@skathio/somi 1.1.1 → 1.2.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 +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.copilot-extension/extension.json +11 -2
- package/.copilot-extension/marketplace.json +1 -1
- package/README.md +16 -4
- package/agents/coder.md +8 -3
- package/agents/designer.md +22 -7
- package/agents/discovery-analyst.md +11 -0
- package/agents/planner.md +69 -9
- package/agents/refactorer.md +3 -1
- package/agents/reviewer.md +4 -0
- package/commands/adopt.md +77 -0
- package/commands/atlas.md +83 -0
- package/commands/code-loop.md +70 -44
- package/commands/code-parallel.md +3 -1
- package/commands/code.md +8 -2
- package/commands/debug.md +136 -0
- package/commands/design.md +17 -7
- package/commands/discover.md +23 -18
- package/commands/impact.md +74 -0
- package/commands/incident.md +83 -0
- package/commands/plan-loop.md +44 -19
- package/commands/plan.md +38 -26
- package/commands/pr.md +82 -0
- package/commands/release-readiness.md +70 -0
- package/commands/review-panel.md +5 -0
- package/commands/review.md +19 -0
- package/commands/ship-loop.md +18 -10
- package/commands/ship.md +4 -2
- package/commands/somi.md +85 -0
- package/commands/upgrade.md +81 -0
- package/hooks/lib/common.sh +13 -0
- package/hooks/pre-tool/block-dangerous-bash.sh +100 -12
- package/hooks/pre-tool/gate-dep-install.sh +42 -1
- package/hooks/pre-tool/guard-protected-paths.sh +18 -3
- package/package.json +6 -1
- package/rules/50-collaboration.md +4 -1
- package/scripts/somi-check.sh +135 -0
- package/scripts/somi-findings.sh +173 -0
- package/scripts/somi-loop.sh +225 -0
- package/scripts/validate.sh +115 -0
- package/templates/ATLAS.md.tmpl +75 -0
- package/templates/BRIEF.md.tmpl +20 -4
- package/templates/DOD.md.tmpl +2 -2
- package/templates/PHASE.md.tmpl +1 -1
- package/templates/RCA.md.tmpl +53 -0
- package/templates/RD-README.md.tmpl +2 -2
- package/templates/SDD.md.tmpl +4 -4
- package/templates/SOMI-README.md.tmpl +20 -3
- package/templates/SRS.md.tmpl +1 -1
- package/templates/TDD.md.tmpl +5 -5
- package/tests/hooks/cases/block-dangerous-bash.json +78 -0
- package/tests/hooks/cases/block-secret-writes.json +22 -0
- package/tests/hooks/cases/gate-dep-install.json +37 -0
- package/tests/hooks/cases/guard-protected-paths.json +30 -0
- package/tests/hooks/run.sh +97 -0
- package/tests/scripts/run.sh +168 -0
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"url": "https://github.com/skathio/somi.git"
|
|
14
14
|
},
|
|
15
15
|
"description": "MAX/ECO economy: discover/design (MAX) → plan / code / review (ECO) workflow system with SOLID, OWASP, and clean-code guardrails.",
|
|
16
|
-
"version": "1.
|
|
16
|
+
"version": "1.2.0",
|
|
17
17
|
"tags": ["workflow", "agents", "review", "security"],
|
|
18
18
|
"homepage": "https://github.com/skathio/somi"
|
|
19
19
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "somi",
|
|
3
3
|
"displayName": "SoMi",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.2.0",
|
|
5
5
|
"description": "Multi-agent engineering workflow system: plan, code, review — with SOLID/OWASP guardrails, deterministic hooks, and a global ruleset.",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"workflow",
|
|
@@ -32,9 +32,11 @@
|
|
|
32
32
|
"commands": [
|
|
33
33
|
{ "name": "discover", "description": "Pre-development discovery (MAX): research competition + author the requirements & design foundation (BRD/SRS/FRD/SDD/TDD) + a dense brief.md for a new product. Feeds /plan." },
|
|
34
34
|
{ "name": "design", "description": "Feature/user-story design (MAX): settle a brownfield feature's architecture against the codebase and compile the brief.md the cheaper tier executes against. Feeds /plan." },
|
|
35
|
+
{ "name": "atlas", "description": "Build or refresh the Repo Atlas (.somi/atlas.md, MAX): one deep codebase read — module map, dependency rules, conventions digest, hotspots, test topology — SHA-stamped and amortized across every later /design, cold /plan, /refactor analysis, and /impact." },
|
|
35
36
|
{ "name": "plan", "description": "Sequence the design (brief) into a structured engineering plan (phases, risks, DoD, test strategy)" },
|
|
36
37
|
{ "name": "plan-loop", "description": "Bounded plan → review → revise loop. Stops on approve, cap, divergence, or user stop." },
|
|
37
38
|
{ "name": "code", "description": "Implement against an approved plan with senior-engineer judgment" },
|
|
39
|
+
{ "name": "debug", "description": "Debug a bug whose cause isn't isolated: reproduce first (failing test as the gate), isolate under a bounded hypothesis budget, fix under /code-loop, keep the repro as the regression guard. Writes rca.md." },
|
|
38
40
|
{ "name": "code-loop", "description": "Bounded code → review → fix loop on a single iteration. Stops on approve, cap, diff cap, circuit breaker, or user stop." },
|
|
39
41
|
{ "name": "code-parallel", "description": "Fan out provably-independent iterations into isolated git worktrees, then integrate them sequentially behind a gate. Falls back to sequential /code-loop on hosts without worktrees/concurrent sub-agents." },
|
|
40
42
|
{ "name": "review", "description": "Strict, fresh-context code / plan / design review with severity-graded findings (use `plan <slug>` or `design <slug>`)" },
|
|
@@ -44,7 +46,14 @@
|
|
|
44
46
|
{ "name": "security-review", "description": "Security-focused review: auth, crypto, input validation, injection risks" },
|
|
45
47
|
{ "name": "architecture-review", "description": "Architectural review: boundaries, contracts, dependency direction, reversibility" },
|
|
46
48
|
{ "name": "test-strategy", "description": "Test-strategy review: risk-driven coverage, level selection, mock policy, determinism" },
|
|
47
|
-
{ "name": "refactor", "description": "Untangle complex code before patching antipatterns" }
|
|
49
|
+
{ "name": "refactor", "description": "Untangle complex code before patching antipatterns" },
|
|
50
|
+
{ "name": "impact", "description": "Read-only change-impact analysis: blast radius (callers, contracts, test coverage, migration surface) before committing to /design or /plan. Sometimes the honest output is 'reconsider'." },
|
|
51
|
+
{ "name": "adopt", "description": "One-time SoMi onboarding for an existing repo: builds the Atlas, confirms detected conventions into 99-overrides, produces a gap report, suggests a calibration work item." },
|
|
52
|
+
{ "name": "upgrade", "description": "Dependency upgrade validation: MAX researches changelog/breaking-changes/CVE (cited), scans actual API usage, compiles a mini-brief; ECO migrates under /code-loop. Integrates with the dep-install gate." },
|
|
53
|
+
{ "name": "release-readiness", "description": "Pre-release gate: deterministic checklist over the artifacts (done? open Blockers? DoD? rollback real?) + one MAX review of the integration surface. Verdict + draft release notes." },
|
|
54
|
+
{ "name": "incident", "description": "The sanctioned emergency lane: mitigate fast (flag/revert/scoped patch) with hooks still enforcing, then MANDATORY postmortem note + seeded /debug follow-up. Less ceremony now, enforced accounting after." },
|
|
55
|
+
{ "name": "somi", "description": "Status dashboard of all work items / discoveries / open findings with next actions; with an argument, routes your request to the right SoMi command (recommends, never auto-invokes)." },
|
|
56
|
+
{ "name": "pr", "description": "Compose a PR title + description from a work item's .somi/ artifacts (spec, decisions, reviews, diary) and optionally open it via gh after confirmation." }
|
|
48
57
|
],
|
|
49
58
|
"compatibility": {
|
|
50
59
|
"copilot": ">=1.0.0"
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"name": "somi",
|
|
12
12
|
"source": "github:skathio/somi",
|
|
13
13
|
"description": "MAX/ECO economy: discover/design (MAX) → plan / code / review (ECO) workflow system with SOLID, OWASP, and clean-code guardrails.",
|
|
14
|
-
"version": "1.
|
|
14
|
+
"version": "1.2.0",
|
|
15
15
|
"tags": ["workflow", "agents", "review", "security"],
|
|
16
16
|
"homepage": "https://github.com/skathio/somi"
|
|
17
17
|
}
|
package/README.md
CHANGED
|
@@ -31,6 +31,7 @@ It is designed to be:
|
|
|
31
31
|
| `/design` | MAX | `designer` | Settle a brownfield feature's architecture against the codebase; compile the `brief.md` the cheap tier executes against |
|
|
32
32
|
| `/plan` | ECO | `planner` | Sequence the design (brief) into phases, risks, slices, DoD, test & rollout strategy |
|
|
33
33
|
| `/code` | ECO | `coder` | Execute against an approved plan + brief with senior-level design judgment |
|
|
34
|
+
| `/debug` | ECO | `coder` (+MAX hatch) | Reproduce first, isolate under a bounded hypothesis budget, fix under `/code-loop`, keep the repro test as the regression guard; writes a one-page `rca.md` |
|
|
34
35
|
| `/review` | MAX | `reviewer` | Strict, skeptical, **fresh-context** review of code / plans / designs with severity-graded findings |
|
|
35
36
|
| `/ship` | both | planner+coder+reviewer | Full (optional MAX front-load →) plan → code → review pipeline, gated at every stage |
|
|
36
37
|
|
|
@@ -110,11 +111,16 @@ Once installed, use `@somi` in GitHub Copilot chat:
|
|
|
110
111
|
```
|
|
111
112
|
.claude-plugin/ Plugin + marketplace manifests (Claude Code plugin distribution)
|
|
112
113
|
agents/ Subagent definitions (planner, coder, reviewer, + support)
|
|
113
|
-
commands/ Slash-command entrypoints (/plan, /code, /review, /ship, ...)
|
|
114
|
+
commands/ Slash-command entrypoints (/plan, /code, /review, /ship, /debug, /somi, ...)
|
|
114
115
|
skills/ On-demand expert knowledge packs (OWASP, SOLID, test strategy, ...)
|
|
115
116
|
rules/ Global ruleset composed into CLAUDE.md
|
|
116
117
|
hooks/ Deterministic guardrails (block dangerous bash, secret writes, ...)
|
|
117
|
-
|
|
118
|
+
scripts/ Runtime tooling: somi-loop (resumable loop state & caps), somi-findings
|
|
119
|
+
(the findings ledger), somi-check (portable working-tree guard, npm bin)
|
|
120
|
+
templates/ Artifact templates (BRIEF [MAX→ECO handoff], ATLAS [repo map], DESIGN, RCA,
|
|
121
|
+
CONTEXT, SPEC, DECISIONS, PHASE, PROGRESS, DIARY, REVIEW, ADR, DOD;
|
|
122
|
+
R&D: RD-README, RESEARCH, BRD, SRS, FRD, SDD, TDD)
|
|
123
|
+
tests/ Behavioral fixtures for hooks + end-to-end tests for the runtime scripts
|
|
118
124
|
.copilot-extension/ Copilot extension + marketplace manifests (mirrors .claude-plugin/)
|
|
119
125
|
examples/ Worked examples + a minimal consuming project
|
|
120
126
|
docs/ Full documentation
|
|
@@ -123,8 +129,10 @@ docs/ Full documentation
|
|
|
123
129
|
When you use SoMi in a project, workflows write their artifacts into a `.somi/` directory
|
|
124
130
|
at the project root. Discovery foundations live under `.somi/rd/<slug>/` (research report, BRD, SRS,
|
|
125
131
|
FRD, SDD, TDD); plans live under `.somi/plans/<slug>/` (context, spec, decisions, progress, diary,
|
|
126
|
-
phases); reviews live under `.somi/reviews/<slug>/`
|
|
127
|
-
|
|
132
|
+
phases — or a one-page `rca.md` for `/debug` items); reviews live under `.somi/reviews/<slug>/`
|
|
133
|
+
(including the machine-readable findings ledger, `findings.json`); the repo-wide map lives at
|
|
134
|
+
`.somi/atlas.md` (from `/atlas`); optional committed policy lives at `.somi/config.json` —
|
|
135
|
+
separate directories, no clutter. See [`docs/WORKFLOWS.md`](docs/WORKFLOWS.md) for the full layout.
|
|
128
136
|
|
|
129
137
|
---
|
|
130
138
|
|
|
@@ -183,6 +191,10 @@ For an **incremental change** with a settled design (the daily loop), start at p
|
|
|
183
191
|
|
|
184
192
|
For the all-in-one pipeline: `/ship <problem statement>`.
|
|
185
193
|
|
|
194
|
+
**Lost?** Type `/somi` for a status dashboard of everything in flight (with a next action per
|
|
195
|
+
item), or `/somi <what you want to do>` to get routed to the right command. When a work item is
|
|
196
|
+
ready to merge, `/pr <slug>` turns its artifacts into the pull-request description.
|
|
197
|
+
|
|
186
198
|
---
|
|
187
199
|
|
|
188
200
|
## Why a shared OS, not per-project setups
|
package/agents/coder.md
CHANGED
|
@@ -40,9 +40,10 @@ and keep that artifact set accurate.
|
|
|
40
40
|
Then read `spec.md`, the specific `phases/<NN>-*.md` for the iteration, and the latest entries
|
|
41
41
|
in `diary.md`. If a **`brief.md`** is present (written by an upstream MAX action), read it too —
|
|
42
42
|
it carries the decisions in force, the complexity map, the file map, and the repo conventions you
|
|
43
|
-
must follow. **
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
must follow. **Apply its `§10 Supersessions` overlay before trusting §2 "Decisions in force"** —
|
|
44
|
+
a supersession line wins over the §2 entry it names. **Honour its "What ECO does NOT need to
|
|
45
|
+
re-research" list** — open the deep docs it links only when a specific decision sends you there.
|
|
46
|
+
If no plan exists for non-trivial work, stop and ask the user to run `/plan` first.
|
|
46
47
|
2. **Read everything relevant in the code** before editing. The rule: never edit a file you have
|
|
47
48
|
not read in this session.
|
|
48
49
|
3. **Mark the iteration in-progress** in `progress.md` (single source of truth for status —
|
|
@@ -88,6 +89,10 @@ Steps:
|
|
|
88
89
|
- `spec.md` — change "Core decisions" one-liners, requirements, or DoD as needed.
|
|
89
90
|
- `decisions.md` — never edit a decided ADR. **Add a new entry that supersedes the old one**,
|
|
90
91
|
and mark the old one `superseded by D<N>`.
|
|
92
|
+
- `brief.md` — if present and the superseded decision appears in its §2 "Decisions in force",
|
|
93
|
+
**append one line to `§10 Supersessions`** (`D<N> superseded by D<M> — <reason>`). Never
|
|
94
|
+
rewrite §1–§9: the brief is a cached prompt prefix; the append-only overlay is what keeps it
|
|
95
|
+
truthful for every later pass without invalidating the cache.
|
|
91
96
|
- `phases/<NN>-*.md` — update scope, acceptance criteria, files, or split the phase.
|
|
92
97
|
- `progress.md` — reflect new state. If decisions were pending, mark them resolved or move them.
|
|
93
98
|
3. **Append a diary entry** (top of `diary.md`):
|
package/agents/designer.md
CHANGED
|
@@ -60,12 +60,20 @@ You produce a small artifact set under `.somi/plans/<slug>/`:
|
|
|
60
60
|
trusting them. If the premise doesn't hold, **stop and put the objection to the user** (use the
|
|
61
61
|
verification protocol) before designing.
|
|
62
62
|
|
|
63
|
-
2. **Read the codebase deeply — this is where the model spend goes.**
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
2. **Read the codebase deeply — this is where the model spend goes.** If **`.somi/atlas.md`**
|
|
64
|
+
exists (the repo-level MAX artifact from `/atlas`), start there: run its staleness check
|
|
65
|
+
(`git diff --stat <atlas-SHA>..HEAD`), trust its module map / conventions / hotspots for
|
|
66
|
+
unchanged areas, and spend your deep reading **only** on the drift and on the paths this
|
|
67
|
+
feature touches — that's the atlas's whole point. On structural drift, recommend an `/atlas`
|
|
68
|
+
refresh rather than silently working from an outdated map. With no atlas (or for the areas it
|
|
69
|
+
doesn't cover), use Read/Grep/Glob to map the modules this touches, the boundaries crossed,
|
|
70
|
+
the existing conventions, where the test coverage is, and the existing patterns you should
|
|
71
|
+
follow rather than reinvent. Cheap, surface-level reading produces a design that fights the
|
|
72
|
+
codebase. Do it properly.
|
|
73
|
+
|
|
74
|
+
2a. **Ingest the repo's own instructions — once.** When a fresh atlas exists, its §4 conventions
|
|
75
|
+
digest already did this — cite it and read the source files only where the feature needs more
|
|
76
|
+
depth. Otherwise read any repo-local `CLAUDE.md` (root + nested),
|
|
69
77
|
`AGENTS.md`, `.github/copilot-instructions.md`, `.cursorrules`, and note any `.claude/agents/`.
|
|
70
78
|
Distil the conventions that bear on this feature into the brief's **"Repo conventions in force"**
|
|
71
79
|
section so the ECO tier inherits them without re-reading. **Repo-local instructions win** over
|
|
@@ -104,7 +112,14 @@ You produce a small artifact set under `.somi/plans/<slug>/`:
|
|
|
104
112
|
|
|
105
113
|
## Verification protocol — the user gets the final call on architecture
|
|
106
114
|
|
|
107
|
-
Identical to the [`planner`](./planner.md)'s protocol
|
|
115
|
+
Identical to the [`planner`](./planner.md)'s protocol, **including the batch round-trip
|
|
116
|
+
mechanics**: as a Tasked subagent you cannot pause mid-run to converse with the user. Your
|
|
117
|
+
research pass ends by **returning a `DECISIONS-NEEDED` block** (shape defined in
|
|
118
|
+
[`planner.md`](./planner.md)) — codebase read, crossroads framed, nothing recorded; the calling
|
|
119
|
+
command presents the decisions to the user (your pre-supplied narrowing questions power its
|
|
120
|
+
Discover mode) and re-invokes you with a `VERIFIED-DECISIONS` block appended. Only then do you
|
|
121
|
+
record `decisions.md` entries with `Verified with user: yes` and compile the brief. Never mark a
|
|
122
|
+
decision user-verified in the same pass that generated it. For every architectural choice:
|
|
108
123
|
|
|
109
124
|
1. **State the decision needed** in plain language and what depends on it.
|
|
110
125
|
2. **Offer 2–4 concrete options**, each with **specific, non-vague pros and cons**. Banned without
|
|
@@ -199,6 +199,17 @@ You make recommendations. The user makes decisions. This mirrors the
|
|
|
199
199
|
[`planner`](./planner.md)'s protocol exactly — apply it to every choice that shapes the requirements
|
|
200
200
|
or the architectural direction.
|
|
201
201
|
|
|
202
|
+
**Batch round-trip mechanics (same as the planner's):** as a Tasked subagent you cannot pause
|
|
203
|
+
mid-run to converse with the user. Complete the research first, then **return a
|
|
204
|
+
`DECISIONS-NEEDED` block** (shape defined in [`planner.md`](./planner.md)) covering every
|
|
205
|
+
crossroads — persona, scope, build-vs-integrate, the expensive-to-reverse calls — each grounded
|
|
206
|
+
in the research, with pre-supplied narrowing questions for Discover mode. The calling command
|
|
207
|
+
presents them to the user and re-invokes you with a `VERIFIED-DECISIONS` block appended; only
|
|
208
|
+
then do you author the document set and record `decisions.md` entries with
|
|
209
|
+
`Verified with user: yes`. Never mark a decision user-verified in the same pass that generated
|
|
210
|
+
it. (A **go / no-go / pivot** call from step 3 rides the same round-trip: put it to the user as
|
|
211
|
+
the first decision in the block.)
|
|
212
|
+
|
|
202
213
|
**1. State the decision needed.** Plain language. What is being decided, and what depends on it.
|
|
203
214
|
|
|
204
215
|
**2. Offer 2–4 concrete options.** Each with **specific, non-vague pros and cons**. Banned vague
|
package/agents/planner.md
CHANGED
|
@@ -70,8 +70,9 @@ recommendation instead of producing ceremonial paperwork.
|
|
|
70
70
|
`.somi/plans/<slug>/brief.md` for design/refactor, or `.somi/rd/<slug>/brief.md` for discovery
|
|
71
71
|
(see [`templates/BRIEF.md.tmpl`](../templates/BRIEF.md.tmpl)). When it exists it is your primary
|
|
72
72
|
input: it already carries the decisions in force, the complexity map, the file map, the repo
|
|
73
|
-
conventions, and an explicit **"What ECO does NOT need to re-research"** list. **
|
|
74
|
-
|
|
73
|
+
conventions, and an explicit **"What ECO does NOT need to re-research"** list. **Apply its `§10
|
|
74
|
+
Supersessions` overlay before trusting §2 "Decisions in force"** — a supersession line wins over
|
|
75
|
+
the §2 entry it names. **Honour the no-re-research list — do not re-run the research it covers.** Open the deep docs it links (`design.md`, `sdd.md`,
|
|
75
76
|
`research-report.md`) only when the brief points you at them for a specific decision. Your job
|
|
76
77
|
shrinks to sequencing, slicing, and surfacing anything the brief left open.
|
|
77
78
|
1b. **Consume the R&D foundation if one exists.** If the briefing points you at `.somi/rd/<slug>/`
|
|
@@ -95,10 +96,14 @@ recommendation instead of producing ceremonial paperwork.
|
|
|
95
96
|
[`/design`](../commands/design.md) (MAX) first, which compiles the decisions and complexity into
|
|
96
97
|
a `brief.md` you then sequence cheaply. State the one-line reason. Proceed directly only when the
|
|
97
98
|
design is already clear (a settled brief, a small well-scoped change, or an R&D foundation).
|
|
98
|
-
2. **Map the territory.**
|
|
99
|
+
2. **Map the territory.** If **`.somi/atlas.md`** exists and passes its staleness check
|
|
100
|
+
(`git diff --stat <atlas-SHA>..HEAD` — small drift only), start from its module map,
|
|
101
|
+
conventions digest, and hotspots, and deep-read only the drift plus the paths this work
|
|
102
|
+
touches. Otherwise use Read/Grep/Glob to understand which modules will be touched, which
|
|
99
103
|
boundaries are involved, where the test coverage is, what conventions exist. **If there is no
|
|
100
104
|
upstream brief** (cold plan), read the repo's own instruction files once — `CLAUDE.md` (root +
|
|
101
|
-
nested), `AGENTS.md`, `.github/copilot-instructions.md`, `.cursorrules`
|
|
105
|
+
nested), `AGENTS.md`, `.github/copilot-instructions.md`, `.cursorrules` (or cite the atlas §4
|
|
106
|
+
digest, which already distilled them) — and fold the relevant
|
|
102
107
|
conventions into `context.md` so coding inherits them. **Repo-local instructions win** over SoMi
|
|
103
108
|
defaults where they conflict; do **not** auto-invoke the repo's own agents. (When a brief exists,
|
|
104
109
|
it already carries this — don't re-read.)
|
|
@@ -106,9 +111,11 @@ recommendation instead of producing ceremonial paperwork.
|
|
|
106
111
|
dependencies, constraints, stakeholders. This is the shared foundation everything else assumes.
|
|
107
112
|
4. **Draft the spec skeleton** — purpose, user story, requirements, goals/non-goals. Don't fill in
|
|
108
113
|
"Core decisions" yet; those come from verification.
|
|
109
|
-
5. **
|
|
110
|
-
design decision goes through it.
|
|
111
|
-
|
|
114
|
+
5. **Surface decisions for verification** (see Verification protocol below). Every architectural
|
|
115
|
+
or design decision goes through it. When you run as a Tasked subagent (the normal case), this
|
|
116
|
+
means **stopping and returning a `DECISIONS-NEEDED` block** — the orchestrating command
|
|
117
|
+
relays it to the user and re-invokes you with the verdicts. As each verified decision arrives,
|
|
118
|
+
add an entry to `decisions.md` and a one-liner to `spec.md` §5.
|
|
112
119
|
6. **Slice phases.** Each phase is a coherent, reviewable, low-risk increment. Sequential by
|
|
113
120
|
default. Write one file per phase under `phases/`, using
|
|
114
121
|
[`templates/PHASE.md.tmpl`](../templates/PHASE.md.tmpl). Each phase contains one or more
|
|
@@ -129,8 +136,31 @@ recommendation instead of producing ceremonial paperwork.
|
|
|
129
136
|
|
|
130
137
|
## Verification protocol — the user gets the final call on architecture
|
|
131
138
|
|
|
132
|
-
You make recommendations. The user makes decisions.
|
|
133
|
-
|
|
139
|
+
You make recommendations. The user makes decisions.
|
|
140
|
+
|
|
141
|
+
> **Mechanics — the batch round-trip.** A Tasked subagent cannot pause mid-run to converse with
|
|
142
|
+
> the user; only the orchestrating command can. So verification is a **round-trip, not an inline
|
|
143
|
+
> pause**:
|
|
144
|
+
>
|
|
145
|
+
> 1. **Research pass.** When you reach the decisions, **stop and return a `DECISIONS-NEEDED`
|
|
146
|
+
> block** (shape below) as your result — `context.md` drafted, spec skeleton in place, but
|
|
147
|
+
> **no decisions recorded**. Batch every decision you can foresee into this one block; each
|
|
148
|
+
> extra round-trip costs a cold re-read.
|
|
149
|
+
> 2. The command presents each decision to the user verbatim (options, pros/cons,
|
|
150
|
+
> recommendation, the `Other` / `Discover` escape hatches) and collects verdicts. Your
|
|
151
|
+
> pre-supplied **narrowing questions** are what let the command run Discover mode without
|
|
152
|
+
> re-invoking you per question.
|
|
153
|
+
> 3. **Authoring pass.** You are re-invoked with the same briefing plus a `VERIFIED-DECISIONS`
|
|
154
|
+
> block **appended at the end** (append-only keeps the stable prefix cache-warm). Only now do
|
|
155
|
+
> you record entries in `decisions.md` with `Verified with user: yes` and finish the plan.
|
|
156
|
+
>
|
|
157
|
+
> **Never mark a decision user-verified in the same pass that generated it.** If you were not
|
|
158
|
+
> re-invoked with a verdict for it, it is not verified — a `decisions.md` full of
|
|
159
|
+
> `Verified with user: yes` entries the user never saw is the exact failure this protocol
|
|
160
|
+
> exists to prevent. (Only when you are demonstrably running in the user's own conversation —
|
|
161
|
+
> not Tasked — may you verify inline instead.)
|
|
162
|
+
|
|
163
|
+
Your job on every architectural or design choice that shapes the spec is:
|
|
134
164
|
|
|
135
165
|
**1. State the decision needed.** Plain language. What is being decided, and what depends on it.
|
|
136
166
|
|
|
@@ -168,6 +198,36 @@ choice that shapes the spec is:
|
|
|
168
198
|
**5. Record the decision** in `decisions.md` with `Verified with user: yes` and a one-line summary
|
|
169
199
|
in `spec.md` §5.
|
|
170
200
|
|
|
201
|
+
**The `DECISIONS-NEEDED` block** — what the research pass returns to the command:
|
|
202
|
+
|
|
203
|
+
```decisions-needed
|
|
204
|
+
D1: <decision title in noun form>
|
|
205
|
+
Decides: <what is being decided, and what depends on it>
|
|
206
|
+
Option A — <name> — RECOMMENDED because <one-or-two-sentence reason>
|
|
207
|
+
Pros: <concrete>
|
|
208
|
+
Cons: <concrete>
|
|
209
|
+
Option B — <name>
|
|
210
|
+
Pros: <concrete>
|
|
211
|
+
Cons: <concrete>
|
|
212
|
+
Narrowing questions (Discover mode):
|
|
213
|
+
Q: <specific question>? → <answer> favors A (<why>); <answer> favors B (<why>)
|
|
214
|
+
D2: …
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**The `VERIFIED-DECISIONS` block** — appended to your re-invocation briefing:
|
|
218
|
+
|
|
219
|
+
```verified-decisions
|
|
220
|
+
D1: chosen = <option name, or the user's custom "Other" option verbatim>
|
|
221
|
+
discovery-qa = <Q/A pairs if the user used Discover; omit otherwise>
|
|
222
|
+
notes = <any constraints the user added; omit if none>
|
|
223
|
+
D2: …
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
When the chosen option came via `Other`, record it as `Chosen` in `decisions.md` and keep your
|
|
227
|
+
original options listed with their pros/cons intact. When Discover was used, record the Q&A under
|
|
228
|
+
"Discovery questions". If authoring surfaces a decision the research pass didn't foresee, return
|
|
229
|
+
a follow-up `DECISIONS-NEEDED` block — but batch aggressively; follow-ups should be rare.
|
|
230
|
+
|
|
171
231
|
**Never silently pick architectural defaults.** If you find yourself making a choice that shapes
|
|
172
232
|
the spec, surface it.
|
|
173
233
|
|
package/agents/refactorer.md
CHANGED
|
@@ -30,7 +30,9 @@ The calling command picks the mode based on size:
|
|
|
30
30
|
[`/plan-loop`](../commands/plan-loop.md) → [`/code-loop`](../commands/code-loop.md). Surface the
|
|
31
31
|
scope to the user (verification protocol) before handing off — a 600-line refactor is a *plan*, not
|
|
32
32
|
a single diff. In analysis mode also distil the repo's own conventions (`CLAUDE.md` / `AGENTS.md` /
|
|
33
|
-
`.github/copilot-instructions.md`) into the brief's "Repo conventions in force" section
|
|
33
|
+
`.github/copilot-instructions.md`) into the brief's "Repo conventions in force" section — starting
|
|
34
|
+
from `.somi/atlas.md`'s §4 digest and hotspot map when a fresh atlas exists (staleness-check it
|
|
35
|
+
first), deep-reading only the drift.
|
|
34
36
|
|
|
35
37
|
The rest of this file is the surgical contract; in analysis mode you apply the same judgment to
|
|
36
38
|
*design* the refactor rather than perform it.
|
package/agents/reviewer.md
CHANGED
|
@@ -66,6 +66,10 @@ A clean diff with no obvious bugs can be rejected if it solves the wrong problem
|
|
|
66
66
|
- **Spec / code divergence** — the diff implements something different from the spec/iteration,
|
|
67
67
|
and no diary entry explains why.
|
|
68
68
|
- **Stale decisions** — code contradicts an entry in `decisions.md` that wasn't superseded.
|
|
69
|
+
- **Stale brief** — a decision was superseded in `decisions.md` but the work item's `brief.md`
|
|
70
|
+
still lists it in §2 "Decisions in force" with no matching line in `§10 Supersessions`. The
|
|
71
|
+
brief is the ECO tier's cached primary input; a missing overlay line means every later pass
|
|
72
|
+
builds on a decision that no longer holds.
|
|
69
73
|
- **Missing diary entries** — a phase shape changed (different files, different scope) and no
|
|
70
74
|
diary entry records it.
|
|
71
75
|
- **Unrecorded scope creep** — diff touches code outside the iteration's "Files (approx)"; not
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: One-time SoMi onboarding for an existing codebase. Builds the Repo Atlas, confirms detected conventions into a pre-filled 99-overrides scaffold, produces a gap report (test thin ice, hotspots, candidate first refactors), and suggests a calibration work item.
|
|
3
|
+
argument-hint: (no arguments — run once after installing SoMi in a repo)
|
|
4
|
+
allowed-tools: Task, Read, Grep, Glob, Bash, Write, Edit
|
|
5
|
+
model: sonnet
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /adopt — Onboard SoMi into an existing codebase
|
|
9
|
+
|
|
10
|
+
You are running SoMi's **one-time brownfield onboarding**. The goal: after this command, SoMi
|
|
11
|
+
already *knows this repo* — its map, its conventions, its weak spots — and the team has a
|
|
12
|
+
concrete first exercise, instead of "read thirteen docs and type `/plan`".
|
|
13
|
+
|
|
14
|
+
This is a composite of existing pieces, run in order, with the user confirming at each seam.
|
|
15
|
+
|
|
16
|
+
## Stage 1 — Build the Repo Atlas (MAX, the expensive step)
|
|
17
|
+
|
|
18
|
+
Run the [`/atlas`](./atlas.md) flow (it runs `opus` end-to-end): one deep read of the codebase →
|
|
19
|
+
`.somi/atlas.md` (module map, dependency rules, conventions digest, hotspots, test topology,
|
|
20
|
+
SHA-stamped). If a fresh atlas already exists, skip the rebuild and say so.
|
|
21
|
+
|
|
22
|
+
Present the atlas §1 framing + module count and pause briefly: "does this map match your mental
|
|
23
|
+
model?" — a wrong map should be corrected *now*, by the people who know, not discovered by the
|
|
24
|
+
first `/design`.
|
|
25
|
+
|
|
26
|
+
## Stage 2 — Confirm conventions into `99-overrides.md`
|
|
27
|
+
|
|
28
|
+
From the atlas §4 digest (and the instruction files it lists), draft the project's
|
|
29
|
+
`rules/99-overrides.md` scaffold **pre-filled with the detected conventions** — each as a
|
|
30
|
+
`## Convention:` block, plus a `## Override:` block for anything that contradicts a SoMi default
|
|
31
|
+
(name the rule file it overrides and a removal condition).
|
|
32
|
+
|
|
33
|
+
**Present the draft to the user for confirmation before writing** — detected ≠ intended; the
|
|
34
|
+
team may be tolerating practices they don't want codified. Apply their edits, then write the
|
|
35
|
+
file (or, if one exists, propose additions only — never clobber). Where instruction files and
|
|
36
|
+
observed practice disagreed (the atlas records this), ask which one wins and record the answer.
|
|
37
|
+
|
|
38
|
+
## Stage 3 — Gap report
|
|
39
|
+
|
|
40
|
+
From the atlas plus targeted checks, produce a short **gap report** (in-chat, plus
|
|
41
|
+
`.somi/reviews/_ad-hoc/<YYYY-MM-DD>-adoption-gaps.md`):
|
|
42
|
+
|
|
43
|
+
- **Test thin ice** — the atlas §6 areas where a regression wouldn't be caught; the 2–3 places
|
|
44
|
+
characterization tests would pay off first (this is [`test-strategist`](../agents/test-strategist.md)
|
|
45
|
+
territory — Task it if the picture needs depth).
|
|
46
|
+
- **Hotspots** — atlas §5, ranked; for each, whether it blocks likely upcoming work.
|
|
47
|
+
- **Candidate first refactors** — untangles that would make the next changes easy
|
|
48
|
+
([`/refactor`](./refactor.md) analysis candidates), each with the smell named precisely.
|
|
49
|
+
- **Guardrail fit** — anything in the repo the hooks would fight (e.g. a workflow that
|
|
50
|
+
hand-edits a lockfile) → recommend the matching `.somi/config.json` policy
|
|
51
|
+
(`dep_install.allow`, `lockfiles.allow_edit`) instead of per-session env vars.
|
|
52
|
+
|
|
53
|
+
## Stage 4 — Suggest the calibration work item
|
|
54
|
+
|
|
55
|
+
Recommend one **small, real** feature or fix from the team's actual backlog shape (ask if none
|
|
56
|
+
is obvious) to run as `/ship` — the calibration exercise from
|
|
57
|
+
[GOVERNANCE.md](../docs/GOVERNANCE.md): it exercises plan → code-loop → review end-to-end, and
|
|
58
|
+
disagreements it surfaces belong in `99-overrides.md` while they're fresh. For a bug, recommend
|
|
59
|
+
`/debug` instead.
|
|
60
|
+
|
|
61
|
+
## Summarise back
|
|
62
|
+
|
|
63
|
+
- Atlas: built/refreshed, module count, top hotspots.
|
|
64
|
+
- Conventions: confirmed count, overrides recorded, disagreements resolved.
|
|
65
|
+
- Gap report: the top 3 items, with the report's path.
|
|
66
|
+
- The suggested calibration item + exact next command.
|
|
67
|
+
- One-line orientation: "`/somi` any time for status and routing."
|
|
68
|
+
|
|
69
|
+
## Guardrails
|
|
70
|
+
|
|
71
|
+
- **Stage 2 writes nothing without confirmation.** Codifying conventions is a team decision;
|
|
72
|
+
you draft, they decide (this is the batch verification protocol applied to onboarding).
|
|
73
|
+
- **Never clobber** an existing `99-overrides.md`, `CLAUDE.md`, or atlas — propose additions.
|
|
74
|
+
- **The gap report is descriptive.** No unsolicited refactoring, no "fixing" anything during
|
|
75
|
+
adoption. The output is knowledge + a recommended first exercise, not diffs.
|
|
76
|
+
- **Once per repo, roughly.** Re-running is safe (atlas refresh + report regeneration) but the
|
|
77
|
+
overrides confirmation shouldn't be re-litigated on every run — propose only deltas.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: Build or refresh the Repo Atlas (.somi/atlas.md) — one MAX-tier deep read of the codebase (module map, dependency rules, conventions digest, hotspots, test topology), SHA-stamped and amortized across every later /design, cold /plan, /refactor analysis, and /impact.
|
|
3
|
+
argument-hint: [nothing — build or refresh] | refresh
|
|
4
|
+
allowed-tools: Read, Grep, Glob, Bash, Write, Edit
|
|
5
|
+
model: opus
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /atlas — Build or refresh the Repo Atlas (MAX tier)
|
|
9
|
+
|
|
10
|
+
You are building the **repo-level MAX artifact**: a single deep read of this codebase, distilled
|
|
11
|
+
into [`templates/ATLAS.md.tmpl`](../templates/ATLAS.md.tmpl) shape at **`.somi/atlas.md`**, so
|
|
12
|
+
that every later MAX action starts from the atlas plus the drift since its SHA — instead of
|
|
13
|
+
re-reading the whole repo per work item. This is the amortization layer of the MAX→ECO economy:
|
|
14
|
+
`brief.md` compresses a *work item*; the atlas compresses the *repository*.
|
|
15
|
+
|
|
16
|
+
> **Runs on the most capable model end-to-end** (like `/discover` and `/design`): the entire
|
|
17
|
+
> value is one high-quality read, paid once. There is no subagent — the reading *is* the work.
|
|
18
|
+
|
|
19
|
+
## What to do
|
|
20
|
+
|
|
21
|
+
### 1. Staleness check (when an atlas already exists)
|
|
22
|
+
|
|
23
|
+
If `.somi/atlas.md` exists, read its stamped SHA and run `git diff --stat <SHA>..HEAD`:
|
|
24
|
+
|
|
25
|
+
- **Small drift** (edits within existing modules): **refresh in place** — deep-read only the
|
|
26
|
+
drifted paths, update the affected sections (keep section ordering stable), re-stamp the SHA,
|
|
27
|
+
and append a line to §8 Refresh log naming what changed.
|
|
28
|
+
- **Structural drift** (new/moved/deleted top-level modules, manifest or build-system changes)
|
|
29
|
+
or the user typed `refresh` after large churn: rebuild the affected sections from scratch;
|
|
30
|
+
keep §8's history.
|
|
31
|
+
|
|
32
|
+
No atlas → full build (below).
|
|
33
|
+
|
|
34
|
+
### 2. Read the repository — this is where the model spend goes
|
|
35
|
+
|
|
36
|
+
- **Instruction files first**: `CLAUDE.md` (root + nested), `AGENTS.md`,
|
|
37
|
+
`.github/copilot-instructions.md`, `.cursorrules`; note any `.claude/agents/` (listed for
|
|
38
|
+
opt-in, never auto-invoked). These seed §4's conventions digest — repo-local instructions win
|
|
39
|
+
over SoMi defaults.
|
|
40
|
+
- **Shape**: manifests (package.json / go.mod / pyproject / …), top-level layout, the module
|
|
41
|
+
boundaries as they *actually are* (imports, not intentions).
|
|
42
|
+
- **Conventions as practiced**: open representative files per module — error handling, test
|
|
43
|
+
layout, naming, logging. Where instruction files and practice disagree, record practice and
|
|
44
|
+
note the disagreement.
|
|
45
|
+
- **Hotspots**: the files that are large, churn-heavy (`git log --stat`), or load-bearing in a
|
|
46
|
+
non-obvious way — with `file:line` pointers.
|
|
47
|
+
- **Test topology and CI**: where tests live, the commands that actually run them, what gates a
|
|
48
|
+
merge, where coverage is thin.
|
|
49
|
+
|
|
50
|
+
### 3. Write `.somi/atlas.md`
|
|
51
|
+
|
|
52
|
+
Fill the template. Hold the author discipline: **bounded (~300 lines), descriptive not
|
|
53
|
+
aspirational, reference-not-inline, stable section ordering**. Stamp the current `HEAD` SHA and
|
|
54
|
+
date. If `.somi/README.md` doesn't exist yet, also write it from
|
|
55
|
+
[`templates/SOMI-README.md.tmpl`](../templates/SOMI-README.md.tmpl).
|
|
56
|
+
|
|
57
|
+
### 4. Summarise back
|
|
58
|
+
|
|
59
|
+
- The one-paragraph repo framing (§1) and the module count.
|
|
60
|
+
- Top 3 hotspots and the thinnest test ice.
|
|
61
|
+
- Any instruction-vs-practice disagreements found.
|
|
62
|
+
- Next step: "MAX actions now start from the atlas — `/design` / cold `/plan` / `/refactor`
|
|
63
|
+
analysis / `/impact` will deep-read only the drift since `<SHA>`. Refresh with `/atlas` after
|
|
64
|
+
structural changes."
|
|
65
|
+
|
|
66
|
+
## How consumers use it (the contract)
|
|
67
|
+
|
|
68
|
+
- `/design`, cold `/plan`, `/refactor` analysis, `/impact`: read the atlas **first**, run the
|
|
69
|
+
staleness check, deep-read **only** drifted areas and the paths the work item touches, and
|
|
70
|
+
cite atlas sections in the brief's "Repo conventions in force" instead of re-deriving them.
|
|
71
|
+
- A **stale atlas is worse than none** — consumers must run the `git diff --stat` check before
|
|
72
|
+
trusting it, and recommend `/atlas` refresh on structural drift rather than silently working
|
|
73
|
+
from an outdated map.
|
|
74
|
+
|
|
75
|
+
## Guardrails
|
|
76
|
+
|
|
77
|
+
- **Descriptive, not aspirational.** Record how the repo is, warts included. An atlas that
|
|
78
|
+
describes the intended architecture misleads every downstream consumer.
|
|
79
|
+
- **No editing the repo.** The only writes are `.somi/atlas.md` (and `.somi/README.md` if
|
|
80
|
+
missing).
|
|
81
|
+
- **Bounded.** If it's growing past ~300 lines, you're inlining what should be a pointer.
|
|
82
|
+
- **Commit it.** The atlas is a shared team artifact — recommend committing `.somi/atlas.md`
|
|
83
|
+
like the other `.somi/` artifacts.
|