@skathio/somi 3.1.0 → 4.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 (148) hide show
  1. package/.claude/settings.json +13 -0
  2. package/.claude-plugin/marketplace.json +2 -2
  3. package/.claude-plugin/plugin.json +1 -1
  4. package/.copilot-extension/extension.json +1 -1
  5. package/.copilot-extension/marketplace.json +2 -2
  6. package/README.md +28 -23
  7. package/VERSION +1 -1
  8. package/agents/{architecture-reviewer.md → somi-architecture-reviewer.md} +10 -11
  9. package/agents/{atlas.md → somi-atlas.md} +3 -5
  10. package/agents/{coder.md → somi-coder.md} +29 -26
  11. package/agents/{designer.md → somi-designer.md} +9 -11
  12. package/agents/{discovery-analyst.md → somi-discovery-analyst.md} +7 -9
  13. package/agents/{impact.md → somi-impact.md} +6 -8
  14. package/agents/{incident.md → somi-incident.md} +2 -4
  15. package/agents/{plan-reviewer.md → somi-plan-reviewer.md} +9 -11
  16. package/agents/{planner.md → somi-planner.md} +19 -27
  17. package/agents/{pr.md → somi-pr.md} +2 -4
  18. package/agents/{refactor-designer.md → somi-refactor-designer.md} +14 -15
  19. package/agents/{refactorer.md → somi-refactorer.md} +14 -15
  20. package/agents/{reviewer.md → somi-reviewer.md} +8 -7
  21. package/agents/{sdlc-reviewer.md → somi-sdlc-reviewer.md} +8 -10
  22. package/agents/{security-reviewer.md → somi-security-reviewer.md} +8 -8
  23. package/agents/{test-strategist.md → somi-test-strategist.md} +4 -6
  24. package/agents/somi.md +27 -14
  25. package/commands/adopt.md +9 -10
  26. package/commands/architecture-review.md +4 -5
  27. package/commands/atlas.md +3 -4
  28. package/commands/code-loop.md +38 -14
  29. package/commands/code-parallel.md +4 -4
  30. package/commands/code.md +24 -15
  31. package/commands/debug.md +8 -9
  32. package/commands/design.md +14 -15
  33. package/commands/discover.md +11 -12
  34. package/commands/impact.md +2 -3
  35. package/commands/incident.md +3 -4
  36. package/commands/plan-loop.md +16 -12
  37. package/commands/plan.md +15 -16
  38. package/commands/pr.md +2 -3
  39. package/commands/refactor-design.md +10 -11
  40. package/commands/refactor.md +7 -8
  41. package/commands/release-readiness.md +6 -7
  42. package/commands/review-panel.md +24 -23
  43. package/commands/review.md +14 -14
  44. package/commands/security-review.md +8 -7
  45. package/commands/ship-loop.md +107 -28
  46. package/commands/ship.md +6 -6
  47. package/commands/somi-config.md +131 -0
  48. package/commands/test-strategy.md +3 -4
  49. package/commands/upgrade.md +4 -5
  50. package/examples/code-review-example.md +1 -1
  51. package/examples/discovery-example.md +1 -1
  52. package/examples/feature-plan-example.md +2 -2
  53. package/hooks/hooks.json +14 -1
  54. package/hooks/lib/common.mjs +64 -1
  55. package/hooks/post-tool/audit-log.mjs +3 -2
  56. package/hooks/pre-tool/block-secret-writes.mjs +12 -11
  57. package/hooks/pre-tool/guard-cost-lowering.mjs +177 -0
  58. package/hooks/pre-tool/guard-protected-paths.mjs +13 -3
  59. package/hooks/session-start/detect-repo-instructions.mjs +27 -2
  60. package/hooks/session-start/ensure-default-config.mjs +121 -0
  61. package/package.json +1 -1
  62. package/rules/00-priorities.md +1 -1
  63. package/rules/30-security-owasp.md +1 -1
  64. package/rules/50-collaboration.md +9 -6
  65. package/rules/CLAUDE.md +11 -10
  66. package/scripts/lib/agent-info.mjs +85 -0
  67. package/scripts/lib/agent-registry.mjs +92 -0
  68. package/scripts/lib/cost-ceiling.mjs +175 -171
  69. package/scripts/lib/cost-config-edit.mjs +102 -0
  70. package/scripts/lib/cost-config.mjs +64 -0
  71. package/scripts/lib/cost-defaults.mjs +51 -0
  72. package/scripts/lib/cost-lowering.mjs +89 -0
  73. package/scripts/lib/cost-model.mjs +37 -22
  74. package/scripts/lib/dispatch-resolver.mjs +68 -50
  75. package/scripts/lib/loop-diff.mjs +96 -0
  76. package/scripts/lib/loop-dispatch.mjs +19 -0
  77. package/scripts/lib/loop-review.mjs +52 -0
  78. package/scripts/lib/run-budget.mjs +28 -0
  79. package/scripts/lib/size-tier.mjs +184 -0
  80. package/scripts/lib/tier-record.mjs +82 -0
  81. package/scripts/size-budget-overrides.json +7 -15
  82. package/scripts/somi-config.mjs +358 -0
  83. package/scripts/somi-dispatch.mjs +1 -1
  84. package/scripts/somi-loop.mjs +71 -96
  85. package/scripts/somi-mcp.mjs +135 -14
  86. package/scripts/somi-tier.mjs +393 -0
  87. package/scripts/validate.sh +37 -215
  88. package/skills/api-design/SKILL.md +1 -1
  89. package/skills/clean-code/SKILL.md +1 -1
  90. package/skills/market-research/SKILL.md +2 -2
  91. package/skills/owasp-defense/SKILL.md +2 -2
  92. package/skills/plan-review/SKILL.md +5 -1
  93. package/skills/reasoning-craft/SKILL.md +1 -1
  94. package/skills/requirements-engineering/SKILL.md +3 -3
  95. package/skills/solid-principles/SKILL.md +1 -1
  96. package/skills/somi-dispatch/SKILL.md +116 -87
  97. package/skills/somi-routing/SKILL.md +88 -1
  98. package/skills/testing-playbook/SKILL.md +2 -2
  99. package/skills/threat-modeling/SKILL.md +3 -3
  100. package/templates/BRIEF.md.tmpl +2 -2
  101. package/templates/DESIGN.md.tmpl +1 -1
  102. package/templates/DOD.md.tmpl +2 -2
  103. package/templates/PHASE.md.tmpl +2 -2
  104. package/templates/RCA.md.tmpl +1 -1
  105. package/templates/REVIEW.md.tmpl +3 -2
  106. package/templates/SDD.md.tmpl +1 -1
  107. package/templates/SPEC.md.tmpl +1 -1
  108. package/templates/TDD.md.tmpl +1 -1
  109. package/tests/hooks/cases/block-secret-writes.json +130 -17
  110. package/tests/hooks/cases/detect-repo-instructions.json +22 -1
  111. package/tests/hooks/cases/guard-protected-paths.json +175 -25
  112. package/tests/scripts/agent-model-frontmatter.sh +38 -0
  113. package/tests/scripts/agent-names.sh +77 -0
  114. package/tests/scripts/check-frontmatter.sh +1 -1
  115. package/tests/scripts/checkpoint-gate.sh +44 -3
  116. package/tests/scripts/convergence-runner.sh +10 -6
  117. package/tests/scripts/cost-ceiling.sh +127 -215
  118. package/tests/scripts/cost-defaults.sh +128 -0
  119. package/tests/scripts/cost-hardcap.sh +329 -0
  120. package/tests/scripts/cost-lowering.sh +261 -0
  121. package/tests/scripts/cost-model.sh +18 -14
  122. package/tests/scripts/dispatch-guard.sh +7 -7
  123. package/tests/scripts/dispatch-line-gate.sh +61 -0
  124. package/tests/scripts/dispatch-reference-gate.sh +13 -13
  125. package/tests/scripts/ensure-default-config.sh +162 -0
  126. package/tests/scripts/eval-runner.sh +9 -9
  127. package/tests/scripts/evals-packaging.sh +127 -20
  128. package/tests/scripts/fixtures/size-tier-cases.json +87 -0
  129. package/tests/scripts/goldens/loop-state-done.json +1 -1
  130. package/tests/scripts/goldens/somi-loop.json +3 -3
  131. package/tests/scripts/lib/agent-registry-tests.mjs +95 -0
  132. package/tests/scripts/lib/brief-only-guard.mjs +27 -0
  133. package/tests/scripts/lib/checkpoint-gate.mjs +40 -3
  134. package/tests/scripts/lib/dispatch-reference-gate.mjs +5 -5
  135. package/tests/scripts/lib/retirement-gate.mjs +7 -2
  136. package/tests/scripts/lib/ship-loop-sizing-guard.mjs +52 -0
  137. package/tests/scripts/lib/size-tier-drift.mjs +74 -0
  138. package/tests/scripts/lib/somi-mcp-config-tests.mjs +92 -0
  139. package/tests/scripts/lib/somi-mcp-tests.mjs +80 -25
  140. package/tests/scripts/lib/somi-mcp-tier-tests.mjs +64 -0
  141. package/tests/scripts/retirement-gate.sh +19 -0
  142. package/tests/scripts/review-panel-seats.sh +2 -2
  143. package/tests/scripts/run.sh +95 -0
  144. package/tests/scripts/size-tier.sh +562 -0
  145. package/tests/scripts/somi-agent-dispatch-contract.sh +20 -11
  146. package/tests/scripts/somi-config.sh +281 -0
  147. package/tests/scripts/somi-dispatch.sh +194 -95
  148. package/tests/scripts/somi-mcp.sh +2 -0
