MAINTAINING — keep the tools-registry fragment set (and this skill) current
The "sub-skill": the protocol for updating docs/context/ fragments after code changes. Read it when
running /tools-registry-context sync. (This system was scaffolded by the global codemap skill.)
Scope boundary (read first)
This skill documents only docs/context/. Session handoffs and plans live elsewhere (e.g.
.context/) and are explicitly not part of the fragment set — never read them as input, fold them
into a fragment, or sweep them into the index. build-map.py walks docs/context/ only, by design.
The mental model
docs/context/**/*.md ← the fragments (SOURCE OF TRUTH; human-browsable, versioned)
frontmatter: title / status / sources: [...] / related: [...]
│ scripts/build-map.py reads all frontmatter + fragments.config →
▼
docs/context/README.md (human index, grouped by category)
.claude/skills/tools-registry-context/MAP.md (source file → fragment, for routing + drift)Edit fragments, never the generated files (they carry a "GENERATED" banner and are overwritten).
Sync workflow
- Scope: default range
origin/main..HEAD. Override with an explicit range if needed. - Detect drift:
bash .claude/skills/tools-registry-context/scripts/drift.sh [range]→ (a) changed source → documenting fragment(s); (b) changed source with no fragment. - For each affected fragment: read it +
git diff <range> -- <file>; update prose; re-grep moved cited symbols still exist (grep them); add new files tosources:. Citations are symbols, not line numbers, so an unrelated insert elsewhere does NOT make this fragment drift — only a genuine behavior/rename change does. (This is why sync stays fast.) - For gaps: fold into an existing fragment (+
sources:), or write a new fragment fromfragment.md.tmplin the right category folder (~70–130 lines, cited, present-tense). - Show before applying. Get user approval; apply only what's approved.
- Regenerate:
python3 .claude/skills/tools-registry-context/scripts/build-map.py— warns on any fragment missing frontmatter (exit 1). Fix before committing. - Commit with the code.
docs(context):scope; follow the repo's commit conventions.
Fragment conventions (must hold for the tooling)
- Frontmatter required on every fragment:
title,status(shipped | reference | foundational | living | archived | backlog),sources:(repo-relative;[]for narrative/reference),related:(other fragment paths). - Categories = subfolders under
docs/context/, ordered/labeled infragments.config. - One subsystem per fragment. Split anything past ~150 lines.
Evolving this skill / config
- New category → add
{dir,label}tofragments.configcategories(controls index order + heading). - New source area → add a pathspec to
source_globs(and extension tosource_exts) in the config. - Pull upstream script improvements → re-run
codemapinrefreshmode (re-copiesbuild-map.py/drift.shfrom the global skill without touching your fragments or config). - Keep
SKILL.mdthin (a router). Detail belongs here or in fragments.