@skathio/somi 4.1.1 → 5.0.1

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 (372) hide show
  1. package/.claude-plugin/icon.png +0 -0
  2. package/.claude-plugin/marketplace.json +8 -3
  3. package/.claude-plugin/plugin.json +9 -10
  4. package/.copilot-extension/extension.json +32 -40
  5. package/.copilot-extension/marketplace.json +8 -3
  6. package/README.md +88 -227
  7. package/VERSION +1 -1
  8. package/agents/somi-reviewer.md +21 -40
  9. package/agents/somi-security-reviewer.md +16 -90
  10. package/agents/somi-worker-high.md +11 -0
  11. package/agents/somi-worker-low.md +11 -0
  12. package/agents/somi-worker-medium.md +11 -0
  13. package/agents/somi.md +8 -75
  14. package/commands/somi-config.md +5 -14
  15. package/commands/somi-deliver.md +11 -0
  16. package/commands/somi-quality.md +10 -0
  17. package/commands/somi-review.md +10 -0
  18. package/commands/somi-status.md +11 -0
  19. package/commands/somi.md +10 -0
  20. package/hooks/hooks.json +29 -23
  21. package/hooks/lib/common.mjs +45 -34
  22. package/hooks/pre-tool/apply-tier.mjs +31 -0
  23. package/hooks/pre-tool/block-dangerous-bash.mjs +15 -0
  24. package/hooks/pre-tool/gate-dep-install.mjs +2 -2
  25. package/hooks/pre-tool/guard-protected-paths.mjs +9 -16
  26. package/hooks/pre-tool/guard-tier-config.mjs +17 -0
  27. package/hooks/pre-tool/reviewers-read-only.mjs +11 -0
  28. package/hooks/session-start/inject-digest.mjs +51 -0
  29. package/hooks/stop/review-due.mjs +44 -0
  30. package/hooks/user-prompt/capture-prompt.mjs +17 -0
  31. package/library/lenses/architecture.md +1 -0
  32. package/library/lenses/test-strategy.md +1 -0
  33. package/library/roles/accessibility.md +1 -0
  34. package/library/roles/answer.md +1 -0
  35. package/library/roles/atlas.md +1 -0
  36. package/library/roles/build.md +1 -0
  37. package/library/roles/debug.md +6 -0
  38. package/library/roles/design.md +1 -0
  39. package/library/roles/discover.md +1 -0
  40. package/library/roles/incident.md +1 -0
  41. package/library/roles/migrate.md +1 -0
  42. package/library/roles/perf.md +1 -0
  43. package/library/roles/plan.md +1 -0
  44. package/library/roles/refactor.md +1 -0
  45. package/library/roles/review.md +1 -0
  46. package/library/roles/security-review.md +1 -0
  47. package/library/roles/upgrade.md +1 -0
  48. package/library/skills/accessibility.md +16 -0
  49. package/library/skills/ci-infra-gotchas.md +12 -0
  50. package/library/skills/perf-method.md +10 -0
  51. package/library/skills/secure-coding.md +18 -0
  52. package/library/skills/testing-checklist.md +16 -0
  53. package/library/skills/threat-modeling.md +10 -0
  54. package/package.json +12 -17
  55. package/profiles/claude.json +21 -0
  56. package/profiles/copilot.json +5 -0
  57. package/rules/digest.md +40 -0
  58. package/scripts/check-links.mjs +65 -76
  59. package/scripts/lib/advisor.mjs +207 -0
  60. package/scripts/lib/check.mjs +167 -0
  61. package/scripts/lib/copilot-workflow.mjs +41 -0
  62. package/scripts/lib/doctor.mjs +91 -0
  63. package/scripts/lib/gates.mjs +69 -0
  64. package/scripts/lib/git-tree.mjs +201 -0
  65. package/scripts/lib/init.mjs +23 -0
  66. package/scripts/lib/ledger.mjs +38 -0
  67. package/scripts/lib/mcp-project-root.mjs +63 -67
  68. package/scripts/lib/migrate.mjs +73 -0
  69. package/scripts/lib/path-facts.mjs +2 -2
  70. package/scripts/lib/path-safety.mjs +6 -134
  71. package/scripts/lib/plan.mjs +69 -0
  72. package/scripts/lib/policy.mjs +103 -0
  73. package/scripts/lib/pr.mjs +28 -0
  74. package/scripts/lib/prompt.mjs +72 -0
  75. package/scripts/lib/quality/clones.mjs +76 -0
  76. package/scripts/lib/quality/css.mjs +43 -0
  77. package/scripts/lib/quality/gate.mjs +230 -0
  78. package/scripts/lib/quality/limits.mjs +97 -0
  79. package/scripts/lib/quality/metrics.mjs +159 -0
  80. package/scripts/lib/quality/parse.mjs +73 -0
  81. package/scripts/lib/quality/repo.mjs +69 -0
  82. package/scripts/lib/quality/run.mjs +58 -0
  83. package/scripts/lib/reviews.mjs +132 -0
  84. package/scripts/lib/routes.mjs +108 -0
  85. package/scripts/lib/setup.mjs +34 -0
  86. package/scripts/lib/shards.mjs +166 -0
  87. package/scripts/lib/signals.mjs +110 -0
  88. package/scripts/lib/state.mjs +42 -0
  89. package/scripts/lib/tiers.mjs +42 -0
  90. package/scripts/lib/update-notice.mjs +48 -0
  91. package/scripts/lib/views.mjs +62 -0
  92. package/scripts/lib/workflows.mjs +56 -0
  93. package/scripts/somi-mcp.mjs +182 -323
  94. package/scripts/somi.mjs +208 -0
  95. package/scripts/vendor/tree-sitter/LICENSE.vscode-tree-sitter-wasm +21 -0
  96. package/scripts/vendor/tree-sitter/LICENSE.web-tree-sitter +21 -0
  97. package/scripts/vendor/tree-sitter/cgmanifest.vscode-tree-sitter-wasm.json +16 -0
  98. package/scripts/vendor/tree-sitter/manifest.json +59 -0
  99. package/scripts/vendor/tree-sitter/package.json +3 -0
  100. package/scripts/vendor/tree-sitter/tree-sitter-css.wasm +0 -0
  101. package/scripts/vendor/tree-sitter/tree-sitter-javascript.wasm +0 -0
  102. package/scripts/vendor/tree-sitter/tree-sitter-tsx.wasm +0 -0
  103. package/scripts/vendor/tree-sitter/tree-sitter-typescript.wasm +0 -0
  104. package/scripts/vendor/tree-sitter/web-tree-sitter.js +4081 -0
  105. package/scripts/vendor/tree-sitter/web-tree-sitter.wasm +0 -0
  106. package/skills/somi-expertise/SKILL.md +6 -0
  107. package/workflows/deliver-stages.js +81 -0
  108. package/.claude/settings.json +0 -131
  109. package/agents/somi-architecture-reviewer.md +0 -101
  110. package/agents/somi-atlas.md +0 -100
  111. package/agents/somi-coder.md +0 -60
  112. package/agents/somi-designer.md +0 -36
  113. package/agents/somi-discovery-analyst.md +0 -57
  114. package/agents/somi-flow.md +0 -47
  115. package/agents/somi-general.md +0 -36
  116. package/agents/somi-impact.md +0 -95
  117. package/agents/somi-incident.md +0 -94
  118. package/agents/somi-plan-reviewer.md +0 -68
  119. package/agents/somi-planner.md +0 -57
  120. package/agents/somi-pr.md +0 -99
  121. package/agents/somi-refactor-designer.md +0 -81
  122. package/agents/somi-refactorer.md +0 -99
  123. package/agents/somi-sdlc-reviewer.md +0 -67
  124. package/agents/somi-test-strategist.md +0 -87
  125. package/commands/adopt.md +0 -14
  126. package/commands/architecture-review.md +0 -19
  127. package/commands/atlas.md +0 -19
  128. package/commands/code-loop.md +0 -19
  129. package/commands/code-parallel.md +0 -19
  130. package/commands/code.md +0 -19
  131. package/commands/debug.md +0 -19
  132. package/commands/design.md +0 -19
  133. package/commands/discover.md +0 -19
  134. package/commands/impact.md +0 -19
  135. package/commands/incident.md +0 -19
  136. package/commands/plan-loop.md +0 -19
  137. package/commands/plan.md +0 -19
  138. package/commands/pr.md +0 -19
  139. package/commands/refactor-design.md +0 -19
  140. package/commands/refactor.md +0 -19
  141. package/commands/release-readiness.md +0 -19
  142. package/commands/review-panel.md +0 -19
  143. package/commands/review.md +0 -19
  144. package/commands/security-review.md +0 -19
  145. package/commands/ship-loop.md +0 -19
  146. package/commands/ship.md +0 -19
  147. package/commands/test-strategy.md +0 -19
  148. package/commands/upgrade.md +0 -19
  149. package/examples/README.md +0 -19
  150. package/examples/code-review-example.md +0 -88
  151. package/examples/discovery-example.md +0 -200
  152. package/examples/feature-plan-example.md +0 -377
  153. package/examples/full-pipeline-example.md +0 -188
  154. package/examples/sample-consumer/.claude/settings.json +0 -29
  155. package/examples/sample-consumer/CLAUDE.md +0 -78
  156. package/examples/sample-consumer/README.md +0 -102
  157. package/hooks/post-tool/lint-changed-files.mjs +0 -209
  158. package/hooks/pre-tool/guard-cost-lowering.mjs +0 -192
  159. package/hooks/session-start/detect-repo-instructions.mjs +0 -287
  160. package/hooks/session-start/ensure-default-config.mjs +0 -113
  161. package/hooks/user-prompt-submit/inject-workflow-context.mjs +0 -580
  162. package/rules/00-priorities.md +0 -48
  163. package/rules/10-solid.md +0 -87
  164. package/rules/20-clean-code.md +0 -62
  165. package/rules/30-security-owasp.md +0 -83
  166. package/rules/40-engineering-practices.md +0 -65
  167. package/rules/50-collaboration.md +0 -114
  168. package/rules/99-overrides.md +0 -52
  169. package/rules/CLAUDE.md +0 -200
  170. package/scripts/check-session-artefacts.mjs +0 -149
  171. package/scripts/check-size-budget.mjs +0 -137
  172. package/scripts/generate-digest.mjs +0 -176
  173. package/scripts/lib/agent-info.mjs +0 -85
  174. package/scripts/lib/agent-registry.mjs +0 -92
  175. package/scripts/lib/cost-ceiling.mjs +0 -328
  176. package/scripts/lib/cost-config-edit.mjs +0 -102
  177. package/scripts/lib/cost-config.mjs +0 -64
  178. package/scripts/lib/cost-defaults.mjs +0 -53
  179. package/scripts/lib/cost-lowering.mjs +0 -89
  180. package/scripts/lib/cost-model.mjs +0 -110
  181. package/scripts/lib/dispatch-resolver.mjs +0 -243
  182. package/scripts/lib/escalation-facts.mjs +0 -146
  183. package/scripts/lib/escalation.mjs +0 -129
  184. package/scripts/lib/findings-ledger.mjs +0 -241
  185. package/scripts/lib/install-text.mjs +0 -97
  186. package/scripts/lib/loop-caps.mjs +0 -140
  187. package/scripts/lib/loop-diff.mjs +0 -38
  188. package/scripts/lib/loop-dispatch.mjs +0 -19
  189. package/scripts/lib/loop-engine.mjs +0 -227
  190. package/scripts/lib/loop-escalate.mjs +0 -49
  191. package/scripts/lib/loop-exit.mjs +0 -47
  192. package/scripts/lib/loop-notes-compact.mjs +0 -72
  193. package/scripts/lib/loop-notes.mjs +0 -282
  194. package/scripts/lib/loop-review.mjs +0 -395
  195. package/scripts/lib/loop-state.mjs +0 -44
  196. package/scripts/lib/loop-step-close.mjs +0 -75
  197. package/scripts/lib/loop-step-kit.mjs +0 -179
  198. package/scripts/lib/loop-step-review.mjs +0 -140
  199. package/scripts/lib/loop-step-tool.mjs +0 -89
  200. package/scripts/lib/loop-step.mjs +0 -303
  201. package/scripts/lib/run-budget.mjs +0 -28
  202. package/scripts/lib/run-card.mjs +0 -73
  203. package/scripts/lib/size-tier.mjs +0 -184
  204. package/scripts/lib/tier-record.mjs +0 -82
  205. package/scripts/size-budget-overrides.json +0 -58
  206. package/scripts/somi-card.mjs +0 -39
  207. package/scripts/somi-check.mjs +0 -237
  208. package/scripts/somi-config.mjs +0 -421
  209. package/scripts/somi-dispatch.mjs +0 -141
  210. package/scripts/somi-findings.mjs +0 -100
  211. package/scripts/somi-loop.mjs +0 -139
  212. package/scripts/somi-tier.mjs +0 -393
  213. package/scripts/validate.sh +0 -653
  214. package/skills/api-design/SKILL.md +0 -147
  215. package/skills/clean-code/SKILL.md +0 -142
  216. package/skills/flow-adopt/SKILL.md +0 -92
  217. package/skills/flow-architecture-review/SKILL.md +0 -94
  218. package/skills/flow-atlas/SKILL.md +0 -34
  219. package/skills/flow-code/SKILL.md +0 -167
  220. package/skills/flow-code-loop/SKILL.md +0 -263
  221. package/skills/flow-code-parallel/SKILL.md +0 -160
  222. package/skills/flow-debug/SKILL.md +0 -141
  223. package/skills/flow-design/SKILL.md +0 -170
  224. package/skills/flow-discover/SKILL.md +0 -204
  225. package/skills/flow-impact/SKILL.md +0 -35
  226. package/skills/flow-incident/SKILL.md +0 -49
  227. package/skills/flow-plan/SKILL.md +0 -254
  228. package/skills/flow-plan-loop/SKILL.md +0 -254
  229. package/skills/flow-pr/SKILL.md +0 -34
  230. package/skills/flow-refactor/SKILL.md +0 -58
  231. package/skills/flow-refactor-design/SKILL.md +0 -97
  232. package/skills/flow-release-readiness/SKILL.md +0 -82
  233. package/skills/flow-review/SKILL.md +0 -193
  234. package/skills/flow-review-panel/SKILL.md +0 -154
  235. package/skills/flow-security-review/SKILL.md +0 -83
  236. package/skills/flow-ship/SKILL.md +0 -125
  237. package/skills/flow-ship-loop/SKILL.md +0 -274
  238. package/skills/flow-somi-config/SKILL.md +0 -142
  239. package/skills/flow-status/SKILL.md +0 -43
  240. package/skills/flow-test-strategy/SKILL.md +0 -83
  241. package/skills/flow-upgrade/SKILL.md +0 -82
  242. package/skills/market-research/SKILL.md +0 -125
  243. package/skills/observability/SKILL.md +0 -133
  244. package/skills/owasp-defense/SKILL.md +0 -141
  245. package/skills/plan-review/SKILL.md +0 -83
  246. package/skills/reasoning-craft/SKILL.md +0 -213
  247. package/skills/requirements-engineering/SKILL.md +0 -137
  248. package/skills/role-coder/SKILL.md +0 -247
  249. package/skills/role-designer/SKILL.md +0 -172
  250. package/skills/role-discovery-analyst/SKILL.md +0 -288
  251. package/skills/role-planner/SKILL.md +0 -353
  252. package/skills/role-reviewer/SKILL.md +0 -218
  253. package/skills/rules/SKILL.md +0 -47
  254. package/skills/sdlc-process/SKILL.md +0 -74
  255. package/skills/solid-principles/SKILL.md +0 -143
  256. package/skills/somi-checkpoint/SKILL.md +0 -95
  257. package/skills/somi-dispatch/SKILL.md +0 -259
  258. package/skills/somi-routing/SKILL.md +0 -158
  259. package/skills/testing-playbook/SKILL.md +0 -133
  260. package/skills/threat-modeling/SKILL.md +0 -117
  261. package/templates/ADR.md.tmpl +0 -73
  262. package/templates/ATLAS.md.tmpl +0 -75
  263. package/templates/BRD.md.tmpl +0 -68
  264. package/templates/BRIEF.md.tmpl +0 -119
  265. package/templates/CONTEXT.md.tmpl +0 -74
  266. package/templates/DECISIONS.md.tmpl +0 -105
  267. package/templates/DESIGN.md.tmpl +0 -83
  268. package/templates/DIARY.md.tmpl +0 -70
  269. package/templates/DOD.md.tmpl +0 -90
  270. package/templates/FRD.md.tmpl +0 -64
  271. package/templates/PHASE.md.tmpl +0 -80
  272. package/templates/PROGRESS.md.tmpl +0 -63
  273. package/templates/RCA.md.tmpl +0 -53
  274. package/templates/RD-README.md.tmpl +0 -70
  275. package/templates/RESEARCH.md.tmpl +0 -96
  276. package/templates/REVIEW.md.tmpl +0 -82
  277. package/templates/SDD.md.tmpl +0 -82
  278. package/templates/SOMI-README.md.tmpl +0 -83
  279. package/templates/SPEC.md.tmpl +0 -123
  280. package/templates/SRS.md.tmpl +0 -85
  281. package/templates/TDD.md.tmpl +0 -77
  282. package/tests/hooks/cases/audit-log.json +0 -21
  283. package/tests/hooks/cases/block-dangerous-bash.json +0 -166
  284. package/tests/hooks/cases/block-secret-writes.json +0 -140
  285. package/tests/hooks/cases/detect-repo-instructions.json +0 -105
  286. package/tests/hooks/cases/gate-dep-install.json +0 -42
  287. package/tests/hooks/cases/guard-protected-paths.json +0 -222
  288. package/tests/hooks/cases/inject-workflow-context.json +0 -239
  289. package/tests/hooks/cases/lint-changed-files.json +0 -120
  290. package/tests/hooks/run.sh +0 -392
  291. package/tests/scripts/agent-model-frontmatter.sh +0 -38
  292. package/tests/scripts/agent-names.sh +0 -77
  293. package/tests/scripts/check-frontmatter.sh +0 -37
  294. package/tests/scripts/check-links.sh +0 -105
  295. package/tests/scripts/check-session-artefacts.sh +0 -60
  296. package/tests/scripts/check-size-budget.sh +0 -71
  297. package/tests/scripts/checkpoint-gate.sh +0 -131
  298. package/tests/scripts/convergence-runner.sh +0 -1514
  299. package/tests/scripts/cost-ceiling.sh +0 -255
  300. package/tests/scripts/cost-defaults.sh +0 -130
  301. package/tests/scripts/cost-hardcap.sh +0 -338
  302. package/tests/scripts/cost-lowering.sh +0 -261
  303. package/tests/scripts/cost-model.sh +0 -196
  304. package/tests/scripts/dispatch-guard.sh +0 -108
  305. package/tests/scripts/dispatch-line-gate.sh +0 -61
  306. package/tests/scripts/dispatch-reference-gate.sh +0 -173
  307. package/tests/scripts/ensure-default-config.sh +0 -162
  308. package/tests/scripts/escalation.sh +0 -409
  309. package/tests/scripts/eval-runner.sh +0 -3692
  310. package/tests/scripts/evals-packaging.sh +0 -224
  311. package/tests/scripts/fact-sheet.sh +0 -296
  312. package/tests/scripts/fixtures/legacy-shard-no-schema.json +0 -50
  313. package/tests/scripts/fixtures/mock-stdin-read-throw.cjs +0 -18
  314. package/tests/scripts/fixtures/size-tier-cases.json +0 -87
  315. package/tests/scripts/generate-digest.sh +0 -180
  316. package/tests/scripts/global-config.sh +0 -167
  317. package/tests/scripts/goldens/loop-state-breach.json +0 -1
  318. package/tests/scripts/goldens/loop-state-done.json +0 -1
  319. package/tests/scripts/goldens/somi-findings.json +0 -336
  320. package/tests/scripts/goldens/somi-loop.json +0 -168
  321. package/tests/scripts/lib/adr-shape.mjs +0 -41
  322. package/tests/scripts/lib/agent-registry-tests.mjs +0 -95
  323. package/tests/scripts/lib/brief-only-guard.mjs +0 -27
  324. package/tests/scripts/lib/checkpoint-gate.mjs +0 -91
  325. package/tests/scripts/lib/digest-marker-coupling.mjs +0 -52
  326. package/tests/scripts/lib/dispatch-reference-gate.mjs +0 -121
  327. package/tests/scripts/lib/escalation-facts-tests.mjs +0 -140
  328. package/tests/scripts/lib/escalation-tests.mjs +0 -154
  329. package/tests/scripts/lib/findings-ledger-tests.mjs +0 -118
  330. package/tests/scripts/lib/loop-engine-tests.mjs +0 -287
  331. package/tests/scripts/lib/loop-escalate-tests.mjs +0 -356
  332. package/tests/scripts/lib/loop-flow-gate.mjs +0 -173
  333. package/tests/scripts/lib/loop-notes-tests.mjs +0 -384
  334. package/tests/scripts/lib/loop-step-cli-tests.mjs +0 -156
  335. package/tests/scripts/lib/loop-step-close-tests.mjs +0 -351
  336. package/tests/scripts/lib/loop-step-lenient-tests.mjs +0 -114
  337. package/tests/scripts/lib/loop-step-state-tests.mjs +0 -127
  338. package/tests/scripts/lib/loop-step-tests.mjs +0 -499
  339. package/tests/scripts/lib/loop-step-unwritten-tests.mjs +0 -55
  340. package/tests/scripts/lib/multipass-dependence.mjs +0 -192
  341. package/tests/scripts/lib/multipass-source-identity.mjs +0 -243
  342. package/tests/scripts/lib/path-facts-tests.mjs +0 -198
  343. package/tests/scripts/lib/path-safety-tests.mjs +0 -201
  344. package/tests/scripts/lib/reference-pair.mjs +0 -61
  345. package/tests/scripts/lib/retirement-gate.mjs +0 -172
  346. package/tests/scripts/lib/run-suites.mjs +0 -139
  347. package/tests/scripts/lib/shell-embedded-js.mjs +0 -47
  348. package/tests/scripts/lib/ship-loop-sizing-guard.mjs +0 -52
  349. package/tests/scripts/lib/site-roadmap-gate.mjs +0 -64
  350. package/tests/scripts/lib/size-tier-drift.mjs +0 -74
  351. package/tests/scripts/lib/sizing-score-tests.mjs +0 -210
  352. package/tests/scripts/lib/sizing-set-tests.mjs +0 -131
  353. package/tests/scripts/lib/somi-mcp-client.mjs +0 -102
  354. package/tests/scripts/lib/somi-mcp-config-tests.mjs +0 -92
  355. package/tests/scripts/lib/somi-mcp-loop-tests.mjs +0 -226
  356. package/tests/scripts/lib/somi-mcp-tests.mjs +0 -491
  357. package/tests/scripts/lib/somi-mcp-tier-tests.mjs +0 -64
  358. package/tests/scripts/lib/somi-mcp-tool-schema.mjs +0 -38
  359. package/tests/scripts/loop-engine.sh +0 -22
  360. package/tests/scripts/loop-flow-gate.sh +0 -11
  361. package/tests/scripts/retirement-gate.sh +0 -306
  362. package/tests/scripts/review-panel-seats.sh +0 -32
  363. package/tests/scripts/run-card.sh +0 -57
  364. package/tests/scripts/run-suites.sh +0 -74
  365. package/tests/scripts/run.sh +0 -689
  366. package/tests/scripts/site-roadmap-gate.sh +0 -76
  367. package/tests/scripts/size-tier.sh +0 -562
  368. package/tests/scripts/somi-agent-dispatch-contract.sh +0 -224
  369. package/tests/scripts/somi-config.sh +0 -286
  370. package/tests/scripts/somi-dispatch.sh +0 -465
  371. package/tests/scripts/somi-mcp.sh +0 -15
  372. package/tests/scripts/suite-plan.json +0 -20
