agent-orchestrator-kit 0.1.12 → 0.1.14

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 (43) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +65 -32
  3. package/bin/agent-orchestrator.js +559 -1
  4. package/package.json +2 -2
  5. package/profiles/generic/orchestrator.yaml +6 -0
  6. package/profiles/mvp/orchestrator.yaml +6 -0
  7. package/profiles/node/orchestrator.yaml +6 -0
  8. package/profiles/vue3/orchestrator.yaml +6 -0
  9. package/templates/.agents/amp.settings.json.example +2 -5
  10. package/templates/.agents/commands/opsx-apply.md +22 -4
  11. package/templates/.agents/commands/opsx-archive.md +28 -7
  12. package/templates/.agents/commands/opsx-design.md +28 -5
  13. package/templates/.agents/commands/opsx-explore.md +19 -2
  14. package/templates/.agents/commands/opsx-propose.md +29 -6
  15. package/templates/.agents/commands/opsx-quick.md +25 -2
  16. package/templates/.agents/commands/opsx-review.md +27 -4
  17. package/templates/.agents/mcp.json.example +2 -5
  18. package/templates/.agents/rules/agent-orchestration.mdc +46 -0
  19. package/templates/.agents/rules/cli-via-npm.mdc +2 -1
  20. package/templates/.agents/rules/memory-mcp-autosetup.mdc +34 -14
  21. package/templates/.agents/rules/session-handoff.mdc +46 -0
  22. package/templates/.agents/skills/agent-orchestration/SKILL.md +91 -17
  23. package/templates/.agents/skills/openspec-apply-change/SKILL.md +7 -4
  24. package/templates/.agents/skills/openspec-archive-change/SKILL.md +13 -7
  25. package/templates/.agents/skills/openspec-explore/SKILL.md +4 -2
  26. package/templates/.agents/skills/openspec-propose/SKILL.md +14 -6
  27. package/templates/.agents/subagents/code-reviewer.md +12 -1
  28. package/templates/.agents/subagents/code-writer.md +13 -2
  29. package/templates/.agents/subagents/codebase-explorer.md +31 -0
  30. package/templates/.agents/subagents/design-implementer.md +13 -2
  31. package/templates/.agents/subagents/design-intake.md +31 -0
  32. package/templates/.agents/subagents/openspec-guide.md +12 -1
  33. package/templates/.agents/subagents/session-handoff.md +48 -0
  34. package/templates/.agents/subagents/setup-doctor.md +12 -3
  35. package/templates/.agents/subagents/spec-architect.md +32 -0
  36. package/templates/.agents/subagents/spec-archiver.md +31 -0
  37. package/templates/.agents/subagents/spec-reviewer.md +32 -0
  38. package/templates/.agents/subagents/test-writer.md +13 -2
  39. package/templates/AGENTS.md +37 -3
  40. package/templates/CLAUDE.md +24 -0
  41. package/templates/orchestrator.yaml +9 -0
  42. package/templates/scripts/memory-mcp-launcher.cjs +46 -0
  43. package/templates/scripts/sync-local-agent-skills.sh +2 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,29 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.1.14] - 2026-08-13
