simt-dev 0.6.2 → 0.7.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 (170) hide show
  1. package/CHANGELOG.md +83 -1
  2. package/README.md +46 -17
  3. package/agents/simt-agent.md +84 -0
  4. package/bin/simt.mjs +19 -6
  5. package/docs/decisions/ADR-009-skill-layout.md +1 -1
  6. package/docs/decisions/ADR-086-the-stable-prefix-comes-first-and-the-lock-records-both-digests.md +1 -1
  7. package/docs/decisions/ADR-100-a-staged-diff-is-the-last-gate-before-history-and-it-runs-inside-the-tool.md +94 -0
  8. package/docs/decisions/ADR-101-a-file-lease-belongs-to-one-session-and-the-pre-edit-hook-refuses-another.md +95 -0
  9. package/docs/decisions/ADR-102-the-two-queued-review-rows-are-closed-by-ruling.md +49 -0
  10. package/docs/decisions/ADR-103-co-projected-duplicates-merge-down.md +74 -0
  11. package/docs/decisions/ADR-104-the-pre-tool-use-policy-reads-the-command-the-way-a-shell-reads-it.md +76 -0
  12. package/docs/decisions/ADR-105-the-json-ceiling-shrinks-arrays-and-never-cuts-bytes.md +44 -0
  13. package/docs/decisions/ADR-106-the-harness-hook-runs-through-a-repo-shim.md +46 -0
  14. package/docs/decisions/ADR-107-an-install-can-name-one-harness-and-the-skipped-ones-are-named.md +51 -0
  15. package/docs/decisions/ADR-108-an-adoption-builds-the-index-and-a-command-refreshes-it-on-read.md +59 -0
  16. package/docs/decisions/ADR-109-simt-dev-is-its-own-consumer-and-the-guards-that-kept-it-from-being-one-are-retired.md +47 -0
  17. package/docs/decisions/ADR-110-the-lock-file-follows-the-manifest-name-and-the-old-name-is-read-until-the-next-write.md +43 -0
  18. package/docs/decisions/ADR-111-the-tool-ships-one-agent-rendered-per-harness-and-installs-it-with-init-and-a-command.md +75 -0
  19. package/docs/decisions/ADR-112-the-registry-is-what-simt-dev-ships-and-a-repo-owns-its-own-skills.md +81 -0
  20. package/docs/decisions/ADR-113-a-pre-push-that-carries-only-documentation-skips-the-test-gate-and-says-so.md +87 -0
  21. package/docs/decisions/ADR-114-the-bench-pairs-at-the-task-level-a-missing-cost-is-not-zero-and-an-unasked-cross-group-compare-is-refused.md +74 -0
  22. package/docs/decisions/ADR-115-the-index-stamps-its-schema-version-migrates-older-databases-in-place-and-serves-newer-ones-from-a-sidecar.md +69 -0
  23. package/docs/decisions/ADR-116-rust-support-reaches-the-example-path-the-indent-and-the-bench-runner.md +100 -0
  24. package/docs/decisions/README.md +53 -0
  25. package/package.json +4 -2
  26. package/rules/core.md +2 -2
  27. package/rules/mdc/preview-postflight.mdc +5 -6
  28. package/rules/mdc/test-gate.mdc +2 -0
  29. package/rules/stacks/android.md +10 -11
  30. package/rules/stacks/cloudflare-workers.md +1 -1
  31. package/rules/stacks/connectiq.md +2 -2
  32. package/rules/stacks/container.md +2 -0
  33. package/rules/stacks/dart.md +1 -1
  34. package/rules/stacks/deno.md +1 -1
  35. package/rules/stacks/dotnet.md +1 -1
  36. package/rules/stacks/elixir.md +1 -1
  37. package/rules/stacks/go.md +1 -1
  38. package/rules/stacks/jvm.md +4 -3
  39. package/rules/stacks/node.md +2 -2
  40. package/rules/stacks/python.md +7 -6
  41. package/rules/stacks/react-native.md +3 -5
  42. package/rules/stacks/react-web.md +9 -9
  43. package/rules/stacks/ruby.md +1 -1
  44. package/rules/stacks/rust.md +1 -1
  45. package/rules/stacks/swift.md +1 -1
  46. package/rules/stacks/typescript.md +2 -2
  47. package/rules/stacks/uv.md +3 -2
  48. package/skills/simt-commands/SKILL.md +70 -0
  49. package/src/advice/advice.mjs +7 -3
  50. package/src/agenthooks/decide.mjs +238 -15
  51. package/src/agenthooks/opencode.mjs +72 -0
  52. package/src/agenthooks/policy.mjs +81 -5
  53. package/src/agenthooks/prompt.mjs +6 -2
  54. package/src/agenthooks/render.mjs +186 -19
  55. package/src/agenthooks/shell.mjs +523 -0
  56. package/src/agenthooks/shim.mjs +55 -0
  57. package/src/agents/render.mjs +277 -0
  58. package/src/argv.mjs +62 -9
  59. package/src/bench/ablate.mjs +31 -14
  60. package/src/bench/mine.mjs +48 -1
  61. package/src/bench/probes.mjs +5 -6
  62. package/src/bench/report.mjs +243 -80
  63. package/src/bench/run.mjs +12 -11
  64. package/src/bench/variants.mjs +112 -40
  65. package/src/brief/assemble.mjs +6 -0
  66. package/src/ci/workflow.mjs +16 -7
  67. package/src/commands/agent.mjs +206 -0
  68. package/src/commands/agenthook.mjs +133 -17
  69. package/src/commands/bench.mjs +2 -1
  70. package/src/commands/ci.mjs +28 -3
  71. package/src/commands/compare.mjs +8 -7
  72. package/src/commands/completions.mjs +27 -0
  73. package/src/commands/decide.mjs +20 -6
  74. package/src/commands/doctor.mjs +367 -0
  75. package/src/commands/evidence.mjs +13 -3
  76. package/src/commands/explain.mjs +52 -0
  77. package/src/commands/gate.mjs +85 -19
  78. package/src/commands/graph.mjs +18 -5
  79. package/src/commands/help.mjs +96 -26
  80. package/src/commands/hooks.mjs +258 -67
  81. package/src/commands/ignore.mjs +152 -0
  82. package/src/commands/impact.mjs +4 -2
  83. package/src/commands/index.mjs +69 -102
  84. package/src/commands/init.mjs +239 -37
  85. package/src/commands/lease.mjs +304 -0
  86. package/src/commands/lessons.mjs +77 -9
  87. package/src/commands/map.mjs +33 -18
  88. package/src/commands/mcp.mjs +2 -2
  89. package/src/commands/pack.mjs +9 -0
  90. package/src/commands/plan.mjs +13 -1
  91. package/src/commands/plugin.mjs +17 -2
  92. package/src/commands/prbody.mjs +45 -0
  93. package/src/commands/repoindex.mjs +4 -0
  94. package/src/commands/rules.mjs +219 -105
  95. package/src/commands/shared.mjs +36 -5
  96. package/src/commands/skills.mjs +329 -206
  97. package/src/commands/skillscompile.mjs +8 -7
  98. package/src/commands/skillsinstall.mjs +112 -30
  99. package/src/commands/slice.mjs +712 -0
  100. package/src/commands/status.mjs +62 -0
  101. package/src/commands/sync.mjs +146 -36
  102. package/src/commands/tests.mjs +5 -2
  103. package/src/commands/undo.mjs +114 -0
  104. package/src/commands/upgrade.mjs +103 -9
  105. package/src/commands/why.mjs +10 -4
  106. package/src/compare/hooksstate.mjs +23 -1
  107. package/src/compare/learn.mjs +82 -57
  108. package/src/compare/parallel.mjs +50 -0
  109. package/src/compare/row.mjs +26 -1
  110. package/src/completions.mjs +196 -0
  111. package/src/decisions/dir.mjs +84 -0
  112. package/src/decisions/index.mjs +109 -11
  113. package/src/diff.mjs +254 -0
  114. package/src/distill/distill.mjs +3 -1
  115. package/src/ecosystem/node-runner.mjs +144 -0
  116. package/src/explain.mjs +270 -0
  117. package/src/federation/config.mjs +44 -0
  118. package/src/graph/load.mjs +52 -24
  119. package/src/hooks/capability.mjs +14 -1
  120. package/src/hooks/dispatcher.mjs +441 -9
  121. package/src/hooks/gates.mjs +14 -3
  122. package/src/hooks/resolve.mjs +23 -3
  123. package/src/hooks/shim.mjs +12 -7
  124. package/src/identity.mjs +67 -14
  125. package/src/ignore.mjs +133 -0
  126. package/src/index/extract.mjs +192 -11
  127. package/src/index/persist.mjs +372 -55
  128. package/src/index/store.mjs +263 -60
  129. package/src/index/tests.mjs +6 -35
  130. package/src/journal.mjs +545 -0
  131. package/src/kernel/card.mjs +37 -12
  132. package/src/kernel/checks.mjs +44 -9
  133. package/src/kernel/variants.mjs +27 -16
  134. package/src/lease.mjs +195 -0
  135. package/src/ledger/index.mjs +91 -25
  136. package/src/mcp/resources.mjs +5 -3
  137. package/src/mcp/server.mjs +86 -13
  138. package/src/mcp/tools.mjs +340 -264
  139. package/src/memory/decide.mjs +98 -38
  140. package/src/memory/lessons.mjs +180 -33
  141. package/src/name.mjs +9 -0
  142. package/src/output/index.mjs +82 -12
  143. package/src/package-version.mjs +49 -1
  144. package/src/packs/manage.mjs +13 -4
  145. package/src/plan/index.mjs +37 -8
  146. package/src/plan/template.mjs +27 -5
  147. package/src/plugins.mjs +33 -8
  148. package/src/prbody.mjs +253 -0
  149. package/src/projection/baselines.mjs +1 -1
  150. package/src/projection/disclosure.mjs +2 -2
  151. package/src/projection/loaders.mjs +41 -1
  152. package/src/projection/lock.mjs +21 -14
  153. package/src/projection/manifest.mjs +82 -21
  154. package/src/projection/markers.mjs +43 -3
  155. package/src/projection/mdc.mjs +34 -7
  156. package/src/projection/project.mjs +162 -18
  157. package/src/projection/rules.mjs +54 -3
  158. package/src/projection/shared.mjs +4 -1
  159. package/src/projection/surfaces.mjs +9 -1
  160. package/src/repo-root.mjs +69 -0
  161. package/src/resolve/body.mjs +4 -0
  162. package/src/resolve/fingerprint.mjs +5 -0
  163. package/src/resolve/local.mjs +58 -0
  164. package/src/review/critic.mjs +4 -2
  165. package/src/secrets.mjs +374 -0
  166. package/src/state.mjs +76 -0
  167. package/src/status.mjs +157 -0
  168. package/src/toolwords.mjs +5 -0
  169. package/src/tsconfig.mjs +39 -99
  170. package/templates/plan/tracker.json +1 -1
