simt-dev 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/CHANGELOG.md +172 -0
  2. package/README.md +138 -74
  3. package/docs/decisions/ADR-073-a-kernel-is-a-smaller-projection-the-repository-asks-for.md +1 -1
  4. package/docs/decisions/ADR-077-the-command-card-leads-the-region-and-reads-committed-evidence.md +1 -1
  5. package/docs/decisions/ADR-083-a-budget-is-met-by-cutting-the-kernel-and-hard-is-the-floor.md +153 -0
  6. package/docs/decisions/ADR-084-a-workspace-carries-its-repeated-rules-once.md +100 -0
  7. package/docs/decisions/ADR-085-the-region-ends-with-the-names-it-kept-out.md +72 -0
  8. package/docs/decisions/ADR-086-the-stable-prefix-comes-first-and-the-lock-records-both-digests.md +69 -0
  9. package/docs/decisions/ADR-087-a-run-is-evidence-for-one-tree.md +67 -0
  10. package/docs/decisions/ADR-088-a-marked-line-is-enforced-by-a-checker.md +59 -0
  11. package/docs/decisions/ADR-089-the-local-index-is-a-cache-of-git-blobs.md +52 -0
  12. package/docs/decisions/ADR-090-an-optional-adapter-is-off-until-named.md +55 -0
  13. package/docs/decisions/ADR-091-the-map-ranks-files-a-task-mentions.md +60 -0
  14. package/docs/decisions/ADR-092-tests-are-imports-conventions-and-coverage.md +60 -0
  15. package/docs/decisions/ADR-093-why-names-what-governs-a-file.md +58 -0
  16. package/docs/decisions/ADR-094-a-change-runs-the-tests-that-import-it.md +44 -0
  17. package/docs/decisions/ADR-095-gate-output-keeps-the-failures.md +31 -0
  18. package/docs/decisions/ADR-096-impact-names-who-a-change-reaches.md +38 -0
  19. package/package.json +2 -2
  20. package/rules/core.md +2 -2
  21. package/src/agenthooks/policy.mjs +10 -2
  22. package/src/agenthooks/prompt.mjs +81 -0
  23. package/src/agenthooks/render.mjs +138 -17
  24. package/src/argv.mjs +34 -1
  25. package/src/bench/grade.mjs +3 -0
  26. package/src/bench/run.mjs +85 -39
  27. package/src/bench/variants.mjs +456 -0
  28. package/src/brief/assemble.mjs +346 -0
  29. package/src/brief/kind.mjs +134 -0
  30. package/src/brief/packet.mjs +197 -0
  31. package/src/ci/workflow.mjs +11 -1
  32. package/src/commands/agenthook.mjs +84 -5
  33. package/src/commands/bench.mjs +53 -16
  34. package/src/commands/brief.mjs +78 -0
  35. package/src/commands/compare.mjs +10 -2
  36. package/src/commands/decide.mjs +116 -0
  37. package/src/commands/evidence.mjs +96 -0
  38. package/src/commands/gate.mjs +165 -0
  39. package/src/commands/help.mjs +65 -3
  40. package/src/commands/hooks.mjs +45 -5
  41. package/src/commands/impact.mjs +205 -0
  42. package/src/commands/index.mjs +52 -1
  43. package/src/commands/lessons.mjs +127 -0
  44. package/src/commands/local.mjs +97 -0
  45. package/src/commands/map.mjs +126 -0
  46. package/src/commands/repoindex.mjs +55 -0
  47. package/src/commands/rules.mjs +17 -2
  48. package/src/commands/shared.mjs +398 -0
  49. package/src/commands/skills.mjs +3 -17
  50. package/src/commands/skillscompile.mjs +255 -0
  51. package/src/commands/sync.mjs +87 -3
  52. package/src/commands/tests.mjs +145 -0
  53. package/src/commands/tokens.mjs +30 -1
  54. package/src/commands/why.mjs +172 -0
  55. package/src/compare/learn.mjs +680 -0
  56. package/src/decisions/index.mjs +116 -65
  57. package/src/federation/client.mjs +188 -0
  58. package/src/federation/config.mjs +134 -0
  59. package/src/federation/query.mjs +48 -0
  60. package/src/graph/compile.mjs +475 -0
  61. package/src/graph/spec.mjs +1 -1
  62. package/src/hooks/dispatcher.mjs +15 -0
  63. package/src/hooks/shim.mjs +31 -0
  64. package/src/index/compact.mjs +228 -0
  65. package/src/index/extract.mjs +331 -0
  66. package/src/index/gate.mjs +89 -0
  67. package/src/index/govern.mjs +234 -0
  68. package/src/index/impact.mjs +186 -0
  69. package/src/index/map.mjs +627 -0
  70. package/src/index/persist.mjs +239 -0
  71. package/src/index/store.mjs +515 -0
  72. package/src/index/tests.mjs +294 -0
  73. package/src/kernel/budget.mjs +100 -0
  74. package/src/kernel/checks.mjs +378 -0
  75. package/src/kernel/variants.mjs +353 -0
  76. package/src/ledger/index.mjs +147 -0
  77. package/src/local/client.mjs +482 -0
  78. package/src/local/config.mjs +234 -0
  79. package/src/mcp/tools.mjs +138 -1
  80. package/src/measure/context.mjs +7 -5
  81. package/src/memory/decide.mjs +462 -0
  82. package/src/memory/lessons.mjs +858 -0
  83. package/src/projection/disclosure.mjs +92 -0
  84. package/src/projection/lock.mjs +125 -0
  85. package/src/projection/manifest.mjs +52 -0
  86. package/src/projection/markers.mjs +56 -17
  87. package/src/projection/project.mjs +24 -17
  88. package/src/projection/rules.mjs +407 -49
  89. package/src/projection/shared.mjs +428 -0
  90. package/src/projection/targets.mjs +2 -1
  91. package/src/toolwords.mjs +8 -0
