@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Avinash Singh
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,214 @@
1
+ <div align="center">
2
+ <img src="site/src/assets/logo/wordmark.svg" width="280" alt="momentum" />
3
+
4
+ ### Spec-driven discipline for agentic AI
5
+
6
+ Phases. Decisions. History. Backlog. First-class state across any AI IDE.
7
+
8
+ [![npm](https://img.shields.io/npm/v/@limina-labs/momentum?logo=npm)](https://www.npmjs.com/package/@limina-labs/momentum)
9
+ [![license](https://img.shields.io/github/license/LiminaLabsAI/momentum)](LICENSE)
10
+ [![visit the site](https://img.shields.io/badge/site-trymomentum.github.io-4F46E5)](https://trymomentum.github.io/)
11
+ </div>
12
+
13
+ ---
14
+
15
+ ## What is momentum?
16
+
17
+ **Your AI coding agent forgets.** Hit the context limit or open a fresh session and it loses the roadmap, the architecture decisions, the bug it fixed an hour ago. The chat window is the wrong place to keep your project's source of truth — the file system is.
18
+
19
+ momentum makes your project's memory durable. Phases, decisions, history, and backlog live as plain files your agent reads at the start of every session and updates as it works — so the *project* persists, not just whatever the agent shipped this session. Whether your agent writes code, manages infrastructure, runs research, or operates pipelines, the same discipline applies: every phase planned, every decision recorded, every release tagged.
20
+
21
+ ## Quick install
22
+
23
+ ```bash
24
+ npx @limina-labs/momentum@latest init
25
+ ```
26
+
27
+ That's it. The agent picks up the workflow on next session start.
28
+
29
+ > Always pin `@latest`. A bare `npx @limina-labs/momentum` can serve a
30
+ > stale, cached version; `@latest` forces npx to resolve the newest release.
31
+
32
+ ```bash
33
+ # Want a specific adapter?
34
+ npx @limina-labs/momentum@latest init --agent opencode # opencode
35
+ npx @limina-labs/momentum@latest init --agent codex # Codex
36
+ npx @limina-labs/momentum@latest init --agent antigravity # Antigravity
37
+
38
+ # Coordinating multiple related projects?
39
+ npx @limina-labs/momentum@latest init --ecosystem my-eco
40
+ ```
41
+
42
+ ## How it works — no daemon, no lock-in
43
+
44
+ momentum isn't a framework or a background service. It's plain files and conventions your agent already knows how to read:
45
+
46
+ 1. **`init` writes files into your repo** — your agent's instruction file (`CLAUDE.md` / `AGENTS.md`), a `specs/` folder, rule and slash-command definitions, and git hooks.
47
+ 2. **Your AI IDE already reads that instruction file every session** — momentum just fills it with a structured workflow and a map of where project state lives.
48
+ 3. **Your agent maintains the state as it works** — it reads `status.md` to orient, logs decisions to `history.md`, and tracks work in `backlog.md`. Automatically.
49
+
50
+ Nothing runs in the background. No service to manage, no lock-in: **uninstall = delete the files.**
51
+
52
+ ## Works with any AI IDE
53
+
54
+ | Agent | Status | Primary instruction file |
55
+ | --- | --- | --- |
56
+ | [opencode](https://opencode.ai) | ✅ Shipped (v0.28.0, live-validated) | `AGENTS.md` |
57
+ | [Claude Code](https://trymomentum.github.io/ide-support/#claude-code) | ✅ Shipped | `CLAUDE.md` |
58
+ | [Codex](https://trymomentum.github.io/ide-support/#codex) | ✅ Shipped | `AGENTS.md` |
59
+ | [Antigravity](https://trymomentum.github.io/ide-support/#antigravity) | ✅ Shipped | `AGENTS.md` |
60
+ | [Cursor](https://trymomentum.github.io/ide-support/#cursor) | 🛠️ Planned (Phase 15) | `.cursor/rules/` |
61
+ | [Gemini CLI](https://trymomentum.github.io/ide-support/#gemini-cli) | 🛠️ Planned (Phase 15) | `GEMINI.md` |
62
+
63
+ Same commands, same workflow, every agent. Switch adapters anytime; the per-project state survives.
64
+
65
+ ## Keeping projects up to date
66
+
67
+ Upgrading is **two steps** — update the CLI, then re-sync each project's files:
68
+
69
+ ```bash
70
+ npm install -g @limina-labs/momentum@latest # 1. update the CLI
71
+ momentum upgrade # 2. re-sync this project
72
+ ```
73
+
74
+ `momentum upgrade` copies files from the *installed* CLI (not from npm), so your
75
+ project files are only ever as new as the CLI — skip step 1 and step 2 just
76
+ re-installs the same old files. Upgrade is safe by design: your `## Project
77
+ Extensions` block is preserved, changed files are backed up to `.bak`, files a
78
+ newer version drops are removed (also `.bak`-backed), and your own files are
79
+ never touched. Preview anything with `momentum upgrade --dry-run`.
80
+
81
+ Running an **ecosystem**? Sweep every member in one pass:
82
+
83
+ ```bash
84
+ momentum ecosystem upgrade # skips dirty repos; reports each version
85
+ momentum ecosystem upgrade --dry-run # preview the whole fleet, write nothing
86
+ momentum ecosystem upgrade --autostash # stash dirty repos, upgrade, restore them
87
+ ```
88
+
89
+ `--autostash` lets a repo with uncommitted work upgrade anyway: it stashes the
90
+ in-flight changes, runs the upgrade on a clean tree, then restores your work
91
+ exactly as it was — so you don't have to commit or stash by hand first. If the
92
+ upgrade ever touches a file you'd also changed, your work is kept safe in
93
+ `git stash` rather than overwritten. (`--force` is the blunt alternative:
94
+ upgrade in place without stashing.) Same flags work on single-repo
95
+ `momentum upgrade`.
96
+
97
+ A momentum-managed project records its version-of-record in
98
+ `.momentum/installed.json` (committed) — that's what powers orphan cleanup and
99
+ the ecosystem sweep's per-repo version report.
100
+
101
+ ## Your specs are an open knowledge bundle
102
+
103
+ Every momentum project's `specs/` tree is a conformant **[Open Knowledge
104
+ Format](https://github.com/GoogleCloudPlatform/knowledge-catalog/blob/main/okf/SPEC.md)
105
+ (OKF v0.1)** bundle — Google Cloud's open, vendor-neutral standard for agent
106
+ knowledge: markdown concept files with YAML frontmatter, reserved `index.md`
107
+ listings for progressive disclosure, ordinary markdown links as the
108
+ relationship graph. Any OKF consumer — a knowledge catalog, a visualizer,
109
+ someone else's agent — can read your specs with zero momentum knowledge, and
110
+ there is no JSON state left to drift: a phase's status lives in the phase's
111
+ own `overview.md` frontmatter.
112
+
113
+ ```bash
114
+ momentum okf check # conformance report for specs/ (exit 1 on violations)
115
+ momentum okf index # regenerate the bundle listings
116
+ ```
117
+
118
+ Existing projects convert automatically on `momentum upgrade`: legacy
119
+ `specs/phases/index.json` is distributed into per-phase frontmatter,
120
+ `impact-map.json` becomes a readable table, every spec file gains its `type`,
121
+ and the old JSON is removed. The migration preserves your prose byte-for-byte
122
+ and is idempotent. (ADR-0005.)
123
+
124
+ ## What you get
125
+
126
+ | | |
127
+ | --- | --- |
128
+ | 🧭 **Phases** | Plan → execute → verify → release. Every phase has a brainstorm, plan, tasks, history. |
129
+ | 📋 **Backlog** | Bugs / features / tech debt / enhancements with priorities and per-item context. |
130
+ | 📜 **History** | Append-only log of decisions, discoveries, scope changes. The *why* outlives any session. |
131
+ | ⚖️ **Rules** | 13 autonomous agent rules — orient first, verify before claim, log every decision. |
132
+ | 🛠️ **Skills** | ~15 slash commands your agent runs — start, complete, sync, review, validate. |
133
+ | 🌐 **Multi-project** | Ecosystem mode (state layer) + Orchestration primitives (action layer) for cross-project work. |
134
+
135
+ ## Single project ↔ Multi-project ecosystem
136
+
137
+ Single-project usage is the default. When you have related projects that need to coordinate, ecosystem mode lets one agent session work across all of them.
138
+
139
+ ```mermaid
140
+ flowchart LR
141
+ subgraph single [SINGLE PROJECT]
142
+ A1[your agent] --> A2[your-project/]
143
+ end
144
+
145
+ subgraph multi [ECOSYSTEM]
146
+ B1[one agent session]
147
+ B1 --> B2[my-eco/]
148
+ B2 --> B3[project-a/]
149
+ B2 --> B4[project-b/]
150
+ B2 --> B5[project-c/]
151
+ end
152
+
153
+ style single fill:#F8FAFC,stroke:#94A3B8,stroke-width:1px
154
+ style multi fill:#EEF2FF,stroke:#4F46E5,stroke-width:1px
155
+ ```
156
+
157
+ **Hard invariant**: a project running `momentum init` without `--ecosystem` sees zero difference from before ecosystem mode existed. Ecosystem mode is purely additive.
158
+
159
+ [Read the ecosystem deep dive →](https://trymomentum.github.io/ecosystem/)
160
+
161
+ ## Orchestration primitives
162
+
163
+ Four verbs the agent composes per task — not a pipeline. They're how the agent **acts** across projects (ecosystem mode is the durable **state** they read and write).
164
+
165
+ - **`scout`** — Read-only context fetch from a project without opening a session there.
166
+ - **`dispatch`** — Parallel fan-out across N projects with auto-tailored prompts + synthesis.
167
+ - **`handoff`** — Cross-session control transfer with a structured context block.
168
+ - **`continue`** — Pick up a pending handoff. Idempotent.
169
+
170
+ [Read the orchestration deep dive →](https://trymomentum.github.io/orchestration/)
171
+
172
+ ## Parallel workstreams
173
+
174
+ One repo, several features in flight, each in its own agent session — momentum models each as a **lane**: a branch (usually in its own worktree) bound to one phase, with its own session. Each session resolves its phase from its branch, writes only its own lane's tracking, and finished lanes land on `main` **one at a time** with the suite green between landings. `momentum lanes` is the mechanism: open lanes (worktree created for you), see the ambient board with queue pressure from any session, signal other lanes, and land through a merge queue with graded evidence gates. Isolation substrate is yours to pick — plain `git worktree` works out of the box; treehouse pools or GitButler virtual branches light up extra speed. momentum recommends, never requires.
175
+
176
+ [Read the parallel workstreams guide →](https://trymomentum.github.io/parallel-work/)
177
+
178
+ ## The 13 autonomous rules
179
+
180
+ Discipline preserved without enforcement overhead. Three of the highest-leverage:
181
+
182
+ - **Rule 6 — Git lifecycle.** Feature branch auto-created. Conventional commits. Push silently. NEVER merge to main without explicit OK.
183
+ - **Rule 8 — Record phase history.** Every meaningful decision lands in `history.md` at the moment it happens. The *why* outlives every session.
184
+ - **Rule 12 — Verify before claim.** No completion without evidence. Run the test, read the output, mark done only if the output shows pass.
185
+
186
+ [Read all 13 rules with full text + red flags →](https://trymomentum.github.io/rules/)
187
+
188
+ ## Why momentum exists
189
+
190
+ The thesis is narrow: **state that outlives any single session**.
191
+
192
+ What's new about agentic AI is that the agent acts. What's old is that acts without context disappear into noise. Spec-driven discipline gives the agent context that outlives any single session — `status.md` at session start, `history.md` for every decision, `backlog.md` for everything queued. The agent verifies before claiming done. The agent doesn't pollute curated docs with orchestration noise.
193
+
194
+ The discipline is the differentiator. The toolkit is the implementation.
195
+
196
+ [Read the philosophy + design principles →](https://trymomentum.github.io/about/)
197
+
198
+ ## Docs
199
+
200
+ - 🌐 **Live site** — [trymomentum.github.io](https://trymomentum.github.io/)
201
+ - 📚 **Getting started** — [trymomentum.github.io/getting-started/](https://trymomentum.github.io/getting-started/)
202
+ - 💡 **Concepts** — [trymomentum.github.io/concepts/](https://trymomentum.github.io/concepts/)
203
+ - 🛠️ **Skills** — [trymomentum.github.io/skills/](https://trymomentum.github.io/skills/)
204
+ - ⚖️ **Rules** — [trymomentum.github.io/rules/](https://trymomentum.github.io/rules/)
205
+ - 🌐 **Multi-project** — [Ecosystem mode](https://trymomentum.github.io/ecosystem/) · [Orchestration](https://trymomentum.github.io/orchestration/)
206
+ - ❓ **FAQ** — [trymomentum.github.io/faq/](https://trymomentum.github.io/faq/)
207
+
208
+ ## Contributing
209
+
210
+ Issues + discussions + PRs welcome at [github.com/LiminaLabsAI/momentum](https://github.com/LiminaLabsAI/momentum). The project itself uses momentum, so contributing means following the same workflow — phases, history entries, conventional commits, `/complete-phase` before release.
211
+
212
+ ## License
213
+
214
+ [MIT](LICENSE)
@@ -0,0 +1,196 @@
1
+ 'use strict';
2
+
3
+ // Antigravity adapter for momentum.
4
+ //
5
+ // Antigravity (2.x: IDE + `agy` CLI + Python SDK over one shared agent
6
+ // harness) auto-loads AGENTS.md hierarchically as its primary instruction
7
+ // surface and discovers workflows/skills/hooks/plugins under the `.agents/`
8
+ // customization root. Contract locked by live probes against agy 1.0.16 —
9
+ // see specs/phases/phase-22b-antigravity-2-adoption/evidence/fact-sheet.md
10
+ // and ADR-0006.
11
+
12
+ const fs = require('fs');
13
+ const path = require('path');
14
+ const { spawn, spawnSync } = require('child_process');
15
+
16
+ module.exports = {
17
+ displayName: 'Antigravity',
18
+
19
+ destinations: {
20
+ // Phase 22b (ADR-0006): ONE canonical customization root — .agents/.
21
+ // agy 1.0.16 accepts .agents/.agent/_agents/_agent equally (fact-sheet §1);
22
+ // .agents/ is what every vendor example, the builtin reference docs, and
23
+ // the plugin layout use. Legacy .agent/ files are orphan-cleaned on
24
+ // upgrade (Phase 20 machinery; user-owned files keep their shield).
25
+ // Recipes are workflows (auto-register as /<name> slash commands).
26
+ // agents/ declared but unused — personas live as skills on Antigravity.
27
+ commands: ['.agents', 'workflows'], // legacy commands key reused — overlay still feeds via destinations[commands]
28
+ 'agent-rules': ['.agents', 'rules'],
29
+ scripts: ['scripts'],
30
+ engines: ['.agents', 'engines'],
31
+ workflows: ['.agents', 'workflows'],
32
+ skills: ['.agents', 'skills'],
33
+ agents: ['.agents', 'agents'],
34
+ },
35
+
36
+ primaryInstruction: {
37
+ source: ['instructions', 'AGENTS.md'],
38
+ destination: ['AGENTS.md'],
39
+ label: 'AGENTS.md',
40
+ markerAware: true,
41
+ },
42
+
43
+ configFiles: [
44
+ {
45
+ source: ['hooks.json'],
46
+ destination: ['.agents', 'hooks.json'],
47
+ label: '.agents/hooks.json',
48
+ },
49
+ ],
50
+
51
+ capabilities: {
52
+ hooks: true, // Phase 22b: five-event contract verified live (fact-sheet §5; PreToolUse/PostToolUse/PreInvocation/PostInvocation/Stop all fired)
53
+ slashCommands: true, // Phase 22b: workflows auto-register as /<name> — verified live incl. planted markers (fact-sheet §3)
54
+ subagents: true,
55
+ parallelSubagents: true,
56
+ sessionStartHook: false, // Phase 22b: no SessionStart event EXISTS (5-event surface). Equivalent ships via PreInvocation invocationNum==0 + injectSteps; flip gated on the live injection round-trip (ENH-054 hang blocks re-probe).
57
+ skills: true, // Phase 22b: <name>/SKILL.md discovery verified live (fact-sheet §4)
58
+ browser: false,
59
+ computerUse: false,
60
+ artifacts: true,
61
+ planningMode: true,
62
+ },
63
+
64
+ roadmap: {
65
+ sessionStartHook:
66
+ 'Phase 22b (ADR-0006): SessionStart does not exist on Antigravity — the momentum-session-context PreInvocation hook injects the handoff banner + queued notices as ephemeralMessage at invocationNum 0. Capability flips true once the injection round-trip is verified live (re-probe blocked by the intermittent agy 1.0.16 hook-runner hang, ENH-054). AGENTS.md text carries the fallback handoff hint meanwhile.',
67
+ },
68
+
69
+ runInstall(targetDir, adapterDir, helpers) {
70
+ const { copyFile, fileExists, recordManaged } = helpers;
71
+
72
+ console.log('→ Configuring Antigravity hooks...');
73
+ const hooksDest = path.join(targetDir, '.agents', 'hooks.json');
74
+ if (recordManaged) recordManaged(hooksDest); // managed regardless of write
75
+ if (!fileExists(hooksDest)) {
76
+ copyFile(path.join(adapterDir, 'hooks.json'), hooksDest);
77
+ } else {
78
+ console.log(' ⚠️ .agents/hooks.json already exists.');
79
+ console.log(` Merge hooks manually from: ${path.join(adapterDir, 'hooks.json')}`);
80
+ }
81
+ },
82
+
83
+ runUpgrade(targetDir, adapterDir, helpers) {
84
+ const { copyFile, fileExists, recordManaged, dryRun } = helpers;
85
+
86
+ console.log('→ Upgrading Antigravity hooks...');
87
+ const src = path.join(adapterDir, 'hooks.json');
88
+ const dest = path.join(targetDir, '.agents', 'hooks.json');
89
+ if (recordManaged) recordManaged(dest); // managed even when identical-skip
90
+
91
+ if (fileExists(dest)) {
92
+ const srcContent = fs.readFileSync(src, 'utf8');
93
+ const destContent = fs.readFileSync(dest, 'utf8');
94
+ if (srcContent !== destContent) {
95
+ if (dryRun) {
96
+ console.log(' ✋ would upgrade: .agents/hooks.json');
97
+ } else {
98
+ fs.copyFileSync(dest, dest + '.bak');
99
+ copyFile(src, dest);
100
+ console.log(' ↑ upgraded: .agents/hooks.json (original saved as .bak)');
101
+ }
102
+ }
103
+ } else {
104
+ copyFile(src, dest);
105
+ console.log(' + added: .agents/hooks.json');
106
+ }
107
+ },
108
+
109
+ // Phase 22b G2 — adapter.spawn(directive) on the REAL agy CLI surface.
110
+ //
111
+ // agy 1.0.16 has no --cwd/--skill flags (fact-sheet §7 — the Phase 18
112
+ // contract was written against a runtime that did not exist). Real shape:
113
+ // - run FROM directive.repoPath (process cwd),
114
+ // - headless print mode: -p <prompt>,
115
+ // - --new-project: MANDATORY isolation — without it print mode can
116
+ // resume an unrelated prior conversation for the workspace,
117
+ // - skill engagement by name in the prompt (semantic activation),
118
+ // - --dangerously-skip-permissions: supervisors edit files headlessly,
119
+ // - --print-timeout as the in-CLI bound + detached launch with logs:
120
+ // print runs take minutes and can hang PAST their own timeout when
121
+ // hooks are present (ENH-054) — the conductor monitors via the board
122
+ // and the per-repo log file; never block the conductor's session.
123
+ spawn(directive) {
124
+ if (!directive || directive.platform !== 'antigravity') {
125
+ return {
126
+ repoId: directive && directive.repoId,
127
+ status: -1,
128
+ detail: `non-antigravity platform: ${directive && directive.platform}`,
129
+ };
130
+ }
131
+ const agyBin = process.env.AGY_BIN || 'agy';
132
+
133
+ // Synchronous missing-binary detection (the async 'error' event would
134
+ // arrive after we return the contract tuple).
135
+ const resolved = agyBin.includes(path.sep)
136
+ ? (fs.existsSync(agyBin) ? agyBin : null)
137
+ : (() => {
138
+ const w = spawnSync('which', [agyBin], { encoding: 'utf8' });
139
+ return w.status === 0 ? agyBin : null;
140
+ })();
141
+ if (!resolved) {
142
+ return {
143
+ repoId: directive.repoId,
144
+ status: -1,
145
+ detail: `agy not found (${agyBin}) — install: curl -fsSL https://antigravity.google/cli/install.sh | bash`,
146
+ };
147
+ }
148
+
149
+ const printTimeout = process.env.MOMENTUM_AGY_PRINT_TIMEOUT || '30m';
150
+ const prompt = [
151
+ `Load the swarm-supervisor skill and stay in that persona.`,
152
+ `You are a swarm supervisor. Recipe: ${directive.recipePath}`,
153
+ `Read the recipe and the brief at specs/phases/${directive.phaseSlug}/overview.md.`,
154
+ `Your repo: ${directive.repoId}. Your swarm: ${directive.swarmId} wave ${directive.wave}.`,
155
+ `Begin the boot sequence.`,
156
+ ].join('\n');
157
+ const args = [
158
+ '--new-project',
159
+ '--dangerously-skip-permissions',
160
+ '--print-timeout', printTimeout,
161
+ '-p', prompt,
162
+ ];
163
+
164
+ let logPath = null;
165
+ let out = 'ignore';
166
+ try {
167
+ const logDir = path.join(directive.repoPath, '.momentum');
168
+ fs.mkdirSync(logDir, { recursive: true });
169
+ logPath = path.join(logDir, `swarm-supervisor-${directive.swarmId}-w${directive.wave}.log`);
170
+ out = fs.openSync(logPath, 'a');
171
+ } catch (_) { /* log file is best-effort — spawn proceeds without it */ }
172
+
173
+ try {
174
+ const child = spawn(resolved, args, {
175
+ cwd: directive.repoPath,
176
+ env: Object.assign({}, process.env, directive.env),
177
+ detached: true,
178
+ stdio: ['ignore', out, out],
179
+ });
180
+ child.unref();
181
+ if (typeof out === 'number') fs.closeSync(out);
182
+ return {
183
+ repoId: directive.repoId,
184
+ status: 0,
185
+ detail: `launched pid ${child.pid}${logPath ? ` (log: ${logPath})` : ''}`,
186
+ };
187
+ } catch (err) {
188
+ if (typeof out === 'number') { try { fs.closeSync(out); } catch (_) {} }
189
+ return {
190
+ repoId: directive.repoId,
191
+ status: -1,
192
+ detail: (err && err.message) || 'spawn failed',
193
+ };
194
+ }
195
+ },
196
+ };
@@ -0,0 +1,39 @@
1
+ {
2
+ "momentum-brainstorm-gate": {
3
+ "PreToolUse": [
4
+ {
5
+ "matcher": "write_to_file|run_command|.*write.*|.*edit.*|.*replace.*",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "bash ../scripts/antigravity-hook-adapter.sh pre-tool",
10
+ "timeout": 15
11
+ }
12
+ ]
13
+ }
14
+ ]
15
+ },
16
+ "momentum-history-reminder": {
17
+ "PostToolUse": [
18
+ {
19
+ "matcher": "write_to_file|run_command|.*write.*|.*edit.*|.*replace.*",
20
+ "hooks": [
21
+ {
22
+ "type": "command",
23
+ "command": "bash ../scripts/antigravity-hook-adapter.sh post-tool",
24
+ "timeout": 15
25
+ }
26
+ ]
27
+ }
28
+ ]
29
+ },
30
+ "momentum-session-context": {
31
+ "PreInvocation": [
32
+ {
33
+ "type": "command",
34
+ "command": "bash ../scripts/antigravity-hook-adapter.sh pre-invocation",
35
+ "timeout": 15
36
+ }
37
+ ]
38
+ }
39
+ }