@skathio/somi 2.2.2 → 3.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.
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +8 -2
- package/.copilot-extension/extension.json +9 -8
- package/.copilot-extension/marketplace.json +2 -2
- package/README.md +45 -33
- package/VERSION +1 -1
- package/agents/architecture-reviewer.md +16 -0
- package/agents/atlas.md +102 -0
- package/agents/coder.md +66 -22
- package/agents/designer.md +20 -16
- package/agents/discovery-analyst.md +6 -5
- package/agents/impact.md +97 -0
- package/agents/incident.md +96 -0
- package/agents/plan-reviewer.md +70 -0
- package/agents/planner.md +77 -20
- package/agents/pr.md +101 -0
- package/agents/refactor-designer.md +82 -0
- package/agents/refactorer.md +30 -24
- package/agents/reviewer.md +28 -25
- package/agents/sdlc-reviewer.md +69 -0
- package/agents/security-reviewer.md +17 -0
- package/agents/somi.md +204 -153
- package/agents/test-strategist.md +16 -1
- package/commands/adopt.md +21 -7
- package/commands/architecture-review.md +8 -5
- package/commands/atlas.md +24 -72
- package/commands/code-loop.md +46 -15
- package/commands/code-parallel.md +6 -4
- package/commands/code.md +29 -21
- package/commands/debug.md +17 -11
- package/commands/design.md +48 -31
- package/commands/discover.md +26 -16
- package/commands/impact.md +16 -54
- package/commands/incident.md +22 -55
- package/commands/plan-loop.md +43 -17
- package/commands/plan.md +64 -26
- package/commands/pr.md +19 -66
- package/commands/refactor-design.md +98 -0
- package/commands/refactor.md +22 -23
- package/commands/release-readiness.md +16 -7
- package/commands/review-panel.md +31 -10
- package/commands/review.md +21 -14
- package/commands/security-review.md +12 -3
- package/commands/ship-loop.md +71 -54
- package/commands/ship.md +17 -13
- package/commands/test-strategy.md +6 -4
- package/commands/upgrade.md +10 -8
- package/examples/discovery-example.md +2 -2
- package/examples/sample-consumer/CLAUDE.md +41 -7
- package/examples/sample-consumer/README.md +36 -22
- package/hooks/lib/common.mjs +66 -20
- package/hooks/post-tool/audit-log.mjs +7 -11
- package/hooks/post-tool/lint-changed-files.mjs +8 -11
- package/hooks/pre-tool/block-dangerous-bash.mjs +32 -44
- package/hooks/pre-tool/block-secret-writes.mjs +6 -9
- package/hooks/pre-tool/gate-dep-install.mjs +18 -27
- package/hooks/pre-tool/guard-protected-paths.mjs +9 -11
- package/hooks/session-start/detect-repo-instructions.mjs +21 -23
- package/hooks/user-prompt-submit/inject-workflow-context.mjs +190 -42
- package/mcp.json +10 -0
- package/package.json +5 -2
- package/rules/CLAUDE.md +22 -19
- package/scripts/check-links.mjs +218 -0
- package/scripts/check-session-artefacts.mjs +149 -0
- package/scripts/check-size-budget.mjs +137 -0
- package/scripts/generate-digest.mjs +176 -0
- package/scripts/lib/cost-ceiling.mjs +317 -0
- package/scripts/lib/cost-model.mjs +95 -0
- package/scripts/lib/dispatch-resolver.mjs +224 -0
- package/scripts/lib/mcp-project-root.mjs +183 -0
- package/scripts/size-budget-overrides.json +74 -0
- package/scripts/somi-check.mjs +6 -13
- package/scripts/somi-dispatch.mjs +141 -0
- package/scripts/somi-findings.mjs +4 -5
- package/scripts/somi-loop.mjs +181 -13
- package/scripts/somi-mcp.mjs +357 -0
- package/scripts/validate.sh +690 -29
- package/skills/clean-code/SKILL.md +1 -1
- package/skills/plan-review/SKILL.md +79 -0
- package/skills/rules/SKILL.md +47 -0
- package/skills/sdlc-process/SKILL.md +74 -0
- package/skills/somi-dispatch/SKILL.md +220 -0
- package/skills/somi-routing/SKILL.md +31 -6
- package/skills/{test-strategy → testing-playbook}/SKILL.md +1 -1
- package/templates/ATLAS.md.tmpl +4 -4
- package/templates/BRIEF.md.tmpl +23 -22
- package/templates/DECISIONS.md.tmpl +1 -0
- package/templates/DESIGN.md.tmpl +5 -5
- package/templates/DIARY.md.tmpl +10 -5
- package/templates/DOD.md.tmpl +24 -0
- package/templates/PROGRESS.md.tmpl +3 -16
- package/templates/SOMI-README.md.tmpl +3 -3
- package/tests/hooks/cases/inject-workflow-context.json +120 -7
- package/tests/hooks/run.sh +20 -11
- package/tests/scripts/check-links.sh +105 -0
- package/tests/scripts/check-session-artefacts.sh +60 -0
- package/tests/scripts/check-size-budget.sh +71 -0
- package/tests/scripts/checkpoint-gate.sh +90 -0
- package/tests/scripts/convergence-runner.sh +1510 -0
- package/tests/scripts/cost-ceiling.sh +343 -0
- package/tests/scripts/cost-model.sh +192 -0
- package/tests/scripts/dispatch-guard.sh +108 -0
- package/tests/scripts/dispatch-reference-gate.sh +173 -0
- package/tests/scripts/eval-runner.sh +3691 -0
- package/tests/scripts/evals-packaging.sh +117 -0
- package/tests/scripts/fixtures/legacy-shard-no-schema.json +50 -0
- package/tests/scripts/generate-digest.sh +180 -0
- package/tests/scripts/goldens/loop-state-breach.json +1 -0
- package/tests/scripts/goldens/loop-state-done.json +1 -0
- package/tests/scripts/goldens/somi-loop.json +1 -1
- package/tests/scripts/lib/adr-shape.mjs +41 -0
- package/tests/scripts/lib/checkpoint-gate.mjs +54 -0
- package/tests/scripts/lib/digest-marker-coupling.mjs +52 -0
- package/tests/scripts/lib/dispatch-reference-gate.mjs +112 -0
- package/tests/scripts/lib/multipass-dependence.mjs +192 -0
- package/tests/scripts/lib/multipass-source-identity.mjs +243 -0
- package/tests/scripts/lib/reference-pair.mjs +61 -0
- package/tests/scripts/lib/retirement-gate.mjs +167 -0
- package/tests/scripts/lib/shell-embedded-js.mjs +47 -0
- package/tests/scripts/lib/somi-mcp-client.mjs +102 -0
- package/tests/scripts/lib/somi-mcp-tests.mjs +401 -0
- package/tests/scripts/lib/somi-mcp-tool-schema.mjs +38 -0
- package/tests/scripts/retirement-gate.sh +287 -0
- package/tests/scripts/review-panel-seats.sh +32 -0
- package/tests/scripts/run.sh +184 -2
- package/tests/scripts/somi-agent-dispatch-contract.sh +195 -0
- package/tests/scripts/somi-dispatch.sh +354 -0
- package/tests/scripts/somi-mcp.sh +12 -0
package/commands/pr.md
CHANGED
|
@@ -1,82 +1,35 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: Compose a PR title + description from a work item's artifacts (spec/rca, verified decisions, progress, review verdicts, open findings, diary highlights) and optionally open it via gh. The exit ramp from .somi/ artifacts into the team's PR workflow.
|
|
3
3
|
argument-hint: <slug> [--draft]
|
|
4
|
-
allowed-tools: Read,
|
|
5
|
-
model: sonnet
|
|
4
|
+
allowed-tools: Task, Read, Bash, Write, Edit
|
|
6
5
|
---
|
|
7
6
|
|
|
8
7
|
# /pr — Work item → pull request handoff
|
|
9
8
|
|
|
10
|
-
You are
|
|
11
|
-
|
|
12
|
-
team actually reviews, instead of leaving the author to retype it.
|
|
9
|
+
You are running the **PR handoff** workflow of somi: turning a work item's `.somi/` artifact set
|
|
10
|
+
into the PR description the team actually reviews, instead of leaving the author to retype it.
|
|
13
11
|
|
|
14
12
|
Target work item: **$ARGUMENTS** (a slug under `.somi/plans/`; empty = the single work item with
|
|
15
13
|
`status: in-progress` or `done`-but-unmerged, else ask).
|
|
16
14
|
|
|
17
15
|
## What to do
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
### 2. Compose
|
|
33
|
-
|
|
34
|
-
```markdown
|
|
35
|
-
## What & why
|
|
36
|
-
<2–4 sentences from spec §1 / rca.md — the problem and the outcome, not a file list.>
|
|
37
|
-
|
|
38
|
-
## How
|
|
39
|
-
<The approach in one short paragraph + the verified decisions as bullets:
|
|
40
|
-
- D2 — Redis-backed counters (multi-replica budget) — .somi/plans/<slug>/decisions.md>
|
|
41
|
-
|
|
42
|
-
## What changed along the way
|
|
43
|
-
<Only if plan-change diary entries exist — one line each. Omit the section otherwise.>
|
|
44
|
-
|
|
45
|
-
## Testing
|
|
46
|
-
<Tests added/changed and what they prove; for /debug items, name the regression test.>
|
|
47
|
-
|
|
48
|
-
## Review status
|
|
49
|
-
<Latest SoMi verdict(s); open findings by id with their agreed disposition
|
|
50
|
-
("F-4 accepted as follow-up — see progress.md"). Never hide an open Major.>
|
|
51
|
-
|
|
52
|
-
## Follow-ups
|
|
53
|
-
<From progress.md, one line each. Omit if none.>
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
Title: `<type>: <spec §1 in imperative, ≤ 70 chars>` following the repo's commit/PR conventions
|
|
57
|
-
(read a few merged PRs / `git log` for house style; repo conventions win over this template).
|
|
58
|
-
|
|
59
|
-
Keep it honest and short — the PR description is the artifact set *distilled*, not duplicated.
|
|
60
|
-
Link `.somi/plans/<slug>/` once for readers who want the full record. Do **not** paste user
|
|
61
|
-
problem statements out of their fences; reference `context.md` instead.
|
|
62
|
-
|
|
63
|
-
### 3. Confirm, then optionally open
|
|
64
|
-
|
|
65
|
-
Show the composed title + body to the user. **Opening a PR is outward-facing — only run
|
|
66
|
-
`gh pr create` after the user confirms** (use `--draft` if they asked for a draft, and their
|
|
67
|
-
base branch if named). No `gh` available or user declines → hand them the composed markdown to
|
|
68
|
-
paste. Never push branches or create the PR unprompted.
|
|
69
|
-
|
|
70
|
-
### 4. After opening (if opened)
|
|
71
|
-
|
|
72
|
-
- Append a `diary.md` entry (category `note`): `PR opened: <url>`.
|
|
73
|
-
- Add a `progress.md` "Recent activity" line with the PR URL.
|
|
17
|
+
1. **Brief the `pr` agent** ([`agents/pr.md`](../agents/pr.md)) — before this `Task`, call
|
|
18
|
+
`somi_resolve` for `pr` (with `project_dir`), pass its model, and put `dispatched at cost:
|
|
19
|
+
<tier>` in the briefing; full rules: the `somi-dispatch` skill (`somi_skill`, or
|
|
20
|
+
`somi:somi-dispatch` on Claude Code) — with the resolved slug. It gathers
|
|
21
|
+
the artifacts itself and returns a composed title + body — it never writes or publishes
|
|
22
|
+
anything; this command owns every write, including `gh pr create`.
|
|
23
|
+
2. **Show the composed title + body to the user.** Opening a PR is outward-facing — only run
|
|
24
|
+
`gh pr create` after the user confirms (use `--draft` if they asked for a draft, and their
|
|
25
|
+
base branch if named). No `gh` available or the user declines → hand them the composed
|
|
26
|
+
markdown to paste. Never push branches or create the PR unprompted.
|
|
27
|
+
3. **After opening (if opened)**:
|
|
28
|
+
- Append a `diary.md` entry (category `note`): `PR opened: <url>`.
|
|
74
29
|
|
|
75
30
|
## Guardrails
|
|
76
31
|
|
|
77
|
-
- **Confirmation before `gh pr create` — always.** Publishing is not reversible
|
|
78
|
-
|
|
79
|
-
- **Report reality.** If
|
|
80
|
-
|
|
81
|
-
- **House style wins.** If the repo has a PR template (`.github/PULL_REQUEST_TEMPLATE.md`), fill
|
|
82
|
-
*that*, mapping the sections above into it rather than fighting it.
|
|
32
|
+
- **Confirmation before `gh pr create` — always.** Publishing is not reversible the way a local
|
|
33
|
+
edit is.
|
|
34
|
+
- **Report reality.** If the agent's composed description shows red tests, open findings, or
|
|
35
|
+
incomplete iterations, don't soften it before showing the user.
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Scope design for a refactor too big for one diff, done as a `cost: high` pass: names the destination shape, maps seams and risks across modules, confirms test-coverage gaps, and compiles a brief.md that /plan-loop → /code-loop execute. Split from /refactor because mode selection and tier selection are different decisions."
|
|
3
|
+
argument-hint: <refactor target too large for one safe diff>
|
|
4
|
+
allowed-tools: Task, Read, Edit, Write, Bash, Grep, Glob
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# /refactor-design — Large-refactor scope design
|
|
8
|
+
|
|
9
|
+
You are running the **refactor-designer** workflow of somi — the front-loaded, expensive-reasoning
|
|
10
|
+
step for a refactor too big for one safe diff: it spans many modules, needs a migration, or changes
|
|
11
|
+
a shared shape. Rather than editing, this command **designs the refactor scope** and compiles it
|
|
12
|
+
into a [`brief.md`](../templates/BRIEF.md.tmpl) that the cheaper tier executes via
|
|
13
|
+
[`/plan-loop`](./plan-loop.md) → [`/code-loop`](./code-loop.md).
|
|
14
|
+
|
|
15
|
+
> **The judgment-heavy core runs at the most capable tier — on the agent, not the command**, like
|
|
16
|
+
> [`/design`](./design.md). This command declares no `cost:` and no `model:` of its own; it runs on
|
|
17
|
+
> whatever model this session is already using, and Tasks the
|
|
18
|
+
> [`refactor-designer`](../agents/refactor-designer.md) agent for the judgment-heavy core of the
|
|
19
|
+
> work (naming the destination shape, mapping seams and risks, confirming test-coverage gaps); its
|
|
20
|
+
> `brief.md` anchors the whole refactor, so the agent declares `cost: high` with no lower member.
|
|
21
|
+
> This command still does real work of its own — scaffolding the artifact set and owning the
|
|
22
|
+
> crossroads conversation with the user, which can't live inside a single `Task` call because a
|
|
23
|
+
> Tasked run can't pause to converse — but that work has no `cost:` of its own to declare. Split
|
|
24
|
+
> out from [`/refactor`](./refactor.md) because mode
|
|
25
|
+
> selection (surgical vs. scope design) and tier selection (`medium` vs. `high`) are two different
|
|
26
|
+
> decisions — one unit naming both let a declared tier become a claim its own procedure could
|
|
27
|
+
> contradict (a large refactor under a `medium` ceiling would have entered scope-design work at a
|
|
28
|
+
> tier its own text called insufficient). [`/refactor`](./refactor.md) stays the default for a
|
|
29
|
+
> small, named smell that fits one safe diff; use this command when the destination needs more
|
|
30
|
+
> than one reviewable diff.
|
|
31
|
+
|
|
32
|
+
The user's refactor target: **$ARGUMENTS**
|
|
33
|
+
|
|
34
|
+
## What to do
|
|
35
|
+
|
|
36
|
+
### 1. Validate scope
|
|
37
|
+
|
|
38
|
+
If the target is genuinely small enough for one safe diff, say so and recommend
|
|
39
|
+
[`/refactor`](./refactor.md) instead — don't manufacture a design pass for a surgical change.
|
|
40
|
+
|
|
41
|
+
### 2. Pick the slug and scaffold
|
|
42
|
+
|
|
43
|
+
Derive a short, plain-language kebab-case slug (e.g., `untangle-order-service`); confirm with the
|
|
44
|
+
user. Create `.somi/plans/<slug>/` with the same artifact set [`/design`](./design.md) uses, from
|
|
45
|
+
[`templates/`](../templates/): `design.md` (destination shape + seam/risk map), `decisions.md`
|
|
46
|
+
(ADR-style, user-verified), `brief.md` (the load-bearing design→execution handoff), `diary.md`.
|
|
47
|
+
`context.md`, `spec.md`, `phases/`, and `progress.md` are **the planner's** to create when
|
|
48
|
+
[`/plan`](./plan.md) runs. If `.somi/README.md` does not yet exist at the repo root, also write it
|
|
49
|
+
from [`templates/SOMI-README.md.tmpl`](../templates/SOMI-README.md.tmpl), same as `/design`.
|
|
50
|
+
|
|
51
|
+
### 3. Invoke the `refactor-designer` agent
|
|
52
|
+
|
|
53
|
+
Before this `Task`, call `somi_resolve` for `refactor-designer` (with `project_dir`), pass its
|
|
54
|
+
model, and put `dispatched at cost: <tier>` in the briefing; full rules: the `somi-dispatch` skill
|
|
55
|
+
(`somi_skill`, or `somi:somi-dispatch` on Claude Code). Brief
|
|
56
|
+
[`agents/refactor-designer.md`](../agents/refactor-designer.md) via the Task tool with: the
|
|
57
|
+
refactor target, the slug and paths, and a reminder to name the destination shape, map the seams
|
|
58
|
+
and risks (`file:line`), confirm or raise test-coverage gaps, and compile the brief.
|
|
59
|
+
|
|
60
|
+
### 4. Repo-awareness (respect as context)
|
|
61
|
+
|
|
62
|
+
Same as [`/design`](./design.md) §5: read the repo's own instruction files once, distil into the
|
|
63
|
+
brief's **"Repo conventions in force"** section, never auto-invoke the repo's own agents.
|
|
64
|
+
|
|
65
|
+
### 5. Verification protocol (the batch round-trip)
|
|
66
|
+
|
|
67
|
+
Surface the destination shape and migration approach to the user before handing off — the shared
|
|
68
|
+
batch round-trip ([`commands/plan.md`](./plan.md) §5): the research pass returns a
|
|
69
|
+
`DECISIONS-NEEDED` block, this command presents it, and re-invokes the agent with a
|
|
70
|
+
`VERIFIED-DECISIONS` block appended before it records `decisions.md` and compiles the brief. That
|
|
71
|
+
re-invocation resolves fresh too — call `somi_resolve` for `refactor-designer` again before it, the
|
|
72
|
+
same as the first Task (full rules: the `somi-dispatch` skill).
|
|
73
|
+
|
|
74
|
+
### 6. The brief is the deliverable
|
|
75
|
+
|
|
76
|
+
Same bar as `/design`'s: dense, bounded per [`templates/BRIEF.md.tmpl`](../templates/BRIEF.md.tmpl),
|
|
77
|
+
reference-not-inline, with a concrete "What execution does NOT need to re-research" section. For a
|
|
78
|
+
high-stakes refactor, review
|
|
79
|
+
it at `cost: high` via [`/review`](./review.md) `design <slug>` (fresh context, bounded) first.
|
|
80
|
+
|
|
81
|
+
### 7. Summarise back
|
|
82
|
+
|
|
83
|
+
- One-paragraph framing of the destination shape.
|
|
84
|
+
- The seam/risk map (`file:line`) and any test-coverage gaps confirmed or raised.
|
|
85
|
+
- A pointer to `.somi/plans/<slug>/brief.md`.
|
|
86
|
+
- Next step: "Review `brief.md`, then run `/plan <slug>` (`cost: medium`)."
|
|
87
|
+
|
|
88
|
+
## Guardrails
|
|
89
|
+
|
|
90
|
+
- **Do not edit code.** This command designs scope only; execution runs via `/plan-loop` → `/code-loop`.
|
|
91
|
+
- **No behavior changes designed in.** If the destination requires one, that's a feature, not a refactor — stop and say so.
|
|
92
|
+
- **Do not skip verification** for the destination shape and the migration approach.
|
|
93
|
+
- **No artifact outside `.somi/plans/<slug>/`.**
|
|
94
|
+
|
|
95
|
+
## Quality bar
|
|
96
|
+
|
|
97
|
+
See [`agents/refactor-designer.md`](../agents/refactor-designer.md). The brief alone must let a
|
|
98
|
+
planner sequence the work and a coder execute it without re-deriving the seam/risk map.
|
package/commands/refactor.md
CHANGED
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Refactor a named smell. Surgical
|
|
2
|
+
description: Refactor a named smell. Surgical, behavior-preserving execution against a smell that fits one safe diff — tests stay green, no feature work. For a refactor too big for one diff, use /refactor-design instead.
|
|
3
3
|
argument-hint: <smell description and target files>
|
|
4
4
|
allowed-tools: Task, Read, Edit, Write, Bash, Grep, Glob
|
|
5
|
-
model: sonnet
|
|
6
5
|
---
|
|
7
6
|
|
|
8
|
-
# /refactor —
|
|
7
|
+
# /refactor — Surgical refactor
|
|
9
8
|
|
|
10
|
-
You are invoking the **refactorer** workflow of somi.
|
|
9
|
+
You are invoking the **refactorer** workflow of somi. This command has no `cost:` of its own — nor
|
|
10
|
+
a `model:` of its own; it runs on whatever model this session is already using — and Tasks the
|
|
11
|
+
[`refactorer`](../agents/refactorer.md) agent, which declares `cost: low, medium` for this mode
|
|
12
|
+
(`medium` unless the session ceiling resolves to `low`).
|
|
11
13
|
|
|
12
14
|
The user's refactor target: **$ARGUMENTS**
|
|
13
15
|
|
|
14
|
-
##
|
|
16
|
+
## Precondition — this command is surgical only
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
this when the destination needs more than a single reviewable diff; surface the scope to the user
|
|
24
|
-
before handing off. For a high-stakes refactor, review the brief in MAX scope first via
|
|
25
|
-
[`/review`](./review.md) `design <slug>` (fresh context, bounded).
|
|
18
|
+
This command performs a **small, named smell** that fits one safe, behavior-preserving diff. If the
|
|
19
|
+
refactor spans many modules, needs a migration, or changes a shared shape — too big for one safe
|
|
20
|
+
diff (a 600-line refactor is a *plan*, not a diff) — stop and recommend
|
|
21
|
+
[`/refactor-design`](./refactor-design.md) instead: it designs the refactor scope and compiles a
|
|
22
|
+
`brief.md` that [`/plan-loop`](./plan-loop.md) → [`/code-loop`](./code-loop.md) then execute. Mode
|
|
23
|
+
selection and tier selection are separate decisions, which is why this is its own command rather
|
|
24
|
+
than a mode flag; see [`agents/refactorer.md`](../agents/refactorer.md)'s `> **Cost:**` callout.
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
## What to do (surgical path)
|
|
26
|
+
## What to do
|
|
30
27
|
|
|
31
28
|
1. **Verify the precondition**: the refactor target is a *named smell* (e.g., "`OrderService` mixes pricing
|
|
32
29
|
and persistence") with specific files in scope. If `$ARGUMENTS` is vague ("clean up the codebase"),
|
|
@@ -34,8 +31,11 @@ The steps below are the **surgical** path.
|
|
|
34
31
|
2. **Verify test coverage exists** for the behavior to be preserved. If it doesn't, the first step is to
|
|
35
32
|
add characterization tests — surface this to the user and ask whether to proceed or hand off to
|
|
36
33
|
`test-strategist` first.
|
|
37
|
-
3. **Brief the `refactorer` agent** ([`agents/refactorer.md`](../agents/refactorer.md))
|
|
38
|
-
|
|
34
|
+
3. **Brief the `refactorer` agent** ([`agents/refactorer.md`](../agents/refactorer.md)) — before
|
|
35
|
+
this `Task`, call `somi_resolve` for `refactorer` (with `project_dir`), pass its model, and put
|
|
36
|
+
`dispatched at cost: <tier>` in the briefing; full rules: the `somi-dispatch` skill
|
|
37
|
+
(`somi_skill`, or `somi:somi-dispatch` on Claude Code) — with the smell, the target
|
|
38
|
+
files, and the destination shape.
|
|
39
39
|
4. **The agent performs small, named refactor steps** with tests green between each.
|
|
40
40
|
5. **Verify** by running the tests yourself.
|
|
41
41
|
6. **Summarize back** with:
|
|
@@ -49,9 +49,8 @@ The steps below are the **surgical** path.
|
|
|
49
49
|
|
|
50
50
|
- **No behavior changes.** No bug fixes mixed in. If a bug is discovered, file it as follow-up.
|
|
51
51
|
- **No feature work.** This is structure-only.
|
|
52
|
-
- **No big-bang rewrites
|
|
53
|
-
|
|
54
|
-
`/plan-loop` → `/code-loop` execute it as bounded, reviewable iterations.
|
|
52
|
+
- **No big-bang rewrites.** Same threshold as the precondition above — if it's crossed mid-refactor,
|
|
53
|
+
stop and hand off to [`/refactor-design`](./refactor-design.md) instead of pushing through.
|
|
55
54
|
- **Tests stay green** at every step. Not "green at the end" — green at every commit.
|
|
56
55
|
|
|
57
56
|
## Quality bar
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Pre-release gate. Deterministic aggregation over the artifacts (work items done? open Blockers/Majors in the findings ledgers? DoD satisfied? rollout/rollback real?) plus ONE
|
|
2
|
+
description: Pre-release gate. Deterministic aggregation over the artifacts (work items done? open Blockers/Majors in the findings ledgers? DoD satisfied? rollout/rollback real?) plus ONE high-cost review of the integration surface. Produces a release verdict + draft release notes.
|
|
3
3
|
argument-hint: <slug…> | <milestone/tag description> (empty = all non-done work items in scope)
|
|
4
4
|
allowed-tools: Task, Read, Grep, Glob, Bash, Write, Edit
|
|
5
|
-
model: sonnet
|
|
6
5
|
---
|
|
7
6
|
|
|
8
7
|
# /release-readiness — The pre-release gate
|
|
@@ -12,6 +11,12 @@ Most of this is **deterministic aggregation over artifacts that already exist**
|
|
|
12
11
|
spend goes to exactly one place: a fresh-eyes review of the *integration surface*, which
|
|
13
12
|
per-iteration reviews structurally miss.
|
|
14
13
|
|
|
14
|
+
> **No `cost:` of its own, and no `model:` either — it runs on whatever model this session is
|
|
15
|
+
> already using.** Stages 1 and 3 read and write
|
|
16
|
+
> directly, inline, at whatever tier is already running this command. Stage 2, the one expensive
|
|
17
|
+
> step, Tasks the [`reviewer`](../agents/reviewer.md) agent, which declares `cost: medium, high`
|
|
18
|
+
> on its own account and resolves against the session ceiling independently of this command.
|
|
19
|
+
|
|
15
20
|
Scope: **$ARGUMENTS** (one or more work-item slugs, or a milestone description; empty = every
|
|
16
21
|
work item in `.somi/plans/` not marked `done`+merged).
|
|
17
22
|
|
|
@@ -34,11 +39,15 @@ For each in-scope work item, check mechanically and record pass/fail + evidence:
|
|
|
34
39
|
Any hard failure here (open Blocker, red tests, unexecutable rollback) → the verdict is already
|
|
35
40
|
`not-ready`; finish the checklist anyway so the report is complete, but say it early.
|
|
36
41
|
|
|
37
|
-
## Stage 2 —
|
|
42
|
+
## Stage 2 — High-cost integration review (the one expensive step)
|
|
38
43
|
|
|
39
44
|
Per-iteration reviews saw each diff in isolation. Task the [`reviewer`](../agents/reviewer.md)
|
|
40
|
-
(`
|
|
41
|
-
the
|
|
45
|
+
(declares `cost: medium, high`; the session ceiling picks the highest permitted member — typically
|
|
46
|
+
`high`, the fresh-context depth this stage wants). Before this `Task`, call `somi_resolve` for
|
|
47
|
+
`reviewer` (with `project_dir`), pass its model, and put `dispatched at cost: <tier>` in the
|
|
48
|
+
briefing; full rules: the `somi-dispatch` skill (`somi_skill`, or `somi:somi-dispatch` on Claude
|
|
49
|
+
Code). Task it on the **cumulative release diff** (merge-base of
|
|
50
|
+
the release scope vs. the default branch) with an explicit integration framing: interactions **between** the work
|
|
42
51
|
items, contract mismatches across independently-reviewed changes, migration ordering across
|
|
43
52
|
items, config/flag interactions, and observability of the release as a whole ("when this ships
|
|
44
53
|
and something degrades, what tells us which work item did it?"). Skip only if the release is a
|
|
@@ -66,5 +75,5 @@ Summarise back: verdict first, then the two or three load-bearing facts behind i
|
|
|
66
75
|
doesn't soften it to `ready-with-conditions` without a named human owner for each condition.
|
|
67
76
|
- **Read-only against the release** — this command gates, it doesn't fix. Fixes go through
|
|
68
77
|
`/code` / `/debug` on the owning work item.
|
|
69
|
-
- **One
|
|
70
|
-
the work for free; don't Task a panel per work item — the per-iteration reviews already ran.
|
|
78
|
+
- **One high-cost pass, deliberately.** The economics of this command are the checklist doing 90%
|
|
79
|
+
of the work for free; don't Task a panel per work item — the per-iteration reviews already ran.
|
package/commands/review-panel.md
CHANGED
|
@@ -2,24 +2,38 @@
|
|
|
2
2
|
description: Parallel multi-lens review. Spawns the relevant review agents (reviewer + security / architecture / test as the diff warrants) concurrently on the same change, then merges and de-duplicates their findings into one severity-graded verdict.
|
|
3
3
|
argument-hint: <slug> [phase N, iteration M] | <diff target>
|
|
4
4
|
allowed-tools: Task, Read, Grep, Glob, Bash, Write, Edit, WebFetch
|
|
5
|
-
model: sonnet
|
|
6
5
|
---
|
|
7
6
|
|
|
8
7
|
# /review-panel — Parallel multi-lens review
|
|
9
8
|
|
|
10
|
-
You are running the **review panel** of somi: several independent
|
|
11
|
-
|
|
9
|
+
You are running the **review panel** of somi: several independent review lenses on the **same change
|
|
10
|
+
at the same time**, merged into one verdict. Each lens is read-only **by contract** — it holds
|
|
11
|
+
Write/Edit and is forbidden from using them.
|
|
12
12
|
|
|
13
13
|
The user's target: **$ARGUMENTS** (a work-item slug, optionally `phase N, iteration M`, or a diff
|
|
14
14
|
target such as a PR / commit range / working tree).
|
|
15
15
|
|
|
16
|
-
The orchestrator (this command)
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
The orchestrator (this command) has no `cost:` of its own — nor a `model:` of its own; it runs on
|
|
17
|
+
whatever model this session is already using — and runs entirely inline. Each lens it Tasks
|
|
18
|
+
resolves its model from its **own** declared set:
|
|
19
|
+
`reviewer`, `architecture-reviewer`,
|
|
20
|
+
`test-strategist`, `plan-reviewer`, and `sdlc-reviewer` declare `cost: medium, high` (the ceiling picks the highest permitted member,
|
|
21
|
+
typically `high` for the fresh-eyes depth a panel wants); `security-reviewer` declares `cost: high`
|
|
22
|
+
alone — a missed vulnerability outweighs a lighter generalist pass, so it has no lower mode (see
|
|
23
|
+
its own `> **Cost:**` callout). The lenses are read-only **by contract, not by platform
|
|
24
|
+
restriction** — they return findings; this command owns every write (the merged review file,
|
|
25
|
+
`progress.md`, `diary.md`). The session ceiling selects each lens's tier and never refuses one: a lens whose declared tiers
|
|
26
|
+
all sit above the ceiling still runs, at its cheapest declared tier.
|
|
19
27
|
|
|
20
28
|
> **Why this exists.** A single reviewer carries one set of priorities at a time; running the
|
|
21
29
|
> specialist lenses *in parallel* on one diff catches what a sequential, escalation-only pass misses
|
|
22
|
-
> — and
|
|
30
|
+
> — and parallelizing is safe because **this command is the sole writer**: every lens returns
|
|
31
|
+
> findings as text and none is given a write to perform, so there is nothing for them to contend
|
|
32
|
+
> over. **Concurrency does not weaken this**: zero writers is zero writers whether one lens runs or
|
|
33
|
+
> six, so parallelism adds no contention risk the sequential case lacks. Note it rests on the
|
|
34
|
+
> lenses honouring their contract — each carries a `## Write discipline` section — not on a platform
|
|
35
|
+
> restriction; they do hold Write/Edit. Parallelism does raise the *cost* if that contract breaks:
|
|
36
|
+
> concurrent violating writes race, where a sequential one would merely be last-write-wins.
|
|
23
37
|
> This is the panel for a change you want scrutinized hard before merge. For a quick single-lens
|
|
24
38
|
> pass, use [`/review`](./review.md).
|
|
25
39
|
|
|
@@ -50,20 +64,27 @@ its domain** — seating an irrelevant lens is wasted spend and dilutes signal:
|
|
|
50
64
|
| `security-reviewer` | touches auth/authz, crypto, secrets, input validation, deserialization, file uploads, third-party data, templating, or user-controlled input reaching a sink |
|
|
51
65
|
| `architecture-reviewer` | adds/splits a module or service, changes a public contract, or changes dependency direction |
|
|
52
66
|
| `test-strategist` | adds/changes meaningful test surface, or the diff's risk is concentrated where tests are thin/over-mocked/flaky |
|
|
67
|
+
| `plan-reviewer` | the review target is a plan or design (a `.somi/plans/<slug>/` artifact set, a `brief.md`, or an ADR), or the diff changes `spec.md` / `decisions.md` / `phases/` / `brief.md` — the plan's shape is what is under review, not only the code |
|
|
68
|
+
| `sdlc-reviewer` | a work-item `<slug>` was given, or the diff touches `progress.md` / `diary.md` / the findings ledger — so the planning record can be checked against what the diff actually did |
|
|
53
69
|
|
|
54
70
|
Record which lenses you seated and **why each unseated one was skipped** — that record is part of
|
|
55
71
|
the panel's value (it shows the surface was considered, not ignored).
|
|
56
72
|
|
|
57
73
|
### 3. Run the panel **in parallel**
|
|
58
74
|
|
|
59
|
-
Issue the seated lenses as **multiple `Task` calls in a single turn** so they run concurrently
|
|
60
|
-
|
|
75
|
+
Issue the seated lenses as **multiple `Task` calls in a single turn** so they run concurrently —
|
|
76
|
+
call `somi_resolve` for each lens back-to-back immediately before the batch (each call's own
|
|
77
|
+
`project_dir`, model, and `dispatched at cost: <tier>` in that lens's own briefing — this is the
|
|
78
|
+
concurrent-batch case the `somi-dispatch` skill's §5 names explicitly). Give each the *same* scoped
|
|
79
|
+
diff and work-item context, and each its own briefing:
|
|
61
80
|
|
|
62
81
|
```text
|
|
63
82
|
Task reviewer (= /review <target>, scope = this diff)
|
|
64
83
|
Task security-reviewer (= security lens on this diff) # if seated
|
|
65
84
|
Task architecture-reviewer (= structural lens on this diff) # if seated
|
|
66
85
|
Task test-strategist (= test-shape lens on this diff) # if seated
|
|
86
|
+
Task plan-reviewer (= plan lens on the plan artifacts) # if seated
|
|
87
|
+
Task sdlc-reviewer (= process lens on the planning record) # if seated
|
|
67
88
|
```
|
|
68
89
|
|
|
69
90
|
> **Copilot / sequential fallback.** Parallel sub-agent execution is a Claude Code capability. Where
|
|
@@ -105,7 +126,7 @@ lenses found the change.
|
|
|
105
126
|
lenses in the markdown, not as duplicate ledger entries.
|
|
106
127
|
- Update `progress.md` (the iteration's `Reviewed` column → `panel:<verdict>`) and append a
|
|
107
128
|
`diary.md` entry (category `review-feedback`) naming the verdict, the seated lenses, and the top
|
|
108
|
-
finding. The lenses
|
|
129
|
+
finding. The lenses write nothing by contract; these writes are yours.
|
|
109
130
|
- If any lens surfaced a **plan** issue (not just code), include its proposed diary entry and
|
|
110
131
|
recommend `/plan` (or the `/code` plan-change protocol) per [`/review`](./review.md).
|
|
111
132
|
|
package/commands/review.md
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
description: Strict, skeptical, fresh-context review of the current changes — or a plan, a
|
|
2
|
+
description: Strict, skeptical, fresh-context review of the current changes — or a plan, a high-cost design+brief, an ADR, a PR, or an arbitrary diff. Severity-graded findings, evidence-driven, will reject weak solutions. Output lands under .somi/reviews/<slug>/.
|
|
3
3
|
argument-hint: <slug> | <diff range> | <PR #> | <file path> | "plan <slug>" | "design <slug>"
|
|
4
4
|
allowed-tools: Task, Read, Grep, Glob, Bash, Write, Edit, WebFetch
|
|
5
|
-
model: sonnet
|
|
6
5
|
---
|
|
7
6
|
|
|
8
7
|
# /review — Reviewing workflow
|
|
@@ -14,8 +13,8 @@ branch, scoped to the single in-progress work item if exactly one exists).
|
|
|
14
13
|
|
|
15
14
|
> **Note:** plan-level review is part of this command. Use `plan <slug>` (or pass an `.somi/plans/`
|
|
16
15
|
> path) to review a spec/decisions/phases set instead of a diff. Use `design <slug>` to review a
|
|
17
|
-
>
|
|
18
|
-
> [`/refactor`](./refactor.md)
|
|
16
|
+
> `cost: high` design + `brief.md` (from [`/design`](./design.md), [`/discover`](./discover.md), or
|
|
17
|
+
> [`/refactor-design`](./refactor-design.md)) before it hands off to execution. There is no separate
|
|
19
18
|
> `/plan-review` or `/design-review` command — this is the single deepest review surface.
|
|
20
19
|
|
|
21
20
|
> **Fresh-context review (bias avoidance).** The `reviewer` (and any consultant) is **always** Tasked
|
|
@@ -39,11 +38,12 @@ branch, scoped to the single in-progress work item if exactly one exists).
|
|
|
39
38
|
- **`plan <slug>`** → review the spec/decisions/phases for that work item, not its code. If
|
|
40
39
|
exactly one work item has `status: awaiting-approval` or `planning` in `.somi/plans/` and the
|
|
41
40
|
user typed bare `plan`, use it.
|
|
42
|
-
- **`design <slug>`** → review a
|
|
43
|
-
doc set for discovery), `decisions.md`, and especially **`brief.md`**. This is
|
|
44
|
-
|
|
45
|
-
brief is **dense, bounded, reference-not-inline**, and that its **"What
|
|
46
|
-
re-research"** section is concrete enough to actually save
|
|
41
|
+
- **`design <slug>`** → review a `cost: high` design + handoff: `design.md` (or the
|
|
42
|
+
`.somi/rd/<slug>/` doc set for discovery), `decisions.md`, and especially **`brief.md`**. This is
|
|
43
|
+
the "high cost reviewed at high cost" pass — calibrate as a plan review (cheaper to fix here), and
|
|
44
|
+
additionally check the brief is **dense, bounded, reference-not-inline**, and that its **"What
|
|
45
|
+
execution does NOT need to re-research"** section is concrete enough to actually save execution
|
|
46
|
+
the research.
|
|
47
47
|
- **A file path** → review the file (typically an ADR or design doc outside `.somi/`).
|
|
48
48
|
|
|
49
49
|
### 2. Read for intent first
|
|
@@ -63,7 +63,9 @@ errors that are cheaper to fix here than after code is written.
|
|
|
63
63
|
|
|
64
64
|
### 3. Brief the `reviewer` agent
|
|
65
65
|
|
|
66
|
-
|
|
66
|
+
Before this `Task`, call `somi_resolve` for `reviewer` (with `project_dir`), pass its model, and put
|
|
67
|
+
`dispatched at cost: <tier>` in the briefing; full rules: the `somi-dispatch` skill (`somi_skill`,
|
|
68
|
+
or `somi:somi-dispatch` on Claude Code). Via the Task tool, pass:
|
|
67
69
|
|
|
68
70
|
- The target (diff, file, or plan-artifact set).
|
|
69
71
|
- The work-item paths (`spec.md`, the iteration phase file, recent `diary.md` entries,
|
|
@@ -72,8 +74,10 @@ Via the Task tool, pass:
|
|
|
72
74
|
- An instruction to **return** (not write) the full review body and any proposed diary entry;
|
|
73
75
|
the command owns all writes.
|
|
74
76
|
|
|
75
|
-
The `reviewer` agent is read-only
|
|
76
|
-
|
|
77
|
+
The `reviewer` agent is read-only **by contract, not by platform restriction** — it holds Write/Edit
|
|
78
|
+
but is forbidden from using them, so the command owns every write. If the target crosses the triggers
|
|
79
|
+
below, **also invoke** the relevant consultant via a separate Task call — call `somi_resolve` for it
|
|
80
|
+
first, like any other (full rules: the `somi-dispatch` skill) — and merge its findings
|
|
77
81
|
into the review under a dedicated section:
|
|
78
82
|
|
|
79
83
|
| Trigger | Consultant agent | When |
|
|
@@ -82,7 +86,10 @@ into the review under a dedicated section:
|
|
|
82
86
|
| New module / service / public contract / dependency-direction change / public interface | `architecture-reviewer` | Both code and plan |
|
|
83
87
|
| Mock-heavy diff, new flaky tests, e2e-only coverage of risky code, untestable seams | `test-strategist` | Code review |
|
|
84
88
|
|
|
85
|
-
Skipping a triggered consultant is itself a **finding** in the meta-review.
|
|
89
|
+
Skipping a triggered consultant is itself a **finding** in the meta-review. If a triggered
|
|
90
|
+
consultant's own declared `cost:` has no member at or below the session ceiling, that is not a
|
|
91
|
+
skip to absorb quietly — stop and surface the refusal to the user rather than reporting a clean
|
|
92
|
+
verdict the consultant never actually rendered.
|
|
86
93
|
|
|
87
94
|
### 4. Aggregate findings
|
|
88
95
|
|
|
@@ -127,7 +134,7 @@ The command (not the agent) writes these:
|
|
|
127
134
|
`node scripts/somi-findings.mjs resolve --slug <slug> --id F-<n> --status fixed --by <review-filename>`
|
|
128
135
|
(`accepted` / `wontfix` when the human signed off on not fixing). The markdown review file is
|
|
129
136
|
the human view; the ledger is the machine view — same command, same step, no drift.
|
|
130
|
-
- In `progress.md`:
|
|
137
|
+
- In `progress.md`: set the reviewed iteration's `Reviewed` cell to the verdict (there is no activity log).
|
|
131
138
|
- If the reviewer returned a proposed `review-feedback` diary entry (because a Blocker/Major
|
|
132
139
|
points at the plan rather than the code, or a plan-review finding requires plan changes),
|
|
133
140
|
append it to `.somi/plans/<slug>/diary.md`. The follow-up `/code` (or next `/plan` revision)
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
description: Targeted security review of the current changes (or a specified diff). Walks trust boundaries to sinks, applies OWASP Top 10 lens, produces severity-graded findings with explicit attack paths. Output lands under .somi/reviews/<slug>/ when scoped to a work item.
|
|
3
3
|
argument-hint: <slug> | <diff range> | <PR #> | <file path>
|
|
4
4
|
allowed-tools: Task, Read, Grep, Glob, Bash, Write, Edit, WebFetch
|
|
5
|
-
model: sonnet
|
|
6
5
|
---
|
|
7
6
|
|
|
8
7
|
# /security-review — Targeted security review
|
|
@@ -23,12 +22,22 @@ Use the same resolution logic as [`/review`](./review.md):
|
|
|
23
22
|
|
|
24
23
|
### 2. Brief the `security-reviewer` agent
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
Before this `Task`, call `somi_resolve` for `security-reviewer` (with `project_dir`), pass its
|
|
26
|
+
model, and put `dispatched at cost: <tier>` in the briefing; full rules: the `somi-dispatch` skill
|
|
27
|
+
(`somi_skill`, or `somi:somi-dispatch` on Claude Code). Via the Task tool, pass:
|
|
27
28
|
|
|
28
29
|
- The diff and the relevant repo context.
|
|
29
30
|
- The work-item paths (`spec.md` §8 security considerations, the iteration phase file, recent
|
|
30
31
|
`diary.md` entries) when scoped.
|
|
31
32
|
- The expectation: walk trust boundaries to sinks, produce **attack-path-grounded** findings.
|
|
33
|
+
- The expectation that it **returns** its findings as text rather than writing them. The
|
|
34
|
+
`security-reviewer` agent is read-only **by contract, not by platform restriction** — it holds
|
|
35
|
+
Write/Edit and its `## Write discipline` section forbids using them, so this command owns every
|
|
36
|
+
write (the review file, `progress.md`, `diary.md`).
|
|
37
|
+
|
|
38
|
+
`security-reviewer` declares `cost: high` alone, no lower member. If the session ceiling has no
|
|
39
|
+
member at or below that, do not run a substitute lighter pass and report it as this review — stop
|
|
40
|
+
and surface the refusal to the user.
|
|
32
41
|
|
|
33
42
|
### 3. Findings must include
|
|
34
43
|
|
|
@@ -46,7 +55,7 @@ Use [`templates/REVIEW.md.tmpl`](../templates/REVIEW.md.tmpl) with security fram
|
|
|
46
55
|
|
|
47
56
|
### 5. Update work-item state (if scoped)
|
|
48
57
|
|
|
49
|
-
- `progress.md`:
|
|
58
|
+
- `progress.md`: set the iteration's `Reviewed` cell to the verdict (there is no activity log).
|
|
50
59
|
- If a Blocker / Major finding requires a plan change (e.g., reveals a missing mitigation in
|
|
51
60
|
`spec.md` §8), append a diary entry with category `review-feedback`. The follow-up `/code`
|
|
52
61
|
invocation will pick up the changes via the plan-change protocol.
|