@skathio/somi 3.1.1 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/.claude/settings.json +13 -0
  2. package/.claude-plugin/marketplace.json +2 -2
  3. package/.claude-plugin/plugin.json +1 -1
  4. package/.copilot-extension/extension.json +1 -1
  5. package/.copilot-extension/marketplace.json +2 -2
  6. package/README.md +34 -24
  7. package/VERSION +1 -1
  8. package/agents/{architecture-reviewer.md → somi-architecture-reviewer.md} +10 -11
  9. package/agents/{atlas.md → somi-atlas.md} +3 -5
  10. package/agents/{coder.md → somi-coder.md} +26 -23
  11. package/agents/{designer.md → somi-designer.md} +9 -11
  12. package/agents/{discovery-analyst.md → somi-discovery-analyst.md} +7 -9
  13. package/agents/{impact.md → somi-impact.md} +6 -8
  14. package/agents/{incident.md → somi-incident.md} +2 -4
  15. package/agents/{plan-reviewer.md → somi-plan-reviewer.md} +9 -11
  16. package/agents/{planner.md → somi-planner.md} +16 -24
  17. package/agents/{pr.md → somi-pr.md} +2 -4
  18. package/agents/{refactor-designer.md → somi-refactor-designer.md} +14 -15
  19. package/agents/{refactorer.md → somi-refactorer.md} +11 -12
  20. package/agents/{reviewer.md → somi-reviewer.md} +8 -7
  21. package/agents/{sdlc-reviewer.md → somi-sdlc-reviewer.md} +8 -10
  22. package/agents/{security-reviewer.md → somi-security-reviewer.md} +8 -8
  23. package/agents/{test-strategist.md → somi-test-strategist.md} +4 -6
  24. package/agents/somi.md +25 -12
  25. package/commands/adopt.md +9 -10
  26. package/commands/architecture-review.md +4 -5
  27. package/commands/atlas.md +3 -3
  28. package/commands/code-loop.md +38 -14
  29. package/commands/code-parallel.md +4 -4
  30. package/commands/code.md +24 -15
  31. package/commands/debug.md +8 -9
  32. package/commands/design.md +14 -15
  33. package/commands/discover.md +11 -12
  34. package/commands/impact.md +2 -2
  35. package/commands/incident.md +3 -4
  36. package/commands/plan-loop.md +16 -12
  37. package/commands/plan.md +15 -16
  38. package/commands/pr.md +2 -2
  39. package/commands/refactor-design.md +10 -11
  40. package/commands/refactor.md +7 -8
  41. package/commands/release-readiness.md +6 -7
  42. package/commands/review-panel.md +24 -23
  43. package/commands/review.md +14 -14
  44. package/commands/security-review.md +8 -7
  45. package/commands/ship-loop.md +107 -28
  46. package/commands/ship.md +6 -6
  47. package/commands/somi-config.md +138 -0
  48. package/commands/test-strategy.md +3 -4
  49. package/commands/upgrade.md +4 -5
  50. package/examples/code-review-example.md +1 -1
  51. package/examples/discovery-example.md +1 -1
  52. package/examples/feature-plan-example.md +2 -2
  53. package/hooks/hooks.json +14 -1
  54. package/hooks/lib/common.mjs +71 -9
  55. package/hooks/post-tool/audit-log.mjs +3 -2
  56. package/hooks/pre-tool/block-secret-writes.mjs +12 -11
  57. package/hooks/pre-tool/guard-cost-lowering.mjs +192 -0
  58. package/hooks/pre-tool/guard-protected-paths.mjs +13 -3
  59. package/hooks/session-start/detect-repo-instructions.mjs +27 -2
  60. package/hooks/session-start/ensure-default-config.mjs +113 -0
  61. package/package.json +1 -1
  62. package/rules/00-priorities.md +1 -1
  63. package/rules/30-security-owasp.md +1 -1
  64. package/rules/50-collaboration.md +9 -6
  65. package/rules/CLAUDE.md +11 -10
  66. package/scripts/lib/agent-info.mjs +85 -0
  67. package/scripts/lib/agent-registry.mjs +92 -0
  68. package/scripts/lib/config-files.mjs +145 -0
  69. package/scripts/lib/cost-ceiling.mjs +190 -179
  70. package/scripts/lib/cost-config-edit.mjs +102 -0
  71. package/scripts/lib/cost-config.mjs +64 -0
  72. package/scripts/lib/cost-defaults.mjs +51 -0
  73. package/scripts/lib/cost-lowering.mjs +89 -0
  74. package/scripts/lib/cost-model.mjs +37 -22
  75. package/scripts/lib/dispatch-resolver.mjs +59 -50
  76. package/scripts/lib/loop-diff.mjs +96 -0
  77. package/scripts/lib/loop-dispatch.mjs +19 -0
  78. package/scripts/lib/loop-review.mjs +52 -0
  79. package/scripts/lib/run-budget.mjs +28 -0
  80. package/scripts/lib/size-tier.mjs +184 -0
  81. package/scripts/lib/tier-record.mjs +82 -0
  82. package/scripts/size-budget-overrides.json +7 -15
  83. package/scripts/somi-check.mjs +4 -3
  84. package/scripts/somi-config.mjs +421 -0
  85. package/scripts/somi-dispatch.mjs +1 -1
  86. package/scripts/somi-loop.mjs +75 -99
  87. package/scripts/somi-mcp.mjs +135 -14
  88. package/scripts/somi-tier.mjs +393 -0
  89. package/scripts/validate.sh +57 -215
  90. package/skills/api-design/SKILL.md +1 -1
  91. package/skills/clean-code/SKILL.md +1 -1
  92. package/skills/market-research/SKILL.md +2 -2
  93. package/skills/owasp-defense/SKILL.md +2 -2
  94. package/skills/plan-review/SKILL.md +5 -1
  95. package/skills/reasoning-craft/SKILL.md +1 -1
  96. package/skills/requirements-engineering/SKILL.md +3 -3
  97. package/skills/solid-principles/SKILL.md +1 -1
  98. package/skills/somi-dispatch/SKILL.md +104 -109
  99. package/skills/somi-routing/SKILL.md +88 -1
  100. package/skills/testing-playbook/SKILL.md +2 -2
  101. package/skills/threat-modeling/SKILL.md +3 -3
  102. package/templates/BRIEF.md.tmpl +2 -2
  103. package/templates/DESIGN.md.tmpl +1 -1
  104. package/templates/DOD.md.tmpl +2 -2
  105. package/templates/PHASE.md.tmpl +2 -2
  106. package/templates/RCA.md.tmpl +1 -1
  107. package/templates/REVIEW.md.tmpl +3 -2
  108. package/templates/SDD.md.tmpl +1 -1
  109. package/templates/SPEC.md.tmpl +1 -1
  110. package/templates/TDD.md.tmpl +1 -1
  111. package/tests/hooks/cases/block-secret-writes.json +130 -17
  112. package/tests/hooks/cases/detect-repo-instructions.json +22 -1
  113. package/tests/hooks/cases/guard-protected-paths.json +175 -25
  114. package/tests/scripts/agent-model-frontmatter.sh +38 -0
  115. package/tests/scripts/agent-names.sh +77 -0
  116. package/tests/scripts/check-frontmatter.sh +1 -1
  117. package/tests/scripts/checkpoint-gate.sh +44 -3
  118. package/tests/scripts/convergence-runner.sh +10 -6
  119. package/tests/scripts/cost-ceiling.sh +127 -215
  120. package/tests/scripts/cost-defaults.sh +128 -0
  121. package/tests/scripts/cost-hardcap.sh +338 -0
  122. package/tests/scripts/cost-lowering.sh +261 -0
  123. package/tests/scripts/cost-model.sh +18 -14
  124. package/tests/scripts/dispatch-guard.sh +7 -7
  125. package/tests/scripts/dispatch-line-gate.sh +61 -0
  126. package/tests/scripts/dispatch-reference-gate.sh +13 -13
  127. package/tests/scripts/ensure-default-config.sh +162 -0
  128. package/tests/scripts/eval-runner.sh +9 -9
  129. package/tests/scripts/evals-packaging.sh +127 -20
  130. package/tests/scripts/fixtures/size-tier-cases.json +87 -0
  131. package/tests/scripts/global-config.sh +167 -0
  132. package/tests/scripts/goldens/loop-state-done.json +1 -1
  133. package/tests/scripts/goldens/somi-loop.json +3 -3
  134. package/tests/scripts/lib/agent-registry-tests.mjs +95 -0
  135. package/tests/scripts/lib/brief-only-guard.mjs +27 -0
  136. package/tests/scripts/lib/checkpoint-gate.mjs +40 -3
  137. package/tests/scripts/lib/dispatch-reference-gate.mjs +5 -5
  138. package/tests/scripts/lib/retirement-gate.mjs +7 -2
  139. package/tests/scripts/lib/ship-loop-sizing-guard.mjs +52 -0
  140. package/tests/scripts/lib/site-roadmap-gate.mjs +64 -0
  141. package/tests/scripts/lib/size-tier-drift.mjs +74 -0
  142. package/tests/scripts/lib/somi-mcp-config-tests.mjs +92 -0
  143. package/tests/scripts/lib/somi-mcp-tests.mjs +66 -28
  144. package/tests/scripts/lib/somi-mcp-tier-tests.mjs +64 -0
  145. package/tests/scripts/retirement-gate.sh +19 -0
  146. package/tests/scripts/review-panel-seats.sh +2 -2
  147. package/tests/scripts/run.sh +95 -0
  148. package/tests/scripts/site-roadmap-gate.sh +76 -0
  149. package/tests/scripts/size-tier.sh +562 -0
  150. package/tests/scripts/somi-agent-dispatch-contract.sh +20 -11
  151. package/tests/scripts/somi-config.sh +286 -0
  152. package/tests/scripts/somi-dispatch.sh +150 -98
  153. package/tests/scripts/somi-mcp.sh +2 -0