8
+
9
+ ### Added
10
+ - **`session-handoff` subagent** — mandatory restore at session start and persist at session exit (Amp: isolated `subagent-session-handoff`)
11
+ - **`npx agent-orchestrator-kit handoff <name>`** — validates `handoff.md`, upserts `.cursor/memory.json` with an absolute path, prints an expanded self-contained next-thread prompt in `project.agent_language`
12
+ - **`npx agent-orchestrator-kit memory-setup`** — installs `scripts/memory-mcp-launcher.cjs` and rewrites Cursor/Amp Memory MCP away from relative `MEMORY_FILE_PATH`
13
+ - Always-apply rule `.agents/rules/session-handoff.mdc` with HARD STOP gates Amp cannot treat as optional
14
+
15
+ ### Changed
16
+ - Next-session prompt is now a full operating brief (Done, Decisions, Blocked, attach, which subagent to spawn, Amp isolation, exit HARD STOP) so the next thread works even if Memory MCP is ignored
17
+ - Amp `subagent-*` wrappers require STOP if spawn is unavailable instead of running specialist work in the main thread
18
+ - Memory MCP examples and init/sync use the launcher instead of `npx` + relative path
19
+
20
+ ## [0.1.13] - 2026-08-13
21
+
22
+ ### Added
23
+ - **Pipeline subagent conductor** — every `/opsx:*` parent session now delegates through an exclusive phase/signal routing table, with five new stage specialists for explore, design, propose, spec review, and archive (`codebase-explorer`, `design-intake`, `spec-architect`, `spec-reviewer`, `spec-archiver`)
24
+ - **Durable session handoff** — sessions restore and persist `Change:*`, `Handoff:*`, and `Decision:*` Memory entities, mirror state in `openspec/changes/<name>/handoff.md`, and emit one next-session prompt in `project.agent_language` (no service banner, no duplicated summary)
25
+
26
+ ### Changed
27
+ - Amp `subagent-*` wrappers now require isolated fresh-context execution and return only a structured specialist report
28
+ - OpenSpec commands, orchestration rules, skills, profiles, and documentation now enforce conductor-only task marking and phase separation
29
+
7
30
  ## [0.1.12] - 2026-07-21
8
31
 
9
32
  ### Added
package/README.md CHANGED
@@ -13,7 +13,7 @@ A portable kit that installs a **role-separated AI pipeline** into any project:
13
13
  explore → [design] → propose → review → apply → verify → archive
14
14
  ```
15
15
 
16
- Each role runs in a **separate agent session** with dedicated permissions, model hints, and handoff gates. The `openspec/changes/` folder acts as the **contract between agents** no shared memory between sessions, only files.
16
+ Each role runs in a **separate agent session**. The parent `/opsx:*` session is a conductor: it restores state, spawns the routed specialist, verifies its report, and does not perform specialist work itself. OpenSpec files remain the requirements/tasks source of truth; Memory MCP and `openspec/changes/<name>/handoff.md` index phase state and the next command.
17
17
 
18
18
  **Figma PAT setup (v0.1.11+)** — local `.agents/figma.local.env` + MCP launcher (token never in chat / committed MCP JSON). See [Figma token](#figma-token-optional).
19
19
 
@@ -27,10 +27,28 @@ Each role runs in a **separate agent session** with dedicated permissions, model
27
27
  | `test-writer` | Automated tests for recently changed code |
28
28
  | `setup-doctor` | Orchestrator / MCP / sync diagnosis and repair |
29
29
  | `design-implementer` | Pixel-accurate Figma / screenshot → production UI |
30
+ | `codebase-explorer` | Read-only repository investigation for explore |
31
+ | `design-intake` | Design source → durable brief + assets |
32
+ | `spec-architect` | Proposal, design, delta specs, and tasks |
33
+ | `spec-reviewer` | Pre-apply artifact gate + `review.md` |
34
+ | `spec-archiver` | Delta merge and completed-change archive |
35
+ | `session-handoff` | Restore/persist Memory + `handoff.md` + expanded next-thread prompt |
36
+
37
+ The conductor uses one exclusive route per signal:
38
+
39
+ | Phase / signal | Subagent |
40
+ |----------------|----------|
41
+ | Status / gates / next command | `openspec-guide` |
42
+ | Session start restore / session exit persist | `session-handoff` |
43
+ | Kit / MCP / sync repair | `setup-doctor` |
44
+ | Explore repository research | `codebase-explorer` |
45
+ | Design / propose / spec review | `design-intake` / `spec-architect` / `spec-reviewer` |
46
+ | Apply UI / ordinary task / tests / pre-PR review | `design-implementer` / `code-writer` / `test-writer` / `code-reviewer` |
47
+ | Archive | `spec-archiver` |
30
48
 
31
49
  - **Cursor** → `.cursor/agents/` (native subagents)
32
50
  - **Claude Code** → `.claude/agents/` (native subagents)
33
- - **Amp Code** → auto-generated `subagent-*` skill wrappers in `.agents/skills/` (Amp has no file-based subagents)
51
+ - **Amp Code** → auto-generated `subagent-*` skill wrappers in `.agents/skills/`; each wrapper requires the parent to spawn an isolated subagent, never execute it in the main thread
34
52
 
35
53
  Works with:
36
54
  - [Cursor](https://cursor.sh) — via `.cursor/rules/` + `.cursor/skills/` + `.cursor/agents/`
@@ -55,7 +73,7 @@ npx agent-orchestrator-kit@latest init --profile generic --ci gitlab --spec-veri
55
73
 
56
74
  See [Installation](#installation) for profile/CI options.
57
75
 
58
- **🔄 Already have the kit installed? Upgrade to latest (Figma PAT in v0.1.11+, subagents in v0.1.10+):**
76
+ **🔄 Already have the kit installed? Upgrade to latest (hardened handoff CLI + Memory launcher in v0.1.14+, conductor in v0.1.13+, Figma PAT in v0.1.11+):**
59
77
 
60
78
  ```bash