package/CHANGELOG.md CHANGED
@@ -6,6 +6,88 @@ All notable changes to this package are recorded here. The format follows
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.7.0] — 2026-10-31
10
+
11
+ ### Added
12
+
13
+ `simt agent-hooks install --harness <id>` writes the policies into one
14
+ harness instead of all of them; an unknown id is a usage error that names
15
+ the valid ones. The readers the run skipped are named in the report
16
+ (`SKIPPED`) and in the JSON document's `notWritten`, so a narrowed install
17
+ cannot read as full coverage (ADR-107).
18
+
19
+ `simt init --yes` builds the repository index as part of the adoption, so
20
+ the first `simt map` or `simt brief` in a fresh repository answers from real
21
+ files. Commands that read the index (`map`, `brief`, `slice`) now refresh it
22
+ from the git index on every read — unchanged blobs are not re-read, so a
23
+ current repository pays for one `git ls-files -s` — and the prompt hook and
24
+ MCP surface still report a cold index rather than build one (ADR-108).
25
+
26
+ The rule text names the manifest as `simt.json`, the name it has had since
27
+ the rename; four rule files still said `simt-dev.json`, which resolves in no
28
+ repository.
29
+
30
+ ### Changed
31
+
32
+ The projection lock is `simt.lock.json`, the name that follows the command
33
+ and the manifest. A lock written under the old `simt-dev.lock.json` is still
34
+ read — including the `variants` winners nothing else records — and migrates
35
+ on the next write (ADR-110).
36
+
37
+ This repository is now a consumer of itself: `simt init` ran on its own
38
+ source, so the two tests that asserted it was *not* a consumer are rewritten
39
+ to assert the new state, and `AGENTS.md`'s "not self-adopted" section now
40
+ says what is true (ADR-109). A gate finding whose `detail` is absent is now
41
+ `null` rather than `undefined`, so the CLI's JSON and the MCP structured
42
+ surface of one answer deep-equal.
43
+
44
+ ## [0.6.3] — 2026-10-29
45
+
46
+ ### Added
47
+
48
+ `simt explain <CODE>` names what a `check` finding means, the decision behind
49
+ it, how to fix it, and a concrete trigger — one table row per finding code, so
50
+ every code `check` can emit has an entry.
51
+
52
+ `simt doctor --fix` applies only the remedies flagged safe (local, idempotent,
53
+ journaled) and lists the rest; a fixture with three safe and two unsafe findings
54
+ fixes exactly three.
55
+
56
+ `simt status --line` prints the gate state from the last `check` in under
57
+ 50 ms from cache — `simt PASS ✓rules ✓hooks 3/3gates` — for shell prompts, tmux
58
+ and agent status lines.
59
+
60
+ Every write records `{path, beforeDigest, afterDigest, beforeBytes}` in
61
+ `.simt/journal/`, and `simt undo` restores the last set when every file in it
62
+ is untouched since.
63
+
64
+ `--diff` on every writer prints a unified diff of the plan next to the report,
65
+ changing nothing about what the run writes.
66
+
67
+ `simt completions <bash|zsh|fish>` prints a completion script generated from the
68
+ command registry, so the three shells complete exactly the commands the binary
69
+ dispatches.
70
+
71
+ One ignore list (`.simtignore`) renders `.cursorignore`, `.aiderignore`,
72
+ `.geminiignore` and Claude `permissions.deny`, and a zero-dependency
73
+ staged-diff secret scan (vendor patterns plus Shannon entropy over added lines
74
+ only) blocks a commit carrying a probable secret without printing the bytes.
75
+
76
+ `simt slice start <id>` isolates the work in a linked worktree on branch
77
+ `slice/<id>` with the brief preloaded and flips the tracker row In progress;
78
+ `simt slice finish <id>` runs the declared gates, commits a Conventional
79
+ subject from the row title, and records the SHA and test command on the row.
80
+
81
+ `simt lease <paths> --session <id>` claims files until a TTL in
82
+ `.simt/leases.json`, and the pre-edit hook denies an edit leased by another
83
+ session (ADR-101).
84
+
85
+ `simt pr-body [--base <ref>]` assembles the pull request body from the evidence
86
+ ledger, the decision records the diff touches, the gate state from the last
87
+ check, and the residual risk in ADR-008 vocabulary. It is also exposed as the
88
+ `pr_body` MCP tool; the two longest tool descriptions were shortened to hold
89
+ the 2 KB `tools/list` budget.
90
+
9
91
  ## [0.6.2] — 2026-10-27
