@skathio/somi 4.1.1 → 5.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.
- package/.claude-plugin/icon.png +0 -0
- package/.claude-plugin/marketplace.json +8 -3
- package/.claude-plugin/plugin.json +9 -10
- package/.copilot-extension/extension.json +32 -40
- package/.copilot-extension/marketplace.json +8 -3
- package/README.md +88 -227
- package/VERSION +1 -1
- package/agents/somi-reviewer.md +21 -40
- package/agents/somi-security-reviewer.md +16 -90
- package/agents/somi-worker-high.md +11 -0
- package/agents/somi-worker-low.md +11 -0
- package/agents/somi-worker-medium.md +11 -0
- package/agents/somi.md +8 -75
- package/commands/somi-config.md +5 -14
- package/commands/somi-deliver.md +11 -0
- package/commands/somi-quality.md +10 -0
- package/commands/somi-review.md +10 -0
- package/commands/somi-status.md +11 -0
- package/commands/somi.md +10 -0
- package/hooks/hooks.json +29 -23
- package/hooks/lib/common.mjs +45 -34
- package/hooks/pre-tool/apply-tier.mjs +31 -0
- package/hooks/pre-tool/block-dangerous-bash.mjs +15 -0
- package/hooks/pre-tool/gate-dep-install.mjs +2 -2
- package/hooks/pre-tool/guard-protected-paths.mjs +9 -16
- package/hooks/pre-tool/guard-tier-config.mjs +17 -0
- package/hooks/pre-tool/reviewers-read-only.mjs +11 -0
- package/hooks/session-start/inject-digest.mjs +51 -0
- package/hooks/stop/review-due.mjs +44 -0
- package/hooks/user-prompt/capture-prompt.mjs +17 -0
- package/library/lenses/architecture.md +1 -0
- package/library/lenses/test-strategy.md +1 -0
- package/library/roles/accessibility.md +1 -0
- package/library/roles/answer.md +1 -0
- package/library/roles/atlas.md +1 -0
- package/library/roles/build.md +1 -0
- package/library/roles/debug.md +6 -0
- package/library/roles/design.md +1 -0
- package/library/roles/discover.md +1 -0
- package/library/roles/incident.md +1 -0
- package/library/roles/migrate.md +1 -0
- package/library/roles/perf.md +1 -0
- package/library/roles/plan.md +1 -0
- package/library/roles/refactor.md +1 -0
- package/library/roles/review.md +1 -0
- package/library/roles/security-review.md +1 -0
- package/library/roles/upgrade.md +1 -0
- package/library/skills/accessibility.md +16 -0
- package/library/skills/ci-infra-gotchas.md +12 -0
- package/library/skills/perf-method.md +10 -0
- package/library/skills/secure-coding.md +18 -0
- package/library/skills/testing-checklist.md +16 -0
- package/library/skills/threat-modeling.md +10 -0
- package/package.json +12 -17
- package/profiles/claude.json +21 -0
- package/profiles/copilot.json +5 -0
- package/rules/digest.md +40 -0
- package/scripts/check-links.mjs +65 -76
- package/scripts/lib/advisor.mjs +207 -0
- package/scripts/lib/check.mjs +167 -0
- package/scripts/lib/copilot-workflow.mjs +41 -0
- package/scripts/lib/doctor.mjs +91 -0
- package/scripts/lib/gates.mjs +69 -0
- package/scripts/lib/git-tree.mjs +201 -0
- package/scripts/lib/init.mjs +23 -0
- package/scripts/lib/ledger.mjs +38 -0
- package/scripts/lib/mcp-project-root.mjs +63 -67
- package/scripts/lib/migrate.mjs +73 -0
- package/scripts/lib/path-facts.mjs +2 -2
- package/scripts/lib/path-safety.mjs +6 -134
- package/scripts/lib/plan.mjs +69 -0
- package/scripts/lib/policy.mjs +103 -0
- package/scripts/lib/pr.mjs +28 -0
- package/scripts/lib/prompt.mjs +72 -0
- package/scripts/lib/quality/clones.mjs +76 -0
- package/scripts/lib/quality/css.mjs +43 -0
- package/scripts/lib/quality/gate.mjs +230 -0
- package/scripts/lib/quality/limits.mjs +97 -0
- package/scripts/lib/quality/metrics.mjs +159 -0
- package/scripts/lib/quality/parse.mjs +73 -0
- package/scripts/lib/quality/repo.mjs +69 -0
- package/scripts/lib/quality/run.mjs +58 -0
- package/scripts/lib/reviews.mjs +132 -0
- package/scripts/lib/routes.mjs +108 -0
- package/scripts/lib/setup.mjs +34 -0
- package/scripts/lib/shards.mjs +166 -0
- package/scripts/lib/signals.mjs +110 -0
- package/scripts/lib/state.mjs +42 -0
- package/scripts/lib/tiers.mjs +42 -0
- package/scripts/lib/update-notice.mjs +48 -0
- package/scripts/lib/views.mjs +62 -0
- package/scripts/lib/workflows.mjs +56 -0
- package/scripts/somi-mcp.mjs +182 -323
- package/scripts/somi.mjs +208 -0
- package/scripts/vendor/tree-sitter/LICENSE.vscode-tree-sitter-wasm +21 -0
- package/scripts/vendor/tree-sitter/LICENSE.web-tree-sitter +21 -0
- package/scripts/vendor/tree-sitter/cgmanifest.vscode-tree-sitter-wasm.json +16 -0
- package/scripts/vendor/tree-sitter/manifest.json +59 -0
- package/scripts/vendor/tree-sitter/package.json +3 -0
- package/scripts/vendor/tree-sitter/tree-sitter-css.wasm +0 -0
- package/scripts/vendor/tree-sitter/tree-sitter-javascript.wasm +0 -0
- package/scripts/vendor/tree-sitter/tree-sitter-tsx.wasm +0 -0
- package/scripts/vendor/tree-sitter/tree-sitter-typescript.wasm +0 -0
- package/scripts/vendor/tree-sitter/web-tree-sitter.js +4081 -0
- package/scripts/vendor/tree-sitter/web-tree-sitter.wasm +0 -0
- package/skills/somi-expertise/SKILL.md +6 -0
- package/workflows/deliver-stages.js +81 -0
- package/.claude/settings.json +0 -131
- package/agents/somi-architecture-reviewer.md +0 -101
- package/agents/somi-atlas.md +0 -100
- package/agents/somi-coder.md +0 -60
- package/agents/somi-designer.md +0 -36
- package/agents/somi-discovery-analyst.md +0 -57
- package/agents/somi-flow.md +0 -47
- package/agents/somi-general.md +0 -36
- package/agents/somi-impact.md +0 -95
- package/agents/somi-incident.md +0 -94
- package/agents/somi-plan-reviewer.md +0 -68
- package/agents/somi-planner.md +0 -57
- package/agents/somi-pr.md +0 -99
- package/agents/somi-refactor-designer.md +0 -81
- package/agents/somi-refactorer.md +0 -99
- package/agents/somi-sdlc-reviewer.md +0 -67
- package/agents/somi-test-strategist.md +0 -87
- package/commands/adopt.md +0 -14
- package/commands/architecture-review.md +0 -19
- package/commands/atlas.md +0 -19
- package/commands/code-loop.md +0 -19
- package/commands/code-parallel.md +0 -19
- package/commands/code.md +0 -19
- package/commands/debug.md +0 -19
- package/commands/design.md +0 -19
- package/commands/discover.md +0 -19
- package/commands/impact.md +0 -19
- package/commands/incident.md +0 -19
- package/commands/plan-loop.md +0 -19
- package/commands/plan.md +0 -19
- package/commands/pr.md +0 -19
- package/commands/refactor-design.md +0 -19
- package/commands/refactor.md +0 -19
- package/commands/release-readiness.md +0 -19
- package/commands/review-panel.md +0 -19
- package/commands/review.md +0 -19
- package/commands/security-review.md +0 -19
- package/commands/ship-loop.md +0 -19
- package/commands/ship.md +0 -19
- package/commands/test-strategy.md +0 -19
- package/commands/upgrade.md +0 -19
- package/examples/README.md +0 -19
- package/examples/code-review-example.md +0 -88
- package/examples/discovery-example.md +0 -200
- package/examples/feature-plan-example.md +0 -377
- package/examples/full-pipeline-example.md +0 -188
- package/examples/sample-consumer/.claude/settings.json +0 -29
- package/examples/sample-consumer/CLAUDE.md +0 -78
- package/examples/sample-consumer/README.md +0 -102
- package/hooks/post-tool/lint-changed-files.mjs +0 -209
- package/hooks/pre-tool/guard-cost-lowering.mjs +0 -192
- package/hooks/session-start/detect-repo-instructions.mjs +0 -287
- package/hooks/session-start/ensure-default-config.mjs +0 -113
- package/hooks/user-prompt-submit/inject-workflow-context.mjs +0 -580
- package/rules/00-priorities.md +0 -48
- package/rules/10-solid.md +0 -87
- package/rules/20-clean-code.md +0 -62
- package/rules/30-security-owasp.md +0 -83
- package/rules/40-engineering-practices.md +0 -65
- package/rules/50-collaboration.md +0 -114
- package/rules/99-overrides.md +0 -52
- package/rules/CLAUDE.md +0 -200
- package/scripts/check-session-artefacts.mjs +0 -149
- package/scripts/check-size-budget.mjs +0 -137
- package/scripts/generate-digest.mjs +0 -176
- package/scripts/lib/agent-info.mjs +0 -85
- package/scripts/lib/agent-registry.mjs +0 -92
- package/scripts/lib/cost-ceiling.mjs +0 -328
- package/scripts/lib/cost-config-edit.mjs +0 -102
- package/scripts/lib/cost-config.mjs +0 -64
- package/scripts/lib/cost-defaults.mjs +0 -53
- package/scripts/lib/cost-lowering.mjs +0 -89
- package/scripts/lib/cost-model.mjs +0 -110
- package/scripts/lib/dispatch-resolver.mjs +0 -243
- package/scripts/lib/escalation-facts.mjs +0 -146
- package/scripts/lib/escalation.mjs +0 -129
- package/scripts/lib/findings-ledger.mjs +0 -241
- package/scripts/lib/install-text.mjs +0 -97
- package/scripts/lib/loop-caps.mjs +0 -140
- package/scripts/lib/loop-diff.mjs +0 -38
- package/scripts/lib/loop-dispatch.mjs +0 -19
- package/scripts/lib/loop-engine.mjs +0 -227
- package/scripts/lib/loop-escalate.mjs +0 -49
- package/scripts/lib/loop-exit.mjs +0 -47
- package/scripts/lib/loop-notes-compact.mjs +0 -72
- package/scripts/lib/loop-notes.mjs +0 -282
- package/scripts/lib/loop-review.mjs +0 -395
- package/scripts/lib/loop-state.mjs +0 -44
- package/scripts/lib/loop-step-close.mjs +0 -75
- package/scripts/lib/loop-step-kit.mjs +0 -179
- package/scripts/lib/loop-step-review.mjs +0 -140
- package/scripts/lib/loop-step-tool.mjs +0 -89
- package/scripts/lib/loop-step.mjs +0 -303
- package/scripts/lib/run-budget.mjs +0 -28
- package/scripts/lib/run-card.mjs +0 -73
- package/scripts/lib/size-tier.mjs +0 -184
- package/scripts/lib/tier-record.mjs +0 -82
- package/scripts/size-budget-overrides.json +0 -58
- package/scripts/somi-card.mjs +0 -39
- package/scripts/somi-check.mjs +0 -237
- package/scripts/somi-config.mjs +0 -421
- package/scripts/somi-dispatch.mjs +0 -141
- package/scripts/somi-findings.mjs +0 -100
- package/scripts/somi-loop.mjs +0 -139
- package/scripts/somi-tier.mjs +0 -393
- package/scripts/validate.sh +0 -653
- package/skills/api-design/SKILL.md +0 -147
- package/skills/clean-code/SKILL.md +0 -142
- package/skills/flow-adopt/SKILL.md +0 -92
- package/skills/flow-architecture-review/SKILL.md +0 -94
- package/skills/flow-atlas/SKILL.md +0 -34
- package/skills/flow-code/SKILL.md +0 -167
- package/skills/flow-code-loop/SKILL.md +0 -263
- package/skills/flow-code-parallel/SKILL.md +0 -160
- package/skills/flow-debug/SKILL.md +0 -141
- package/skills/flow-design/SKILL.md +0 -170
- package/skills/flow-discover/SKILL.md +0 -204
- package/skills/flow-impact/SKILL.md +0 -35
- package/skills/flow-incident/SKILL.md +0 -49
- package/skills/flow-plan/SKILL.md +0 -254
- package/skills/flow-plan-loop/SKILL.md +0 -254
- package/skills/flow-pr/SKILL.md +0 -34
- package/skills/flow-refactor/SKILL.md +0 -58
- package/skills/flow-refactor-design/SKILL.md +0 -97
- package/skills/flow-release-readiness/SKILL.md +0 -82
- package/skills/flow-review/SKILL.md +0 -193
- package/skills/flow-review-panel/SKILL.md +0 -154
- package/skills/flow-security-review/SKILL.md +0 -83
- package/skills/flow-ship/SKILL.md +0 -125
- package/skills/flow-ship-loop/SKILL.md +0 -274
- package/skills/flow-somi-config/SKILL.md +0 -142
- package/skills/flow-status/SKILL.md +0 -43
- package/skills/flow-test-strategy/SKILL.md +0 -83
- package/skills/flow-upgrade/SKILL.md +0 -82
- package/skills/market-research/SKILL.md +0 -125
- package/skills/observability/SKILL.md +0 -133
- package/skills/owasp-defense/SKILL.md +0 -141
- package/skills/plan-review/SKILL.md +0 -83
- package/skills/reasoning-craft/SKILL.md +0 -213
- package/skills/requirements-engineering/SKILL.md +0 -137
- package/skills/role-coder/SKILL.md +0 -247
- package/skills/role-designer/SKILL.md +0 -172
- package/skills/role-discovery-analyst/SKILL.md +0 -288
- package/skills/role-planner/SKILL.md +0 -353
- package/skills/role-reviewer/SKILL.md +0 -218
- package/skills/rules/SKILL.md +0 -47
- package/skills/sdlc-process/SKILL.md +0 -74
- package/skills/solid-principles/SKILL.md +0 -143
- package/skills/somi-checkpoint/SKILL.md +0 -95
- package/skills/somi-dispatch/SKILL.md +0 -259
- package/skills/somi-routing/SKILL.md +0 -158
- package/skills/testing-playbook/SKILL.md +0 -133
- package/skills/threat-modeling/SKILL.md +0 -117
- package/templates/ADR.md.tmpl +0 -73
- package/templates/ATLAS.md.tmpl +0 -75
- package/templates/BRD.md.tmpl +0 -68
- package/templates/BRIEF.md.tmpl +0 -119
- package/templates/CONTEXT.md.tmpl +0 -74
- package/templates/DECISIONS.md.tmpl +0 -105
- package/templates/DESIGN.md.tmpl +0 -83
- package/templates/DIARY.md.tmpl +0 -70
- package/templates/DOD.md.tmpl +0 -90
- package/templates/FRD.md.tmpl +0 -64
- package/templates/PHASE.md.tmpl +0 -80
- package/templates/PROGRESS.md.tmpl +0 -63
- package/templates/RCA.md.tmpl +0 -53
- package/templates/RD-README.md.tmpl +0 -70
- package/templates/RESEARCH.md.tmpl +0 -96
- package/templates/REVIEW.md.tmpl +0 -82
- package/templates/SDD.md.tmpl +0 -82
- package/templates/SOMI-README.md.tmpl +0 -83
- package/templates/SPEC.md.tmpl +0 -123
- package/templates/SRS.md.tmpl +0 -85
- package/templates/TDD.md.tmpl +0 -77
- package/tests/hooks/cases/audit-log.json +0 -21
- package/tests/hooks/cases/block-dangerous-bash.json +0 -166
- package/tests/hooks/cases/block-secret-writes.json +0 -140
- package/tests/hooks/cases/detect-repo-instructions.json +0 -105
- package/tests/hooks/cases/gate-dep-install.json +0 -42
- package/tests/hooks/cases/guard-protected-paths.json +0 -222
- package/tests/hooks/cases/inject-workflow-context.json +0 -239
- package/tests/hooks/cases/lint-changed-files.json +0 -120
- package/tests/hooks/run.sh +0 -392
- package/tests/scripts/agent-model-frontmatter.sh +0 -38
- package/tests/scripts/agent-names.sh +0 -77
- package/tests/scripts/check-frontmatter.sh +0 -37
- package/tests/scripts/check-links.sh +0 -105
- package/tests/scripts/check-session-artefacts.sh +0 -60
- package/tests/scripts/check-size-budget.sh +0 -71
- package/tests/scripts/checkpoint-gate.sh +0 -131
- package/tests/scripts/convergence-runner.sh +0 -1514
- package/tests/scripts/cost-ceiling.sh +0 -255
- package/tests/scripts/cost-defaults.sh +0 -130
- package/tests/scripts/cost-hardcap.sh +0 -338
- package/tests/scripts/cost-lowering.sh +0 -261
- package/tests/scripts/cost-model.sh +0 -196
- package/tests/scripts/dispatch-guard.sh +0 -108
- package/tests/scripts/dispatch-line-gate.sh +0 -61
- package/tests/scripts/dispatch-reference-gate.sh +0 -173
- package/tests/scripts/ensure-default-config.sh +0 -162
- package/tests/scripts/escalation.sh +0 -409
- package/tests/scripts/eval-runner.sh +0 -3692
- package/tests/scripts/evals-packaging.sh +0 -224
- package/tests/scripts/fact-sheet.sh +0 -296
- package/tests/scripts/fixtures/legacy-shard-no-schema.json +0 -50
- package/tests/scripts/fixtures/mock-stdin-read-throw.cjs +0 -18
- package/tests/scripts/fixtures/size-tier-cases.json +0 -87
- package/tests/scripts/generate-digest.sh +0 -180
- package/tests/scripts/global-config.sh +0 -167
- package/tests/scripts/goldens/loop-state-breach.json +0 -1
- package/tests/scripts/goldens/loop-state-done.json +0 -1
- package/tests/scripts/goldens/somi-findings.json +0 -336
- package/tests/scripts/goldens/somi-loop.json +0 -168
- package/tests/scripts/lib/adr-shape.mjs +0 -41
- package/tests/scripts/lib/agent-registry-tests.mjs +0 -95
- package/tests/scripts/lib/brief-only-guard.mjs +0 -27
- package/tests/scripts/lib/checkpoint-gate.mjs +0 -91
- package/tests/scripts/lib/digest-marker-coupling.mjs +0 -52
- package/tests/scripts/lib/dispatch-reference-gate.mjs +0 -121
- package/tests/scripts/lib/escalation-facts-tests.mjs +0 -140
- package/tests/scripts/lib/escalation-tests.mjs +0 -154
- package/tests/scripts/lib/findings-ledger-tests.mjs +0 -118
- package/tests/scripts/lib/loop-engine-tests.mjs +0 -287
- package/tests/scripts/lib/loop-escalate-tests.mjs +0 -356
- package/tests/scripts/lib/loop-flow-gate.mjs +0 -173
- package/tests/scripts/lib/loop-notes-tests.mjs +0 -384
- package/tests/scripts/lib/loop-step-cli-tests.mjs +0 -156
- package/tests/scripts/lib/loop-step-close-tests.mjs +0 -351
- package/tests/scripts/lib/loop-step-lenient-tests.mjs +0 -114
- package/tests/scripts/lib/loop-step-state-tests.mjs +0 -127
- package/tests/scripts/lib/loop-step-tests.mjs +0 -499
- package/tests/scripts/lib/loop-step-unwritten-tests.mjs +0 -55
- package/tests/scripts/lib/multipass-dependence.mjs +0 -192
- package/tests/scripts/lib/multipass-source-identity.mjs +0 -243
- package/tests/scripts/lib/path-facts-tests.mjs +0 -198
- package/tests/scripts/lib/path-safety-tests.mjs +0 -201
- package/tests/scripts/lib/reference-pair.mjs +0 -61
- package/tests/scripts/lib/retirement-gate.mjs +0 -172
- package/tests/scripts/lib/run-suites.mjs +0 -139
- package/tests/scripts/lib/shell-embedded-js.mjs +0 -47
- package/tests/scripts/lib/ship-loop-sizing-guard.mjs +0 -52
- package/tests/scripts/lib/site-roadmap-gate.mjs +0 -64
- package/tests/scripts/lib/size-tier-drift.mjs +0 -74
- package/tests/scripts/lib/sizing-score-tests.mjs +0 -210
- package/tests/scripts/lib/sizing-set-tests.mjs +0 -131
- package/tests/scripts/lib/somi-mcp-client.mjs +0 -102
- package/tests/scripts/lib/somi-mcp-config-tests.mjs +0 -92
- package/tests/scripts/lib/somi-mcp-loop-tests.mjs +0 -226
- package/tests/scripts/lib/somi-mcp-tests.mjs +0 -491
- package/tests/scripts/lib/somi-mcp-tier-tests.mjs +0 -64
- package/tests/scripts/lib/somi-mcp-tool-schema.mjs +0 -38
- package/tests/scripts/loop-engine.sh +0 -22
- package/tests/scripts/loop-flow-gate.sh +0 -11
- package/tests/scripts/retirement-gate.sh +0 -306
- package/tests/scripts/review-panel-seats.sh +0 -32
- package/tests/scripts/run-card.sh +0 -57
- package/tests/scripts/run-suites.sh +0 -74
- package/tests/scripts/run.sh +0 -689
- package/tests/scripts/site-roadmap-gate.sh +0 -76
- package/tests/scripts/size-tier.sh +0 -562
- package/tests/scripts/somi-agent-dispatch-contract.sh +0 -224
- package/tests/scripts/somi-config.sh +0 -286
- package/tests/scripts/somi-dispatch.sh +0 -465
- package/tests/scripts/somi-mcp.sh +0 -15
- package/tests/scripts/suite-plan.json +0 -20
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: sdlc-process
|
|
3
|
-
description: Use when judging whether a SoMi work item's artifacts match reality - progress.md accuracy, diary entries for plan and decision changes, diary compaction, decisions recorded before acting on them, review findings resolved by id, and nothing shipped that points into the planning folder. Process discipline, not code quality.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# SDLC process — artifact discipline
|
|
7
|
-
|
|
8
|
-
The plan artifacts are the team's memory. They only help if they stay true. This skill holds the
|
|
9
|
-
checks for that; the rules come from the templates (`PROGRESS`, `DIARY`, `DECISIONS`, `BRIEF`,
|
|
10
|
-
`REVIEW`) and `rules/50-collaboration.md`, not from new policy. When this skill and an agent file
|
|
11
|
-
diverge on a check, the skill wins.
|
|
12
|
-
|
|
13
|
-
Read bounded: `progress.md` in full, the live entries of `decisions.md`, the recent slice of
|
|
14
|
-
`diary.md` (since the last review, or the last ~10 entries), and the diff. Compare artifacts with
|
|
15
|
-
the **diff and the repository**, not with each other alone: an artifact can be internally consistent
|
|
16
|
-
and still wrong.
|
|
17
|
-
|
|
18
|
-
## The checks
|
|
19
|
-
|
|
20
|
-
### 1. `progress.md` matches reality
|
|
21
|
-
- An iteration marked `done` has its acceptance criteria met by the diff. Read the criterion, find
|
|
22
|
-
the evidence; a `done` with no evidence is Major.
|
|
23
|
-
- The phase table's "iterations done / total" agrees with the iteration table. "Last activity" and
|
|
24
|
-
"Currently in flight" are current.
|
|
25
|
-
- Status lives only in `progress.md`. Status duplicated into a phase file is a finding against the
|
|
26
|
-
phase file.
|
|
27
|
-
- Scope creep (files outside the iteration's list) is acknowledged in follow-ups, not silent.
|
|
28
|
-
|
|
29
|
-
### 2. Plan and decision changes have diary entries
|
|
30
|
-
- A changed decision, phase shape, assumption from `context.md`, a hit or cleared blocker, or a
|
|
31
|
-
review finding that affects the plan has an entry with the right category (`plan-change`,
|
|
32
|
-
`decision-change`, `blocker`, `review-feedback`, `note`).
|
|
33
|
-
- Entries are short, self-contained, and say why. The diary is append-only: a wrong entry is
|
|
34
|
-
corrected by a new one, not rewritten.
|
|
35
|
-
- Spec and code diverging with **no** entry explaining it is a finding. If an entry explains it,
|
|
36
|
-
flag a Minor for visibility at most, not a Blocker.
|
|
37
|
-
|
|
38
|
-
### 3. Diary compaction was done
|
|
39
|
-
- After an append, if there are more than 40 `## ` entry headings, the writer compacted in the same
|
|
40
|
-
edit: entries older than the newest 15 in the movable categories (`note`, `discovery`, `unblock`,
|
|
41
|
-
`blocker`, `review-feedback`) went verbatim to `diary-archive.md`, leaving one `Compacted:`
|
|
42
|
-
entry. A `decision-change` or `plan-change` entry never moves.
|
|
43
|
-
- Count the headings; do not assume. An over-threshold diary without compaction is a Minor, Major
|
|
44
|
-
if reviews are visibly reading the whole file.
|
|
45
|
-
|
|
46
|
-
### 4. Decisions are recorded before they are acted on
|
|
47
|
-
- A choice that shapes the design appears in `decisions.md` (user-verified when architectural)
|
|
48
|
-
**before** the code that relies on it, not back-filled afterward.
|
|
49
|
-
- Never edited in place: the old entry moved to the superseded appendix, marked `superseded by`,
|
|
50
|
-
with a new entry and a diary entry. The spec's one-liner pointer matches the live decision.
|
|
51
|
-
- If `brief.md` exists and the superseded decision is in its "Decisions in force", a line was
|
|
52
|
-
appended to its supersession overlay. A missing line means later passes build on a dead decision.
|
|
53
|
-
Sections of the brief other than the overlay are not rewritten.
|
|
54
|
-
|
|
55
|
-
### 5. Review findings are recorded and resolved by id
|
|
56
|
-
- Findings from a review are in the ledger with an id and a severity; each is resolved with a
|
|
57
|
-
status (`fixed`, `accepted`, `wontfix`) and the review that closed it. A finding discussed in
|
|
58
|
-
prose and never resolved is still open.
|
|
59
|
-
- Open Blockers and Majors are not carried into a `done` iteration without explicit human sign-off.
|
|
60
|
-
- A review that points at the plan, not the code, produced a diary entry and a plan change, not a
|
|
61
|
-
code patch around the symptom.
|
|
62
|
-
|
|
63
|
-
### 6. Nothing shipped points into the planning folder
|
|
64
|
-
- Shipped files (code, comments, agent/skill/command/doc prose) do not cite decision ids, finding
|
|
65
|
-
ids, iteration or phase numbers, or planning slugs. The reader cannot resolve them; say the
|
|
66
|
-
reasoning in words. Where a gate exists for this, run it rather than eyeballing; report a
|
|
67
|
-
reference the gate cannot see.
|
|
68
|
-
- Product vocabulary ("phase", "work item", a template's sample ids) is not a finding.
|
|
69
|
-
|
|
70
|
-
## Severity guide
|
|
71
|
-
|
|
72
|
-
Blocker: an artifact claims something false that a later step will act on (a `done` that is not,
|
|
73
|
-
a live decision the code contradicts). Major: missing record of a plan or decision change.
|
|
74
|
-
Minor: stale bookkeeping that misleads but does not gate. Nit: wording.
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: solid-principles
|
|
3
|
-
description: Use when designing a new module, naming a class, deciding what a function should know, splitting/merging modules, or evaluating whether an abstraction is paying for itself. Operationalizes SOLID as design questions, not five recited bullets.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# SOLID — design questions
|
|
7
|
-
|
|
8
|
-
The principles are in [`rules/10-solid.md`](../../rules/10-solid.md) — that's the always-on floor.
|
|
9
|
-
This skill adds **operational depth**: before/after example pairs, decision rules, anti-patterns.
|
|
10
|
-
Don't restate the rule's prose here; link to it when the principle itself is the answer.
|
|
11
|
-
|
|
12
|
-
When you load this skill you are evaluating a design, not reciting principles. Each letter is a question
|
|
13
|
-
to ask of the code you're about to write or review.
|
|
14
|
-
|
|
15
|
-
## S — "What's the one reason this changes?"
|
|
16
|
-
|
|
17
|
-
If you can't say it in one sentence without "and", you have an SRP problem. SRP isn't about counting
|
|
18
|
-
methods; it's about counting **actors** that drive change.
|
|
19
|
-
|
|
20
|
-
**Before (SRP smell)**
|
|
21
|
-
```python
|
|
22
|
-
class Order:
|
|
23
|
-
def total(self) -> Money: ...
|
|
24
|
-
def save(self) -> None: ... # persistence
|
|
25
|
-
def send_receipt(self) -> None: ... # email
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Three reasons to change: pricing rules, schema, comms.
|
|
29
|
-
|
|
30
|
-
**After**
|
|
31
|
-
```python
|
|
32
|
-
class Order: # pricing rules
|
|
33
|
-
def total(self) -> Money: ...
|
|
34
|
-
|
|
35
|
-
class OrderRepository: # persistence
|
|
36
|
-
def save(self, o: Order) -> None: ...
|
|
37
|
-
|
|
38
|
-
class ReceiptSender: # comms
|
|
39
|
-
def send(self, o: Order) -> None: ...
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## O — "Can I add the next variant without editing existing code?"
|
|
43
|
-
|
|
44
|
-
OCP isn't "make everything pluggable." It's "when the next variant arrives, design lets you *add* instead
|
|
45
|
-
of *modify*." Only invest when variation is real.
|
|
46
|
-
|
|
47
|
-
**The three-cases rule**: do not abstract until you have three concrete variants. Two is a coincidence;
|
|
48
|
-
three is a pattern. A premature strategy interface costs more than a third `if`.
|
|
49
|
-
|
|
50
|
-
## L — "Does this subtype obey the parent's contract, or weaken it?"
|
|
51
|
-
|
|
52
|
-
The Square/Rectangle case is the canonical example. If your subclass throws `NotSupportedException`,
|
|
53
|
-
the type relationship is wrong — prefer composition.
|
|
54
|
-
|
|
55
|
-
**Red flag:** when a subclass override requires callers to *check the runtime type* to know what to do,
|
|
56
|
-
the inheritance is misused.
|
|
57
|
-
|
|
58
|
-
## I — "Is this interface shaped for callers, or for the implementer's convenience?"
|
|
59
|
-
|
|
60
|
-
Big "service" interfaces (`IUserService` with 20 methods) usually serve the implementer. Callers
|
|
61
|
-
typically need 2–3 of those methods. Split:
|
|
62
|
-
|
|
63
|
-
**Before**
|
|
64
|
-
```ts
|
|
65
|
-
interface UserService {
|
|
66
|
-
getUser(id: string): User
|
|
67
|
-
updateProfile(id: string, p: Profile): void
|
|
68
|
-
resetPassword(id: string): void
|
|
69
|
-
exportGDPRData(id: string): Blob
|
|
70
|
-
// ... 15 more
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
**After**
|
|
75
|
-
```ts
|
|
76
|
-
interface UserReader { getUser(id: string): User }
|
|
77
|
-
interface ProfileWriter { updateProfile(id: string, p: Profile): void }
|
|
78
|
-
interface PasswordResetter { resetPassword(id: string): void }
|
|
79
|
-
interface GDPRExporter { exportGDPRData(id: string): Blob }
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Each consumer depends on the role it actually uses. The concrete `UserService` implements all four.
|
|
83
|
-
|
|
84
|
-
## D — "Does business policy know about mechanism?"
|
|
85
|
-
|
|
86
|
-
Domain rules should not import database drivers, HTTP clients, file systems, or cloud SDKs. The domain
|
|
87
|
-
declares the interface in its own language; infrastructure implements it.
|
|
88
|
-
|
|
89
|
-
**Smell**
|
|
90
|
-
```python
|
|
91
|
-
# domain/order.py
|
|
92
|
-
import psycopg2
|
|
93
|
-
def reserve_inventory(order):
|
|
94
|
-
conn = psycopg2.connect(...)
|
|
95
|
-
...
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
**Better**
|
|
99
|
-
```python
|
|
100
|
-
# domain/inventory.py
|
|
101
|
-
class InventoryPort(Protocol):
|
|
102
|
-
def reserve(self, sku: str, qty: int) -> None: ...
|
|
103
|
-
|
|
104
|
-
# domain/order.py
|
|
105
|
-
def reserve_inventory(order, inventory: InventoryPort):
|
|
106
|
-
for line in order.lines:
|
|
107
|
-
inventory.reserve(line.sku, line.qty)
|
|
108
|
-
|
|
109
|
-
# infrastructure/postgres_inventory.py
|
|
110
|
-
class PostgresInventory(InventoryPort):
|
|
111
|
-
def __init__(self, conn): self.conn = conn
|
|
112
|
-
def reserve(self, sku, qty): ...
|
|
113
|
-
```
|
|
114
|
-
|
|
115
|
-
Now domain tests don't need a database. Now the inventory implementation can change without touching the
|
|
116
|
-
order policy.
|
|
117
|
-
|
|
118
|
-
But: **don't invert dependencies you never swap.** A `LoggerInterface` with one logger implementation is
|
|
119
|
-
just extra indirection.
|
|
120
|
-
|
|
121
|
-
## Meta-rules
|
|
122
|
-
|
|
123
|
-
See [`rules/10-solid.md`](../../rules/10-solid.md) §Meta-rules for the canonical statements
|
|
124
|
-
(YAGNI > SOLID for hypothetical variation; three-is-the-magic-number; refactor-under-green).
|
|
125
|
-
Operational additions specific to this skill:
|
|
126
|
-
|
|
127
|
-
- **Composition over inheritance** in ~80% of cases; reserve inheritance for true is-a relationships
|
|
128
|
-
whose contract genuinely holds across subtypes (re-read the L section before reaching for `extends`).
|
|
129
|
-
|
|
130
|
-
## When SOLID is *not* the right lens
|
|
131
|
-
|
|
132
|
-
- **One-off scripts.** A bash script doesn't need DI.
|
|
133
|
-
- **Performance-critical inner loops.** Sometimes the right move is a flat struct + tight loop, not
|
|
134
|
-
five tiny objects.
|
|
135
|
-
- **Trivial code paths.** A three-line function doesn't need a class hierarchy.
|
|
136
|
-
|
|
137
|
-
SOLID is a response to real change pressure. If there's no pressure, the principles are inert.
|
|
138
|
-
|
|
139
|
-
## When to escalate
|
|
140
|
-
|
|
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 [`somi-architecture-reviewer`](../../agents/somi-architecture-reviewer.md)
|
|
143
|
-
rather than patching locally.
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: somi-checkpoint
|
|
3
|
-
description: The contract for a SoMi user gate when the procedure runs inside a subagent - return a CHECKPOINT block and stop, then continue from a RESUME block - plus the DONE, STOPPED and REROUTE result blocks. Loaded by somi-flow, somi-general and the somi dispatcher.
|
|
4
|
-
user-invocable: false
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# somi-checkpoint — user gates across a subagent boundary
|
|
8
|
-
|
|
9
|
-
A subagent cannot ask the user anything: neither Claude Code nor Copilot gives a subagent a
|
|
10
|
-
question tool. SoMi procedures still need the user at fixed gates (a slug confirmation, a
|
|
11
|
-
`DECISIONS-NEEDED` round-trip, `/ship-loop`'s brief-handoff gate, `/pr`'s confirmation before
|
|
12
|
-
`gh pr create`, `/incident`'s framing). This skill is how those gates survive the boundary.
|
|
13
|
-
|
|
14
|
-
## Which mode you are in
|
|
15
|
-
|
|
16
|
-
- **Main conversation** — a slash command on Claude Code, or an agent the user selected for the
|
|
17
|
-
session. Ask at each gate directly, exactly as the procedure says. This skill does not apply.
|
|
18
|
-
- **Subagent** — you were started with a briefing (`flow:` / `args:`, or `RESUME`). Every gate
|
|
19
|
-
becomes a `CHECKPOINT`, below.
|
|
20
|
-
|
|
21
|
-
A gate is any step that tells you to ask, confirm, present something to the user, offer options,
|
|
22
|
-
or wait for a reply. Nothing else is a gate: never invent one to hand work back.
|
|
23
|
-
|
|
24
|
-
## At a gate: save, return, stop
|
|
25
|
-
|
|
26
|
-
1. **Save first.** Write everything the procedure would already have written up to this step
|
|
27
|
-
(artifacts, diary entry, loop state). The next run starts from a fresh context and from disk.
|
|
28
|
-
2. **Return one `CHECKPOINT` block as your whole final message**, and stop:
|
|
29
|
-
|
|
30
|
-
````
|
|
31
|
-
CHECKPOINT
|
|
32
|
-
flow: <flow name>
|
|
33
|
-
resume_at: <the heading of the step to continue from, verbatim>
|
|
34
|
-
context: |
|
|
35
|
-
<at most 10 lines: slug, iteration, loop run id, paths written, what is done>
|
|
36
|
-
ask:
|
|
37
|
-
- id: q1
|
|
38
|
-
question: <one question>
|
|
39
|
-
options: # omit for a free-text answer
|
|
40
|
-
- <recommended option first, marked (recommended)>
|
|
41
|
-
- <option>
|
|
42
|
-
detail: |
|
|
43
|
-
<what the user needs to choose well: pros/cons, the DECISIONS-NEEDED text verbatim>
|
|
44
|
-
````
|
|
45
|
-
|
|
46
|
-
Several decisions from one `DECISIONS-NEEDED` block go in one `CHECKPOINT` (`q1`, `q2`, …),
|
|
47
|
-
options and pros/cons kept verbatim, with `Other` and `Discover` offered as the planner's
|
|
48
|
-
protocol requires.
|
|
49
|
-
3. Never answer your own question, never pick a default to keep going, and never mark a decision
|
|
50
|
-
user-verified without a `RESUME` that carries the user's answer.
|
|
51
|
-
|
|
52
|
-
## When the caller resumes you
|
|
53
|
-
|
|
54
|
-
You get a fresh start whose briefing begins with:
|
|
55
|
-
|
|
56
|
-
````
|
|
57
|
-
RESUME
|
|
58
|
-
flow: <flow name>
|
|
59
|
-
resume_at: <as returned>
|
|
60
|
-
context: |
|
|
61
|
-
<as returned, verbatim>
|
|
62
|
-
answers:
|
|
63
|
-
q1: <the user's answer, verbatim>
|
|
64
|
-
args:
|
|
65
|
-
```args
|
|
66
|
-
<the original request, verbatim>
|
|
67
|
-
```
|
|
68
|
-
````
|
|
69
|
-
|
|
70
|
-
Load the flow skill again, check the disk state matches `context` (the artifacts exist, the loop
|
|
71
|
-
state is where it says), and continue from `resume_at`. If it doesn't match, return `STOPPED`
|
|
72
|
-
with what differs; never rebuild state from memory. An answer that doesn't fit the question
|
|
73
|
-
(the user changed their mind, asked something else) is a new gate: return a new `CHECKPOINT`.
|
|
74
|
-
|
|
75
|
-
## Result blocks
|
|
76
|
-
|
|
77
|
-
Every SoMi subagent run ends with exactly one of these as its final message:
|
|
78
|
-
|
|
79
|
-
| Block | When | Carries |
|
|
80
|
-
|---|---|---|
|
|
81
|
-
| `CHECKPOINT` | a gate needs the user | the shape above |
|
|
82
|
-
| `DONE` | the procedure finished | `flow:`, `summary:` (the procedure's own summary step), `artifacts:` (paths), `next:` (one step) |
|
|
83
|
-
| `STOPPED` | a gate fired or a step failed (cap breach, resolver error, refused agent type) | `flow:`, `reason:`, `outstanding:`, `next:` |
|
|
84
|
-
| `REROUTE` | `somi-general` only: the request is a SoMi workflow after all | `flow:` (the workflow), `why:` (one line), `args:` |
|
|
85
|
-
|
|
86
|
-
## The caller's side (the dispatcher)
|
|
87
|
-
|
|
88
|
-
- `CHECKPOINT` → put each `ask` to the user (the host's question tool, or plain text), with
|
|
89
|
-
`detail` shown faithfully and nothing added or dropped, and end the turn. When the user replies,
|
|
90
|
-
start the same agent with a `RESUME` block: `flow`, `resume_at` and `context` copied verbatim,
|
|
91
|
-
`answers` from the user, and the original `args`. Never answer a checkpoint on the user's behalf,
|
|
92
|
-
even in a session the host calls non-interactive: there, the questions are the final answer.
|
|
93
|
-
- `DONE` / `STOPPED` → relay `summary` / `reason` and `next` to the user.
|
|
94
|
-
- `REROUTE` → dispatch the named flow with `args`, after the usual one-line announcement.
|
|
95
|
-
- The user can say `stop` at any checkpoint: relay it as the answer; the flow records a user-stop.
|
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: somi-dispatch
|
|
3
|
-
description: The one canonical procedure for resolving and starting any SoMi agent — call `somi_resolve`, honour the fallback order, map the result onto a `Task` call carrying the resolved tier and model, and announce a `low` session ceiling once per session. Loaded by the front door and by every command that Tasks an agent directly — edit only here.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# somi-dispatch — resolve, then start, one agent
|
|
7
|
-
|
|
8
|
-
This is the single canonical procedure for turning "start agent X" into a real `Task` call —
|
|
9
|
-
resolving its cost tier and model against the session ceiling first, every time, on every entry
|
|
10
|
-
path. The `somi` dispatcher, the `somi-flow` runner and every flow procedure that Tasks an agent load this skill
|
|
11
|
-
instead of carrying their own copy of it — editing it once here keeps every entry path in sync,
|
|
12
|
-
which is the whole reason this skill exists (the same precedent `skills/somi-routing` sets).
|
|
13
|
-
|
|
14
|
-
## When this applies
|
|
15
|
-
|
|
16
|
-
Whenever your own procedure is about to start an agent via `Task` — whether that's the only agent
|
|
17
|
-
a simple flow Tasks, one of several a multi-agent flow seats in turn, or the `somi-flow` /
|
|
18
|
-
`somi-general` agent the dispatcher starts. It does **not** apply to a `Task` line that
|
|
19
|
-
names another *command* (`Task /code-loop`, `Task /review-panel`, …) — a command is not an agent
|
|
20
|
-
and there is nothing here to resolve for it; load that command's `flow-<name>` skill and run it
|
|
21
|
-
in place, and let its own agent-Tasks reach this skill in turn.
|
|
22
|
-
|
|
23
|
-
**A re-invocation resolves fresh too, every time, the same as a first start.** The planner,
|
|
24
|
-
designer, discovery-analyst, and refactor-designer are all re-invoked in authoring mode after a
|
|
25
|
-
`DECISIONS-NEEDED` round-trip pauses for the user (`flow-plan`, `flow-design`, `flow-discover`,
|
|
26
|
-
`flow-refactor-design`) — that pause is exactly when a user is
|
|
27
|
-
likely to raise the ceiling, so treating the re-invocation as "already resolved" from before the
|
|
28
|
-
pause would silently miss it. There is no shape of "starting an agent" that skips this procedure.
|
|
29
|
-
|
|
30
|
-
## 1. Resolve the agent's dispatch tier
|
|
31
|
-
|
|
32
|
-
Call the bundled `somi_resolve` tool — never by reading the agent's frontmatter and judging it
|
|
33
|
-
yourself; that is the last-resort fallback below, reached only when nothing else can be called at
|
|
34
|
-
all. A host may surface the tool namespaced by plugin and server (e.g. `mcp__somi__somi_resolve`);
|
|
35
|
-
call it by its bare name, `somi_resolve`, regardless of how it's namespaced.
|
|
36
|
-
|
|
37
|
-
```
|
|
38
|
-
somi_resolve({ agent: "<agent name>", host: "<host>",
|
|
39
|
-
project_dir: "<absolute path of the project you are working in this session>" })
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
**Always pass `project_dir`.** The server is launched once, from SoMi's own install location, not
|
|
43
|
-
the project you're working in, and it never guesses which project that is — without a root of its
|
|
44
|
-
own it refuses outright (exit `67`, see Failures below). Give it the absolute path of the project
|
|
45
|
-
this session is actually working in — read your own working directory to get it (a shell `pwd` if
|
|
46
|
-
you have one this turn, or the workspace root the host already told you at session start) — never a
|
|
47
|
-
relative path, and never SoMi's own install directory.
|
|
48
|
-
|
|
49
|
-
**Pass `ceiling` only when the user actually asked, in this turn, to change the session ceiling —
|
|
50
|
-
or asked earlier in this conversation while `cost.ceiling` is set and no config write happened.**
|
|
51
|
-
It applies to that resolve and is remembered as an explicitly set value, but a `cost.ceiling` in
|
|
52
|
-
`.somi/config.json` is read live on every resolve and outranks a remembered value — so where the
|
|
53
|
-
config sets one, a ceiling passed here does **not** last. Omit it on every ordinary resolve. A `ceiling` below the one
|
|
54
|
-
now in force needs the user's confirmation (the host will ask them); never pass one they did not ask for.
|
|
55
|
-
|
|
56
|
-
**Name the agent canonically** (`somi-coder`, `somi-reviewer`, …). When the identifier came from
|
|
57
|
-
somewhere else (a user typed `somi:somi-coder`, or an old name like `coder`), first call the read-only
|
|
58
|
-
`somi_agent_info` tool: `somi_agent_info({ agent: "<identifier>", host: "<host>", project_dir: "<project>" })`. It returns the
|
|
59
|
-
`canonical_name` to resolve, or a 65 for an unknown identifier. Stop on a 65 and relay its message
|
|
60
|
-
(it names the 4.0.0 rename when that is the cause); never substitute a different agent.
|
|
61
|
-
|
|
62
|
-
Name `<host>` precisely, never guess it: `claude-code` if this turn is running in Claude Code,
|
|
63
|
-
`copilot` if it's running in GitHub Copilot.
|
|
64
|
-
|
|
65
|
-
### Fallback order — try in this order, every time
|
|
66
|
-
|
|
67
|
-
1. **The `somi_resolve` tool** (above) — the primary path, tried first, on either host.
|
|
68
|
-
2. **The CLI, by path** — `node scripts/somi-dispatch.mjs resolve --agent <agent name> --host <host> [--ceiling <tier>]` —
|
|
69
|
-
only where SoMi's own files are actually reachable at a path you already know without guessing
|
|
70
|
-
(e.g. this session is working inside the SoMi repo itself, or a vendored install whose
|
|
71
|
-
`${SOMI_VENDOR_ROOT}` you already have). This is not a general substitute for the tool: most
|
|
72
|
-
consuming projects give a prompt no way to know where SoMi is installed at all, which is the
|
|
73
|
-
entire reason the tool exists.
|
|
74
|
-
3. **The disclosed last-resort judgment fallback** (§4 below) — reached only when *neither* of the
|
|
75
|
-
above can even be attempted: no MCP tool call is possible in this turn, **and** no shell is
|
|
76
|
-
available to run the CLI (or SoMi's install path genuinely isn't known).
|
|
77
|
-
|
|
78
|
-
**A tool call that reaches the server and returns an error is never a reason to fall back.** Map
|
|
79
|
-
its exit code (§3) and stop — falling back to the CLI or to judgment after a real error would bury
|
|
80
|
-
the actual failure under a second, unrelated guess. The fallback order above is for when a resolver
|
|
81
|
-
genuinely cannot be reached at all, never for a reachable one that answered with a failure.
|
|
82
|
-
|
|
83
|
-
## 2. Read the result
|
|
84
|
-
|
|
85
|
-
The tool's JSON comes back in its text content; the CLI fallback prints the identical shape to
|
|
86
|
-
stdout:
|
|
87
|
-
|
|
88
|
-
```json
|
|
89
|
-
{"agent": "somi-coder", "agent_type": "somi:somi-coder", "supported": ["medium"], "declared": ["medium"], "tier": "medium", "tier_source": "ceiling", "degraded": false, "model": "<mapped model>", "enforced": true, "ceiling": "medium", "ceiling_source": "default", "ceiling_origin": "default"}
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
- `tier` — the tier selected now: the agent's `cost.agents` entry if it has one (`tier_source:
|
|
93
|
-
"override"`), else the ceiling (`tier_source: "ceiling"`). The ceiling is a hard cap for every agent
|
|
94
|
-
without an override.
|
|
95
|
-
- `declared` (same as `supported`) — the agent's default tier, one element (`scripts/lib/cost-defaults.mjs`);
|
|
96
|
-
`degraded` is `true` when `tier` is below it.
|
|
97
|
-
- `model` — pass it to `Task` when non-null; with `model_candidates` (a `cost.mapping` preference list),
|
|
98
|
-
pass the first candidate the subagent tool's own model list offers, else `model`. An unresolved launch
|
|
99
|
-
inherits the session's model, so always pass the resolved one.
|
|
100
|
-
- `enforced` — `true` only when `model` is a concrete id from a mapping. `false`: nothing pins this tier on
|
|
101
|
-
this host, `reason` says why (e.g. `no model mapping for host copilot`), and the tier is only *requested*,
|
|
102
|
-
never a claim about what ran.
|
|
103
|
-
- `ceiling` / `ceiling_source` / `ceiling_origin` — for the announcement below.
|
|
104
|
-
- `warnings` — repeat each verbatim; never drop or soften one.
|
|
105
|
-
|
|
106
|
-
**`degraded`: one line before the `Task`:** `running <agent> at <tier> (default <default tier>)`, e.g.
|
|
107
|
-
`running somi-security-reviewer at medium (default high)` — the hard cap working as designed, made visible.
|
|
108
|
-
|
|
109
|
-
**A `low` ceiling: announce it once per session, before the first agent it applies to starts.** "Once"
|
|
110
|
-
means once in the context you can currently see: a repeat after a compaction or inside a Tasked command's
|
|
111
|
-
fresh context is fine. Name its source: `ceiling_source`, or `ceiling_origin` when the source is `state` (an
|
|
112
|
-
earlier explicit value). `config` is `cost.ceiling` in `.somi/config.json`, read live; `cli` / `env` is an
|
|
113
|
-
explicit override (`--ceiling`, `SOMI_COST_CEILING`, or `somi_resolve`'s `ceiling`), possibly remembered.
|
|
114
|
-
This lets the user raise the ceiling before work starts.
|
|
115
|
-
|
|
116
|
-
**Changing the ceiling mid-session** is `/somi-config`'s job (or `somi_config` `set cost.ceiling`): it lives
|
|
117
|
-
in `cost.ceiling`, which outranks a remembered value. Say it is saved only after the tool returns success;
|
|
118
|
-
if the tool is unreachable, tell the user to set it themselves. Lowering any tier, above all
|
|
119
|
-
`somi-security-reviewer`'s, needs the user; a refusal (exit `64`) is not worked around.
|
|
120
|
-
|
|
121
|
-
**No mapped model — which rule wins.** When `enforced` is `false`, first match wins, and the briefing (§5)
|
|
122
|
-
reports what happened, never what was hoped for:
|
|
123
|
-
|
|
124
|
-
1. **A `cost.mapping` entry** — the resolver already applied it (`model` non-null, `enforced: true`). Pass
|
|
125
|
-
it: a configured mapping counts as the user naming the model, so a host rule "do not set `model` unless
|
|
126
|
-
the user names one" does **not** block it.
|
|
127
|
-
2. **The host's own guidance** — if it says not to set a model unless the user names one, pass none and
|
|
128
|
-
state `requested cost: <tier> (not enforced: no mapped model)`; `cost.mapping` is how to pin one.
|
|
129
|
-
3. **Your own pick** — only from model ids **visible to you this turn** (e.g. the subagent tool's `model`
|
|
130
|
-
parameter): the lightest for `low`, the strongest for `high`. Say it is your choice; `enforced` stays
|
|
131
|
-
`false`, so use the `requested cost:` line. No ids visible: pass none and say so. Never invent one.
|
|
132
|
-
|
|
133
|
-
`null` is expected on Copilot, which ships no mapping because its ids vary by plan and editor.
|
|
134
|
-
|
|
135
|
-
**Unenforced notice, then the picker.** When `enforced` is `false` and `tier` is `high`, print ONE
|
|
136
|
-
user-visible line per agent type per session before its `Task`: `<agent> is high-tier but no model is pinned
|
|
137
|
-
on <host>, so its model was not chosen by SoMi.` The first time in a session, offer the `/somi-config` model
|
|
138
|
-
picker (one question per tier from the ids you can see, or "use the host default this session", which ends
|
|
139
|
-
the asking) before continuing; never pick and save models without it. Lower tiers get the briefing line
|
|
140
|
-
only. If the host rejects a model you picked yourself, retry once without it and say so (§5).
|
|
141
|
-
|
|
142
|
-
## 3. Failures — map each exit code, and stop; never guess a model or tier to keep going
|
|
143
|
-
|
|
144
|
-
- `64` (usage — bad or missing arguments, including an unrecognized `ceiling`/`--ceiling` or
|
|
145
|
-
`SOMI_COST_CEILING` value, or a malformed `project_dir` — not absolute, doesn't exist, or outside
|
|
146
|
-
a root the host already supplied) — the call itself was malformed; say so and stop.
|
|
147
|
-
- `65` (unknown agent) — no file at the install root matches the agent name you named; say so and
|
|
148
|
-
stop, don't dispatch.
|
|
149
|
-
- `66` (no tier source) — the agent is the exempt `somi`, or its file has no entry in the default
|
|
150
|
-
tier table; quote the resolver's own message and stop.
|
|
151
|
-
- `67` (project environment/config failure) — either `.somi/config.json` (including a structurally
|
|
152
|
-
invalid `cost.mapping`, `cost.agents`, or an oversize, symlinked or non-regular file) or
|
|
153
|
-
`.somi/somi-state/ceiling.json` is corrupt, unparsable, or malformed-shape; or the merged mapping
|
|
154
|
-
is missing the tier just selected, or holds a non-string
|
|
155
|
-
model value, for a host the project's own `cost.mapping` named (a partial override of a shipped
|
|
156
|
-
host replaces that host's whole tier map, so overriding just one tier drops the others); **or no
|
|
157
|
-
project root could be established at all** — no `project_dir` reached the server as usable, and
|
|
158
|
-
nothing else established one either. For the config/state cases, quote the resolver's own message
|
|
159
|
-
— including the file path when it names one — and tell the user to fix or delete the offending
|
|
160
|
-
config before retrying. For the no-project-root case specifically: **tell the user which folder
|
|
161
|
-
you passed (or tried to pass) as `project_dir` and stop** — this is never silently retried with a
|
|
162
|
-
guessed or different path.
|
|
163
|
-
|
|
164
|
-
## 4. Last-resort fallback — neither the tool nor a reachable CLI
|
|
165
|
-
|
|
166
|
-
Reached only when this turn cannot call `somi_resolve` at all **and** there is no shell available
|
|
167
|
-
to run the CLI (or SoMi's install path genuinely isn't known) — never when either one is reachable
|
|
168
|
-
and simply returned a failure (map that per §3 instead). Say plainly that you're doing this and
|
|
169
|
-
name which of the two you couldn't reach, then resolve the same decision manually: read the
|
|
170
|
-
ceiling and the tier yourself, in the same order the resolver itself would: a ceiling the user
|
|
171
|
-
asked for in this conversation (you cannot see `SOMI_COST_CEILING` without a shell), then this
|
|
172
|
-
agent's
|
|
173
|
-
`cost.agents.<agent>` entry in `.somi/config.json` if it has one, else the ceiling — `cost.ceiling`
|
|
174
|
-
in `.somi/config.json` if set, else a ceiling the user explicitly set earlier in
|
|
175
|
-
`.somi/somi-state/ceiling.json` (only if it records `cli` or `env` as its origin), else `medium`
|
|
176
|
-
(the shipped default). That tier is the answer; the agent's default tier does not change it,
|
|
177
|
-
though if the tier is below the agent's default tier, say so as in §2. Nothing was resolved against a mapping here, so nothing is enforced: the
|
|
178
|
-
briefing's cost line is `requested cost: <tier> (not enforced: no mapped model)`, never
|
|
179
|
-
`dispatched at cost:`.
|
|
180
|
-
|
|
181
|
-
## 5. Start the agent
|
|
182
|
-
|
|
183
|
-
**Resolve right before starting, one agent at a time — except a concurrent batch.** Ordinarily
|
|
184
|
-
resolve immediately before the single `Task` call it belongs to, never long in advance and never
|
|
185
|
-
once for a whole command. The one exception: when your own procedure calls for **several agent
|
|
186
|
-
`Task`s issued together in one turn** so they run concurrently (`/review-panel` seating its lenses
|
|
187
|
-
is the shipped example), resolve each one back-to-back, immediately before issuing that batch —
|
|
188
|
-
still not once for the whole command, and each still gets its own `project_dir`, model, and
|
|
189
|
-
cost briefing line in that agent's own briefing.
|
|
190
|
-
|
|
191
|
-
Every entry path that starts an agent states this step in one canonical phrase, copied verbatim
|
|
192
|
-
(`tests/scripts/dispatch-line-gate.sh` holds each copy to it):
|
|
193
|
-
|
|
194
|
-
<!-- dispatch-line:start -->
|
|
195
|
-
pass its `model`, start it as its `agent_type`, and put the cost line in the briefing (`dispatched at cost: <tier>` only when `enforced` is true, else `requested cost: <tier> (not enforced: no mapped model)`)
|
|
196
|
-
<!-- dispatch-line:end -->
|
|
197
|
-
|
|
198
|
-
1. **Start the agent as its `agent_type`** (`somi:somi-coder`): the type the host itself registered,
|
|
199
|
-
on Claude Code and Copilot CLI alike — never a bare name, never a general-purpose agent carrying
|
|
200
|
-
the agent's text, never its role played inline. The real agent runs, from a fresh context.
|
|
201
|
-
2. **State the cost line in the agent's briefing**, using §1's resolved `tier` verbatim. When
|
|
202
|
-
`enforced` is `true`: `dispatched at cost: <tier>`. When it is `false`:
|
|
203
|
-
`requested cost: <tier> (not enforced: no mapped model)` — **`dispatched at cost:` is
|
|
204
|
-
reserved for enforced dispatches**, so a briefing never claims a tier no model was pinned to.
|
|
205
|
-
`somi-coder`, `somi-planner`, and `somi-refactorer` take their "Running at `low`" trim from **either** line
|
|
206
|
-
(`dispatched at cost: low` or `requested cost: low`) — the trim is about the procedure, not the
|
|
207
|
-
model, so it follows the requested tier; without a cost line, their disclosure instruction can
|
|
208
|
-
never fire.
|
|
209
|
-
3. **Pass §2's `model`** — the mapped value, or your own no-mapped-model pick when it applies.
|
|
210
|
-
4. **Hand it the scope your own procedure defines** (the iteration, the slug, the target file —
|
|
211
|
-
whatever your own instruction says to pass) — never a paraphrase of the whole command standing
|
|
212
|
-
in for the agent's own prompt. When the procedure printed a run card (`somi-card.mjs`), it goes
|
|
213
|
-
first in the briefing, byte for byte, before the cost line and the scope.
|
|
214
|
-
5. **If the host rejects a model you picked yourself** (§2's no-mapped-model case), retry the same
|
|
215
|
-
dispatch once without a model argument and say you're doing so. A **mapped** model is never
|
|
216
|
-
dropped this way: if the host rejects it, try the next `model_candidates` entry, and when none is
|
|
217
|
-
left, fail loudly and say so.
|
|
218
|
-
6. **If the agent cannot be started as its `agent_type`** — `agent_type` is `null` (a host with no
|
|
219
|
-
registration), or the host rejects the type (`Unknown agent_type`, a disabled subagent, the plugin
|
|
220
|
-
not installed or not enabled) — **stop**. Tell the user, in one line, which canonical agent could
|
|
221
|
-
not start, as which type, on which host, and the host's reason (`could not start somi-coder as
|
|
222
|
-
somi:somi-coder on copilot: Unknown agent_type`). Never substitute an agent, run its procedure
|
|
223
|
-
yourself, or report the step done. The fix is host-side: enable the plugin, or check `/subagents`.
|
|
224
|
-
|
|
225
|
-
**A dispatched agent's own checkpoints stay in force.** Resolving and starting it never itself
|
|
226
|
-
authorizes an outward-facing action a checkpoint still gates — a `gh pr create` confirmation, an
|
|
227
|
-
incident framing exchange, a plan's decision round-trip all still happen exactly where the
|
|
228
|
-
dispatched agent's or command's own text says they do.
|
|
229
|
-
|
|
230
|
-
## Failure modes to avoid
|
|
231
|
-
|
|
232
|
-
- **Guessing a model or a tier when resolution fails**, or when the host rejects the model
|
|
233
|
-
argument. A resolver that was **reached** and answered with an error (§3) is always a stop — map
|
|
234
|
-
the exit code and surface its own message, never fall back to the CLI or to judgment on top of a
|
|
235
|
-
real answer. The §4 judgment fallback exists for a *different* failure: neither `somi_resolve`
|
|
236
|
-
nor a reachable CLI could be called **at all** this turn. Even then it is never silent — say
|
|
237
|
-
plainly which of the two you couldn't reach before resolving by hand.
|
|
238
|
-
- **Skipping the `low`-ceiling announcement, or repeating it needlessly.** Once per session, before
|
|
239
|
-
the first agent that resolves to `low` starts — not before every later one, and not skipped just
|
|
240
|
-
because nobody asked again.
|
|
241
|
-
- **Passing nothing when the resolver reports no mapped model, without saying so.** A `null` model
|
|
242
|
-
calls for your own pick for that tier when a model identifier is actually visible to you this
|
|
243
|
-
turn, disclosed as a choice — never an invented value passed off as the mapping's own answer, and
|
|
244
|
-
never a silent omission when one genuinely was visible.
|
|
245
|
-
- **Dispatching without a cost briefing line.** Without `dispatched at cost: <tier>` or `requested
|
|
246
|
-
cost: <tier>`, the agent's own "Running at `low`" disclosure can never fire, even when it should.
|
|
247
|
-
- **Starting a stand-in.** A general-purpose or built-in agent given the SoMi agent's text, a bare or
|
|
248
|
-
pre-4.0.0 name as the type, or the agent's procedure run inline when its `agent_type` was refused:
|
|
249
|
-
each hides which agent actually ran. Stop and report it instead (§5, step 6).
|
|
250
|
-
- **Writing `dispatched at cost: <tier>` for an unenforced dispatch** (`enforced: false`), or staying
|
|
251
|
-
silent about a high-tier agent whose model nothing pinned. Use `requested cost: <tier> (not enforced: no mapped model)` and print the unenforced notice (§2).
|
|
252
|
-
|
|
253
|
-
## Consumers
|
|
254
|
-
|
|
255
|
-
Loaded by `agents/somi.md` (the dispatcher, before it starts `somi-flow` or `somi-general`), by
|
|
256
|
-
`agents/somi-flow.md`, and by every `skills/flow-*/SKILL.md` procedure that Tasks an agent
|
|
257
|
-
directly — one line at that point in the procedure pointing here is enough; do not re-embed this
|
|
258
|
-
procedure in a flow skill. `scripts/validate.sh` derives which flow skills Task an agent from the
|
|
259
|
-
real agent names under `agents/` and fails the build if one of them doesn't reference this skill.
|