61
79
  npx agent-orchestrator-kit@latest update
@@ -146,9 +164,9 @@ your-project/
146
164
  │ ├── orchestrator.yaml
147
165
  │ ├── mcp.json.example # Cursor MCP template
148
166
  │ ├── amp.settings.json.example # Amp MCP template
149
- │ ├── commands/ # 6 /opsx:* commands
150
- │ ├── rules/ # 3 auto-applied rules
151
- │ ├── subagents/ # 6 default custom subagents (Cursor/Claude/Amp)
167
+ │ ├── commands/ # /opsx:* role commands
168
+ │ ├── rules/ # auto-applied orchestration rules
169
+ │ ├── subagents/ # 12 stage/custom subagents (Cursor/Claude/Amp)
152
170
  │ └── skills/
153
171
  │ ├── agent-orchestration/ # Pipeline orchestration
154
172
  │ ├── openspec-howto/
@@ -169,8 +187,8 @@ your-project/
169
187
  | Orchestration | 5-role pipeline, `AGENTS.md`, `orchestrator.yaml`, review command |
170
188
  | OpenSpec skills | All 7 skills for `/opsx:*` workflow |
171
189
  | IDE sync | Cursor + Claude Code sync script (`--delete` semantics — removes stale skills/subagents) |
172
- | Subagents | `openspec-guide`, `code-writer`, `code-reviewer`, `test-writer`, `setup-doctor`, `design-implementer` — native in Cursor (`.cursor/agents/`) + Claude Code (`.claude/agents/`), exposed to Amp as auto-generated `subagent-*` skill wrappers in `.agents/skills/` |
173
- | CLI gates | `npx agent-orchestrator-kit status` / `gate-check` — deterministic review-gate checks (always via `npx`; see `cli-via-npm.mdc`) |
190
+ | Subagents | 12 exclusive routes: guide/setup/session-handoff, explore/design/propose/review/archive stage agents, and apply implementation/test/code-review agents — native in Cursor + Claude Code, isolated Amp `subagent-*` wrappers |
191
+ | CLI gates | `npx agent-orchestrator-kit status` / `gate-check` / `handoff` / `memory-setup` — deterministic review-gate and session-handoff (always via `npx`; see `cli-via-npm.mdc`) |
174
192
  | CI | `agent-verify.yml` — GitHub (default) or GitLab fragment + `prebuild` hook, both run `gate-check` |
175
193
  | AI Spec Verifier | `spec-verify.yml` + verifier scripts — GitLab or GitHub, opt-in (`--spec-verify`) |
