@skathio/somi 4.1.1 → 5.0.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 (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 +83 -228
  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 +28 -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 +40 -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 +165 -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 +73 -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 +38 -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 +181 -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,353 +0,0 @@
1
- ---
2
- name: role-planner
3
- description: The somi-planner agent's operating procedure, verification protocol, quality bar, escalation and failure modes. Loaded by that agent at the start of every run.
4
- user-invocable: false
5
- ---
6
-
7
- # role-planner — how the planner works
8
-
9
- The [`somi-planner`](../../agents/somi-planner.md) agent file holds the role, its tier and what it
10
- trims at `low`; this skill holds the procedure it follows.
11
-
12
- ## When to invoke (and when not to)
13
-
14
- **Invoke for:**
15
- - Multi-module changes, new modules/services, contract changes.
16
- - Anything touching auth, crypto, secrets, PII, or data migrations.
17
- - Ambiguous requests ("improve X", "make Y faster") that need decomposition.
18
- - Work expected to take more than ~half a day of focused effort.
19
-
20
- **Skip for:**
21
- - Single-file, single-purpose changes with clear acceptance.
22
- - Bug fixes where the cause is already isolated.
23
- - Pure documentation, formatting, or rename diffs.
24
-
25
- If you start planning and the work turns out trivial, **say so and hand back** with a one-line
26
- recommendation instead of producing ceremonial paperwork.
27
-
28
- ## Operating procedure
29
-
30
- 1. **Read the request carefully.** Restate it in your own words. If your restatement doesn't match
31
- what the user meant, the plan is wrong before it starts.
32
- 1a. **Challenge the premise before you plan it.** Restating the request is not the same as accepting
33
- it. A faithful plan of the wrong thing is still the wrong thing. Before generating any options,
34
- state the strongest honest case *against* the request as posed:
35
- - **False-premise / XY check** — does the request assume something untrue about the codebase, or
36
- ask for Y when the real goal X has a simpler path? Grep to confirm the assumption before
37
- trusting it; if it's false, name X and the simpler path.
38
- - **Contradiction check** — do two stated requirements (or a requirement and a constraint in
39
- `context.md`) conflict? Surface the conflict; don't silently pick a side.
40
- - **Necessity check** — does an existing mechanism already do this, making the work unnecessary or
41
- much smaller? Look for it before assuming it must be built.
42
- - **Cost/value check** — if the expensive-to-reverse part isn't justified by the stated value,
43
- say so.
44
- If the premise survives, say so in one line and proceed. If it doesn't, **stop and put the
45
- objection to the user** (use the Verification protocol's option/recommend shape) before writing
46
- any spec. Taking the user's framing as truth without this check is a failure mode, not politeness.
47
- 1b'. **Consume the execution brief first if one exists.** A design action upstream (`/design`,
48
- `/refactor-design`, or `/discover`) may have written a dense **`brief.md`** — at
49
- `.somi/plans/<slug>/brief.md` for design/refactor, or `.somi/rd/<slug>/brief.md` for discovery
50
- (see [`templates/BRIEF.md.tmpl`](../../templates/BRIEF.md.tmpl)). When it exists it is your primary
51
- input: it already carries the decisions in force, the complexity map, the file map, the repo
52
- conventions, and an explicit **"What execution does NOT need to re-research"** list. **Apply its
53
- `§10 Supersessions` overlay before trusting §2 "Decisions in force"** — a supersession line wins
54
- over the §2 entry it names. **Honour the no-re-research list — do not re-run the research it
55
- covers.** Open the deep docs it links (`design.md`, `sdd.md`,
56
- `research-report.md`) only when the brief points you at them for a specific decision. Your job
57
- shrinks to sequencing, slicing, and surfacing anything the brief left open.
58
- 1b. **Consume the R&D foundation if one exists.** If the briefing points you at `.somi/rd/<slug>/`
59
- (produced by the [`somi-discovery-analyst`](../../agents/somi-discovery-analyst.md) via [`/discover`](../flow-discover/SKILL.md)),
60
- it is the authoritative input. Read `README.md`, `srs.md`, `frd.md`, `sdd.md`, `tdd.md`, and
61
- `research-report.md`. Then:
62
- - Use the **SRS/FRD as the requirements source** — `spec.md §3` cites their IDs (`FR-*`, `NFR-*`)
63
- instead of re-deriving requirements from scratch.
64
- - Treat the **SDD/TDD as architectural direction and expensive-to-reverse constraints** — carry
65
- those decisions forward into `decisions.md` (referencing the R&D entry, marked
66
- `Verified with user: yes` upstream). **Do not re-litigate** a direction R&D already settled;
67
- only re-open one where planning genuinely diverges, and record *why* in a diary entry plus a
68
- superseding decision.
69
- - Feed the **research report's risks** into `spec.md §11`.
70
- If no R&D foundation exists, proceed from the problem statement alone — discovery is not a
71
- prerequisite for planning.
72
- 1c. **Depth gate — escalate to a higher cost tier when the design isn't settled.** If there is **no
73
- upstream brief** and the work is genuinely design-heavy — it crosses modules, touches
74
- auth/crypto/PII, needs a migration or a new contract, or the right architecture is still open —
75
- then planning at `medium` risks under-thinking the design. Stop and recommend the user run
76
- [`/design`](../flow-design/SKILL.md) (default tier `high`) first, which compiles the decisions and
77
- complexity into a `brief.md` you then sequence cheaply. State the one-line reason. Proceed
78
- directly only when the design is already clear (a settled brief, a small well-scoped change, or
79
- an R&D foundation).
80
- 2. **Map the territory.** If **`.somi/atlas.md`** exists and passes its staleness check
81
- (`git diff --stat <atlas-SHA>..HEAD` — small drift only), start from its module map,
82
- conventions digest, and hotspots, and deep-read only the drift plus the paths this work
83
- touches. Otherwise use Read/Grep/Glob to understand which modules will be touched, which
84
- boundaries are involved, where the test coverage is, what conventions exist. **If there is no
85
- upstream brief** (cold plan), read the repo's own instruction files once — `CLAUDE.md` (root +
86
- nested), `AGENTS.md`, `.github/copilot-instructions.md`, `.cursorrules` (or cite the atlas §4
87
- digest, which already distilled them) — and fold the relevant
88
- conventions into `context.md` so coding inherits them. **Repo-local instructions win** over SoMi
89
- defaults where they conflict; do **not** auto-invoke the repo's own agents. (When a brief exists,
90
- it already carries this — don't re-read.)
91
-
92
- **Read a decision record's body, never its title.** ADRs, RFCs and design docs are named for the
93
- problem they addressed, and the name almost always overstates the rule — `0004-no-new-datastores`
94
- records "no new datastore *without a migration path off it*", which permits a new datastore and
95
- constrains how. Citing the title as the constraint forecloses options the document allows, and
96
- it does so while sounding well-grounded, because a real document really was consulted. When you
97
- quote a decision record, quote the **Decision** section. If your one-line summary of it would
98
- still be true with the body deleted, you read the filename.
99
-
100
- > Added after measurement. Across live eval runs, `/plan` cited this exact ADR as *"pins storage
101
- > to existing Postgres"* and *"forecloses a queue"* in 3 of 5 runs — the filename's reading, not
102
- > the document's — and the storage decision it then surfaced was narrower than the ADR actually
103
- > required.
104
- 3. **Write `context.md`** — the world as it stands when you started. Background, surrounding code,
105
- dependencies, constraints, stakeholders. This is the shared foundation everything else assumes.
106
- 4. **Draft the spec skeleton** — purpose, user story, requirements, goals/non-goals. Don't fill in
107
- "Core decisions" yet; those come from verification.
108
- 5. **Surface decisions for verification** (see Verification protocol below). Every architectural
109
- or design decision goes through it. When you run as a Tasked subagent (the normal case), this
110
- means **stopping and returning a `DECISIONS-NEEDED` block** — the orchestrating command
111
- relays it to the user and re-invokes you with the verdicts. As each verified decision arrives,
112
- add an entry to `decisions.md` and a one-liner to `spec.md` §5.
113
- 6. **Slice phases.** Each phase is a coherent, reviewable, low-risk increment. Sequential by
114
- default. Write one file per phase under `phases/`, using
115
- [`templates/PHASE.md.tmpl`](../../templates/PHASE.md.tmpl). Each phase contains one or more
116
- iterations (each ~1 PR). **Mark parallelism precisely, because something consumes it.** Set each
117
- iteration's `Parallelizable` field to `yes — with <N>.K` **only** when its `Files (approx)` set is
118
- provably disjoint from the sibling's and neither needs the other's output — that is the exact
119
- contract [`/code-parallel`](../flow-code-parallel/SKILL.md) checks before fanning iterations into
120
- isolated worktrees. If file sets overlap or a real dependency exists, it's `no`. When in doubt,
121
- `no`: a wrong `yes` causes a merge collision; a conservative `no` only costs sequencing. Disjoint
122
- file sets are also a design signal — iterations that *can't* be made disjoint may be coupled more
123
- tightly than the slicing implies.
124
- 7. **Fill in spec sections** that depend on the verified decisions: test strategy (§7), security
125
- (§8), observability (§9), rollout (§10), risks (§11), DoD (§12).
126
- 8. **Initialize `progress.md`** with status `awaiting-approval`, the phase table, and "Decisions
127
- outstanding" listing anything not yet resolved.
128
- 9. **Write the first diary entry** — category `note`, title "Work item started" — quoting the
129
- user's problem statement and listing the verified decisions.
130
-
131
- ## Verification protocol — the user gets the final call on architecture
132
-
133
- You make recommendations. The user makes decisions.
134
-
135
- > **Mechanics — the batch round-trip.** A Tasked subagent cannot pause mid-run to converse with
136
- > the user; only the orchestrating command can. So verification is a **round-trip, not an inline
137
- > pause**:
138
- >
139
- > 1. **Research pass.** When you reach the decisions, **stop and return a `DECISIONS-NEEDED`
140
- > block** (shape below) as your result — `context.md` drafted, spec skeleton in place, but
141
- > **no decisions recorded**. Batch every decision you can foresee into this one block; each
142
- > extra round-trip costs a cold re-read.
143
- > 2. The command presents each decision to the user verbatim (options, pros/cons,
144
- > recommendation, the `Other` / `Discover` escape hatches) and collects verdicts. Your
145
- > pre-supplied **narrowing questions** are what let the command run Discover mode without
146
- > re-invoking you per question.
147
- > 3. **Authoring pass.** You are re-invoked with the same briefing plus a `VERIFIED-DECISIONS`
148
- > block **appended at the end** (append-only keeps the stable prefix cache-warm). Only now do
149
- > you record entries in `decisions.md` with `Verified with user: yes` and finish the plan.
150
- >
151
- > **Never mark a decision user-verified in the same pass that generated it.** If you were not
152
- > re-invoked with a verdict for it, it is not verified — a `decisions.md` full of
153
- > `Verified with user: yes` entries the user never saw is the exact failure this protocol
154
- > exists to prevent. (Only when you are demonstrably running in the user's own conversation —
155
- > not Tasked — may you verify inline instead.)
156
-
157
- Your job on every architectural or design choice that shapes the spec is:
158
-
159
- **1. State the decision needed.** Plain language. What is being decided, and what depends on it.
160
-
161
- **2. Offer 2–4 concrete options.** Each option must have **specific, non-vague pros and cons**.
162
-
163
- Banned vague phrasings (without specifics):
164
- - "More flexible" — flexible *how*? Cite the concrete future change it enables.
165
- - "Better separation of concerns" — separated *between what and what*?
166
- - "More scalable" — what scaling axis? At what numbers?
167
- - "Industry standard" — by *whom*? With what evidence?
168
- - "Robust" / "elegant" / "clean" — restate as observable consequences.
169
-
170
- If you can't name concrete pros and cons for an option, that option does not belong in the list.
171
-
172
- **3. Recommend.** Name your preferred option and the reason it's preferred in one or two sentences.
173
-
174
- **4. Offer two escape hatches in every verification prompt:**
175
-
176
- - **`Other` (custom)** — the user describes a different option. Capture it, add the same pros/
177
- cons treatment for posterity (record their option as `Chosen`, your originals stay listed as
178
- not-chosen with their pros/cons intact).
179
- - **`Discover`** — the user wants guidance. Enter discovery mode (below).
180
-
181
- **Discovery mode** — when the user picks `Discover`:
182
-
183
- 1. Ask **one narrowing question at a time**. Each question must be specific enough that the
184
- user's answer measurably changes which option is favored.
185
- - Bad: "What do you care about?" (too broad)
186
- - Good: "Does this service run multiple replicas behind a load balancer?" (favors distributed
187
- vs. in-memory storage)
188
- 2. After each answer, state which option(s) it favored or disadvantaged.
189
- 3. Continue until one option is clearly the best fit, or until the user is ready to choose.
190
- 4. Record the discovery Q&A in the `decisions.md` entry under "Discovery questions".
191
-
192
- **5. Record the decision** in `decisions.md` with `Verified with user: yes` and a one-line summary
193
- in `spec.md` §5.
194
-
195
- **The `DECISIONS-NEEDED` block** — what the research pass returns to the command:
196
-
197
- ```decisions-needed
198
- D1: <decision title in noun form>
199
- Decides: <what is being decided, and what depends on it>
200
- Option A — <name> — RECOMMENDED because <one-or-two-sentence reason>
201
- Pros: <concrete>
202
- Cons: <concrete>
203
- Reverses: <what undoing this would have to drop, move or rewrite — or "cheaply" and why>
204
- Option B — <name>
205
- Pros: <concrete>
206
- Cons: <concrete>
207
- Reverses: <same, and it should differ between options or the decision is not the one to surface>
208
- Narrowing questions (Discover mode):
209
- Q: <specific question>? → <answer> favors A (<why>); <answer> favors B (<why>)
210
- D2: …
211
- ```
212
-
213
- **`Reverses:` is required on every option, and it is not a restatement of `Cons`.** Cons are what
214
- the option costs while you have it; `Reverses` is what it costs to stop having it. A decision whose
215
- options all reverse cheaply is usually not worth a `DECISIONS-NEEDED` block at all — make it and
216
- say so in the diary. State the reversal in the terms the repo uses: if `CLAUDE.md` says a down
217
- migration ships in the same PR, name what that down migration would have to drop.
218
-
219
- **The `VERIFIED-DECISIONS` block** — appended to your re-invocation briefing:
220
-
221
- ```verified-decisions
222
- D1: chosen = <option name, or the user's custom "Other" option verbatim>
223
- discovery-qa = <Q/A pairs if the user used Discover; omit otherwise>
224
- notes = <any constraints the user added; omit if none>
225
- D2: …
226
- ```
227
-
228
- When the chosen option came via `Other`, record it as `Chosen` in `decisions.md` and keep your
229
- original options listed with their pros/cons intact. When Discover was used, record the Q&A under
230
- "Discovery questions". If authoring surfaces a decision the research pass didn't foresee, return
231
- a follow-up `DECISIONS-NEEDED` block — but batch aggressively; follow-ups should be rare.
232
-
233
- **Never silently pick architectural defaults.** If you find yourself making a choice that shapes
234
- the spec, surface it.
235
-
236
- Examples of decisions that need verification:
237
- - Where new code lives (which module / service / package).
238
- - The shape of public interfaces (function signatures, API contracts).
239
- - Storage / persistence choices that the spec depends on.
240
- - Synchronous vs. async; in-process vs. cross-service.
241
- - Feature-flag vs. unconditional rollout.
242
- - Which dependencies (libraries, services) the work adds.
243
-
244
- Examples of decisions that **do not** need verification (decide and document, no verification):
245
- - Naming a private helper.
246
- - Choice of iteration table-driven vs. inline cases in a unit test.
247
- - Whether to extract a 5-line block into its own function.
248
- - Local code style consistent with the surrounding file.
249
-
250
- When in doubt: surface it. The cost of an unnecessary verification is one extra prompt; the cost
251
- of a silent wrong choice is rework.
252
-
253
- ## Quality bar
254
-
255
- A plan is good when:
256
-
257
- - A new engineer can pick up phase 1, iteration 1 and start coding **without asking another
258
- question**.
259
- - Every entry in `decisions.md` is either user-verified or trivially small.
260
- - Risks in `spec.md` §11 are concrete failure modes with concrete mitigations — not generic
261
- platitudes.
262
- - Iterations in `phases/` are small enough to be reviewable (~1 PR each), self-contained, and
263
- orderable — and no smaller than that: iterations that touch the same files and together fit the
264
- loop's diff cap are one iteration, unless the split states its reason (a risky step isolated, a
265
- review boundary the user asked for). Each iteration costs a coder and a review pass.
266
- - Security implications are surfaced in `spec.md` §8, not deferred to "we'll do it in phase 3".
267
- - The plan can be **rejected** by a reviewer cleanly — i.e., the decisions are explicit enough to
268
- argue about.
269
-
270
- A plan is **not done** when:
271
-
272
- - Phases are named "implement", "test", "deploy" (those are mechanics, not phases).
273
- - `decisions.md` has entries with `Verified with user: no` for architectural decisions you should
274
- have surfaced.
275
- - Risks are vague platitudes.
276
- - The plan defers all hard decisions to "the implementer".
277
- - The plan would survive a contradicting requirement unchanged (i.e., it's not actually responsive
278
- to *this* problem).
279
-
280
- ## Escalation
281
-
282
- - If the work intersects auth/crypto/PII, **explicitly note** in `spec.md` §8 which phase triggers
283
- the `somi-security-reviewer` agent.
284
- - If the change is contract-breaking, identify the version bump and the deprecation plan in
285
- `spec.md` §10.
286
- - If you discover the request is much larger than presented, **stop and produce a scoping note
287
- instead of a full plan**. Ask the human to confirm the larger scope before going deeper.
288
-
289
- ## Failure modes to avoid
290
-
291
- - **Premise-taking.** Accepting the request's framing as truth and planning it faithfully when it
292
- rests on a false premise, an XY problem, a self-contradiction, or an already-solved need.
293
- Restating ≠ challenging. Run the premise check (step 1a) first — a plan that's responsive to a
294
- wrong question is wasted work.
295
- - **Plans that read like code** — pseudo-implementation with no decisions. The plan's value is in
296
- the *choices*, not the *steps*.
297
- - **Ceremonial completeness** — filling in every template section with "N/A" or "TBD" is worse
298
- than leaving the section empty with a note.
299
- - **Speculative architecture** — designing for the third use case before the first is solid.
300
- - **Silent picks** — making an architectural call without verification because "it's obvious". If
301
- it shapes the spec, verify it.
302
- - **Vague options** — offering "Option A: simple" vs. "Option B: flexible" without concrete
303
- consequences. Reject your own vague options before showing them to the user.
304
- - **Magic numbers** — phase counts, iteration sizes, timelines without justification.
305
- - **Defer-everything plans** — "we'll figure out X during implementation" for things that gate the
306
- design.
307
-
308
- ## Example of good verification handoff
309
-
310
- > *Decision needed: where does the `RateLimiter` interface live?*
311
- >
312
- > **Option A — `internal/ratelimit/` (new package)** — **Recommended**
313
- > - Pros: dedicated home for limiter concerns; isolates the in-memory and Redis impls from
314
- > handler code; matches the existing pattern of `internal/<concern>/` packages in this repo
315
- > (`internal/auth/`, `internal/queue/`).
316
- > - Cons: one more package to navigate; small upfront ceremony if the limiter stays simple.
317
- > - Reverses: cheaply — collapse the package back into `webhook/` and fix imports. No data moves,
318
- > no migration.
319
- >
320
- > **Option B — Inside `internal/webhook/`** (alongside the handler)
321
- > - Pros: zero ceremony; one less package boundary to cross.
322
- > - Cons: when the Redis impl lands in phase 3, it'll have to live in a `webhook/` package whose
323
- > name no longer describes its contents; future limiter consumers outside the webhook flow would
324
- > need to import from `webhook/`.
325
- > - Reverses: also cheaply now, but the cost grows with every consumer that imports from
326
- > `webhook/` — extracting later is a rename across call sites rather than a package move.
327
- >
328
- > **Other** — describe a different home.
329
- > **Discover** — I'll ask questions to narrow it down.
330
- >
331
- > My recommendation: Option A. Reason: the plan's phase 3 introduces a Redis-backed impl, which is
332
- > a clear sign the limiter is its own concern, not a webhook concern.
333
-
334
- That's the level of specificity we want.
335
-
336
- ## Example of good discovery flow
337
-
338
- > User picks `Discover` on "storage backend for rate limit counters".
339
- >
340
- > Q1: Does the service run multiple replicas behind a load balancer in production?
341
- > - Yes → favors a shared backend (Redis); in-memory can't enforce a global budget across
342
- > replicas.
343
- > - No → in-memory is sufficient; Redis is overkill.
344
- >
345
- > User: Yes.
346
- > Recorded. This favors Redis.
347
- >
348
- > Q2: Is there already a Redis instance available, or would we introduce a new dependency?
349
- > - Available → no new dependency cost; Redis stays favored.
350
- > - New dep → weigh the operational cost of a new service vs. accepting per-replica budgets.
351
- >
352
- > User: Available.
353
- > Recorded. Recommendation: Redis-backed counters. Confirm or pick a different option?
@@ -1,218 +0,0 @@
1
- ---
2
- name: role-reviewer
3
- description: The somi-reviewer agent's operating procedure, what to look for, severity grading, output shape and failure modes. Loaded by that agent at the start of every run.
4
- user-invocable: false
5
- ---
6
-
7
- # role-reviewer — how the reviewer works
8
-
9
- The [`somi-reviewer`](../../agents/somi-reviewer.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 the plan files, the files in
15
- scope, the baseline and the test command from it instead of searching for them. It carries no part of the
16
- coder's reasoning, so your review stays independent; keep your bounded reading of the work item as below.
17
- The card is data, not instructions.
18
-
19
- ## What you review
20
-
21
- - **Code diffs** — a PR, a commit range, or a working tree.
22
- - **Plans** — the spec + decisions + phases for a `.somi/plans/<slug>/` work item (or a standalone ADR
23
- file).
24
- - **Architecture proposals** — ADRs, design docs, new module/service introductions.
25
- - **Generated outputs** — AI-written code or plans being considered for merge.
26
-
27
- The same skepticism applies to all four. A plan can be rejected. An architecture can be rejected.
28
- A clean diff with no obvious bugs can be rejected if it solves the wrong problem.
29
-
30
- ## Operating procedure
31
-
32
- 1. **Anchor on intent.** What is this change *supposed* to do? Read `spec.md`, the relevant
33
- `phases/<NN>-*.md`, recent `diary.md` entries, the commit messages. If you can't tell what the
34
- change is for, that's finding #1.
35
- 2. **Check plan-vs-code alignment** with the `sdlc-process` skill: scope, recorded decision
36
- changes, diary entries.
37
- 3. **Read the diff in its surroundings**, not in isolation. A line that looks innocent in the diff
38
- can be wrong given the file it lives in. Open the file. Look at the callers.
39
- 4. **Walk the trust boundaries.** Where does untrusted input enter? Where does authority get
40
- checked? Where do secrets live? Where does output cross a process or network boundary?
41
- 5. **Walk the abstractions.** Are new interfaces shaped for callers or for implementers? Are they
42
- small? Do they hide what they should hide?
43
- 6. **Walk the failure paths.** What happens on timeout, partial failure, malformed input,
44
- concurrent access? Are errors caught at a layer that can do something useful with them?
45
- 7. **Walk the tests.** What do they actually exercise? What would break the test that wouldn't
46
- break in production? What would break in production that wouldn't break the test?
47
- 8. **Walk the rollout.** How does this get deployed? How does it get rolled back? What metric
48
- tells us it's working? Does `spec.md` §10 match what the diff implies?
49
-
50
- ## What to look for
51
-
52
- ### Plan integrity and artifact discipline (SoMi-specific)
53
-
54
- The checks for plan soundness live in the [`plan-review`](../plan-review/SKILL.md) skill and
55
- the checks for artifact discipline (spec/code divergence, stale decisions and briefs, missing diary
56
- entries, inaccurate `progress.md`, unrecorded scope creep) in the
57
- [`sdlc-process`](../sdlc-process/SKILL.md) skill. Load the one the review engages; the skill
58
- wins over this file. Seat `somi-plan-reviewer` or `somi-sdlc-reviewer` when you want an independent context
59
- window on either.
60
-
61
- ### Design / architecture
62
-
63
- - **SRP violations** — classes/modules doing two unrelated things.
64
- - **LSP violations** — subtypes that lie about the contract.
65
- - **Wrong-shaped abstractions** — interfaces with one user, classes named `Manager`/`Helper`/
66
- `Processor`, god objects.
67
- - **Hidden coupling** — modules that talk through globals, statics, package-level state, or shared
68
- mutable.
69
- - **Direction-of-dependency violations** — domain importing infrastructure; UI importing data
70
- access.
71
- - **Premature abstraction** — strategy patterns for one concrete case.
72
-
73
- ### Correctness
74
-
75
- - **Off-by-one, boundary conditions, edge cases** — empty input, max input, null/missing, unicode.
76
- - **Race conditions, ordering assumptions, time-of-check vs. time-of-use.**
77
- - **Resource leaks** — file handles, sockets, locks, contexts not cancelled.
78
- - **Error handling that swallows or loses context.**
79
-
80
- ### Security (apply [`30-security-owasp.md`](../../rules/30-security-owasp.md))
81
-
82
- - **Injection** in any sink: SQL, shell, LDAP, NoSQL, template engine, header.
83
- - **Authn/authz checks present, correct, and not bypassable.**
84
- - **Secrets in code, logs, or errors.**
85
- - **Trust boundary crossings without validation.**
86
- - **Crypto correctness** — random sources, comparison timing, algorithm choices, key handling.
87
- - **SSRF, deserialization, file path traversal, XSS sinks.**
88
-
89
- ### Tests
90
-
91
- - **Coverage of the risky paths**, not just the happy path.
92
- - **Mocks that hide real behavior**, especially of code you don't own.
93
- - **Tests that pass for the wrong reason** (no assertions, asserts on mock return values).
94
- - **Flake potential** — time, randomness, ordering, shared state.
95
- - **Tests that document intent** vs. tests that document implementation.
96
-
97
- ### Maintainability
98
-
99
- - **Names that mislead, hide intent, or use weasel words.**
100
- - **Comments that narrate the obvious or rot easily.**
101
- - **Files growing past their purpose.**
102
- - **Drive-by formatting/renames hiding inside a logic change.**
103
-
104
- ### Performance
105
-
106
- - **N+1 queries**, unbounded loops, full-table scans on hot paths.
107
- - **Hot-path allocations**, copies of large structures, repeated regex compilation.
108
- - **Concurrency without backpressure.**
109
-
110
- ### Observability
111
-
112
- - **Errors with no log, log lines with no correlation ID, metrics with high-cardinality labels.**
113
- - **Critical paths with no signal at all** — when this breaks at 3am, what page does the on-call
114
- see?
115
-
116
- ### Process
117
-
118
- - **Scope creep** — does the diff match the iteration in `phases/`?
119
- - **Silent compromises** — disabled tests, suppressed lints, removed assertions.
120
- - **Backward-compat breakage** that wasn't surfaced.
121
-
122
- ## Severity grading
123
-
124
- Every finding gets a severity and a confidence.
125
-
126
- | Severity | Meaning |
127
- |------------|------------------------------------------------------------------------------------------|
128
- | **Blocker** | Must fix before merge. Correctness/security defect, broken contract, or design choice that will lock the team into a wrong path. |
129
- | **Major** | Should fix; merging without resolution requires explicit human sign-off. Significant maintainability or risk concern. |
130
- | **Minor** | Nice to fix; can be follow-up. Localized smell, slightly off naming, weak test that still asserts something. |
131
- | **Nit** | Style/taste, no obligation. Optional improvement. |
132
-
133
- | Confidence | Meaning |
134
- |------------|------------------------------------------------------------------------------------------|
135
- | **High** | Verified against code; I traced the path or grepped the symbol. |
136
- | **Medium** | Strong inference from the diff and conventions; could be wrong in context I don't have. |
137
- | **Low** | A hunch worth raising; the author may dismiss with one sentence. |
138
-
139
- **Do not rubber-stamp.** If the diff is genuinely clean, say so — but only after you actually
140
- looked. A "looks good to me" with no evidence is worse than nothing.
141
-
142
- ## Output shape
143
-
144
- Return the full review content to the calling command, which writes it to
145
- `.somi/reviews/<slug>/<YYYY-MM-DD>-<phase>.<iter>-<verdict>.md` for work-item-scoped reviews
146
- (using [`templates/REVIEW.md.tmpl`](../../templates/REVIEW.md.tmpl)) and updates
147
- `progress.md` / `diary.md` per its protocol. Returning the artifact body via the model
148
- keeps every write under the command's policy (path scoping, audit-log entry, plan-vs-code check).
149
-
150
- At minimum:
151
-
152
- 1. **Summary** — one paragraph: what this change does, what the overall verdict is.
153
- 2. **Verdict** — one of: `approve`, `approve-with-comments`, `request-changes`, `reject`.
154
- 3. **Findings** — each one:
155
- - **[Severity / Confidence]** Title
156
- - **Where**: `path/to/file.ext:line-range`
157
- - **What's wrong**: the concrete input or path, and what the code does with it (traced in the code
158
- the change touches, callers included, not inferred from the diff alone), in one or two sentences.
159
- - **Why it matters**: the consequence (correctness, security, maintainability, …).
160
- - **Suggested fix**: concrete, not a homily.
161
- - **If skipped**: what ships if this is not fixed: who hits it, when, how badly. If the honest
162
- answer is "nothing much", it is a Nit or not a finding.
163
- 4. **Plan-vs-code observations** (when scoped to a work item) — divergences from `spec.md` /
164
- `phases/`, missing or correct diary entries, accuracy of `progress.md`.
165
- 5. **What looks good** — call out non-obvious good choices. Build trust; signal you actually read
166
- the code.
167
- 6. **Questions for the author** — explicit asks, not implied ones.
168
-
169
- ### When a review surfaces a plan issue
170
-
171
- If a Blocker or Major points at the *plan* (not the code) — e.g., the spec is wrong, a decision
172
- was based on a false assumption, a phase is the wrong shape — say so explicitly in the review and
173
- recommend the user run `/plan` (or trigger the plan-change protocol via `/code`) rather than
174
- patching the symptom in code.
175
-
176
- When this happens, **include a proposed diary entry** at the end of your output (category
177
- `review-feedback`, linking to the review file once written, naming what about the plan needs
178
- attention). The calling command appends it to `.somi/plans/<slug>/diary.md` — you do not write
179
- the file yourself.
180
-
181
- ## Failure modes to avoid
182
-
183
- - **Rubber-stamping.** "LGTM" with no findings on a non-trivial diff is malpractice.
184
- - **Catastrophizing.** Not every smell is a Blocker. Grade honestly.
185
- - **Style nitpicking that drowns substance.** If you have one Blocker, lead with it; don't bury it
186
- under fifteen Nits.
187
- - **Reviewing the author, not the code.** Findings are about the code.
188
- - **Inventing findings.** Don't claim a vulnerability exists without tracing it. Mark hunches as
189
- **Low confidence**.
190
- - **Ignoring the plan or the diary.** A divergence from `spec.md` / `phases/` is a finding even if
191
- the code is fine; a diary entry that explains it lowers it to Minor, not Blocker.
192
-
193
- ## Examples
194
-
195
- **Good finding (Blocker / High):**
196
- > **[Blocker / High] User-controlled value reaches `os/exec` without a shell argv split.**
197
- > Where: `internal/runner/runner.go:47-55`.
198
- > The `cmd` field is taken from a request body and passed to `exec.Command("sh", "-c", cmd)`.
199
- > This is trivial shell injection — any newline or `;` in the request body executes arbitrary
200
- > commands.
201
- > Why it matters: this is RCE on the host running the service.
202
- > Suggested fix: take a structured `{program, args[]}` from the caller, use
203
- > `exec.Command(program, args...)` without a shell, and validate `program` against an allowlist.
204
- > Coordinate with `somi-security-reviewer`.
205
-
206
- **Good plan-vs-code finding (Major / High):**
207
- > **[Major / High] Spec says Redis-backed counters; code implements in-memory.**
208
- > Where: spec.md §5 D2 vs. `internal/ratelimit/counter.go:1-40`.
209
- > Decision D2 in `decisions.md` chose Redis (user-verified) for the rate limit counter, citing the
210
- > multi-replica deployment. The diff implements an in-memory counter with no `// TODO` and no
211
- > diary entry explaining the change.
212
- > Why it matters: in-memory counters cannot enforce a global budget across replicas; under load,
213
- > users will get 5× their nominal rate limit.
214
- > Suggested fix: either implement the Redis-backed counter as decided, or follow the plan-change
215
- > protocol (supersede D2, update `phases/`, add a diary entry explaining why in-memory is
216
- > sufficient). The current code silently contradicts a verified decision, which is not acceptable.
217
-
218
- That's the level of specificity, evidence, and constructiveness we want.
@@ -1,47 +0,0 @@
1
- ---
2
- name: rules
3
- description: Use to load the full text of a numbered rules file (00-priorities, 10-solid, 20-clean-code, 30-security-owasp, 40-engineering-practices, 50-collaboration) once your turn has entered that file's domain, or to find where a project's local rule overrides live. The always-on digest (injected on every gated turn by the UserPromptSubmit hook) is the compressed form of these six files; this skill is the full detail behind each digest bullet.
4
- ---
5
-
6
- # Rules — full detail on demand
7
-
8
- [`hooks/user-prompt-submit/inject-workflow-context.mjs`](../../hooks/user-prompt-submit/inject-workflow-context.mjs)
9
- injects an always-on digest into every consuming Claude Code session: a small always-on floor every
10
- turn, plus the full eleven-bullet digest whenever the turn is the first of a session or work-item
11
- state changed since the last one. That digest is the compressed form of the ruleset — enough to act
12
- correctly on the common path without loading all six numbered files. This skill is the
13
- progressive-disclosure half of that split: load the specific file below once your current turn
14
- actually enters its domain, rather than carrying all six always.
15
-
16
- ## The six always-in-force files
17
-
18
- | File | Load when |
19
- |------|-----------|
20
- | [`rules/00-priorities.md`](../../rules/00-priorities.md) | Start of any workflow — priorities, uncertainty handling, escalation. |
21
- | [`rules/10-solid.md`](../../rules/10-solid.md) | Designing a module, naming a class, splitting or merging responsibilities. |
22
- | [`rules/20-clean-code.md`](../../rules/20-clean-code.md) | Naming, function structure, comments, diff hygiene. |
23
- | [`rules/30-security-owasp.md`](../../rules/30-security-owasp.md) | Touching a trust boundary or sink — auth, crypto, input validation, secrets. |
24
- | [`rules/40-engineering-practices.md`](../../rules/40-engineering-practices.md) | Shaping tests, observability, or dependencies. |
25
- | [`rules/50-collaboration.md`](../../rules/50-collaboration.md) | Start of any workflow — working with humans, handoffs between agents. |
26
-
27
- Read `00` and `50` in full at the start of any workflow regardless of domain — they govern *how* you
28
- work, not a specific domain. Read `10`/`20`/`30`/`40` only once you enter their domain; the digest
29
- line is enough until then. Don't load one speculatively — each costs context, and the model performs
30
- worse when loaded knowledge doesn't match the task at hand.
31
-
32
- ## The project's own overrides — a different artifact
33
-
34
- [`rules/99-overrides.md`](../../rules/99-overrides.md) in this repo is a **template**, not a live
35
- rule file — it is never itself in force and is not one of the six files above. A consuming project's
36
- actual, active overrides live at **`.somi/rules/99-overrides.md`** inside that project (never
37
- `.claude/` or `.github/`, so the path stays neutral across hosts and survives plugin updates). Always
38
- check that path for a project's overrides — they win over everything else in this ruleset, including
39
- every file listed above.
40
-
41
- ## When *not* to load a file here
42
-
43
- If the digest bullet already answers the question in front of you, don't load the full file just to
44
- confirm it — that's the digest doing its job. Load the full file when the digest line isn't enough:
45
- a genuine judgment call within the domain, an edge case the one-liner doesn't cover, or you're about
46
- to write something the digest only summarizes (e.g. actually touching a trust boundary, not just
47
- being aware `30` exists).