package/CHANGELOG.md CHANGED
@@ -6,6 +6,176 @@ All notable changes to this package are recorded here. The format follows
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.4.0] — 2026-10-20
10
+
11
+ ### Hybrid retrieval fuses BM25, the code graph, and the resolver
12
+
13
+ `simt index` indexes full-text tokens across `code`, `docs`, `skills`, `decisions` and
14
+ `lessons` into the SQLite FTS5 `fts` table (with an Okapi BM25 fallback when the index is
15
+ JSON-lines). `simt map` and `simt brief` fuse FTS5 `bm25()`, PageRank graph proximity and
16
+ resolver signals with reciprocal-rank fusion (`RRF_K = 40`), raising gold-file recall@10 on
17
+ the 20 mined tasks here from 54.3% to 61.3% (above the 60% bar in ADR-091). With `--embed`
18
+ and a configured `local.embed` endpoint, `simt index` stores `Float32Array` vector blobs in
19
+ the `embeddings` table and `simt map --embed` adds brute-force cosine similarity; embeddings
20
+ stay off by default unless they raise recall@10 by at least 10 percentage points.
21
+
22
+ ### A local model adapter that opens zero sockets until named
23
+
24
+ `simt local doctor` probes the OpenAI-compatible `local.chat` and `local.embed` endpoints
25
+ declared in `simt.json` (`/v1/models`, `/v1/chat/completions`, `/v1/embeddings` for Ollama,
26
+ `llama-server`, LM Studio and MLX servers) and reports reachability, model presence and
27
+ latency. Non-loopback URLs are refused unless `--allow-remote` is given (ADR-075, ADR-090),
28
+ and when `local` is unset nothing opens a socket.
29
+
30
+ ### Estate learning and ADR drafts across a workspace
31
+
32
+ `simt compare --learn` aggregates benchmark uplift (`ΔR`, `ΔC`) per rule section across
33
+ adopted sibling repositories, promotes lessons repeated across at least two repositories as
34
+ shared candidates, and flags gates that fail more than 20% of the time as `NOISY-GATE`.
35
+ `simt compare --draft-adr <pattern>` writes a proposed ADR draft under `docs/decisions/`
36
+ carrying `Origin: simt compare --draft-adr` and the workspace evidence behind it.
37
+
38
+ ### Rule text variants have to win on the bench
39
+
40
+ A rule may declare candidate wordings under `simt-variants:` in its frontmatter (or supply
41
+ them with `--variants-file`). `simt bench variants <rule-id>` evaluates each candidate on
42
+ paired benchmark runs with McNemar on resolved rate and Wilcoxon signed-rank on cost,
43
+ promotes a wording only when `ΔR > 0` (or `ΔR == 0` and `ΔC < 0`) at `p < 0.05`, and records
44
+ the winning variant and its `p`-value in `simt-dev.lock.json`.
45
+
46
+ ### Decision records carry structured supersession frontmatter
47
+
48
+ `simt decide "<title>"` scaffolds the next numbered ADR in `docs/decisions/` with structured
49
+ frontmatter (`Status`, `Date`, `Supersedes`, `Superseded-by`, `Affects`) and updates the
50
+ records it supersedes when `--supersedes` and `--yes` are given. `simt rules lint` reports
51
+ `PARTIAL-SUPERSEDE` when prose claims to supersede part of an earlier record without
52
+ matching frontmatter links.
53
+
54
+ ### Lessons are captured from failure-to-fix pairs, recalled on match, and expire
55
+
56
+ When a failing gate or test run in `.simt-dev/ledger.jsonl` is followed by a passing run on
57
+ the same package, `simt lessons` records a deterministic candidate in
58
+ `.simt-dev/lessons-candidates.jsonl`. `simt lessons promote <id> --yes` writes a reviewed
59
+ lesson to `docs/lessons/<id>.md` with `Paths`, `Check`, `Expires` and `ADR` fields, and
60
+ `simt check` reports `LESSON-EXPIRED` once the date passes or the linked ADR is superseded.
61
+ Matching lessons (at most two) are recalled in `simt brief` and by `simt agent-hook
62
+ after-tool` when a tool call fails on the same package or error signature.
63
+
64
+ ### Skills compile to the Agent Skills standard and report their triggers
65
+
66
+ `simt skills compile` validates and compiles skill sources against the Agent Skills standard
67
+ (frontmatter `name` and `description`, description under 1024 characters, `SKILL.md` body at
68
+ most 500 lines, and on-demand `references/` and `scripts/` links). `simt skills triggers
69
+ "<prompt>"` previews which skills match a task and the score breakdown behind each match.
70
+
71
+ ### A task brief fits in the bytes a prompt can carry
72
+
73
+ `simt brief "<task>"` assembles what a task needs into one packet: the kind of the task
74
+ and the commands that kind needs, the files the map ranks highest, the tests the index
75
+ knows for them, the decisions that govern them, the skills the resolver selects, the
76
+ lessons that name those paths, and the cautions — dirty files to leave alone, generated
77
+ paths, files no test covers. The packet stays inside `--budget` bytes (2048 by default,
78
+ `0` for all of it), ends with the number of items it had to cut, and prints the same bytes
79
+ on the same tree; `--explain` prints every item with the reason it was kept or dropped.
80
+ The accept figure it was designed against — 20% fewer turns, 15% cheaper than the kernel
81
+ arm at no loss of resolved rate — is unmeasured here, because it needs a bench run and an
82
+ installed agent CLI and neither is on this machine. `simt skills brief` keeps its own
83
+ behaviour for now: retiring it changes two accepted decisions and an MCP output schema,
84
+ and this slice carries no decision to do it.
85
+
86
+ ### The packet arrives without being asked for
87
+
88
+ A repository that declares a `brief` key in its manifest gets the packet injected as context
89
+ before every prompt: `simt agent-hooks install` writes a `UserPromptSubmit` hook into Claude
90
+ Code's and Codex's own config, and `simt agent-hook prompt-submit --harness <id>` answers in
91
+ that harness's dialect with `hookSpecificOutput.additionalContext`. It never decides and never
92
+ exits 2 — no prompt text, no opt-in, a cold index or an assembly error all print why on stderr
93
+ and exit 0. The injection is capped at 2048 bytes; `brief.bytes` may lower that and may not
94
+ raise it. Cursor and Gemini CLI are not in the table: Cursor's prompt event can only block a
95
+ prompt, and Gemini CLI's replacement is not in the reader table. The pre-tool path pays nothing
96
+ for this — the repository is reached through a dynamic import only a prompt event opens. MCP
97
+ gains a `brief` tool so a client can pull the same packet, assembled by the same code as the
98
+ command.
99
+
100
+ ### A brief can cite a code graph it did not build
101
+
102
+ A repository may declare a `federation` block in `simt.json` naming external code-graph
103
+ servers, each with the command that starts it and, optionally, the MCP tool to ask, the
104
+ argument the question goes in, the languages it covers and the timeout to wait. `simt brief`
105
+ and the MCP `brief` tool then ask each declared server one structural question for the task
106
+ and add the answer to a `FEDERATION` section that names its source; a `covers <languages>`
107
+ line records what a server claims without yet skipping the index's own extraction of those
108
+ languages. The list is the repository's own committed declaration, the same trust model as
109
+ `gates.commands`, and nothing is started that the manifest did not name. A malformed entry, a
110
+ spawn failure, a protocol error or a timeout all become a caution and the brief still exits
111
+ `0`; a server that never answers is bounded by its own per-server timeout. MCP also gains a
112
+ `federation_query` tool, which asks a named server (or every declared one) one structural
113
+ question on demand and returns the answer with its source; like the brief's fan-out it goes
114
+ only to the tool and argument the manifest declared. The packet delivered at prompt submit
115
+ does not federate — starting someone else's process is not a wait a 300 ms submit may take.
116
+
117
+ ## [0.3.1] — 2026-10-18
118
+
119
+ ### Who a change reaches
120
+
121
+ `simt impact` takes a tracked path or the name of one export. It lists the files that import it, the tests of that closure, the decisions and rules that govern the file, and the last matching CODEOWNERS line. In a workspace it also lists another repository that references an OpenAPI document or a JSON Schema file this change touches. Each list stops at 64 (ADR-096).
122
+
123
+ ### A gate report keeps the failures and counts the passes
124
+
125
+ `simt gate` compacts a report it knows how to read: TAP, JUnit XML, pytest's junit file, vitest or jest JSON, and `go test -json`. Failures come first, with the name, the assertion and the location. Passing tests are a count. The raw log path is printed. Anything else is printed unchanged (ADR-095).
126
+
127
+ ### A change runs the tests that import it
128
+
129
+ `simt gate` selects the test files that import a changed file, directly or through other files, and runs only those with the package's own runner. Paths name the change. `--changed` reads the diff. A clean diff runs nothing. Changing `src/resolve/resolve.mjs` in this checkout selects 51 files, the hand-built list, in about 40 ms. The bar is 5 seconds (ADR-094).
130
+
131
+ ### what governs a file is the decision, rule, skill, gate or lesson that names it
132
+
133
+ `simt why` reads an Affects line as the tokens in backticks, including a line the paragraph wraps onto. A token that is a command, a path, or a glob is an edge. A token that is none of those is printed as `UNRESOLVED-AFFECTS`. Rules, skills, gates and lessons contribute the path lists they already publish. At `4c27514` every one of the sixteen Affects tokens resolves or is reported, and ADR-017 is the only record that names the dispatcher (ADR-093).
134
+
135
+ ### The tests of a file are its importers, its conventional neighbour, and its coverage
136
+
137
+ `simt tests` lists the tests that exercise a file. An import counts, including one whose specifier is on the next line and a dynamic `import()`. So does the conventional source beside the test, and a coverage record that names both sides. Files that only share commits are a separate list, added with `--cochange`. On 30 hand-labelled files in this checkout every predicted test is in the label. The bar is 0.8 (ADR-092).
138
+
139
+ ### The map ranks the files a task is likely to touch
140
+
141
+ `simt map` orders the index by the task's words and by the import and call edges around them. It renders paths, exported names, or signatures, inside a byte budget. `simt bench report` prints recall@10: the mean fraction of a mined task's gold files that land in the top 10. On the 20 mined tasks measured here that figure is 55.6%. The bar is 60% (ADR-091).
142
+
143
+ ### The index names the exports and the imports
144
+
145
+ `simt index` fills symbols and import edges from the blob it already hashes. The built-in extractors are line-oriented, for the languages a map needs, and on the labelled fixtures they recall at least 90% of the exported names for TypeScript, Kotlin, Python and Go. A structural parser is a separate package named by `index.parsers`; with that key absent, nothing is loaded. It writes cache rows and does not edit the repository. A live comparison against tree-sitter is unmeasured (ADR-090).
146
+
147
+ ### The local index is a cache of git blobs
148
+
149
+ `simt index` rebuilds `.simt-dev/index.sqlite` from `git ls-files`. A blob that has not changed is not read again, and the same blobs produce the same rows. When this Node cannot open `node:sqlite` with FTS5, the same rows are written to `.simt-dev/index.jsonl` instead (ADR-089).
150
+
151
+ ### A marked line is enforced by a checker
152
+
153
+ A rule line may name a checker with `simt-check`. The projection keeps `Enforced:` and the checker's name, and `simt check` runs the checker. The file-length line is `max-file-lines`: past 400 lines warns, past 1000 fails, and a path is exempt only when `limits.fileLines.generated` names it. A path under `node_modules` is not counted: a committed dependency is not a file this repository wrote, and counting it failed every install of this package. A file-length warning and a checker that is not built yet are reported and do not fail `check` or `sync`. `import-direction` stays in the prose until the module graph exists. Probe compliance is unmeasured (ADR-088).
154
+
155
+ ### A run is evidence for one tree
156
+
157
+ `simt evidence` prints the runs recorded against the tree on disk. A gate the dispatcher runs appends a line: the command, the exit, a short summary, and a digest of the output. Editing any file changes the tree, so that line no longer applies. `simt evidence check` warns when a commit message says the tests passed and this tree has no passing line, and fails the commit when `gates.evidence` is `block`. `simt hooks install --yes` writes the commit-msg shim only when that setting is present (ADR-087).
158
+
159
+ ### A workspace carries its repeated rules once
160
+
161
+ `simt shared plan` names the rules every repository in a workspace renders with the same bytes, and where each harness would load that copy. `simt shared install --yes` writes the copy into the user-level file the harness actually reads, and records the ids on each repository's manifest under `shared`. The next `simt sync` drops those rules from the region and names them, with the command that shows each one. `simt doctor` says when the copy is missing or stale, and does not fail the repository for it. The 30 KB estate bar and the bench comparison are unmeasured (ADR-084).
162
+
163
+ ### The region ends with the names of what it kept out
164
+
165
+ The generated region ends with a `## Disclosure` section: one line per scoped profile, with the patterns and the files it moved to, and one line per installed skill, with its name and the description that says when to open it. The skill body stays in its file. A surface that cannot narrow a profile still carries that profile in the region (ADR-085).
166
+
167
+ ### The stable prefix comes first
168
+
169
+ Shipped rules lead the region, and the command card follows them, so an edit this repository makes changes only the tail. `simt sync --yes` writes `simt-dev.lock.json` with an input digest and an output digest. `simt check --frozen` fails when the output moves and the inputs did not, and names a stale lock separately (ADR-086).
170
+
171
+ ### Kernel mode packs to the budget the repository declared
172
+
173
+ `mode: kernel` reads `budget.bytes`, holds back a reserve for the files that load beside the region, and drops rules least-valuable-first until the region fits. Every cut rule is named, with the command that shows it. `full` mode cuts nothing. A repository whose hard rules already exceed the budget is told so, and those rules stay (ADR-083).
174
+
175
+ ### Vulnerability reports
176
+
177
+ `SECURITY.md` names the two places a report goes: a GitHub issue on this repository, or `security@simt.space`.
178
+
9
179
  ## [0.3.0] — 2026-10-17