@@ -3,8 +3,8 @@
3
3
  # to for "which tier and model should this agent run at, right now" -- the first real call site for
4
4
  # decideDispatch/modelForDispatch (nothing before this composed them together outside a test).
5
5
  #
6
- # Exercises: resolution against real shipped agents at every representative declared shape
7
- # (high-only, medium+high, low+medium) across all three ceilings; ceiling_source surfacing each of
6
+ # Exercises: resolution against real shipped agents at every representative default tier
7
+ # (high, medium) across all three ceilings; ceiling_source surfacing each of
8
8
  # cli/env/config/state/default; an unmapped host resolving to model: null rather than a guess; the
9
9
  # project's `.somi/config.json` `cost.mapping` override (an unmapped host gaining a mapped model, a
10
10
  # single claude-code tier overridden, a __proto__ key rejected, a malformed mapping -- missing tier
@@ -12,13 +12,12 @@
12
12
  # --agent rejected before any file is read, in either direction (`../` and a bare `/`); the somi
13
13
  # exemption and an unknown agent each failing with their own distinct, clear, non-zero exit code;
14
14
  # an empty or missing value for --host/--ceiling/--agent rejected outright rather than falling
15
- # through to a silent default; and the three exit codes (usage / unknown agent / malformed
16
- # declaration) staying distinct from each other and from success.
15
+ # through to a silent default; and the three exit codes (usage / unknown agent / no tier source) staying distinct from each other and from success.
17
16
  #
18
17
  # Every invocation is scoped to its OWN throwaway CLAUDE_PROJECT_DIR, so the real repo's
19
- # .somi/somi-state/ceiling.json is never read or written by this suite -- agent frontmatter itself
20
- # is still read from the REAL agents/ directory (the resolver's install root, not the project
21
- # root), which is the behavior under test, not something to fake.
18
+ # .somi/somi-state/ceiling.json is never read or written by this suite -- agent FILES are still looked up in
19
+ # the REAL agents/ directory (the resolver's install root, not the project root), while each agent's
20
+ # tier comes from scripts/lib/cost-defaults.mjs -- the behavior under test, not something to fake.
22
21
  set -uo pipefail
23
22
 
24
23
  ROOT_REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
@@ -51,59 +50,78 @@ expect_exit() { # $1 = name, $2 = expected exit code, $3 = project root, remaini
51
50
  if [ "$got" = "$want" ]; then ok "$name"; else bad "$name (expected exit $want, got $got)"; fi
52
51
  }
53
52
 
