@skathio/somi 4.1.1 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/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 +83 -228
- 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 +28 -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 +40 -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 +165 -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 +73 -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 +38 -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 +181 -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,147 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: api-design
|
|
3
|
-
description: Use when adding or changing an HTTP/gRPC/library API. Covers resource modeling, error shapes, versioning, idempotency, pagination, and backward compatibility. Optimizes for callers, not implementers.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# API design
|
|
7
|
-
|
|
8
|
-
You are about to expose an interface — HTTP endpoint, gRPC method, library function. Once it has one
|
|
9
|
-
caller you don't control, it's expensive to change. Design it for the caller's life, not your morning's
|
|
10
|
-
convenience.
|
|
11
|
-
|
|
12
|
-
## First principles
|
|
13
|
-
|
|
14
|
-
- **Shape for callers.** What does the consumer actually need? Don't model the interface around the
|
|
15
|
-
implementation's convenience.
|
|
16
|
-
- **Predictable > clever.** Surprise costs every future engineer who hits it.
|
|
17
|
-
- **Boring & consistent.** Within an API, the same concept should use the same vocabulary, the same
|
|
18
|
-
pagination, the same error shape.
|
|
19
|
-
|
|
20
|
-
## Resource modeling (REST)
|
|
21
|
-
|
|
22
|
-
- **Nouns, not verbs.** `POST /orders` to create. `POST /orders/{id}/cancel` only if "cancel" is a
|
|
23
|
-
workflow that doesn't reduce to PATCH.
|
|
24
|
-
- **Collections + items.** `GET /orders` (list), `GET /orders/{id}` (item), `POST /orders` (create),
|
|
25
|
-
`PATCH /orders/{id}` (partial update), `DELETE /orders/{id}` (remove or soft-remove).
|
|
26
|
-
- **Subresources** for hierarchy: `GET /orders/{id}/line-items`. Stop nesting at depth 2 unless deeper is
|
|
27
|
-
semantically required.
|
|
28
|
-
- **Sub-actions** sparingly: `POST /orders/{id}/cancel` if `cancel` isn't a state field update.
|
|
29
|
-
- **IDs**: stable, opaque, externally unique. Don't expose internal autoincrement primary keys.
|
|
30
|
-
|
|
31
|
-
## Idempotency
|
|
32
|
-
|
|
33
|
-
- **Safe by default for GET/HEAD/OPTIONS.**
|
|
34
|
-
- **Idempotent for PUT/DELETE** (same call, same outcome).
|
|
35
|
-
- **POST is non-idempotent** by default. For state-changing POSTs that can be retried by clients (mobile,
|
|
36
|
-
network blips, payments), accept an `Idempotency-Key` header and dedupe server-side for a TTL.
|
|
37
|
-
|
|
38
|
-
## Error shape
|
|
39
|
-
|
|
40
|
-
Pick one error envelope and use it everywhere:
|
|
41
|
-
|
|
42
|
-
```json
|
|
43
|
-
{
|
|
44
|
-
"error": {
|
|
45
|
-
"code": "ORDER_NOT_FOUND",
|
|
46
|
-
"message": "Order with id ord_123 not found.",
|
|
47
|
-
"details": { "id": "ord_123" }
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
- **Stable machine code**: `ORDER_NOT_FOUND` — clients branch on this.
|
|
53
|
-
- **Human message**: for logs / dashboards, not for end users (don't leak internals).
|
|
54
|
-
- **Structured details**: optional, for clients to render specific cases.
|
|
55
|
-
- **HTTP status carries the broad category**: 4xx caller-fault, 5xx server-fault. Don't return 200 with
|
|
56
|
-
`{"error": ...}`.
|
|
57
|
-
|
|
58
|
-
## Status codes (quick cheat sheet)
|
|
59
|
-
|
|
60
|
-
| Code | When |
|
|
61
|
-
|------|---------------------------------------------------------------------|
|
|
62
|
-
| 200 | OK (GET, PUT/PATCH that returned the resource) |
|
|
63
|
-
| 201 | Created (POST that created a resource — include `Location` header) |
|
|
64
|
-
| 204 | No Content (DELETE, or PUT with no body) |
|
|
65
|
-
| 400 | Caller sent malformed/invalid input |
|
|
66
|
-
| 401 | Unauthenticated |
|
|
67
|
-
| 403 | Authenticated but not allowed |
|
|
68
|
-
| 404 | Resource doesn't exist OR caller can't see it (don't leak existence)|
|
|
69
|
-
| 409 | Conflict — concurrent modification, duplicate, state mismatch |
|
|
70
|
-
| 422 | Validation failure (sometimes preferred over 400) |
|
|
71
|
-
| 429 | Rate limited (include `Retry-After`) |
|
|
72
|
-
| 5xx | Server fault |
|
|
73
|
-
|
|
74
|
-
Don't get cute (`418`). Don't reinvent (`299`).
|
|
75
|
-
|
|
76
|
-
## Pagination
|
|
77
|
-
|
|
78
|
-
Pick one and stick to it across the API:
|
|
79
|
-
|
|
80
|
-
- **Cursor-based** (preferred for changing data): `?cursor=<opaque>&limit=N` → response includes `next_cursor`
|
|
81
|
-
(or `null` at end).
|
|
82
|
-
- **Offset-based** (only for static data): `?offset=N&limit=N`. Bad for inserts/deletes during iteration.
|
|
83
|
-
- **Page-based**: `?page=N&per_page=N`. Same caveats as offset.
|
|
84
|
-
|
|
85
|
-
Always include the **next pointer** in the response, not just a flag. Callers shouldn't construct pages.
|
|
86
|
-
|
|
87
|
-
## Filtering, sorting, fields
|
|
88
|
-
|
|
89
|
-
- **Filter**: `?status=active&owner=u_123`. Document allowed fields.
|
|
90
|
-
- **Sort**: `?sort=created_at,-priority` (prefix `-` for descending). Allowlist sortable fields.
|
|
91
|
-
- **Field selection**: `?fields=id,name,status` for bandwidth-sensitive clients. Optional.
|
|
92
|
-
|
|
93
|
-
## Versioning
|
|
94
|
-
|
|
95
|
-
Choose one path:
|
|
96
|
-
|
|
97
|
-
1. **URI versioning**: `/v1/orders`. Coarse but unambiguous.
|
|
98
|
-
2. **Header versioning**: `Accept: application/vnd.example.v1+json`. Cleaner URIs, harder caching.
|
|
99
|
-
3. **No versioning, additive forever**: feasible if discipline is iron and the API is small.
|
|
100
|
-
|
|
101
|
-
**Breaking changes** require either a new version or a deprecation cycle (announce → warn → remove with
|
|
102
|
-
months of overlap).
|
|
103
|
-
|
|
104
|
-
## Backward compatibility
|
|
105
|
-
|
|
106
|
-
- **Adding fields** to responses is safe (clients should ignore unknowns; document this expectation).
|
|
107
|
-
- **Removing or renaming fields** is breaking. Deprecate, warn, then remove.
|
|
108
|
-
- **Changing types or meanings** is breaking even with the same name.
|
|
109
|
-
- **Tightening validation** is breaking (calls that used to succeed now fail).
|
|
110
|
-
- **Loosening validation** is generally safe.
|
|
111
|
-
|
|
112
|
-
Document a deprecation policy: `Deprecation: true` header, sunset date, alternative.
|
|
113
|
-
|
|
114
|
-
## Time
|
|
115
|
-
|
|
116
|
-
- **ISO-8601 UTC** in responses (`2026-05-20T18:42:11Z`). Never bare timestamps without timezone.
|
|
117
|
-
- **Accept ISO-8601** in inputs; reject otherwise. Don't guess locales.
|
|
118
|
-
|
|
119
|
-
## IDs
|
|
120
|
-
|
|
121
|
-
- **Prefix typed IDs** for human safety: `ord_8f3a...`, `usr_2c91...`. Bug reports cite IDs all the time;
|
|
122
|
-
prefixed IDs prevent confusion across types.
|
|
123
|
-
- **Opaque**: don't encode internal facts (timestamps, shard hints) where callers can see them.
|
|
124
|
-
|
|
125
|
-
## Rate limiting
|
|
126
|
-
|
|
127
|
-
- **`429 Too Many Requests`** with `Retry-After` (seconds) and ideally `X-RateLimit-Remaining`,
|
|
128
|
-
`X-RateLimit-Reset`.
|
|
129
|
-
- **Limit per principal**, not per IP, when there's auth.
|
|
130
|
-
- **Document the limits** publicly. Hidden limits cause outages.
|
|
131
|
-
|
|
132
|
-
## Security touchpoints
|
|
133
|
-
|
|
134
|
-
API design is half security design. Cross-reference [`owasp-defense`](../owasp-defense/SKILL.md):
|
|
135
|
-
|
|
136
|
-
- **AuthZ at the resource**, not just the route.
|
|
137
|
-
- **Idempotency keys** on state-changing public endpoints.
|
|
138
|
-
- **Input validation** with allowlists.
|
|
139
|
-
- **SSRF** if the endpoint takes a URL.
|
|
140
|
-
- **PII** — don't return more than the caller needs.
|
|
141
|
-
|
|
142
|
-
## When to invoke `somi-architecture-reviewer`
|
|
143
|
-
|
|
144
|
-
- The API introduces a new contract that other systems will depend on.
|
|
145
|
-
- The API changes dependency direction (e.g., service A now calls service B where it used to be the
|
|
146
|
-
reverse).
|
|
147
|
-
- The versioning strategy is being decided for the first time.
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: clean-code
|
|
3
|
-
description: Use when naming things, structuring functions, deciding whether to add a comment, or cleaning up code mid-implementation. Pragmatic clean-code rules with explicit anti-patterns and when-not-to-apply guidance.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Clean code — pragmatic rules
|
|
7
|
-
|
|
8
|
-
The principles are in [`rules/20-clean-code.md`](../../rules/20-clean-code.md) — that's the
|
|
9
|
-
always-on floor. This skill adds **operational depth**: decision tables (parameter counts,
|
|
10
|
-
function length), before/after example pairs (early returns, boolean naming), and
|
|
11
|
-
when-not-to-apply guidance. When a section restates the rule verbatim, replace with a pointer
|
|
12
|
-
and only keep the operational expansion.
|
|
13
|
-
|
|
14
|
-
## Naming
|
|
15
|
-
|
|
16
|
-
### Rules of thumb
|
|
17
|
-
|
|
18
|
-
- **Intent > mechanics.** `eligibleUserIds` beats `arr`.
|
|
19
|
-
- **Length scales with scope.** Loop variable: 1–3 chars. Module-level: spell it out.
|
|
20
|
-
- **One concept, one word.** Don't shuffle `fetch`/`get`/`retrieve`/`load`/`pull` for the same operation.
|
|
21
|
-
- **No type-encoded prefixes** (`strName`, `bIsValid`).
|
|
22
|
-
- **Watch for weasel words**: `Manager`, `Helper`, `Util`, `Processor`, `Handler`, `Service`. They usually
|
|
23
|
-
hide an SRP violation.
|
|
24
|
-
|
|
25
|
-
### Boolean naming
|
|
26
|
-
|
|
27
|
-
- **Be a question.** `isActive`, `hasPermission`, `canEdit`, `shouldRetry`.
|
|
28
|
-
- **Avoid double negatives.** `isNotInvalid` is unreadable.
|
|
29
|
-
- **Avoid ambiguity.** `flag` is meaningless. `accountFrozen` is clear.
|
|
30
|
-
|
|
31
|
-
### Side-effect signaling
|
|
32
|
-
|
|
33
|
-
- **Verbs for action**, **nouns for state**.
|
|
34
|
-
- `user.name` is state; `user.deactivate()` is action.
|
|
35
|
-
- `validateOrder` better not also charge the card. Name truthfully.
|
|
36
|
-
|
|
37
|
-
## Functions
|
|
38
|
-
|
|
39
|
-
### Length
|
|
40
|
-
|
|
41
|
-
Aim for under ~20 lines. Length is a smell, not a hard limit. A 40-line function that reads top-to-bottom
|
|
42
|
-
without nesting is fine. A 15-line function with five nested ifs is not.
|
|
43
|
-
|
|
44
|
-
### Parameters
|
|
45
|
-
|
|
46
|
-
| Count | Verdict |
|
|
47
|
-
|-------|--------------------------------------------------------|
|
|
48
|
-
| 0 | Suspect — what state is it pulling from? |
|
|
49
|
-
| 1 | Great. |
|
|
50
|
-
| 2 | Great. |
|
|
51
|
-
| 3 | Borderline. Consider a parameter object if related. |
|
|
52
|
-
| 4+ | Almost always wants a struct/record/object. |
|
|
53
|
-
|
|
54
|
-
### Flag arguments
|
|
55
|
-
|
|
56
|
-
Banned.
|
|
57
|
-
|
|
58
|
-
```ts
|
|
59
|
-
// bad
|
|
60
|
-
processOrder(order, true); // what does `true` mean?
|
|
61
|
-
|
|
62
|
-
// good
|
|
63
|
-
processOrderAndCharge(order);
|
|
64
|
-
processOrderAsDraft(order);
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
### Early returns
|
|
68
|
-
|
|
69
|
-
```python
|
|
70
|
-
# bad — pyramid of doom
|
|
71
|
-
def process(req):
|
|
72
|
-
if req.is_valid():
|
|
73
|
-
if req.user.has_quota():
|
|
74
|
-
if not req.is_duplicate():
|
|
75
|
-
# actual work, four levels deep
|
|
76
|
-
...
|
|
77
|
-
|
|
78
|
-
# good — guard clauses, work at the surface level
|
|
79
|
-
def process(req):
|
|
80
|
-
if not req.is_valid(): return Err("invalid")
|
|
81
|
-
if not req.user.has_quota(): return Err("quota")
|
|
82
|
-
if req.is_duplicate(): return Err("duplicate")
|
|
83
|
-
# actual work
|
|
84
|
-
...
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
## Comments
|
|
88
|
-
|
|
89
|
-
**Default: no comment.** The bar to add one is high. A comment is justified only when **the WHY is
|
|
90
|
-
non-obvious**:
|
|
91
|
-
|
|
92
|
-
- A hidden constraint (`// must run before the lock is acquired — see issue #2412`).
|
|
93
|
-
- A non-local invariant (`// keep aligned with the schema in migrations/0042`).
|
|
94
|
-
- A workaround for a specific bug or library quirk (`// libfoo 1.4 returns null for empty results`).
|
|
95
|
-
- A subtle performance choice (`// pre-allocate; the hot path runs ~1e6 times/sec`).
|
|
96
|
-
|
|
97
|
-
**Banned**:
|
|
98
|
-
|
|
99
|
-
- Narrating WHAT the code does (`// increment i`).
|
|
100
|
-
- References to the current PR/task/ticket (`// added for TICKET-1234`) — that rots; PR history is the
|
|
101
|
-
right place.
|
|
102
|
-
- Commented-out code (delete it; source control remembers).
|
|
103
|
-
- Outdated comments. If you change the code, update or delete the comment.
|
|
104
|
-
|
|
105
|
-
## Errors
|
|
106
|
-
|
|
107
|
-
Canonical rules: [`rules/20-clean-code.md`](../../rules/20-clean-code.md) §Errors. Operational
|
|
108
|
-
expansion specific to this skill:
|
|
109
|
-
|
|
110
|
-
- **Preserve cause idiomatically.** `raise ProcessingError("step 3") from e` (Python),
|
|
111
|
-
`fmt.Errorf("step 3: %w", err)` (Go), `throw new ProcessingError("step 3", { cause: e })`
|
|
112
|
-
(JS). Don't `throw new Error(e.message)` — the stack and chain are lost.
|
|
113
|
-
- **Boundary-decided error logging.** Don't log-and-rethrow at every layer; one log at the
|
|
114
|
-
layer that decides the response. Many duplicates for one event is dashboard noise.
|
|
115
|
-
|
|
116
|
-
## Structure
|
|
117
|
-
|
|
118
|
-
Canonical rules: [`rules/20-clean-code.md`](../../rules/20-clean-code.md) §Structure. Operational
|
|
119
|
-
addition specific to this skill:
|
|
120
|
-
|
|
121
|
-
- **No `utils.py` / `helpers.ts` / `common.go`** grab-bag modules. They become SRP graveyards.
|
|
122
|
-
When you reach for one, the actual concept already wants a name — give it one.
|
|
123
|
-
|
|
124
|
-
## Diff hygiene
|
|
125
|
-
|
|
126
|
-
See [`rules/20-clean-code.md`](../../rules/20-clean-code.md) §Diff hygiene for the canonical
|
|
127
|
-
list. Operational note: hooks (`hooks/pre-tool/guard-protected-paths.mjs`) enforce some of these
|
|
128
|
-
mechanically (e.g., no lockfile hand-edits, no writes inside `.git/`). When a hook fires, the
|
|
129
|
-
rule is being enforced — don't work around the hook.
|
|
130
|
-
|
|
131
|
-
## When clean-code rules are *not* the right move
|
|
132
|
-
|
|
133
|
-
- **Hot paths.** Sometimes the readable version costs 10x and you need the gnarly one. Document why.
|
|
134
|
-
- **Generated code.** Don't fight your generator's conventions.
|
|
135
|
-
- **Existing code without coverage.** Don't "clean up" code you can't safely modify. Refactor under green
|
|
136
|
-
or escalate to [`somi-test-strategist`](../testing-playbook/SKILL.md) first.
|
|
137
|
-
|
|
138
|
-
## The reader test
|
|
139
|
-
|
|
140
|
-
Write code as if explaining the problem to a smart colleague who knows the language but not this codebase.
|
|
141
|
-
Names, structure, and tests should let them follow along without questions. When a reviewer asks "what
|
|
142
|
-
does this do?", the code lost.
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: flow-adopt
|
|
3
|
-
description: The /adopt procedure, loaded by the /adopt command and by the somi-flow runner.
|
|
4
|
-
user-invocable: false
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# /adopt — Onboard SoMi into an existing codebase
|
|
8
|
-
|
|
9
|
-
You are running SoMi's **one-time brownfield onboarding**. The goal: after this command, SoMi
|
|
10
|
-
already *knows this repo* — its map, its conventions, its weak spots — and the team has a
|
|
11
|
-
concrete first exercise, instead of "read thirteen docs and type `/plan`".
|
|
12
|
-
|
|
13
|
-
This is a composite of existing pieces, run in order, with the user confirming at each seam.
|
|
14
|
-
|
|
15
|
-
> **No `cost:` of its own, and no `model:` either — it runs on whatever model this session is
|
|
16
|
-
> already using.** Stage 1 Tasks
|
|
17
|
-
> the `somi-atlas` agent ([`agents/somi-atlas.md`](../../agents/somi-atlas.md)), which defaults to `high` on its
|
|
18
|
-
> own account and resolves against the session ceiling independently of this command. Stages 2 and
|
|
19
|
-
> 4 read and write directly, inline, at whatever tier is already running this command. Stage 3 may
|
|
20
|
-
> also Task [`somi-test-strategist`](../../agents/somi-test-strategist.md) for the gap report's test-thin-ice
|
|
21
|
-
> depth — it resolves on its own account exactly as Stage 1's `somi-atlas` does, not at this command's
|
|
22
|
-
> tier.
|
|
23
|
-
|
|
24
|
-
## Stage 1 — Build the Repo Atlas (default `high`, the expensive step)
|
|
25
|
-
|
|
26
|
-
Before this `Task`, call `somi_resolve` for `somi-atlas` (with `project_dir`), 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)`); full rules: the `somi-dispatch` skill (`somi_skill`,
|
|
27
|
-
or `somi:somi-dispatch` on Claude Code). Task the `somi-atlas` agent
|
|
28
|
-
([`agents/somi-atlas.md`](../../agents/somi-atlas.md)) to build or refresh
|
|
29
|
-
`.somi/atlas.md` (module map, dependency rules, conventions digest, hotspots, test topology,
|
|
30
|
-
SHA-stamped). It runs its own staleness check and skips the rebuild — saying so — when a fresh
|
|
31
|
-
atlas already exists.
|
|
32
|
-
|
|
33
|
-
Present the atlas §1 framing + module count and pause briefly: "does this map match your mental
|
|
34
|
-
model?" — a wrong map should be corrected *now*, by the people who know, not discovered by the
|
|
35
|
-
first `/design`.
|
|
36
|
-
|
|
37
|
-
## Stage 2 — Confirm conventions into `99-overrides.md`
|
|
38
|
-
|
|
39
|
-
From the atlas §4 digest (and the instruction files it lists), draft the project's
|
|
40
|
-
`.somi/rules/99-overrides.md` scaffold **pre-filled with the detected conventions** — each as a
|
|
41
|
-
`## Convention:` block, plus a `## Override:` block for anything that contradicts a SoMi default
|
|
42
|
-
(name the rule file it overrides and a removal condition). `.somi/` is the neutral location
|
|
43
|
-
regardless of which host (Claude Code, GitHub Copilot) is consuming SoMi — never write this under
|
|
44
|
-
`.claude/` or `.github/`, and never at the project root.
|
|
45
|
-
|
|
46
|
-
**Present the draft to the user for confirmation before writing** — detected ≠ intended; the
|
|
47
|
-
team may be tolerating practices they don't want codified. Apply their edits, then write the
|
|
48
|
-
file (or, if one exists, propose additions only — never clobber). Where instruction files and
|
|
49
|
-
observed practice disagreed (the atlas records this), ask which one wins and record the answer.
|
|
50
|
-
|
|
51
|
-
## Stage 3 — Gap report
|
|
52
|
-
|
|
53
|
-
From the atlas plus targeted checks, produce a short **gap report** (in-chat, plus
|
|
54
|
-
`.somi/reviews/_ad-hoc/<YYYY-MM-DD>-adoption-gaps.md`):
|
|
55
|
-
|
|
56
|
-
- **Test thin ice** — the atlas §6 areas where a regression wouldn't be caught; the 2–3 places
|
|
57
|
-
characterization tests would pay off first (this is [`somi-test-strategist`](../../agents/somi-test-strategist.md)
|
|
58
|
-
territory — before Tasking it, call `somi_resolve` for `somi-test-strategist`; full rules: the
|
|
59
|
-
`somi-dispatch` skill — if the picture needs depth).
|
|
60
|
-
- **Hotspots** — atlas §5, ranked; for each, whether it blocks likely upcoming work.
|
|
61
|
-
- **Candidate first refactors** — untangles that would make the next changes easy
|
|
62
|
-
([`/refactor`](../flow-refactor/SKILL.md) for a contained smell, [`/refactor-design`](../flow-refactor-design/SKILL.md)
|
|
63
|
-
candidates for anything spanning modules), each with the smell named precisely.
|
|
64
|
-
- **Guardrail fit** — anything in the repo the hooks would fight (e.g. a workflow that
|
|
65
|
-
hand-edits a lockfile) → recommend the matching `.somi/config.json` policy
|
|
66
|
-
(`dep_install.allow`, `lockfiles.allow_edit`) instead of per-session env vars.
|
|
67
|
-
|
|
68
|
-
## Stage 4 — Suggest the calibration work item
|
|
69
|
-
|
|
70
|
-
Recommend one **small, real** feature or fix from the team's actual backlog shape (ask if none
|
|
71
|
-
is obvious) to run as `/ship` — the calibration exercise from
|
|
72
|
-
[GOVERNANCE.md](../../docs/GOVERNANCE.md): it exercises plan → code-loop → review end-to-end, and
|
|
73
|
-
disagreements it surfaces belong in `.somi/rules/99-overrides.md` while they're fresh. For a bug, recommend
|
|
74
|
-
`/debug` instead.
|
|
75
|
-
|
|
76
|
-
## Summarise back
|
|
77
|
-
|
|
78
|
-
- Atlas: built/refreshed, module count, top hotspots.
|
|
79
|
-
- Conventions: confirmed count, overrides recorded, disagreements resolved.
|
|
80
|
-
- Gap report: the top 3 items, with the report's path.
|
|
81
|
-
- The suggested calibration item + exact next command.
|
|
82
|
-
- One-line orientation: "on GitHub Copilot, `@somi` any time for status and routing."
|
|
83
|
-
|
|
84
|
-
## Guardrails
|
|
85
|
-
|
|
86
|
-
- **Stage 2 writes nothing without confirmation.** Codifying conventions is a team decision;
|
|
87
|
-
you draft, they decide (this is the batch verification protocol applied to onboarding).
|
|
88
|
-
- **Never clobber** an existing `.somi/rules/99-overrides.md`, `CLAUDE.md`, or atlas — propose additions.
|
|
89
|
-
- **The gap report is descriptive.** No unsolicited refactoring, no "fixing" anything during
|
|
90
|
-
adoption. The output is knowledge + a recommended first exercise, not diffs.
|
|
91
|
-
- **Once per repo, roughly.** Re-running is safe (atlas refresh + report regeneration) but the
|
|
92
|
-
overrides confirmation shouldn't be re-litigated on every run — propose only deltas.
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: flow-architecture-review
|
|
3
|
-
description: The /architecture-review procedure, loaded by the /architecture-review command and by the somi-flow runner.
|
|
4
|
-
user-invocable: false
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# /architecture-review — Targeted architectural review
|
|
8
|
-
|
|
9
|
-
You are running an **architecture-only** review using somi.
|
|
10
|
-
|
|
11
|
-
Target: **$ARGUMENTS** (empty = current working-tree diff vs. default branch, scoped to a single
|
|
12
|
-
in-progress work item if exactly one exists).
|
|
13
|
-
|
|
14
|
-
## When to invoke
|
|
15
|
-
|
|
16
|
-
Always when the change introduces or modifies any of:
|
|
17
|
-
|
|
18
|
-
- A new module, package, or service.
|
|
19
|
-
- A public contract (HTTP / RPC / library API / event schema).
|
|
20
|
-
- A dependency-direction change, especially at the domain↔infrastructure boundary.
|
|
21
|
-
- An ADR or design doc choosing between patterns (sync/async, monolith/service, push/pull).
|
|
22
|
-
- A module split or merge.
|
|
23
|
-
|
|
24
|
-
If the change is purely internal refactoring within an existing module with no contract change,
|
|
25
|
-
`/review` (which still invokes the reviewer with arch awareness) is usually enough — this command
|
|
26
|
-
is for cases where structure is the primary subject.
|
|
27
|
-
|
|
28
|
-
## What to do
|
|
29
|
-
|
|
30
|
-
### 1. Resolve the target
|
|
31
|
-
|
|
32
|
-
Use the same resolution logic as [`/review`](../flow-review/SKILL.md): slug, working tree, range, PR, file,
|
|
33
|
-
or `plan <slug>`.
|
|
34
|
-
|
|
35
|
-
### 2. Brief the `somi-architecture-reviewer` agent
|
|
36
|
-
|
|
37
|
-
Before this `Task`, call `somi_resolve` for `somi-architecture-reviewer` (with `project_dir`), 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)`); full rules: the `somi-dispatch` skill
|
|
38
|
-
(`somi_skill`, or `somi:somi-dispatch` on Claude Code). Via the Task tool, pass:
|
|
39
|
-
|
|
40
|
-
- The diff or plan-artifact set.
|
|
41
|
-
- The work-item paths (`spec.md`, `decisions.md`, the iteration phase file, recent `diary.md`
|
|
42
|
-
entries) when scoped.
|
|
43
|
-
- The expectation: restate the decision, identify forces, locate boundaries, trace dependencies,
|
|
44
|
-
stress-test the contract against three plausible future requirements, check reversibility, check
|
|
45
|
-
team fit.
|
|
46
|
-
|
|
47
|
-
The `somi-architecture-reviewer` agent is read-only **by contract, not by platform restriction** — it
|
|
48
|
-
holds Write/Edit but is forbidden from using them, so the command owns every write. Have it **return** its findings;
|
|
49
|
-
the command owns all writes.
|
|
50
|
-
|
|
51
|
-
### 3. Findings must include
|
|
52
|
-
|
|
53
|
-
- **What's being decided** — the reviewer's restatement.
|
|
54
|
-
- **Forces evaluated** — the constraints/requirements being weighed.
|
|
55
|
-
- **Alternatives considered** — at least two real options, each with the case for and against.
|
|
56
|
-
- **Verdict** — `approve` / `approve-with-changes` / `request-changes` / `reject`.
|
|
57
|
-
- **Findings** — severity-graded (same scale as `/review`).
|
|
58
|
-
- **Reversibility note** — how hard to undo in 18 months and what would force it.
|
|
59
|
-
- **Follow-ups** — issues to file, monitoring to add, sunset criteria for any compromises.
|
|
60
|
-
|
|
61
|
-
If the architecture has security implications, the command **must** also invoke
|
|
62
|
-
`somi-security-reviewer` via Task — call `somi_resolve` for `somi-security-reviewer` first (full rules: the
|
|
63
|
-
`somi-dispatch` skill) — and merge those findings.
|
|
64
|
-
|
|
65
|
-
### 4. Write the review
|
|
66
|
-
|
|
67
|
-
Filename pattern: `<YYYY-MM-DD>-arch-<phase>.<iter>-<verdict>.md` under
|
|
68
|
-
`.somi/reviews/<slug>/` when scoped, or `.somi/reviews/_ad-hoc/<YYYY-MM-DD>-arch-<slug>.md`
|
|
69
|
-
otherwise.
|
|
70
|
-
|
|
71
|
-
Use [`templates/REVIEW.md.tmpl`](../../templates/REVIEW.md.tmpl) with architecture framing, or
|
|
72
|
-
[`templates/ADR.md.tmpl`](../../templates/ADR.md.tmpl) if the target is a single ADR.
|
|
73
|
-
|
|
74
|
-
### 5. Update work-item state (if scoped)
|
|
75
|
-
|
|
76
|
-
- `progress.md`: set the iteration's `Reviewed` cell to the verdict (there is no activity log).
|
|
77
|
-
- If a Blocker / Major requires a plan change (e.g., a chosen pattern doesn't fit the boundary),
|
|
78
|
-
append a `review-feedback` diary entry. The follow-up `/plan` revision (or `/code`'s plan-change
|
|
79
|
-
protocol) will apply changes.
|
|
80
|
-
|
|
81
|
-
### 6. Summarise back
|
|
82
|
-
|
|
83
|
-
- **Verdict**.
|
|
84
|
-
- Count of Blockers / Majors / Minors.
|
|
85
|
-
- Top 3 findings with reversibility cost.
|
|
86
|
-
- Pointer to the review file.
|
|
87
|
-
|
|
88
|
-
## Guardrails
|
|
89
|
-
|
|
90
|
-
- **No architecture astronautics.** Don't propose patterns the problem doesn't call for.
|
|
91
|
-
- **Treat low-reversibility decisions with tighter scrutiny.** A public contract is forever
|
|
92
|
-
until explicitly versioned out; a private helper can be rewritten in an afternoon.
|
|
93
|
-
- **Team fit matters.** A "correct" architecture nobody can run is incorrect.
|
|
94
|
-
- **Don't pattern-match to the last system you saw.** Each codebase has its own forces.
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: flow-atlas
|
|
3
|
-
description: The /atlas procedure, loaded by the /atlas command and by the somi-flow runner.
|
|
4
|
-
user-invocable: false
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# /atlas — Build or refresh the Repo Atlas
|
|
8
|
-
|
|
9
|
-
You are running the **repo cartography** workflow of somi: one deep read of this codebase, so
|
|
10
|
-
every later design action starts from a map plus the drift since its SHA instead of re-reading
|
|
11
|
-
the whole repo per work item. This command has no `cost:` of its own — and no `model:` of its own
|
|
12
|
-
either, so it runs on whatever model this session is already using — and Tasks the
|
|
13
|
-
[`somi-atlas`](../../agents/somi-atlas.md) agent for its entire job, which defaults to `high` with no lower
|
|
14
|
-
member.
|
|
15
|
-
|
|
16
|
-
## What to do
|
|
17
|
-
|
|
18
|
-
1. **Resolve the mode.** `$ARGUMENTS` empty → build or refresh, whichever applies; `refresh` →
|
|
19
|
-
explicitly request a refresh — the agent's own staleness check still decides whether that's an
|
|
20
|
-
in-place update on small drift or a rebuild of just the affected sections on structural drift,
|
|
21
|
-
never the whole atlas.
|
|
22
|
-
2. **Brief the `somi-atlas` agent** ([`agents/somi-atlas.md`](../../agents/somi-atlas.md)) — before this `Task`, call
|
|
23
|
-
`somi_resolve` for `somi-atlas` (with `project_dir`), 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)`); full rules: the `somi-dispatch` skill (`somi_skill`, or
|
|
24
|
-
`somi:somi-dispatch` on Claude Code) — with the mode. It runs the
|
|
25
|
-
staleness check itself, does the deep read, and writes `.somi/atlas.md` (and `.somi/README.md`
|
|
26
|
-
if missing) directly — this command owns no writes here.
|
|
27
|
-
3. **Relay its summary**: repo framing + module count, top hotspots, thinnest test ice, any
|
|
28
|
-
instruction-vs-practice disagreements, and the next-step line.
|
|
29
|
-
|
|
30
|
-
## Guardrails
|
|
31
|
-
|
|
32
|
-
- **No editing the repo beyond the atlas.** If the agent proposes anything else, that's a finding
|
|
33
|
-
for the user, not an action to take here.
|
|
34
|
-
- **Commit it.** Recommend committing `.somi/atlas.md` like the other `.somi/` artifacts.
|