10
92
 
11
93
  ### Fixed
@@ -16,7 +98,7 @@ shapes and the leaking-paths count, both designed to move with the corpus).
16
98
  Same product as v0.6.1; this tag exists so the release automation is proven by
17
99
  a green run rather than described by a red one.
18
100
 
19
- ## [0.6.1] — 2026-10-27
101
+ ## [0.6.1] — 2026-10-27 (tagged, never published to npm)
20
102
 
21
103
  ### Fixed
22
104
 
package/README.md CHANGED
@@ -26,18 +26,18 @@ to merge. It does not write the projection.
26
26
  ## Install
27
27
 
28
28
  Requires **Node >= 22.20.0** for the npm and PyPI channels; the release binary carries
29
- its own runtime. The current published release is **0.5.0**. Pin it. The tool writes a
29
+ its own runtime. Pin the release you install. The tool writes a
30
30
  content digest into the files it generates, and an unpinned upgrade changes them under
31
31
  you.
32
32
 
33
33
  ```sh
34
- npm i -D simt-dev@0.5.0
34
+ npm i -D simt-dev
35
35
 
36
36
  # or globally
37
- npm i -g simt-dev@0.5.0
37
+ npm i -g simt-dev
38
38
 
39
39
  # or once, with no install
40
- npx -y simt-dev@0.5.0 check
40
+ npx -y simt-dev check
41
41
  ```
42
42
 
43
43
  ### From PyPI
@@ -68,7 +68,7 @@ runtime: the command works with no Node installed.
68
68
  ### As a single-file binary
69
69
 
70
70
  Each release carries one executable per platform — macOS arm64 and x64, Linux x64 —
71
- beside its `.sha256`. The channel's first release is the version after 0.5.0; pin that,
71
+ beside its `.sha256`. Pin the release you download,
72
72
  and run this from the repository's top level:
73
73
 
74
74
  ```sh
@@ -85,7 +85,7 @@ published `.sha256` before running anything.
85
85
  ```sh
86
86
  # Adopt, inspect, and maintain a repository
87
87
  simt init # adopt or scaffold; prints a plan; --yes writes
88
- simt doctor # stack, facts, evidence, and config health
88
+ simt doctor [--fix] # stack, facts, evidence, and config health (--fix applies safe remedies, journaled)
89
89
  simt check [--frozen] # projection drift, manifest, lock, and declared checkers
90
90
  simt sync [--explain] --yes # regenerate the projection
91
91
  simt upgrade --yes # move every consumer in the workspace to this SHA
@@ -103,6 +103,7 @@ simt why [path] # ADRs, rules, skills, gates, and lessons go
103
103
  simt rules list [--root <path>] # rule catalogue and what applies to a repository
104
104
  simt rules show <id> # read one rule body (including rules deferred in kernel mode)
105
105
  simt rules why <id|ADR-NNN> [--all] # the decision that settled a rule, and whether it still stands
106
+ simt explain <CODE> [--json] # what a check finding means, why it is reported, and how to fix it
106
107
  simt decide "<title>" --yes # scaffold the next ADR with structured simt-affects / simt-supersedes
107
108
  simt lessons list # fail-to-fix, revert, review-block, and hook-denial candidates
108
109
  simt lessons review <id> --yes # promote a candidate to docs/lessons/NNNN-<slug>.md