54
- # --- high-only (`designer`, cost: high): no cheaper mode exists, so every ceiling still runs high -
55
- for c in low medium high; do
56
- out="$(run "$(fresh)" resolve --agent designer --ceiling "$c")"
57
- check "designer (high-only) under ceiling=$c: tier is high -- no cheaper mode to select" \
58
- "$(field "$out" tier)" "high"
59
- check "designer under ceiling=$c: model is opus" "$(field "$out" model)" "opus"
53
+ # --- high-only (`somi-designer`, cost: high): the ceiling is a hard cap, so it runs AT the ceiling and
54
+ # is reported degraded when that is below its default tier high ----------------------------------------
55
+ for spec in low:haiku:true medium:sonnet:true high:opus:false; do
56
+ IFS=: read -r c m d <<<"$spec"
57
+ out="$(run "$(fresh)" resolve --agent somi-designer --ceiling "$c")"
58
+ check "designer (high-only) under ceiling=$c: tier is the ceiling (hard cap)" "$(field "$out" tier)" "$c"
59
+ check "designer under ceiling=$c: model is $m" "$(field "$out" model)" "$m"
60
+ check "designer under ceiling=$c: degraded is $d, tier_source ceiling" \
61
+ "$(field "$out" degraded)/$(field "$out" tier_source)" "$d/ceiling"
60
62
  done
61
-
62
- # --- graded medium/high (`reviewer`): ceiling picks the highest permitted member -----------------
63
- out="$(run "$(fresh)" resolve --agent reviewer --ceiling low)"
64
- check "reviewer (medium,high) under ceiling=low: no member fits, selects cheapest (medium)" \
65
- "$(field "$out" tier)" "medium"
66
- out="$(run "$(fresh)" resolve --agent reviewer --ceiling medium)"
63
+ # An agent override wins over the ceiling, through the CLI.
64
+ R_OVR="$(fresh)"; mkdir -p "$R_OVR/.somi"
65
+ printf '{"cost": {"ceiling": "low", "agents": {"somi-designer": "high"}}}\n' > "$R_OVR/.somi/config.json"
66
+ out="$(run "$R_OVR" resolve --agent somi-designer)"
67
+ check "cost.agents.somi-designer=high beats ceiling=low: tier high, model opus, tier_source override" \
68
+ "$(field "$out" tier)/$(field "$out" model)/$(field "$out" tier_source)" "high/opus/override"
69
+
70
+ # --- default high, also acceptable at medium (`somi-reviewer`): the tier is the ceiling itself; degraded when below the default -
71
+ out="$(run "$(fresh)" resolve --agent somi-reviewer --ceiling low)"
72
+ check "reviewer (default high) under ceiling=low: clamped to the ceiling (low), degraded" \
73
+ "$(field "$out" tier)/$(field "$out" degraded)" "low/true"
74
+ out="$(run "$(fresh)" resolve --agent somi-reviewer --ceiling medium)"
67
75
  check "reviewer under ceiling=medium: selects medium" "$(field "$out" tier)" "medium"
68
- out="$(run "$(fresh)" resolve --agent reviewer --ceiling high)"
76
+ out="$(run "$(fresh)" resolve --agent somi-reviewer --ceiling high)"
69
77
  check "reviewer under ceiling=high: selects high" "$(field "$out" tier)" "high"
70
78
 
71
- # --- graded low/medium (`coder`): the opt-in `low` bar's shipped example ------------------------
72
- out="$(run "$(fresh)" resolve --agent coder --ceiling low)"
73
- check "coder (low,medium) under ceiling=low: selects low" "$(field "$out" tier)" "low"
79
+ # --- default medium, opt-in low (`somi-coder`): the opt-in `low` bar's shipped example ------------------------
80
+ out="$(run "$(fresh)" resolve --agent somi-coder --ceiling low)"
81
+ check "coder (default medium) under ceiling=low: selects low" "$(field "$out" tier)" "low"
74
82
  check "coder under ceiling=low: model is haiku" "$(field "$out" model)" "haiku"
75
- out="$(run "$(fresh)" resolve --agent coder --ceiling medium)"
83
+ out="$(run "$(fresh)" resolve --agent somi-coder --ceiling medium)"
76
84
  check "coder under ceiling=medium: selects medium" "$(field "$out" tier)" "medium"
77
- out="$(run "$(fresh)" resolve --agent coder --ceiling high)"
78
- check "coder under ceiling=high: selects its own top member (medium), never invents high" \
79
- "$(field "$out" tier)" "medium"
80
- check "coder under ceiling=high: model is sonnet, not opus" "$(field "$out" model)" "sonnet"
85
+ out="$(run "$(fresh)" resolve --agent somi-coder --ceiling high)"
86
+ check "coder under ceiling=high: runs at the ceiling (high), not degraded" \
87
+ "$(field "$out" tier)/$(field "$out" degraded)/$(field "$out" tier_source)" "high/false/ceiling"
88
+ check "coder under ceiling=high: model is opus" "$(field "$out" model)" "opus"
81
89
 
82
- # --- ceiling_source covers all five origins -- this is what lets a dispatcher announce a `low`
90
+ # --- ceiling_source covers all of cli/env/config/state/default -- this is what lets a dispatcher announce a `low`
83
91
  # ceiling honestly, by its real source, not just its bare value. -----------------------------------
84
- out="$(run "$(fresh)" resolve --agent coder)"
92
+ out="$(run "$(fresh)" resolve --agent somi-coder)"
85
93
  check "no config, no env, no --ceiling: ceiling_source is default" "$(field "$out" ceiling_source)" "default"
86
94
 
87
- out="$(run "$(fresh)" resolve --agent coder --ceiling medium)"
95
+ out="$(run "$(fresh)" resolve --agent somi-coder --ceiling medium)"
88
96
  check "explicit --ceiling: ceiling_source is cli" "$(field "$out" ceiling_source)" "cli"
89
97
 
90
98
  R_ENV="$(fresh)"
91
- out="$(CLAUDE_PROJECT_DIR="$R_ENV" SOMI_COST_CEILING=medium node "$CLI" resolve --agent coder)"
99
+ out="$(CLAUDE_PROJECT_DIR="$R_ENV" SOMI_COST_CEILING=medium node "$CLI" resolve --agent somi-coder)"
92
100
  check "SOMI_COST_CEILING set, no --ceiling: ceiling_source is env" "$(field "$out" ceiling_source)" "env"
93
101
 
94
102
  R_CFG="$(fresh)"; mkdir -p "$R_CFG/.somi"
95
103
  printf '{"cost": {"ceiling": "low"}}\n' > "$R_CFG/.somi/config.json"