@@ -32,10 +32,9 @@ is for cases where structure is the primary subject.
32
32
  Use the same resolution logic as [`/review`](./review.md): slug, working tree, range, PR, file,
33
33
  or `plan <slug>`.
34
34
 
35
- ### 2. Brief the `architecture-reviewer` agent
35
+ ### 2. Brief the `somi-architecture-reviewer` agent
36
36
 
37
- Before this `Task`, call `somi_resolve` for `architecture-reviewer` (with `project_dir`), pass its
38
- model, and put `dispatched at cost: <tier>` in the briefing; full rules: the `somi-dispatch` skill
37
+ Before this `Task`, call `somi_resolve` for `somi-architecture-reviewer` (with `project_dir`), pass its `model`, start it as its `agent_type`, and put the cost line in the briefing (`dispatched at cost: <tier>` only when `enforced` is true, else `requested cost: <tier> (not enforced: no mapped model)`); full rules: the `somi-dispatch` skill
39
38
  (`somi_skill`, or `somi:somi-dispatch` on Claude Code). Via the Task tool, pass:
40
39
 
41
40
  - The diff or plan-artifact set.
@@ -45,7 +44,7 @@ model, and put `dispatched at cost: <tier>` in the briefing; full rules: the `so
45
44
  stress-test the contract against three plausible future requirements, check reversibility, check
46
45
  team fit.
47
46
 
48
- The `architecture-reviewer` agent is read-only **by contract, not by platform restriction** — it
47
+ The `somi-architecture-reviewer` agent is read-only **by contract, not by platform restriction** — it
49
48
  holds Write/Edit but is forbidden from using them, so the command owns every write. Have it **return** its findings;
50
49
  the command owns all writes.
51
50
 
@@ -60,7 +59,7 @@ the command owns all writes.
60
59
  - **Follow-ups** — issues to file, monitoring to add, sunset criteria for any compromises.
61
60
 
62
61
  If the architecture has security implications, the command **must** also invoke
63
- `security-reviewer` via Task — call `somi_resolve` for `security-reviewer` first (full rules: the
62
+ `somi-security-reviewer` via Task — call `somi_resolve` for `somi-security-reviewer` first (full rules: the
64
63
  `somi-dispatch` skill) — and merge those findings.
65
64
 
66
65
  ### 4. Write the review
package/commands/atlas.md CHANGED
@@ -10,7 +10,7 @@ You are running the **repo cartography** workflow of somi: one deep read of this
10
10
  every later design action starts from a map plus the drift since its SHA instead of re-reading
11
11
  the whole repo per work item. This command has no `cost:` of its own — and no `model:` of its own
12
12
  either, so it runs on whatever model this session is already using — and Tasks the
13
- [`atlas`](../agents/atlas.md) agent for its entire job, which declares `cost: high` with no lower
13
+ [`somi-atlas`](../agents/somi-atlas.md) agent for its entire job, which defaults to `high` with no lower
14
14
  member.
15
15
 
16
16
  ## What to do
@@ -19,9 +19,8 @@ member.
19
19
  explicitly request a refresh — the agent's own staleness check still decides whether that's an
20
20
  in-place update on small drift or a rebuild of just the affected sections on structural drift,
21
21
  never the whole atlas.
22
- 2. **Brief the `atlas` agent** ([`agents/atlas.md`](../agents/atlas.md)) — before this `Task`, call
23
- `somi_resolve` for `atlas` (with `project_dir`), pass its model, and put `dispatched at cost:
24
- <tier>` in the briefing; full rules: the `somi-dispatch` skill (`somi_skill`, or
22
+ 2. **Brief the `somi-atlas` agent** ([`agents/somi-atlas.md`](../agents/somi-atlas.md)) — before this `Task`, call
23
+ `somi_resolve` for `somi-atlas` (with `project_dir`), pass its `model`, start it as its `agent_type`, and put the cost line in the briefing (`dispatched at cost: <tier>` only when `enforced` is true, else `requested cost: <tier> (not enforced: no mapped model)`); full rules: the `somi-dispatch` skill (`somi_skill`, or
25
24
  `somi:somi-dispatch` on Claude Code) — with the mode. It runs the
26
25
  staleness check itself, does the deep read, and writes `.somi/atlas.md` (and `.somi/README.md`
27
26
  if missing) directly — this command owns no writes here.
@@ -12,12 +12,13 @@ The user's target: **$ARGUMENTS** (a work-item slug, optionally with `phase N, i
12
12
 