@@ -125,11 +126,20 @@ simt agent-hooks status # what each harness will run, and whether Co
125
126
  simt agent-hook <event> --harness # evaluate pre-tool-use, post-tool-use, or prompt-submit
126
127
  simt evidence # gate and test runs recorded against the current git tree
127
128
  simt evidence check <msg-file> # verify a commit message does not claim unrecorded passing runs
129
+ simt pr-body [--base <ref>] # a PR body: the evidence block for this tree, changed
130
+ # decisions, gate state, and residual risk in ADR-008 vocabulary
128
131
 
129
132
  # Plans, context metering, workspace learning, benchmarks, local models, and MCP
130
133
  simt plan status # count queued, in-progress, complete, and accepted tracker rows
131
134
  simt plan next [<id>] # print the next ready slice section (~1 KB)
132
135
  simt plan done <id> [<sha>] --yes # mark a tracker row complete with its commit SHA and test command
136
+ simt status --line # one-line gate state from the last check, for prompts (< 50 ms)
137
+ simt undo --yes # restore the last journaled set of writes, if untouched since
138
+ simt slice start <id> --yes # a worktree on branch slice/<id> with the brief preloaded; row In progress
139
+ simt slice finish <id> --yes # run the pre-commit gates, commit a Conventional subject from the
140
+ # row's title, and record the SHA and --test command on the row
141
+ simt lease [<paths>] --session # claim files for this session (--ttl, default 1h) or list claims;
142
+ # the pre-edit hook refuses another session's edit until the TTL
133
143
  simt tokens [--repos] [--session] # measure bytes loaded at session start or split a transcript
134
144
  simt harness detect [--user] # detect configured harnesses at repo and user level
135
145
  simt harness loaders [--table] # what each harness loads, in what order, and where its cap truncates
@@ -142,26 +152,38 @@ simt bench run --yes # evaluate arms (bare, current, kernel, brie
142
152
  simt bench report [--compare a b] # resolved rate, quality, cost, CPI, bootstrap CIs, McNemar/Wilcoxon
143
153
  simt bench ablate --yes # leave-one-out rule ablation ranked by value per KB
144
154
  simt bench probes --yes # 12 deterministic rule-compliance probes
145
- simt bench variants --yes # evaluate simt-variants slots and lock winners in simt-dev.lock.json
155
+ simt bench variants --yes # evaluate simt-variants slots and lock winners in simt.lock.json
156
+ simt review [--local] # an advisory ADR-008 verdict skeleton over the staged diff
157
+ simt distill <skill|doc> # a budgeted proposal summary with line citations, for a person to merge
146
158
  simt pack new <name> --source <spec> # scaffold a versioned pack: pack.json, bench.json, one rule
147
159
  simt pack lint [dir] [--require-measured] # validate a pack and state its measured ΔR
148
160
  simt pack publish [dir] --yes # publish an npm-sourced pack (git packs name the tag-and-push)
149
- simt mcp [--list] # serve the 13 read-only tools over stdio JSON-RPC
161
+ simt mcp [--list] # serve the 15 read-only tools over stdio JSON-RPC
162
+ simt completions <bash|zsh|fish> # a completion script generated from the command registry
163
+ simt ignore [--yes] [--diff] # render the one .simtignore list into .cursorignore,
164
+ # .aiderignore, .geminiignore and Claude's permissions.deny
150
165
  ```
151
166
 
152
167
  `init`, `sync`, `upgrade`, `hooks install`, `agent-hooks install`, `shared install`,
153
- `skills install`, `plan done`, `lessons review`, `decide`, `pack new`, `pack publish`
154
- and the `bench` writers print
155
- a plan and write nothing without `--yes`. None of them commit or push. `simt index`
168
+ `skills install`, `plan done`, `lessons review`, `decide`, `ignore`, `pack new`,
169
+ `pack publish`, `slice start`, `slice finish`, `lease` and the `bench` writers print
170
+ a plan and write nothing without `--yes`. None of them push, and only
171
+ `slice finish` commits — locally, through the pre-commit gates, and only what is
172
+ staged. `simt index`
156
173
  writes its cache without asking: the file is gitignored and `git ls-files` can rebuild it.
157
174
 
175
+ Declare `secret-scan` in `gates.preCommit` to block a commit whose staged diff
176
+ carries a probable secret: the scan runs inside the binary (vendor patterns plus
177
+ Shannon entropy, over added lines only), needs no install, and its report never
178
+ prints the matched bytes.
179
+
158
180
  `check` runs the checkers a rule names (`max-file-lines`, `forbid-regex`,
159
181
  `forbidden-path-edit`, `required-file`), verifies structured ADR supersessions
160
182
  (`prose-partial-supersession`), and flags expired lessons (`LESSON-EXPIRED`). A marked
161
183
  rule line leaves the projection as `Enforced:` and the checker's name. The file-length
162
184
  line warns past 400 lines and fails past 1000. `simt evidence check` warns when a commit
163
185
  message claims a passing run this tree does not have, and the commit fails when
164
- `gates.evidence` is `block`.
186
+ `gates.evidence` is `block`. Every finding `check` can emit is explained by `simt explain <CODE>` (DRIFT, UNMANAGED, PACK-DIGEST-MISMATCH, ...).
165
187
 
166
188
  ## Agent playbook: how and when to use each module
167
189
 
@@ -180,6 +202,7 @@ through `simt mcp`.
180
202
  | Rule violation or error | `simt lessons list` | `simt rules why <rule-id>` for the decision |
181
203
  | Working from a plan | `simt plan next` | `simt plan done <id> <sha> --yes` when finished |
182
204
  | Before committing | `simt check` | `simt evidence` to verify test claims |
205
+ | Opening a pull request | `simt pr-body` | `--base <ref>` to diff against another fork point |
183
206
  | Repository adoption | `simt init --yes` | `simt doctor` to verify stack detection |
184
207
  | Multi-repo workspace | `simt compare` | `simt shared plan` to find deduplication opportunities |
185
208
  | Local model available | `simt local doctor` | `simt index --embed` to build vector embeddings |
@@ -312,16 +335,16 @@ returns a JSON object with `task`, `commands`, `files`, `tests`, `decisions`, `s
312
335
  | **Governance & Provenance** | `simt why [path]`, `simt rules list`, `simt rules show <id>`, `simt rules why <id\|ADR-NNN>`, `simt decide` | `rules_list`, `rules_why` | Before touching governed files (`why`), when reading deferred kernel rules (`rules show`), or when checking/scaffolding ADRs (`rules why`, `decide`) |
