@limina-labs/momentum 0.30.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (182) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +214 -0
  3. package/adapters/antigravity/adapter.js +196 -0
  4. package/adapters/antigravity/hooks.json +39 -0
  5. package/adapters/antigravity/instructions/AGENTS.md +638 -0
  6. package/adapters/antigravity/instructions/header.md +3 -0
  7. package/adapters/antigravity/instructions/surfaces.md +153 -0
  8. package/adapters/antigravity/instructions/vars.json +1 -0
  9. package/adapters/antigravity/scripts/antigravity-hook-adapter.sh +147 -0
  10. package/adapters/antigravity/skills/momentum-orient/SKILL.md +29 -0
  11. package/adapters/antigravity/skills/momentum-reviewer-architecture/SKILL.md +39 -0
  12. package/adapters/antigravity/skills/momentum-reviewer-qa/SKILL.md +38 -0
  13. package/adapters/antigravity/skills/momentum-reviewer-security/SKILL.md +42 -0
  14. package/adapters/antigravity/skills/swarm-supervisor/SKILL.md +75 -0
  15. package/adapters/antigravity/workflows/continue.md +39 -0
  16. package/adapters/antigravity/workflows/dispatch.md +49 -0
  17. package/adapters/antigravity/workflows/handoff.md +38 -0
  18. package/adapters/antigravity/workflows/review-code.md +84 -0
  19. package/adapters/antigravity/workflows/scout.md +42 -0
  20. package/adapters/antigravity/workflows/swarm.md +203 -0
  21. package/adapters/claude-code/adapter.js +148 -0
  22. package/adapters/claude-code/commands/continue.md +82 -0
  23. package/adapters/claude-code/commands/dispatch.md +154 -0
  24. package/adapters/claude-code/commands/handoff.md +85 -0
  25. package/adapters/claude-code/commands/review-code.md +194 -0
  26. package/adapters/claude-code/commands/scout.md +119 -0
  27. package/adapters/claude-code/commands/swarm.md +242 -0
  28. package/adapters/claude-code/instructions/header.md +3 -0
  29. package/adapters/claude-code/instructions/vars.json +1 -0
  30. package/adapters/claude-code/settings.json +36 -0
  31. package/adapters/codex/adapter.js +225 -0
  32. package/adapters/codex/agents/momentum-reviewer-architecture.toml +57 -0
  33. package/adapters/codex/agents/momentum-reviewer-qa.toml +52 -0
  34. package/adapters/codex/agents/momentum-reviewer-security.toml +57 -0
  35. package/adapters/codex/agents/swarm-supervisor.toml +76 -0
  36. package/adapters/codex/commands/continue.md +40 -0
  37. package/adapters/codex/commands/dispatch.md +111 -0
  38. package/adapters/codex/commands/handoff.md +57 -0
  39. package/adapters/codex/commands/scout.md +90 -0
  40. package/adapters/codex/commands/swarm.md +334 -0
  41. package/adapters/codex/hooks.json +36 -0
  42. package/adapters/codex/instructions/AGENTS.md +691 -0
  43. package/adapters/codex/instructions/header.md +3 -0
  44. package/adapters/codex/instructions/surfaces.md +206 -0
  45. package/adapters/codex/instructions/vars.json +1 -0
  46. package/adapters/codex/skills/momentum-orient/SKILL.md +29 -0
  47. package/adapters/opencode/adapter.js +224 -0
  48. package/adapters/opencode/agents/momentum-reviewer-architecture.md +54 -0
  49. package/adapters/opencode/agents/momentum-reviewer-qa.md +48 -0
  50. package/adapters/opencode/agents/momentum-reviewer-security.md +48 -0
  51. package/adapters/opencode/agents/swarm-supervisor.md +51 -0
  52. package/adapters/opencode/commands/continue.md +40 -0
  53. package/adapters/opencode/commands/dispatch.md +111 -0
  54. package/adapters/opencode/commands/handoff.md +57 -0
  55. package/adapters/opencode/commands/review-code.md +194 -0
  56. package/adapters/opencode/commands/scout.md +90 -0
  57. package/adapters/opencode/commands/swarm.md +334 -0
  58. package/adapters/opencode/instructions/AGENTS.md +604 -0
  59. package/adapters/opencode/instructions/header.md +3 -0
  60. package/adapters/opencode/instructions/surfaces.md +119 -0
  61. package/adapters/opencode/instructions/vars.json +1 -0
  62. package/adapters/opencode/plugins/momentum.js +219 -0
  63. package/adapters/opencode/skills/momentum-lanes/SKILL.md +30 -0
  64. package/adapters/opencode/skills/momentum-orient/SKILL.md +29 -0
  65. package/adapters/opencode/skills/momentum-track/SKILL.md +28 -0
  66. package/adapters/opencode/skills/momentum-validate/SKILL.md +31 -0
  67. package/bin/antigravity.js +112 -0
  68. package/bin/ecosystem.js +1302 -0
  69. package/bin/lanes.js +300 -0
  70. package/bin/momentum.js +1857 -0
  71. package/bin/okf.js +72 -0
  72. package/bin/orchestration-commands.js +305 -0
  73. package/bin/state-commands.js +218 -0
  74. package/bin/swarm.js +1104 -0
  75. package/bin/waves.js +147 -0
  76. package/core/adapter-capabilities.md +112 -0
  77. package/core/adapter-parity-matrix.md +170 -0
  78. package/core/commands/brainstorm-idea.md +98 -0
  79. package/core/commands/brainstorm-phase.md +129 -0
  80. package/core/commands/complete-phase.md +130 -0
  81. package/core/commands/ecosystem.md +161 -0
  82. package/core/commands/hotfix.md +64 -0
  83. package/core/commands/initiative.md +119 -0
  84. package/core/commands/lanes.md +94 -0
  85. package/core/commands/log.md +45 -0
  86. package/core/commands/migrate.md +70 -0
  87. package/core/commands/review.md +31 -0
  88. package/core/commands/session.md +79 -0
  89. package/core/commands/start-phase.md +161 -0
  90. package/core/commands/start-project.md +142 -0
  91. package/core/commands/sync-docs.md +81 -0
  92. package/core/commands/systematic-debug.md +46 -0
  93. package/core/commands/track.md +54 -0
  94. package/core/commands/validate.md +96 -0
  95. package/core/ecosystem/layout.md +128 -0
  96. package/core/ecosystem/lib/index.js +245 -0
  97. package/core/ecosystem/lib/initiative.js +258 -0
  98. package/core/ecosystem/lib/pointer.js +198 -0
  99. package/core/ecosystem/lib/state.js +295 -0
  100. package/core/ecosystem/schema/ecosystem.schema.json +85 -0
  101. package/core/ecosystem/schema/initiative.schema.json +61 -0
  102. package/core/ecosystem/scripts/session-append.sh +167 -0
  103. package/core/ecosystem/templates/ecosystem-agents.md +79 -0
  104. package/core/ecosystem/templates/ecosystem-claude.md +79 -0
  105. package/core/ecosystem/templates/ecosystem-settings-claude.json +14 -0
  106. package/core/ecosystem/templates/initiative-template.md +50 -0
  107. package/core/engines/subagent-dispatch.md +80 -0
  108. package/core/git-hooks/commit-msg +14 -0
  109. package/core/git-hooks/contract.js +176 -0
  110. package/core/git-hooks/pre-push +15 -0
  111. package/core/git-hooks/run-check.js +160 -0
  112. package/core/instructions/legacy-project-md-hashes.json +12 -0
  113. package/core/instructions/navigation.md +14 -0
  114. package/core/instructions/rules-body.md +454 -0
  115. package/core/lanes/lib/board.js +161 -0
  116. package/core/lanes/lib/land.js +301 -0
  117. package/core/lanes/lib/signals.js +207 -0
  118. package/core/lanes/lib/state.js +325 -0
  119. package/core/lib/frontmatter.js +163 -0
  120. package/core/lib/okf-migrate.js +374 -0
  121. package/core/lib/okf-types.js +61 -0
  122. package/core/lifecycle-contract.md +59 -0
  123. package/core/orchestration/capability-routing.js +120 -0
  124. package/core/orchestration/continue.js +102 -0
  125. package/core/orchestration/dispatch.js +366 -0
  126. package/core/orchestration/events.js +197 -0
  127. package/core/orchestration/handoff.js +317 -0
  128. package/core/orchestration/index.js +50 -0
  129. package/core/orchestration/run-artifact.js +93 -0
  130. package/core/orchestration/scout.js +327 -0
  131. package/core/orchestration/session-log.js +123 -0
  132. package/core/orchestration/tracking.js +180 -0
  133. package/core/orchestration/types.js +131 -0
  134. package/core/scripts/brainstorm-gate.sh +157 -0
  135. package/core/scripts/check-history-reminder.sh +110 -0
  136. package/core/scripts/sessionstart-handoff.sh +180 -0
  137. package/core/specs-templates/CLAUDE.md +484 -0
  138. package/core/specs-templates/README.md +32 -0
  139. package/core/specs-templates/specs/README.md +30 -0
  140. package/core/specs-templates/specs/adhoc/README.md +31 -0
  141. package/core/specs-templates/specs/adhoc/_TEMPLATE.md +29 -0
  142. package/core/specs-templates/specs/architecture/ecosystem.md +214 -0
  143. package/core/specs-templates/specs/backlog/backlog.md +46 -0
  144. package/core/specs-templates/specs/backlog/details/.gitkeep +0 -0
  145. package/core/specs-templates/specs/changelog/.gitkeep +0 -0
  146. package/core/specs-templates/specs/decisions/0000-template.md +33 -0
  147. package/core/specs-templates/specs/decisions/README.md +29 -0
  148. package/core/specs-templates/specs/decisions/impact-map.md +14 -0
  149. package/core/specs-templates/specs/decisions/index.md +4 -0
  150. package/core/specs-templates/specs/index.md +16 -0
  151. package/core/specs-templates/specs/phases/README.md +41 -0
  152. package/core/specs-templates/specs/phases/index.md +6 -0
  153. package/core/specs-templates/specs/planning/roadmap.md +23 -0
  154. package/core/specs-templates/specs/status.md +70 -0
  155. package/core/specs-templates/specs/vision/principles.md +16 -0
  156. package/core/specs-templates/specs/vision/project-charter.md +35 -0
  157. package/core/specs-templates/specs/vision/success-criteria.md +19 -0
  158. package/core/swarm/absorb.js +294 -0
  159. package/core/swarm/conductor.js +499 -0
  160. package/core/swarm/focus.js +151 -0
  161. package/core/swarm/inbox.js +222 -0
  162. package/core/swarm/join.js +138 -0
  163. package/core/swarm/lib/board.js +178 -0
  164. package/core/swarm/lib/brief.js +157 -0
  165. package/core/swarm/lib/git-sha-cache.js +71 -0
  166. package/core/swarm/lib/incremental-log.js +117 -0
  167. package/core/swarm/lib/manifest.js +578 -0
  168. package/core/swarm/lib/pre-merge.js +112 -0
  169. package/core/swarm/lib/saga.js +146 -0
  170. package/core/swarm/lib/sessions.js +83 -0
  171. package/core/swarm/lib/tokens.js +255 -0
  172. package/core/swarm/lib/wave-ordering.js +55 -0
  173. package/core/swarm/schema/board.schema.json +54 -0
  174. package/core/swarm/schema/contract.schema.json +56 -0
  175. package/core/swarm/schema/dispatch-run.schema.json +70 -0
  176. package/core/swarm/schema/manifest.schema.json +234 -0
  177. package/core/swarm/schema/signal.schema.json +61 -0
  178. package/core/swarm/signals.js +296 -0
  179. package/core/swarm/supervise.md +81 -0
  180. package/core/waves/lib/plan-graph.js +175 -0
  181. package/core/waves/lib/waves.js +83 -0
  182. package/package.json +46 -0
