/index-rebuild
Rebuild the project index, optionally targeting a specific module with custom instructions.
Usage
code
/index-rebuild Full rebuild (all modules + index) /index-rebuild --module MacroMan-Tracking Rebuild only Tracking README + update index /index-rebuild --module MacroMan-Tracking --m "Focus on TrackState machine transitions"
Step 1: Parse arguments
Parse $ARGUMENTS for:
- •
--module <name>— target a specific module (optional) - •
--m "<instructions>"or--m <instructions>— custom emphasis instructions (optional)
If no arguments: full rebuild of all modules.
Step 2: Announce
If --module specified:
Say: "Rebuilding index for module: <name>"
If full rebuild:
Say: "Rebuilding complete project index..."
Step 3a: Targeted rebuild (--module specified)
- •Verify the module directory exists. If not, list available modules and ask user to pick one.
- •Scan the module:
- •List files with
git ls-files <module>/(or Glob fallback) - •Read interface/header/export files for public API
- •Extract dependencies from build files (CMakeLists.txt, package.json, Cargo.toml, etc.)
- •Generate tags from file names, class names, function names
- •List files with
- •Read existing
<Module>/README.md - •Preserve the
<!-- CUSTOM -->section content - •Regenerate the
<!-- AUTO-GENERATED -->section using the same template as /index-init Step 3 - •If
--minstructions provided:- •Use them to guide emphasis in the README generation (what classes to detail, what patterns to document)
- •Save the instructions in the CUSTOM section as:
**Index instructions**: <instructions>
- •Write the updated README
- •Update
.claude/index.md:- •Update the module's row in the Modules table
- •Update the Tag Index for this module's tags only
- •Regenerate
.claude/index.summary.mdfrom.claude/index.md(keep under 4KB)
Step 3b: Full rebuild (no --module flag)
Perform the same steps as /index-init Steps 2-4, but:
- •PRESERVE all
<!-- CUSTOM -->sections in existing READMEs - •PRESERVE the
<!-- CUSTOM -->section in.claude/index.md - •Do NOT re-add the CLAUDE.md section if it already exists
- •Do NOT modify hooks (they're managed by the plugin)
Step 4: Report
Summarize:
- •Modules rebuilt (count or specific name)
- •Files indexed
- •Tags updated
- •Custom instructions applied (if --m was used)
If targeted rebuild, suggest: "Run /index-status to verify the rebuild."