313
336
  | **Skills & Disclosure** | `simt skills index\|brief\|show\|why\|find\|install\|compile\|eval`, `simt graph lint` | `skills_index`, `skills_find`, `skills_brief`, `skills_show`, `skills_why` | When a task requires domain workflows or reference docs without blowing the session token budget |
314
337
  | **Memory & Lessons** | `simt lessons list`, `simt lessons review <id> --yes` | — | After fixing a failing test/gate or hitting a hook denial, to inspect or promote reusable failure-to-fix lessons |
315
- | **Plans & Trackers** | `simt plan status`, `simt plan next [<id>]`, `simt plan done <id> [<sha>] --yes` | `plan_next`, `plan_done` | When executing a phased implementation or review plan row by row |
338
+ | **Plans & Trackers** | `simt plan status`, `simt plan next [<id>]`, `simt plan done <id> [<sha>] --yes`, `simt slice start\|finish <id>`, `simt lease`, `simt pr-body`, `simt status --line`, `simt undo` | `plan_next`, `plan_done`, `pr_body` | When executing a phased implementation or review plan row by row |
316
339
  | **Adoption & Projection** | `simt init`, `simt doctor`, `simt check [--frozen]`, `simt sync`, `simt upgrade`, `simt ci` | `doctor`, `check` | When adopting a repo, diagnosing stack/config health, or verifying zero drift before commit |
317
340
  | **Dual Gates & Evidence** | `simt hooks install\|status\|run`, `simt agent-hooks install\|status`, `simt agent-hook`, `simt evidence [check]` | — | When installing git/agent hooks, running gates manually, or verifying test claims before committing |
318
341
  | **Context & Harnesses** | `simt tokens [--repos] [--session]`, `simt harness detect\|loaders`, `simt shared plan\|install` | — | When auditing startup token cost across harnesses (`claude`, `codex`, `cursor`, `opencode`, `antigravity`, `copilot`, `deepseek`) or deduplicating workspace rules |
319
- | **Workspace & Benchmarks** | `simt compare`, `simt bench mine\|run\|report\|ablate\|probes\|variants`, `simt local doctor` | `compare` | When auditing an entire multi-repo estate, measuring rule uplift/cost, or probing local model endpoints |
342
+ | **Workspace & Benchmarks** | `simt compare`, `simt bench mine\|run\|report\|ablate\|probes\|variants`, `simt local doctor`, `simt review [--local]`, `simt distill` | `compare` | When auditing an entire multi-repo estate, measuring rule uplift/cost, or probing local model endpoints |
320
343
 
321
344
  ## Where the plan finishes
322
345
 
323
- Slices `R01`–`R45` are complete and shipped in `0.6.0`. The remaining queued slices are the
324
- small ergonomics:
346
+ Slices `R01`–`R55` are all complete. The small ergonomics (`R46`–`R55`) shipped
347
+ on top of `0.6.0`:
325
348
 
326
349
  - **The small doors (`R46`–`R55`).** `simt explain <CODE>` for every finding code, safe
327
350
  idempotent `simt doctor --fix`, a `< 50 ms` `simt status --line`, a write journal with
@@ -329,6 +352,12 @@ small ergonomics:
329
352
  plus a staged-diff secret scan, `simt slice start/finish <ID>` worktrees, file leases
330
353
  for parallel agents, and `simt pr-body` assembled from the evidence ledger.
331
354
 
355
+ The last two rows of review `0002` (`S38` workspace token cost, `S39` estate policy
356
+ as a pack) are closed by ruling in ADR-102: the instrument, the declaration and the
357
+ non-blocking finding shipped, the blocking gate and the registry-carrying pack were
358
+ refused by ruling, and the estate-side move is recorded as whose commit it waits on.
359
+ Everything in plans `0001`–`0003` and reviews `0001`–`0002` is Complete or Accepted.
360
+
332
361
  The local-model slices (`R38`–`R40`) shipped as they lab-written: `simt distill` proposes
333
362
  budgeted summaries with line citations, `simt review` proposes an advisory ADR-008
334
363
  verdict over the staged diff, and `simt brief` carries model/effort advice from bench
@@ -340,7 +369,7 @@ history. All remain off until named and propose rather than write projected text
340
369
  | --- | --- |
341
370
  | `AGENTS.md` (and `<package>/AGENTS.md` in monorepos) | the projection, between `<!-- simt:begin -->` and `<!-- simt:end -->`. The old `simt-dev:` markers are still read, and a region migrates on its next write |
342
371
  | `simt.json` | the manifest: `gates`, `substitutions`, `budget`, `mode`, `shared`, `surfaces`, `plans`, `packs`, `federation`, `local` |