@@ -0,0 +1,40 @@
1
+ Pick up a pending handoff in this repo. Reads `.momentum/inbox/handoff-NNN.md`, parses the structured context block, marks the inbox file as read, and emits a `[NOTE]` in the receiving repo's active phase history.
2
+
3
+ > **Three doors, one library.** This is the slash-command door for opencode. CLI: `momentum continue [--handoff <id>]`. SessionStart hook auto-greets pending handoffs. All three call `core/orchestration/continue.js`.
4
+
5
+ ## Usage
6
+
7
+ ```
8
+ /continue pick up the OLDEST pending handoff
9
+ /continue <id> pick up handoff-<id> specifically
10
+ /continue list list pending handoffs without picking
11
+ ```
12
+
13
+ ## Steps
14
+
15
+ ### Step 1 — List or pick
16
+
17
+ ```js
18
+ const orchestration = require('<momentum-root>/core/orchestration');
19
+ const block = await orchestration.continueHandoff.continueHandoff({
20
+ repo, handoffId, ecosystem,
21
+ });
22
+ ```
23
+
24
+ ### Step 2 — Act on the block
25
+
26
+ Narrate summary, decisions, files, verification commands, open questions. Proceed with the work.
27
+
28
+ ### Step 3 — Don't surprise the user
29
+
30
+ Large blocks → summarise + offer "want me to read the full block?".
31
+
32
+ ## Tracking contract
33
+
34
+ - Auto: inbox file → `read/` + `[NOTE]` in receiving active phase history.
35
+
36
+ ## Errors
37
+
38
+ - No pending → "no pending handoffs in this repo" (not an error).
39
+ - Specified id not found → error with list of pending ids.
40
+ - Malformed inbox → error pointing at the file.
@@ -0,0 +1,111 @@
1
+ Parallel multi-repo fan-out + synthesis. One sub-agent per listed repo with auto-tailored prompts; all results synthesised into a single answer to the user's high-level intent. Writes one dispatch-NNN.md artifact and one session log line.
2
+
3
+ > **Three doors, one library.** This is the slash-command door for opencode. The CLI door is `momentum dispatch <r1> <r2> ... --prompt "<text>"` and the natural-language inference door fires when the user describes a multi-repo audit / alignment task. All three doors call `core/orchestration/dispatch.js` so the output shape is identical.
4
+
5
+ ## When to use
6
+
7
+ - "What breaks if I rename X across all repos?" — multi-repo audit.
8
+ - "Get me the current state of A AND B so I can align a change." — pre-coordination context fetch.
9
+ - "Where does Y come from across the stack?" — cross-cutting investigation.
10
+
11
+ ## Inference guidance
12
+
13
+ Treat ANY of these as a dispatch invocation:
14
+
15
+ - "Audit X across repos A, B, C."
16
+ - "What's the state of A, B, and C right now?"
17
+ - "Find every place that does X across the ecosystem."
18
+
19
+ When inferring, narrate `▸ inferred: dispatch (multi-repo audit). Use /dispatch next time for predictable behavior.`
20
+
21
+ ## Usage
22
+
23
+ ```
24
+ /dispatch <repo1> <repo2> [repo3 ...] "<user intent>"
25
+ ```
26
+
27
+ ## Capability-routing note
28
+
29
+ opencode declares `parallelSubagents: false` in `core/adapter-capabilities.md` pending live validation of parallel subagent fan-out. The capability-routing helper will return `mode='sequential'` for opencode; surface the note up front:
30
+
31
+ ```
32
+ ▸ note: this adapter does not declare parallel subagents — running sequentially (Promote to true once dispatch parallel mode is exercised live against opencode (Phase 22 G5).)
33
+ ```
34
+
35
+ In sequential mode, run sub-agents ONE AT A TIME via opencode's task tool. Output shape stays identical to parallel mode — just slower.
36
+
37
+ ## Steps
38
+
39
+ ### Step 1 — Identify the targets + intent
40
+
41
+ Resolve each repo arg via `ecosystem.json`.
42
+
43
+ ### Step 2 — Capability-route the dispatch mode
44
+
45
+ ```js
46
+ const orchestration = require('<momentum-root>/core/orchestration');
47
+ const adapter = orchestration.capabilityRouting.loadAdapter('<momentum-root>', 'opencode');
48
+ const { mode, notes } = orchestration.capabilityRouting.chooseMode(adapter, 'dispatch');
49
+ ```
50
+
51
+ Surface each note via `▸ note: <text>` BEFORE starting sub-agents.
52
+
53
+ ### Step 3 — Fan out (sequential on opencode today)
54
+
55
+ For EACH target repo, invoke an opencode subagent (task tool) with:
56
+
57
+ - System prompt: "You are a DISPATCH SUB-AGENT for momentum's quick-verb layer. The user intent is authoritative — if it asks to audit / investigate / report, stay read-only. If it asks to fix / refactor / migrate, you may write code, but commit on a feature branch per Rule 6 and surface the branch name. Return a JSON result with summary, filesRead, optional filesWritten + branch, findings (Rule-3 thresholds)."
58
+ - Task prompt: user intent + the specific repo.
59
+
60
+ Capture failures in `failures[]`; never abort the whole dispatch.
61
+
62
+ ### Step 4 — Synthesise
63
+
64
+ Read all per-repo results IN THIS AGENT'S CONTEXT and produce a synthesis paragraph that DIRECTLY ANSWERS the user's intent.
65
+
66
+ ### Step 5 — Record the run + tracking-contract hand-off
67
+
68
+ ```js
69
+ orchestration.dispatch.record({
70
+ repos, userIntent, mode, modeNotes: notes,
71
+ perRepoResults, failures, synthesis,
72
+ originatingRepo, ecosystem, duration,
73
+ });
74
+ ```
75
+
76
+ Then for each finding:
77
+
78
+ ```js
79
+ orchestration.tracking.proposeDiscovery({ primitive: 'dispatch', finding, targetRepo });
80
+ ```
81
+
82
+ Synthesis-level note:
83
+
84
+ ```js
85
+ orchestration.tracking.proposeHistoryNote({
86
+ primitive: 'dispatch',
87
+ originatingRepo,
88
+ message: '<one-line summary>',
89
+ runArtifactRef: '<.momentum/runs/dispatch-NNN.md>',
90
+ });
91
+ ```
92
+
93
+ ### Step 6 — Render
94
+
95
+ ```
96
+ ▸ Synthesis
97
+ <paragraph>
98
+
99
+ ▸ Per-repo
100
+ ▼ <repo1>: <one-line>
101
+ ▼ <repo2>: <one-line>
102
+
103
+ → logged to sessions/<today>.md
104
+ → trace at .momentum/runs/dispatch-NNN.md
105
+ ```
106
+
107
+ ## Tracking contract
108
+
109
+ - Auto: session log line + dispatch-NNN.md.
110
+ - Auto if meaningful: per-repo `[DISCOVERY]` + originating `[NOTE]`.
111
+ - Never: `[DISPATCH]` entry types; `backlog.md` without confirmation.
@@ -0,0 +1,57 @@
1
+ Cross-session control transfer with a structured context block. Writes `<toRepo>/.momentum/inbox/handoff-NNN.md` so a fresh agent session in that repo can pick up where you left off, and emits a `[DECISION]` in this repo's active phase history.
2
+
3
+ > **Three doors, one library.** This is the slash-command door for opencode. The CLI door is `momentum handoff <repo>`; natural-language inference fires when the user describes a control transfer. All three doors call `core/orchestration/handoff.js`.
4
+
5
+ ## When to use
6
+
7
+ - You finished work in repo A and want the next opencode session in repo B to continue with full context.
8
+ - You hit a stopping point that requires switching repos and want decisions preserved.
9
+
10
+ ## Usage
11
+
12
+ ```
13
+ /handoff <repo> [optional one-line summary]
14
+ ```
15
+
16
+ ## Steps
17
+
18
+ ### Step 1 — Identify the target
19
+
20
+ Resolve `<repo>` via `ecosystem.json`.
21
+
22
+ ### Step 2 — Collect the context block
23
+
24
+ Pull from this session:
25
+ - decisions made
26
+ - files touched
27
+ - verification commands the receiving agent should run
28
+ - open questions
29
+
30
+ ### Step 3 — Write the handoff
31
+
32
+ ```js
33
+ const orchestration = require('<momentum-root>/core/orchestration');
34
+ const block = await orchestration.handoff.handoff({
35
+ fromRepo, toRepo, summary,
36
+ decisions, filesTouched, verificationCommands, openQuestions,
37
+ ecosystem,
38
+ });
39
+ ```
40
+
41
+ This writes `<toRepo>/.momentum/inbox/handoff-NNN.md`, appends one line to the ecosystem session log, AND emits a `[DECISION]` in this repo's active phase `history.md`.
42
+
43
+ ### Step 4 — Tell the user
44
+
45
+ ```
46
+ ▸ handoff written: <toRepo>/.momentum/inbox/handoff-NNN.md
47
+ ▸ logged [DECISION] in <originating phase>/history.md
48
+
49
+ Next: open a fresh opencode session in <toRepo>. The SessionStart hook
50
+ will detect the handoff and prompt. Or run `/continue` (or
51
+ `momentum continue`) explicitly.
52
+ ```
53
+
54
+ ## Tracking contract
55
+
56
+ - Auto: session log + inbox file + originating `[DECISION]`.
57
+ - Never: `[HANDOFF]` entry type. Use `[DECISION]`.
@@ -0,0 +1,194 @@
1
+ Run a multi-perspective code review of the pending changes on the current branch.
2
+
3
+ > **This is the opencode variant of review-code.** It uses the task tool to dispatch
4
+ > role-based subagents (`.opencode/agents/momentum-reviewer-*`). Equivalent functionality for other agents
5
+ > would live in their respective `adapters/<agent>/commands/` overlay (e.g.,
6
+ > Cursor would ship a prompt-based variant). Do not generalize this into
7
+ > `core/commands/` — generalization would lose the parallel-subagent value.
8
+
9
+ ## When to use
10
+
11
+ - Before `/sync-docs` and `/complete-phase` at the end of a phase
12
+ - After a non-trivial commit on a feature branch, before opening a PR
13
+ - Whenever you want a fresh, independent read on what was just built
14
+
15
+ This command does NOT modify code. It produces a consolidated review and asks
16
+ you which findings to act on.
17
+
18
+ ## Steps
19
+
20
+ ### Step 1 — Determine review scope
21
+
22
+ Default scope: the diff between the current branch and `main`. Run:
23
+ ```bash
24
+ git diff main...HEAD --stat
25
+ git diff main...HEAD
26
+ ```
27
+
28
+ If the user passed an argument, honor it:
29
+ - `staged` → `git diff --cached`
30
+ - `working` → `git diff` (unstaged changes)
31
+ - `<commit-sha>` → `git diff <commit-sha>...HEAD`
32
+ - `<file-path>` → restrict review to that path within the default scope
33
+
34
+ If no diff exists, report "no changes to review" and stop.
35
+
36
+ ### Step 2 — Read the rules of the project
37
+
38
+ Before dispatching reviewers, read:
39
+ - `AGENTS.md` (rules and constraints — the complete rulebook)
40
+ - `specs/status.md` (current phase context)
41
+
42
+ This ensures every reviewer scores the diff against THIS project's rules,
43
+ not generic best practices alone.
44
+
45
+ ### Step 3 — Dispatch reviewers in parallel
46
+
47
+ Use the task tool to spawn three subagents in **a single message with three
48
+ parallel tool calls** (do NOT serialize). Each subagent gets the same diff
49
+ and the same rules context, but a different role.
50
+
51
+ #### Reviewer A — Security (OWASP / STRIDE)
52
+
53
+ Prompt template:
54
+ > You are reviewing a code diff for **security only**. Use the OWASP Top 10
55
+ > and STRIDE threat categories as your lens.
56
+ >
57
+ > Diff:
58
+ > ```
59
+ > <paste the diff from Step 1>
60
+ > ```
61
+ >
62
+ > Project rules excerpt:
63
+ > ```
64
+ > <paste the relevant constraints from AGENTS.md — especially "No secrets in code">
65
+ > ```
66
+ >
67
+ > Return findings in this exact format:
68
+ >
69
+ > ```
70
+ > ## Security review
71
+ >
72
+ > ### Critical
73
+ > - [finding] (file:line) — [why it's critical]
74
+ >
75
+ > ### Important
76
+ > - [finding] (file:line) — [explanation]
77
+ >
78
+ > ### Minor
79
+ > - [finding] (file:line) — [explanation]
80
+ > ```
81
+ >
82
+ > If no findings at a severity level, write "(none)". Do NOT speculate beyond
83
+ > what the diff shows. Do NOT propose code fixes — only flag the issue.
84
+
85
+ #### Reviewer B — QA (test coverage, edge cases, regressions)
86
+
87
+ Prompt template:
88
+ > You are reviewing a code diff for **test coverage and edge cases only**.
89
+ >
90
+ > Diff:
91
+ > ```
92
+ > <paste the diff from Step 1>
93
+ > ```
94
+ >
95
+ > Project rules excerpt:
96
+ > ```
97
+ > <paste Rule 12 (Verify Before Claim) from AGENTS.md>
98
+ > ```
99
+ >
100
+ > For each meaningful behavior change in the diff, ask:
101
+ > - Is there a test that exercises it?
102
+ > - What edge cases are uncovered (empty input, large input, concurrent
103
+ > access, error paths)?
104
+ > - Could this break an existing test or production path?
105
+ >
106
+ > Return findings in the same Critical/Important/Minor format as the security
107
+ > reviewer. "(none)" when applicable.
108
+
109
+ #### Reviewer C — Architecture (rule compliance, pattern consistency)
110
+
111
+ Prompt template:
112
+ > You are reviewing a code diff for **architectural fit and rule compliance**.
113
+ >
114
+ > Diff:
115
+ > ```
116
+ > <paste the diff from Step 1>
117
+ > ```
118
+ >
119
+ > Full rules:
120
+ > ```
121
+ > <paste AGENTS.md (rules section)>
122
+ > ```
123
+ >
124
+ > For each change, ask:
125
+ > - Does it violate any of the 12 autonomous rules?
126
+ > - Does it match the patterns established elsewhere in the codebase?
127
+ > (Check 2-3 nearby files for convention.)
128
+ > - Does it create a hidden coupling, a leaky abstraction, or an
129
+ > adapter/contract violation?
130
+ > - Is it documented where rules say it should be (history.md, ADR, etc.)?
131
+ >
132
+ > Return findings in the Critical/Important/Minor format. "(none)" when
133
+ > applicable.
134
+
135
+ ### Step 4 — Consolidate
136
+
137
+ Once all three subagents return:
138
+
139
+ 1. Merge findings into a single report ordered:
140
+ ```
141
+ ## Code Review
142
+
143
+ ### Critical (N)
144
+ - [security] finding (file:line)
145
+ - [arch] finding (file:line)
146
+
147
+ ### Important (N)
148
+ - [qa] finding (file:line)
149
+ - [security] finding (file:line)
150
+
151
+ ### Minor (N)
152
+ - [arch] finding (file:line)
153
+ ```
154
+ 2. Tag each finding with its reviewer (`[security]`, `[qa]`, `[arch]`).
155
+ 3. De-duplicate findings that multiple reviewers raised — combine into one
156
+ line and tag with all reviewers (`[security][arch]`).
157
+ 4. If a finding is at Critical and conflicts with a Minor finding from a
158
+ different reviewer, surface BOTH and note the disagreement.
159
+
160
+ ### Step 5 — Present to user, ask what to act on
161
+
162
+ Show the consolidated report. Then ask:
163
+ > "Which findings should I act on now? Options:
164
+ > 1. All Critical
165
+ > 2. All Critical + Important
166
+ > 3. Specific items (list IDs)
167
+ > 4. None — log all findings to backlog only
168
+ > 5. Cancel"
169
+
170
+ For findings the user wants to act on now: implement them as separate commits
171
+ on the current branch (each commit ≤ one finding).
172
+
173
+ For findings the user wants to defer: add each as a backlog item via the
174
+ `/track` flow with appropriate priority (Critical → P0/P1, Important → P1/P2,
175
+ Minor → P2/P3).
176
+
177
+ ### Step 6 — Honor Rule 12 on any fixes
178
+
179
+ If you implement any fix in Step 5, run the relevant verification (test,
180
+ lint, typecheck) BEFORE marking it done — per Rule 12 (Verify Before Claim).
181
+
182
+ ## Constraints
183
+
184
+ - Subagents are **read-only**: they MUST NOT edit files, run code-modifying
185
+ commands, or commit. They return findings as text only.
186
+ - Dispatch all three subagents in a **single message with parallel tool
187
+ calls** — do not sequence them.
188
+ - The review NEVER auto-fixes findings. The user always decides what to act
189
+ on (Step 5).
190
+ - Findings tied to specific lines should include `file:line` so the user can
191
+ navigate quickly.
192
+ - If a reviewer's output is malformed (missing severity headers), re-dispatch
193
+ that single reviewer with a stricter format reminder. Do not silently
194
+ reformat — that hides reviewer mistakes.
@@ -0,0 +1,90 @@
1
+ Read-only context fetch from one ecosystem member repo. Returns a structured summary, writes a scout-NNN.md run artifact, and appends one line to the ecosystem session log.
2
+
3
+ > **Three doors, one library.** This is the slash-command door for opencode. The CLI door is `momentum scout <repo> "<prompt>"` and the natural-language inference door fires when the user describes a single-repo, read-only context-fetch task without naming a primitive. All three doors call `core/orchestration/scout.js` so the output shape is identical.
4
+
5
+ ## When to use
6
+
7
+ - You're about to make a change in this repo but you need to know the current state of a related repo first (auth shape, API contract, schema, recent decisions).
8
+ - A user asks "what's the situation in `<repo>`?" — that's scout.
9
+ - You want a durable record of a context-fetch you just did, not just a chat message.
10
+
11
+ ## Inference guidance (read this in non-slash contexts too)
12
+
13
+ Treat ANY of these as a scout invocation even without an explicit `/scout`:
14
+
15
+ - "What's the current X in repo Y?"
16
+ - "Before I make the change here, get me the latest state from `<sibling repo>`."
17
+ - "Read repo Y and tell me about its current Z."
18
+
19
+ When inferring, narrate it: `▸ inferred: scout (single repo, read-only). Use /scout next time for predictable behavior.`
20
+
21
+ Do NOT use scout for multi-repo questions — use `/dispatch`. Do NOT use scout when you're about to write into the target repo — use `/handoff`.
22
+
23
+ ## Usage
24
+
25
+ ```
26
+ /scout <repo> "<prompt>"
27
+ ```
28
+
29
+ `<repo>` is either a member id from `ecosystem.json` or a relative/absolute path. `<prompt>` is the user's question.
30
+
31
+ ## Steps
32
+
33
+ ### Step 1 — Identify the target repo + prompt
34
+
35
+ Parse the user's invocation and resolve `<repo>` to an absolute path via the ecosystem manifest (`ecosystem.json` → `members[]`).
36
+
37
+ ### Step 2 — Read the target repo in-process
38
+
39
+ opencode's `parallelSubagents` is currently declared `false` in `core/adapter-capabilities.md` (pending live validation). For a single-repo read-only task this is irrelevant — scout is naturally a single sub-agent. Use opencode's task tool (a subagent) to:
40
+
41
+ 1. Read `specs/status.md` and recent files under `specs/architecture/` and `specs/phases/<active>/history.md`.
42
+ 2. Read any keyword-matching files.
43
+ 3. NO writes. Read-only is the contract.
44
+ 4. Return a structured result with `summary`, `filesRead`, `findings` (each finding meeting Rule 3 criteria for `[DISCOVERY]` tracking).
45
+
46
+ ### Step 3 — Record the run
47
+
48
+ Once the sub-agent returns, call into the orchestration library:
49
+
50
+ ```js
51
+ const orchestration = require('<momentum-root>/core/orchestration');
52
+ const result = orchestration.scout.record({
53
+ repo: '<resolved repo path>',
54
+ prompt: '<user prompt>',
55
+ summary: '<sub-agent summary>',
56
+ filesRead: [/* ... */],
57
+ findings: [/* ... */],
58
+ ecosystem: { rootPath: '<ecosystem root>', memberId: '<this repo member id>' },
59
+ duration: <ms>,
60
+ });
61
+ ```
62
+
63
+ This writes `.momentum/runs/scout-NNN.md` in THIS repo (originating) and appends one line to the ecosystem session log.
64
+
65
+ ### Step 4 — Hand findings to the tracking contract
66
+
67
+ ```js
68
+ orchestration.tracking.proposeDiscovery({
69
+ primitive: 'scout',
70
+ finding,
71
+ targetRepo: '<scouted repo path>',
72
+ });
73
+ ```
74
+
75
+ The helper applies Rule 3 criteria; only meaningful findings land in the scouted repo's active phase `history.md` as `[DISCOVERY]`. NEVER use a `[SCOUT]` marker.
76
+
77
+ ### Step 5 — Narrate the result
78
+
79
+ Print the summary, the artifact path, and the session log reference.
80
+
81
+ ## Tracking contract
82
+
83
+ - **Auto every time:** ecosystem session log line + scout-NNN.md artifact in THIS repo.
84
+ - **Auto only when meaningful:** `[DISCOVERY]` in scouted repo's active phase history.
85
+ - **Never:** `backlog.md` entries without explicit user confirmation.
86
+
87
+ ## Errors
88
+
89
+ - Repo not found in ecosystem manifest → report and stop.
90
+ - Repo not in any ecosystem → fall back to running scout in-process via CLI; suggest `momentum scout <path> "<prompt>"`.