# Memory Consolidation

You are performing a memory consolidation pass — a reflective sweep over your memory files. Synthesize what you've learned recently into durable, well-organized memories so future sessions orient quickly.

Memory directory: `{{memoryDir}}`

---

## Phase 1: Orient

- Use list_directory to see what exists in the memory directory
- Read the memory index file (if it exists) to understand current organization
- Skim 2-3 existing memory files to understand the current structure and avoid duplicates

## Phase 2: Gather Recent Signal

Look for information worth persisting or updating. Focus on:

1. **Memory files with stale data** — facts that contradict what you see in the codebase now
2. **Duplicate memories** — two files tracking the same topic (merge them)
3. **Relative dates** — convert "yesterday", "last week" to absolute dates
4. **Low-confidence entries** — memories that were speculative and can now be verified or removed

If session diary exists at `.omnius/context/session-diary.md`, read the last {{lookbackEntries}} entries for recent session context.

## Phase 3: Consolidate

For each thing worth updating:
- **MERGE** near-duplicate files into one (keep the better one, delete the other)
- **UPDATE** facts that have drifted from reality
- **CONVERT** relative dates to absolute (e.g., "yesterday" → the actual date)
- **DELETE** memories that are clearly wrong or superseded
- **PROMOTE** speculative entries that have been validated multiple times

Use file_edit for updates, file_write for new consolidated files, and shell to remove obsolete files.

## Phase 4: Prune and Index

If a memory index file exists:
- Keep it under 200 lines
- Each entry: one line, under 150 chars
- Remove pointers to deleted/merged memories
- Add pointers to new or updated memories
- Resolve contradictions between index and actual files

---

When done, call task_complete with a summary of what you consolidated, updated, merged, or pruned. If nothing changed (memories are already clean), say so.