343
- | `simt-dev.lock.json` | the digest of the inputs, the digest of the projection, and locked `variants` winners from `simt bench variants` |
372
+ | `simt.lock.json` | the digest of the inputs, the digest of the projection, and locked `variants` winners from `simt bench variants`. The old `simt-dev.lock.json` is still read, and a lock migrates on its next write |
344
373
  | `.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 |
345
374
  | `.editorconfig`, `.gitattributes` | baseline regions, placed first so a later setting still wins |
346
375
  | `.simt-hooks/` and `core.hooksPath` | the shared dispatcher. It fails closed |
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: Simt-Agent
3
+ description: Operates a repository with simt-dev: creates plan and review docs from the template, plans the next slice from the tracker, builds it, tests it, and commits it with evidence.
4
+ ---
5
+
6
+ You are the simt-dev operator for this repository. You do three jobs in one:
7
+ you **create the plan or review doc** when starting new work, you **plan** the
8
+ next piece of work from the tracker, and you **build** it. You act through the
9
+ `simt` commands the repository already runs, and you never claim a step you
10
+ did not take.
11
+
12
+ ## Orient before you act
13
+
14
+ - On a new task, run `simt brief "<task>"` before exploring. The packet tells
15
+ you how to run the tests, which files the task touches, and what governs them
16
+ — so you stop re-discovering what the repository already knows.
17
+ - Before editing a file, run `simt why <file>`. It lists the decisions, rules,
18
+ skills, gates and lessons that govern that file. Edit with those in mind.
19
+
20
+ ## Plan the next slice
21
+
22
+ - Read the tracker with `simt plan status` and `simt plan next`. `next` names
23
+ the smallest slice that is independently valuable, in dependency order.
24
+ - Resolve the open material decisions for that slice before building: ask 1–5
25
+ questions, recommended option first, and only where the authority documents
26
+ leave a real choice. Apply documented defaults without asking — operational
27
+ and procedural choices are not questions.
28
+ - State the slice you will take, the owning repository, the tracker task id,
29
+ and the acceptance checks, before you start.
30
+
31
+ ## Create the plan or review doc
32
+
33
+ When starting a new feature or a review, the deliverable is a file, not a
34
+ conversation. Write it before you build:
35
+
36
+ - **Plan:** `docs/plans/NNNN-slug.md` — the next number after the highest one
37
+ already in that directory. Open with `# Plan NNNN — Title`, a `Status:` line
38
+ (`**queued**` · created date), scope, and a tracker table with one row per
39
+ slice carrying an id, a state, and an evidence column. Each slice gets its
40
+ own section below the table.
41
+ - **Review:** `docs/reviews/NNNN-slug.md` — same numbering rule. Open with
42
+ `# Review NNNN — Title`, a `Status:` line, scope and method, severity
43
+ levels, and a tracker table or a pointer to the plan that owns the slices.
44
+ - Do not display the plan in the conversation and stop. The file is the
45
+ deliverable; the conversation is the working session.
46
+ - After the doc exists, track it with `simt plan status` and drive its rows
47
+ with `simt slice start` / `simt slice finish` / `simt plan done`.
48
+
49
+ ## Build one slice
50
+
51
+ - Start it with `simt slice start <id>`. This isolates the tracker row in its
52
+ own worktree with a task brief. Work only in that worktree.
53
+ - Make the smallest change that is independently valuable on its own. Do not
54
+ refactor outside the slice's blast radius.
55
+ - Run the focused test the change needs, through the repository's own runner,
56
+ naming the exact command and the exact test file. Every test must pass; a
57
+ partial pass is a blocker, not a result to quote.
58
+ - Stage only the files the slice touched. Leave unrelated work alone and say so.
59
+ Read the staged diff — not the working tree — before you commit.
60
+ - Finish it with `simt slice finish <id>`. This runs the declared gates, commits
61
+ with a Conventional Commits subject drawn from the row, and records the SHA.
62
+ - Record the slice complete with `simt plan done <id> <sha> --test "<command>"`,
63
+ carrying the evidence for the test you ran.
64
+
65
+ ## Dry run
66
+
67
+ Most simt-dev commands that write to the repository default to **dry-run**:
68
+ they print what they would change and exit without writing. Add `--yes` to
69
+ apply. Read the dry-run output first — it is the plan — then re-run with
70
+ `--yes`. A dry-run that shows an unexpected file is a reason to stop, not to
71
+ add `--yes` and hope.
72
+
73
+ For the full command reference — which commands are mutating vs read-only, and
74
+ the scenario-to-command mapping — read the `simt-commands` skill.
75
+
76
+ ## Boundaries you do not cross
77
+
78
+ - Never claim a test you did not run, a check you did not execute, or a commit
79
+ you did not make.
80
+ - Commit locally and report the SHA. Pushing is a separate decision that needs
81
+ its own approval; a finished slice is not a reason to push.
82
+ - Never use `--no-verify`, and never amend, rebase, reset or rewrite history
83
+ unless explicitly asked.
84
+ - A gate that cannot run blocks the commit; do not skip it to get a green line.
package/bin/simt.mjs CHANGED
@@ -4,26 +4,33 @@
4
4
  // POSIX only (ADR-012). package.json declares os: [darwin, linux], so npm refuses
5
5
  // the install elsewhere rather than letting a hook fail obscurely.
6
6
 
7
- import { parse } from '../src/argv.mjs';
7
+ import { parse, rawJsonFlag } from '../src/argv.mjs';
8
8
  import { EXIT, fail, jsonFailMode, jsonIndentDefault } from '../src/output/index.mjs';
9
9
 
10
10
  try {
11
11
  const argv = process.argv.slice(2);
12
12
  const parsed = parse(argv);
13
13
  if (!parsed.ok) {
14
- process.exit(parsed.code);
14
+ // The flags do not exist yet, so the JSON mode is read off the raw words:
15
+ // a parse failure under `--json` is a JSON document on stdout, not text on
16
+ // stderr with an empty stdout (Q11, ADR-070 ruling 4).
17
+ jsonFailMode(rawJsonFlag(argv));
18
+ process.exit(fail(parsed.error.message, parsed.error.code));
15
19
  }
16
20
  const { flags, positional } = parsed.value;
17
21
 
22
+ // Set before anything can fail: `no command given` under `--json` is a JSON
23
+ // document too, and a failure that prints as text with an empty stdout breaks
24
+ // the same ruling the parse failure above honours (Q11, ADR-070 ruling 4).
25
+ jsonIndentDefault(flags.pretty === true);
26
+ jsonFailMode(flags.json === true);
27
+
18
28
  // No arguments at all is a usage error, not a silent help dump: an agent that
19
29
  // ran the wrong thing should be told so rather than handed 40 lines of prose.
20
30
  if (positional.length === 0 && !flags.help && !flags.version) {
21
31
  process.exit(fail('no command given', EXIT.USAGE));
22
32
  }
23
33
 
24
- jsonIndentDefault(flags.pretty === true);
25
- jsonFailMode(flags.json === true);
26
-
27
34
  // The one command that runs on somebody else's hot path, and therefore the one that
28
35
  // does not load the registry. `agent-hook` is called before every tool call an agent
29
36
  // makes, so its latency is a product requirement rather than a nicety (plan 0003
@@ -41,7 +48,13 @@ try {
41
48
  }
42
49
 
43
50
  const { dispatch } = await import('../src/commands/index.mjs');
44
- process.exit((await dispatch(argv)) ?? EXIT.OK);
51
+ const code = (await dispatch(argv)) ?? EXIT.OK;
52
+ // Assigned, not forced: a large document on stdout (a `--json --diff` over a
53
+ // skill-sized body exceeds the 64 KiB pipe buffer) is still draining when the
54
+ // command resolves, and `process.exit()` cuts it — exit 0 with half a JSON
55
+ // document on stdout. Letting the loop empty first makes the exit honest
56
+ // (plan 0003 R50; the S10 contract asserts the document parses).
57
+ process.exitCode = code;
45
58
  } catch (error) {
46
59
  process.exit(fail(error?.message ?? String(error), EXIT.FAIL));
47
60
  }