13
13
  This command automates the manual `/code` → `/review` → `/code` cycle for a single iteration,
14
14
  with **hard gates** that ensure it terminates. It has no `cost:` of its own — a command has no
15
- model to size — and runs entirely inline; the `coder` it Tasks declares `cost: low, medium`
16
- (`medium` unless the session ceiling resolves to `low`; executing against the work item's
17
- `brief.md` + plan), while the `reviewer` it Tasks declares
18
- `cost: medium, high` — the session ceiling picks the highest permitted member, typically `high`
19
- for the fresh-eyes judgment this loop wants, run on a cold context so it isn't biased by the
20
- coder's reasoning.
15
+ model to size — and runs entirely inline; the `somi-coder` it Tasks defaults to `medium`
16
+ (it runs at the session ceiling; executing against the work item's
17
+ `brief.md` + plan), while the `somi-reviewer` it Tasks defaults
18
+ to `high` — it runs at the session ceiling unless `cost.agents` pins it (pin `somi-reviewer`
19
+ to `high` for the fresh-eyes judgment this loop wants, run on a cold context so it isn't biased by
20
+ the
21
+ coder's reasoning).
21
22
 
22
23
  > **Cache-prefix discipline.** Keep the stable inputs — `rules/CLAUDE.md`, the work-item `brief.md`,
23
24
  > `spec.md`, and the active `phases/<NN>-*.md` — in the **same order at the front** of each pass's
@@ -32,13 +33,14 @@ coder's reasoning.
32
33
  | `SEVERITY_FLOOR` — verdicts that re-loop | `Major` (Blocker + Major) | `SOMI_CODE_LOOP_SEVERITY_FLOOR` (`Blocker` to only re-loop on Blockers) |
33
34
  | `DIFF_CAP_LINES` — cumulative diff across passes | `400` | `SOMI_CODE_LOOP_DIFF_CAP` |
34
35
  | `CIRCUIT_BREAKER` — stop if the same finding (file + symbol + title) recurs in 2 consecutive passes | always on | (n/a) |
35
- | `REVIEW_MODE` — `single` (Task `reviewer`) or `panel` (Task [`/review-panel`](./review-panel.md), parallel multi-lens) | `single` | `SOMI_CODE_LOOP_REVIEW` (`panel`) |
36
+ | `REVIEW_MODE` — `single` (Task `somi-reviewer`), `security` (`somi-reviewer` and `somi-security-reviewer` in parallel; the security lens reads the whole iteration) or `panel` (Task [`/review-panel`](./review-panel.md), parallel multi-lens). At least `security` whenever `init` or `pass` prints `review_min: security` (the sizing record says the work may handle untrusted input or touch auth, crypto, secrets or PII); `panel` also satisfies it | `single` | `SOMI_CODE_LOOP_REVIEW` (`security`, `panel`) |
37
+ | `REVIEW_SCOPE` — what the generalist reviewer reads from pass 2: `delta` (the change since the last reviewed tree, plus the open findings) or `full` (the whole iteration). Pass 1 and the last allowed pass are always full; the security lens and the `panel` mode always read the whole iteration | `delta` | `SOMI_CODE_LOOP_REVIEW_SCOPE` (`full`) |
36
38
  | `HUMAN_CHECKPOINT` — pause between passes if user reply `stop` is detected | always on | (n/a) |
37
39
 
38
40
  **Precedence:** CLI flag (`--max-passes`, `--diff-cap`) > env var (session override) >
39
41
  `.somi/config.json` (committed project policy — keys
40
42
  `code_loop.max_passes`, `code_loop.severity_floor`, `code_loop.diff_cap_lines`,
41
- `code_loop.review_mode`) > the defaults above. Read both at the start of the run; record the
43
+ `code_loop.review_mode`, `code_loop.review_scope`) > the defaults above. Read both at the start of the run; record the
42
44
  effective values in the first diary entry of the loop.
43
45
 
44
46
  `MAX_PASSES` and `DIFF_CAP_LINES` are **re-resolved on every `pass` / `check-diff` call**, not
@@ -64,6 +66,11 @@ adjusting either mid-loop still means starting a fresh loop.
64
66
  Same logic as [`/code`](./code.md) §1–§2. If the iteration is missing or already `done`, stop and
65
67
  ask the user.
66
68
 
69
+ A **brief-only work item** (`brief.md` and `progress.md`, no `phases/`) is iteration `1.1`. Refuse
70
+ it, stopping before `init` and recommending `/plan <problem>`, unless the CLI's tier record for the
71
+ slug exists with a non-null `signals_sha256` and `tier` equal to `small`, stamped approved for the current `brief.md` (`init` enforces this); never
72
+ create or edit that record by hand. Use the brief's expected files as `--files`.
73
+
67
74
  ### 2. Initialize loop state (deterministic, resumable)
68
75
 
69
76
  The loop's arithmetic — pass counting, the diff baseline, cap checks, finding recurrence — is
@@ -102,13 +109,16 @@ session death at `.somi/somi-state/loop/<slug>.<N>.<M>.json`.
102
109
  while true:
103
110
  # 3a. Pass gate (deterministic)
104
111
  node scripts/somi-loop.mjs pass --slug <slug> --iteration <N>.<M>
112
+ exit 4 → STOP — the /ship-loop run's time budget is spent: same follow-ups, exit "time-budget"
105
113
  exit 2 → STOP — write remaining ≥Major findings as progress.md follow-ups (by F-id),
106
114
  summarise, exit "max-passes-exceeded"
107
115
 
108
- # 3b. Code — call somi_resolve for coder first (project_dir, model, dispatched-at-cost line in
116
+ # 3b. Code — call somi_resolve for somi-coder first (project_dir, model, cost line in
109
117
  # the briefing); full rules: the somi-dispatch skill (somi_skill, or somi:somi-dispatch on
110
- # Claude Code)
111
- Task coder ( = /code <slug> phase <N>, iteration <M>, brief = current_findings or initial spec )
118
+ # Claude Code). Every agent this loop starts is also recorded (the script re-resolves it;
119
+ # it records what SoMi decided, not your claim):
120
+ # node scripts/somi-loop.mjs record-dispatch --slug <slug> --iteration <N>.<M> --agent <agent> [--host <host>]
121
+ Task somi-coder ( = /code <slug> phase <N>, iteration <M>, brief = current_findings or initial spec )
112
122
 
113
123
  # 3c. Diff & scope gate (deterministic — cumulative vs the recorded baseline, working tree
114
124
  # included, .somi/.claude excluded; out-of-scope lines count DOUBLE)
@@ -116,12 +126,24 @@ while true:
116
126
  exit 3 → STOP — exit "diff-cap-exceeded"; if the printed JSON's out_of_scope is non-empty,
117
127
  report the stop as "scope-expansion" and name the files
118
128
 