96
- out="$(run "$R_CFG" resolve --agent coder)"
97
- check "bootstrap from .somi/config.json's cost.ceiling: ceiling_source is config" \
98
- "$(field "$out" ceiling_source)" "config"
99
- out2="$(run "$R_CFG" resolve --agent coder)"
100
- check "a second call against the same project root: ceiling_source is state, not config again" \
101
- "$(field "$out2" ceiling_source)" "state"
104
+ out="$(run "$R_CFG" resolve --agent somi-coder)"
105
+ check "cost.ceiling in .somi/config.json: ceiling_source is config" "$(field "$out" ceiling_source)" "config"
106
+ out2="$(run "$R_CFG" resolve --agent somi-coder)"
107
+ check "a second call is config again (config is read live, not remembered as state)" \
108
+ "$(field "$out2" ceiling_source)/$(field "$out2" ceiling_origin)" "config/config"
109
+ printf '{"cost": {"ceiling": "high"}}\n' > "$R_CFG/.somi/config.json"
110
+ out="$(run "$R_CFG" resolve --agent somi-coder)"
111
+ check "editing the config between two calls moves the ceiling" "$(field "$out" ceiling)/$(field "$out" tier)" "high/high"
112
+ out="$(run "$R_CFG" resolve --agent somi-coder --ceiling low)"
113
+ check "--ceiling beats the config and persists" "$(field "$out" ceiling_source)/$(field "$out" ceiling)" "cli/low"
114
+ rm "$R_CFG/.somi/config.json"
115
+ out="$(run "$R_CFG" resolve --agent somi-coder)"
116
+ check "with the config gone, the persisted CLI ceiling is state with origin cli" \
117
+ "$(field "$out" ceiling_source)/$(field "$out" ceiling_origin)/$(field "$out" ceiling)" "state/cli/low"
118
+ out="$(run "$(fresh)" resolve --agent somi-coder)"
119
+ check "no config, no state: the default ceiling is medium" "$(field "$out" ceiling)/$(field "$out" tier)" "medium/medium"
102
120
 
103
121
  # --- unmapped host: model is null (let the host choose), never a guessed name -------------------
104
- out="$(run "$(fresh)" resolve --agent coder --host some-future-host)"
122
+ out="$(run "$(fresh)" resolve --agent somi-coder --host some-future-host --ceiling high)"
105
123
  check "unmapped host: model is null" "$(field "$out" model)" "null"
106
- check "unmapped host: tier still resolves normally" "$(field "$out" tier)" "medium"
124
+ check "unmapped host: tier still resolves normally (the ceiling, high)" "$(field "$out" tier)" "high"
107
125
 
108
126
  # --- .somi/config.json's cost.mapping override: how a host SoMi doesn't map (e.g. Copilot) is told
109
127
  # which of ITS OWN models is low/medium/high -- reused via readCostConfig, merged via
@@ -126,18 +144,18 @@ expect_malformed() { # $1=name $2=want-exit-code $3=proj, remaining = CLI args
126
144
  }
127
145
 
128
146
  # Otherwise-unmapped host, mapped by the project: resolves to it for the tier actually selected
129
- # (coder is low,medium; default ceiling high -> its own top member, medium). Without the mapping,
147
+ # (--ceiling high -> coder resolves to high, so the high entry is used). Without the mapping,
130
148
  # same as any unmapped host: null.
131
149
  R_MAP="$(fresh)"; mkdir -p "$R_MAP/.somi"
132
150
  printf '{"cost": {"mapping": {"copilot": {"low": "gpt-5-mini", "medium": "gpt-5", "high": "gpt-5-pro"}}}}\n' \
133
151
  > "$R_MAP/.somi/config.json"
134
- out="$(run "$R_MAP" resolve --agent coder --host copilot)"
135
- check "copilot mapped via project config: model is the mapped medium entry" "$(field "$out" model)" "gpt-5"
136
- out="$(run "$(fresh)" resolve --agent coder --host copilot)"
152
+ out="$(run "$R_MAP" resolve --agent somi-coder --host copilot --ceiling high)"
153
+ check "copilot mapped via project config: model is the mapped high entry" "$(field "$out" model)" "gpt-5-pro"
154
+ out="$(run "$(fresh)" resolve --agent somi-coder --host copilot)"
137
155
  check "copilot with no project mapping: model is null" "$(field "$out" model)" "null"
138
156
 
139
157
  # #32: `enforced` is true only when a concrete model id was resolved; otherwise false with a reason.
140
- out="$(run "$(fresh)" resolve --agent designer --host copilot)"
158
+ out="$(run "$(fresh)" resolve --agent somi-designer --host copilot)"
141
159
  check "copilot, no mapping, high agent: model is null" "$(field "$out" model)" "null"
142
160
  check "copilot, no mapping: enforced is false" "$(field "$out" enforced)" "false"
143
161
  case "$(field "$out" reason)" in
@@ -148,11 +166,11 @@ case "$(field "$out" reason)" in
148
166
  *"no model mapping for host copilot"*) ok "copilot, no mapping: reason names the host" ;;
149
167
  *) bad "copilot, no mapping: reason names the host (got '$(field "$out" reason)')" ;;
150
168
  esac
151
- out="$(run "$R_MAP" resolve --agent designer --host copilot)"
169
+ out="$(run "$R_MAP" resolve --agent somi-designer --host copilot --ceiling high)"
152
170
  check "copilot with a config mapping: model is the mapped high entry" "$(field "$out" model)" "gpt-5-pro"
153
171
  check "copilot with a config mapping: enforced is true" "$(field "$out" enforced)" "true"
154
172
  check "copilot with a config mapping: no reason key" "$(field "$out" reason)" "undefined"
155
- out="$(run "$(fresh)" resolve --agent designer --host claude-code)"
173
+ out="$(run "$(fresh)" resolve --agent somi-designer --host claude-code)"
156
174
  check "claude-code default: enforced is true" "$(field "$out" enforced)" "true"
157
175
 
158
176
  # #32: the dispatch skill keeps the honesty rule -- a text-level guard so it cannot be edited away.