@@ -1,6 +1,6 @@
1
1
  # ADR-009 — Skills are `<name>/SKILL.md` with mandatory frontmatter
2
2
 
3
- Status: **accepted** · 2026-10-05 · affects all repos
3
+ Status: **accepted** · 2026-10-05 · affects all repos · ruling 4 superseded by ADR-112
4
4
 
5
5
  ## Context
6
6
 
@@ -1,6 +1,6 @@
1
1
  # ADR-086 — The stable prefix comes first, and the lock records both digests
2
2
 
3
- Status: **accepted** · 2026-10-18 · filed as R13 (plan 0003)
3
+ Status: **accepted** · 2026-10-18 · filed as R13 (plan 0003) · ruling 3's file name is superseded by [ADR-110](ADR-110-the-lock-file-follows-the-manifest-name-and-the-old-name-is-read-until-the-next-write.md)
4
4
 
5
5
  **Affects:** `src/projection/rules.mjs`, `src/projection/lock.mjs`, `src/commands/sync.mjs`,
6
6
  `src/argv.mjs`, `test/lock.test.mjs`, `test/card.test.mjs`
@@ -0,0 +1,94 @@
1
+ ---
2
+ simt-affects: ["src/hooks/gates.mjs", "src/hooks/resolve.mjs", "src/hooks/dispatcher.mjs", "src/projection/manifest.mjs", "src/secrets.mjs"]
3
+ simt-supersedes: []
4
+ ---
5
+
6
+ # ADR-100 — a staged diff is the last gate before history, and it runs inside the tool
7
+
8
+ Status: **accepted** · 2026-10-27
9
+
10
+ Affects: `src/hooks/gates.mjs`, `src/hooks/resolve.mjs`,
11
+ `src/hooks/dispatcher.mjs`, `src/projection/manifest.mjs`, `src/secrets.mjs`
12
+
13
+ ## Context
14
+
15
+ Git history is append-only: a secret committed is a rotation exercise, not a
16
+ revert, and the one moment it can still be kept out is the commit. Every other
17
+ leak path in this tool is already gated — the projection, the manifest, the
18
+ evidence claim — but nothing gated the staged diff.
19
+
20
+ The three existing gate kinds cannot express this check. `staged` hands files
21
+ to a formatter binary in `node_modules/.bin`, `script` runs a `package.json`
22
+ script, and `command` runs a line the manifest declares: each resolves
23
+ something ON DISK, and each therefore has a way to be missing. A secret scan
24
+ has nothing to resolve — the implementation is the question being asked — and
25
+ making it a `command` gate would mean a repository declares `simt secrets`
26
+ (or installs a third-party scanner) before the check exists at all. That is
27
+ backwards for the repositories most at risk, which are frequently the ones with
28
+ the least toolchain to install into.
29
+
30
+ Plan 0003 R52 asks for both halves from one list and one binary: a
31
+ zero-dependency staged-diff scan (vendor patterns plus entropy), and no
32
+ repository needing anything to run it.
33
+
34
+ ## Ruling
35
+
36
+ 1. **A fourth gate kind, `builtin`, runs inside this binary.** It is declared
37
+ in the manifest like any other gate, a `gates.commands` entry overrides it
38
+ exactly as it overrides every other kind (the dispatcher's precedence is
39
+ unchanged), and its result flows through the same ledger line, the same
40
+ fail-closed reporting and the same `hooks status` view. What it never does
41
+ is resolve anything on disk: there is no script to miss, no formatter to
42
+ install and no command to declare, so `gateRunnable` reports it runnable and
43
+ `check` counts it as such. A `builtin` name with no implementation fails the
44
+ event with the name of the gate rather than passing.
45
+
46
+ 2. **`secret-scan` reads only the added lines of `git diff --cached`.** Two
47
+ detectors, both local: a pattern library for the shapes vendors publish
48
+ (AWS key ids, private key blocks, GitHub/Slack/Stripe/Google/OpenAI-style
49
+ tokens, JWTs, assigned secrets) and Shannon entropy (≥ 4.5 bits per
50
+ character over runs of ≥ 32 base64-ish characters) for the blobs no vendor
51
+ named. Values carrying placeholder markers (`example`, `changeme`,
52
+ `your_`, …) are documentation, not findings. Context lines are not
53
+ scanned: blocking a commit over bytes the author did not stage reproduces
54
+ the prohibition `format`'s staged-only rule exists for. If git cannot
55
+ answer, the gate fails rather than reading silence as a clean diff.
56
+
57
+ 3. **A finding never prints the matched bytes.** The report carries the
58
+ pattern id, the file, the line and a four-character prefix — the part a
59
+ vendor publishes as a type (`AKIA`, `sk-`, `ghp_`). Hook output lands in a
60
+ terminal, a CI log and often an agent's own transcript, and echoing the
61
+ secret into the report about the secret is the leak with extra steps.
62
+
63
+ 4. **The gate is opt-in, not an `init` default.** Entropy has a false-positive
64
+ rate no threshold eliminates, and a gate that blocks a first commit over a
65
+ sha256 digest teaches exactly the `--no-verify` habit the dispatcher exists
66
+ to prevent. A repository opts in by adding `secret-scan` to
67
+ `gates.preCommit`; from then on it is reported, counted and fail-closed like
68
+ every other declared gate.
69
+
70
+ ## Consequences
71
+
72
+ - A repository gets the scan by declaring the gate; nothing is installed,
73
+ nothing is fetched at hook time, and a fresh clone runs it identically.
74
+ - `unresolved()` and `gateRunnable()` know `builtin` as a runnable kind, so
75
+ `check` no longer has a gate it must call unrunnable-but-isn't; `hooks
76
+ status` prints `run builtin` for the entry.
77
+ - A `gates.commands["secret-scan"]` declaration replaces the built-in scan
78
+ with whatever line the repository names — the escape hatch every other kind
79
+ has, preserved for this one.
80
+ - The matcher lives in `src/secrets.mjs` and is unit-tested against sentinel
81
+ values, including the negative cases (hex digests, UUIDs, placeholders) that
82
+ decide whether the threshold is usable rather than merely strict.
83
+
84
+ ## Rejected
85
+
86
+ - **Shipping a third-party scanner (gitleaks, trufflehog).** It violates the
87
+ zero-dependency rule outright, and a hook that downloads a scanner at commit
88
+ time is a hook that fails on an offline machine — the failure mode ADR-010's
89
+ no-fetch-at-hook-time rule already refuses for `npx`.
90
+ - **Scanning the working tree or the whole repository.** That flags secrets
91
+ already in history on every subsequent commit (unfixable by the author of
92
+ this commit) and scans unstaged work nobody was about to record. The staged
93
+ diff is precisely the bytes the next commit would make permanent, and it is
94
+ the only bytes this gate claims to judge.
@@ -0,0 +1,95 @@
1
+ ---
2
+ simt-affects: ["src/lease.mjs", "src/commands/lease.mjs", "src/agenthooks/policy.mjs", "src/agenthooks/decide.mjs"]
3
+ simt-supersedes: []
4
+ ---
5
+
6
+ # ADR-101 — a file lease belongs to one session, and the pre-edit hook refuses another's edit
7
+
8
+ Status: **accepted** · 2026-10-28
9
+
10
+ Affects: `src/lease.mjs`, `src/commands/lease.mjs`,
11
+ `src/agenthooks/policy.mjs`, `src/agenthooks/decide.mjs`
12
+
13
+ ## Context
14
+
15
+ Parallel agents share one working tree, and the cheapest collision between them
16
+ is two sessions editing the same file at once: each edit is valid alone, and
17
+ the pair is neither — one session's work is overwritten by the other's save,
18
+ with no gate, no diff and no hook that ever sees a conflict. Git notices this
19
+ only at merge time, which is far after the fact either session can explain.
20
+
21
+ Plan 0003 R54 asks for a claim mechanism: `simt lease <paths>` records which
22
+ session is working on which path, with a TTL, and the pre-edit half of the
23
+ agent hook denies an edit from a session that does not hold the claim.
24
+
25
+ The policy table is where every other agent-time refusal lives (`push`,
26
+ `rewrite`, `generated`), so a lease refusal belongs there too — one table,
27
+ four harness dialects, one message. What the table has never had is a fact
28
+ that is not in the payload: which session is asking, and who else has claimed
29
+ the path.
30
+
31
+ ## Ruling
32
+
33
+ 1. **A lease is a claim, not a lock.** `.simt/leases.json` records one entry
34
+ per path: the repo-relative path, the session name, and an absolute expiry
35
+ timestamp. It is taken with `simt lease <paths>` (preview unless `--yes`),
36
+ the session comes from `--session` or `SIMT_SESSION`, and the TTL defaults
37
+ to an hour. There is no lock on the file and no daemon: a claim is advisory
38
+ data that expires on its own, last writer wins, and a claim lost to a race
39
+ is simply re-made. Coordination machinery would be a system built around a
40
+ file a TTL already cleans up.
41
+
42
+ 2. **A live claim held by a different session refuses a re-claim.** Stealing
43
+ is what expiry is for: the refusal names the holder and the expiry, and
44
+ the session that wants the path waits for the TTL or asks the holder. The
45
+ holder may re-claim (refresh) its own paths at any time.
46
+
47
+ 3. **The pre-edit hook denies an edit to a path another session holds.** The
48
+ check joins two facts at decision time: the active claims in the file, and
49
+ the asking session's name from `SIMT_SESSION` — one variable for the claim
50
+ and the check, because a denial is only explainable if the session it
51
+ protected is the same name the claim was filed under. A session that cannot
52
+ prove ownership is treated as another session: an unrecognised edit is
53
+ refused with the holder's name, not waved through. Expiry is read when the
54
+ hook runs, so a TTL needs no sweeper, and a claim with no file (the default
55
+ state of every repository) denies nothing.
56
+
57
+ 4. **An unreadable claim file fails closed for edits and only for edits.**
58
+ A `.simt/leases.json` that does not parse is evidence someone — possibly a
59
+ session routing around the check — broke the claims the hook is about to
60
+ enforce, so any write is refused until the file is fixed or removed; a
61
+ `lease` command refuses to write over it for the same reason. A shell
62
+ command with no file fact is not an edit and is not refused. This mirrors
63
+ the fail-closed contract every gate has, scoped to the question the lease
64
+ can actually answer.
65
+
66
+ 5. **The refusal is the `lease` policy, with the table's full machinery.** It
67
+ carries `ADR-101`, is lifted by `SIMT_ALLOW=lease` exactly as every other
68
+ policy is, exits with the harness's deny code, and its message names the
69
+ held paths, the holders and the expiry in ISO — the three things the
70
+ blocked session needs to act. The per-instance detail is a `detail` hook on
71
+ the row, so the message that quotes a timestamp does not become a special
72
+ case inside `decide`.
73
+
74
+ ## Consequences
75
+
76
+ - Two sessions in one working tree can coordinate with one command and no
77
+ shared process; a crashed session's claims lapse on their own.
78
+ - The hook's hot path gains one small `readFile` of a file that is usually
79
+ absent, and only when the payload named a file to write.
80
+ - `learn.mjs` reads policy rows by `id` and `adr` only, so the `lease` row
81
+ joins the estate's violation aggregation with no further wiring.
82
+ - The claim file is local state under `.simt` like the index and the journal:
83
+ never projected, never committed.
84
+
85
+ ## Rejected
86
+
87
+ - **File locking (`flock`, a lockfile protocol).** A lock that blocks is a
88
+ deadlock with a crashed session in it, and it needs the very daemon ruling 1
89
+ refuses. The TTL already bounds every claim.
90
+ - **Inferring leased paths from shell commands.** Only the edit tools name a
91
+ file with no guesswork; guessing at what a `sh -c` line will write is the
92
+ payload-shaped false positive the policy table was built to avoid — no fact
93
+ is not a violation.
94
+ - **A lease the holder must release to finish.** Forgetting to release is the
95
+ expected failure of any release-based protocol; an expiry is not.