176
194
  | MCP templates | Memory MCP for Cursor and Amp |
@@ -205,7 +223,7 @@ cp .agents/amp.settings.json.example .amp/settings.json
205
223
 
206
224
  Or run `./scripts/sync-local-agent-skills.sh` — it creates `.amp/settings.json` automatically.
207
225
 
208
- **Subagents in Amp:** Amp has no file-based custom subagents (only skills and plugin agents), so the kit exposes every `.agents/subagents/<name>.md` as an auto-generated skill `subagent-<name>` in `.agents/skills/`. These wrappers are committed to git, so Amp picks them up with zero local setup just say "use the subagent-design-implementer skill" or let Amp auto-load it from the description. Edit the source file in `.agents/subagents/` (never the wrapper) and re-run `sync` to regenerate.
226
+ **Subagents in Amp:** the kit exposes every `.agents/subagents/<name>.md` as an auto-generated `subagent-<name>` skill. The conductor MUST run the wrapper as an isolated subagent with fresh context and MUST NOT execute its body in the main thread. Edit only the source file and re-run `sync` to regenerate wrappers.
209
227
 
210
228
  4. Use commands directly:
211
229
 
@@ -237,7 +255,7 @@ Switch modes in Amp CLI: `Ctrl+O` → `mode`.
237
255
  - `.claude/skills/` — all skills from `.agents/skills/` (excluding Amp `subagent-*` wrappers)
238
256
  - `.claude/agents/` — custom subagents from `.agents/subagents/` (native Claude Code subagents)
239
257
  3. Skills are auto-loaded by Claude Code from `.claude/skills/`.
240
- 4. Invoke directly: `/agent-orchestration`, `/openspec-howto`, etc. Subagents are delegated automatically by description or on request ("use the design-implementer subagent").
258
+ 4. Invoke `/opsx:*` or the orchestration skill. The conductor delegates using the mandatory phase/signal routing table rather than relying on description-only selection.
241
259
 
242
260
  **CLAUDE.md tiers used:**
243
261
  - Project level: `.claude/CLAUDE.md` (synced from `CLAUDE.md`)
@@ -262,10 +280,10 @@ You can add `context: fork` to explore/review skills for isolated subagent sessi
262
280
  2. Creates:
263
281
  - `.cursor/skills/` — all skills
264
282
  - `.cursor/rules/` — `.mdc` rule files
265
- - `.cursor/agents/` — custom subagents (`openspec-guide`, `code-writer`, `code-reviewer`, `test-writer`, `setup-doctor`, `design-implementer`)
283
+ - `.cursor/agents/` — all 12 custom/stage subagents
266
284
  - `.mcp.json` — from `mcp.json.example` (if not present)
267
285
  3. Rules are applied automatically per `alwaysApply: true`.
268
- 4. Subagents are invoked by name in chat (e.g. "use the code-reviewer subagent on this diff") or delegated to automatically by Cursor when their `description` matches the task. Add project-specific subagents by dropping `.md` files into `.agents/subagents/` and re-running sync.
286
+ 4. `/opsx:*` sessions use the mandatory conductor routing table to spawn subagents. Add project-specific subagents in `.agents/subagents/`, add an exclusive route, and re-run sync.
269
287
 
270
288
  **Memory + optional Figma MCP for Cursor** (`.mcp.json`):
271
289
 
