| name | consolidate |
| description | This skill should be used when the user asks to "consolidate memory", "merge the log checkpoints", "run consolidation", invokes /tm:consolidate, or accepts the SessionStart nudge reporting unconsolidated log checkpoints. Dispatches the tm-archivist agent to merge project log/ checkpoints into durable notes and MEMORY.md, refresh the index, and prune consolidated logs. |
tm — consolidate log checkpoints into durable memory
Guard (run first, always)
Run ${CLAUDE_PLUGIN_ROOT}/scripts/tm-guard.sh "$PWD" and read its KEY=VALUE output.
If TM_STATUS is not OK, stop and follow the repair flows in <MEMORY_DIR>/references/bootstrap.md
(if the store does not exist yet, the same file ships in the plugin at
${CLAUDE_PLUGIN_ROOT}/references/bootstrap.md). Do not continue until the guard prints
TM_STATUS=OK. Keep MEMORY_DIR, PROJECT_ID, and PROJECT_PATH for the steps below.
Steps
-
Scope check. Consolidation is project-scoped (global has no log/). If
PROJECT_EXISTS=false, there is nothing to consolidate — stop and follow the
project-creation flow in bootstrap.md.
-
Measure the backlog — pure filename comparison, zero parsing. Read last_consolidated
from <MEMORY_DIR>/<PROJECT_PATH>/INDEX.md frontmatter, then list
<MEMORY_DIR>/<PROJECT_PATH>/log/. A checkpoint is unconsolidated when its
YYYY-MM-DD-HHMM filename prefix sorts lexicographically after the stamp (never means
every checkpoint counts). If the count is zero, report "nothing to consolidate" — for
note-staleness review point the user at /tm:retro (a Claude-Code-only flow; on Codex,
direct the user to run the retrospective from Claude Code) — and stop.
-
Confirm — always proposed, never silent. Report the unconsolidated-checkpoint count and
confirm via AskUserQuestion (consolidate now / cancel) before anything is dispatched. The
pass moves consolidated log/ files to log/archive/ and (own-repo stores) lands a store
commit; never start it without this confirmation — including when this skill auto-triggered
from the SessionStart nudge or a description match. On cancel, stop.
-
Dispatch tm-archivist in the background via the Task tool. Consolidation is bulk work;
never run it in the main context when agent dispatch is available. Pass exactly the agent's
input contract in the prompt:
mode: consolidate
memory_dir: <MEMORY_DIR>
project_path: <PROJECT_PATH>
project_id: <PROJECT_ID>
The consolidation procedure (merge → supersede → archive logs → index refresh → stamp bump →
store commit → ≤5-line report with global-promotion candidates) is authoritative in
<MEMORY_DIR>/references/consolidation.md (if the store's copy is missing, the same file
ships in the plugin at ${CLAUDE_PLUGIN_ROOT}/references/consolidation.md), which the
archivist follows — do not restate or override it here.
-
Relay the report to the user (≤5 lines).
-
Promotion gate (main thread). For each candidate in the report, confirm with
AskUserQuestion (promote / skip). On confirmation, run the /tm:promote flow for that
note. Global memory is never written without this explicit confirmation.
Codex fallback
- No AskUserQuestion → confirm step 3 in plain text ("N checkpoints to consolidate — proceed?
yes/no") and wait for an explicit "yes"; likewise confirm each step 6 promotion candidate in
plain text before promoting.
- No background agents → after the confirmation, run the procedure in
<MEMORY_DIR>/references/consolidation.md (if the store's copy is missing, the same file
ships in the plugin at ${CLAUDE_PLUGIN_ROOT}/references/consolidation.md) inline in the
main thread instead of step 4 (inputs: memory_dir, project_path, project_id from the
guard), then continue at step 5 with its ≤5-line report.
Additional resources
<MEMORY_DIR>/references/consolidation.md — the authoritative consolidation procedure
(if the store's copy is missing, the same file ships in the plugin at
${CLAUDE_PLUGIN_ROOT}/references/consolidation.md).
<MEMORY_DIR>/references/note-format.md — note frontmatter and Gist convention.
<MEMORY_DIR>/references/index-format.md — index row format and last_consolidated stamp.