119
- # 3d. Review — single reviewer, or the parallel panel when REVIEW_MODE == panel
129
+ # 3d. Review — single reviewer, reviewer + security lens, or the parallel panel.
130
+ # First ask what the generalist reads (the script decides, not the orchestrator):
131
+ node scripts/somi-loop.mjs review-scope --slug <slug> --iteration <N>.<M>
132
+ scope == "delta" → its brief: "review only the change from <from> to <to> (`git diff <from> <to>`:
133
+ <files>), and re-check each open finding in the ledger: resolved, or still open with
134
+ its evidence. Do not re-review code outside that change; it was reviewed on pass
135
+ <since_pass>." A defect the delta introduces anywhere is in scope.
136
+ scope == "full" → this iteration's whole diff, as on pass 1
120
137
  if REVIEW_MODE == "panel":
121
138
  Task /review-panel ( = <slug> phase <N>, iteration <M> ) # a command — resolves its own lenses
139
+ elif REVIEW_MODE == "security": # also whenever pass printed review_min: security
140
+ # call somi_resolve for both first; Task both in ONE message so they run in parallel
141
+ Task somi-reviewer ( = /review <slug>, scope = the review-scope result )
142
+ Task somi-security-reviewer ( = security lens on this iteration's WHOLE diff, every pass )
143
+ # merge: one findings list, de-duplicated by locus, severity = the highest either lens gave
122
144
  else:
123
- # call somi_resolve for reviewer first; full rules: the somi-dispatch skill
124
- Task reviewer ( = /review <slug>, scope = this iteration's diff )
145
+ # call somi_resolve for somi-reviewer first; full rules: the somi-dispatch skill
146
+ Task somi-reviewer ( = /review <slug>, scope = the review-scope result )
125
147
 
126
148
  # 3e. Record the pass + findings. The ledger computes recurrence on a STABLE locus
127
149
  # (file + symbol + normalized title — never the raw line number, which drifts between
@@ -177,6 +199,8 @@ while true:
177
199
  `circuit-breaker` | `user-stop`.
178
200
  - Passes used (out of `MAX_PASSES`) — from `somi-loop.mjs stats` (also the run's telemetry:
179
201
  per-pass verdicts, Blocker/Major counts, diff sizes).
202
+ - What ran: `finish`'s `dispatches`, one line per agent start (agent, tier, model, enforced). Name
203
+ every `enforced: false` start; the host chose that model, not SoMi.
180
204
  - Final verdict + count by severity.
181
205
  - Cumulative diff size and any out-of-scope files touched.
182
206
  - Pointer to all review files under `.somi/reviews/<slug>/` from this loop.
@@ -14,10 +14,10 @@ The user's target: **$ARGUMENTS** (a work-item slug, optionally a specific `phas
14
14
 
15
15
  This command has no `cost:` of its own and Tasks no agent directly — it composes
16
16
  [`/code-loop`](./code-loop.md) instead, which makes it a router by inspection, not by
17
- declaration. Each `/code-loop` instance it runs Tasks its `coder` at `cost: low, medium` (`medium`
18
- unless the session ceiling resolves to `low`; executing against the work item's `brief.md`
19
- + plan) and its `reviewer` at whatever `medium, high` member the session ceiling permits (typically
20
- `high`, fresh-eyes judgment).
17
+ declaration. Each `/code-loop` instance it runs Tasks its `somi-coder` at its default tier `medium` (it runs at
18
+ the session ceiling; executing against the work item's `brief.md`
19
+ + plan) and its `somi-reviewer` at the session ceiling unless `cost.agents` pins it (pin it to `high` for
20
+ fresh-eyes judgment).
21
21
 
22
22
  > **Why this exists, and why it's conservative.** Smaller diffs from focused agents are higher
23
23
  > quality — *if* they don't collide. Letting several coders edit the same tree at once produces merge
package/commands/code.md CHANGED
@@ -7,14 +7,14 @@ allowed-tools: Task, Read, Edit, Write, Bash, Grep, Glob, WebFetch
7
7
  # /code — Coding workflow
8
8
 
9
9
  You are running the **coding workflow** of somi. It has no `cost:` of its own — a command has no
10
- model to size — and runs entirely inline regardless of which branch step 1 takes; the `coder` it
11
- Tasks declares `cost: low, medium`. It runs the full procedure at `medium` unconditionally, for
10
+ model to size — and runs entirely inline regardless of which branch step 1 takes; the `somi-coder` it
11
+ Tasks defaults to `medium`. It runs the full procedure at any tier above `low`, for
12
12
  every accepted iteration — dispatch can't tell "the small one" apart from the rest, which is why
13
- `coder` has no job-shaped excuse to run lighter on its own initiative. It runs at `low` only when
14
- the session ceiling resolves there (an explicit CLI flag or `SOMI_COST_CEILING`, a committed
15
- `.somi/config.json`, or persisted state), in which case it still implements and tests the
13
+ `somi-coder` has no job-shaped excuse to run lighter on its own initiative. It runs at `low` only for
14
+ a `low` ceiling (flag, env var, `cost.ceiling`, or one set earlier by flag or env var) or a
15
+ `cost.agents` entry of `low`, in which case it still implements and tests the
16
16
  iteration but trims the proactive design-smell sweep and discloses the trade in its summary — see
17
- [`agents/coder.md`](../agents/coder.md)'s "Running at `low`" section for exactly what stays and
17
+ [`agents/somi-coder.md`](../agents/somi-coder.md)'s "Running at `low`" section for exactly what stays and
18
18
  what trims. The expensive reasoning (architecture, decisions, complexity, repo conventions) was
19
19
  front-loaded by a design action upstream and lives in the work item — implement against it.
20
20
 
@@ -43,13 +43,23 @@ Parse the fenced user request (above) for the resolution shape:
43
43
  - If it's a free-form task description and **no work item exists** or applies, apply the trivial
44
44
  threshold in [`skills/somi-routing/SKILL.md`](../skills/somi-routing/SKILL.md#the-trivial-threshold):
45
45
  - If the request **meets** it, proceed without a work item or plan. No artifacts to update; skip
46
- §2, §4, §5 and §7, and brief the `coder` with the request itself.
46
+ §2, §4, §5 and §7, and brief the `somi-coder` with the request itself.
47
47
  - If it **fails** it (any signal, or unsure), stop. Recommend `/debug <symptoms>` when the cause is
48
48
  not yet isolated, otherwise `/plan <problem>`.
49
49
 
50
+ **Brief-only work item.** A slug whose directory holds `brief.md` and `progress.md` but no
51
+ `phases/` is a one-iteration item, iteration `1.1`; its acceptance is the brief's testable
52
+ acceptance bullets and its files are the brief's expected files. It exists only for the `small`
53
+ tier of [`/ship-loop`](./ship-loop.md), so **refuse it unless** the CLI's record
54
+ `.somi/somi-state/tier/<slug>.json` exists, has a non-null `signals_sha256`, has `tier` equal to
55
+ `small`, and carries the approval stamp (`approved_at`, and a `brief_sha256` matching `brief.md` now);
56
+ `scripts/somi-loop.mjs init` enforces the same check. A missing, unreadable or mismatching record means the item was not sized: stop and
57
+ recommend `/plan <problem>`. Never create the record or edit it by hand.
58
+
50
59
  ### 2. Locate the iteration
51
60
 
52
- Read `.somi/plans/<slug>/spec.md`, `progress.md`, and the relevant `phases/<NN>-*.md`. If a
61
+ Read `.somi/plans/<slug>/spec.md`, `progress.md`, and the relevant `phases/<NN>-*.md` (a brief-only
62
+ item has `brief.md` and `progress.md` only, read those). If a
53
63
  **`brief.md`** is present (the design→execution handoff), read it too — it carries the decisions in
54
64
  force, the complexity map, the file map, and the repo conventions. **Apply its `§10 Supersessions`
55
65
  overlay before trusting §2** — a supersession line there wins over the §2 decision it names.
@@ -61,10 +71,9 @@ all earlier ones are `done`).
61
71
  If the iteration is `blocked`, surface why (from `progress.md` and `diary.md`) and ask whether to
62
72
  unblock first, switch iterations, or proceed despite the block.
63
73
 
64
- ### 3. Brief the `coder` agent
74
+ ### 3. Brief the `somi-coder` agent
65
75
 
66
- Before this `Task`, call `somi_resolve` for `coder` (with `project_dir`), pass its model, and put
67
- `dispatched at cost: <tier>` in the briefing; full rules: the `somi-dispatch` skill (`somi_skill`,
76
+ Before this `Task`, call `somi_resolve` for `somi-coder` (with `project_dir`), pass its `model`, start it as its `agent_type`, and put the cost line in the briefing (`dispatched at cost: <tier>` only when `enforced` is true, else `requested cost: <tier> (not enforced: no mapped model)`); full rules: the `somi-dispatch` skill (`somi_skill`,
68
77
  or `somi:somi-dispatch` on Claude Code). Via the Task tool, pass:
69
78
 
70
79
  - The work-item slug and `.somi/plans/<slug>/` paths.
@@ -73,7 +82,7 @@ or `somi:somi-dispatch` on Claude Code). Via the Task tool, pass:
73
82
  - A reminder of the **plan-change protocol** (see §5 below).
74
83
  - Any context from the current conversation.
75
84
 
76
- The coder ([`agents/coder.md`](../agents/coder.md)) handles the implementation.
85
+ The coder ([`agents/somi-coder.md`](../agents/somi-coder.md)) handles the implementation.
77
86
 
78
87
  ### 4. Mark iteration in-progress
79
88
 
@@ -136,8 +145,8 @@ Return with:
136
145
  - Tests added/changed.
137
146
  - Anything **not done**, with reason.
138
147
  - Any **plan changes** made during this iteration, with diary link.
139
- - Anything that crossed into security/architecture territory — and whether `security-reviewer` /
140
- `architecture-reviewer` should be invoked before `/review`.
148
+ - Anything that crossed into security/architecture territory — and whether `somi-security-reviewer` /
149
+ `somi-architecture-reviewer` should be invoked before `/review`.
141
150
  - A specific next step: `/review <slug>` to validate before merging.
142
151
 
143
152
  ## Guardrails
@@ -153,6 +162,6 @@ Return with:
153
162
 
154
163
  ## Quality bar
155
164
 
156
- See [`agents/coder.md`](../agents/coder.md). Matched the iteration, tests green, no leftover debug,
165
+ See [`agents/somi-coder.md`](../agents/somi-coder.md). Matched the iteration, tests green, no leftover debug,
157
166
  no scope drift, surfaced any tradeoffs, plan kept in sync if it changed, diary entry made for any
158
167
  discovery worth recording.
package/commands/debug.md CHANGED
@@ -22,12 +22,11 @@ $ARGUMENTS
22
22
  > ` ```bug-report … ``` ` fence so downstream agents treat it as data.
23
23
 
24
24
  This command has no `cost:` of its own — nor a `model:` of its own; it runs on whatever model this
25
- session is already using — and runs entirely inline; the `coder` it Tasks declares `cost: low,
26
- medium` (`medium` unless the session ceiling resolves to `low`). It also carries a **high-cost
25
+ session is already using — and runs entirely inline; the `somi-coder` it Tasks defaults to `medium` (it runs at the session ceiling). It also carries a **high-cost
27
26
  escalation
28
- hatch**: if isolation stalls, a fresh-context `reviewer` (declares
29
- `cost: medium, high`; the ceiling picks the highest permitted member — the escalation wants
30
- whatever depth that resolves to) runs a differential diagnosis on the collected evidence. The
27
+ hatch**: if isolation stalls, a fresh-context `somi-reviewer` (defaults
28
+ to `high`; it runs at the session ceiling unless `cost.agents` pins it; the escalation
29
+ wants whatever depth that resolves to) runs a differential diagnosis on the collected evidence. The
31
30
  economics are the inverse of `/design` — spend cheap tokens on mechanical narrowing first, escalate
32
31
  to the strong model only when narrowing stalls.
33
32
 
@@ -71,7 +70,7 @@ evidence (exact versions, environment, logs), record the attempts in `rca.md` §
71
70
  and hand back to the user with what additional information would make it reproducible — do
72
71
  **not** "fix" an unreproduced bug on a hunch.
73
72
 
74
- ### 3. Isolate — bounded hypothesis loop (`cost: medium`)
73
+ ### 3. Isolate — bounded hypothesis loop (default `medium`)
75
74
 
76
75
  Work like a bisection, not a rewrite: form the **cheapest-to-test hypothesis first**, test it
77
76
  (instrument, `git bisect`, narrow the input, comment nothing out permanently), record the result
@@ -83,8 +82,8 @@ in `rca.md` §3's cause chain, and move on. Rules:
83
82
  - The repro from §2 is the oracle — a hypothesis is confirmed only when toggling the suspected
84
83
  cause flips the repro.
85
84
  - After **`MAX_HYPOTHESES`** failed hypotheses: **escalate to the higher-cost tier.** Task the
86
- [`reviewer`](../agents/reviewer.md) (declares `cost: medium, high`) — call `somi_resolve` for
87
- `reviewer` first (`project_dir`, its model, `dispatched at cost: <tier>` in the briefing; full
85
+ [`somi-reviewer`](../agents/somi-reviewer.md) (defaults to `high`) — call `somi_resolve` for
86
+ `somi-reviewer` first (with `project_dir`), pass its `model`, start it as its `agent_type`, and put the cost line in the briefing (`dispatched at cost: <tier>` only when `enforced` is true, else `requested cost: <tier> (not enforced: no mapped model)`); full
88
87
  rules: the `somi-dispatch` skill) — on a **fresh context** with the evidence only —
89
88
  `rca.md` (symptom, repro, cause chain so far, dead hypotheses) and the relevant code — for a
90
89
  differential diagnosis: what candidate causes does the evidence *not yet rule out*, and which
@@ -107,7 +106,7 @@ Fill `rca.md` §4 when green: the change, and **why it fixes the root cause, not
107
106
  - The §2 repro test **stays in the suite** — it is the regression guard, not scaffolding.
108
107
  - Answer `rca.md` §6 (*why did no test catch this?*). If the answer is a test-shape problem
109
108
  (over-mocked seam, missing integration level), consult
110
- [`test-strategist`](../agents/test-strategist.md) and record its recommendation.
109
+ [`somi-test-strategist`](../agents/somi-test-strategist.md) and record its recommendation.
111
110
  - File follow-ups (§7 + `progress.md`): sibling defects, deferred hardening, observability gaps.
112
111
  - Set `progress.md` status to `done`; append a closing diary entry (category `note`) with the
113
112
  one-line root cause.
@@ -8,19 +8,19 @@ allowed-tools: Task, Read, Grep, Glob, Write, Edit, WebSearch, WebFetch, Bash
8
8
 
9
9
  You are running the **design workflow** of somi — the front-loaded, expensive-reasoning step that
10
10
  turns a feature or user story into a settled architecture against the **existing codebase**, then
11
- compiles it into a dense [`brief.md`](../templates/BRIEF.md.tmpl) the cheaper (`cost: medium`) tier
11
+ compiles it into a dense [`brief.md`](../templates/BRIEF.md.tmpl) the cheaper (default `medium`) tier
12
12
  executes against **without re-researching**. All artifacts live under `.somi/plans/<slug>/`.
13
13
 
14
14
  > **The judgment-heavy core runs at the most capable tier — on the agent, not the command.** This
15
15
  > command declares no `cost:` and no `model:` of its own; it runs on whatever model this session is
16
- > already using, and Tasks the [`designer`](../agents/designer.md)
16
+ > already using, and Tasks the [`somi-designer`](../agents/somi-designer.md)
17
17
  > agent for the judgment-heavy core of the work (framing the feature, reading the codebase,
18
18
  > shaping crossroads); its `brief.md` anchors everything execution does, so the designer declares
19
19
  > `cost: high` with no lower member. This command still does real work of its own — scaffolding the
20
20
  > artifact set and owning the crossroads conversation with the user, which can't live inside a
21
21
  > single `Task` call because a Tasked run can't pause to converse — but that work has no `cost:` of
22
22
  > its own to declare. This is the high-cost layer of SoMi's design→execution economy; the cost is
23
- > justified because it lets plan and code run at `cost: medium`. See
23
+ > justified because it lets plan and code run at `medium`. See
24
24
  > [`docs/COMMANDS.md`](../docs/COMMANDS.md).
25
25
 
26
26
  > **/design vs /discover vs /plan.** [`/discover`](./discover.md) is for a **whole new product** —
@@ -79,12 +79,11 @@ Create `.somi/plans/<slug>/` with the design artifact set from [`templates/`](..
79
79
  If `.somi/README.md` does not yet exist at the repo root, also write it from
80
80
  [`templates/SOMI-README.md.tmpl`](../templates/SOMI-README.md.tmpl).
81
81
 
82
- ### 4. Invoke the `designer` agent
82
+ ### 4. Invoke the `somi-designer` agent
83
83
 
84
- Before this `Task`, call `somi_resolve` for `designer` (with `project_dir`), pass its model, and put
85
- `dispatched at cost: <tier>` in the briefing; full rules: the `somi-dispatch` skill (`somi_skill`,
84
+ Before this `Task`, call `somi_resolve` for `somi-designer` (with `project_dir`), pass its `model`, start it as its `agent_type`, and put the cost line in the briefing (`dispatched at cost: <tier>` only when `enforced` is true, else `requested cost: <tier> (not enforced: no mapped model)`); full rules: the `somi-dispatch` skill (`somi_skill`,
86
85
  or `somi:somi-dispatch` on Claude Code). Brief
87
- [`agents/designer.md`](../agents/designer.md) via the Task tool with:
86
+ [`agents/somi-designer.md`](../agents/somi-designer.md) via the Task tool with:
88
87
  - The full feature (kept inside the `user-feature` fence).
89
88
  - The slug and `.somi/plans/<slug>/` paths.
90
89
  - A reminder to follow the operating procedure: premise-check, **read the codebase deeply**, ingest
@@ -111,7 +110,7 @@ with the user, so run the **shared batch round-trip** (see [`commands/plan.md`](
111
110
  framed, nothing recorded).
112
111
  2. **You present each decision to the user faithfully** — options, pros/cons, recommendation, the
113
112
  escape hatches; the designer's pre-supplied narrowing questions power Discover mode.
114
- 3. This re-invocation resolves fresh too — call `somi_resolve` for `designer` again before it, same
113
+ 3. This re-invocation resolves fresh too — call `somi_resolve` for `somi-designer` again before it, same
115
114
  as the first Task (full rules: the `somi-dispatch` skill). Re-invoke the designer with a
116
115
  **`VERIFIED-DECISIONS` block appended** to the same briefing; it
117
116
  then records `decisions.md` entries with `Verified with user: yes` and compiles the brief.
@@ -124,15 +123,15 @@ user-verified without an actual user verdict from step 2.
124
123
  Hold the designer to the brief quality bar: it must be **dense, bounded (≤ ~400 lines / ~6k tokens),
125
124
  reference-not-inline**, and its **"What execution does NOT need to re-research"** section must be
126
125
  concrete and honest — that section is what earns the higher spend and lets `/plan`/`/code` run at
127
- `cost: medium`.
126
+ `medium`.
128
127
 
129
- ### 8. Optional high-cost review loop (review the design at `cost: high`)
128
+ ### 8. Optional high-cost review loop (review the design at `high`)
130
129
 
131
130
  For a high-stakes design, run a bounded **design → review → revise** loop before handing off — the
132
131
  high-cost counterpart to [`/plan-loop`](./plan-loop.md) / [`/code-loop`](./code-loop.md):
133
132
 
134
- - Task [`architecture-reviewer`](../agents/architecture-reviewer.md) (and
135
- [`reviewer`](../agents/reviewer.md) for the brief's completeness) — call `somi_resolve` for each
133
+ - Task [`somi-architecture-reviewer`](../agents/somi-architecture-reviewer.md) (and
134
+ [`somi-reviewer`](../agents/somi-reviewer.md) for the brief's completeness) — call `somi_resolve` for each
136
135
  first (full rules: the `somi-dispatch` skill) — on a **fresh context** — give it
137
136
  the artifacts only (`design.md`, `decisions.md`, `brief.md`), **not** the design conversation, so
138
137
  the review is unbiased.
@@ -148,8 +147,8 @@ Return to the user with:
148
147
  - The **architectural decisions made** (one-liner each) and the **complexity hotspots** identified.
149
148
  - A pointer to `.somi/plans/<slug>/` and the files to read first (`brief.md`, then `design.md`).
150
149
  - A specific next step: "Review / edit `.somi/plans/<slug>/brief.md`, then run `/plan <slug>` — the
151
- planner consumes the brief and sequences it into phases (at `cost: low, medium` — `medium`
152
- unless the session ceiling resolves to `low`)."
150
+ planner consumes the brief and sequences it into phases (default tier `medium` — it runs at the
151
+ session ceiling)."
153
152
 
154
153
  ## Guardrails
155
154
 
@@ -167,5 +166,5 @@ Return to the user with:
167
166
  The design is acceptable when the **brief alone** lets a planner sequence the work and a coder
168
167
  execute it without re-deriving the architecture; every architectural decision in `decisions.md` is
169
168
  user-verified; the complexity map names specific `file:line` hotspots; and `design.md` sets direction
170
- without drifting into the planner's file-by-file design. See [`agents/designer.md`](../agents/designer.md)
169
+ without drifting into the planner's file-by-file design. See [`agents/somi-designer.md`](../agents/somi-designer.md)
171
170
  for the full quality bar.
@@ -14,9 +14,9 @@ software-design phase of the SDLC that happens *before* planning or coding. Its
14
14
  > **The judgment-heavy core runs at the most capable tier — on the agent, not the command.** This
15
15
  > command declares no `cost:` and no `model:` of its own; it runs on whatever model this session is
16
16
  > already using, and Tasks the
17
- > [`discovery-analyst`](../agents/discovery-analyst.md) agent for the judgment-heavy core of the
17
+ > [`somi-discovery-analyst`](../agents/somi-discovery-analyst.md) agent for the judgment-heavy core of the
18
18
  > work (framing the idea, deciding the document set, shaping crossroads); its output anchors the
19
- > entire project, so the analyst declares `cost: high` with no lower member. This command still
19
+ > entire project, so the analyst defaults to `high` with no lower member. This command still
20
20
  > does real work of its own — scaffolding the `.somi/rd/<slug>/` set and owning the crossroads
21
21
  > conversation with the user, which can't live inside a single `Task` call because a Tasked run
22
22
  > can't pause to converse — but that work has no `cost:` of its own to declare. See
@@ -46,7 +46,7 @@ a product.
46
46
  ### 1a. Pressure-test the idea (and allow a no-go)
47
47
 
48
48
  Before scaffolding, instruct the analyst to hold the idea against four questions (see
49
- [`agents/discovery-analyst.md`](../agents/discovery-analyst.md) step 1a): is the problem real and
49
+ [`agents/somi-discovery-analyst.md`](../agents/somi-discovery-analyst.md) step 1a): is the problem real and
50
50
  unmet, is the space already won, is there a structural fatal pitfall, and does the framing hide a
51
51
  false premise / XY problem? Keep these live through the research. The honest outcome may be **go**,
52
52
  **pivot** (a stronger adjacent cut — put it to the user first), or **no-go** (produce a short cited
@@ -91,10 +91,9 @@ Create `.somi/rd/<slug>/` with the document set and supporting files from the te
91
91
  If `.somi/README.md` does not yet exist at the repo root, also write it from
92
92
  [`templates/SOMI-README.md.tmpl`](../templates/SOMI-README.md.tmpl).
93
93
 
94
- ### 4. Invoke the `discovery-analyst` agent
94
+ ### 4. Invoke the `somi-discovery-analyst` agent
95
95
 
96
- Before this `Task`, call `somi_resolve` for `discovery-analyst` (with `project_dir`), pass its
97
- model, and put `dispatched at cost: <tier>` in the briefing; full rules: the `somi-dispatch` skill
96
+ Before this `Task`, call `somi_resolve` for `somi-discovery-analyst` (with `project_dir`), pass its `model`, start it as its `agent_type`, and put the cost line in the briefing (`dispatched at cost: <tier>` only when `enforced` is true, else `requested cost: <tier> (not enforced: no mapped model)`); full rules: the `somi-dispatch` skill
98
97
  (`somi_skill`, or `somi:somi-dispatch` on Claude Code). Brief the agent via the
99
98
  Task tool with:
100
99
  - The full idea (kept inside the `user-software-idea` fence).
@@ -102,7 +101,7 @@ Task tool with:
102
101
  - A reminder to follow the **research methodology** and the **verification protocol** (§5).
103
102
  - Any context from the current conversation or repo.
104
103
 
105
- The analyst ([`agents/discovery-analyst.md`](../agents/discovery-analyst.md)) does the heavy lifting:
104
+ The analyst ([`agents/somi-discovery-analyst.md`](../agents/somi-discovery-analyst.md)) does the heavy lifting:
106
105
  researches the competition and common complaints, synthesizes findings, decides the document set,
107
106
  then authors the requirements (BRD → SRS → FRD) and high-level design (SDD → TDD) with full
108
107
  traceability — pausing on each crossroads for verification.
@@ -121,7 +120,7 @@ subagent cannot pause to converse with the user, so run the **shared batch round
121
120
  pivot** verdict (which rides the block as the first decision). Nothing is recorded yet.
122
121
  2. **You present each decision to the user faithfully** — options, pros/cons, recommendation, the
123
122
  escape hatches; the analyst's pre-supplied narrowing questions power Discover mode.
124
- 3. This re-invocation resolves fresh too — call `somi_resolve` for `discovery-analyst` again before
123
+ 3. This re-invocation resolves fresh too — call `somi_resolve` for `somi-discovery-analyst` again before
125
124
  it, same as the first Task (full rules: the `somi-dispatch` skill). Re-invoke the analyst with a
126
125
  **`VERIFIED-DECISIONS` block appended** to the same briefing; it
127
126
  then authors the document set and records `decisions.md` entries with
@@ -153,11 +152,11 @@ After the documents are written:
153
152
  every document. Its **"What execution does NOT need to re-research"** section is the load-bearing
154
153
  part. Keep it bounded and reference-not-inline (it links the deep docs, doesn't restate them).
155
154
 
156
- ### 7a. Optional high-cost review loop (review the foundation at `cost: high`)
155
+ ### 7a. Optional high-cost review loop (review the foundation at `high`)
157
156
 
158
157
  For a high-stakes initiative, run a bounded **discover → review → revise** loop before handing off —
159
158
  the high-cost counterpart to [`/plan-loop`](./plan-loop.md) / [`/code-loop`](./code-loop.md). Task
160
- [`/review`](./review.md) as `design <slug>` (and the [`architecture-reviewer`](../agents/architecture-reviewer.md)
159
+ [`/review`](./review.md) as `design <slug>` (and the [`somi-architecture-reviewer`](../agents/somi-architecture-reviewer.md)
161
160
  — resolve it via `somi_resolve` first, full rules: the `somi-dispatch` skill — where the SDD
162
161
  warrants) on a **fresh context** — give it the artifacts only (`brief.md`, `srs.md`,
163
162
  `sdd.md`, …), **not** the discovery conversation, so the review is unbiased. Revise on Blocker/Major
@@ -176,7 +175,7 @@ Return to the user with:
176
175
  `srs.md`, `sdd.md`).
177
176
  - A specific next step: "Review / edit `.somi/rd/<slug>/` directly, then run `/plan <slug>` — the
178
177
  planner consumes `brief.md` (the design→execution handoff) as its primary input, treating the
179
- SRS/FRD as the requirements source and the SDD/TDD as architectural direction, at `cost: medium`."
178
+ SRS/FRD as the requirements source and the SDD/TDD as architectural direction, at `medium`."
180
179
 
181
180
  ## Guardrails
182
181
 
@@ -202,4 +201,4 @@ The discovery is acceptable when:
202
201
  - Every direction-shaping decision in `decisions.md` is user-verified.
203
202
  - `README.md`'s traceability map connects requirements to their origins and design elements.
204
203
 
205
- See [`agents/discovery-analyst.md`](../agents/discovery-analyst.md) for the full quality bar.
204
+ See [`agents/somi-discovery-analyst.md`](../agents/somi-discovery-analyst.md) for the full quality bar.
@@ -18,9 +18,8 @@ $ARGUMENTS
18
18
 
19
19
  ## What to do
20
20
 
21
- 1. **Brief the `impact` agent** ([`agents/impact.md`](../agents/impact.md)) — before this `Task`,
22
- call `somi_resolve` for `impact` (with `project_dir`), pass its model, and put `dispatched at
23
- cost: <tier>` in the briefing; full rules: the `somi-dispatch` skill (`somi_skill`, or
21
+ 1. **Brief the `somi-impact` agent** ([`agents/somi-impact.md`](../agents/somi-impact.md)) — before this `Task`,
22
+ call `somi_resolve` for `somi-impact` (with `project_dir`), pass its `model`, start it as its `agent_type`, and put the cost line in the briefing (`dispatched at cost: <tier>` only when `enforced` is true, else `requested cost: <tier> (not enforced: no mapped model)`); full rules: the `somi-dispatch` skill (`somi_skill`, or
24
23
  `somi:somi-dispatch` on Claude Code) — with the target above (a proposed
25
24
  change, a file/symbol, or a diff range/PR).
26
25
  2. **Relay its report** in-chat: blast radius in one sentence, the callers/contracts/tests table,
@@ -26,13 +26,12 @@ recently (deploy? config? dependency? traffic?). Derive a slug (`incident-<date>
26
26
  scaffold **only** `.somi/plans/<slug>/diary.md` + `progress.md` (status `in-progress`), first
27
27
  diary entry = the fenced report + the timeline as known. No spec, no phases, no rca yet.
28
28
 
29
- ### 2. Brief the `incident` agent
29
+ ### 2. Brief the `somi-incident` agent
30
30
 
31
- Before this `Task`, call `somi_resolve` for `incident` (with `project_dir`), pass its model, and put
32
- `dispatched at cost: <tier>` in the briefing; full rules: the `somi-dispatch` skill (`somi_skill`,
31
+ Before this `Task`, call `somi_resolve` for `somi-incident` (with `project_dir`), pass its `model`, start it as its `agent_type`, and put the cost line in the briefing (`dispatched at cost: <tier>` only when `enforced` is true, else `requested cost: <tier> (not enforced: no mapped model)`); full rules: the `somi-dispatch` skill (`somi_skill`,
33
32
  or `somi:somi-dispatch` on Claude Code). Via the Task tool, pass
34
33
  the slug and the frame from step 1. The agent
35
- ([`agents/incident.md`](../agents/incident.md)) mitigates, verifies against the live symptom, and
34
+ ([`agents/somi-incident.md`](../agents/somi-incident.md)) mitigates, verifies against the live symptom, and
36
35
  runs mandatory debt capture (postmortem note, seeded follow-up, guardrail retro) — writing
37
36
  `diary.md` / `progress.md` itself as it goes.
38
37
 
@@ -17,13 +17,14 @@ $ARGUMENTS
17
17
 
18
18
  This command automates the manual `/plan` → `/review plan <slug>` → `/plan` cycle, with **hard
19
19
  gates** that ensure it terminates. It has no `cost:` of its own — nor a `model:` of its own; it runs
20
- on whatever model this session is already using — and runs entirely inline; the `planner` it Tasks
21
- declares `cost: low,
22
- medium` (`medium` unless the session ceiling resolves to `low`; executing against an upstream
23
- `brief.md` when one exists), while the `reviewer` it Tasks declares
24
- `cost: medium, high` — the session ceiling picks the highest permitted member, typically `high`
25
- for the fresh-eyes judgment this loop wants, run on a cold context so it isn't biased by the
26
- planner's reasoning.
20
+ on whatever model this session is already using — and runs entirely inline; the `somi-planner` it Tasks
21
+ defaults to
22
+ `medium` (it runs at the session ceiling; executing against an upstream
23
+ `brief.md` when one exists), while the `somi-reviewer` it Tasks defaults
24
+ to `high` — it runs at the session ceiling unless `cost.agents` pins it (pin `somi-reviewer`
25
+ to `high` for the fresh-eyes judgment this loop wants, run on a cold context so it isn't biased by
26
+ the
27
+ planner's reasoning).
27
28
 
28
29
  > **Cache-prefix discipline.** Keep the stable inputs — `rules/CLAUDE.md`, the work-item `brief.md`,
29
30
  > and `spec.md §1` — in the **same order at the front** of each pass's planner brief, and append the
@@ -96,18 +97,20 @@ Pass counting and finding recurrence are owned by the shipped scripts
96
97
  while true:
97
98
  # 3a. Pass gate (deterministic)
98
99
  node scripts/somi-loop.mjs pass --slug <slug>
100
+ exit 4 → STOP — the /ship-loop run's time budget is spent: same summary, exit "time-budget"
99
101
  exit 2 → STOP — summarise current best plan + remaining findings (by F-id),
100
102
  exit "max-passes-exceeded"
101
103
 
102
104
  # 3b. Plan (the batch verification round-trip pauses here for the user when the
103
105
  # planner returns DECISIONS-NEEDED — that pause never counts as a pass, and the
104
106
  # re-invocation after it resolves fresh too, same as any other start). Call somi_resolve
105
- # for planner first; full rules: the somi-dispatch skill (somi_skill, or somi:somi-dispatch
106
- # on Claude Code).
107
- Task planner (= /plan <problem> or /plan revision <slug> with prior findings as brief)
107
+ # for somi-planner first; full rules: the somi-dispatch skill (somi_skill, or somi:somi-dispatch
108
+ # on Claude Code). Record every start:
109
+ # node scripts/somi-loop.mjs record-dispatch --slug <slug> --agent <agent> [--host <host>]
110
+ Task somi-planner (= /plan <problem> or /plan revision <slug> with prior findings as brief)
108
111
 
109
- # 3c. Plan review — call somi_resolve for reviewer first; full rules: the somi-dispatch skill
110
- Task reviewer (= /review plan <slug>)
112
+ # 3c. Plan review — call somi_resolve for somi-reviewer first; full rules: the somi-dispatch skill
113
+ Task somi-reviewer (= /review plan <slug>)
111
114
 
112
115
  # 3d. Record the pass + findings (locus file for a plan finding is the artifact —
113
116
  # e.g. spec.md / decisions.md / phases/02-…md — symbol is the section)
@@ -159,6 +162,7 @@ while true:
159
162
 
160
163
  - Loop status: `done` | `max-passes-exceeded` | `divergence` | `user-stop`.
161
164
  - Passes used (out of `MAX_PASSES`).
165
+ - What ran: `finish`'s `dispatches` (agent, tier, model, enforced); name every `enforced: false` start.
162
166
  - Final verdict + count by severity.
163
167
  - Top 3 open findings (if any).
164
168
  - Pointer to the plan files (`.somi/plans/<slug>/`) and review files