---
name: consolidate-memory
description: Find duplicate or overlapping memories and patterns and propose merges — a review draft only, sources are never edited
---
<!-- generated by tools/build-codex-plugin.js from plugin/; edit the source there, not this file -->

> Host: Codex CLI, through the `agenticos` plugin. Invoke as `$agenticos:consolidate-memory`. `<plugin root>` is the plugin's folder, two levels above the folder that holds this SKILL.md; the `aos` launcher is `<plugin root>/bin/aos`. The tools of the `agenticos` MCP server are named `mcp__agenticos__<tool>`.

Produce a memory consolidation draft:

1. Bash: `aos consolidate-memory the text the user wrote after `$agenticos:consolidate-memory`` (fallback: `sh "<plugin root>/bin/aos" consolidate-memory the text the user wrote after `$agenticos:consolidate-memory``). Without `--local` it prints a `<<<AOS_CONTEXT feature=consolidate-memory>>> … <<<END>>>` block listing candidate clusters with their file contents and the draft format.
2. Write the proposal (one section per cluster: keep / merge into / delete, with the merged text) to a temp file and persist it with `aos consolidate-memory --write <file>`; it lands at `brain/_index/memory-consolidation.md`.
3. Remind the user it is a proposal; no source file was modified. Offer to execute specific sections on request, never by deleting a file:
   - Merge 2–6 memories into one: `aos memory merge-draft <path> <path>… --estimate --json` prints, with no model call, the memory that keeps its path and links (`winner`, the oldest) and each file's hash in order (`baseHashes`). Once the user approves the merged text, `aos memory merge <path> <path>… --into <json> --expect <hash>,<hash>… --json` (`--into` is one argument: a JSON object with exactly `title`, `description` and `body`) writes it over the oldest, supersedes the others by it and leaves one `MEMORY.md` line. It refuses, writing nothing, when a file changed since its hash. `aos memory unmerge <winner> --expect <the hash merge printed> --json` undoes it for 30 days.
   - Retire a duplicate with `aos memory supersede <path> --by <kept path>` and a dead memory with `aos memory archive <path>`; `aos memory restore <path>` undoes either.
4. Tell the user the Brain tab does this with cards: Health → **Consolidation sweep** (or `aos memory sweep --json` in a session; `aos memory sweep <path>… --json` for up to 50 memories) asks Claude Code or Codex for merge, archive and retitle suggestions, each saying why. A card changes nothing until the user acts on it, and then applies through the same `aos memory` verbs: Merge opens the merge dialog, Archive and Retitle ask first, and Dismiss hides it for good.
