kb-curate
Skill125 starsChanged 5 months agoMITView on GitHub
Rules for maintaining a markdown knowledge base (GitMark) — apply when adding, editing, moving, or deleting documentation (.md). A lightweight code-ontology: every document has a type, properties (frontmatter incl. a one-line description and OKF trust fields), and typed links. Keeps the KB structured instead of a pile of files. Use on "add a doc", "record a decision", "update the docs", "reorganize docs".
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 20
If the topic already exists — edit the existing doc, don't create a second one.
- Distinctive: line 47
Not the title again. It is indexed with extra weight and shown in folder indexes.
- Distinctive: line 64
Keep one source: rules in AGENTS.md, CLAUDE.md is only
- Very specific: line 83
If the README has <!-- gitmark:toc --> … <!-- /gitmark:toc -->, don't hand-edit the block: run gitmark toc --write after adding/renaming …
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
kb-curate — how to maintain the knowledge base (GitMark ontology)
Full model: docs/ontology.md. This skill is the operational checklist. Principle:
md+git is the source of truth, with an ontology on top (object types / properties /
links — inspired by Palantir Foundry/Gotham, compatible with Google's Open Knowledge
Format (OKF) frontmatter).
Before writing — search, don't duplicate
python3 <plugin>/skills/kb-search/gitmark.py search "<topic>"
python3 <plugin>/skills/kb-search/gitmark.py query type=<type> --fields path,title # what existsIf the topic already exists — edit the existing doc, don't create a second one.
When ADDING knowledge (CREATE)
- Pick a
node_type:service·reference·runbook·gotcha·decision·plan·guide·report·index. Unsure → spec =reference, how-to =guide. - Put it in the right folder (type → folder): service-specific →
docs/services/<svc>/; cross-cutting →docs/reference/; ops procedure →docs/ops/; plan →docs/plans/; decision →docs/decisions/. - Add frontmatter (min
node_type; for load-bearing docs alsotitle,description,service,status: active,updated: YYYY-MM-DD):--- node_type: runbook title: Deploy the gateway description: "How to roll out (deploy) the API gateway to prod and roll back if healthchecks fail." service: api status: active updated: 2026-06-06 generated: { by: claude-code/<model>, at: 2026-06-06T10:00:00Z } links: documents: [../../scripts/deploy.sh] depends_on: [../reference/architecture.md] ---description— one sentence, 12–30 words, in the words of someone who has not read the doc: the task/symptom it answers + key entities, a synonym where natural. Not the title again. It is indexed with extra weight and shown in folder indexes.generated— when an agent wrote or substantially rewrote the content:{ by: <tool>/<model>, at: <ISO datetime>Z }. A human author:by: human:<id>.verified— only the actor who actually checked the content against reality adds it:verified: [{ by: human:<id>, at: … }]orprocess:<name>. An agent never writeshuman:intoverifiedon its own — that is the whole point of the trust tier. Content changed materially → drop staleverifiedentries.stale_after— for perishable facts (hosts, versions, counts, "current state"): an ISO instant after which the doc must be re-checked.lintflags it (I8).
- Add ≥1 link — to code (
documents/implemented_by) or a sibling doc (depends_on/relates_to). No orphans. Paths are relative to the doc, or start with/for repo-root-relative (OKF style, stable when docs move). - Add a line to the folder's
README.md(its index):- [Title](file.md) — description.
Entry point — AGENTS.md, CLAUDE.md imports it
AGENTS.md is read by Codex, Qwen Code, Cursor and others; Claude Code reads CLAUDE.md.
Keep one source: rules in AGENTS.md, CLAUDE.md is only
# CLAUDE.md
All rules live in `AGENTS.md`; Claude Code imports it below.
@AGENTS.mdAGENTS.md starts with a header: one sentence on what the project is, a link to
docs/README.md, 3–5 rules that hold everywhere, and a short tree of docs/ and the top
code dirs (one line each). When the KB gains a folder or a top dir moves — update that tree.
Found a project with everything in CLAUDE.md? git mv CLAUDE.md AGENTS.md, add the header,
write the import. lint checks it (I9). Full model: docs/ontology.md → Entry point.
Indexes — append-only, built where possible
- A folder
README.mdis an index: noupdated:in it, add new lines at the end of their section, don't reorder.gitmark attrs --writeonce per repo → indexes merge withunion. - If the README has
<!-- gitmark:toc -->…<!-- /gitmark:toc -->, don't hand-edit the block: rungitmark toc --writeafter adding/renaming docs (the line comes fromtitle+description). summary:is read asdescription; a dated snapshot getsstatus: frozenand is not edited.
When EDITING (UPDATE)
- Meaning changed → bump
updated:(andgenerated.atif an agent rewrote it). - Doc is stale →
status: deprecatedand setsupersedes: [old.md]on the replacement. Junk → delete (git keeps history).
When MOVING (reorganizing)
git mv(preserves history), then rewrite every link to it and update the README indexes of both folders.
Always at the end
python3 <plugin>/skills/kb-search/gitmark.py lint # invariants I1–I9
python3 <plugin>/skills/kb-search/gitmark.py lint --baseline origin/main # KB with debt: only "did it grow?"
python3 <plugin>/skills/kb-search/gitmark.py toc --write # if folder READMEs use gitmark:toc blocks
python3 <plugin>/skills/kb-search/gitmark.py secrets # nothing token-shaped in the KB
python3 <plugin>/skills/kb-search/gitmark.py index # rebuild search
python3 <plugin>/skills/kb-search/gitmark.py health # optional: KB scorecardlint flags: missing/broken frontmatter, values outside vocabularies, orphans, broken
links, folder without README, supersedes target still live, typed link to a missing
code path, past stale_after. Fix until clean.
Vocabularies (don't invent values)
node_type: service|reference|runbook|gotcha|decision|plan|guide|report|index (OKF'stype:is accepted as a synonym)status: active|draft|deprecated|archived|frozen (OKFstable= active;frozen— dated snapshot, never edited)- link types: documents|depends_on|supersedes|relates_to|implemented_by|part_of
service: your project's controlled vocabulary. Declare it (and any extra types, statuses, link types) in the frontmatter ofdocs/ontology.md:
Withoutvocab: service: [api, billing, frontend] node_type: [meeting]vocab.service, lint derives it from folder names underdocs/andservices|apps|packages/. Values starting with_(_platform) are sentinels.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

