@skathio/somi 3.1.1 → 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.
- package/.claude/settings.json +13 -0
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/.copilot-extension/extension.json +1 -1
- package/.copilot-extension/marketplace.json +2 -2
- package/README.md +28 -23
- package/VERSION +1 -1
- package/agents/{architecture-reviewer.md → somi-architecture-reviewer.md} +10 -11
- package/agents/{atlas.md → somi-atlas.md} +3 -5
- package/agents/{coder.md → somi-coder.md} +26 -23
- package/agents/{designer.md → somi-designer.md} +9 -11
- package/agents/{discovery-analyst.md → somi-discovery-analyst.md} +7 -9
- package/agents/{impact.md → somi-impact.md} +6 -8
- package/agents/{incident.md → somi-incident.md} +2 -4
- package/agents/{plan-reviewer.md → somi-plan-reviewer.md} +9 -11
- package/agents/{planner.md → somi-planner.md} +16 -24
- package/agents/{pr.md → somi-pr.md} +2 -4
- package/agents/{refactor-designer.md → somi-refactor-designer.md} +14 -15
- package/agents/{refactorer.md → somi-refactorer.md} +11 -12
- package/agents/{reviewer.md → somi-reviewer.md} +8 -7
- package/agents/{sdlc-reviewer.md → somi-sdlc-reviewer.md} +8 -10
- package/agents/{security-reviewer.md → somi-security-reviewer.md} +8 -8
- package/agents/{test-strategist.md → somi-test-strategist.md} +4 -6
- package/agents/somi.md +25 -12
- package/commands/adopt.md +9 -10
- package/commands/architecture-review.md +4 -5
- package/commands/atlas.md +3 -3
- package/commands/code-loop.md +38 -14
- package/commands/code-parallel.md +4 -4
- package/commands/code.md +24 -15
- package/commands/debug.md +8 -9
- package/commands/design.md +14 -15
- package/commands/discover.md +11 -12
- package/commands/impact.md +2 -2
- package/commands/incident.md +3 -4
- package/commands/plan-loop.md +16 -12
- package/commands/plan.md +15 -16
- package/commands/pr.md +2 -2
- package/commands/refactor-design.md +10 -11
- package/commands/refactor.md +7 -8
- package/commands/release-readiness.md +6 -7
- package/commands/review-panel.md +24 -23
- package/commands/review.md +14 -14
- package/commands/security-review.md +8 -7
- package/commands/ship-loop.md +107 -28
- package/commands/ship.md +6 -6
- package/commands/somi-config.md +131 -0
- package/commands/test-strategy.md +3 -4
- package/commands/upgrade.md +4 -5
- package/examples/code-review-example.md +1 -1
- package/examples/discovery-example.md +1 -1
- package/examples/feature-plan-example.md +2 -2
- package/hooks/hooks.json +14 -1
- package/hooks/lib/common.mjs +64 -1
- package/hooks/post-tool/audit-log.mjs +3 -2
- package/hooks/pre-tool/block-secret-writes.mjs +12 -11
- package/hooks/pre-tool/guard-cost-lowering.mjs +177 -0
- package/hooks/pre-tool/guard-protected-paths.mjs +13 -3
- package/hooks/session-start/detect-repo-instructions.mjs +27 -2
- package/hooks/session-start/ensure-default-config.mjs +121 -0
- package/package.json +1 -1
- package/rules/00-priorities.md +1 -1
- package/rules/30-security-owasp.md +1 -1
- package/rules/50-collaboration.md +9 -6
- package/rules/CLAUDE.md +11 -10
- package/scripts/lib/agent-info.mjs +85 -0
- package/scripts/lib/agent-registry.mjs +92 -0
- package/scripts/lib/cost-ceiling.mjs +175 -171
- package/scripts/lib/cost-config-edit.mjs +102 -0
- package/scripts/lib/cost-config.mjs +64 -0
- package/scripts/lib/cost-defaults.mjs +51 -0
- package/scripts/lib/cost-lowering.mjs +89 -0
- package/scripts/lib/cost-model.mjs +37 -22
- package/scripts/lib/dispatch-resolver.mjs +59 -50
- package/scripts/lib/loop-diff.mjs +96 -0
- package/scripts/lib/loop-dispatch.mjs +19 -0
- package/scripts/lib/loop-review.mjs +52 -0
- package/scripts/lib/run-budget.mjs +28 -0
- package/scripts/lib/size-tier.mjs +184 -0
- package/scripts/lib/tier-record.mjs +82 -0
- package/scripts/size-budget-overrides.json +7 -15
- package/scripts/somi-config.mjs +358 -0
- package/scripts/somi-dispatch.mjs +1 -1
- package/scripts/somi-loop.mjs +71 -96
- package/scripts/somi-mcp.mjs +135 -14
- package/scripts/somi-tier.mjs +393 -0
- package/scripts/validate.sh +37 -215
- package/skills/api-design/SKILL.md +1 -1
- package/skills/clean-code/SKILL.md +1 -1
- package/skills/market-research/SKILL.md +2 -2
- package/skills/owasp-defense/SKILL.md +2 -2
- package/skills/plan-review/SKILL.md +5 -1
- package/skills/reasoning-craft/SKILL.md +1 -1
- package/skills/requirements-engineering/SKILL.md +3 -3
- package/skills/solid-principles/SKILL.md +1 -1
- package/skills/somi-dispatch/SKILL.md +104 -109
- package/skills/somi-routing/SKILL.md +88 -1
- package/skills/testing-playbook/SKILL.md +2 -2
- package/skills/threat-modeling/SKILL.md +3 -3
- package/templates/BRIEF.md.tmpl +2 -2
- package/templates/DESIGN.md.tmpl +1 -1
- package/templates/DOD.md.tmpl +2 -2
- package/templates/PHASE.md.tmpl +2 -2
- package/templates/RCA.md.tmpl +1 -1
- package/templates/REVIEW.md.tmpl +3 -2
- package/templates/SDD.md.tmpl +1 -1
- package/templates/SPEC.md.tmpl +1 -1
- package/templates/TDD.md.tmpl +1 -1
- package/tests/hooks/cases/block-secret-writes.json +130 -17
- package/tests/hooks/cases/detect-repo-instructions.json +22 -1
- package/tests/hooks/cases/guard-protected-paths.json +175 -25
- package/tests/scripts/agent-model-frontmatter.sh +38 -0
- package/tests/scripts/agent-names.sh +77 -0
- package/tests/scripts/check-frontmatter.sh +1 -1
- package/tests/scripts/checkpoint-gate.sh +44 -3
- package/tests/scripts/convergence-runner.sh +10 -6
- package/tests/scripts/cost-ceiling.sh +127 -215
- package/tests/scripts/cost-defaults.sh +128 -0
- package/tests/scripts/cost-hardcap.sh +329 -0
- package/tests/scripts/cost-lowering.sh +261 -0
- package/tests/scripts/cost-model.sh +18 -14
- package/tests/scripts/dispatch-guard.sh +7 -7
- package/tests/scripts/dispatch-line-gate.sh +61 -0
- package/tests/scripts/dispatch-reference-gate.sh +13 -13
- package/tests/scripts/ensure-default-config.sh +162 -0
- package/tests/scripts/eval-runner.sh +9 -9
- package/tests/scripts/evals-packaging.sh +127 -20
- package/tests/scripts/fixtures/size-tier-cases.json +87 -0
- package/tests/scripts/goldens/loop-state-done.json +1 -1
- package/tests/scripts/goldens/somi-loop.json +3 -3
- package/tests/scripts/lib/agent-registry-tests.mjs +95 -0
- package/tests/scripts/lib/brief-only-guard.mjs +27 -0
- package/tests/scripts/lib/checkpoint-gate.mjs +40 -3
- package/tests/scripts/lib/dispatch-reference-gate.mjs +5 -5
- package/tests/scripts/lib/retirement-gate.mjs +7 -2
- package/tests/scripts/lib/ship-loop-sizing-guard.mjs +52 -0
- package/tests/scripts/lib/size-tier-drift.mjs +74 -0
- package/tests/scripts/lib/somi-mcp-config-tests.mjs +92 -0
- package/tests/scripts/lib/somi-mcp-tests.mjs +66 -28
- package/tests/scripts/lib/somi-mcp-tier-tests.mjs +64 -0
- package/tests/scripts/retirement-gate.sh +19 -0
- package/tests/scripts/review-panel-seats.sh +2 -2
- package/tests/scripts/run.sh +95 -0
- package/tests/scripts/size-tier.sh +562 -0
- package/tests/scripts/somi-agent-dispatch-contract.sh +20 -11
- package/tests/scripts/somi-config.sh +281 -0
- package/tests/scripts/somi-dispatch.sh +150 -98
- package/tests/scripts/somi-mcp.sh +2 -0
package/scripts/validate.sh
CHANGED
|
@@ -75,6 +75,7 @@ bash tests/scripts/cost-ceiling.sh
|
|
|
75
75
|
|
|
76
76
|
echo "==> Dispatch resolver tests..."
|
|
77
77
|
bash tests/scripts/somi-dispatch.sh
|
|
78
|
+
bash tests/scripts/size-tier.sh
|
|
78
79
|
|
|
79
80
|
echo "==> Front-door agent <-> dispatch resolver contract tests..."
|
|
80
81
|
# agents/somi.md is a prompt and can't be exercised without a model, but what its Step 4 tells the
|
|
@@ -89,13 +90,13 @@ echo "==> Bundled MCP server tests (somi_resolve / somi_command)..."
|
|
|
89
90
|
# rather than re-testing the resolver's arithmetic a third time.
|
|
90
91
|
bash tests/scripts/somi-mcp.sh
|
|
91
92
|
|
|
92
|
-
echo "==> Validating the
|
|
93
|
+
echo "==> Validating the dispatch guard (no caller ignoring per-agent overrides)..."
|
|
93
94
|
# scripts/lib/cost-ceiling.mjs's modelForDispatch() is the ONLY sanctioned way to turn a dispatch
|
|
94
95
|
# decision into a model: it resolves the SELECTED tier and refuses anything shaped as other than an
|
|
95
96
|
# "allow" decision. Calling the underlying model resolver directly against a decision's ceiling
|
|
96
97
|
# field instead of its selected field reads fine in English but is a different, unsanctioned
|
|
97
|
-
# composition -- it would run a unit at
|
|
98
|
-
# tier decideDispatch actually picked for it
|
|
98
|
+
# composition -- a caller that ignores per-agent overrides: it would run a unit at the session
|
|
99
|
+
# ceiling rather than the tier decideDispatch actually picked for it (its cost.agents entry). This
|
|
99
100
|
# gate closes that path structurally rather than by convention: nothing outside the library itself
|
|
100
101
|
# may compose the two functions that way. scripts/somi-dispatch.mjs is the first real dispatch call
|
|
101
102
|
# site this machinery ever had (before it, decideDispatch/modelForDispatch had zero live callers),
|
|
@@ -158,6 +159,10 @@ echo "==> Eval packaging & hermeticity..."
|
|
|
158
159
|
# syntax-check it, so a "no mention" rule would be self-contradicting.
|
|
159
160
|
bash tests/scripts/evals-packaging.sh
|
|
160
161
|
|
|
162
|
+
echo "==> Eval gate rule tests..."
|
|
163
|
+
# One glob (D-P3): later iterations add tests/scripts/eval-gate-*.sh files, never a validate.sh block.
|
|
164
|
+
if [ -d tests/evals ]; then for t in tests/scripts/eval-gate-*.sh; do bash "$t"; done; else echo " (skipped: tests/evals not packaged)"; fi
|
|
165
|
+
|
|
161
166
|
echo "==> Digest-marker / hook-fixture coupling..."
|
|
162
167
|
# A `rules/` trim that removes or rewords a digest bullet must update
|
|
163
168
|
# tests/hooks/cases/inject-workflow-context.json's Tier-2 marker in the SAME attempt. The fixture
|
|
@@ -182,233 +187,47 @@ if ! node scripts/check-frontmatter.mjs; then
|
|
|
182
187
|
fi
|
|
183
188
|
|
|
184
189
|
echo "==> Validating cost-tier declarations..."
|
|
185
|
-
#
|
|
186
|
-
#
|
|
187
|
-
#
|
|
188
|
-
#
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
# file Tasks never contributes a value here, and a spawned unit never inherits its caller's tier
|
|
192
|
-
# either direction: a cost: medium orchestrator Tasking a cost: high agent stays declared medium --
|
|
193
|
-
# the agent's own frontmatter is where high is truthfully declared, once -- and a cost: high agent
|
|
194
|
-
# Tasking a cost: low, medium helper does not pull that helper up to high either.
|
|
195
|
-
cost_of() {
|
|
196
|
-
awk '{sub(/\r$/,"")} /^---$/{c++} c==1 && /^cost:[[:space:]]*/{sub(/^cost:[[:space:]]*/,""); print; exit}' "$1"
|
|
190
|
+
# An agent's default tier lives in scripts/lib/cost-defaults.mjs (cost.agents in .somi/config.json
|
|
191
|
+
# overrides it), never in frontmatter: no agents/*.md or commands/*.md declares `cost:`, and no
|
|
192
|
+
# command declares `model:`. Agents declare no `model:` either (check (c) below). The table must list
|
|
193
|
+
# exactly agents/*.md minus the exempt front door `somi`; tests/scripts/cost-defaults.sh proves that.
|
|
194
|
+
fm_has() {
|
|
195
|
+
awk -v k="$2" '{sub(/\r$/,"")} /^---$/{c++} c==1 && index($0,k":")==1{f=1; exit} END{exit !f}' "$1"
|
|
197
196
|
}
|
|
198
197
|
model_of() {
|
|
199
198
|
awk '{sub(/\r$/,"")} /^---$/{c++} c==1 && /^model:[[:space:]]*/{sub(/^model:[[:space:]]*/,""); print; exit}' "$1"
|
|
200
199
|
}
|
|
201
200
|
cost_failed=0
|
|
202
|
-
|
|
203
|
-
# Both the valid-cost enum and each tier's expected model are DERIVED from
|
|
204
|
-
# scripts/lib/cost-model.mjs in one node call, not hardcoded a second time here -- a repricing or
|
|
205
|
-
# a new tier is then a one-file edit instead of two files drifting apart.
|
|
206
|
-
#
|
|
207
|
-
# CAPTURE, CHECK, THEN EVAL -- deliberately not a bare `eval "$(node -e …)"`. A PARTIAL failure
|
|
208
|
-
# (resolveModel throws for one tier mid-forEach, after valid_costs and earlier ranks already
|
|
209
|
-
# printed) exits node non-zero, but that status is invisible to `eval`: the failing command
|
|
210
|
-
# substitution is only an argument being built for eval, not the exit status of a simple command,
|
|
211
|
-
# so `set -e` cannot see it and the script would report the cost block PASSED with that tier's
|
|
212
|
-
# model_for_* silently missing. Assigning to a plain variable first makes the substitution's exit
|
|
213
|
-
# status the ASSIGNMENT's status, which the explicit `||` below then catches -- and it must be
|
|
214
|
-
# explicit, not a bare `cost_env=$(node …)`: under `set -e` a bare assignment dies silently at the
|
|
215
|
-
# assignment, with no diagnostic reaching the user about which check was skipped.
|
|
216
|
-
cost_env="$(node -e '
|
|
217
|
-
import("./scripts/lib/cost-model.mjs").then((m) => {
|
|
218
|
-
console.log("valid_costs=" + JSON.stringify(m.VALID_COSTS.join("|")));
|
|
219
|
-
m.VALID_COSTS.forEach((c, idx) => {
|
|
220
|
-
console.log("rank_" + c + "=" + idx);
|
|
221
|
-
console.log("model_for_" + c + "=" + JSON.stringify(m.resolveModel(c, "claude-code")));
|
|
222
|
-
});
|
|
223
|
-
});
|
|
224
|
-
')" || { echo "cost-model derivation failed; cannot validate cost tiers" >&2; exit 1; }
|
|
225
|
-
eval "$cost_env"
|
|
226
|
-
|
|
227
|
-
# (a) `cost:` lives on agents only -- `cost:` sizes an agent instance being spawned, and a
|
|
228
|
-
# command isn't one, so `cost:` on a command binds to nothing. Every agents/*.md file must declare
|
|
229
|
-
# a `cost:` field (EXEMPTION:
|
|
230
|
-
# agents/somi.md, see below) and every value in it (split on comma, for graded units) must be one
|
|
231
|
-
# of scripts/lib/cost-model.mjs's VALID_COSTS. Every commands/*.md file must NOT declare one -- the
|
|
232
|
-
# front door spawns that command's paired agent at the agent's own declared tier instead.
|
|
233
|
-
#
|
|
234
|
-
# EXEMPTION: agents/somi.md. `cost:` on this one file was always decorative -- the host binds the
|
|
235
|
-
# model when the user picks this agent in its own UI, so nothing in this repo could ever act on
|
|
236
|
-
# the declaration. A field nothing can read is worse than no field: a future dispatcher would have
|
|
237
|
-
# to treat a decorative declaration as a trap. Named here, not silently skipped, so a later reader
|
|
238
|
-
# does not "fix" it back in.
|
|
239
|
-
#
|
|
240
|
-
# Commands must not declare `model:` either, for the same reason: Claude Code honoured a
|
|
241
|
-
# command's own `model:` for that command's own turn, which taught the repo that a command has a
|
|
242
|
-
# cost while every dispatch target's actual cost lives on the agent it Tasks. Agents keep
|
|
243
|
-
# `model:` -- it is still the mechanism Claude Code reads to pick a Tasked subagent's model, and
|
|
244
|
-
# the retirement gate's frontmatter exemption (tests/scripts/lib/retirement-gate.mjs) still applies
|
|
245
|
-
# to it.
|
|
246
201
|
for f in agents/*.md commands/*.md; do
|
|
247
202
|
[ -f "$f" ] || continue
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
commands/*.md)
|
|
251
|
-
if [ -n "$got" ]; then
|
|
252
|
-
echo "COST TIER ON COMMAND: $f declares cost: '$got' -- commands declare no cost: of their own; declare cost: on the agent this command Tasks instead" >&2
|
|
253
|
-
cost_failed=1
|
|
254
|
-
fi
|
|
255
|
-
declared_model="$(model_of "$f" | tr -d '[:space:]')"
|
|
256
|
-
if [ -n "$declared_model" ]; then
|
|
257
|
-
echo "MODEL ON COMMAND: $f declares model: '$declared_model' -- commands no longer declare a model of their own; the front door dispatches this command's paired agent at the agent's own declared cost/model instead" >&2
|
|
258
|
-
cost_failed=1
|
|
259
|
-
fi
|
|
260
|
-
continue
|
|
261
|
-
;;
|
|
262
|
-
agents/somi.md)
|
|
263
|
-
if [ -n "$got" ]; then
|
|
264
|
-
echo "COST TIER ON EXEMPT AGENT: $f declares cost: '$got' -- this file is exempt from cost: entirely (see the EXEMPTION comment above); remove the declaration" >&2
|
|
265
|
-
cost_failed=1
|
|
266
|
-
fi
|
|
267
|
-
continue
|
|
268
|
-
;;
|
|
269
|
-
esac
|
|
270
|
-
if [ -z "$got" ]; then
|
|
271
|
-
echo "COST TIER MISSING: $f has no 'cost:' field in frontmatter" >&2
|
|
203
|
+
if fm_has "$f" cost; then
|
|
204
|
+
echo "COST DECLARED: $f declares cost: -- default tiers live in scripts/lib/cost-defaults.mjs and cost.agents, not in frontmatter" >&2
|
|
272
205
|
cost_failed=1
|
|
273
|
-
continue
|
|
274
206
|
fi
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
stripped="$(echo "$got" | tr -d '[:space:]')"
|
|
279
|
-
case "$stripped" in
|
|
280
|
-
,*|*,|*,,*)
|
|
281
|
-
echo "COST TIER MALFORMED: $f has an empty cost value (leading/trailing/double comma) in '$got'" >&2
|
|
207
|
+
case "$f" in commands/*.md)
|
|
208
|
+
if fm_has "$f" model; then
|
|
209
|
+
echo "MODEL ON COMMAND: $f declares model: -- a command runs on the session's model; its agent's tier comes from the default table and the resolver" >&2
|
|
282
210
|
cost_failed=1
|
|
283
|
-
|
|
284
|
-
;;
|
|
211
|
+
fi ;;
|
|
285
212
|
esac
|
|
286
|
-
IFS=',' read -ra cost_values <<< "$got"
|
|
287
|
-
prev_rank=-1
|
|
288
|
-
for v in "${cost_values[@]}"; do
|
|
289
|
-
v="$(echo "$v" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')"
|
|
290
|
-
case "|$valid_costs|" in
|
|
291
|
-
*"|$v|"*)
|
|
292
|
-
rank_var="rank_$v"
|
|
293
|
-
rank="${!rank_var}"
|
|
294
|
-
;;
|
|
295
|
-
*)
|
|
296
|
-
echo "COST TIER INVALID: $f declares cost value '$v' (expected one of $valid_costs)" >&2
|
|
297
|
-
cost_failed=1
|
|
298
|
-
rank=-1
|
|
299
|
-
;;
|
|
300
|
-
esac
|
|
301
|
-
# Multi-value cost must be strictly ascending with no duplicates (low < medium < high) -- a
|
|
302
|
-
# second value that repeats or precedes the first is a hand-edit slip a reader will not
|
|
303
|
-
# notice, and the field is about to become a dispatch input.
|
|
304
|
-
if [ "$rank" -ge 0 ] && [ "$rank" -le "$prev_rank" ]; then
|
|
305
|
-
echo "COST TIER UNORDERED: $f declares '$got' -- multi-value cost must be strictly ascending ($valid_costs), no duplicates" >&2
|
|
306
|
-
cost_failed=1
|
|
307
|
-
fi
|
|
308
|
-
[ "$rank" -ge 0 ] && prev_rank="$rank"
|
|
309
|
-
done
|
|
310
213
|
done
|
|
311
214
|
|
|
312
|
-
# (
|
|
313
|
-
#
|
|
314
|
-
|
|
315
|
-
local f="$1" want="$2" got
|
|
316
|
-
got="$(cost_of "$f" | tr -d '[:space:]')"
|
|
317
|
-
if [ "$got" != "$want" ]; then
|
|
318
|
-
echo "COST TIER MISMATCH: $f cost is '$got', expected '$want'" >&2
|
|
319
|
-
cost_failed=1
|
|
320
|
-
fi
|
|
321
|
-
}
|
|
322
|
-
# low, medium: these three widen downward under the opt-in bar for `low` -- a builder-tier agent
|
|
323
|
-
# may declare `low` once it can still do a reduced-depth version of its job and its own output says
|
|
324
|
-
# so when it ran that way, even though the reduced depth would not hold up as the only tier it ever
|
|
325
|
-
# ran at. `low` only ever runs when the session ceiling resolves to `low` -- an explicit CLI flag or
|
|
326
|
-
# SOMI_COST_CEILING for this session, or inherited from a committed .somi/config.json or a saved
|
|
327
|
-
# state file that persists across sessions -- and the front door announces that ceiling and its
|
|
328
|
-
# source before work starts, so the quality drop is a trade the user can see, not one sprung on
|
|
329
|
-
# them. Each agent's own frontmatter and "Running at `low`" section name what that agent's
|
|
330
|
-
# reduced-depth pass keeps and what it trims -- read those, not this comment, for the specifics.
|
|
331
|
-
# refactorer still has no `high` member: a refactor too big for one diff is a different job, split
|
|
332
|
-
# out to the refactor-designer sibling below, not a third tier declared here. agents/somi.md is
|
|
333
|
-
# EXEMPT from this whole block (see the comment above the loop) -- it declares no cost: at all.
|
|
334
|
-
for a in planner coder refactorer; do
|
|
335
|
-
assert_cost "agents/$a.md" low,medium
|
|
336
|
-
done
|
|
337
|
-
# high-only: a wrong call here is paid for through everything downstream that builds on it, so a
|
|
338
|
-
# cheaper pass would be cheaper-and-wrong, not genuinely useful -- these never gain a lower member.
|
|
339
|
-
# atlas joins this set: its whole value is one high-quality read of the repository, paid once.
|
|
340
|
-
for a in discovery-analyst designer security-reviewer refactor-designer atlas; do
|
|
341
|
-
assert_cost "agents/$a.md" high
|
|
342
|
-
done
|
|
343
|
-
# medium, high: a lighter pass is genuinely useful under a capped ceiling, but the deepest work
|
|
344
|
-
# needs the strong model -- these grade ONE job over two depths, not two different jobs, so a
|
|
345
|
-
# blind ceiling pick is safe at either member. These are judges, not builders: a weaker judge
|
|
346
|
-
# doesn't produce weaker output, it produces a false pass with nothing downstream to catch what it
|
|
347
|
-
# missed, so the opt-in bar for `low` above does not extend to this set.
|
|
348
|
-
for a in reviewer architecture-reviewer test-strategist plan-reviewer sdlc-reviewer; do
|
|
349
|
-
assert_cost "agents/$a.md" medium,high
|
|
350
|
-
done
|
|
351
|
-
# medium-only, judge not builder: impact's deliverable is a proceed / design-first / reconsider
|
|
352
|
-
# verdict and, in diff mode, the review-lens selection -- a reduced-depth pass would undercount the
|
|
353
|
-
# blast radius and can return a false "proceed, small" with nothing downstream to re-check it, or
|
|
354
|
-
# drop a lens (security-reviewer, worst case) that then never runs elsewhere. Same false-pass
|
|
355
|
-
# failure that keeps the medium,high judges above off `low`, so impact stays off it too despite
|
|
356
|
-
# tracing an already-written call graph -- still no `high` member, since even its full-depth pass is
|
|
357
|
-
# mechanical tracing, not open-ended research.
|
|
358
|
-
assert_cost agents/impact.md medium
|
|
359
|
-
# medium-only: incident's mitigation-stage judgment (flag flip vs. revert vs. scoped patch, verified
|
|
360
|
-
# against the live symptom) and its debt-capture accounting both need full reasoning on every run --
|
|
361
|
-
# every job this agent accepts is, by construction, a live outage handed off after framing, so there
|
|
362
|
-
# is no lighter version of the call to make honestly.
|
|
363
|
-
assert_cost agents/incident.md medium
|
|
364
|
-
# graded over one job at two depths: mechanical aggregation of existing artifacts is already a
|
|
365
|
-
# correct, usable PR description at low; a fuller pass adds house-style matching, never required.
|
|
366
|
-
assert_cost agents/pr.md low,medium
|
|
367
|
-
|
|
368
|
-
# (c) `model:` and `cost:` state one fact twice -- assert `model:` resolves from the declared
|
|
369
|
-
# `cost:` set's TOP (highest, rightmost) member, deriving the expected model from resolveModel()
|
|
370
|
-
# rather than a second hardcoded table. Top-ness, not mere membership: a `model:` naming a lower
|
|
371
|
-
# declared member would silently run the agent at that lower tier regardless of ceiling -- the
|
|
372
|
-
# muted-reviewer failure `cost:` exists to prevent, re-opened by hand. `agents/` only -- commands
|
|
373
|
-
# declare neither `cost:` nor `model:` any more (asserted above), so there is nothing here to check
|
|
374
|
-
# them against.
|
|
215
|
+
# (c) Agents declare no `model:`. The tier-to-model step is the resolver's result alone, passed as the Task
|
|
216
|
+
# model argument; a launch that skips the resolver must inherit the session's model, so the session tier
|
|
217
|
+
# stays a ceiling. A declared `model:` would silently win over it (the cost-cap leak this check closes).
|
|
375
218
|
for f in agents/*.md; do
|
|
376
|
-
[ -
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
declared_model="$(model_of "$f" | tr -d '[:space:]')"
|
|
380
|
-
IFS=',' read -ra mv_values <<< "$got"
|
|
381
|
-
top="${mv_values[${#mv_values[@]}-1]}"
|
|
382
|
-
mv="model_for_$top"
|
|
383
|
-
expected="${!mv:-}"
|
|
384
|
-
# An unrecognized top value was already reported as COST TIER INVALID above -- nothing further
|
|
385
|
-
# to check here (no expected model to compare against).
|
|
386
|
-
if [ -n "$expected" ] && [ "$expected" != "$declared_model" ]; then
|
|
387
|
-
echo "MODEL/COST MISMATCH: $f declares cost: $got (top tier: $top) with model: $declared_model, expected '$expected' per scripts/lib/cost-model.mjs" >&2
|
|
388
|
-
cost_failed=1
|
|
389
|
-
fi
|
|
219
|
+
[ -z "$(model_of "$f" | tr -d '[:space:]')" ] && continue
|
|
220
|
+
echo "MODEL ON AGENT: $f declares model: -- remove it; an unresolved launch must inherit the session tier, and the resolver passes the model" >&2
|
|
221
|
+
cost_failed=1
|
|
390
222
|
done
|
|
391
223
|
|
|
392
224
|
if [ "$cost_failed" -ne 0 ]; then
|
|
393
225
|
exit 1
|
|
394
226
|
fi
|
|
227
|
+
bash tests/scripts/cost-defaults.sh
|
|
395
228
|
|
|
396
|
-
echo "==>
|
|
397
|
-
|
|
398
|
-
# cost: medium" claim about any of the three -- in a command's own explanatory prose, or in another
|
|
399
|
-
# agent's cross-reference -- understates what they can run at and drifts back to exactly the
|
|
400
|
-
# muted-capability bug this rework exists to close, silently and outside the frontmatter checks
|
|
401
|
-
# above (which only ever see the agent's OWN file, never a claim made about it elsewhere). Matched
|
|
402
|
-
# on the literal three-agent list, never a fourth: impact and incident are legitimately medium-only
|
|
403
|
-
# today, so a plain `cost: medium` claim about either is correct, not stale, and must not fire here.
|
|
404
|
-
stale_cost_claim_failed=0
|
|
405
|
-
if grep -rnE '(coder|planner|refactorer)[^\n]{0,80}cost: medium`' commands/ agents/ docs/ 2>/dev/null; then
|
|
406
|
-
echo "STALE COST CLAIM: coder/planner/refactorer all declare the widened 'cost: low, medium' -- the line(s) above still claim a plain 'cost: medium'" >&2
|
|
407
|
-
stale_cost_claim_failed=1
|
|
408
|
-
fi
|
|
409
|
-
if [ "$stale_cost_claim_failed" -ne 0 ]; then
|
|
410
|
-
exit 1
|
|
411
|
-
fi
|
|
229
|
+
echo "==> Agent names: stem == frontmatter name, somi- prefix, no stale ids..."
|
|
230
|
+
bash tests/scripts/agent-names.sh
|
|
412
231
|
|
|
413
232
|
echo "==> Validating command <-> somi-dispatch skill reference..."
|
|
414
233
|
# Every command that Tasks an agent directly resolves it through the same dispatch procedure the
|
|
@@ -424,6 +243,9 @@ if ! node tests/scripts/lib/dispatch-reference-gate.mjs commands agents; then
|
|
|
424
243
|
fi
|
|
425
244
|
bash tests/scripts/dispatch-reference-gate.sh
|
|
426
245
|
|
|
246
|
+
echo "==> Dispatch line: one canonical phrase, native agent_type dispatch, requested-low disclosure..."
|
|
247
|
+
bash tests/scripts/dispatch-line-gate.sh
|
|
248
|
+
|
|
427
249
|
echo "==> Validating the stale-vocabulary retirement gate..."
|
|
428
250
|
# scripts/validate.sh only ever asserted frontmatter VALUES above, never prose -- so a
|
|
429
251
|
# half-converted ruleset (frontmatter switched to the new cost field, prose still naming the
|
|
@@ -465,7 +287,7 @@ for f in \
|
|
|
465
287
|
templates/DESIGN.md.tmpl \
|
|
466
288
|
templates/ATLAS.md.tmpl \
|
|
467
289
|
templates/RCA.md.tmpl \
|
|
468
|
-
agents/designer.md \
|
|
290
|
+
agents/somi-designer.md \
|
|
469
291
|
commands/design.md \
|
|
470
292
|
commands/atlas.md \
|
|
471
293
|
commands/debug.md \
|
|
@@ -641,10 +463,10 @@ if [ "$contract_failed" -ne 0 ]; then
|
|
|
641
463
|
exit 1
|
|
642
464
|
fi
|
|
643
465
|
# pr is never seated in commands/review-panel.md (it is not a review lens), so the derived sweep
|
|
644
|
-
# above cannot cover it -- but its own contract is load-bearing (agents/pr.md's Write discipline
|
|
466
|
+
# above cannot cover it -- but its own contract is load-bearing (agents/somi-pr.md's Write discipline
|
|
645
467
|
# section is the only thing gating an ungated `gh pr create`), so assert it directly.
|
|
646
|
-
if ! grep -q '^## Write discipline' agents/pr.md; then
|
|
647
|
-
echo "MISSING WRITE CONTRACT: agents/pr.md has no '## Write discipline' section" >&2
|
|
468
|
+
if ! grep -q '^## Write discipline' agents/somi-pr.md; then
|
|
469
|
+
echo "MISSING WRITE CONTRACT: agents/somi-pr.md has no '## Write discipline' section" >&2
|
|
648
470
|
exit 1
|
|
649
471
|
fi
|
|
650
472
|
|
|
@@ -785,7 +607,7 @@ if ! grep -q 'somi-routing/SKILL.md#the-trivial-threshold' commands/code.md; the
|
|
|
785
607
|
fi
|
|
786
608
|
|
|
787
609
|
# Coder: Decision Ladder step sits between "Map the change" and "Implement"; no-plan path cites the threshold.
|
|
788
|
-
{ awk '/^[0-9]+\. \*\*Map the change/{m=NR} /^[0-9]+\. \*\*Climb the Decision Ladder/{l=NR} /^[0-9]+\. \*\*Implement the smallest/{i=NR} END{exit !(m && l>m && i>l)}' agents/coder.md && grep -q 'somi-routing/SKILL.md#the-trivial-threshold' agents/coder.md; } || { echo "FAIL: agents/coder.md needs the Decision Ladder between Map and Implement, and the trivial-threshold reference" >&2; exit 1; }
|
|
610
|
+
{ awk '/^[0-9]+\. \*\*Map the change/{m=NR} /^[0-9]+\. \*\*Climb the Decision Ladder/{l=NR} /^[0-9]+\. \*\*Implement the smallest/{i=NR} END{exit !(m && l>m && i>l)}' agents/somi-coder.md && grep -q 'somi-routing/SKILL.md#the-trivial-threshold' agents/somi-coder.md; } || { echo "FAIL: agents/somi-coder.md needs the Decision Ladder between Map and Implement, and the trivial-threshold reference" >&2; exit 1; }
|
|
789
611
|
echo "==> Creating coverage stub..."
|
|
790
612
|
mkdir -p coverage
|
|
791
613
|
printf 'TN:\nend_of_record\n' > coverage/lcov.info
|
|
@@ -139,7 +139,7 @@ API design is half security design. Cross-reference [`owasp-defense`](../owasp-d
|
|
|
139
139
|
- **SSRF** if the endpoint takes a URL.
|
|
140
140
|
- **PII** — don't return more than the caller needs.
|
|
141
141
|
|
|
142
|
-
## When to invoke `architecture-reviewer`
|
|
142
|
+
## When to invoke `somi-architecture-reviewer`
|
|
143
143
|
|
|
144
144
|
- The API introduces a new contract that other systems will depend on.
|
|
145
145
|
- The API changes dependency direction (e.g., service A now calls service B where it used to be the
|
|
@@ -133,7 +133,7 @@ rule is being enforced — don't work around the hook.
|
|
|
133
133
|
- **Hot paths.** Sometimes the readable version costs 10x and you need the gnarly one. Document why.
|
|
134
134
|
- **Generated code.** Don't fight your generator's conventions.
|
|
135
135
|
- **Existing code without coverage.** Don't "clean up" code you can't safely modify. Refactor under green
|
|
136
|
-
or escalate to [`test-strategist`](../testing-playbook/SKILL.md) first.
|
|
136
|
+
or escalate to [`somi-test-strategist`](../testing-playbook/SKILL.md) first.
|
|
137
137
|
|
|
138
138
|
## The reader test
|
|
139
139
|
|
|
@@ -6,7 +6,7 @@ description: Use when researching a software idea before specifying it — scann
|
|
|
6
6
|
# Market & competitive research
|
|
7
7
|
|
|
8
8
|
This skill powers the research half of the discovery phase. The owning agent is
|
|
9
|
-
[`discovery-analyst`](../../agents/discovery-analyst.md); the output of this research feeds directly
|
|
9
|
+
[`somi-discovery-analyst`](../../agents/somi-discovery-analyst.md); the output of this research feeds directly
|
|
10
10
|
into [`requirements-engineering`](../requirements-engineering/SKILL.md) — every finding should become
|
|
11
11
|
a requirement, a non-goal, or a risk, or it was wasted effort.
|
|
12
12
|
|
|
@@ -92,7 +92,7 @@ Known failure mode → Risk + mitigation (verify our approach doesn't inherit
|
|
|
92
92
|
Pricing/UX friction → scope/non-goal in the BRD
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
-
See the worked trace in [`discovery-analyst`](../../agents/discovery-analyst.md) ("Example of a good
|
|
95
|
+
See the worked trace in [`somi-discovery-analyst`](../../agents/somi-discovery-analyst.md) ("Example of a good
|
|
96
96
|
research-to-requirement trace").
|
|
97
97
|
|
|
98
98
|
## Anti-patterns to call out
|
|
@@ -129,9 +129,9 @@ does it end up?** When you load this skill, do this walk:
|
|
|
129
129
|
- `JSON.parse` of `req.body` with no schema; then field access without type checks.
|
|
130
130
|
- A redirect URL taken from a query parameter without an allowlist.
|
|
131
131
|
|
|
132
|
-
## When to invoke `security-reviewer`
|
|
132
|
+
## When to invoke `somi-security-reviewer`
|
|
133
133
|
|
|
134
|
-
Loading this skill means *you are aware*. It does not replace the [`security-reviewer`](../../agents/security-reviewer.md)
|
|
134
|
+
Loading this skill means *you are aware*. It does not replace the [`somi-security-reviewer`](../../agents/somi-security-reviewer.md)
|
|
135
135
|
agent. Invoke that agent when:
|
|
136
136
|
|
|
137
137
|
- The change introduces a new ingress or sink.
|
|
@@ -38,6 +38,10 @@ Nit with a confidence; a plan can be rejected.
|
|
|
38
38
|
- Phases are named for an outcome, not a mechanic ("implement", "test", "deploy" are not phases).
|
|
39
39
|
- Each iteration is about one reviewable PR, self-contained and orderable, and fits the loop's diff
|
|
40
40
|
and file caps. If it plainly cannot, the plan must split it.
|
|
41
|
+
- Iterations are not split finer than that. Two iterations that touch the same files and together fit
|
|
42
|
+
the caps are a finding (Minor; Major when three or more could merge) unless the plan states why the
|
|
43
|
+
split pays for its extra coder and review pass. Seen on 4.0.0: an 80-line one-file task planned as
|
|
44
|
+
five iterations, each with its own coder, diff gate and review.
|
|
41
45
|
- The `Files (approx)` list is believable against the scope: it names the files the change must
|
|
42
46
|
touch, including tests and docs, not a convenient subset. A list that is obviously short is the
|
|
43
47
|
usual cause of a later scope breach.
|
|
@@ -48,7 +52,7 @@ Nit with a confidence; a plan can be rejected.
|
|
|
48
52
|
- Each risk names a specific failure mode and a mitigation that could be carried out. Generic
|
|
49
53
|
platitudes ("scope may grow", "performance may suffer") are findings.
|
|
50
54
|
- Security implications are in the spec's security section with the phase that triggers
|
|
51
|
-
`security-reviewer`; contract-breaking changes name the version bump and deprecation path.
|
|
55
|
+
`somi-security-reviewer`; contract-breaking changes name the version bump and deprecation path.
|
|
52
56
|
|
|
53
57
|
### 5. Acceptance criteria can fail
|
|
54
58
|
- Every criterion states evidence of a **kind** (a named test, a command and its expected output,
|
|
@@ -208,6 +208,6 @@ substituting a different task (root-cause now, refuse to bump).
|
|
|
208
208
|
## When to escalate
|
|
209
209
|
|
|
210
210
|
n/a — this is cross-cutting reasoning/voice craft applied on every response, not a domain with a
|
|
211
|
-
specialist agent to hand off to (unlike, say, `owasp-defense` → `security-reviewer`). There is
|
|
211
|
+
specialist agent to hand off to (unlike, say, `owasp-defense` → `somi-security-reviewer`). There is
|
|
212
212
|
nothing to escalate to; apply it inline. Named explicitly so the absence reads as a decision, not
|
|
213
213
|
an oversight.
|
|
@@ -9,7 +9,7 @@ The collaboration and priority rules in [`rules/50-collaboration.md`](../../rule
|
|
|
9
9
|
and [`rules/00-priorities.md`](../../rules/00-priorities.md) are the always-on floor. This skill adds
|
|
10
10
|
**operational depth** for the discovery phase: how to write a requirement that can't be misread, how
|
|
11
11
|
to split documents, and how to keep everything traceable. The owning agent is
|
|
12
|
-
[`discovery-analyst`](../../agents/discovery-analyst.md); load this skill when you are *authoring or
|
|
12
|
+
[`somi-discovery-analyst`](../../agents/somi-discovery-analyst.md); load this skill when you are *authoring or
|
|
13
13
|
reviewing* requirements/design docs under `.somi/rd/<slug>/`.
|
|
14
14
|
|
|
15
15
|
Pair it with [`market-research`](../market-research/SKILL.md) (where requirements come from),
|
|
@@ -122,7 +122,7 @@ good default:
|
|
|
122
122
|
- For a **small, well-understood internal tool**, a single SRS may absorb the FRD — don't force five
|
|
123
123
|
documents. Omit with a reason in `README.md`.
|
|
124
124
|
- For work that already has a settled spec, skip discovery and hand to the
|
|
125
|
-
[`planner`](../../agents/planner.md).
|
|
125
|
+
[`somi-planner`](../../agents/somi-planner.md).
|
|
126
126
|
- Don't gold-plate NFRs for a prototype — state the targets that matter and explicitly defer the
|
|
127
127
|
rest.
|
|
128
128
|
|
|
@@ -130,7 +130,7 @@ good default:
|
|
|
130
130
|
|
|
131
131
|
- **To the user (verification protocol)** — any requirement- or direction-shaping decision: target
|
|
132
132
|
persona, scope boundary, build-vs-integrate, an expensive-to-reverse architectural call.
|
|
133
|
-
- **To the [`planner`](../../agents/planner.md)** — once the SRS/SDD are ready; the planner turns
|
|
133
|
+
- **To the [`somi-planner`](../../agents/somi-planner.md)** — once the SRS/SDD are ready; the planner turns
|
|
134
134
|
direction into detailed, phased design. Don't do its job in the SDD.
|
|
135
135
|
- **To [`threat-modeling`](../threat-modeling/SKILL.md) / [`owasp-defense`](../owasp-defense/SKILL.md)**
|
|
136
136
|
— when the product introduces a real attack surface; the security NFRs and trust boundaries belong
|
|
@@ -139,5 +139,5 @@ SOLID is a response to real change pressure. If there's no pressure, the princip
|
|
|
139
139
|
## When to escalate
|
|
140
140
|
|
|
141
141
|
If you spot a SOLID violation that's deeper than this skill can fix — for example, the dependency
|
|
142
|
-
direction is wrong throughout a layer — escalate to [`architecture-reviewer`](../../agents/architecture-reviewer.md)
|
|
142
|
+
direction is wrong throughout a layer — escalate to [`somi-architecture-reviewer`](../../agents/somi-architecture-reviewer.md)
|
|
143
143
|
rather than patching locally.
|