@skathio/somi 4.1.0 → 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 -226
  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 -278
  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 -301
  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 -128
  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 -371
  334. package/tests/scripts/lib/loop-step-cli-tests.mjs +0 -141
  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,377 +0,0 @@
1
- # Example — Planner output
2
-
3
- > Generated by `/plan Add per-team rate limiting to the public webhook ingestion endpoint with audit logging and an emergency kill switch.`
4
- >
5
- > The planner produces a directory of focused artifacts under `.somi/plans/rate-limiting-webhooks/`,
6
- > not a single document. This example walks through each file. Sections are truncated for
7
- > brevity; a real plan would have more sections fully filled in.
8
-
9
- The work item slug: **`rate-limiting-webhooks`**. All artifacts live at
10
- `.somi/plans/rate-limiting-webhooks/`.
11
-
12
- ---
13
-
14
- ## `context.md` — the world as it stands
15
-
16
- ```markdown
17
- # Context — Per-team webhook rate limiting
18
-
19
- ## 1. Background
20
-
21
- A noisy customer recently consumed nearly all of the global 1000 req/min budget on
22
- `POST /webhooks/ingest`, starving quieter teams for ~12 minutes. SRE asked for per-team isolation;
23
- product asked for an operator-controlled kill switch we can use during incidents without a
24
- deploy.
25
-
26
- ## 2. Surrounding code
27
-
28
- - Touched / nearby: `internal/webhook/handler.go`, `internal/webhook/middleware.go`,
29
- `internal/config/`, `internal/audit/`.
30
- - Conventions in this area: constructor injection, context propagation, structured logging via
31
- `slog`.
32
- - Existing test coverage: thorough on the handler; thin on middleware composition.
33
-
34
- ## 3. Dependencies and integrations
35
-
36
- | Dependency | Version / state | Relevance |
37
- |-------------|------------------------------------------|------------------------------------------|
38
- | Redis 7 | available (same VPC, same SLA as webhook)| Backing store for distributed counters |
39
- | Config store| available; supports per-team boolean keys| Kill-switch lives here |
40
- | Team ID | already in `X-Team-Id` header (authed) | The bucketing key |
41
-
42
- ## 4. Constraints
43
-
44
- - p99 latency on `/ingest` must not increase by more than 5ms.
45
- - Must roll out behind a flag; no big-bang deploy.
46
- - Killswitch must take effect within 30s of being flipped, without a deploy.
47
-
48
- ## 5. Stakeholders
49
-
50
- - Requester: SRE — wants noisy-team isolation and an incident-time kill switch.
51
- - Reviewers expected: SRE on-call, webhook team lead.
52
- - Affected downstream: ingest workers (lower-but-fairer throughput per team).
53
- ```
54
-
55
- ---
56
-
57
- ## `spec.md` — purpose, requirements, decisions, DoD
58
-
59
- ```markdown
60
- # Spec — Per-team webhook rate limiting
61
-
62
- ## 1. Purpose
63
-
64
- Add per-team request budgets to webhook ingestion so a noisy team can't starve others. Provide an
65
- operator-controlled kill switch to halt ingestion for a specific team during incidents without
66
- deploying.
67
-
68
- ## 2. User story
69
-
70
- - As an **SRE on-call**, I want to flip a kill switch for one misbehaving team, so that I can
71
- contain an incident without a deploy or a global outage.
72
- - As a **legitimate team**, I want a guaranteed minimum throughput, so that another team's
73
- spike doesn't starve me.
74
-
75
- ## 3. Requirements
76
-
77
- ### Functional
78
- - R1 — Each team has a request budget (default 200 req/min, per-team override config).
79
- - R2 — Denied requests return 429 with `Retry-After` and a structured error body.
80
- - R3 — Audit log entry on every deny: team_id, time, reason, count-in-window, correlation_id.
81
- - R4 — Kill switch (ops-only) disables ingestion for a specific team within 30s, no deploy.
82
-
83
- ### Non-functional
84
- - NF1 — p99 latency on `/ingest` increases by ≤ 5ms under 500 rps load.
85
- - NF2 — No new high-cardinality metric labels (team_id is bucketed, not raw).
86
-
87
- ## 4. Goals / Non-goals
88
-
89
- **Goals**: per-team isolation; kill switch; audit log.
90
- **Non-goals**: per-endpoint sub-limits; cost-based limiting; new dashboards beyond two new panels.
91
-
92
- ## 5. Core decisions
93
-
94
- - **D1** — Token-bucket algorithm, Redis-backed. ([`decisions.md#d1`](./decisions.md#d1))
95
- - **D2** — Limiter applies **before body parsing** (cheap-reject path). ([`decisions.md#d2`](./decisions.md#d2))
96
- - **D3** — Killswitch defaults to **off** per team; never wide-open. ([`decisions.md#d3`](./decisions.md#d3))
97
- - **D4** — Audit log includes team_id (real), correlation_id, reason, counts — **no payload**.
98
- ([`decisions.md#d4`](./decisions.md#d4))
99
-
100
- ## 6. Acceptance criteria
101
-
102
- - [ ] Over-limit team gets 429 with `Retry-After`.
103
- - [ ] Killswitch flip halts ingestion for the targeted team within 30s; other teams unaffected.
104
- - [ ] Audit log lines visible in central sink with required fields.
105
- - [ ] p99 latency increase ≤ 5ms under load test.
106
-
107
- ## 7. Test strategy
108
-
109
- Risk-driven: focus on (a) atomicity under concurrent requests against Redis, (b) clock-driven
110
- expiry edges (frozen clock), (c) handler returning correct status + headers, (d) audit log shape.
111
-
112
- ## 8. Security considerations
113
-
114
- - Trust boundary: untrusted webhook payload from the internet.
115
- - Sinks: log line (log-injection if we put raw team-supplied headers in logs), Redis Lua (no
116
- concat — args parameterized).
117
- - OWASP: A04 (DoS abuse), A05 (misconfig if killswitch wide-opens), A09 (logging — capture
118
- without leaking PII).
119
- - `somi-security-reviewer` trigger: **end of phase 2** (before flag is turned on in prod).
120
-
121
- ## 9. Observability plan
122
-
123
- Logs (audit), metrics (`webhook.ratelimit.{allow,deny}` and `webhook.killswitch.tripped` —
124
- team_bucket label), traces (span attribute `ratelimit.outcome`), alerts on sustained deny rate.
125
-
126
- ## 10. Rollout & rollback
127
-
128
- Flag `webhook_ratelimit_v1`, default off, 1% → 10% → 50% → 100% with 24h between. Rollback: flag
129
- off. Success metric: zero P0 incidents for 14d; per-team p95 within ±5ms.
130
-
131
- ## 11. Risks
132
-
133
- | Risk | Likelihood | Impact | Mitigation |
134
- |--------------------------------------------|-----------|--------|------------------------------------------------|
135
- | Redis hiccup → false denies | M | H | Fail-open with circuit breaker; alert on spike |
136
- | Limit too tight for legitimate bursts | M | M | 24h ramp + per-team override |
137
- | Killswitch misconfig kills all teams | L | H | Per-team only; no "all" key; 2-person approval |
138
-
139
- ## 12. Definition of Done
140
-
141
- - [ ] All phases complete with passing tests.
142
- - [ ] `somi-security-reviewer` consulted at end of phase 2; no Blocker findings.
143
- - [ ] Staging ramp completed (1% → 100%) without incident.
144
- - [ ] Ops runbook updated with kill-switch procedure.
145
- - [ ] Audit log fields documented in `docs/observability/audit-events.md`.
146
- - [ ] `progress.md` status set to `done`.
147
- ```
148
-
149
- ---
150
-
151
- ## `decisions.md` — the deliberation behind each choice
152
-
153
- ```markdown
154
- # Decisions — Per-team webhook rate limiting
155
-
156
- ## D1 — Rate-limit algorithm + backing store
157
-
158
- > Status: `accepted` • Date: 2026-05-20 • Verified with user: yes • Phase: work-item-wide
159
-
160
- ### Context
161
-
162
- The service runs N replicas behind a load balancer; an in-memory limiter cannot enforce a per-team
163
- budget across replicas. We need atomic refill + take semantics.
164
-
165
- ### Decision
166
-
167
- Use a token-bucket algorithm backed by a Redis Lua script (atomic refill + take).
168
-
169
- ### Alternatives considered
170
-
171
- #### Option A — Token bucket in Redis (chosen)
172
- - Pros: smooth bursts, well-understood, ops-friendly, atomic via Lua.
173
- - Cons: a network hop per request (well within latency budget).
174
-
175
- #### Option B — In-process leaky bucket (rejected)
176
- - Pros: zero extra deps.
177
- - Cons: drift across replicas, unfair under autoscaling, can't enforce global budget.
178
- - Reason for rejection: violates the goal of *global* per-team isolation across N replicas.
179
-
180
- #### Option C — Sliding-window in Redis (rejected, revisit later)
181
- - Pros: more precise (no edge-of-window bursts).
182
- - Cons: more expensive Lua script per request; harder to reason about.
183
- - Reason for rejection: bucket precision is sufficient for the SLA; reconsider if we see bucket
184
- drift complaints.
185
-
186
- ### Discovery questions
187
-
188
- (User picked A directly; discovery not used.)
189
-
190
- ### Consequences
191
-
192
- - Positive: clear ops story; latency budget preserved with one Redis call per request.
193
- - Negative: Redis hiccup affects every request — circuit breaker required (see D5 below).
194
- - Reversibility: low cost to swap to sliding-window later; same interface, different Lua.
195
-
196
- ### Implementation notes
197
-
198
- - `internal/ratelimit/redis.go` — Lua script lives here.
199
- - Phase 2 wiring.
200
-
201
- ---
202
-
203
- ## D2 — Where the limiter applies in the request path
204
-
205
- > Status: `accepted` • Date: 2026-05-20 • Verified with user: yes
206
-
207
- ### Decision
208
-
209
- Limiter applies **before body parsing** (cheap-reject path).
210
-
211
- ### Alternatives considered
212
-
213
- #### Option A — Before body parsing (chosen)
214
- - Pros: trivial DoS resistance — we don't allocate a payload buffer for over-limit traffic.
215
- - Cons: can't apply payload-size-aware limits (not in scope per non-goal §4).
216
-
217
- #### Option B — After body parsing
218
- - Pros: enables cost-based limiting later.
219
- - Cons: over-limit traffic still allocates and parses; opens trivial resource-exhaustion vector.
220
- - Reason for rejection: cost-based limiting is a non-goal; protecting the cheap path is the
221
- whole point.
222
-
223
- ### Consequences
224
-
225
- Positive: predictable, cheap rejection path. Negative: forecloses cost-based modes. Reversibility:
226
- moderate — we can move the limiter after parsing if we add cost-based limiting later.
227
-
228
- ---
229
-
230
- ## D3 — Killswitch default behavior
231
-
232
- > Status: `accepted` • Date: 2026-05-20 • Verified with user: yes
233
-
234
- ### Decision
235
-
236
- Killswitch defaults to **off** for every team; never wide-open by default; no "all teams" key.
237
-
238
- ### Alternatives considered
239
-
240
- #### Option A — Per-team boolean, default off (chosen)
241
- - Pros: safe default; fits OWASP A05 (misconfig); ops can enable for exactly one team.
242
- - Cons: no quick way to halt *all* ingestion in a true emergency (acceptable — we have rate-limit
243
- fallback for that).
244
-
245
- #### Option B — Per-team + "all" override
246
- - Pros: faster total halt during a wide incident.
247
- - Cons: misconfig blast radius is the whole service.
248
- - Reason for rejection: a wide halt is rarer than a single-team halt; we have other levers (deploy
249
- rollback, LB drain) for the wide case.
250
-
251
- (More decisions follow, including D4 for audit log content and D5 for circuit-breaker design.)
252
- ```
253
-
254
- ---
255
-
256
- ## `phases/` — one file per phase
257
-
258
- The planner writes one file per phase under `phases/`. The phase file expands each iteration in
259
- detail (scope, files, acceptance, tests, observability, rollback). For this work item:
260
-
261
- ```
262
- phases/
263
- ├── 01-limiter-contract.md ← Phase 1: define interface + in-memory impl for testing
264
- ├── 02-redis-and-wiring.md ← Phase 2: Redis-backed impl + wire into handler (flag-gated)
265
- └── 03-killswitch-and-audit.md ← Phase 3: kill switch + structured audit log
266
- ```
267
-
268
- A single phase file (truncated):
269
-
270
- ```markdown
271
- # Phase 1 — Limiter contract + in-memory impl
272
-
273
- ## Goal
274
-
275
- Define the `RateLimiter` interface and prove its behavior with an in-memory impl. No integration
276
- with the webhook handler yet.
277
-
278
- ## Exit criteria
279
-
280
- - [ ] `RateLimiter` interface defined with `Allow(ctx, key, n) (bool, retryAfter, error)`.
281
- - [ ] In-memory bucket passes table-driven tests for burst, expiry, concurrency, zero-budget.
282
-
283
- ## Iterations
284
-
285
- ### Iteration 1.1 — Interface + in-memory impl + table tests
286
-
287
- - Scope: define interface; implement `InMemoryLimiter`; add table tests.
288
- - Files: `internal/ratelimit/limiter.go` (new), `internal/ratelimit/inmem.go` (new),
289
- `internal/ratelimit/inmem_test.go` (new).
290
- - Acceptance: tests cover burst, expiry, concurrency, zero-budget.
291
- - Tests: table-driven unit tests with a frozen clock.
292
- - Observability: none yet (no integration).
293
- - Rollback: revert the PR.
294
- - Status: not-started.
295
- ```
296
-
297
- ---
298
-
299
- ## `progress.md` — single source of truth for status
300
-
301
- ```markdown
302
- # Progress — Per-team webhook rate limiting
303
-
304
- ## Status
305
-
306
- `awaiting-approval`
307
-
308
- Started: 2026-05-20
309
- Last activity: 2026-05-20 — work item created, 4 decisions verified with user.
310
-
311
- ## Phase progress
312
-
313
- | # | Phase | Status | Iterations done / total |
314
- |---|------------------------------------|-------------|-------------------------|
315
- | 1 | Limiter contract + in-memory impl | not-started | 0/1 |
316
- | 2 | Redis-backed + wiring | not-started | 0/2 |
317
- | 3 | Killswitch + audit | not-started | 0/2 |
318
-
319
- ## Currently in flight
320
-
321
- Nothing yet — plan awaiting approval.
322
-
323
- ## Decisions outstanding
324
-
325
- - [ ] **SRE**: 200/min default — confirm with traffic data (not blocking phase 1).
326
- - [ ] **Ops**: 2-person approval for kill-switch flip — runbook concern, addressed in phase 3.
327
-
328
- ## Recent activity
329
-
330
- - **2026-05-20**: work item created; D1–D4 verified with user; phases sliced.
331
- ```
332
-
333
- ---
334
-
335
- ## `diary.md` — chronological narrative
336
-
337
- ```markdown
338
- # Diary — Per-team webhook rate limiting
339
-
340
- ## 2026-05-20 10:14 — Work item started
341
-
342
- **Category**: note
343
- **Phase**: work-item-wide
344
-
345
- Initial planning. Problem statement from SRE: noisy-team incident on /ingest, want per-team
346
- isolation + an operator-controlled kill switch usable mid-incident without a deploy.
347
-
348
- Drafted `context.md` (background, dependencies — Redis 7 available, config store available),
349
- drafted spec skeleton.
350
-
351
- Verified 4 decisions with user:
352
- - D1 — Token bucket in Redis (chose A; B rejected for replica drift; C deferred).
353
- - D2 — Limiter before body parsing (chose A; cheap-reject path matters for DoS resistance).
354
- - D3 — Killswitch defaults off per team (chose A; no "all" key — blast radius concern).
355
- - D4 — Audit log fields without payload (chose A; OWASP A09 — no PII in logs).
356
-
357
- Sliced into 3 phases / 5 iterations. Status awaiting-approval.
358
- ```
359
-
360
- ---
361
-
362
- ## What this example demonstrates
363
-
364
- - **Six focused files** (plus `phases/` and `reviews/`) instead of one monolithic plan — each
365
- artifact has a single purpose; readers can jump straight to spec, decisions, progress, or
366
- diary without scrolling.
367
- - **Decisions verified inline** — each entry in `decisions.md` shows the options considered with
368
- concrete pros and cons, marks user verification, and (if used) records the discovery Q&A.
369
- - **`spec.md` references decisions by ID** — the spec stays a stable "what + why" document;
370
- `decisions.md` carries the deliberation.
371
- - **`progress.md` is the front door** — read it first to know where the work item stands; phases
372
- table tells you what's done, what's next, what's blocked.
373
- - **`diary.md` is the time machine** — when you come back to this work item in three months,
374
- diary tells you the story of how it evolved.
375
- - **No stale state** — if a constraint discovered during phase 2 forces D1 to change, the agent
376
- supersedes D1 with D5 in `decisions.md`, updates the one-liner in `spec.md` §5, updates
377
- `phases/02-…md` if it shifts the shape, and appends a `diary.md` entry recording why.
@@ -1,188 +0,0 @@
1
- # Example — `/ship` end-to-end pipeline
2
-
3
- A condensed transcript of using `/ship` for a tiny feature: **add a `--dry-run` flag to the
4
- `migrate` CLI**. Shows the human-in-the-loop gates between stages, the inline verification of
5
- architectural decisions during planning, and how the `.somi/plans/<slug>/` artifact set gets populated.
6
-
7
- ---
8
-
9
- ## Turn 1 — User invokes `/ship`
10
-
11
- ```
12
- > /ship Add a --dry-run flag to the migrate CLI that prints the SQL it would execute without
13
- applying any changes. Should work for both up and down migrations.
14
- ```
15
-
16
- ## Turn 2 — Claude (Stage 1: Plan — slug and scaffold)
17
-
18
- > Proposed slug: `migrate-dry-run`. Creating `.somi/plans/migrate-dry-run/` …
19
- >
20
- > [scaffolds `context.md`, `spec.md`, `decisions.md`, `progress.md`, `diary.md`, `phases/`,
21
- > `reviews/`]
22
- >
23
- > Reading `cmd/migrate/main.go`, `internal/migrate/runner.go`, existing tests. Drafting
24
- > `context.md` and the spec skeleton.
25
-
26
- ## Turn 3 — Claude (Stage 1: Plan — first verification)
27
-
28
- > One architectural decision to verify before I write the phases:
29
- >
30
- > **Decision: shape of the dry-run option on `Runner`.**
31
- >
32
- > **Option A — `Options.DryRun bool`** — **Recommended**
33
- > - Pros: minimal API surface; matches existing `Options.{Verbose, RetryCount}` style; one place
34
- > to read at the gate.
35
- > - Cons: closes the door on future modes (`explain`, `verify`) without an additive change later.
36
- >
37
- > **Option B — `Options.Mode runner.Mode`** (typed enum: `apply` / `dryRun`)
38
- > - Pros: leaves room for `explain` / `verify` modes by adding enum variants instead of new bools;
39
- > makes the gate exhaustive at compile time.
40
- > - Cons: more code today for a one-mode addition; requires a default value when callers don't
41
- > supply one.
42
- >
43
- > **Other** — describe a different option.
44
- > **Discover** — I'll ask narrowing questions.
45
- >
46
- > My recommendation: Option A. There's no concrete pull for `explain` / `verify` yet; we can
47
- > migrate to an enum if and when we add a second alternative mode.
48
-
49
- ## Turn 4 — User
50
-
51
- ```
52
- > A
53
- ```
54
-
55
- ## Turn 5 — Claude (Stage 1: Plan — finishing)
56
-
57
- > Recorded as D1 in `decisions.md` (Verified with user: yes).
58
- >
59
- > Writing `phases/01-thread-flag.md`, `phases/02-tests-docs.md`. Updating `spec.md` §5 with the
60
- > one-liner for D1. Initial `progress.md` written (status `awaiting-approval`). First diary entry
61
- > appended.
62
- >
63
- > **Summary**: Two iterations under one phase. (1) Thread `--dry-run` through CLI and
64
- > `Runner.Apply` using `Options.DryRun bool`. (2) Add tests + docs.
65
- >
66
- > **Risks**: (a) printing SQL with secrets — none of our migrations embed secrets, but worth a
67
- > one-line redaction pass; (b) ordering — dry-run must still resolve dependencies in the same
68
- > order as the real apply.
69
- >
70
- > **Open questions**: none.
71
- >
72
- > Plan ready under `.somi/plans/migrate-dry-run/`. Reply `approve` to proceed to Stage 2, `revise
73
- > <notes>` to iterate on the plan, or `abort` to stop.
74
-
75
- ## Turn 6 — User
76
-
77
- ```
78
- > approve
79
- ```
80
-
81
- ## Turn 7 — Claude (Stage 2: Code, Iteration 1.1)
82
-
83
- > Marking phase 1, iteration 1 `in-progress` in `progress.md`. Reading the relevant files.
84
- >
85
- > [edits `cmd/migrate/main.go` to register the flag and pass it]
86
- > [edits `internal/migrate/runner.go` to add `DryRun bool` to options and short-circuit `Exec` to
87
- > `fmt.Println`]
88
- >
89
- > Tests green. Marking iteration 1.1 `done`. Updated `progress.md`. Diary entry added.
90
- >
91
- > **Work item**: `migrate-dry-run` • iteration 1.1.
92
- > **What changed**:
93
- > - `cmd/migrate/main.go` — registered `--dry-run` flag; passed through to `Runner.Apply`.
94
- > - `internal/migrate/runner.go` — added `Options.DryRun`; in dry-run mode, prints `BEGIN; <SQL>;
95
- > COMMIT;` for each migration in dependency order without opening a transaction.
96
- > **Plan changes**: none.
97
- > **Why**: matches phase 1 iteration 1 acceptance.
98
- > **Not done**: tests + docs — planned for iteration 1.2.
99
- > **What to look at**: the dependency-resolution path in `runner.go:142-158` — same code path as
100
- > real apply (which is the whole point); if you re-order migrations, dry-run output reorders too.
101
- > **Tradeoffs taken**: none material.
102
- >
103
- > Iteration 1.1 implemented. Reply `review` to invoke the reviewer on this iteration, `next` to
104
- > proceed to the next iteration without a review, or `stop`.
105
-
106
- ## Turn 8 — User
107
-
108
- ```
109
- > review
110
- ```
111
-
112
- ## Turn 9 — Claude (Stage 3: Review)
113
-
114
- > [reads the diff, `spec.md`, `phases/01-…`, recent diary entries]
115
- >
116
- > **Verdict**: `approve-with-comments`.
117
- > **Counts**: 0 Blockers, 0 Majors, 1 Minor, 1 Nit.
118
- >
119
- > **Top findings**:
120
- > - **[Minor / Medium]** Dry-run prints `BEGIN/COMMIT` per migration, but real apply uses a single
121
- > transaction per `up` batch. Output suggests semantics that don't quite match real apply.
122
- > Suggest matching the real shape or noting the divergence in the printed header.
123
- > - **[Nit / Low]** None material on naming or structure.
124
- >
125
- > Plan-vs-code: no drift; iteration scope matched `phases/01-thread-flag.md` exactly.
126
- >
127
- > Review file at `.somi/reviews/migrate-dry-run/2026-05-21-iteration-1-1-approve-with-comments.md`.
128
- > Recent activity logged in `progress.md`. No diary entry needed — finding is a code concern, not
129
- > a plan concern.
130
- >
131
- > Reply `next` to proceed to iteration 1.2 (tests + docs), `revise` to address the Minor first,
132
- > or `stop`.
133
-
134
- ## Turn 10 — User
135
-
136
- ```
137
- > revise — address the Minor by matching the real transaction shape in dry-run output.
138
- ```
139
-
140
- ## Turn 11 — Claude (Stage 2 again, addressing review feedback)
141
-
142
- > Adjusting iteration 1.1 per review feedback.
143
- >
144
- > [edits `internal/migrate/runner.go` so dry-run emits one `BEGIN` at the start of a batch and one
145
- > `COMMIT` at the end, matching real apply semantics]
146
- >
147
- > Done. Re-running review …
148
- >
149
- > **Verdict**: `approve` (clean). Review file updated.
150
- >
151
- > Reply `next` to proceed to iteration 1.2.
152
-
153
- ## Turn 12 — User
154
-
155
- ```
156
- > next
157
- ```
158
-
159
- ## Turn 13 — Claude (Stage 2, Iteration 1.2)
160
-
161
- > [writes table tests for dry-run output; updates `docs/migrate.md`]
162
- >
163
- > ... [final review on iteration 1.2 — clean approve] ...
164
- >
165
- > All iterations complete. Setting `progress.md` status to `done`. Final diary entry appended.
166
- > Work item: `migrate-dry-run`.
167
- >
168
- > Artifacts at `.somi/plans/migrate-dry-run/` — full audit trail of the work. Ready for PR.
169
-
170
- ---
171
-
172
- ## What the example demonstrates
173
-
174
- - **Slug + scaffold up front** — every work item gets its own `.somi/plans/<slug>/` directory; the
175
- six-file artifact set is created from templates before drafting starts.
176
- - **Inline verification on architectural decisions** — the agent surfaces options with concrete
177
- pros and cons and offers `Other` / `Discover` escape hatches. The user decides; the choice is
178
- recorded in `decisions.md`.
179
- - **Hard gates** between stages — Claude never silently progresses.
180
- - **One iteration per coding cycle** — even though the plan had two iterations, each one got its
181
- own code → review loop.
182
- - **Progress + diary updates** — `progress.md` reflects status; `diary.md` captures notable
183
- events. If the coder had to change the plan mid-implementation, a diary entry with category
184
- `plan-change` would have recorded what changed and why.
185
- - **Reviews are scoped to the work item** — they land under `reviews/` and update `progress.md`.
186
- A plan-affecting finding would have appended a `review-feedback` diary entry.
187
- - **Artifacts persist** — `.somi/plans/migrate-dry-run/` is the durable record of the work, auditable
188
- after the session ends.
@@ -1,29 +0,0 @@
1
- {
2
- "$schema": "https://json.schemastore.org/claude-code-settings.json",
3
- "_comment": "Sample post-install settings.json for a project that installed somi as a plugin. Hooks are NOT declared here — Claude Code auto-merges them from the plugin's hooks/hooks.json (paths resolve via ${CLAUDE_PLUGIN_ROOT}). This file holds project-specific env, permissions, and any project-only hooks. If you vendor somi instead of using the plugin marketplace, copy the hooks block from somi's own .claude/settings.json (which uses ${SOMI_VENDOR_ROOT}) and merge it here.",
4
- "env": {
5
- "NODE_ENV": "development"
6
- },
7
- "permissions": {
8
- "allow": [
9
- "Read(**)",
10
- "Grep(**)",
11
- "Glob(**)",
12
- "Bash(npm test:*)",
13
- "Bash(npm run lint:*)",
14
- "Bash(npm run typecheck:*)",
15
- "Bash(git status:*)",
16
- "Bash(git diff:*)",
17
- "Bash(git log:*)"
18
- ],
19
- "deny": [
20
- "Read(./.env)",
21
- "Read(./.env.local)",
22
- "Read(./.env.production)",
23
- "Bash(curl * | sh)",
24
- "Bash(rm -rf /:*)",
25
- "Bash(git push --force:*)",
26
- "Bash(git push --force-with-lease:*)"
27
- ]
28
- }
29
- }
@@ -1,78 +0,0 @@
1
- # sample-consumer — Project instructions
2
-
3
- This file is the **project's** `CLAUDE.md` — **yours, hand-written**. SoMi does not generate it and
4
- never writes to it. It holds your project's own instructions; SoMi's ruleset arrives separately (see
5
- below).
6
-
7
- ---
8
-
9
- ## SoMi's ruleset — you do not need to wire this up
10
-
11
- **Nothing in this section is required.** On Claude Code, SoMi's `UserPromptSubmit` hook injects a
12
- priority floor (a header plus four bullets) on every turn, plus the fuller digest whenever the
13
- work-item signature changes; the numbered files are available on demand via the `rules` skill.
14
- On GitHub Copilot, `extension.json`'s `"rules"` key handles it. See
15
- [`docs/RULES.md`](../../docs/RULES.md#how-the-ruleset-reaches-your-session) (repo-relative — that
16
- link will not resolve once you copy this file into your own project).
17
-
18
- If you want SoMi's digest pinned into *this* file's context regardless — so it is present on every
19
- turn rather than only on signature-change turns — use an **`@import`**. A markdown link is inert;
20
- Claude Code will not follow it.
21
-
22
- > **This imports `rules/CLAUDE.md` only — roughly 200 of the ruleset's ~700 lines.** That file
23
- > references `00`–`50` with markdown links, and `@` expansion does not follow those, so the
24
- > numbered files (~460 lines) do **not** come with it. What you get is the digest plus the
25
- > composition index — close to what the hook already injects. For the numbered files, use the
26
- > `rules` skill.
27
-
28
- **Find your plugin root first.** A marketplace install copies SoMi into a user-level cache
29
- (`~/.claude/plugins/cache`), *not* into your project; a vendored copy is wherever you put it. Note
30
- that `/plugin` lists installed plugins and their components but does **not** show a filesystem
31
- path, so it cannot answer this. Once you know the root, add a line of this shape, unindented and
32
- **not** inside a code fence:
33
-
34
- @your/plugin/root/rules/CLAUDE.md
35
-
36
- > The line above is a **placeholder** — that path does not exist, so as written it is a no-op.
37
- > Replace `your/plugin/root` with your real root before it does anything.
38
-
39
- > **Three silent-failure modes to avoid.** (1) **Import parsing skips fenced code blocks and code
40
- > spans** — a `@path` inside triple-backticks or `` ` `` is deliberately *not* imported, so the line
41
- > above must be bare. (2) An `@import` pointing at a nonexistent path fails without warning.
42
- > (3) An import resolving **outside your project** — which a marketplace install always is, since
43
- > the plugin lives in a home-directory cache — triggers a one-time approval dialog; **if you decline
44
- > it, the imports stay disabled and the dialog never reappears.** After adding the line, confirm the
45
- > ruleset is actually in context rather than assuming it.
46
-
47
- > If you want to override a SOMI default, edit
48
- > `.somi/rules/99-overrides.md` (consumer-relative — that path exists in your project, not in this
49
- > example directory) — SOMI will never touch that file.
50
- > This lives under `.somi/`, not `.claude/` or `.github/`, so it stays the same regardless of
51
- > which host (Claude Code, GitHub Copilot) is consuming SoMi.
52
-
53
- ---
54
-
55
- ## Project-specific instructions
56
-
57
- <!-- Add your project's conventions, idioms, and gotchas below. SOMI rules already cover SOLID,
58
- clean code, OWASP, and engineering practices — focus on what's unique about THIS project. -->
59
-
60
- ### Stack
61
-
62
- - Language: TypeScript (Node 20).
63
- - Framework: Fastify.
64
- - DB: Postgres via Prisma.
65
- - Tests: Vitest + Testcontainers for DB integration.
66
-
67
- ### Project conventions
68
-
69
- - HTTP error envelope is defined in `src/lib/httperr.ts` — use it everywhere.
70
- - Domain code lives in `src/domain/`; it must not import from `src/infra/`.
71
- - All migrations are reversible; the down migration is part of the same PR as the up.
72
- - Logs are JSON via `pino`; never `console.log` in committed code.
73
-
74
- ### What goes in PRs
75
-
76
- - Tests (no exceptions for non-trivial logic).
77
- - Updated `docs/` if behavior or interfaces changed.
78
- - A short summary referencing the plan iteration if there was one.