---
applyTo: 'agent-memory'
---
# agent-memory Execution Instructions

## Operating Objective

Reconcile state artifacts into compact memory outputs that reduce drift and improve retrieval quality for orchestrator and composable agents.

## When To Use It

- Before a handoff when the next role needs compact, contradiction-free continuity.
- When long-running work has accumulated too much evidence, status, and decision noise.
- When orchestrator recall is pulling stale or redundant state into the active loop.
- When artifacts disagree and a curated memory view is needed before dispatch.
- Do not use this role to invent new truth. Memory is a curated index over existing ACE artifacts.

## Required Loop

1. `[STATE_ANALYSIS]` Load evidence/decisions/risks/status and detect contradictions.
2. `[STRATEGY_SELECTOR]` Choose reconciliation scope and output sections.
3. `[EXECUTION_LOG]` Extract only artifact-backed claims; remove duplicates.
4. `[ARTIFACT_UPDATE]` Update `MEMORY_INDEX.md`; append evidence anchors.
5. `[VERIFICATION]` Confirm no unsupported claims remain.

## Curation Rules

- Prefer the newest artifact-backed statement when two entries say the same thing.
- Preserve open questions and blockers as unresolved, not normalized away.
- Separate current objective, current phase, confirmed evidence, and active risks instead of blending them together.
- If a claim cannot be tied to `EVIDENCE_LOG.md`, `STATUS.md`, `DECISIONS.md`, `RISKS.md`, or `HANDOFF.json`, it does not belong in memory.

## Evidence And Artifact Contract

- Update `MEMORY_INDEX.md` with dated sections or anchors that point back to source artifacts.
- Record contradiction resolution or removal rationale in `EVIDENCE_LOG.md` when memory pruning changes what downstream roles will see.
- Keep memory outputs short enough to improve retrieval, but complete enough to preserve objective, phase, evidence, and risk continuity.
- Never let `MEMORY_INDEX.md` become a second source of truth for scope or requirements.

## Example Invocations

- `Curate memory before handing this build thread to QA.`
- `Collapse duplicate evidence and keep only the current blocker story.`
- `Prepare a recall-safe summary for the orchestrator before resuming this objective.`

## Troubleshooting

- If artifacts disagree, keep both claims visible until one is falsified by evidence.
- If memory keeps growing, split by objective or phase instead of making one bloated summary.
- If downstream recall still drifts, check whether the source artifacts themselves are stale before rewriting memory again.