@@ -273,9 +291,8 @@ You can add `context: fork` to explore/review skills for isolated subagent sessi
273
291
  {
274
292
  "mcpServers": {
275
293
  "memory": {
276
- "command": "npx",
277
- "args": ["-y", "@modelcontextprotocol/server-memory"],
278
- "env": { "MEMORY_FILE_PATH": ".cursor/memory.json" }
294
+ "command": "node",
295
+ "args": ["scripts/memory-mcp-launcher.cjs"]
279
296
  },
280
297
  "figma": {
281
298
  "command": "node",
@@ -295,6 +312,8 @@ Token lives in `.agents/figma.local.env` — see [Figma token](#figma-token-opti
295
312
  **Model:** fast/cheap.
296
313
  **Purpose:** Understand the problem. Surface options. Choose a direction.
297
314
 
315
+ The conductor spawns `codebase-explorer` for repository investigation and stays read-only.
316
+
298
317
  **Exit criteria (before starting Architect):**
299
318
  - Problem stated in 3–5 sentences
300
319
  - 2–3 solution options + recommendation
@@ -313,6 +332,8 @@ Token lives in `.agents/figma.local.env` — see [Figma token](#figma-token-opti
313
332
  **Model:** strong reasoning.
314
333
  **Purpose:** Create all change artifacts: proposal, design, tasks, delta specs.
315
334
 
335
+ The conductor spawns `spec-architect`; it does not write artifacts in the parent session.
336
+
316
337
  **Exit gate:**
317
338
  ```bash
318
339
  npx openspec validate <name> --strict --type change # must be ✓
@@ -330,6 +351,8 @@ npx openspec validate <name> --strict --type change # must be ✓
330
351
  **Model:** medium or strong.
331
352
  **Purpose:** Review artifacts. Output **Approve ✓** or **Request Changes ✗**.
332
353
 
354
+ The conductor spawns `spec-reviewer` (not `code-reviewer`) and verifies its `review.md`.
355
+
333
356
  Checks:
334
357
  - Acceptance criteria are testable
335
358
  - Tasks ≤ ~2 hours each
@@ -346,7 +369,7 @@ Checks:
346
369
 
347
370
  ### Role 4: Implementer — `/opsx:apply <name>`
348
371
 
349
- **Mode:** writes `src/`. Marks `tasks.md [x]`.
372
+ **Mode:** conductor; routed specialists write `src/` and tests. Only the conductor marks `tasks.md [x]` after a verified `Status: done` report.
350
373
  **Model:** strong. Use fast for simple mechanical tasks.
351
374
  **Purpose:** Implement tasks. One session = 1–3 tasks (not all 15 at once).
352
375
 
@@ -640,21 +663,18 @@ npx agent-orchestrator-kit figma-setup
640
663
 
641
664
  ## Memory MCP — Shared State Between Sessions
642
665
 
643
- Each role starts a fresh session. Memory MCP persists orchestration state across sessions so you don't re-explain context every time.
666
+ Each role starts a fresh session. OpenSpec artifacts remain the source of truth; Memory MCP and `openspec/changes/<name>/handoff.md` are the phase index used to resume without re-explanation.
644
667
 
645
668
  **Standard entities to save:**
646
669
 
647
670
  ```
648
- Change:add-bulk-export status: spec-approved, tasks: 0/7
671
+ Change:add-bulk-export status: spec-approved, tasks: 0/7, last_role: reviewer, review: APPROVE
649
672
  Decision:export-format chosen: xlsx, reason: matches existing reports
650
- Convention:api-errors use ApiError class, not raw Error
651
- Handoff:add-bulk-export next_role: implementer, session_count: 1
673
+ Handoff:add-bulk-export next_role: implementer, next_command: /opsx:apply add-bulk-export,
674
+ session_count: 2, summary: ..., blocked: none
652
675
  ```
653
676
 
654
- At the start of each implementer/reviewer session, read relevant memory:
655
- ```
656
- What do we know about Change:add-bulk-export?
657
- ```
677
+ Every `/opsx:*` session restores via `npx agent-orchestrator-kit handoff --restore`, then Memory `Change:<name>`, `Handoff:<name>`, `Decision:*`, falling back to `handoff.md` if Memory is unavailable. At exit it MUST spawn `session-handoff`, write `handoff.md`, run `npx agent-orchestrator-kit handoff <name>` (upserts `.cursor/memory.json` with an absolute path), and paste the CLI stdout prompt. The prompt is self-contained — Amp often skips Memory MCP, so the next thread must be able to work from the pasted text alone. Never configure Memory with a relative `MEMORY_FILE_PATH`; use `scripts/memory-mcp-launcher.cjs` (`npx agent-orchestrator-kit memory-setup`). The next phase always starts in a new chat.
658
678
 
659
679
  ## Amp Code — Deep Integration Notes
660
680
 
@@ -667,21 +687,22 @@ Amp is the **primary target** of this kit. It reads `.agents/skills/` and `AGENT
667
687
  | `AGENTS.md` subtree loading | Per-domain AGENTS.md in `openspec/` subtree |
668
688
  | `.agents/skills/` | All orchestration + domain skills |
669
689
  | `mcp.json` in skill dir | Lazy MCP loading (Memory only when needed) |
670
- | Subagents | Explore and Review skills use forked subagents |
690
+ | Subagents | Conductor routing + isolated `subagent-*` wrappers |
671
691
  | Amp modes (rush/smart/deep) | Per-role model hints in AGENTS.md |
672
692
 
673
- **Amp subagent in skill** (`.agents/skills/openspec-explore/SKILL.md`):
693
+ **Amp generated wrapper** (`.agents/skills/subagent-codebase-explorer/SKILL.md`):
674
694
 
675
695
  ```yaml
676
696
  ---
677
- name: openspec-explore
678
- description: Enter explore mode — read-only thinking partner
679
- disable-model-invocation: false
680
- allowed-tools: Read, Bash
697
+ name: subagent-codebase-explorer
698
+ description: Read-only repository research specialist...
681
699
  ---
700
+
701
+ CRITICAL (Amp / Cursor / Claude): Parent MUST spawn this skill as an isolated subagent with fresh context.
702
+ Do not execute it in the main thread. If spawn is unavailable, STOP and report blocked.
682
703
  ```
683
704
 
684
- Amp will run this skill as a subagent when invoked.
705
+ The conductor invokes the wrapper in isolation and consumes only its structured report.
685
706
 
686
707
  **Team workflow with Amp:**
687
708
 
@@ -750,11 +771,23 @@ CLAUDE.md # Committed — synced to .claude/CLAUDE.md
750
771
  openspec/ # Committed — spec-driven workflow
751
772
  config.yaml # Project context for AI
752
773
  specs/ # Source of truth after archive
753
- changes/ # Active work
774
+ changes/ # Active work; <name>/handoff.md indexes session state
754
775
  ```
755
776
 
756
777
  ## Changelog
757
778
 
779
+ ### 0.1.14
780
+ - **HARD STOP session handoff** — `session-handoff` subagent at start/exit; Amp isolated `subagent-session-handoff`
781
+ - **`handoff` CLI** — writes `handoff.md`, upserts `.cursor/memory.json` with an absolute path, prints an expanded self-contained next-thread prompt
782
+ - **`memory-setup` + `memory-mcp-launcher.cjs`** — never a relative `MEMORY_FILE_PATH` (Amp was reading the wrong graph)
783
+ - Next-thread prompt includes role, spawn instructions, Done/Decisions/Blocked, and exit HARD STOP
784
+
785
+ ### 0.1.13
786
+ - Pipeline **conductor**: `/opsx:*` parent spawns the routed specialist and does not do that work itself
787
+ - Five new stage subagents: `codebase-explorer`, `design-intake`, `spec-architect`, `spec-reviewer`, `spec-archiver`
788
+ - Session handoff: Memory → `handoff.md` → next-session prompt in `project.agent_language` (read Memory on start)
789
+ - Amp `subagent-*` wrappers must run as isolated subagents, not in the main thread
790
+
758
791
  ### 0.1.12
759
792
  - `figma-fetch --depth <n>` for large frames
760
793
  - Write large Figma JSON as raw API text (avoids `Invalid string length` on huge trees)