A Second Hook Keeps the Indexes Honest
After every write to context-v/, the plugin checks that the doc and its folder are listed in their indexes, and tells the agent the exact lines to add.
Why Care?
A doc that isn't in an index is hard to find. People browsing context-v/ miss it, OKF tools skip it, and the next agent session doesn't know it exists. The skill already said to add each doc's line to its folder's index.md, but agents kept forgetting the step above that: listing a new folder in context-v/index.md. It happened today in two repos, and the user had to point it out.
A rule that gets forgotten even part of the time belongs in a hook.
What's New?
hooks/check-index.py, run after everyWrite,EditorMultiEditto a doc undercontext-v/. It checks two exact rules:the doc's folder has an
index.mdthat links the docevery folder between the doc and
context-v/is linked from its parent'sindex.md
When something's missing, it tells the agent the lines to add, using the doc's own
titleanddescription(orlede):TEXTcontext-v index out of date. Add these lines (keep each description to one plain sentence): context-v/notes/index.md (create it, with frontmatter `type` set to the folder name in Train-Case): * [My Note](My%20Note.md) - A short note. context-v/index.md: * [Notes](notes/) - <what this folder holds>It never edits an index. The description line is the agent's to write, and like the frontmatter check, it lets a write through if anything unexpected goes wrong.
Audit a whole tree:
python3 hooks/check-index.py --all path/to/context-vlists every missing line and exits 1 if there are any. Use it in CI, a pre-commit hook, or a subagent's sweep.The skill's checklist now names the folder line in
context-v/index.mdas part of adding a doc.
Under the hood
Scope matches the frontmatter check:
*.mdundercontext-v/, skippingextra/,agent-skills/and the reservedREADME,index,logandconfigfiles.A link counts in any common form:
File.md,./File.md,File%20Name.md,<File Name.md>, andfolder/orfolder/index.md.Its first audit run, on four repos in the Lossless tree, found one real gap: a
blueprints/folder with noindex.md.
What's Next?
This reaches installed plugins with the next release. The version in plugin.json is still 0.4.0.
