@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,129 @@
|
|
|
1
|
+
Brainstorm the next phase before creating it.
|
|
2
|
+
|
|
3
|
+
Run AFTER `/complete-phase` and BEFORE `/start-phase`.
|
|
4
|
+
|
|
5
|
+
## Important: No Separate Design Document
|
|
6
|
+
|
|
7
|
+
All output goes directly into the phase directory as standard phase files.
|
|
8
|
+
The brainstorm output IS the phase files — there is no intermediate design doc.
|
|
9
|
+
|
|
10
|
+
**But — and this is the whole point of this command — those phase files MUST NOT exist on disk until the user has explicitly approved the draft.** See the [Brainstorm Gate Contract](#brainstorm-gate-contract) below.
|
|
11
|
+
|
|
12
|
+
## Steps
|
|
13
|
+
|
|
14
|
+
0. **Enter the brainstorm gate**:
|
|
15
|
+
```bash
|
|
16
|
+
mkdir -p .momentum && touch .momentum/brainstorm-active
|
|
17
|
+
```
|
|
18
|
+
From this point until Step 8, do NOT call any write-class tool on any path under `specs/`. The PreToolUse hook (`core/scripts/brainstorm-gate.sh`, wired by Claude Code + Codex + Antigravity) will block such calls; this step makes the intent explicit.
|
|
19
|
+
|
|
20
|
+
1. Review current state:
|
|
21
|
+
- Read `specs/status.md` — what phase just completed?
|
|
22
|
+
- Read the completed phase's `history.md` — what was learned?
|
|
23
|
+
- Read `specs/backlog/backlog.md` — any P0/P1 items to address first?
|
|
24
|
+
|
|
25
|
+
2. Check the roadmap:
|
|
26
|
+
- Read `specs/planning/roadmap.md` — what's the next planned phase?
|
|
27
|
+
- Is the planned phase still the right next step given what was learned?
|
|
28
|
+
|
|
29
|
+
3. Define scope with the user (one question at a time):
|
|
30
|
+
- What is the goal of this phase?
|
|
31
|
+
- What are the key deliverables?
|
|
32
|
+
- What are the acceptance criteria?
|
|
33
|
+
- What are the non-goals (explicitly out of scope)?
|
|
34
|
+
|
|
35
|
+
4. For monorepo — identify reference specs:
|
|
36
|
+
- Which architecture docs in `specs/architecture/` are relevant?
|
|
37
|
+
- Are there any spec gaps that need to be filled first?
|
|
38
|
+
- If gaps exist, propose an ADR or addendum before proceeding.
|
|
39
|
+
|
|
40
|
+
5. Gap analysis (monorepo only):
|
|
41
|
+
- Cross-reference brainstormed design against architecture specs
|
|
42
|
+
- Verify interface counts, field names, error codes match exactly
|
|
43
|
+
- Record findings and resolutions
|
|
44
|
+
|
|
45
|
+
6. **Draft phase files in conversation only** — do NOT call `Write`/`Edit`/`MultiEdit`:
|
|
46
|
+
- `overview.md` — goal, key decisions table, scope (in/out), deliverables with verification commands, acceptance criteria
|
|
47
|
+
- `plan.md` — full implementation plan using the Group Execution Pattern (see below)
|
|
48
|
+
- `tasks.md` — granular checklist mirroring plan.md tasks
|
|
49
|
+
- `history.md` — initial entries logging all decisions from this brainstorm session
|
|
50
|
+
|
|
51
|
+
Show the user the full draft in the chat. Iterate on revisions in the chat. Nothing on disk yet.
|
|
52
|
+
|
|
53
|
+
7. Present for user approval:
|
|
54
|
+
- Show key sections of overview.md and plan.md
|
|
55
|
+
- Ask: "Does this look right? Any changes before I write the phase files?"
|
|
56
|
+
|
|
57
|
+
8. **On approval — exit the gate and write**:
|
|
58
|
+
```bash
|
|
59
|
+
rm .momentum/brainstorm-active
|
|
60
|
+
```
|
|
61
|
+
Then write all four files to `specs/phases/phase-N-shortname/` and commit:
|
|
62
|
+
```bash
|
|
63
|
+
git add specs/phases/phase-N-shortname/
|
|
64
|
+
git commit -m "docs: brainstorm Phase N — {phase name}"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
9. Prompt: "Phase N is planned. Run `/start-phase` when ready to begin."
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Brainstorm Gate Contract
|
|
72
|
+
|
|
73
|
+
This command runs in two phases: **brainstorm** (conversational, no disk writes) and **commit** (writes files to disk on explicit approval).
|
|
74
|
+
|
|
75
|
+
### Sentinel-driven enforcement
|
|
76
|
+
|
|
77
|
+
A file `.momentum/brainstorm-active` exists for the lifetime of the brainstorm phase. While it exists, the `brainstorm-gate.sh` PreToolUse hook (shared across Claude Code, Codex, and Antigravity) blocks any write-class tool call whose target lives under `specs/`. The hook is the safety net; the discipline below is the primary contract.
|
|
78
|
+
|
|
79
|
+
### Sequence
|
|
80
|
+
|
|
81
|
+
1. **Enter brainstorm** — `mkdir -p .momentum && touch .momentum/brainstorm-active`
|
|
82
|
+
2. **Draft in conversation only** — all overview/plan/tasks/history content lives in the chat. NEVER call `Write`/`Edit`/`MultiEdit` on `specs/` paths during this phase. The hook will block such calls; the contract makes the intent visible.
|
|
83
|
+
3. **Present for approval** — show the user the full draft. Ask: "Does this look right? Any changes before I write the phase files?"
|
|
84
|
+
4. **Exit brainstorm on approval** — `rm .momentum/brainstorm-active`, then write all files in one batch and commit.
|
|
85
|
+
|
|
86
|
+
### Red flags — STOP and stay in conversation
|
|
87
|
+
|
|
88
|
+
| If you find yourself thinking… | …STOP and stay in conversation |
|
|
89
|
+
|---|---|
|
|
90
|
+
| "I'll just write a quick draft to disk so I can see it" | The conversation IS the draft. The hook will block this. |
|
|
91
|
+
| "The user will approve, no point waiting" | Approval changes the conversation. Don't pre-commit to text the user might still revise. |
|
|
92
|
+
| "I'll create the directory now to save a step later" | Don't. Wait for approval. |
|
|
93
|
+
| "The brainstorm session was interrupted; I'll just remove the sentinel" | Only remove it when you have explicit approval AND are about to write. Premature removal recreates the failure mode. |
|
|
94
|
+
|
|
95
|
+
### Anti-rationalization counters
|
|
96
|
+
|
|
97
|
+
- "Drafting to disk is faster than drafting in chat" — false: revisions in chat are free; revisions on disk require re-edits.
|
|
98
|
+
- "Only writing scratch files, not the real specs" — the hook can't tell scratch from real; keep both in conversation.
|
|
99
|
+
- "It's fine, the user said proceed" — proceed only AFTER the explicit approval step, not before.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Group Execution Pattern for plan.md
|
|
104
|
+
|
|
105
|
+
Declare the execution order at the top of every plan.md:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
# Sequential: Group 0 → Group 1 → Group 2
|
|
109
|
+
# Parallel: (Groups 0 + 1 + 2 in parallel) → Group 3
|
|
110
|
+
# Mixed: Group 0 → (Groups 1 + 2 in parallel) → Group 3
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Every group header declares:
|
|
114
|
+
- `**Sequential.**` or `**Parallel with Groups X and Y.**`
|
|
115
|
+
- External dependencies (libraries, services, running processes)
|
|
116
|
+
- Commit message for the group
|
|
117
|
+
|
|
118
|
+
Standard layout:
|
|
119
|
+
- **Group 0** — contracts, types, migrations (sequential, blocks everything)
|
|
120
|
+
- **Middle groups** — independent feature areas (parallel candidates)
|
|
121
|
+
- **Second-to-last** — wiring and integration (sequential)
|
|
122
|
+
- **Last** — verification: tests, benchmarks, smoke tests (sequential)
|
|
123
|
+
|
|
124
|
+
## Key Principles
|
|
125
|
+
- One question at a time — don't overwhelm
|
|
126
|
+
- Each phase should be completable in a focused sprint
|
|
127
|
+
- If scope is too large, suggest splitting into sub-phases
|
|
128
|
+
- Record any discoveries in history.md
|
|
129
|
+
- **Brainstorm Gate**: see the contract above. No writes until approval.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Verify, finalize, and release a completed phase.
|
|
2
|
+
|
|
3
|
+
> **Which phase is yours (Rule 15):** the phase bound to your branch — that
|
|
4
|
+
> is the phase this command completes. `status.md`'s Active Phase table is
|
|
5
|
+
> the fallback and the cross-lane overview. When other lanes are in flight,
|
|
6
|
+
> landing follows the Rule 6 **Landing Order**: one lane at a time, full
|
|
7
|
+
> suite green on updated `main` between landings, remaining lanes rebase.
|
|
8
|
+
|
|
9
|
+
## Steps
|
|
10
|
+
|
|
11
|
+
### Verify
|
|
12
|
+
|
|
13
|
+
1. Read the phase's acceptance criteria:
|
|
14
|
+
- Read `specs/phases/phase-N-*/overview.md`
|
|
15
|
+
|
|
16
|
+
2. Verify all tasks are done:
|
|
17
|
+
- Read `specs/phases/phase-N-*/tasks.md`
|
|
18
|
+
- If any `[ ]` unchecked items remain → report to user, do NOT proceed
|
|
19
|
+
|
|
20
|
+
3. **Run project-specific validation and capture fresh evidence** (per Rule 12 — Verify Before Claim):
|
|
21
|
+
- Run all defined validation commands: tests, linting, type checks, build, smoke tests
|
|
22
|
+
- Capture each command's stdout/stderr (e.g., redirect to a temp file with `tee`)
|
|
23
|
+
- Note exit codes
|
|
24
|
+
- If any command fails → STOP, report failure to user, do NOT proceed to Finalize
|
|
25
|
+
- If a command can't run in the current environment, say so explicitly — do not silently skip
|
|
26
|
+
|
|
27
|
+
**Refuse to advance to Finalize without fresh, captured evidence.** Memory of "tests passed earlier this phase" is not evidence — re-run them now.
|
|
28
|
+
|
|
29
|
+
4. If this phase built a learning loop, verify:
|
|
30
|
+
- Locked evaluator exists in `tests/benchmarks/`
|
|
31
|
+
- Convergence measurement logged (scalar improved)
|
|
32
|
+
- If not → report to user, do NOT proceed
|
|
33
|
+
|
|
34
|
+
5. Check for new bugs discovered during the phase:
|
|
35
|
+
- Grep `specs/backlog/backlog.md` for items tagged to this phase
|
|
36
|
+
|
|
37
|
+
### Finalize
|
|
38
|
+
|
|
39
|
+
**Step F0: Sync docs from phase history (run BEFORE other finalize steps)**
|
|
40
|
+
- Run `/sync-docs` to propagate all history-recorded changes to relevant documents
|
|
41
|
+
- If /sync-docs finds nothing to update, proceed directly
|
|
42
|
+
|
|
43
|
+
6. Create retrospective:
|
|
44
|
+
- `specs/phases/phase-N-*/retrospective.md`
|
|
45
|
+
- What went well, what didn't, lessons learned
|
|
46
|
+
- **Append a `## Verification Evidence` section** with the captured output from Step 3:
|
|
47
|
+
- For each validation command: command line, exit code, last 50 lines of output (or full output if shorter)
|
|
48
|
+
- Format as fenced code blocks with the command as the heading
|
|
49
|
+
- This is the durable record that Rule 12 was honored — it must exist before the release section runs
|
|
50
|
+
|
|
51
|
+
7. Update all tracking:
|
|
52
|
+
- `specs/phases/README.md` → mark `Complete`
|
|
53
|
+
- `specs/status.md` → remove this lane's row from the Active Phase table
|
|
54
|
+
(leave other lanes' rows untouched — Rule 15), update current phase,
|
|
55
|
+
add release version
|
|
56
|
+
- `specs/planning/roadmap.md` → update phase status
|
|
57
|
+
- `specs/changelog/YYYY-MM.md` → add release entry
|
|
58
|
+
|
|
59
|
+
### Release
|
|
60
|
+
|
|
61
|
+
> **Gate (Rule 12):** Do NOT enter Release if `retrospective.md` lacks a `## Verification Evidence` section. If evidence is missing, return to Step 3 and capture it.
|
|
62
|
+
|
|
63
|
+
8. Commit all remaining changes and push:
|
|
64
|
+
```bash
|
|
65
|
+
git add -A
|
|
66
|
+
git commit -m "docs: complete Phase N - {phase name}"
|
|
67
|
+
git push origin phase-N-shortname
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
9. Ask the user ONCE for approval to release — present the full plan:
|
|
71
|
+
```
|
|
72
|
+
Ready to release vX.Y.Z. This will:
|
|
73
|
+
1. Merge phase-N-shortname → staging
|
|
74
|
+
2. Merge staging → main
|
|
75
|
+
3. Tag vX.Y.Z and create GitHub Release
|
|
76
|
+
|
|
77
|
+
Proceed?
|
|
78
|
+
```
|
|
79
|
+
Wait for a single "yes" before running any of the following steps.
|
|
80
|
+
|
|
81
|
+
10. On approval, execute all three steps in sequence.
|
|
82
|
+
|
|
83
|
+
**Landing Order (Rule 6/15):** if another lane landed on `main` since
|
|
84
|
+
this branch last rebased, rebase this branch onto updated `main` and
|
|
85
|
+
re-run the suite BEFORE merging. Never land two lanes back-to-back
|
|
86
|
+
without the suite passing in between.
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# step 1 — phase branch → staging
|
|
90
|
+
git checkout staging && git pull origin staging
|
|
91
|
+
git merge --no-ff phase-N-shortname -m "merge: phase-N-shortname → staging (vX.Y.Z)"
|
|
92
|
+
git push origin staging
|
|
93
|
+
|
|
94
|
+
# step 2 — staging → main
|
|
95
|
+
git checkout main && git pull origin main
|
|
96
|
+
git merge --no-ff staging -m "merge: staging → main (vX.Y.Z — Phase N: {phase name})"
|
|
97
|
+
git push origin main
|
|
98
|
+
|
|
99
|
+
# step 3 — tag + GitHub Release
|
|
100
|
+
git tag -a vX.Y.Z -m "Phase N: {phase name}"
|
|
101
|
+
git push origin vX.Y.Z
|
|
102
|
+
gh release create vX.Y.Z \
|
|
103
|
+
--title "vX.Y.Z — Phase N: {phase name}" \
|
|
104
|
+
--notes "## Phase N: {phase name}
|
|
105
|
+
{bullet summary of what was delivered}
|
|
106
|
+
### Next: Phase N+1 — {next phase name}" \
|
|
107
|
+
--target main
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
12. Report summary to user:
|
|
111
|
+
- What was delivered
|
|
112
|
+
- GitHub Release URL
|
|
113
|
+
- What's next
|
|
114
|
+
|
|
115
|
+
13. Delete the merged phase branch (ENH-042 — now that merge → main + release
|
|
116
|
+
are confirmed; do NOT skip this, or stale branches accumulate on origin):
|
|
117
|
+
```bash
|
|
118
|
+
git branch -d phase-N-shortname # local — `-d` (not `-D`) refuses if unmerged
|
|
119
|
+
git push origin --delete phase-N-shortname # remote
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
14. Branch-hygiene self-audit (ENH-042) — confirm no released phase left a
|
|
123
|
+
dangling branch:
|
|
124
|
+
```bash
|
|
125
|
+
# Any origin branch for an already-released phase should be gone.
|
|
126
|
+
git branch -r | grep -E 'origin/(phase-|chore/|audit/)' || echo "✓ clean — no stale branches"
|
|
127
|
+
```
|
|
128
|
+
For each match, verify it is fully merged into `main`
|
|
129
|
+
(`git branch -r --merged main`) and delete it per step 13. Leave any
|
|
130
|
+
*unmerged* branch alone and surface it to the user.
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
Cross-repo ecosystem coordination (Phase 9 Tier 1).
|
|
2
|
+
|
|
3
|
+
The ecosystem layer threads multiple momentum-installed repos into one
|
|
4
|
+
coherent unit of work. Use it when a feature or release spans more than
|
|
5
|
+
one repo and you want shared status, shared initiative tracking, and a
|
|
6
|
+
shared daily session log.
|
|
7
|
+
|
|
8
|
+
> Per-repo phases, backlog, and history stay where they are. The
|
|
9
|
+
> ecosystem layer is additive — it never writes into a member repo's
|
|
10
|
+
> `specs/`. The only touch is one fenced line in CLAUDE.md / AGENTS.md.
|
|
11
|
+
|
|
12
|
+
## When to use
|
|
13
|
+
|
|
14
|
+
- The work-at-hand is spread across two or more repos that already have
|
|
15
|
+
momentum installed (e.g. a backend repo + a frontend repo + an infra
|
|
16
|
+
repo all participating in one product launch).
|
|
17
|
+
- A user asks for cross-repo status: "what's in flight across the X
|
|
18
|
+
constellation right now?"
|
|
19
|
+
- A user names an "initiative" or "cross-repo feature" by name — see if
|
|
20
|
+
it exists as `<ecosystem-root>/initiatives/NNNN-<slug>.md`.
|
|
21
|
+
- A user asks "what happened today?" — read today's session log.
|
|
22
|
+
|
|
23
|
+
## Discovery
|
|
24
|
+
|
|
25
|
+
Always start by checking for an ecosystem root:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# Walk up from $PWD (bounded to 5 parents) AND scan siblings for
|
|
29
|
+
# ecosystem.json — the helper in core/ecosystem/lib/index.js does this.
|
|
30
|
+
node -e "console.log(require('./core/ecosystem/lib').findRoot(process.cwd()))"
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
If no ecosystem root exists and the work clearly spans repos, suggest:
|
|
34
|
+
`momentum ecosystem init <name>` from the parent directory.
|
|
35
|
+
|
|
36
|
+
## Subcommands
|
|
37
|
+
|
|
38
|
+
### `status`
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
momentum ecosystem status
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Prints the manifest (name, members, dependency edges) and per-member
|
|
45
|
+
git state (modified files + last commit). Use this as the first read
|
|
46
|
+
when context-switching into multi-repo work.
|
|
47
|
+
|
|
48
|
+
### `add <repo-path>`
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
momentum ecosystem add ../<repo-name> --role <platform|client|library|infra|bench|other> [--id <id>]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Registers a momentum-installed repo as a member of the current
|
|
55
|
+
ecosystem. Idempotent — safe to re-run. Writes one fenced line into
|
|
56
|
+
the target's CLAUDE.md / AGENTS.md pointing back at the ecosystem.
|
|
57
|
+
|
|
58
|
+
Pre-flight: target must have CLAUDE.md or AGENTS.md (i.e. have been
|
|
59
|
+
through `momentum init`). The command refuses non-momentum targets.
|
|
60
|
+
|
|
61
|
+
### `remove <id>`
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
momentum ecosystem remove <member-id>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Strips the member from `ecosystem.json` and removes the fenced pointer
|
|
68
|
+
from the target's primary instruction file. Tolerant of missing target
|
|
69
|
+
(the manifest is updated even if the member directory is gone).
|
|
70
|
+
|
|
71
|
+
### `init [name]`
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
momentum ecosystem init <name>
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Scaffolds a fresh ecosystem root: `ecosystem.json`, `initiatives/`,
|
|
78
|
+
`sessions/`, `.state/`, `README.md`, `.gitignore`. Runs `git init` and
|
|
79
|
+
produces the initial commit (best-effort — if git identity is missing
|
|
80
|
+
the scaffold is still valid, user can commit later).
|
|
81
|
+
|
|
82
|
+
## On-disk layout
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
<ecosystem-root>/
|
|
86
|
+
├── ecosystem.json ← manifest (members, roles, dep edges)
|
|
87
|
+
├── README.md
|
|
88
|
+
├── initiatives/ ← cross-repo features (see /initiative)
|
|
89
|
+
│ └── NNNN-<slug>.md
|
|
90
|
+
├── sessions/ ← daily activity log
|
|
91
|
+
│ └── YYYY-MM-DD.md ← appended by member-repo PostToolUse hook
|
|
92
|
+
├── .state/ ← runtime state (gitignored)
|
|
93
|
+
│ ├── active-initiative
|
|
94
|
+
│ └── last-session
|
|
95
|
+
└── .gitignore
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
See `core/ecosystem/layout.md` for the full reference.
|
|
99
|
+
|
|
100
|
+
## Reading the session log
|
|
101
|
+
|
|
102
|
+
Today's session file (`sessions/$(date -u +%F).md`) is auto-populated
|
|
103
|
+
by member-repo hooks every time a `git commit` or `gh pr {merge,create}`
|
|
104
|
+
runs. Each line:
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
HH:MMZ [<member-id>] <kind>: <summary> (<context>)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
For a narrated entry not tied to a tool event, use the `/session` slash
|
|
111
|
+
command (`/session log "..."`).
|
|
112
|
+
|
|
113
|
+
## Reading the manifest
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
cat <ecosystem-root>/ecosystem.json
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Or programmatically:
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
const lib = require('<momentum>/core/ecosystem/lib');
|
|
123
|
+
const root = lib.findRoot(process.cwd());
|
|
124
|
+
const manifest = lib.loadManifest(root);
|
|
125
|
+
manifest.members.forEach((m) => console.log(m.id, m.role, m.path));
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Composition with other commands
|
|
129
|
+
|
|
130
|
+
- `/initiative` — manage individual cross-repo features inside this
|
|
131
|
+
ecosystem (`create`, `status`, `close`, `list`). See its recipe.
|
|
132
|
+
- `/session log <message>` — append a manual narrative entry to
|
|
133
|
+
today's session log.
|
|
134
|
+
- `/track` — backlog item tracking; lives inside each member repo's
|
|
135
|
+
`specs/backlog/`. The ecosystem doesn't aggregate backlogs (yet —
|
|
136
|
+
Tier 2 work).
|
|
137
|
+
- `momentum init` — adds a brand-new momentum project. The ecosystem
|
|
138
|
+
layer only registers existing momentum-installed repos.
|
|
139
|
+
|
|
140
|
+
## Failure modes
|
|
141
|
+
|
|
142
|
+
- "not inside an ecosystem root" — caller is not in or under an
|
|
143
|
+
ecosystem. Either `cd` into one, or `momentum ecosystem init <name>`
|
|
144
|
+
to create one.
|
|
145
|
+
- "target doesn't look momentum-installed" — the path passed to `add`
|
|
146
|
+
doesn't have CLAUDE.md / AGENTS.md. Run `momentum init` on the
|
|
147
|
+
target first.
|
|
148
|
+
- "member id already registered" — the id is taken by another path.
|
|
149
|
+
Pass `--id <different>` or `remove` the existing entry first.
|
|
150
|
+
|
|
151
|
+
## Key principles
|
|
152
|
+
|
|
153
|
+
- **Strictly additive** — never modify a member repo's `specs/` or any
|
|
154
|
+
file beyond the one fenced line in its primary instruction file.
|
|
155
|
+
- **Discovery first** — every command walks up looking for the
|
|
156
|
+
ecosystem root; nothing assumes the cwd.
|
|
157
|
+
- **Idempotent** — `add` is safe to re-run; `remove` is safe even when
|
|
158
|
+
the target is gone.
|
|
159
|
+
- **Member-internal autonomy** — each member repo's per-repo phases,
|
|
160
|
+
backlog, history, sync-docs all keep working unchanged. The
|
|
161
|
+
ecosystem is a thread across them, not a replacement for them.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
Ship an ad-hoc change without a full phase — a bounded `quick-task` (bugfix /
|
|
2
|
+
chore / audit / dependency bump) or a declared `spike` (throwaway exploration).
|
|
3
|
+
Preserves git discipline + tracking; a quick-task still passes the Rule 12
|
|
4
|
+
verification gate. For net-new features or cross-cutting work, use
|
|
5
|
+
`/brainstorm-phase` instead — see the Rule 14 escalation check below.
|
|
6
|
+
|
|
7
|
+
## Steps
|
|
8
|
+
|
|
9
|
+
1. **Pick the work type** (see `specs/adhoc/README.md`):
|
|
10
|
+
- Default → `quick-task`. With `--spike` (or when the user says "spike" /
|
|
11
|
+
"experiment") → `spike` (gate-exempt, throwaway).
|
|
12
|
+
|
|
13
|
+
2. **Rule 14 escalation check — STOP if this should be a phase.** Escalate to
|
|
14
|
+
`/brainstorm-phase` instead if the change: touches more than ~5 files of
|
|
15
|
+
production code, modifies anything under `specs/architecture/`, needs an
|
|
16
|
+
ADR, changes a public contract/interface, or displaces a planned phase.
|
|
17
|
+
When in doubt, ask the user. Do NOT smuggle a phase-sized change through
|
|
18
|
+
the ad-hoc lane.
|
|
19
|
+
|
|
20
|
+
3. **Branch** (Rule 6 — never work on `main`/`staging`):
|
|
21
|
+
- quick-task bugfix → `fix/BUG-NNN-short-desc`
|
|
22
|
+
- quick-task chore → `chore/short-desc`
|
|
23
|
+
- spike → `spike/short-desc`
|
|
24
|
+
|
|
25
|
+
4. **Open the ad-hoc record.** Choose `<id>`: the backlog id if one exists
|
|
26
|
+
(e.g. `BUG-009`), else `YYYY-MM-DD-<slug>`. Then:
|
|
27
|
+
```bash
|
|
28
|
+
mkdir -p specs/adhoc/<id>
|
|
29
|
+
cp specs/adhoc/_TEMPLATE.md specs/adhoc/<id>/record.md
|
|
30
|
+
```
|
|
31
|
+
Fill **Current / Expected / Unchanged Behavior**. The Unchanged-Behavior
|
|
32
|
+
line is the blast-radius guardrail — be explicit about what must NOT change.
|
|
33
|
+
|
|
34
|
+
5. **Track it** (Rule 3): ensure the backlog has a row (`/track` if not). A
|
|
35
|
+
pure chore with no backlog id is fine — note "Backlog: none" in the record.
|
|
36
|
+
|
|
37
|
+
6. **Do the work.** Commit with Conventional Commits (the `commit-msg` hook
|
|
38
|
+
enforces this). Keep commits atomic.
|
|
39
|
+
|
|
40
|
+
7. **Verify (Rule 12) — the gate.**
|
|
41
|
+
- `quick-task`: run the real verification command(s); paste fresh output
|
|
42
|
+
(command + exit status) into the record's `## Verification Evidence`.
|
|
43
|
+
This is REQUIRED before merge.
|
|
44
|
+
- `spike`: write `spike — gate-exempt` there plus one line on what was
|
|
45
|
+
learned and the follow-up (file a backlog item if the spike found work).
|
|
46
|
+
|
|
47
|
+
8. **Log the why** (Rule 8, phase-optional): append decisions/discoveries to
|
|
48
|
+
`specs/adhoc/<id>/record.md` (or `specs/adhoc/history.md`) via `/log`.
|
|
49
|
+
Update `specs/changelog/YYYY-MM.md` with a one-line entry.
|
|
50
|
+
|
|
51
|
+
9. **Merge + (optional) release** — needs explicit user approval (Rule 6):
|
|
52
|
+
- Ask the user before merging to `main`/`staging`. After approval, authorize
|
|
53
|
+
the single push with the sentinel the `pre-push` hook consumes:
|
|
54
|
+
```bash
|
|
55
|
+
touch .momentum/merge-approved # single-use; consumed on push to main
|
|
56
|
+
```
|
|
57
|
+
- If this ships a version bump, add a row to the **Ad-hoc / Patch Releases**
|
|
58
|
+
section of `specs/status.md` (NOT the Completed Phases table). The
|
|
59
|
+
`pre-push` release-tag gate requires the record's `## Verification
|
|
60
|
+
Evidence` to be non-empty — so a spike must not cut a release tag.
|
|
61
|
+
|
|
62
|
+
10. **Clean up**: after a confirmed merge, delete the branch
|
|
63
|
+
(`git branch -d <branch>` + `git push origin --delete <branch>`), and set
|
|
64
|
+
the record `Status:` to `shipped` (or `abandoned` for a dropped spike).
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Manage cross-repo initiatives in an ecosystem.
|
|
2
|
+
|
|
3
|
+
Initiatives are first-class records of features that span multiple
|
|
4
|
+
member repos. Each initiative is one markdown file under
|
|
5
|
+
`<ecosystem-root>/initiatives/NNNN-<slug>.md` with a small YAML
|
|
6
|
+
frontmatter block (id, slug, status, started, owner, repos).
|
|
7
|
+
|
|
8
|
+
This command must be run from inside an ecosystem root or any of its
|
|
9
|
+
member repos (the ecosystem root is discovered by walking up).
|
|
10
|
+
|
|
11
|
+
## Subcommands
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
/initiative create <slug> Create a new initiative + activate it
|
|
15
|
+
/initiative status [<slug>] Print the named (or active) initiative card
|
|
16
|
+
/initiative close <slug> Populate the Close section + deactivate
|
|
17
|
+
/initiative list List all initiatives in this ecosystem
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Steps for `create`
|
|
21
|
+
|
|
22
|
+
1. Locate the ecosystem root via the walk-up helper
|
|
23
|
+
(`core/ecosystem/lib/index.js → findRoot`). If none found, abort
|
|
24
|
+
with a clear message: "Not inside an ecosystem. Run `momentum
|
|
25
|
+
ecosystem init` first."
|
|
26
|
+
|
|
27
|
+
2. Validate the `<slug>` matches `/^[a-z][a-z0-9-]*$/`. If not, abort.
|
|
28
|
+
|
|
29
|
+
3. Allocate the next initiative id via `nextInitiativeId(root)`
|
|
30
|
+
(scans existing files for the highest `NNNN-` prefix).
|
|
31
|
+
|
|
32
|
+
4. Prompt the user (one question at a time) for:
|
|
33
|
+
- **Why** — one-paragraph motivation
|
|
34
|
+
- **Repos involved** — defaults to all members; allow comma-separated
|
|
35
|
+
subset
|
|
36
|
+
- **Owner** — defaults to git config user.name or env USER
|
|
37
|
+
|
|
38
|
+
5. Render the initiative file from
|
|
39
|
+
`core/ecosystem/templates/initiative-template.md`, substituting the
|
|
40
|
+
frontmatter + the user's "Why" text. Leave the
|
|
41
|
+
"Per-repo contributions", "Linked decisions", "Deploy chronology"
|
|
42
|
+
sections empty (they'll fill in as work lands).
|
|
43
|
+
|
|
44
|
+
6. Write the file to `<root>/initiatives/<NNNN>-<slug>.md` via
|
|
45
|
+
`writeInitiative(filePath, frontmatter, content)`. This re-validates
|
|
46
|
+
the frontmatter.
|
|
47
|
+
|
|
48
|
+
7. Set the slug as the active initiative:
|
|
49
|
+
`setActive(root, slug)` (writes `<root>/.state/active-initiative`).
|
|
50
|
+
|
|
51
|
+
8. Print confirmation:
|
|
52
|
+
```
|
|
53
|
+
Created initiative 0042-<slug>.md. Active.
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Steps for `status`
|
|
57
|
+
|
|
58
|
+
1. Resolve the target slug: argument if given; else read
|
|
59
|
+
`<root>/.state/active-initiative`; else abort with
|
|
60
|
+
"No active initiative. Pass <slug> or `/initiative create` first."
|
|
61
|
+
|
|
62
|
+
2. Load the file via `loadInitiative(root, slug)`. Print:
|
|
63
|
+
- Frontmatter as a header block (status, owner, started, repos)
|
|
64
|
+
- "Per-repo contributions" section verbatim
|
|
65
|
+
- For each repo in `repos[]`, run `gh pr list --repo <owner>/<repo>
|
|
66
|
+
--state open --json number,title,headRefName` (best-effort; degrade
|
|
67
|
+
gracefully if `gh` not authenticated) and append a one-line
|
|
68
|
+
summary per open PR.
|
|
69
|
+
- For each repo, print last 3 commits via `git -C <repo-path>
|
|
70
|
+
log -3 --oneline`.
|
|
71
|
+
|
|
72
|
+
3. If `<root>/.state/active-initiative` matches this slug, print:
|
|
73
|
+
`(active)` in the header.
|
|
74
|
+
|
|
75
|
+
## Steps for `close`
|
|
76
|
+
|
|
77
|
+
1. Resolve slug from argument (required for close — no implicit
|
|
78
|
+
"close the active one" to avoid surprises).
|
|
79
|
+
|
|
80
|
+
2. Load the initiative; abort if already `status: closed`.
|
|
81
|
+
|
|
82
|
+
3. Prompt the user (one question at a time):
|
|
83
|
+
- **What shipped?**
|
|
84
|
+
- **What was deferred?**
|
|
85
|
+
- **What was learned?**
|
|
86
|
+
|
|
87
|
+
4. Append a populated `## Close` section (preserving any existing
|
|
88
|
+
sections above it). Set frontmatter `status: closed` and
|
|
89
|
+
`closed: <today>`. Write back via `writeInitiative`.
|
|
90
|
+
|
|
91
|
+
5. If this slug was active, clear `.state/active-initiative` via
|
|
92
|
+
`clearActive(root)`.
|
|
93
|
+
|
|
94
|
+
6. Print confirmation:
|
|
95
|
+
```
|
|
96
|
+
Closed initiative <slug>. State cleared.
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Steps for `list`
|
|
100
|
+
|
|
101
|
+
1. Read every `NNNN-*.md` file in `<root>/initiatives/`. Sort by
|
|
102
|
+
numeric id ascending.
|
|
103
|
+
|
|
104
|
+
2. For each, print:
|
|
105
|
+
```
|
|
106
|
+
NNNN <slug> status started→closed-or-‹in-progress› repos: a, b, c
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
3. If `.state/active-initiative` is set, mark that row with `←active`.
|
|
110
|
+
|
|
111
|
+
## Key principles
|
|
112
|
+
|
|
113
|
+
- **Idempotent prompts** — running `/initiative create <existing-slug>`
|
|
114
|
+
must refuse with a clear error, never silently overwrite.
|
|
115
|
+
- **Frontmatter is the source of truth** — body sections are free-form
|
|
116
|
+
human writing; the agent doesn't reformat them when re-reading.
|
|
117
|
+
- **Cross-repo, not in-repo** — initiatives live in the ecosystem root,
|
|
118
|
+
not inside any one member's `specs/`. The member-repo phases stay
|
|
119
|
+
authoritative for their own work; initiatives link across them.
|