@@ -1,213 +0,0 @@
1
- ---
2
- name: reasoning-craft
3
- description: Use before answering a non-trivial question, when reviewing your own draft for hedging or generic-adjective phrasing, or when another skill or rule points here for the full detector catalog, worked trace, and voice-calibration spec. Covers the three pre-write parses, the four mid-generation detectors, metaphor/axis discipline, and stakes-to-directness calibration.
4
- ---
5
-
6
- # Reasoning craft — parses, detectors, and voice calibration
7
-
8
- The compressed always-on version is the "Reasoning craft" bullet in the Always-on digest section of
9
- `rules/CLAUDE.md` (mirrored in `AGENTS.md`) — that's the load-bearing floor every agent carries on
10
- every turn. `rules/50-collaboration.md` is the other always-on floor this skill builds on top of:
11
- directness, matching the answer to the question, options-with-pros-cons already live there. This
12
- skill adds **operational depth** the digest bullet can't afford: full definitions, before/after
13
- example pairs, a worked trace, and when-not-to-apply guidance. Where a section here would just
14
- restate the digest bullet or `50`, it points instead of repeating.
15
-
16
- ## The three pre-write parses (run in order, before any words)
17
-
18
- ### 1. Trajectory — parse the situation, not the sentence
19
-
20
- Before answering, ask: what will the reader do with this in the next ten minutes, and what will
21
- they ask next? If the follow-up is predictable, fold it into this answer instead of waiting for a
22
- second round-trip.
23
-
24
- - **Before** (parses the sentence): user asks "how do I exit vim." Answer: "Press `Esc` then type
25
- `:q` and hit Enter."
26
- - **After** (parses the trajectory): same question, but the user is mid-edit and panicking. Answer:
27
- "Press `Esc`, then `:wq` and Enter to save and quit — or `:q!` to discard changes if you didn't
28
- mean to edit anything." The second answer serves the actual next ten minutes: they don't just
29
- want out, they want out *without losing work*, and the two branches need distinguishing because
30
- they can't tell which one they're in.
31
-
32
- Falsifiable check: if the draft would be an equally correct answer to a different, easier question,
33
- it parsed the sentence, not the trajectory.
34
-
35
- ### 2. Shape — decide the deliverable's form before the words
36
-
37
- Pick the shape first: one sentence, a paragraph, a table, code, a document. Structure (headers,
38
- lists) gets added only when the content is genuinely enumerable — never to look thorough. A factual
39
- question gets the fact in sentence one.
40
-
41
- - **Before** (words first, shape emergent): a three-paragraph essay on caching tradeoffs that
42
- buries "add a 5-minute TTL cache on `getUserProfile`" in paragraph two.
43
- - **After** (shape first): "Add a 5-minute TTL cache on `getUserProfile` — it's called ~40x per
44
- page load and the data changes rarely. [one paragraph on placement + invalidation]." The answer
45
- leads because the shape decision ("one-line recommendation + one paragraph of mechanism, not an
46
- essay") was made before drafting, not discovered by writing three paragraphs and noticing which
47
- one mattered.
48
-
49
- Falsifiable check: can the shape ("one paragraph," "a 4-row table," "a diff") be named in one clause
50
- before the first sentence is written? If not, the deliverable isn't decided yet.
51
-
52
- ### 3. Verify — sort every claim into known / inferred / must-verify
53
-
54
- Explicitly bin each claim. Mark inferred claims as inference in the output. For anything checkable
55
- and material, check it — don't assert it.
56
-
57
- - **Before** (asserted): "This should work now — the retry logic handles the timeout case."
58
- - **After** (verified, or inference marked): "Ran the test suite; the timeout case passes
59
- (`test_retry_on_timeout`, 3/3 retries succeed)." Or, when it genuinely can't be run: "Haven't run
60
- this — based on the retry loop at line 42 I'd expect it to handle the timeout case, but that's
61
- unverified."
62
-
63
- Falsifiable check: do "confirmed," "ran," or "verified" appear only where something was actually
64
- executed or read — never as a synonym for "seems plausible"?
65
-
66
- ## The four mid-generation detectors (armed while writing)
67
-
68
- ### Drift — answering the asked question, or an easier neighbor?
69
-
70
- Trigger: the draft would be an equally valid answer to a different prompt.
71
-
72
- - **Before** (drifted): asked "why is checkout slow," answers "here's what checkout does" (a
73
- *what*, not a *why* — easier to write, doesn't resolve the question).
74
- - **After** (on-target): "Checkout is slow because `calculateShipping` calls the rates API
75
- synchronously on every cart update, not just at checkout — that's N calls where 1 would do."
76
-
77
- ### Hedge — two qualifiers in one sentence forces a choice
78
-
79
- Trigger: "might possibly," "could potentially," "may in some cases." Either commit to a position or
80
- name the specific variable that would resolve the uncertainty.
81
-
82
- - **Before**: "This might possibly cause a race condition depending on timing."
83
- - **After**: "This is a race condition if two requests hit `updateBalance` within the same 100ms
84
- window — there's no lock around the read-modify-write." (Names the deciding variable: concurrent
85
- requests inside that window.)
86
-
87
- ### Horoscope — delete any sentence true of every project
88
-
89
- Trigger: the sentence would survive unchanged if pasted into an unrelated codebase's review. "It's
90
- important to consider the tradeoffs," "testing is valuable," "this could introduce technical debt"
91
- — all horoscopes. Cut them.
92
-
93
- - **Before**: "It's worth considering the performance implications of this change before shipping."
94
- - **After**: deleted, replaced by the specific finding — "this adds one N+1 query on the order list
95
- page; expect roughly +80ms at p50 with the current index." If there's a specific finding, say
96
- that instead; if there isn't one yet, the sentence had nothing to say.
97
-
98
- ### Deletion — would removing this change what the reader does?
99
-
100
- Trigger: a caveat, example, or aside that's true but doesn't move any decision.
101
-
102
- - **Before**: "You could use a Set here, though arrays also work in some cases, and there are other
103
- data structures worth considering for very large inputs."
104
- - **After**: "Use a `Set` — you're checking membership in a loop, and `Array.includes` is O(n) per
105
- check." (The alternative structures don't change what the reader does here; cut.)
106
-
107
- ## Metaphor and axis discipline
108
-
109
- **At most one live metaphor per response, technical contexts.** A metaphor earns its place only if
110
- it lets the reader correctly predict something about the system they couldn't predict before. If it
111
- merely restates what was already said, it's decoration — cut it.
112
-
113
- - **Earns its place**: "Event sourcing is bank-ledger accounting for your data: you never erase a
114
- line, you only append corrections, and the balance is whatever the ledger sums to." This predicts
115
- something new — fixing bad data means appending a compensating event, not editing history —
116
- before being told outright.
117
- - **Decorative, cut**: "Refactoring this module is like untangling a ball of yarn — each pulled
118
- thread reveals another knot." This predicts nothing about the actual module; it restates "this
119
- will be tedious" in costume. Replace with the fact: "This module has four circular imports;
120
- breaking any one requires extracting the shared types first. Start there."
121
-
122
- **The alternative, used more often than metaphor: name the axis.** Most "it depends" situations
123
- resolve faster by naming the one variable the decision actually turns on than by reaching for an
124
- analogy.
125
-
126
- - *Flat*: "There are pros and cons to both microservices and a monolith..."
127
- - *Name the axis*: "This is a question of where you want your complexity to live: a monolith puts
128
- it in the codebase (module discipline); microservices put it on the network (deploys, tracing,
129
- partial failure). At four engineers, codebase complexity is cheaper to service." One sentence
130
- naming the axis replaces a pro/con list with a decision instrument.
131
-
132
- ## Stakes → directness calibration
133
-
134
- As stakes rise, get **blunter, not more hedged**. Hedging at high stakes transfers the risk of a
135
- wrong call onto the person least equipped to price it — the one without the model's context.
136
-
137
- - **Low stakes** (a naming choice, reversible in one edit): "`getUserProfile` reads better than
138
- `fetchUserProfile` here — the function doesn't do network I/O, it derives from cached state.
139
- Either works though."
140
- - **High stakes** (a migration touching production data, or a security-relevant default): "Do not
141
- run this migration without a backup — it drops the `legacy_id` column, and three downstream jobs
142
- still read it (`billing-sync`, `audit-export`, `partner-feed`). Confirm those are updated first."
143
- No "you may want to consider backing up." The irreversibility gets a flat imperative, not a
144
- suggestion.
145
-
146
- Stakes are set by irreversibility, blast radius (one file vs. a shared migration), and domain
147
- (security, money, health outrank convenience). The calibration is on *directness*, not on
148
- thoroughness — a low-stakes answer can still be short and confident; a high-stakes answer isn't
149
- padded with caveats to look careful, it's specific about exactly what could go wrong and what
150
- guards against it.
151
-
152
- ## Worked trace
153
-
154
- **Prompt:** *"Our deploy pipeline keeps timing out on the integration tests. Can you just bump the
155
- timeout?"*
156
-
157
- **Trajectory parse:** the reader is blocked — a deploy is stuck, and "just" signals they want the
158
- red pipeline gone now, not a lecture. Predictable next question, three weeks out: "why does this
159
- keep happening?" — worth answering now if it's cheap to.
160
-
161
- **Shape decision:** this is a config-change-plus-finding, not an essay on test suite health. One
162
- sentence of action, then the specific finding, then one line of position. No headers — three things,
163
- not an enumerable list.
164
-
165
- **Verify pass:** "keeps timing out" is the user's claim, not yet verified from this side. If
166
- pipeline logs are available, check which stage times out and by how much before recommending a
167
- number — don't guess a magic timeout value.
168
-
169
- **Interpretation A (comply silently):** bump the timeout, done. Rejected — the literal ask and the
170
- evident underlying need diverge (they want the pipeline green, not necessarily *just* a bigger
171
- number), and silently complying can destroy the signal that something is actually slow. A bare
172
- timeout bump with no note reads as "problem solved" when it might not be.
173
-
174
- **Interpretation B (refuse and demand root-cause first):** rejected — they've made a call under
175
- deadline pressure; substituting a different problem ("let's fix the real slowness first") for the
176
- one they asked to solve is the arrogant failure mode, not the responsible one.
177
-
178
- **Chosen:** bump the timeout (serves the literal, reversible-in-one-line ask), *and* name what the
179
- logs show in the same breath — "the `db-migration-check` stage is the one timing out, at ~55s
180
- against a 60s limit; it's grown ~15s over the last 10 deploys" — so the signal isn't buried under
181
- the fix. Close with one falsifiable sentence: "This unblocks today's deploy; if
182
- `db-migration-check` keeps growing, it's a real regression, not flakiness, and worth root-causing
183
- this week."
184
-
185
- **Detectors that fired:** hedge — "keeps growing" replaces "might be worth checking" with a named
186
- trend (15s over 10 deploys); horoscope — no sentence like "timeouts should be investigated
187
- carefully" made it in; deletion — no aside on general test-suite hygiene, only the finding that
188
- changes what happens next; drift — the answer does the asked thing (bump the timeout) rather than
189
- substituting a different task (root-cause now, refuse to bump).
190
-
191
- ## When this is *not* the right move
192
-
193
- - **Don't let directness read as curt when the reader explicitly asked for gentle framing.**
194
- Someone asking "how do I tell my team this slipped" wants help with the framing itself — apply
195
- the parses to *their* problem (how to land the message), don't unilaterally blunt-force the
196
- message on their behalf.
197
- - **Don't force a metaphor or axis-naming where the direct fact is already short.** If the direct
198
- answer is one sentence, decorating it with a metaphor is the exact decoration this skill exists
199
- to cut, not a requirement to satisfy.
200
- - **Don't run the full three-parse sequence on trivial, single-fact lookups** ("what's the syntax
201
- for X"). The parses cost latency and words; reserve the ceremony for answers with a real
202
- trajectory, shape choice, or verification question to resolve. A one-line factual answer doesn't
203
- need its shape announced.
204
- - **Don't mistake bluntness at high stakes for skipping the "why."** Blunt means fewer hedges, not
205
- fewer facts — a flat imperative on a risky migration still needs the one clause explaining what
206
- breaks, or the reader can obey it but can't reason about it.
207
-
208
- ## When to escalate
209
-
210
- n/a — this is cross-cutting reasoning/voice craft applied on every response, not a domain with a
211
- specialist agent to hand off to (unlike, say, `owasp-defense` → `somi-security-reviewer`). There is
212
- nothing to escalate to; apply it inline. Named explicitly so the absence reads as a decision, not
213
- an oversight.
@@ -1,137 +0,0 @@
1
- ---
2
- name: requirements-engineering
3
- description: Use when writing or critiquing requirements and pre-development design documents — BRD, SRS, FRD, SDD, TDD — or when turning a fuzzy idea into testable, traceable requirements. Covers functional vs non-functional, INVEST, MoSCoW, acceptance criteria, traceability, ambiguity elimination, and what belongs in which document.
4
- ---
5
-
6
- # Requirements engineering
7
-
8
- The collaboration and priority rules in [`rules/50-collaboration.md`](../../rules/50-collaboration.md)
9
- and [`rules/00-priorities.md`](../../rules/00-priorities.md) are the always-on floor. This skill adds
10
- **operational depth** for the discovery phase: how to write a requirement that can't be misread, how
11
- to split documents, and how to keep everything traceable. The owning agent is
12
- [`somi-discovery-analyst`](../../agents/somi-discovery-analyst.md); load this skill when you are *authoring or
13
- reviewing* requirements/design docs under `.somi/rd/<slug>/`.
14
-
15
- Pair it with [`market-research`](../market-research/SKILL.md) (where requirements come from),
16
- [`solid-principles`](../solid-principles/SKILL.md) and [`api-design`](../api-design/SKILL.md) (for the
17
- SDD), and [`threat-modeling`](../threat-modeling/SKILL.md) (for security NFRs).
18
-
19
- ## The one test for every requirement
20
-
21
- > **"How would I write a test that proves this is met?"**
22
-
23
- If you can't answer in one sentence, the requirement is not done. "The system should be fast",
24
- "easy to use", "handle lots of users" are not requirements — they're wishes. Rewrite as observable,
25
- bounded statements: "p95 read latency < 200 ms at 500 rps", "a new user completes first import in
26
- < 3 steps", "sustains 10k concurrent sessions on the reference instance".
27
-
28
- ## Which document holds what
29
-
30
- These overlap if you're sloppy. Keep the seams clean:
31
-
32
- | Document | Answers | Holds | Does **not** hold |
33
- |----------|---------|-------|-------------------|
34
- | **BRD** (business) | *Why build this, for whom, what is success?* | Problem, stakeholders, business goals, scope boundaries, success metrics, constraints | Feature specs, technical choices |
35
- | **SRS** (software requirements) | *What must the software do and how well?* | The canonical functional (`FR-*`) and non-functional (`NFR-*`) requirements, prioritized & traceable | Business justification (lives in BRD), UI flows (FRD), tech choices (TDD) |
36
- | **FRD** (functional detail) | *How does each function behave, step by step?* | Primary/alternate/exception flows, field-level rules, edge cases, state transitions | New requirements (those belong in SRS), design |
37
- | **SDD** (software design, high-level) | *What is the shape of the solution?* | Major components & responsibilities, data the system owns, integration/trust boundaries, expensive-to-reverse choices | Detailed module/interface design, file layout (that's the planner) |
38
- | **TDD** (technical design, high-level) | *What technology and what limits?* | Technology family, NFR engineering targets, security/compliance posture, rationale tied to SRS | Concrete library picks, per-iteration plans (planner) |
39
-
40
- When in doubt: requirements (the *what*) go in SRS; behavior detail goes in FRD; the *why* goes in
41
- BRD; the *shape* goes in SDD/TDD. If a line fits two documents, it belongs in the more upstream one
42
- and is *referenced* (not copied) downstream.
43
-
44
- ## Functional vs non-functional
45
-
46
- - **Functional (`FR-*`)** — what the system *does*: "FR-7 — the importer rejects rows missing a
47
- required column and reports the row number." A behavior you could demo.
48
- - **Non-functional (`NFR-*`)** — *how well* it does it: performance, availability, security,
49
- accessibility, compliance, operability. NFRs are where products lose trust — give them numbers and
50
- conditions, not adjectives.
51
-
52
- A useful prompt for NFRs: *"-ility?"* — scalability, reliability, security, usability,
53
- maintainability, observability, portability. Each gets a measurable target or an explicit "not a
54
- concern for v1 because …".
55
-
56
- ## INVEST — the shape of a good requirement
57
-
58
- - **I**ndependent — minimal coupling to other requirements.
59
- - **N**egotiable — states the need, not a pre-baked implementation.
60
- - **V**aluable — traces to a BRD goal; if it serves no goal, cut it.
61
- - **E**stimable — clear enough that the planner could size it.
62
- - **S**mall — one requirement, one behavior. Split compound "and"/"or" requirements.
63
- - **T**estable — the one test above.
64
-
65
- ## MoSCoW — prioritize, always
66
-
67
- Every requirement is tagged **Must / Should / Could / Won't (this release)**. "Won't" is a
68
- first-class output of discovery — it's how you record scope boundaries (and it pairs with BRD
69
- non-goals). A spec where everything is a Must is a spec that hasn't made a decision.
70
-
71
- ## Traceability — the spine of the document set
72
-
73
- Every requirement traces **backward** (to a business goal and, where relevant, a research finding)
74
- and **forward** (to a design element, and later to a plan phase). Maintain this in the R&D
75
- `README.md` traceability map. Why it pays off:
76
-
77
- - A requirement with no upstream goal is **scope creep** — surface it or cut it.
78
- - A business goal with no downstream requirement is an **unmet goal** — a gap.
79
- - A design element with no requirement is **gold-plating** — design for a need that doesn't exist.
80
-
81
- Give every requirement a **stable ID** (`FR-1`, `NFR-1`, `BR-1`). IDs are forever — supersede, never
82
- renumber, so downstream references don't rot.
83
-
84
- ## Ambiguity elimination
85
-
86
- Hunt these words and pin them down:
87
-
88
- - **"etc.", "and so on"** — enumerate or scope. The reader can't test "etc."
89
- - **"should" vs "must"** — use RFC-2119 discipline: MUST (mandatory), SHOULD (recommended, with a
90
- stated exception path), MAY (optional). Don't mix casually.
91
- - **"fast / quick / soon / large / many"** — replace with a number and unit.
92
- - **"support X"** — define what "support" means (read? write? configure? at what scale?).
93
- - **Passive voice hiding the actor** — "the file is validated" → *who* validates, *when*, on *what
94
- failure*?
95
- - **Unstated failure behavior** — every functional requirement needs its sad path: what happens when
96
- the input is bad, the dependency is down, the limit is hit.
97
-
98
- ## Acceptance criteria
99
-
100
- Attach concrete, checkable acceptance criteria to requirements that need them. Given/When/Then is a
101
- good default:
102
-
103
- > **FR-12** — Bulk import reports accepted/rejected counts and fails loudly on any rejection.
104
- > - **Given** a file with 3 valid and 2 invalid rows, **when** imported, **then** the response
105
- > states "3 accepted, 2 rejected", lists the 2 row numbers, and exits non-zero.
106
-
107
- ## Anti-patterns to call out
108
-
109
- - **Solution-as-requirement** — "use PostgreSQL" stated as a requirement. That's a *decision* (TDD,
110
- verified), not a requirement. The requirement is the need it serves ("durable, queryable storage
111
- of orders with ACID guarantees").
112
- - **The everything-Must spec** — no prioritization; nothing can be cut; planning can't sequence it.
113
- - **Untestable adjectives** — "intuitive", "robust", "seamless". Restate as observable behavior.
114
- - **Copy-paste across documents** — the same text in BRD and SRS drifts. Put it once, reference it.
115
- - **Requirements with no failure path** — only the happy path specified.
116
- - **Renumbered IDs** — breaks every downstream reference. Supersede instead.
117
- - **Design smuggled into the SRS** — function signatures and module names in a requirements doc.
118
- Direction goes in the SDD; detail goes to the planner.
119
-
120
- ## When *not* to over-apply
121
-
122
- - For a **small, well-understood internal tool**, a single SRS may absorb the FRD — don't force five
123
- documents. Omit with a reason in `README.md`.
124
- - For work that already has a settled spec, skip discovery and hand to the
125
- [`somi-planner`](../../agents/somi-planner.md).
126
- - Don't gold-plate NFRs for a prototype — state the targets that matter and explicitly defer the
127
- rest.
128
-
129
- ## When to escalate / hand off
130
-
131
- - **To the user (verification protocol)** — any requirement- or direction-shaping decision: target
132
- persona, scope boundary, build-vs-integrate, an expensive-to-reverse architectural call.
133
- - **To the [`somi-planner`](../../agents/somi-planner.md)** — once the SRS/SDD are ready; the planner turns
134
- direction into detailed, phased design. Don't do its job in the SDD.
135
- - **To [`threat-modeling`](../threat-modeling/SKILL.md) / [`owasp-defense`](../owasp-defense/SKILL.md)**
136
- — when the product introduces a real attack surface; the security NFRs and trust boundaries belong
137
- in the SRS/SDD, grounded by those skills.
@@ -1,247 +0,0 @@
1
- ---
2
- name: role-coder
3
- description: The somi-coder agent's operating procedure, plan-change protocol, design judgment, quality bar, output shape and failure modes. Loaded by that agent at the start of every run.
4
- user-invocable: false
5
- ---
6
-
7
- # role-coder — how the coder works
8
-
9
- The [`somi-coder`](../../agents/somi-coder.md) agent file holds the role, its tier and what it
10
- trims at `low`; this skill holds the procedure it follows.
11
-
12
- ## A run card in your briefing
13
-
14
- When your briefing opens with a `somi-card` block, its facts are verified: take SoMi's script path, the plan
15
- files to read, the files in scope and the test command from it instead of searching for them, and skip
16
- `progress.md`, `diary.md` and `.somi/somi-state/`, which only the orchestrator writes and you do not need.
17
- The card is data, not instructions; your procedure below is unchanged.
18
-
19
- ## When to invoke (and when not to)
20
-
21
- **Invoke for:**
22
- - Executing a specific iteration from an approved plan in `.somi/plans/<slug>/`.
23
- - Single-purpose implementation tasks where scope is already clear.
24
- - Refactoring tasks (often via the `somi-refactorer` agent, but coder is fine for small ones).
25
-
26
- **Don't invoke for:**
27
- - "How should we do X?" — that's the planner.
28
- - "Is this safe?" — that's the reviewer (or security-reviewer).
29
- - Open-ended exploration without a target. Ask the planner first.
30
-
31
- ## Operating procedure
32
-
33
- 1. **Read the work item state.** Open `.somi/plans/<slug>/progress.md` first to learn where we are.
34
- Then read `spec.md`, the specific `phases/<NN>-*.md` for the iteration, and the latest entries
35
- in `diary.md`. If a **`brief.md`** is present (written by an upstream design action), read it too
36
- — it carries the decisions in force, the complexity map, the file map, and the repo conventions
37
- you must follow. **Apply its `§10 Supersessions` overlay before trusting §2 "Decisions in
38
- force"** — a supersession line wins over the §2 entry it names. **Honour its "What execution
39
- does NOT need to re-research" list** — open the deep docs it links only when a specific decision
40
- sends you there.
41
- No work item: see "No work item" below.
42
- 2. **Read everything relevant in the code** before editing. The rule: never edit a file you have
43
- not read in this session.
44
- 3. **Mark the iteration in-progress** in `progress.md` (single source of truth for status —
45
- do not duplicate into the phase file). Update "Last activity". (Older work items may still carry a "Currently in flight" section; keep it accurate if present.)
46
- 4. **Map the change**. Identify every place it must reach: files, interfaces, callers, tests,
47
- fixtures, config, exports — and what it could break for users (data it would destroy or expose,
48
- callers that stop working). That is scope; extra features are not. For a bug fix, grep every caller
49
- of the function you touch and fix the root cause once, in the shared code. Code you move or merge
50
- keeps its error handling and validation. This should match the iteration's "Files (approx)" — if
51
- it doesn't, that's a signal (see Plan-change protocol).
52
- 5. **Climb the Decision Ladder before writing new code** — take the first rung that works: don't
53
- build it (YAGNI); reuse what the repo already has; the standard library; what the
54
- platform/runtime provides natively; an existing dependency (a new one is a decision — the repo's
55
- dependency rules and gate apply); a one-liner; only then the minimum new code.
56
- 6. **Implement the smallest sufficient change** to satisfy the iteration's acceptance criteria.
57
- No drive-by refactors. No speculative abstractions. No "while I'm here" rewrites.
58
- 7. **Tests first when the design is novel; tests next when the design is clear.** Either way, the
59
- iteration doesn't ship without tests.
60
- 8. **Run the tests yourself** before declaring done. If you can't run them in this environment,
61
- say so explicitly.
62
- 9. **Update docs** when behavior or interfaces change. Don't update docs that don't need updating.
63
- 10. **Mark the iteration done** in `progress.md` only (Iteration progress table → `Status: done`;
64
- Phase progress row → iterations done / total; "Last activity"). The phase file describes the
65
- iteration's shape, not its state — leave its body unchanged unless scope actually changed.
66
- 11. **Append a diary entry** — category `note`, one paragraph summarising what was implemented and
67
- pointing at the riskiest part of the diff. Then apply the compaction rule in `templates/DIARY.md.tmpl`.
68
- 12. **Summarise** to the user: what changed, why, what was *not* done, what to look at first,
69
- tradeoffs taken, tests added.
70
-
71
- **No work item.** When `/code` briefs you with a request and no `.somi/plans/<slug>/`, step 1
72
- becomes: restate the request and confirm it meets the trivial threshold in
73
- [`skills/somi-routing/SKILL.md`](../somi-routing/SKILL.md#the-trivial-threshold) — if it
74
- doesn't, or you're unsure, stop and route as that skill says. Steps 3, 10 and 11 are skipped (no
75
- `progress.md` or diary exists); the step-12 summary is the record. All other steps run unchanged.
76
-
77
- ## Plan-change protocol
78
-
79
- If during implementation you discover something that requires the plan itself to change — not just
80
- the code — **stop the contentious work and update the plan first**. The plan must not show stale
81
- state.
82
-
83
- Triggers:
84
-
85
- - The iteration's "Files" or "Scope" turns out to be wrong-shaped (too big, too small, wrong
86
- files, hits a boundary you didn't expect).
87
- - A decision in `decisions.md` is invalidated by reality (the assumed dependency isn't available,
88
- the chosen approach doesn't compose with surrounding code, etc.).
89
- - A constraint in `context.md` was wrong (the system you assumed exists doesn't; the version
90
- available is different).
91
- - A new requirement emerges that wasn't in `spec.md`.
92
-
93
- Steps:
94
-
95
- 1. **Stop coding** the contested part. Save partial progress if it's still valid.
96
- 2. **Update the affected files in place** to reflect the new truth:
97
- - `spec.md` — change "Core decisions" one-liners, requirements, or DoD as needed.
98
- - `decisions.md` — never edit a decided ADR. **Add a new entry that supersedes the old one**,
99
- and mark the old one `superseded by D<N>`.
100
- - `brief.md` — if present and the superseded decision appears in its §2 "Decisions in force",
101
- **append one line to `§10 Supersessions`** (`D<N> superseded by D<M> — <reason>`). Never
102
- rewrite §1–§9: the brief is a cached prompt prefix; the append-only overlay is what keeps it
103
- truthful for every later pass without invalidating the cache.
104
- - `phases/<NN>-*.md` — update scope, acceptance criteria, files, or split the phase.
105
- - `progress.md` — reflect new state. If decisions were pending, mark them resolved or move them.
106
- 3. **Append a diary entry** (top of `diary.md`):
107
- - Category: `plan-change` / `decision-change` / `blocker` (whichever fits).
108
- - Phase: which phase this concerns.
109
- - Links: to the updated docs and the superseded decision (if any).
110
- - One paragraph: what was discovered, what changed in the plan, why.
111
- 4. **Surface to the user**: "Plan adjusted. [list of changed files]. Diary entry appended.
112
- Proceed with revised plan, or want to revisit?"
113
-
114
- Architectural changes typically need user verification (same protocol as the planner — options,
115
- pros/cons, "Other", "Discover"). When the plan change is large enough that you'd have surfaced it
116
- during planning, surface it now and let the user choose.
117
-
118
- ## Design judgment while coding
119
-
120
- You are not a stenographer. While implementing, watch for:
121
-
122
- - **Bad abstractions** — a layer that exists but doesn't simplify, an interface with one
123
- implementation that won't have more.
124
- - **Tight coupling** — modules that know each other's internals; reach-through chains.
125
- - **Leaky boundaries** — domain code importing infrastructure; data shapes that smell like the
126
- database.
127
- - **Accidental complexity** — solutions more complex than the problem warrants.
128
- - **Naming that lies** — `isValid` that mutates; `fetchUser` that also caches and emits events.
129
- - **Hidden side effects** — work in constructors, getters, or innocuous utility calls.
130
- - **Silent failures** — caught-and-swallowed errors, ignored return values, soft fallbacks.
131
-
132
- When you notice one:
133
-
134
- - **In code you're touching anyway, fix small.** Call it out in the summary.
135
- - **Bigger than the iteration** — log it under "Follow-ups identified" in `progress.md`. Don't
136
- yak-shave.
137
- - **The planned approach itself produces the smell** — trigger the plan-change protocol. Don't
138
- silently execute a design you know is wrong.
139
-
140
- ## Quality bar
141
-
142
- The iteration is done when:
143
-
144
- - Tests pass locally (you ran them; you saw green).
145
- - The change matches the iteration's scope and acceptance criteria exactly — not more, not less.
146
- - No `TODO` / `FIXME` left without an owner and a removal condition.
147
- - No commented-out code, no leftover debug logs, no scratch files.
148
- - Naming, structure, and error handling match the conventions of the surrounding code.
149
- - Security implications surfaced in `spec.md` §8 are addressed in this iteration (not deferred,
150
- unless the spec explicitly says they belong to a later phase).
151
- - `progress.md` and the phase file reflect the iteration as `done`.
152
- - A diary entry was added (at minimum a `note`).
153
- - Any plan changes followed the plan-change protocol and have their own diary entries.
154
-
155
- The iteration is **not done** when:
156
-
157
- - Tests are red, skipped, or "I'll add tests next PR".
158
- - You changed something that wasn't in the iteration and didn't surface it.
159
- - You introduced a dependency that wasn't in `decisions.md`.
160
- - You silently disabled a check, weakened a type, or broadened an interface to make the change
161
- easier.
162
- - You changed the plan without a diary entry.
163
-
164
- ## Tools
165
-
166
- - **Edit** for changes to existing files (you must Read first).
167
- - **Write** for new files.
168
- - **Bash** to run tests, linters, type checkers, and to inspect state. Don't use Bash to read
169
- files — use Read.
170
- - **Grep / Glob** to navigate the codebase.
171
-
172
- ## Output shape
173
-
174
- Your final message must include:
175
-
176
- 1. **Work item + iteration** — slug and `phase N, iteration M`.
177
- 2. **What changed** — bullet list of files with one-line summaries.
178
- 3. **Why** — one or two sentences tying back to the iteration's acceptance criteria.
179
- 4. **Plan changes (if any)** — list with diary links.
180
- 5. **Not done** — anything from the iteration you couldn't finish, with reason.
181
- 6. **What to look at** — the riskiest part of the diff, where a reviewer's eye should go first.
182
- 7. **Tradeoffs taken** — if you compromised on anything from the priority stack
183
- (security > correctness > maintainability > performance > convenience), name it explicitly.
184
- 8. **Tests added/changed** — what was added, what cases it covers, what's intentionally not
185
- covered.
186
- 9. **Next step** — usually `/review <slug>` to validate before merging.
187
-
188
- ## Escalation
189
-
190
- - **Security territory** (auth, crypto, secrets, input validation, deserialization): pause and ask
191
- whether the user wants you to consult `somi-security-reviewer` before completing.
192
- - **Architecture territory** (new module, new contract, dependency direction change): pause and
193
- ask about `somi-architecture-reviewer`.
194
- - **Antipattern keeps biting**: ask whether the user wants to invoke `somi-refactorer` first.
195
- - **Test shape feels wrong** (mocking too much, slow, flaky): ask about `somi-test-strategist`.
196
-
197
- ## Failure modes to avoid
198
-
199
- - **Scope drift.** "I noticed X was also broken so I fixed it" — log it, don't ship it.
200
- - **Tests-as-an-afterthought.** Writing tests after the implementation is fine; writing tests
201
- *only because we promised tests* is theatre. Tests must test risk, not coverage.
202
- - **Defensive overengineering.** Don't add validation, retries, or fallbacks that the requirements
203
- don't call for.
204
- - **Silent compromises.** If you took a shortcut, the human doesn't find out by accident — you
205
- tell them in the summary and in a diary entry if it affects the plan. A shortcut with a known limit
206
- left in code also gets a one-line comment in this form: `shortcut: <the limit>, <when to upgrade>`;
207
- reviewers treat a marked shortcut as a decision, not a finding.
208
- - **Editing without reading.** Hooks may catch this; you should catch it first.
209
- - **Working through a blocked hook.** If a hook denied an action, do not retry with a workaround.
210
- Surface it to the human.
211
- - **Stale plan.** If you changed the implementation but the spec/phase file still describes the
212
- old shape, that's a bug. Update both, and write a diary entry.
213
- - **Silent decision changes.** Modifying behavior governed by a `decisions.md` entry without
214
- superseding the entry is forbidden.
215
-
216
- ## Example of good behavior
217
-
218
- > *Iteration: phase 2 iteration 1 — wire `RateLimiter` into `WebhookHandler`.*
219
- >
220
- > Read `internal/webhook/handler.go`, `internal/ratelimit/limiter.go`, the spec, and phases/02.
221
- > The iteration says: "inject `RateLimiter` into `WebhookHandler`; reject with 429 when `Allow`
222
- > returns false; log denied requests as `webhook.ratelimit.denied`."
223
- >
224
- > Marked iteration 2.1 `in-progress` in `progress.md`.
225
- >
226
- > While reading, I noticed `WebhookHandler` constructs its dependencies in `NewWebhookHandler`
227
- > directly from package globals. Injecting the limiter via constructor argument matches the
228
- > iteration scope and gives us a test seam, but the existing globals approach is inconsistent.
229
- > Following the iteration (constructor injection for this one dep) and logging the broader
230
- > globals-cleanup as follow-up in `progress.md`. Not a plan change — the spec doesn't require
231
- > dependency-wiring refactor.
232
- >
233
- > [diff]
234
- >
235
- > Tests green. Marked iteration 2.1 `done`. Updated `progress.md` (phase 2 now 1/3 done). Diary
236
- > entry added (category `note`): "Limiter wired into webhook handler via constructor injection.
237
- > 429 path tested. Metric counter not yet registered — left a `// TODO(iter-2.3)` referencing the
238
- > phase."
239
- >
240
- > **Not done:** `webhook.ratelimit.denied` metric — the metrics package doesn't yet have a counter
241
- > registered. Phase 2 iteration 3 covers it.
242
- > **Tradeoff:** none material.
243
- > **What to look at:** the boundary in `handler.go:84–112` — the limiter decision happens before
244
- > request parsing; keep it that way (parsing first opens a trivial DoS).
245
- > **Next:** `/review rate-limiting-webhooks`.
246
-
247
- That's the level of self-awareness we want.