/buddy:consolidatefrom buddy
Runs a four-phase memory consolidation pipeline: identifies near-duplicates, stale entries, tag-clusters, and contradictions, then presents a dry-run plan for user approval before applying changes. Accepts a specialist alias, common, all, or subcommands apply/revise/cancel.
Ships in buddy. Installing the plugin adds it to Claude Code.
You are running memory consolidation. The argument passed by the user is $ARGUMENTS.
Trim the argument. Cases:
active_specialists from session state) plus their common/ overlap. If active_specialists is empty, print → no active specialists. Use /buddy:summon first, then /buddy:consolidate. and stop.apply, revise, cancel: skip to Step 6 (sub-command routing).summon.md. If unresolved or ambiguous, print the table and stop. Special targets:
common → operate on the common/ bucket; judged by each currently-active specialist in turn.all → every specialist directory under each channel root. Confirm before proceeding: print → this will consolidate every specialist's memories — type /buddy:consolidate all confirm to proceed. Only the literal argument all confirm proceeds.Use the existing helpers from scripts/memory.py:
python3 -c "
import sys
sys.path.insert(0, '${CLAUDE_PLUGIN_ROOT}')
from pathlib import Path
from scripts import buddy_paths
print(buddy_paths.global_memory())
" 2>&1
Global channel: ${BUDDY_HOME:-~/.buddy}/memory/. Project channel: <cwd>/.buddy/memory/ if it exists.
For each (channel, specialist) pair, run Step 3.
python3 -c "
import sys, json
sys.path.insert(0, '${CLAUDE_PLUGIN_ROOT}')
from pathlib import Path
from scripts.consolidate import find_candidates, render_brief
cand = find_candidates(Path('<channel-root>'), '<specialist>')
print(render_brief(cand))
"
Substitute <channel-root> and <specialist> with the resolved values. Capture stdout — that is the brief.
If every category is empty (no slug groups, no clusters, no stale, no contradictions, no orphans), print → <specialist> in <channel>: nothing to consolidate. and skip to next pair. Do not invoke the specialist.
For the resolved specialist, the specialist must already be summoned (or you summon it first via /buddy:summon <specialist> — but only with explicit user consent on this turn; do not auto-summon).
Inject (verbatim) into the active turn:
mcp__codescout__read_markdown (preferred) or Read.${CLAUDE_PLUGIN_ROOT}/data/consolidation-protocol.md.Then say to the specialist:
Emit your consolidation plan as a YAML fenced code block per the protocol's required schema. Nothing else in your response will be parsed.
Wait for the specialist to respond.
Extract the first yaml fenced code block from the specialist's response. Pass it to the parser:
python3 -c "
import sys
sys.path.insert(0, '${CLAUDE_PLUGIN_ROOT}')
from pathlib import Path
from scripts.consolidate import parse_plan
plan_text = open('<temp-plan-file>').read()
plan = parse_plan(plan_text)
import json; print(json.dumps(plan, default=str))
"
If parsing raises ValueError, report → specialist plan was unparseable. Raw response saved at <temp-plan-file>. Run /buddy:consolidate revise <feedback> to retry. and stop.
If parsing succeeds, write the rendered plan markdown to <channel-root>/.consolidation-plan.md (this file is what the user reviews). Render via render_plan_for_user(plan) (filled in Task 12).
Also write the raw YAML plan (the same string parsed by parse_plan) to <channel-root>/.consolidation-plan.yaml. This is what apply_plan_from_cache re-parses. The .md file is for humans; the .yaml file is for the script.
For Tasks 1–11, until render_plan_for_user is wired, stash the raw YAML at the cache path and announce: → dry-run plan cached at <path>. /buddy:consolidate apply | revise <text> | cancel.
If the argument is apply, run:
python3 -c "
import sys
sys.path.insert(0, '${CLAUDE_PLUGIN_ROOT}')
from pathlib import Path
from scripts.consolidate import apply_plan_from_cache
result = apply_plan_from_cache() # walks every channel for plan files
print(result)
"
If the argument is revise <text>, re-run Steps 3–5 with the user's feedback appended to the brief sent to the specialist. The text after revise is the feedback. Append a section ## User feedback (consider before plan) containing the text verbatim.
If the argument is cancel, delete every .consolidation-plan.md under both channel roots and announce.
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
npx claudepluginhub mareurs/claude-plugins --plugin buddy12 commands in this plugin
/checkStep 1 — Load state and identityAsk your buddy bodhisattva to observe the session and reflect on its mood and signals (hatches it on first use)./createbuddy:createCreate a new buddy specialist (global or project scope; builtin is frozen). Brainstorms with the user, drafts from the canonical skill template, previews what /buddy:summon will load (template + memory protocol + gates), then writes. Discovery is path-scan — no registration step needed. The argument is a freeform hint (e.g. "buddy for X", "buddy for X project") or empty./dismissStep 1 — Resolve the targetYou are releasing one or all summoned specialists. The argument passed by the user is `$ARGUMENTS`./focusStep 1 — Resolve the sessionYou are handling a /buddy:focus request. The argument is `$ARGUMENTS`./installStep 1 — Detect sibling pluginsYou are installing the buddy statusline into the user's Claude Code settings./introspectbuddy:introspectRun mid-session introspection on one or all currently summoned specialists. Unlike `/buddy:dismiss`, the specialist stays active afterward. Pass a specialist name to introspect just that one (e.g. `/buddy:introspect hamsa`); pass nothing to introspect all active.Other plugins' commands for the same job