How this skill is triggered — by the user, by Claude, or both
Slash command
/engram:consolidateThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
<!-- SPDX-License-Identifier: AGPL-3.0-only -->
Audit knowledge directories and Claude Code auto memory for stale, misplaced, or duplicated content. Produce an editable plan file the user reviews, then execute approved actions. Designed to complement, not replace, native auto-memory: this skill never modifies MEMORY.md directly and never deletes auto-memory entries — it focuses on graduation (promoting stable entries to permanent rules) and on knowledge directories outside auto-memory's scope.
Native Claude Code auto memory writes implicit learnings to ~/.claude/projects/<project>/memory/. This skill complements it:
| Concern | Native auto memory | consolidate (this skill) |
|---|---|---|
| Capture implicit learnings | Yes | No — defer to native |
Maintain MEMORY.md index | Yes (manual edits via /memory) | No — never modify directly |
| Graduate feedback → rules / CLAUDE.md | No | Yes — primary responsibility |
| Audit project knowledge directories | No | Yes — user-declared scan roots |
| Manage staging-directory lifecycle | No | Yes — age-based classification |
| Detect stray operational knowledge | No | Yes |
Do not:
DELETE or ARCHIVE for files inside ~/.claude/projects/<project>/memory/. Use the RULES or CLAUDEMD actions to graduate stable entries; deletion of the source file then happens as part of graduation, not as cleanup.MEMORY.md.Before scanning, the skill needs a list of knowledge directories to inspect. If the user has not declared scan roots in their project's CLAUDE.md or in conversation, ask them. Sensible defaults to suggest:
.memory/
docs/
outputs/ # or whatever the project uses for staging
archive/ # or whatever the project uses for archive
~/.claude/projects/<project>/memory/
Skip these directory patterns unconditionally:
.git/ node_modules/ .venv/
.claude/ dist/ build/
*.pdf *.docx *.xlsx # binary files — no content analysis
If a directory the user named does not exist, surface that in the report rather than failing silently.
| Command | Purpose |
|---|---|
/consolidate or /consolidate scan | Full audit: scan all declared knowledge dirs, generate plan file |
/consolidate staging | Quick triage of one designated staging directory with age classification + destination prompts (inline report, no plan file) |
/consolidate execute | Read the user-edited plan file and execute approved actions |
/consolidate status | Inline health summary: file count and age per declared directory, stray count |
Walk each declared scan root recursively. Collect: path, age, size, content summary. Skip the unconditional-skip patterns above.
Auto-memory files (~/.claude/projects/<project>/memory/) use graduation-only classification:
MEMORY.md or any lock file → KEEP (auto-memory infrastructure — never touch)RULES or CLAUDEMD (graduate)DELETE (only after asking the user — graduating these to a finished-work archive is often better)KEEPAll other files use the general classification (evaluate in order; first match wins):
.DS_Store, .gitkeep) → DELETEDELETE or ARCHIVEDELETEDELETE if >30 days, ARCHIVE if ≤30 daysMOVEDOCS, RULES, CLAUDEMD, or SKILLKEEPA "stray" is operational knowledge (methodology, decisions, planning, standards, patterns, workflows) found outside the declared scan roots. Heuristics for "operational":
guide, plan, strategy, standard, pattern, workflow, decision, adrSkip directories that legitimately hold non-operational content (project deliverables, raw input data, execution logs, meeting records, the .claude/ configuration tree). When in doubt, surface in the report and let the user classify rather than guess.
Write a plan to a path the user has designated for staging output (or <scan-root>/plans/consolidate-plan-YYYY-MM-DD.md if undeclared) using the template at ${CLAUDE_SKILL_DIR}/templates/plan-template.md. The plan is editable: the user changes the Action column to approve, override, or skip each row before running execute.
| Code | Effect |
|---|---|
DELETE | Remove permanently |
ARCHIVE | Move to the project's archive directory with mirrored source path |
DOCS | Move to the project's docs/ |
MEMORY | Move to the project's .memory/ |
RULES | Move to .claude/rules/ |
CLAUDEMD | Incorporate into CLAUDE.md (present diff, require explicit approval) |
SKILL | Move into a skill directory under .claude/skills/ |
MOVE | Relocate (destination given in the Reason column) |
KEEP | No action |
SKIP | Defer decision |
/consolidate execute)KEEP or SKIP.MOVE, ARCHIVE, DOCS, RULES, SKILL). Prevents data loss when a path appears in both a move and a delete row.CLAUDEMD rows present a proposed diff and require an explicit yes before applying./consolidate staging)A focused, quick-check variant for a single designated staging directory. Produces an inline report — no plan file. Age thresholds:
| Age | Status | Default action |
|---|---|---|
| <7 days | Current | None |
| 7–30 days | Aging | Suggest a permanent destination |
| >30 days | Stale | Suggest archive or move |
For each file the user wants to act on, prompt for the destination. Do not guess destinations unless the user has declared a destination map in conversation or CLAUDE.md.
/consolidate status produces inline text only: file count and age per declared directory, stray count with up to three example paths.
| Condition | Response |
|---|---|
| No scan roots declared and user declines to declare | Print the request, exit cleanly |
| A declared scan root does not exist | Note in report, continue with the rest |
| Plan file already exists for today | Overwrite; note "overwrote earlier plan from today" |
| Designated staging directory empty | "No files found. Nothing to triage." |
| Designated staging directory missing | "Staging directory does not exist." |
${CLAUDE_SKILL_DIR}/references/directory-registry.md — common knowledge-directory patterns and exclusion rules${CLAUDE_SKILL_DIR}/templates/plan-template.md — plan file scaffoldCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub backchainai/backchain-plugins --plugin engram