@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.
- package/LICENSE +21 -0
- package/README.md +214 -0
- package/adapters/antigravity/adapter.js +196 -0
- package/adapters/antigravity/hooks.json +39 -0
- package/adapters/antigravity/instructions/AGENTS.md +638 -0
- package/adapters/antigravity/instructions/header.md +3 -0
- package/adapters/antigravity/instructions/surfaces.md +153 -0
- package/adapters/antigravity/instructions/vars.json +1 -0
- package/adapters/antigravity/scripts/antigravity-hook-adapter.sh +147 -0
- package/adapters/antigravity/skills/momentum-orient/SKILL.md +29 -0
- package/adapters/antigravity/skills/momentum-reviewer-architecture/SKILL.md +39 -0
- package/adapters/antigravity/skills/momentum-reviewer-qa/SKILL.md +38 -0
- package/adapters/antigravity/skills/momentum-reviewer-security/SKILL.md +42 -0
- package/adapters/antigravity/skills/swarm-supervisor/SKILL.md +75 -0
- package/adapters/antigravity/workflows/continue.md +39 -0
- package/adapters/antigravity/workflows/dispatch.md +49 -0
- package/adapters/antigravity/workflows/handoff.md +38 -0
- package/adapters/antigravity/workflows/review-code.md +84 -0
- package/adapters/antigravity/workflows/scout.md +42 -0
- package/adapters/antigravity/workflows/swarm.md +203 -0
- package/adapters/claude-code/adapter.js +148 -0
- package/adapters/claude-code/commands/continue.md +82 -0
- package/adapters/claude-code/commands/dispatch.md +154 -0
- package/adapters/claude-code/commands/handoff.md +85 -0
- package/adapters/claude-code/commands/review-code.md +194 -0
- package/adapters/claude-code/commands/scout.md +119 -0
- package/adapters/claude-code/commands/swarm.md +242 -0
- package/adapters/claude-code/instructions/header.md +3 -0
- package/adapters/claude-code/instructions/vars.json +1 -0
- package/adapters/claude-code/settings.json +36 -0
- package/adapters/codex/adapter.js +225 -0
- package/adapters/codex/agents/momentum-reviewer-architecture.toml +57 -0
- package/adapters/codex/agents/momentum-reviewer-qa.toml +52 -0
- package/adapters/codex/agents/momentum-reviewer-security.toml +57 -0
- package/adapters/codex/agents/swarm-supervisor.toml +76 -0
- package/adapters/codex/commands/continue.md +40 -0
- package/adapters/codex/commands/dispatch.md +111 -0
- package/adapters/codex/commands/handoff.md +57 -0
- package/adapters/codex/commands/scout.md +90 -0
- package/adapters/codex/commands/swarm.md +334 -0
- package/adapters/codex/hooks.json +36 -0
- package/adapters/codex/instructions/AGENTS.md +691 -0
- package/adapters/codex/instructions/header.md +3 -0
- package/adapters/codex/instructions/surfaces.md +206 -0
- package/adapters/codex/instructions/vars.json +1 -0
- package/adapters/codex/skills/momentum-orient/SKILL.md +29 -0
- package/adapters/opencode/adapter.js +224 -0
- package/adapters/opencode/agents/momentum-reviewer-architecture.md +54 -0
- package/adapters/opencode/agents/momentum-reviewer-qa.md +48 -0
- package/adapters/opencode/agents/momentum-reviewer-security.md +48 -0
- package/adapters/opencode/agents/swarm-supervisor.md +51 -0
- package/adapters/opencode/commands/continue.md +40 -0
- package/adapters/opencode/commands/dispatch.md +111 -0
- package/adapters/opencode/commands/handoff.md +57 -0
- package/adapters/opencode/commands/review-code.md +194 -0
- package/adapters/opencode/commands/scout.md +90 -0
- package/adapters/opencode/commands/swarm.md +334 -0
- package/adapters/opencode/instructions/AGENTS.md +604 -0
- package/adapters/opencode/instructions/header.md +3 -0
- package/adapters/opencode/instructions/surfaces.md +119 -0
- package/adapters/opencode/instructions/vars.json +1 -0
- package/adapters/opencode/plugins/momentum.js +219 -0
- package/adapters/opencode/skills/momentum-lanes/SKILL.md +30 -0
- package/adapters/opencode/skills/momentum-orient/SKILL.md +29 -0
- package/adapters/opencode/skills/momentum-track/SKILL.md +28 -0
- package/adapters/opencode/skills/momentum-validate/SKILL.md +31 -0
- package/bin/antigravity.js +112 -0
- package/bin/ecosystem.js +1302 -0
- package/bin/lanes.js +300 -0
- package/bin/momentum.js +1857 -0
- package/bin/okf.js +72 -0
- package/bin/orchestration-commands.js +305 -0
- package/bin/state-commands.js +218 -0
- package/bin/swarm.js +1104 -0
- package/bin/waves.js +147 -0
- package/core/adapter-capabilities.md +112 -0
- package/core/adapter-parity-matrix.md +170 -0
- package/core/commands/brainstorm-idea.md +98 -0
- package/core/commands/brainstorm-phase.md +129 -0
- package/core/commands/complete-phase.md +130 -0
- package/core/commands/ecosystem.md +161 -0
- package/core/commands/hotfix.md +64 -0
- package/core/commands/initiative.md +119 -0
- package/core/commands/lanes.md +94 -0
- package/core/commands/log.md +45 -0
- package/core/commands/migrate.md +70 -0
- package/core/commands/review.md +31 -0
- package/core/commands/session.md +79 -0
- package/core/commands/start-phase.md +161 -0
- package/core/commands/start-project.md +142 -0
- package/core/commands/sync-docs.md +81 -0
- package/core/commands/systematic-debug.md +46 -0
- package/core/commands/track.md +54 -0
- package/core/commands/validate.md +96 -0
- package/core/ecosystem/layout.md +128 -0
- package/core/ecosystem/lib/index.js +245 -0
- package/core/ecosystem/lib/initiative.js +258 -0
- package/core/ecosystem/lib/pointer.js +198 -0
- package/core/ecosystem/lib/state.js +295 -0
- package/core/ecosystem/schema/ecosystem.schema.json +85 -0
- package/core/ecosystem/schema/initiative.schema.json +61 -0
- package/core/ecosystem/scripts/session-append.sh +167 -0
- package/core/ecosystem/templates/ecosystem-agents.md +79 -0
- package/core/ecosystem/templates/ecosystem-claude.md +79 -0
- package/core/ecosystem/templates/ecosystem-settings-claude.json +14 -0
- package/core/ecosystem/templates/initiative-template.md +50 -0
- package/core/engines/subagent-dispatch.md +80 -0
- package/core/git-hooks/commit-msg +14 -0
- package/core/git-hooks/contract.js +176 -0
- package/core/git-hooks/pre-push +15 -0
- package/core/git-hooks/run-check.js +160 -0
- package/core/instructions/legacy-project-md-hashes.json +12 -0
- package/core/instructions/navigation.md +14 -0
- package/core/instructions/rules-body.md +454 -0
- package/core/lanes/lib/board.js +161 -0
- package/core/lanes/lib/land.js +301 -0
- package/core/lanes/lib/signals.js +207 -0
- package/core/lanes/lib/state.js +325 -0
- package/core/lib/frontmatter.js +163 -0
- package/core/lib/okf-migrate.js +374 -0
- package/core/lib/okf-types.js +61 -0
- package/core/lifecycle-contract.md +59 -0
- package/core/orchestration/capability-routing.js +120 -0
- package/core/orchestration/continue.js +102 -0
- package/core/orchestration/dispatch.js +366 -0
- package/core/orchestration/events.js +197 -0
- package/core/orchestration/handoff.js +317 -0
- package/core/orchestration/index.js +50 -0
- package/core/orchestration/run-artifact.js +93 -0
- package/core/orchestration/scout.js +327 -0
- package/core/orchestration/session-log.js +123 -0
- package/core/orchestration/tracking.js +180 -0
- package/core/orchestration/types.js +131 -0
- package/core/scripts/brainstorm-gate.sh +157 -0
- package/core/scripts/check-history-reminder.sh +110 -0
- package/core/scripts/sessionstart-handoff.sh +180 -0
- package/core/specs-templates/CLAUDE.md +484 -0
- package/core/specs-templates/README.md +32 -0
- package/core/specs-templates/specs/README.md +30 -0
- package/core/specs-templates/specs/adhoc/README.md +31 -0
- package/core/specs-templates/specs/adhoc/_TEMPLATE.md +29 -0
- package/core/specs-templates/specs/architecture/ecosystem.md +214 -0
- package/core/specs-templates/specs/backlog/backlog.md +46 -0
- package/core/specs-templates/specs/backlog/details/.gitkeep +0 -0
- package/core/specs-templates/specs/changelog/.gitkeep +0 -0
- package/core/specs-templates/specs/decisions/0000-template.md +33 -0
- package/core/specs-templates/specs/decisions/README.md +29 -0
- package/core/specs-templates/specs/decisions/impact-map.md +14 -0
- package/core/specs-templates/specs/decisions/index.md +4 -0
- package/core/specs-templates/specs/index.md +16 -0
- package/core/specs-templates/specs/phases/README.md +41 -0
- package/core/specs-templates/specs/phases/index.md +6 -0
- package/core/specs-templates/specs/planning/roadmap.md +23 -0
- package/core/specs-templates/specs/status.md +70 -0
- package/core/specs-templates/specs/vision/principles.md +16 -0
- package/core/specs-templates/specs/vision/project-charter.md +35 -0
- package/core/specs-templates/specs/vision/success-criteria.md +19 -0
- package/core/swarm/absorb.js +294 -0
- package/core/swarm/conductor.js +499 -0
- package/core/swarm/focus.js +151 -0
- package/core/swarm/inbox.js +222 -0
- package/core/swarm/join.js +138 -0
- package/core/swarm/lib/board.js +178 -0
- package/core/swarm/lib/brief.js +157 -0
- package/core/swarm/lib/git-sha-cache.js +71 -0
- package/core/swarm/lib/incremental-log.js +117 -0
- package/core/swarm/lib/manifest.js +578 -0
- package/core/swarm/lib/pre-merge.js +112 -0
- package/core/swarm/lib/saga.js +146 -0
- package/core/swarm/lib/sessions.js +83 -0
- package/core/swarm/lib/tokens.js +255 -0
- package/core/swarm/lib/wave-ordering.js +55 -0
- package/core/swarm/schema/board.schema.json +54 -0
- package/core/swarm/schema/contract.schema.json +56 -0
- package/core/swarm/schema/dispatch-run.schema.json +70 -0
- package/core/swarm/schema/manifest.schema.json +234 -0
- package/core/swarm/schema/signal.schema.json +61 -0
- package/core/swarm/signals.js +296 -0
- package/core/swarm/supervise.md +81 -0
- package/core/waves/lib/plan-graph.js +175 -0
- package/core/waves/lib/waves.js +83 -0
- package/package.json +46 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# momentum swarm supervisor (Codex)
|
|
2
|
+
#
|
|
3
|
+
# Installed by momentum init/upgrade --agent codex into .codex/agents/.
|
|
4
|
+
#
|
|
5
|
+
# Spawned by the conductor (the user's primary session) — one supervisor
|
|
6
|
+
# per impacted repo, each pinned to that repo's cwd via the MCP cwd shim
|
|
7
|
+
# (see "## MCP cwd shim — Codex configuration" in AGENTS.md). The
|
|
8
|
+
# supervisor runs momentum's normal /start-phase → implement →
|
|
9
|
+
# /sync-docs → /complete-phase loop inside its repo and writes state to
|
|
10
|
+
# `<repo>/.momentum/runs/dispatch-run-<id>.json` + the swarm's manifest.
|
|
11
|
+
#
|
|
12
|
+
# This file is the Codex parity of Claude Code's `claude --bg --cwd …`
|
|
13
|
+
# spawn pattern. Conceptually identical: stateless agent, files-as-state,
|
|
14
|
+
# one repo per supervisor, conductor reads `board.json` between turns.
|
|
15
|
+
|
|
16
|
+
name = "swarm-supervisor"
|
|
17
|
+
|
|
18
|
+
description = """
|
|
19
|
+
Drive a single repo through its phase as part of a swarm. Read the
|
|
20
|
+
recipe at the path supplied in the spawn directive (typically
|
|
21
|
+
`core/swarm/supervise.md`), read the brief at
|
|
22
|
+
`specs/phases/<phase-slug>/overview.md`, and execute the boot sequence.
|
|
23
|
+
State lives in files; the conductor reads `board.json` between turns.
|
|
24
|
+
Dispatched by the conductor; not invoked directly by the user.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
developer_instructions = """
|
|
28
|
+
You are a swarm supervisor for one repo. The conductor (the user's
|
|
29
|
+
primary session) spawned you with a spawn directive containing:
|
|
30
|
+
|
|
31
|
+
- repoPath: your pinned cwd; never cd out of it
|
|
32
|
+
- phaseSlug: the phase you are driving (specs/phases/<slug>/)
|
|
33
|
+
- swarmId: the swarm you belong to (manifest at <eco>/swarms/<id>/)
|
|
34
|
+
- wave: your wave index (1-based)
|
|
35
|
+
- sessionId: the conductor's session id
|
|
36
|
+
- recipePath: absolute path to supervise.md — your operating recipe
|
|
37
|
+
|
|
38
|
+
Boot sequence:
|
|
39
|
+
|
|
40
|
+
1. Read the recipe at `recipePath` end-to-end. Treat it as your
|
|
41
|
+
operating manual for this session.
|
|
42
|
+
2. Read your brief at `specs/phases/<phase-slug>/overview.md`. The
|
|
43
|
+
brief's frontmatter (swarm, wave, initiative, claimed_by_session)
|
|
44
|
+
was populated by the conductor.
|
|
45
|
+
3. Read `specs/status.md` per Rule 1 (orient first).
|
|
46
|
+
4. Begin the normal momentum lifecycle inside this repo: /start-phase
|
|
47
|
+
→ implement → /sync-docs → /complete-phase. Each phase command is
|
|
48
|
+
itself a Codex skill — invoke them by name.
|
|
49
|
+
|
|
50
|
+
Operating constraints:
|
|
51
|
+
|
|
52
|
+
- Stay in `repoPath`. Never `cd` to a sibling repo. Cross-repo concerns
|
|
53
|
+
go through the inbox primitive at `<eco>/swarms/<swarm-id>/inbox/`.
|
|
54
|
+
- State lives in files. Append to `history.md` per Rule 8; the
|
|
55
|
+
conductor reads `board.json` between turns to render progress to the
|
|
56
|
+
user.
|
|
57
|
+
- The conductor may push context via `swarm-context.md` at
|
|
58
|
+
`specs/phases/<phase-slug>/swarm-context.md`. Read it at the top of
|
|
59
|
+
every turn.
|
|
60
|
+
- If you have a question only the conductor can answer, write it to
|
|
61
|
+
the swarm inbox via:
|
|
62
|
+
|
|
63
|
+
momentum swarm inbox write <swarm-id> --repo <your-repo-id> \
|
|
64
|
+
--slug <short-slug> --question "<text>"
|
|
65
|
+
|
|
66
|
+
Then wait for resolution before continuing — do NOT guess.
|
|
67
|
+
- When your phase is complete, run /complete-phase per the standard
|
|
68
|
+
recipe; the supervisor finishes after the phase is verified and
|
|
69
|
+
pushed.
|
|
70
|
+
|
|
71
|
+
You inherit every always-on rule from AGENTS.md (the complete rulebook).
|
|
72
|
+
"""
|
|
73
|
+
|
|
74
|
+
# Supervisors write code, so they cannot run read-only. The Codex
|
|
75
|
+
# sandbox default applies. The conductor is the only session that may
|
|
76
|
+
# write to the swarm's manifest.json / board.json / contracts/ / inbox/.
|
|
@@ -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 Codex. 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 Codex. 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
|
+
Codex 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 Codex; 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 against Codex in CI.)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
In sequential mode, run sub-agents ONE AT A TIME via Codex's subagent surface. 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>', 'codex');
|
|
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 Codex today)
|
|
54
|
+
|
|
55
|
+
For EACH target repo, invoke a Codex sub-agent 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 Codex. 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 Codex 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 Codex 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,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 Codex. 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
|
+
Codex'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 Codex's sub-agent surface 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>"`.
|