Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx agentmods add instructions/pdgit12/knitbrain/claude-mdgit clone --depth 1 https://github.com/PDgit12/knitbrainWhat it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5 | $0.00892 | $0.00892 |
| Opus 5 | $0.00446 | $0.00446 |
| Sonnet 5 | $0.00178 | $0.00178 |
| Haiku 4.5 | $0.00089 | $0.00089 |
Grade C, and why
knitbrain CLAUDE.md scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Recursive force deletehighDestructive command
rm -rf with a variable or a broad path is one typo away from removing the wrong tree.
Always `rm -rf dist && npm run verify` before claiming green — stale dist masks build-order bugs. Local rebuild note: `build` re-chmods the three dist entrypoints (a globally symlinked install breaks otherwise). How it starts
The opening of the file, as written. The whole thing — 66 lines — stays where its author put it; the contents beside it link to each section on GitHub.
knitbrain
TypeScript project (Node ≥18, ESM, vitest). This repo IS the knitbrain product — if a knitbrain MCP server is connected while developing here, note it runs the globally installed build, not your working tree; rebuild + reinstall (npm run build && npm install -g .) and reconnect to test local changes.
Session start
First action: call knitbrain_load_session — returns last handoff, top learnings, false positives. If it reports unfinished work, resume that first.
Adherence gate: close-the-loop writes (knitbrain_record_learning, knitbrain_skill_save, knitbrain_save_handoff) are blocked until knitbrain_classify_task/knitbrain_run ran this session (KNITBRAIN_STRICTNESS, default block).
Tool surface highlights (37 tools)
knitbrain_verify_claim— settle a codebase claim before LEARN. Caveat: the session MCP roots at the launch cwd — settle knit-brain facts by source + tests + built dist when the root is elsewhere.knitbrain_self_check— keystone: audits all four invariants (anti-sycophancy, anti-stale, anti-drift, adherence) in one PASS/FAIL pass.knitbrain_run_loop— one judge→iterate cycle per call; yourverify_cmdis the hard gate.knitbrain_search_code— retrieval layer: query → ranked function-level chunks + graph-related files, score-gated. Search BEFORE reading; knitbrain_read only the hits.knitbrain_read/knitbrain_optimize/knitbrain_retrieve— compression loop; exact original always one retrieve away. Data-tool JSON responses are never skeletonized (machine contract).- Note: big tool responses may come back skeletonized with a trailing
⟨recall:hash⟩— strip it before JSON-parsing a tool result.
Project Map
Entry points: dist/lib.js, dist/index.js, dist/proxy/index.js, dist/hooks/index.js, src/index.ts
High-fanout (change carefully): src/ccr/store.ts, src/tokenizer.ts, src/engine/feedback.ts, src/engine/memory.ts, src/engine/knowledge.ts — check knitbrain_query_dependents before touching.
Largest: src/mcp/tools.ts, scripts/production-audit.mjs, src/learn.ts
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago First seen · 66 lines · 892 tokens per session scan C 4d9447244c54
knitbrain CLAUDE.md is an instructions file published in the GitHub repository PDgit12/knitbrain (3 stars, last pushed 1mo ago), licensed MIT. It adds 892 tokens to every session, about $0.0045 per session on Opus 5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other instructions, from other repositories
pad CLAUDE.md
Instructions for PerpetualSoftware/pad, covering pad — development guide, what this is, architecture, build & install and quick iteration loop.
sverklo CLAUDE.md
Instructions for sverklo/sverklo, covering sverklo development, using sverklo tools, project structure and build & test.
brain-os AGENTS.md
Instructions for brainOS-HQ/brain-os, covering agents.md, context, the hard rule, tool routing (in order) and mutation safety.
brain-os copilot-instructions.md
Instructions for brainOS-HQ/brain-os, covering github copilot instructions, read this first, critical rules (also in agents.md) and known bugs (v0.4.1 fixes pending).
brain-os CLAUDE.md
Instructions for brainOS-HQ/brain-os, covering claude.md, agent instructions, build / dev, publish flow and project memory.
code-insights CLAUDE.md
Instructions for melagiri/code-insights, covering claude.md — code insights, project overview, development philosophy (critical), configuration hierarchy and documentation index.