10
180
 
11
181
  ### The rules and the decisions are readable as MCP resources
@@ -563,6 +733,8 @@ never ran `simt hooks install` again will find nothing until the dependency is r
563
733
  and `simt hooks install --yes` is re-run. That is a real upgrade step and it is called out
564
734
  here rather than discovered.
565
735
 
736
+ [0.4.0]: https://github.com/QuazarMedia/simt-dev/releases/tag/v0.4.0
737
+ [0.3.1]: https://github.com/QuazarMedia/simt-dev/releases/tag/v0.3.1
566
738
  [0.3.0]: https://github.com/QuazarMedia/simt-dev/releases/tag/v0.3.0
567
739
  [0.2.2]: https://github.com/QuazarMedia/simt-dev/releases/tag/v0.2.2
568
740
  [0.2.1]: https://github.com/QuazarMedia/simt-dev/releases/tag/v0.2.1
package/README.md CHANGED
@@ -1,54 +1,117 @@
1
1
  # simt-dev
2
2
 
3
- Shared agent rules, skills and git hooks for a repository.
4
-
5
- One command adopts a repository: it reads what the repo actually runs, projects the
6
- matching rules into the files your agent already reads, and installs a pre-commit hook
7
- that refuses a commit which breaks a gate that repo can genuinely run.
8
-
9
- - **Nothing is declared that cannot run.** Every gate is probed against the working tree
10
- before it is written. A gate whose tool is absent is dropped, with a remedy naming the
11
- package to install — never silently present, never silently absent.
12
- - **Nothing an agent reads is written twice.** Each rule goes to exactly one place, chosen
13
- by what the harness actually reads.
14
- - **The rules are a projection, not a copy.** They carry markers, so `check` can tell
15
- drift from a deliberate edit, and `sync` can regenerate.
16
- - **The tool explains itself.** `rules why` answers "why did I get told this?" from a
17
- numbered record of the decisions behind the rules, with the rejected alternatives
18
- attached.
3
+ ![simt-dev, the intelligence amplifier for coding agents, and its four claims. One: say less, always — a kernel under 2 KB whose bytes stay stable so the prompt cache survives. Two: answers over exploration — a local code graph and a short task brief. Three: enforce, don't instruct — dual gates, before a tool call and at git time. Four: close the loop — benches and memory. Beneath them, the harnesses it works across and its three channels.](https://raw.githubusercontent.com/QuazarMedia/simt-dev/main/res/59e21e6d-6bf2-4d7d-b6ea-c7349a697d11.jpg)
4
+
5
+ `simt` adopts a repository for the agents that work in it.
6
+
7
+ It reads what the repository actually runs, projects the rules that are not already
8
+ obvious into the files those agents read, and installs only the gates that repository
9
+ can run. Around that projection it keeps the bytes stable, replaces an instruction
10
+ with a check where a check can decide, answers questions about the tree from a local
11
+ index, and records whether a run still applies to the tree on disk.
12
+
13
+ The aim of the whole design is a higher share of tasks resolved, at a lower cost per
14
+ resolved task. Those targets are hypotheses. A change that touches what an agent reads
15
+ ships with a measurement, or its record says the measurement was not run. `simt rules
16
+ why ADR-NNN` prints the record, including whether it is still in force.
17
+
18
+ The default path is deterministic: no model, no network, no runtime dependencies.
19
+ Anything that needs a parser grammar, a local model, or another server is a separate
20
+ package, off until the repository names it, and it proposes rows or text for a person
21
+ to merge. It does not write the projection.
22
+
23
+ ## Today
24
+
25
+ ```sh
26
+ simt init # adopt or scaffold; prints a plan; --yes writes
27
+ simt doctor # what this repo is, and whether its config is healthy
28
+ simt check # projection drift, the manifest, and declared checkers
29
+ simt sync --yes # regenerate the projection
30
+ simt upgrade --yes # move every pin of this tool to this version
31
+
32
+ simt rules why ADR-042 # the decision behind a rule, and what was rejected
33
+ simt skills brief --task # a short brief for one task
34
+ simt tokens # bytes a reader loads at session start
35
+ simt shared plan # rules a workspace repeats, and what carrying them once saves
36
+ simt harness loaders # what each harness loads, and what its cap drops
37
+
38
+ simt hooks install --yes # the git dispatcher, for gates this repo can run
39
+ simt agent-hooks install --yes # the same policy before a tool call
40
+ simt evidence # runs recorded against this tree
41
+ simt index # files, exports and imports, from git blob hashes
42
+ simt plan next # the next tracker row that is ready
43
+
44
+ simt bench report # resolved rate, quality, cost, across arms
45
+ simt compare # every sibling checkout that has adopted
46
+ simt mcp # the read-only surface, over stdio
47
+ ```
48
+
49
+ `init`, `sync`, `upgrade`, `hooks install`, `agent-hooks install`, `shared install`
50
+ and `plan done` print a plan and write nothing without `--yes`. None of them commit
51
+ or push. `simt index` writes its cache without asking: the file is gitignored and
52
+ `git ls-files` can rebuild it.
53
+
54
+ `check` runs the checkers a rule names. A marked line leaves the projection as
55
+ `Enforced:` and the checker's name. The file-length line warns past 400 lines and
56
+ fails past 1000. `simt evidence check` warns when a commit message claims a passing
57
+ run this tree does not have, and the commit fails when `gates.evidence` is `block`.
58
+ The commit-msg hook is installed only when that setting is `warn` or `block`.
59
+
60
+ ## Where the plan finishes
61
+
62
+ The work above is the part that runs. The plan still adds the rest of the loop, in
63
+ this order of purpose:
64
+
65
+ - **Gates on the change.** A check selects the tests that cover the diff, and the
66
+ tool's own gate output is shortened without dropping a failure line.
67
+ - **Answers instead of exploration.** A ranked map of the repository, the impact of
68
+ a file or a symbol, the tests that cover a change, and the decisions, rules and
69
+ skills that govern a path. An external code graph can answer for a language it
70
+ covers, and the answer names that source.
71
+ - **A brief for the task in front of the agent.** At most 2 KB, pulled at submit or
72
+ pushed by a hook, built from the map, the tests and the governing records.
73
+ - **A memory that has to earn its place.** A lesson is a candidate when a failing run
74
+ is followed by a fix. It is recalled on a later task that looks like it, and it
75
+ expires. Variant wording of a rule ships only when the bench says it won.
76
+ - **Local models, off unless asked.** Distillation and a critic propose. They do not
77
+ write projected text. With no model configured, nothing opens a socket.
78
+ - **The small doors.** One finding code explained, a safe `doctor` fix, a one-line
79
+ status, an undo journal, a diff of every planned write, shell completions, one
80
+ ignore list for every harness plus a secret scan, a worktree per slice, a file
81
+ lease when two agents would edit the same path, and a pull-request body taken from
82
+ the evidence.
19
83
 
20
84
  ## Install
21
85
 
22
- Requires **Node >= 22.20.0** (the PyPI install can supply it, see below).
86
+ Requires **Node >= 22.20.0**. The current published release is **0.4.0**. Pin it.
87
+ The tool writes a content digest into the files it generates, and an unpinned upgrade
88
+ changes them under you.
23
89
 
24
90
  ```sh
25
- # pinned, per repository - what CI and a teammate both get
26
- npm i -D simt-dev@0.2.1
91
+ npm i -D simt-dev@0.4.0
27
92
 
28
- # or globally, if you would rather not add a dependency
29
- npm i -g simt-dev@0.2.1
93
+ # or globally
94
+ npm i -g simt-dev@0.4.0
30
95
 
31
- # or with no install at all, for a one-off
32
- npx -y simt-dev@0.2.1 check
96
+ # or once, with no install
97
+ npx -y simt-dev@0.4.0 check
33
98
  ```
34
99
 
35
100
  ### From PyPI
36
101
 
37
- The same tool, from the same bytes. The wheel carries the exact contents the npm
38
- tarball carries — the wheel is not a wrapper around `npm install`, so nothing is
39
- fetched when you install it.
102
+ The wheel carries the same bytes as the npm tarball. It does not fetch them from npm
103
+ at install time.
40
104
 
41
105
  ```sh
42
106
  pip install simt-dev
43
107
 
44
- # and if this machine has no node at all
108
+ # when this machine has no node
45
109
  pip install "simt-dev[node]"
46
110
  ```
47
111
 
48
- `simt` is the command on both channels. Where node comes from is resolved in
49
- this order, and the first one that answers wins: `SIMT_DEV_NODE`, the bundled
50
- node from the `node` extra, then `node` on your `PATH`. If none of them resolve,
51
- you get a message naming the remedy rather than a placeholder node path.
112
+ `simt` is the command on both channels. Node is resolved in this order, and the first
113
+ one that answers wins: `SIMT_DEV_NODE`, the node bundled with the `node` extra, then
114
+ `node` on `PATH`.
52
115
 
53
116
  ### From Homebrew
54
117
 
@@ -56,65 +119,66 @@ you get a message naming the remedy rather than a placeholder node path.
56
119
  brew install QuazarMedia/homebrew-tap/simt-dev
57
120
  ```
58
121
 
59
- The formula declares its own `node` dependency, so `brew install` gives you a
60
- working command on a machine that has never had Node.
122
+ The formula depends on `node`, so the command works on a machine that has never had
123
+ Node installed.
61
124
 
62
- Pin the version. The tool writes a content digest into the files it generates, and an
63
- unpinned upgrade changes them under you.
125
+ ## What it writes
64
126
 
65
- ## Use
127
+ | Path | What |
128
+ | --- | --- |
129
+ | `AGENTS.md` | the projection, between `<!-- simt:begin -->` and `<!-- simt:end -->`. The old `simt-dev:` markers are still read, and a region migrates on its next write |
130
+ | `simt.json` | the manifest: gates, substitutions, budget, shared rules, surfaces |
131
+ | `simt-dev.lock.json` | the digest of the inputs and the digest of the projection |
132
+ | `.cursor/rules/*.mdc`, `.claude/rules/*.md`, `.agents/rules/*.md`, `.github/instructions/*.instructions.md` | one file per rule, and only for a harness that reads that directory |
133
+ | `.editorconfig`, `.gitattributes` | baseline regions, placed first so a later setting still wins |
134
+ | `.simt-hooks/` and `core.hooksPath` | the shared dispatcher. It fails closed |
66
135
 
67
- ```sh
68
- simt init # adopt or scaffold this repository (dry-run; --yes to write)
69
- simt doctor # what this repo is, and whether its config is healthy
70
- simt check # the gate: projection drift, manifest validity, policy
71
- simt sync --yes # regenerate the projection
72
- simt upgrade --yes # move every consumer of this tool to this version
73
- simt rules why ADR-042 # why a rule says what it says, and what was rejected
74
- simt compare # what changed across every repository that adopted it
75
- ```
136
+ Text outside the markers is left alone. A regeneration does not revert it.
76
137
 
77
- `init` and `sync` print a plan and write nothing without `--yes`. Neither commits or pushes.
138
+ `simt.json` also carries a `federation` block when the repository names external
139
+ code-graph servers, each with the command that starts it. A brief may then ask one of
140
+ them one structural question for a task and cite the answer's source, and the MCP
141
+ `federation_query` tool asks one on demand, naming the server it asked. The question goes
142
+ to the tool and argument the manifest declared, so no foreign tool is reachable that the
143
+ repository did not name. Nothing is started unless the manifest declared it, and a server
144
+ that does not answer costs the packet a sentence, never the packet.
78
145
 
79
- ## What it writes
146
+ These are caches, gitignored, and rebuildable. They are not repository content:
80
147
 
81
148
  | Path | What |
82
149
  | --- | --- |
83
- | `AGENTS.md` | the projection, between `<!-- simt:begin -->` and `<!-- simt:end -->` (renamed from `simt-dev:`; the old markers are still read, and a region migrates on its next write) |
84
- | `simt.json` | your manifest: which gates to declare, which substitutions to fill |
85
- | `.cursor/rules/*.mdc`, `.claude/rules/*.md`, `.agents/rules/*.md`, `.github/instructions/*.instructions.md` | one file per rule, written only for the harnesses that read their own directory |
86
- | `.editorconfig`, `.gitattributes` | baseline regions |
87
- | `.simt-hooks/` and `core.hooksPath` | the shared dispatcher, fail-closed |
150
+ | `.simt-dev/index.sqlite` | files, symbols, import edges. JSON-lines at `.simt-dev/index.jsonl` when this Node cannot open `node:sqlite` with FTS5 |
151
+ | `.simt-dev/ledger.jsonl` | one line per gate the dispatcher actually ran, against one git tree |
152
+ | `.simt-dev/bench/runs/` | benchmark runs |
88
153
 
89
- Anything outside the markers is yours. simt-dev never edits it and never reverts it.
154
+ `simt shared install --yes` writes a user-level copy of the rules a workspace
155
+ repeats, into the file that harness documents, and records the ids on each
156
+ repository's manifest. The next `sync` drops those rules from the region and names
157
+ them.
90
158
 
91
- ## Platform
159
+ ## How a rule is chosen
92
160
 
93
- **macOS and Linux.** The hooks are POSIX `sh`; there is no Windows build and no plan for
94
- one. `npm i` on Windows fails with npm's `EBADPLATFORM`, which npm will not let a package
95
- explain — so the answer is here: **use WSL2**, and the gate works normally inside it.
161
+ Detection reads dependency manifests, build files and CI workflows, and ranks rules
162
+ by path, keyword, name, capability and stack. The ranking is a score. A pull request
163
+ can diff it.
96
164
 
97
- A Windows checkout without WSL2 can still read every rule this tool generates, because the
98
- projection is plain text in `AGENTS.md` and the per-harness rule files. Only the hooks and
99
- the CI gate need the POSIX host.
165
+ A repository whose ecosystem has no profile yet is still adopted: it gets the core
166
+ rules and no gates, until gate templates exist for it. A hook that would run nothing
167
+ is not installed.
100
168
 
101
- ## How the rules are chosen
169
+ Every behaviour that is a choice has a numbered record. `simt rules why <id>` is the
170
+ path from a rule you did not expect to the reason it is there.
102
171
 
103
- Detection reads what the repository runs — its dependency manifests, its build files, its
104
- CI workflows — and resolves that against a registry of capabilities. Resolution is a
105
- scored ranking over path, keyword, name, capability and stack: no model, no network, no
106
- guessing, so a pull request can meaningfully diff the answer.
172
+ ## Platform
107
173
 
108
- **Not every ecosystem has a profile yet.** A Go, Rust, .NET, Ruby, Swift, Dart or Elixir
109
- repository is detected and gets facts, but it is adopted with the core rules and no gates
110
- until its gate templates are written. A repository with no gates is a repository with an
111
- agent and no pre-commit hook — better than one with a hook that runs nothing, but not full
112
- support, and this README will not pretend otherwise.
174
+ **macOS and Linux.** The hooks are POSIX `sh`. There is no Windows build. `npm i` on
175
+ Windows fails with npm's `EBADPLATFORM`, which npm will not let a package explain, so
176
+ the answer is here: **use WSL2**, and the gate works inside it.
113
177
 
114
- Every behaviour that is a choice rather than a detail has a numbered record, and the
115
- records are readable with `simt rules why <id>`. If the tool ever does something you
116
- did not expect, that command is the shortest path from the symptom to the reason.
178
+ A Windows checkout without WSL2 can still read the projection. It is plain text. The
179
+ hooks and the CI gate need the POSIX host.
117
180
 
118
181
  ## Licence
119
182
 
120
- Apache-2.0. See [LICENSE](LICENSE).
183
+ Apache-2.0. See [LICENSE](LICENSE). Report a vulnerability through
184
+ [SECURITY.md](SECURITY.md).
@@ -1,6 +1,6 @@
1
1
  # ADR-073 — A kernel is a smaller projection the repository asks for, not one it is given
2
2
 
3
- Status: **accepted** · 2026-10-14 · filed as S38 (R07)
3
+ Status: **accepted** · 2026-10-14 · filed as S38 (R07) · ruling 6 narrowed by ADR-084
4
4
  **Affects:** `src/projection/manifest.mjs`, `src/projection/rules.mjs`, `src/measure/context.mjs`,
5
5
  `rules/core.md`, `rules/stacks/*.md`, `test/kernel.test.mjs`
6
6
 
@@ -1,6 +1,6 @@
1
1
  # ADR-077 — The command card leads the region, and is derived from committed evidence only
2
2
 
3
- Status: **accepted** · 2026-10-16 · filed as R10 (plan 0003)
3
+ Status: **accepted** · 2026-10-16 · filed as R10 (plan 0003) · ruling 1 narrowed by ADR-086
4
4
  **Affects:** `src/kernel/card.mjs`, `src/projection/rules.mjs`, `rules/core.md` (indirectly, as
5
5
  the region's first bytes), `test/card.test.mjs`
6
6
 
@@ -0,0 +1,153 @@
1
+ # ADR-083 — A budget is met by cutting the kernel, and the hard constraints are the floor
2
+
3
+ Status: **accepted** · 2026-10-17 · filed as R08 (plan 0003) · ruling 7 narrowed by ADR-084
4
+
5
+ **Affects:** `src/kernel/budget.mjs`, `src/projection/rules.mjs`, `src/projection/manifest.mjs`,
6
+ `src/measure/context.mjs`, `src/projection/project.mjs`, `src/commands/sync.mjs`,
7
+ `test/kernel.test.mjs`, `test/tokens.test.mjs`, `test/surfaces.test.mjs`
8
+
9
+ ## Context
10
+
11
+ ADR-072 shipped the number: `budget.bytes` at the top level of the manifest, 30 000 bytes by
12
+ default, reported by `simt tokens` and raised by `check`, both non-blocking. It recorded what had
13
+ not landed and why — the packing needed a kernel, and the kernel was R07.
14
+
15
+ ADR-073 shipped the kernel. A repository declares `mode: kernel`, every rule declares its class
16
+ in its own frontmatter, and the mode packs `hard` and `command` while naming everything else in
17
+ the region with the command that fetches it. R08's accept criterion — the budget is never
18
+ exceeded — is now reachable, and this record is the part that reaches it.
19
+
20
+ Three facts about the number made the shape of this a decision rather than a loop.
21
+
22
+ The first is that the budget is one number and the meter bills more than the region. A generated
23
+ rule file is billed whole, a managed skill by its name and description, the region by the span
24
+ between its markers. A repository whose rules live in per-rule files has paid for those files
25
+ whether or not the region fits; packing the region against the whole declared number ships a
26
+ projection that fits on its own and is over the line the moment its rule files are written. On a
27
+ fixture with a Cursor surface, three `.mdc` files billed 6,552 B beside a 15,725 B region.
28
+
29
+ The second is the region's own span. It is the one number that moves when the projection is
30
+ packed, so a ceiling derived from it would make `sync` rewrite the file it had just written and
31
+ then report drift on a clean tree.
32
+
33
+ The third is what ADR-072 already ruled and R08's text has not caught up with: the key is
34
+ `budget.bytes`, not `projection.budget.bytes`. The plan is not edited. `projection` is a
35
+ generated key, `upgrade` replaces it wholesale, and a budget written there would disappear on a
36
+ green gate.
37
+
38
+ ## Rulings
39
+
40
+ 1. **One reader for the declared number.** `declaredBudget(manifest)` in `manifest.mjs` is the
41
+ only place `budget.bytes` is interpreted, and both the packer and `measureRoot` call it. A
42
+ finite non-negative value is taken as declared, including `0` — "this repository wants an
43
+ empty projection" is a decision somebody can make — and anything else (a string, `NaN`, a
44
+ negative) falls back to the review figure, because the one reading that cannot silently
45
+ produce compliance is the one where a typo is not a ceiling.
46
+
47
+ 2. **Nothing is cut in `full` mode.** ADR-072's finding already tells the reader "nothing was cut:
48
+ the projection is still in full mode", and a full projection that quietly lost a rule would
49
+ make the tool lie about itself in its own words. `desiredRegion` returns `budget: null` there,
50
+ not an empty cut list, so a reader of the field cannot conclude a cut happened when the mode
51
+ made none possible.
52
+
53
+ 3. **`hard` is the floor.** A priority class exists to say what a reader loses by not having the
54
+ line, and a byte count is not a reader. The packer skips `hard` instead of cutting it, and the
55
+ leftover is a distinct fact — `floorHeld` — reported as such: the notes say the kernel is still
56
+ over after every rule outside the hard class went, and that a hard constraint is not cut to
57
+ reach a byte count. The levers that remain are the repository's own, which is exactly what
58
+ ADR-072's kernel wording already tells the reader. One case gets its own sentence: when the
59
+ reserve alone reaches the declared budget the ceiling is zero or less, which is arithmetically
60
+ true and unreadable — it does not say that the files loading beside the region already spent
61
+ the whole budget — so the notes say that, because a reader left to infer it from a subtraction
62
+ is a reader who demotes a hard rule to fix a number they set too low.
63
+
64
+ 4. **The ceiling is the declared budget minus a reserve, and the region's own span is in
65
+ neither term.** The reserve is the larger of what the meter already bills outside the region
66
+ (what is installed) and what this projection is about to write as rule files (what a
67
+ repository that has not run `sync` yet will pay). Both are lower bounds; the larger is taken
68
+ because the failure each would otherwise cause is the one that must not happen — under-
69
+ reserving reports compliance for a projection that is over. The region's span is excluded
70
+ deliberately, per the second fact above. A folded single-surface repository reserves nothing,
71
+ which is correct rather than untested: `opencode` reads `AGENTS.md` and writes no rule files,
72
+ so there is nothing beside the region to pay for.
73
+
74
+ 5. **The cut order is the region's own order reversed, and it is fixed before any cost is
75
+ computed.** Class, then rule id — the comparator the deferred section already uses, least
76
+ valuable first. Which class a reader can best afford to lose is declared by the rules
77
+ themselves (ADR-073 ruling 3); what is left here is arithmetic, so the order is handed in and
78
+ the module that packs does not second-guess it.
79
+
80
+ 6. **A cut costs what the document then weighs, not the rule's own length.** Three things move
81
+ when a rule leaves: the provenance header drops a source, the deferred section gains a line
82
+ naming what left, and both move again as the cut list grows. So each attempt re-renders the
83
+ region and weighs it — `costs(cut)` returning `Buffer.byteLength(compose(...))`, markers and
84
+ provenance header included, one byte conservative because the file's trailing newline falls
85
+ outside the meter's span and conservative is the only direction a ceiling can afford. The loop
86
+ stops the moment it fits, so a budget never costs a rule it did not have to. This is the
87
+ command card's `CARD_LIMIT_BYTES` idiom (ADR-077) applied to the region instead of the card.
88
+
89
+ 7. **One list, two reasons.** Class-deferred and budget-cut rules share the region's existing
90
+ `## Deferred rules` section, and each line says which it was: `deferred in kernel mode` or
91
+ `cut to fit the declared budget of N bytes`, both naming `simt rules show <id>`. A second
92
+ heading would spend region bytes on a distinction the reader acts on identically, and a cut
93
+ line that did not say why would be indistinguishable from a kernel decision nobody made.
94
+
95
+ 8. **`BUDGET-CUT` is a finding, non-blocking in both commands, and carries the numbers a reader
96
+ needs to judge it.** The detail gives `before → after`, the declared budget, the reserve when
97
+ it is not zero, and every cut rule by id and class; the remedy is a decision
98
+ (`raise budget.bytes to <before + reserve>`, the budget that would have admitted the region
99
+ as it stood — `before` alone would leave the cut in place, because the ceiling it was cut
100
+ against is the budget less the reserve), not a place to go and look. Non-blocking for ADR-072's
101
+ reason: the cut is the tool doing what the repository asked, and a gate that failed here would
102
+ fail a repository for shipping a smaller projection. `sync` prints the same two facts as notes
103
+ so the cut is never silent from either command.
104
+
105
+ 9. **`simt tokens` keeps no second opinion.** ADR-064 kept the meter to one measurement, and the
106
+ packer's arithmetic is not substituted for it anywhere: the meter reports the bytes it finds
107
+ against the declared line, and the end-to-end test judges the cut with the meter's number
108
+ rather than the packer's. A packer that reports compliance for a projection the meter says is
109
+ over budget is the failure this arrangement is arranged against, so the test asserts the
110
+ meter's number even where the packer's own numbers are already visible in the same object.
111
+
112
+ ## Consequences
113
+
114
+ A repository that declares `mode: kernel` and a budget its rules do not fit gets a smaller
115
+ projection, a list of what left and why, and a note from both `sync` and `check`. The accept
116
+ criterion is checkable end to end rather than asserted: a fixture declares a budget a thousand
117
+ bytes under its own projection, syncs, and `simt tokens` reports `over: false` with the declared
118
+ line intact — and a second fixture, whose rule files are billed beside the region, is cut further
119
+ than the region alone would have needed, which is the only way the reserve can be seen to work.
120
+
121
+ The costs are accepted rather than avoided. In kernel mode a projection is now measured
122
+ (`measureRoot`) and its rule targets rendered a second time (`ruleTargets`) on every
123
+ `desiredRegion`, where previously the region's bytes were composed once. `measureRoot` is reached
124
+ through `await import` inside `budgetReserve` because `measure/context.mjs` already imports
125
+ `readLimitFindings` from `projection/project.mjs`; a static import from `rules.mjs` would close a
126
+ three-module loop that has to survive being loaded in any order.
127
+
128
+ Determinism is structural and partly argued. `packToBudget` takes its cost function as an
129
+ argument and reads no clock, no network and no PATH, so the cut set is a function of the rules,
130
+ the classes, the ids and the declared number; the test that renders one repository twice catches
131
+ the failure a test can catch, which is state leaking between calls. Two machines is the claim
132
+ R08 actually makes and no test in this repository can execute it — the argument is the one ADR-073
133
+ ruling 7 already makes.
134
+
135
+ What has not landed, and is not this slice's to land: R02's evaluation, which is still what would
136
+ justify `kernel` as a default rather than a repository's own choice; and the cross-machine half
137
+ of the accept criterion, which is argued from the code's inputs rather than demonstrated.
138
+
139
+ ## Rejected
140
+
141
+ - **Cutting in `full` mode.** The mode is a promise about what a reader gets, and the number in
142
+ ADR-072's finding says nothing was cut; making that sentence untrue to save bytes is the tool
143
+ misreporting itself.
144
+ - **Cutting `hard` to reach the line.** It would remove the one class whose claim is that its
145
+ absence is a defect, and report the result as compliance.
146
+ - **A second `## Cut` section beside `## Deferred rules`.** Two headings for one reader-facing
147
+ fact, and the second one spends bytes to be distinguished from the first.
148
+ - **Subtracting each rule's own length instead of re-rendering.** The provenance header and the
149
+ deferred line both change when a rule leaves, so the arithmetic would either overshoot or stop
150
+ short — and it would be a second definition of the region's size next to the meter's.
151
+ - **A binary search or two-pass packer.** The cost function is called once per candidate and the
152
+ candidate list is the length of the kernel; a cleverer search would add a failure mode to a
153
+ loop whose whole value is that it is the same computation every time.