/memex:consolidate [--fix] [--force]from memex
Sweeps workspace for drift: duplicate files, unannotated decision supersessions, orphans, and bloated logs. Read-only by default; --fix applies safe annotations only.
Ships in memex. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Wikilink rule: When referencing any file in markdown, always use [[filename]] wikilink format.
Independent drift sweep that session-end deliberately doesn't do. Four phases run in order: dedup, decisions contradictions, orphans, decisions compression. Read-only by default; --fix only applies safe annotations.
Run WORKSPACE_ROOT=$(pwd) && echo "$WORKSPACE_ROOT" via Bash. Confirm _MANIFEST.md exists; if not, tell the user to run /memex:init and stop.
Acquire memory/.consolidate.lock and check the 24-hour cooldown in memory/.consolidate-runs.log. Both follow the shared bulk-write convention. See references/locking.md.
Detect candidate duplicate files:
.md files in domain folders. Skip memory/, scratch/, .git, .obsidian, .claude, memex.[[targets]] cited inside) overlap by ≥ 80%.Output but do not auto-merge. Dedup is user-confirmed always. --fix does not auto-merge files.
Read decisions.md. Scan newer entries for explicit override language referencing earlier entries:
supersedes, replaces, dropped, no longer, instead of, reverses, overrides
For each match:
~~strikethrough~~ and (superseded YYYY-MM-DD).If unannotated:
(superseded <date>) marker."With --fix: Apply the strikethrough + supersession marker automatically. Same logic as /memex:lint --fix's decision-consistency annotation.
This is keyword-explicit detection only. Don't infer contradictions from topical similarity. False positives are louder than false negatives in a write-back operation.
Three sub-checks.
Run ${CLAUDE_SKILL_DIR}/scripts/verify-wikilinks.py against the workspace. Report broken wikilinks. With --fix, do nothing. Broken wikilinks need user judgment.
Run ${CLAUDE_SKILL_DIR}/scripts/extract-graph.py against the workspace.
First run with --check to surface dangling edges (typed references to missing files). Report each.
Then run without --check to rewrite memory/.graph.md with the current graph state. Consolidate is the regular refresh point for the graph (along with /memex:reindex); session-end no longer does this.
Skip both if the script is unresolvable. Typed edges are opt-in.
For each domain in the Hub Map: list .md files on disk that aren't in the hub's table (excluding the hub index itself, _CLOSETS.md, and _CLOSETS-archive.md). These are files dropped in the folder without being wired up.
With --fix, propose adding them to the hub. Don't auto-add. Wikilink summaries need user/agent judgment.
Read decisions.md. If it has fewer than 60 lines, skip this phase entirely (no pressure on the 100-line cap).
Otherwise, scan the file for compression candidates by these concrete rules:
For each ~~strikethrough~~ entry annotated (superseded YYYY-MM-DD), check whether the superseding entry exists later in the file and stands on its own. If yes, the strikethrough entry is now redundant detail.
With --fix: Replace the original verbose strikethrough entry plus its superseder with a single one-line summary:
**YYYY-MM-DD** - <new fact>; replaces <old fact> (was <YYYY-MM-DD>)
Without --fix: list the candidate pairs and the proposed merged form.
Group consecutive entries by ISO week (Monday-Sunday). For each week with ≥3 entries about overlapping topics (≥50% subject overlap based on noun matches in the entry text), the cluster is a candidate.
With --fix: Combine into one entry with sub-bullets, preserving every unique fact:
**YYYY-MM-DD–YYYY-MM-DD** - [topic]
- <fact 1 verbatim>
- <fact 2 verbatim>
- <fact 3 verbatim>
Without --fix: list candidate clusters and proposed combined form.
Compression preserves every unique fact. If two entries say the same thing differently, keep the clearer one verbatim. If they say different things, keep both as sub-bullets. Never paraphrase. Never drop a fact because it "feels redundant" — the test is "would re-reading this in 6 months recover the same retrieval signal?"
If decisions.md is at or above 95 lines and --fix is not set, surface a hard warning in the report: "decisions.md at lines; approaching 100-line cap. Run /memex:consolidate --fix to compress."
Append to memory/.consolidate-runs.log (format in references/locking.md):
YYYY-MM-DDTHH:MM:SS dedup=<N> decisions-contradictions=<M> orphans=<K> decisions-compressed=<D> status=<ok|partial>
Clear memory/.consolidate.lock.
Memex Consolidation Report
DEDUP: [PASS / N candidate groups]
[...]
DECISIONS CONTRADICTIONS: [PASS / N unannotated pairs]
Old: <text> -- New: <text> -- fix: add ~~strikethrough~~ + (superseded YYYY-MM-DD)
[...]
ORPHANS: [PASS / N files]
Wikilinks: [N broken / CLEAN]
Typed-edge graph: [N dangling / CLEAN]
Hub orphans: [path - "fits domain X" if known]
[...]
DECISIONS COMPRESSION: [PASS / N candidates / N applied]
decisions.md: [N] lines
Supersession pairs: [count]
Same-period clusters: [count]
[...]
Last run: [from .consolidate-runs.log]
End with: Run /memex:lint for the per-check live report at any time.
references/locking.md.--fix only annotates explicit decision supersessions (newer entry literally references the older with "supersedes/replaces/dropped/no longer/instead of/reverses/overrides"). Anything ambiguous waits for the user.--fix is for safe annotations only.decisions.md approaches the 100-line cap./memex:reindex. For summary format upgrades, run /memex:resummarize. Consolidate doesn't rebuild closets or summaries.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
workspace-drift, knowledge-base, dedup, decision-management, consolidation, memex
npx claudepluginhub skyfox-io/memex --plugin memex17 skills in this plugin
/add-domainAdds a new domain folder with a hub index and wires it into `_MANIFEST.md` -- for a new topic area, or splitting an existing domain into its own folder.
/archiveMoves a file from active (Tier 2) to archived (Tier 3) so Memex stops loading it automatically -- for a wrapped project, a stale reference, or a superseded file. The file stays on disk; only its manifest tier and hub status change.
/cross-searchTrigger when the user's question spans multiple Memex workspaces and they don't know which one holds the answer, or they ask "have I written about X anywhere?". Not for questions the current workspace can answer -- use `/memex:search` instead. Reads only manifests and closets, never inside individual files.
Other plugins' skills for the same job