From memex
Rebuilds per-hub closets indexes for Memex. Use after v1→v2 migration or bulk import to ensure retrieval quality.
How this skill is triggered — by the user, by Claude, or both
Slash command
/memex:reindex [--force] [--hub <hub-name>][--force] [--hub <hub-name>]The summary Claude sees in its skill listing — used to decide when to auto-load this skill
**Wikilink rule:** When referencing any file in markdown, always use `[[filename]]` wikilink format.
Wikilink rule: When referencing any file in markdown, always use [[filename]] wikilink format.
Walk every Tier 2 hub in _MANIFEST.md and (re)generate _CLOSETS.md for each. Session-end refreshes touched hubs incrementally; reindex covers the long tail in one pass.
Picking the right migration tool:
/memex:resummarize. Rewrites manifest + hub summaries to v2 format./memex:reindex. Rebuilds the per-hub closets index used for retrieval.Run resummarize for summary format upgrades, reindex for closets coverage. They're independent; on a fresh v1→v2 migration, run resummarize first, then reindex.
Run WORKSPACE_ROOT=$(pwd) && echo "$WORKSPACE_ROOT" via Bash. Read _MANIFEST.md:
<!-- memex-managed marker: Tell the user "Memex isn't initialized here. Run /memex:init first." and stop.Acquire memory/.reindex.lock and check the 24-hour cooldown in memory/.reindex-runs.log. Both follow the shared bulk-write convention. See ../consolidate/references/locking.md.
Parse $ARGUMENTS:
--hub <name>. Limit to one hub (e.g., --hub fundraising). Useful for spot rebuilds.--force. Rebuild every entry from scratch, ignoring mtime checks. Also bypasses the 24-hour cooldown.Read _MANIFEST.md. For each row in the Hub Map, parse the wikilink in the Hub column:
[[<domain>-index]]. Hub folder = parent of the index file. Closets file: <hub-folder>/_CLOSETS.md.[[<domain>/_CLOSETS]] (v2.1+). Hub folder = the parent folder of the closets file. No index file expected.Resolve absolute paths for each hub folder and its closets / archive. Archive (if any): <hub-folder>/_CLOSETS-archive.md.
Also include memory/ as a synthetic hub. Its closets file is memory/_CLOSETS.md; its files are the Tier 1 files listed in _MANIFEST.md (status, session-log, decisions, glossary, plus any user-added Tier 1 entries). The memory hub has no archive (Tier 1 is a small fixed set, not paginated).
If --hub <name> was passed, filter to that hub. --hub memory reindexes the Tier 1 closets only.
Enumerate the hub's member files:
.md file in the hub folder, excluding _CLOSETS.md and _CLOSETS-archive.md. The folder contents are the canonical members..md files. Union of the two is the canonical member list.In both cases, also flag any files on disk that aren't yet represented in _CLOSETS.md (orphans). Reindex includes orphans by default and surfaces them in the report.
For each file:
/memex:lint reports dangling hub-table entries separately).stat._CLOSETS.md has a current entry (closets file's mtime more recent than the underlying file's) and --force was not passed.For each queued file, read content and write a typed-field closets entry. The format and the eight retrieval-tuned summary rules that drive each field live with session-end:
../session-end/references/closets-format.md../session-end/references/summary-rules.mdReindex applies them verbatim. Do not deviate.
For each hub, after generating entries:
_CLOSETS.md._CLOSETS-archive.md, prepended above existing archive content (never overwrite older archive entries).<!-- memex-closets:1.1 -->._CLOSETS-archive.md is created for the first time, add [[<hub>-CLOSETS-archive]] to the Tier 3 table of _MANIFEST.md._CLOSETS.md listing the top 5 most recently demoted file stems (one line each: [[stem]] — <subjects fragment>, last touched <date>). This keeps the archive's existence and recent contents surfaced in the always-loaded layer without bloating retrieval. Section is purely informational; field-level retrieval still uses the 30 primary entries.If a hub has ≤ 30 files, write only _CLOSETS.md with marker <!-- memex-closets:1.0 --> and no Recently Archived section.
The memory/ hub never paginates (small fixed set). Skip steps 1-6 there; just write all entries to memory/_CLOSETS.md with marker <!-- memex-closets:1.1 -->.
Run ${CLAUDE_SKILL_DIR}/scripts/verify-wikilinks.py against the workspace to confirm no closets entry references a missing file. List broken entries in the report; don't auto-delete.
Then refresh the typed-edge graph (no longer rebuilt at session-end):
${CLAUDE_SKILL_DIR}/scripts/extract-graph.py against the workspace path. It writes memory/.graph.md.Skip if the script is unresolvable. Typed edges are opt-in.
Append to memory/.reindex-runs.log:
YYYY-MM-DDTHH:MM:SS hubs=<N> files=<K> refreshed=<R> skipped=<S> status=<ok|partial>
Clear memory/.reindex.lock. Output:
Memex Reindex Report
Hubs processed: <N>
<hub-name>: <K> files indexed (<refreshed> refreshed, <skipped> already current)
<P> primary entries, <A> archived (if pagination triggered)
...
Orphans found (in folder but not in hub table):
<hub-name>/<file.md> -- consider adding to [[<hub>-index]]
...
Closets issues: [PASS / N dangling references]
...
Total time: <Ts>
Append a one-line entry to memory/session-log.md if Memex is in full mode (skip in compatible mode):
## YYYY-MM-DD - /memex:reindex
- Reindexed <N> hubs, <K> files. <refreshed> refreshed, <skipped> already current.
- <orphans> orphans surfaced; <issues> closet issues to resolve.
---
--hub <name> to scope when iterating._CLOSETS.md and _CLOSETS-archive.md. Orphans surface for user action, not auto-add.--force rebuilds every entry from scratch. Use after a closets format change, or if existing entries look wrong. Otherwise the mtime check is enough._CLOSETS.md may cause some entries to skip on the next reindex. Pass --force if that matters./memex:lint. Reindex is the bulk-write counterpart to lint's read-only audit./memex:resummarize. It operates on manifest and hub summaries, not on closets.npx claudepluginhub skyfox-io/memex --plugin memexRefreshes manifest and hub summaries from v1 topic-based format to v2 retrieval-tuned format that enumerates distinct subjects, names entities, and quotes user-stated facts. Run after large content changes or when upgrading summary format.
Update Knowledge Base indexes. Smart mode detects changes and updates only what's needed. Full rebuild available with --full flag. Use after adding/moving documents or when indexes feel stale.
Rebuild the curated root index + per-type sub-indexes of a cogni-knowledge base on demand, migrate an EXISTING pre-0.0.8 wiki to the curated layout (control files into wiki/meta/, overview folded into the index intro, flat root split into root-map + sub-indexes, schema 0.0.7→0.0.8), or repair drifted machine-owned regions (theme-scoped ROOT-LINKS, schema lag) on a base already >= 0.0.8. Use this skill whenever the user says 'rebuild the index', 'rebuild the knowledge index', 'regenerate the wiki indexes', 'refresh the sub-indexes', 'migrate my wiki to the curated layout', 'upgrade the wiki layout', 'migrate the knowledge base structure', 'repair the knowledge index', 'regenerate the curated front door', 'fix the structural drift', or knowledge-resume / knowledge-health surfaces a schema_version < 0.0.8 migration nudge or a structural-drift verdict.