@@ -175,7 +193,7 @@ for c in "$ROOT_REPO"/commands/*.md "$ROOT_REPO"/agents/*.md; do
175
193
  done
176
194
  check "every command/agent naming 'dispatched at cost:' also names the unenforced 'requested cost' line" "$unguarded" ""
177
195
  trim_missing=""
178
- for a in coder planner refactorer; do
196
+ for a in somi-coder somi-planner somi-refactorer; do
179
197
  flat="$(tr '\n' ' ' < "$ROOT_REPO/agents/$a.md" | tr -s ' ')"
180
198
  case "$flat" in *'dispatched at cost: low` or `requested cost: low'*) ;; *) trim_missing="$trim_missing $a" ;; esac
181
199
  done
@@ -183,20 +201,20 @@ check "coder/planner/refactorer trim on 'requested cost: low' as well as 'dispat
183
201
  check "the unenforced briefing line reads 'no mapped model' everywhere" \
184
202
  "$(grep -rlE 'running on the host model' "$ROOT_REPO/commands" "$ROOT_REPO/agents" "$ROOT_REPO/skills" "$ROOT_REPO/docs" | tr '\n' ' ')" ""
185
203
 
186
- # A project mapping can override a single claude-code tier; designer (cost: high, no cheaper mode)
187
- # always selects high, isolating the override to exactly the tier it names.
204
+ # A project mapping can override a single claude-code tier; designer at --ceiling high selects high,
205
+ # isolating the override to exactly the tier it names.
188
206
  R_OVERRIDE="$(fresh)"; mkdir -p "$R_OVERRIDE/.somi"
189
207
  printf '{"cost": {"mapping": {"claude-code": {"low": "haiku", "medium": "sonnet", "high": "custom-opus"}}}}\n' \
190
208
  > "$R_OVERRIDE/.somi/config.json"
191
- out="$(run "$R_OVERRIDE" resolve --agent designer)"
209
+ out="$(run "$R_OVERRIDE" resolve --agent somi-designer --ceiling high)"
192
210
  check "project mapping overrides claude-code's high tier" "$(field "$out" model)" "custom-opus"
193
211
 
194
212
  # A __proto__ key is rejected outright (mergeHostMapping's denylist) -- this is the PROJECT's own
195
213
  # config.json being malformed, exit 67, never merged.
196
214
  R_PROTO="$(fresh)"; mkdir -p "$R_PROTO/.somi"
197
215
  printf '{"cost": {"mapping": {"__proto__": {"low": "x"}}}}\n' > "$R_PROTO/.somi/config.json"
198
- expect_malformed "a __proto__ key in cost.mapping" 67 "$R_PROTO" resolve --agent coder
199
- proto_err="$(run "$R_PROTO" resolve --agent coder 2>&1 >/dev/null)"
216
+ expect_malformed "a __proto__ key in cost.mapping" 67 "$R_PROTO" resolve --agent somi-coder
217
+ proto_err="$(run "$R_PROTO" resolve --agent somi-coder 2>&1 >/dev/null)"
200
218
  case "$proto_err" in
201
219
  *"__proto__"*) ok "the __proto__ rejection names the disallowed key" ;;
202
220
  *) bad "the __proto__ rejection does not name the key (got: $proto_err)" ;;
@@ -210,8 +228,8 @@ esac
210
228
  # broken in the STRUCTURAL sense mergeHostMapping checks, but these two are still its own data).
211
229
  R_PARTIAL="$(fresh)"; mkdir -p "$R_PARTIAL/.somi"
212
230
  printf '{"cost": {"mapping": {"copilot": {"low": "gpt-5-mini"}}}}\n' > "$R_PARTIAL/.somi/config.json"
213
- expect_malformed "a mapped host missing the selected tier" 67 "$R_PARTIAL" resolve --agent coder --host copilot
214
- partial_msg="$(run "$R_PARTIAL" resolve --agent coder --host copilot 2>&1 >/dev/null || true)"
231
+ expect_malformed "a mapped host missing the selected tier" 67 "$R_PARTIAL" resolve --agent somi-coder --host copilot
232
+ partial_msg="$(run "$R_PARTIAL" resolve --agent somi-coder --host copilot 2>&1 >/dev/null || true)"
215
233
  case "$partial_msg" in
216
234
  *".somi/config.json cost.mapping"*) ok "the missing-tier error names .somi/config.json cost.mapping" ;;
217
235
  *) bad "the missing-tier error does not name .somi/config.json cost.mapping (got: $partial_msg)" ;;
@@ -220,8 +238,8 @@ esac
220
238
  R_NONSTRING="$(fresh)"; mkdir -p "$R_NONSTRING/.somi"
221
239
  printf '{"cost": {"mapping": {"copilot": {"low": "gpt-5-mini", "medium": 5, "high": "gpt-5-pro"}}}}\n' \
222
240
  > "$R_NONSTRING/.somi/config.json"
223
- expect_malformed "a non-string mapped model" 67 "$R_NONSTRING" resolve --agent coder --host copilot
224
- nonstring_msg="$(run "$R_NONSTRING" resolve --agent coder --host copilot 2>&1 >/dev/null || true)"
241
+ expect_malformed "a non-string mapped model" 67 "$R_NONSTRING" resolve --agent somi-coder --host copilot --ceiling medium
242
+ nonstring_msg="$(run "$R_NONSTRING" resolve --agent somi-coder --host copilot --ceiling medium 2>&1 >/dev/null || true)"
225
243
  case "$nonstring_msg" in
226
244
  *".somi/config.json cost.mapping"*) ok "the non-string-model error names .somi/config.json cost.mapping" ;;
227
245
  *) bad "the non-string-model error does not name .somi/config.json cost.mapping (got: $nonstring_msg)" ;;
@@ -234,8 +252,8 @@ esac
234
252
  R_SHIPPED_PARTIAL="$(fresh)"; mkdir -p "$R_SHIPPED_PARTIAL/.somi"
235
253
  printf '{"cost": {"mapping": {"claude-code": {"high": "custom-opus"}}}}\n' > "$R_SHIPPED_PARTIAL/.somi/config.json"
236
254
  expect_malformed "a partial override of the shipped claude-code host drops its other tiers" 67 \
237
- "$R_SHIPPED_PARTIAL" resolve --agent coder
238
- shipped_partial_msg="$(run "$R_SHIPPED_PARTIAL" resolve --agent coder 2>&1 >/dev/null || true)"
255
+ "$R_SHIPPED_PARTIAL" resolve --agent somi-coder --ceiling medium
256
+ shipped_partial_msg="$(run "$R_SHIPPED_PARTIAL" resolve --agent somi-coder --ceiling medium 2>&1 >/dev/null || true)"
239
257
  case "$shipped_partial_msg" in
240
258
  *".somi/config.json cost.mapping"*) ok "the shipped-host partial-override error names .somi/config.json cost.mapping" ;;
241
259
  *) bad "the shipped-host partial-override error does not name .somi/config.json cost.mapping (got: $shipped_partial_msg)" ;;
@@ -245,7 +263,7 @@ esac
245
263
  # (mergeHostMapping's own check, same as __proto__ above) -- exit 67, not 66.
246
264
  R_BADTIER="$(fresh)"; mkdir -p "$R_BADTIER/.somi"
247
265
  printf '{"cost": {"mapping": {"copilot": {"lo": "gpt-5-mini"}}}}\n' > "$R_BADTIER/.somi/config.json"
248
- expect_malformed "a tier key outside low|medium|high in cost.mapping" 67 "$R_BADTIER" resolve --agent coder --host copilot
266
+ expect_malformed "a tier key outside low|medium|high in cost.mapping" 67 "$R_BADTIER" resolve --agent somi-coder --host copilot
249
267
 
250
268
  # A named regression test: bootstrap normally (valid config, ceiling state written), THEN corrupt
251
269
  # config.json -- the ceiling itself doesn't re-read config after bootstrap, but the mapping
@@ -253,10 +271,10 @@ expect_malformed "a tier key outside low|medium|high in cost.mapping" 67 "$R_BAD
253
271
  # (67), never as agent coder's own cost: declaration being malformed (66).
254
272
  R_POSTBOOT="$(fresh)"; mkdir -p "$R_POSTBOOT/.somi"
255
273
  printf '{"cost": {"ceiling": "high"}}\n' > "$R_POSTBOOT/.somi/config.json"
256
- run "$R_POSTBOOT" resolve --agent coder >/dev/null # bootstrap: writes .somi/somi-state/ceiling.json
274
+ run "$R_POSTBOOT" resolve --agent somi-coder >/dev/null # bootstrap: writes .somi/somi-state/ceiling.json
257
275
  printf '{"cost": {"ceiling": "high"}\n' > "$R_POSTBOOT/.somi/config.json" # now corrupt (missing brace)
258
276
  postboot_rc=0
259
- run "$R_POSTBOOT" resolve --agent coder >/dev/null 2>&1 || postboot_rc=$?
277
+ run "$R_POSTBOOT" resolve --agent somi-coder >/dev/null 2>&1 || postboot_rc=$?
260
278
  check "config corrupted AFTER a successful bootstrap: exit 67, not 66" "$postboot_rc" "67"
261
279
 
262
280
  # --- path traversal in --agent: rejected before any file is read, in either direction ------------
@@ -300,19 +318,19 @@ check "the CLI's own EXIT_* constants are pairwise distinct, and none is 0 (succ
300
318
 
301
319
  # --- bad args: missing --agent, unknown subcommand, unknown flag --------------------------------
302
320
  expect_exit "missing --agent is a usage error" 64 "$(fresh)" resolve
303
- expect_exit "unknown subcommand is a usage error" 64 "$(fresh)" bogus-subcommand --agent coder
304
- expect_exit "unknown flag is a usage error" 64 "$(fresh)" resolve --agent coder --bogus-flag x
321
+ expect_exit "unknown subcommand is a usage error" 64 "$(fresh)" bogus-subcommand --agent somi-coder
322
+ expect_exit "unknown flag is a usage error" 64 "$(fresh)" resolve --agent somi-coder --bogus-flag x
305
323
  expect_exit "no subcommand at all is a usage error" 64 "$(fresh)"
306
324
 
307
325
  # --- an empty or missing flag value is rejected outright, never silently defaulted --------------
308
326
  expect_exit "--host with an explicitly empty value is a usage error, not a silent default" 64 \
309
- "$(fresh)" resolve --agent coder --host ""
327
+ "$(fresh)" resolve --agent somi-coder --host ""
310
328
  expect_exit "a trailing --host with no value at all is a usage error" 64 \
311
- "$(fresh)" resolve --agent coder --host
329
+ "$(fresh)" resolve --agent somi-coder --host
312
330
  expect_exit "--ceiling with an explicitly empty value is a usage error" 64 \
313
- "$(fresh)" resolve --agent coder --ceiling ""
331
+ "$(fresh)" resolve --agent somi-coder --ceiling ""
314
332
  expect_exit "a trailing --ceiling with no value at all is a usage error" 64 \
315
- "$(fresh)" resolve --agent coder --ceiling
333
+ "$(fresh)" resolve --agent somi-coder --ceiling
316
334
  expect_exit "--agent with an explicitly empty value is a usage error" 64 \
317
335
  "$(fresh)" resolve --agent ""
318
336
 
@@ -321,8 +339,8 @@ expect_exit "--agent with an explicitly empty value is a usage error" 64 \
321
339
  # resolveCeiling() ever touches disk, so a rejected value leaves no .somi/ state behind. -----------
322
340
  R_BADCEIL="$(fresh)"
323
341
  expect_exit "an invalid --ceiling VALUE ('critical') is a usage error, not a project-env failure" 64 \
324
- "$R_BADCEIL" resolve --agent coder --ceiling critical
325
- badceil_msg="$(run "$R_BADCEIL" resolve --agent coder --ceiling critical 2>&1 >/dev/null || true)"
342
+ "$R_BADCEIL" resolve --agent somi-coder --ceiling critical
343
+ badceil_msg="$(run "$R_BADCEIL" resolve --agent somi-coder --ceiling critical 2>&1 >/dev/null || true)"
326
344
  case "$badceil_msg" in
327
345
  *"--ceiling"*"critical"*) ok "the bad --ceiling error names the flag and the rejected value" ;;
328
346
  *) bad "the bad --ceiling error is unclear (got: $badceil_msg)" ;;
@@ -339,8 +357,8 @@ fi
339
357
  R_CFG_BROKEN="$(fresh)"; mkdir -p "$R_CFG_BROKEN/.somi"
340
358
  printf '{"cost": {"ceiling": "low"}\n' > "$R_CFG_BROKEN/.somi/config.json" # missing closing brace
341
359
  expect_exit "an unparsable .somi/config.json is a project-env failure (67), not usage or malformed" 67 \
342
- "$R_CFG_BROKEN" resolve --agent coder
343
- cfg_broken_msg="$(run "$R_CFG_BROKEN" resolve --agent coder 2>&1 >/dev/null || true)"
360
+ "$R_CFG_BROKEN" resolve --agent somi-coder
361
+ cfg_broken_msg="$(run "$R_CFG_BROKEN" resolve --agent somi-coder 2>&1 >/dev/null || true)"
344
362
  case "$cfg_broken_msg" in
345
363
  *"config.json"*) ok "the unparsable-config error names config.json" ;;
346
364
  *) bad "the unparsable-config error does not name config.json (got: $cfg_broken_msg)" ;;
@@ -349,8 +367,8 @@ esac
349
367
  R_STATE_BROKEN="$(fresh)"; mkdir -p "$R_STATE_BROKEN/.somi/somi-state"
350
368
  printf '{"ceiling": "low"\n' > "$R_STATE_BROKEN/.somi/somi-state/ceiling.json" # missing closing brace
351
369
  expect_exit "an unparsable .somi/somi-state/ceiling.json is a project-env failure (67)" 67 \
352
- "$R_STATE_BROKEN" resolve --agent coder
353
- state_broken_msg="$(run "$R_STATE_BROKEN" resolve --agent coder 2>&1 >/dev/null || true)"
370
+ "$R_STATE_BROKEN" resolve --agent somi-coder
371
+ state_broken_msg="$(run "$R_STATE_BROKEN" resolve --agent somi-coder 2>&1 >/dev/null || true)"
354
372
  case "$state_broken_msg" in
355
373
  *"ceiling.json"*) ok "the unparsable-state error names ceiling.json" ;;
356
374
  *) bad "the unparsable-state error does not name ceiling.json (got: $state_broken_msg)" ;;
@@ -362,52 +380,86 @@ esac
362
380
  # a bad --ceiling value above.
363
381
  R_ENV_BAD="$(fresh)"
364
382
  env_bad_rc=0
365
- CLAUDE_PROJECT_DIR="$R_ENV_BAD" SOMI_COST_CEILING=critical node "$CLI" resolve --agent coder >/dev/null 2>&1 || env_bad_rc=$?
383
+ CLAUDE_PROJECT_DIR="$R_ENV_BAD" SOMI_COST_CEILING=critical node "$CLI" resolve --agent somi-coder >/dev/null 2>&1 || env_bad_rc=$?
366
384
  check "a malformed SOMI_COST_CEILING is a usage error (64), not a project-env failure" "$env_bad_rc" "64"
367
385
  if [ -e "$R_ENV_BAD/.somi" ]; then
368
386
  bad "a rejected SOMI_COST_CEILING must be caught before the ceiling state is ever touched (found .somi/ in the project root)"
369
387
  else
370
388
  ok "a rejected SOMI_COST_CEILING ('critical') leaves the project root untouched -- validated before resolveCeiling touches disk"
371
389
  fi
372
- envbad_msg="$(CLAUDE_PROJECT_DIR="$(fresh)" SOMI_COST_CEILING=critical node "$CLI" resolve --agent coder 2>&1 >/dev/null || true)"
390
+ envbad_msg="$(CLAUDE_PROJECT_DIR="$(fresh)" SOMI_COST_CEILING=critical node "$CLI" resolve --agent somi-coder 2>&1 >/dev/null || true)"
373
391
  case "$envbad_msg" in
374
392
  *"SOMI_COST_CEILING"*"critical"*) ok "the bad SOMI_COST_CEILING error names the variable and the rejected value" ;;
375
393
  *) bad "the bad SOMI_COST_CEILING error is unclear (got: $envbad_msg)" ;;
376
394
  esac
377
395
 
378
396
  # --- output shape: exactly the documented fields (`enforced` added by #32; `reason` only when unenforced), and a real JSON array for `supported` -----
379
- out="$(run "$(fresh)" resolve --agent coder --ceiling medium)"
380
- check "JSON output carries exactly agent/ceiling/ceiling_origin/ceiling_source/enforced/model/supported/tier" \
397
+ out="$(run "$(fresh)" resolve --agent somi-coder --ceiling medium)"
398
+ check "JSON output carries exactly agent/agent_type/ceiling/ceiling_origin/ceiling_source/declared/degraded/enforced/model/supported/tier/tier_source" \
381
399
  "$(node -e 'process.stdout.write(Object.keys(JSON.parse(process.argv[1])).sort().join("|"))' "$out")" \
382
- "agent|ceiling|ceiling_origin|ceiling_source|enforced|model|supported|tier"
383
- check "coder's supported set is exactly [low, medium], echoing its declared frontmatter" \
400
+ "agent|agent_type|ceiling|ceiling_origin|ceiling_source|declared|degraded|enforced|model|supported|tier|tier_source"
401
+ check "coder's supported set is exactly [medium], echoing its default tier from the table" \
384
402
  "$(node -e 'process.stdout.write(JSON.parse(process.argv[1]).supported.join(","))' "$out")" \
385
- "low,medium"
403
+ "medium"
386
404
 
387
405
  # --- ceiling_origin surfaces through the CLI, not just the library: the source/origin distinction
388
406
  # that makes "ceiling_source: state" actionable round-trips through the JSON. ---------------------
389
- out="$(run "$(fresh)" resolve --agent coder)"
407
+ out="$(run "$(fresh)" resolve --agent somi-coder)"
390
408
  check "fresh project, no override: ceiling_origin matches ceiling_source ('default')" \
391
409
  "$(field "$out" ceiling_origin)" "default"
392
410
 
393
411
  R_ORIGIN="$(fresh)"; mkdir -p "$R_ORIGIN/.somi"
394
412
  printf '{"cost": {"ceiling": "low"}}\n' > "$R_ORIGIN/.somi/config.json"
395
- run "$R_ORIGIN" resolve --agent coder >/dev/null # bootstrap from config
396
- out="$(run "$R_ORIGIN" resolve --agent coder)" # a later bare call: state now on disk
397
- check "a later call: ceiling_source is 'state' but ceiling_origin still says 'config' -- actionable" \
398
- "$(field "$out" ceiling_source),$(field "$out" ceiling_origin)" "state,config"
399
-
400
- # --- CRLF checkout (#28): a Windows clone with core.autocrlf rewrites agent files to CRLF; the
401
- # frontmatter delimiter is then `---\r`, which must still parse. Run a copy of the install whose
402
- # agent files are CRLF. -----------------------------------------------------------------------------
403
- CRLF_INSTALL="$(fresh)"
404
- cp -R "$ROOT_REPO/scripts" "$ROOT_REPO/agents" "$CRLF_INSTALL/"
405
- for f in "$CRLF_INSTALL"/agents/*.md; do sed -i 's/$/\r/' "$f"; done
406
- crlf_rc=0
407
- out="$(CLAUDE_PROJECT_DIR="$(fresh)" node "$CRLF_INSTALL/scripts/somi-dispatch.mjs" resolve --agent planner --host copilot 2>&1)" || crlf_rc=$?
408
- check "CRLF agent files: resolve exits 0 (was 66, 'declares no cost:')" "$crlf_rc" "0"
409
- [ "$crlf_rc" = 0 ] && check "CRLF agent files: planner's supported set parses without a trailing CR" \
410
- "$(node -e 'process.stdout.write(JSON.parse(process.argv[1]).supported.join(","))' "$out")" "low,medium"
413
+ run "$R_ORIGIN" resolve --agent somi-coder --ceiling medium >/dev/null # persisted from the CLI; config still outranks it
414
+ rm "$R_ORIGIN/.somi/config.json"
415
+ out="$(run "$R_ORIGIN" resolve --agent somi-coder)" # a later bare call, config gone: state on disk
416
+ check "a later call: ceiling_source is 'state' but ceiling_origin still says 'cli' -- actionable" \
417
+ "$(field "$out" ceiling_source),$(field "$out" ceiling_origin)" "state,cli"
418
+
419
+ # --- the tier comes from the default table, never from the agent file --------------------------------
420
+ # A leftover `cost:` line in an agent file (step one of retiring it) is ignored, and so is the file's
421
+ # line-ending style (#28: a Windows clone rewrites agent files to CRLF). Run a copy of the install whose
422
+ # planner declares `cost: low` and whose agent files are all CRLF.
423
+ LEFTOVER_INSTALL="$(fresh)"
424
+ cp -R "$ROOT_REPO/scripts" "$ROOT_REPO/agents" "$LEFTOVER_INSTALL/"
425
+ sed -i '0,/^description:/s/^description:/cost: low\ndescription:/' "$LEFTOVER_INSTALL/agents/somi-planner.md"
426
+ for f in "$LEFTOVER_INSTALL"/agents/*.md; do sed -i 's/$/\r/' "$f"; done
427
+ leftover_rc=0
428
+ out="$(CLAUDE_PROJECT_DIR="$(fresh)" node "$LEFTOVER_INSTALL/scripts/somi-dispatch.mjs" resolve --agent somi-planner --host copilot 2>&1)" || leftover_rc=$?
429
+ check "a leftover cost: line in a CRLF agent file: resolve exits 0" "$leftover_rc" "0"
430
+ [ "$leftover_rc" = 0 ] && check "... and planner's supported set is the table's [medium], not the file's low" \
431
+ "$(node -e 'process.stdout.write(JSON.parse(process.argv[1]).supported.join(","))' "$out")" "medium"
432
+ grep -q '^cost: low' "$LEFTOVER_INSTALL/agents/somi-planner.md" || bad "fixture did not plant the leftover cost: line"
433
+ # Red proof: if the resolver took the tier from anywhere but the table, the same assertion would see it.
434
+ sed -i "s/const defaultTier = AGENT_DEFAULT_TIERS\[agent\];/const defaultTier = 'low';/" "$LEFTOVER_INSTALL/scripts/lib/dispatch-resolver.mjs"
435
+ out="$(CLAUDE_PROJECT_DIR="$(fresh)" node "$LEFTOVER_INSTALL/scripts/somi-dispatch.mjs" resolve --agent somi-planner --host copilot 2>&1)" || true
436
+ check "red proof: a resolver that ignores the table reports a different supported set" \
437
+ "$(node -e 'process.stdout.write(JSON.parse(process.argv[1]).supported.join(","))' "$out")" "low"
438
+
439
+ # An agent file with no table entry (and not the exempt somi) is a gap in the plugin itself: 66, naming the table.
440
+ GHOST_INSTALL="$(fresh)"
441
+ cp -R "$ROOT_REPO/scripts" "$ROOT_REPO/agents" "$GHOST_INSTALL/"
442
+ printf -- '---\nname: ghost\ndescription: d\n---\nbody\n' > "$GHOST_INSTALL/agents/ghost.md"
443
+ ghost_rc=0
444
+ msg="$(CLAUDE_PROJECT_DIR="$(fresh)" node "$GHOST_INSTALL/scripts/somi-dispatch.mjs" resolve --agent ghost 2>&1 >/dev/null)" || ghost_rc=$?
445
+ check "an agent file with no default-tier table entry exits 66" "$ghost_rc" "66"
446
+ case "$msg" in
447
+ *"default tier table"*) ok "... and the message names the table" ;;
448
+ *) bad "... the message does not name the table (got: $msg)" ;;
449
+ esac
450
+
451
+ # --- #35: a preference list in cost.mapping -> model is the first, model_candidates the list ---------
452
+ P35="$(mktemp -d)"; mkdir "$P35/.somi"
453
+ printf '{"cost":{"ceiling":"high","mapping":{"copilot":{"low":"m-l","medium":"m-m","high":["m-h1","m-h2"]}}}}\n' > "$P35/.somi/config.json"
454
+ out35="$(CLAUDE_PROJECT_DIR="$P35" env -u SOMI_COST_CEILING node "$CLI" resolve --agent somi-designer --host copilot)"
455
+ check "#35: a list mapping resolves model to the first candidate, enforced, with model_candidates" \
456
+ "$(node -e 'const o=JSON.parse(process.argv[1]); process.stdout.write([o.model, o.enforced, JSON.stringify(o.model_candidates)].join("|"))' "$out35")" 'm-h1|true|["m-h1","m-h2"]'
457
+ out35b="$(CLAUDE_PROJECT_DIR="$P35" env -u SOMI_COST_CEILING node "$CLI" resolve --agent somi-coder --host copilot --ceiling medium)"
458
+ check "#35: a plain-string tier carries no model_candidates field" "$(node -e 'process.stdout.write(String("model_candidates" in JSON.parse(process.argv[1])))' "$out35b")" "false"
459
+ printf '{"cost":{"ceiling":"high","mapping":{"copilot":{"low":"m-l","medium":"m-m","high":[]}}}}\n' > "$P35/.somi/config.json"
460
+ rc35=0; CLAUDE_PROJECT_DIR="$P35" env -u SOMI_COST_CEILING node "$CLI" resolve --agent somi-designer --host copilot >/dev/null 2>&1 || rc35=$?
461
+ check "#35: an empty list in the project's mapping is a project config failure (67)" "$rc35" "67"
462
+ rm -rf "$P35"
411
463
 
412
464
  echo "somi-dispatch tests: $pass ok, $fail failed"
413
465
  [ "$fail" -eq 0 ] || exit 1
@@ -10,3 +10,5 @@ set -euo pipefail
10
10
 
11
11
  ROOT_REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
12
12
  node "$ROOT_REPO/tests/scripts/lib/somi-mcp-tests.mjs"
13
+ node "$ROOT_REPO/tests/scripts/lib/somi-mcp-tier-tests.mjs"
14
+ node "$ROOT_REPO/tests/scripts/lib/agent-registry-tests.mjs"