agent-orchestrator-kit 0.2.0 → 0.4.0

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 (41) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +208 -20
  3. package/bin/agent-orchestrator.js +1303 -90
  4. package/package.json +2 -2
  5. package/profiles/generic/orchestrator.yaml +18 -1
  6. package/profiles/mvp/openspec-config.yaml.example +2 -0
  7. package/profiles/mvp/orchestrator.yaml +18 -1
  8. package/profiles/node/orchestrator.yaml +21 -2
  9. package/profiles/vue3/openspec-config.yaml.example +2 -0
  10. package/profiles/vue3/orchestrator.yaml +20 -2
  11. package/templates/.agents/amp.settings.json.example +12 -0
  12. package/templates/.agents/commands/opsx-apply.md +18 -46
  13. package/templates/.agents/commands/opsx-archive.md +10 -163
  14. package/templates/.agents/commands/opsx-design.md +3 -10
  15. package/templates/.agents/commands/opsx-explore.md +3 -10
  16. package/templates/.agents/commands/opsx-propose.md +14 -10
  17. package/templates/.agents/commands/opsx-quick.md +3 -10
  18. package/templates/.agents/commands/opsx-review.md +27 -55
  19. package/templates/.agents/commands/opsx-sync.md +2 -0
  20. package/templates/.agents/github.local.env.example +10 -0
  21. package/templates/.agents/gitlab.local.env.example +12 -0
  22. package/templates/.agents/mcp.json.example +12 -0
  23. package/templates/.agents/rules/agent-orchestration.mdc +15 -16
  24. package/templates/.agents/rules/memory-mcp-autosetup.mdc +1 -1
  25. package/templates/.agents/rules/session-handoff.mdc +22 -17
  26. package/templates/.agents/skills/agent-orchestration/SKILL.md +32 -29
  27. package/templates/.agents/skills/openspec-apply-change/SKILL.md +15 -20
  28. package/templates/.agents/skills/openspec-archive-change/SKILL.md +12 -99
  29. package/templates/.agents/skills/openspec-propose/SKILL.md +11 -0
  30. package/templates/.agents/subagents/session-handoff.md +12 -10
  31. package/templates/.agents/subagents/spec-architect.md +1 -1
  32. package/templates/.agents/subagents/spec-archiver.md +1 -1
  33. package/templates/.agents/subagents/spec-reviewer.md +11 -7
  34. package/templates/.cursor/memory.json +11 -0
  35. package/templates/AGENTS.md +3 -3
  36. package/templates/CLAUDE.md +2 -2
  37. package/templates/orchestrator.yaml +18 -1
  38. package/templates/scripts/browser-mcp-launcher.cjs +21 -0
  39. package/templates/scripts/github-mcp-launcher.cjs +66 -0
  40. package/templates/scripts/gitlab-mcp-launcher.cjs +70 -0
  41. package/templates/scripts/pre-commit-gate-check.sh +4 -0
package/CHANGELOG.md CHANGED
@@ -4,6 +4,31 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.4.0] - 2026-08-28
8
+
9
+ ### Added
10
+ - **Phase 3 cloud agent handoff** — persist writes `## Runtime` (`runtime: local|cloud`, `agent_id`) via `--runtime` → `AOK_RUNTIME` → `CLOUD_ENV_MARKERS` → existing section → `local`; `handoff <name> --cloud-check` blocks on uncommitted/unpushed artifacts for cloud (local: warning, exit 0); persist never commits/pushes — cloud sessions print persist → commit → push → cloud-check on stderr
11
+ - **Phase 2 decisions canon** — git-tracked append-only `openspec/changes/<name>/decisions.md`; `npx agent-orchestrator-kit handoff <name>` appends dated bullets from `handoff.md ## Decisions` (no duplicates; same topic + new text keeps history); Memory `Decision:*` mirrors the file (last topic wins, file → Memory only); `handoff --restore` prints from the git file or `decisions: none`
12
+ - **Skill inventory** — `skills.kit` / `skills.stack` / `skills.external` in `orchestrator.yaml` (template + all profiles); kit skill list for `init`/`update` is enumerated from `templates/.agents/skills/` (no hardcoded `KIT_SKILL_DIRS`); `status` prints warn-only Skill health (`ok` / `missing` / `stale`) plus Amp wrapper freshness; missing stack skills hint `npx <external> install --agent all --yes` without running an install
13
+ - **`agentic-factory-roadmap`** — planning (docs-only) capability: sequences factory phases 1–4 and records platform-level non-goals; implementation stays in later changes
14
+ - **Phase 1 factory gates & MCP** — opt-in pre-commit `gate-check --staged` via `hooks-setup` / `init --hooks` (husky-first, otherwise `core.hooksPath=.githooks`; never writes `.git/hooks/`)
15
+ - **`mcp-setup`** — GitHub / GitLab / browser stdio launchers (Figma pattern); VCS host from `git remote origin` (not `--ci`); `--vcs` override; `--no-browser`
16
+ - **MCP health** in `status` (`ok` / `not configured` / `skipped`) without printing token values
17
+ - Committed examples list `memory`, `figma`, `github`, `gitlab`, `browser`; gitignored `.agents/github.local.env` and `.agents/gitlab.local.env`
18
+
19
+ ## [0.3.0] - 2026-08-18
20
+
21
+ ### Added
22
+ - **`npx agent-orchestrator-kit archive <name>`** — deterministic archive CLI: gates (APPROVE, all tasks `[x]`, free target), delta-spec merge into main specs with `--sync` (ADDED append / MODIFIED replace / REMOVED delete), explicit refusal without a sync decision (`--sync` or `--no-sync --force`), snapshot + full rollback when `openspec validate --all --strict` fails, final `handoff.md` (`next_command: none`) + memory upsert
23
+ - **Task contract lint** — `gate-check --tasks <name>` enforces `Files:` / `Do:` / `Done-when:` per task, rejects vague phrasing and nonexistent `Files:` paths without `new file:`; controlled by `pipeline.task_contract: warn|strict|off` (default `warn`, mvp `off`)
24
+ - **Tiered review** — `gate-check --review <name> [--json]` is deterministic Tier 1 (strict validation, task-contract lint, proposal `Non-goals`/`Acceptance criteria`, non-empty delta sections); `spec-reviewer` runs only after Tier 1 passes and writes `apply-notes.md` (≤ 20 lines) on APPROVE
25
+
26
+ ### Changed
27
+ - **Lean delegation model** — apply is parent-driven (implementer reads `tasks.md` + `apply-notes.md`, spawns subagents only for ≥ 2 independent tasks or on request, STOP escape valve instead of improvisation); archive is CLI-only with `spec-archiver` demoted to fallback; propose/review specialists remain mandatory
28
+ - **Parent-driven session handoff** — canonical Session Start/Exit protocol consolidated in `.agents/rules/session-handoff.mdc`; `/opsx:*` commands reference it instead of duplicating it; `session-handoff` subagent and Memory MCP mirror are fallbacks (`handoff.spawn_handoff_subagent: false` in all profiles); `opsx-archive.md` slimmed to a ≤ 1.5 KB CLI wrapper
29
+
30
+ ## [0.2.0] - 2026-08-18
31
+
7
32
  ### Changed
8
33
  - **Context budget** — thinned always-apply rules and `AGENTS.md` / `CLAUDE.md`; details stay in on-demand skills. `figma-token-setup.mdc` is no longer `alwaysApply`. Restore spawn of `session-handoff` is skipped when `handoff --restore` already printed a briefing.
9
34
 
@@ -168,8 +193,18 @@ All notable changes to this project will be documented in this file.
168
193
  ### Added
169
194
  - Initial release: 5-role orchestration pipeline, `/opsx:*` commands, IDE sync
170
195
 
196
+ [0.4.0]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.3.0...v0.4.0
197
+ [0.3.0]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.2.0...v0.3.0
198
+ [0.2.0]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.1.14...v0.2.0
199
+ [0.1.14]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.1.13...v0.1.14
200
+ [0.1.13]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.1.12...v0.1.13
201
+ [0.1.12]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.1.11...v0.1.12
202
+ [0.1.11]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.1.10...v0.1.11
203
+ [0.1.10]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.1.9...v0.1.10
204
+ [0.1.9]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.1.8...v0.1.9
171
205
  [0.1.8]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.1.7...v0.1.8
172
206
  [0.1.7]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.1.6...v0.1.7
207
+ [0.1.6]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.1.5...v0.1.6
173
208
  [0.1.5]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.1.4...v0.1.5
174
209
  [0.1.4]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.1.3...v0.1.4
175
210
  [0.1.3]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.1.2...v0.1.3
package/README.md CHANGED
@@ -34,17 +34,18 @@ Each role runs in a **separate agent session**. The parent `/opsx:*` session is
34
34
  | `spec-archiver` | Delta merge and completed-change archive |
35
35
  | `session-handoff` | Restore/persist Memory + `handoff.md` + expanded next-thread prompt |
36
36
 
37
- The conductor uses one exclusive route per signal:
37
+ Delegation is **differentiated per phase** (lean model): thinking-heavy phases spawn a mandatory specialist, apply is parent-driven, archive is a deterministic CLI:
38
38
 
39
- | Phase / signal | Subagent |
40
- |----------------|----------|
39
+ | Phase / signal | Delegation |
40
+ |----------------|------------|
41
41
  | Status / gates / next command | `openspec-guide` |
42
- | Session start restore / session exit persist | `session-handoff` |
42
+ | Session start restore / session exit persist | parent-driven CLI (`handoff --restore` / `handoff <name>`); `session-handoff` is a fallback only |
43
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` |
44
+ | Explore repository research | `codebase-explorer` (mandatory) |
45
+ | Design / propose / spec review | `design-intake` / `spec-architect` / `spec-reviewer` (mandatory) |
46
+ | Apply | parent implements from `tasks.md` + `apply-notes.md`; `code-writer` / `test-writer` optional for ≥ 2 independent tasks or explicit request; `design-implementer` for design-brief/Figma tasks |
47
+ | Pre-PR code review | `code-reviewer` |
48
+ | Archive | `npx agent-orchestrator-kit archive <name>` (CLI — no subagent; `spec-archiver` is a fallback when the CLI is unavailable) |
48
49
 
49
50
  - **Cursor** → `.cursor/agents/` (native subagents)
50
51
  - **Claude Code** → `.claude/agents/` (native subagents)
@@ -73,12 +74,14 @@ npx agent-orchestrator-kit@latest init --profile generic --ci gitlab --spec-veri
73
74
 
74
75
  See [Installation](#installation) for profile/CI options.
75
76
 
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+):**
77
+ **🔄 Already have the kit installed? Upgrade to latest (factory phases 1–3 in v0.4.0+, lean pipeline / archive CLI in v0.3.0+, handoff CLI in v0.1.14+, Figma PAT in v0.1.11+):**
77
78
 
78
79
  ```bash
79
80
  npx agent-orchestrator-kit@latest update
80
81
  npx agent-orchestrator-kit@latest sync # or: ./scripts/sync-local-agent-skills.sh
82
+ npx agent-orchestrator-kit@latest mcp-setup # optional — GitHub/GitLab from origin + browser
81
83
  npx agent-orchestrator-kit@latest figma-setup # optional — local Figma token
84
+ npx agent-orchestrator-kit@latest hooks-setup # optional — pre-commit review gate
82
85
  npx agent-orchestrator-kit@latest status
83
86
  ```
84
87
 
@@ -188,7 +191,7 @@ your-project/
188
191
  | OpenSpec skills | All 7 skills for `/opsx:*` workflow |
189
192
  | IDE sync | Cursor + Claude Code sync script (`--delete` semantics — removes stale skills/subagents) |
190
193
  | 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`) |
194
+ | CLI gates | `npx agent-orchestrator-kit status` / `gate-check` / `archive` / `handoff` / `memory-setup` — deterministic review-gate, archive, and session-handoff (always via `npx`; see `cli-via-npm.mdc`) |
192
195
  | CI | `agent-verify.yml` — GitHub (default) or GitLab fragment + `prebuild` hook, both run `gate-check` |
193
196
  | AI Spec Verifier | `spec-verify.yml` + verifier scripts — GitLab or GitHub, opt-in (`--spec-verify`) |
194
197
  | MCP templates | Memory MCP for Cursor and Amp |
@@ -351,13 +354,13 @@ npx openspec validate <name> --strict --type change # must be ✓
351
354
  **Model:** medium or strong.
352
355
  **Purpose:** Review artifacts. Output **Approve ✓** or **Request Changes ✗**.
353
356
 
354
- The conductor spawns `spec-reviewer` (not `code-reviewer`) and verifies its `review.md`.
357
+ Review is **two-tiered**. Tier 1 is deterministic: `npx agent-orchestrator-kit gate-check --review <name>` runs strict OpenSpec validation, the task-contract lint, and structural checks (Non-goals / Acceptance criteria in `proposal.md`, non-empty delta-spec sections). If Tier 1 fails, the verdict is REQUEST CHANGES without spawning anyone. Only on a Tier 1 pass does the conductor spawn `spec-reviewer` (not `code-reviewer`) for Tier 2 judgment and verify its `review.md`. On APPROVE the reviewer also writes `apply-notes.md` (≤ 20 lines of constraints and pitfalls for the implementer).
355
358
 
356
- Checks:
357
- - Acceptance criteria are testable
358
- - Tasks ≤ ~2 hours each
359
+ Tier 2 checks (judgment only — no duplication of Tier 1):
360
+ - Consistency proposal design ↔ tasks
359
361
  - No scope creep vs Non-goals
360
362
  - No conflicts with existing domain specs
363
+ - Tasks self-sufficient for a blind implementer (Files / Do / Done-when)
361
364
 
362
365
  ```
363
366
  /opsx:review add-bulk-camera-export
@@ -467,13 +470,79 @@ Orchestration hard rules (review approval, one active change) used to rely entir
467
470
  npx agent-orchestrator-kit status
468
471
  ```
469
472
 
470
- Prints every active OpenSpec change with task progress (`N/M tasks`), review verdict (`APPROVE` / `REQUEST CHANGES` / `none`), design brief (`brief: yes/no`), and a `ready to archive` flag once all tasks are `[x]`no more running `openspec status` per change by hand.
473
+ Prints every active OpenSpec change with task progress (`N/M tasks`), review verdict (`APPROVE` / `REQUEST CHANGES` / `none`), design brief (`brief: yes/no`), a `ready to archive` flag once all tasks are `[x]`, and an **MCP health** section (launcher / env / live config never prints token values). VCS tools that do not match `git remote origin` show as `skipped (no origin match)`.
471
474
 
472
475
  ```bash
473
- npx agent-orchestrator-kit gate-check [change-name] [--src-glob src/] [--base HEAD~1]
476
+ npx agent-orchestrator-kit gate-check [change-name] [--src-glob src/] [--base HEAD~1] [--staged]
474
477
  ```
475
478
 
476
- Fails (non-zero exit) when `pipeline.require_spec_review: true`, the diff against `--base` touches `--src-glob`, and the active change has no `review.md` with `Verdict: APPROVE`. When `pipeline.require_design_brief: true` and `src/` changed, it also requires `design-brief.md` (or a `Design: none` line in `proposal.md` for non-UI changes). It degrades gracefully to exit 0 (with a message, not silently) when: `.agents/orchestrator.yaml` is missing, neither review nor design brief is required, the diff can't be computed (e.g. shallow clone), or nothing under `--src-glob` changed. It also warns (never fails) when active changes exceed `pipeline.max_active_changes`. Both `agent-verify.yml` fragments (GitHub and GitLab) call `gate-check` automatically.
479
+ Fails (non-zero exit) when `pipeline.require_spec_review: true`, the diff against `--base` (or **staged** files with `--staged`) touches `--src-glob`, and the active change has no `review.md` with `Verdict: APPROVE`. When `pipeline.require_design_brief: true` and `src/` changed, it also requires `design-brief.md` (or a `Design: none` line in `proposal.md` for non-UI changes). It degrades gracefully to exit 0 (with a message, not silently) when: `.agents/orchestrator.yaml` is missing, neither review nor design brief is required, the diff can't be computed (e.g. shallow clone), or nothing under `--src-glob` changed. It also warns (never fails) when active changes exceed `pipeline.max_active_changes`. Both `agent-verify.yml` fragments (GitHub and GitLab) call `gate-check` automatically. Pre-commit uses `--staged` so it checks the index, not `HEAD~1`.
480
+
481
+ ```bash
482
+ npx agent-orchestrator-kit gate-check --tasks <change-name>
483
+ ```
484
+
485
+ Lints the task contract in `tasks.md`: every task needs `Files:` / `Do:` / `Done-when:`, no vague phrasing (`as needed`, `if necessary`, …), and every `Files:` path must exist unless prefixed `new file:`. Behavior follows `pipeline.task_contract` in `orchestrator.yaml`: `warn` (default) exits 0 with warnings, `strict` exits 1 on violations, `off` skips the lint.
486
+
487
+ ```bash
488
+ npx agent-orchestrator-kit gate-check --review <change-name> [--json]
489
+ ```
490
+
491
+ Deterministic Tier 1 of the review phase: strict OpenSpec validation, the task-contract lint, `Non-goals` / `Acceptance criteria` sections in `proposal.md`, and non-empty ADDED/MODIFIED/REMOVED sections in delta specs. Human-readable stdout, or `--json` for a `{pass, errors[]}` report.
492
+
493
+ ### Pre-commit review gate (optional)
494
+
495
+ `gate-check` already exists; it is **not** wired to `git commit` unless you opt in. The kit never writes `.git/hooks/` directly.
496
+
497
+ ```bash
498
+ npx agent-orchestrator-kit hooks-setup
499
+ # or: npx agent-orchestrator-kit init --hooks
500
+ ```
501
+
502
+ - If `.husky/` exists, a marked line `sh scripts/pre-commit-gate-check.sh` is appended to `.husky/pre-commit` (idempotent; existing content is kept). `core.hooksPath` is not changed.
503
+ - Otherwise the kit writes committed `.githooks/pre-commit` and runs `git config core.hooksPath .githooks`. If `core.hooksPath` is already set to something else, the command refuses and prints a manual line to add.
504
+ - Lefthook: add `sh scripts/pre-commit-gate-check.sh` to your pre-commit job yourself (no auto-write).
505
+ - `init` without `--hooks` still installs `scripts/pre-commit-gate-check.sh` as a managed file, unconnected.
506
+ - Disable: remove the marked line from `.husky/pre-commit`, or `git config --unset core.hooksPath`.
507
+ - MVP (`require_spec_review: false`): the hook is a no-op (exit 0).
508
+ - Keep `agent-orchestrator-kit` in the project's **devDependencies** so `npx agent-orchestrator-kit` on every commit does not cold-fetch from the registry.
509
+
510
+ Run `hooks-setup` on each machine (`git config` is local), same as `figma-setup`.
511
+
512
+ ### Optional MCP: GitHub, GitLab, browser
513
+
514
+ Same pattern as Figma: stdio launcher + gitignored env + committed `.example`. Tokens never go in chat or committed MCP JSON.
515
+
516
+ ```bash
517
+ npx agent-orchestrator-kit mcp-setup
518
+ ```
519
+
520
+ Detection uses `git remote get-url origin` (https and ssh). `--ci` is ignored.
521
+
522
+ | Origin hostname | Installed VCS MCP |
523
+ |-----------------|-------------------|
524
+ | `github.com` | GitHub only |
525
+ | `gitlab.com` or hostname contains `gitlab` (self-hosted) | GitLab only; `GITLAB_API_URL=https://<hostname>/api/v4` |
526
+ | missing / unrecognized | no VCS MCP (`status` shows skipped) |
527
+
528
+ Browser MCP (`@playwright/mcp`) is always added unless you pass `--no-browser`. Override detection with `--vcs github` or `--vcs gitlab`.
529
+
530
+ ```bash
531
+ npx agent-orchestrator-kit mcp-setup --vcs gitlab --no-browser
532
+ ```
533
+
534
+ Then put tokens **only** in the gitignored files (never in chat):
535
+
536
+ | Path | Git |
537
+ |------|-----|
538
+ | `.agents/github.local.env` | ignored |
539
+ | `.agents/gitlab.local.env` | ignored |
540
+ | `.agents/*.local.env.example` | committed |
541
+ | `scripts/*-mcp-launcher.cjs` | committed |
542
+
543
+ Cursor, Claude Code, and Amp all spawn the same launchers. Committed examples list all five servers (`memory`, `figma`, `github`, `gitlab`, `browser`); live `.mcp.json` / `.amp/settings.json` receive only the detected VCS plus browser.
544
+
545
+ `npx agent-orchestrator-kit status` prints MCP health (`ok` / `not configured` / `skipped`) without token values.
477
546
 
478
547
  ---
479
548
 
@@ -525,7 +594,13 @@ After PR merged + CI green:
525
594
  /opsx:archive add-bulk-camera-export
526
595
  ```
527
596
 
528
- Merges delta specs into `openspec/specs/` and moves change to `archive/`.
597
+ Archive is a **deterministic CLI**, not an agent workflow:
598
+
599
+ ```bash
600
+ npx agent-orchestrator-kit archive <name> [--sync | --no-sync --force]
601
+ ```
602
+
603
+ It checks the gates (APPROVE in `review.md` when required, all tasks `[x]`, target folder free), merges delta specs into `openspec/specs/` (`--sync`: ADDED append, MODIFIED replace, REMOVED delete), moves the change to `openspec/changes/archive/YYYY-MM-DD-<name>`, and runs `npx openspec validate --all --strict` with a full rollback on failure (main specs restored, new spec files deleted, move reverted). With delta specs present you must decide: `--sync` merges, `--no-sync --force` archives without merging, and no flag refuses with exit 1. It finishes by writing the final `handoff.md` (`next_command: none`) and updating memory. The `/opsx:archive` command is a thin wrapper that calls this CLI; the `spec-archiver` subagent remains only as a fallback when the CLI is unavailable.
529
604
 
530
605
  ## Configuration
531
606
 
@@ -674,7 +749,75 @@ Handoff:add-bulk-export next_role: implementer, next_command: /opsx:apply add
674
749
  session_count: 2, summary: ..., blocked: none
675
750
  ```
676
751
 
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.
752
+ Session boundaries are **parent-driven** (no routine subagent): every `/opsx:*` session restores via `npx agent-orchestrator-kit handoff --restore` (the CLI briefing already reads memory.json and `handoff.md`), falling back to reading `handoff.md` directly if the CLI fails. At exit the parent itself writes `handoff.md`, runs `npx agent-orchestrator-kit handoff <name>` (upserts `.cursor/memory.json` with an absolute path), and pastes the CLI stdout prompt. The `session-handoff` subagent is spawned only when the CLI path fails; Memory MCP is an optional mirror. 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. The canonical Session Start / Exit protocol lives in one place — `.agents/rules/session-handoff.mdc` — and the `/opsx:*` commands reference it instead of duplicating it.
753
+
754
+ ### Change decisions (`decisions.md`)
755
+
756
+ Session decisions accumulate in git-tracked, append-only `openspec/changes/<name>/decisions.md`. That file is the canon visible in a PR/MR; Memory `Decision:*` is a **file → Memory** mirror only.
757
+
758
+ ```bash
759
+ npx agent-orchestrator-kit handoff add-bulk-export
760
+ # appends dated bullets from handoff.md ## Decisions (skips duplicates; same topic + new text → new row)
761
+ npx agent-orchestrator-kit handoff add-bulk-export --restore
762
+ # prints decisions from the git file (or `decisions: none` if the file does not exist)
763
+ ```
764
+
765
+ `Decisions: none` does not create the file. Re-running persist with the same handoff does not duplicate rows. A later revision of the same topic is a new line; the old line stays. `update` does not migrate historical Memory entities into the file.
766
+
767
+ ### Cloud agent handoff (Phase 3)
768
+
769
+ Every persist writes a `## Runtime` section to `openspec/changes/<name>/handoff.md`:
770
+
771
+ ```
772
+ ## Runtime
773
+ - runtime: local|cloud
774
+ - agent_id: <id|none>
775
+ ```
776
+
777
+ Detection is a fixed chain (no TTY / `CURSOR_AGENT` magic): `--runtime` → env `AOK_RUNTIME` → `CLOUD_ENV_MARKERS` (starts with `CURSOR_BACKGROUND_AGENT`) → existing `## Runtime` in the file → `local`. `agent_id` uses `--agent-id` → `AOK_AGENT_ID` → existing value → `none`. Invalid `--runtime` (not `local` or `cloud`) exits non-zero. Legacy files without Runtime stay valid; the next persist appends the section.
778
+
779
+ Configure a cloud agent once:
780
+
781
+ ```
782
+ AOK_RUNTIME=cloud
783
+ AOK_AGENT_ID=<vm-or-run-id>
784
+ ```
785
+
786
+ `--cloud-check` is a **separate** branch of `handoff`, never part of persist (persist has just rewritten `handoff.md`, so the tree is always dirty at that point). It verifies (1) `git status --porcelain -- openspec/changes/<name>/` is empty and (2) the current branch has an upstream with no unpushed commits. Verdict: `cloud` + any failure = non-zero; `local` + the same failure = warning + exit 0; clean = exit 0. The CLI never runs `git commit` or `git push`.
787
+
788
+ Cloud Session Exit order:
789
+
790
+ ```bash
791
+ npx agent-orchestrator-kit handoff <name> --runtime cloud
792
+ git add openspec/changes/<name>/
793
+ git commit
794
+ git push
795
+ npx agent-orchestrator-kit handoff <name> --cloud-check # require exit 0
796
+ ```
797
+
798
+ Persist with `runtime: cloud` prints those four steps on stderr; stdout stays the pure `/opsx:` next-thread prompt. Local persist is unchanged.
799
+
800
+ ### Skill inventory
801
+
802
+ `.agents/orchestrator.yaml` carries a machine-readable `skills:` section (`kit` / `stack` / `external`) instead of hardcoded skill names in the CLI:
803
+
804
+ ```yaml
805
+ skills:
806
+ kit:
807
+ - agent-orchestration
808
+ - openspec-howto
809
+ # ... remaining kit skills
810
+ stack: [] # vue3: vue-core, vue-pinia, vue-axios, vue-router
811
+ external: "" # vue3/node: frontend-agent-skills
812
+ ```
813
+
814
+ `npx agent-orchestrator-kit status` prints **Skill health** after MCP health (`ok` / `missing` / `stale`) for kit + stack skills and Amp `subagent-*` wrappers. The section is warn-only: missing or stale skills never change the exit code. Repair with the existing commands — `sync` (stale IDE copies), `update` (missing kit files), or a manual stack install:
815
+
816
+ ```bash
817
+ npx frontend-agent-skills install --agent all --yes
818
+ ```
819
+
820
+ The CLI never auto-installs external skill packages. `.agents/orchestrator.yaml` is outside kit-managed paths, so `update` does **not** refresh `skills.kit` — after a kit skill is added or removed, edit that list by hand (or re-init with `--force`).
678
821
 
679
822
  ## Amp Code — Deep Integration Notes
680
823
 
@@ -720,6 +863,7 @@ npx agent-orchestrator-kit init [options]
720
863
  --name <name> Project name (default: directory name)
721
864
  --ci <provider> CI provider: gitlab | github | none (default: github)
722
865
  --spec-verify Install AI Spec Verifier blocking gate (GitLab or GitHub)
866
+ --hooks Opt-in: install pre-commit gate-check hook (husky-first)
723
867
  --force Overwrite existing files
724
868
 
725
869
  npx agent-orchestrator-kit update
@@ -731,14 +875,35 @@ npx agent-orchestrator-kit sync [options]
731
875
  present in .agents/ (does not touch memory.json, .mcp.json, CLAUDE.md, etc.)
732
876
 
733
877
  npx agent-orchestrator-kit status
734
- Show progress, review verdict, and archive-readiness for active changes
878
+ Show progress, review verdict, archive-readiness, MCP health, and Skill health
879
+ (warn-only; missing/stale skills do not fail the command)
735
880
 
736
881
  npx agent-orchestrator-kit gate-check [change-name] [options]
737
882
  --src-glob <glob> Source path filter used to detect code changes (default: src/)
738
883
  --base <ref> Git ref to diff against (default: HEAD~1)
884
+ --staged Check staged files (git diff --cached) instead of --base
885
+ --tasks <name> Lint task contracts (Files / Do / Done-when)
886
+ --review <name> Deterministic Tier 1 review (optional --json)
739
887
  Exit non-zero when require_spec_review is true, src/ changed, and the
740
888
  active change has no review.md with Verdict: APPROVE. Graceful no-op
741
889
  otherwise (missing config, review not required, no relevant diff).
890
+
891
+ npx agent-orchestrator-kit hooks-setup
892
+ Opt-in pre-commit gate (husky-first, else core.hooksPath=.githooks)
893
+
894
+ npx agent-orchestrator-kit mcp-setup [--vcs github|gitlab] [--no-browser]
895
+ Install GitHub/GitLab (from origin) and browser MCP launchers
896
+
897
+ npx agent-orchestrator-kit archive <name> [--sync | --no-sync --force]
898
+ Gate-check a completed change, optionally merge delta specs, move to
899
+ openspec/changes/archive/YYYY-MM-DD-<name>, validate, write final handoff
900
+
901
+ npx agent-orchestrator-kit handoff [change-name] [options]
902
+ --restore Print the restore briefing instead of persisting
903
+ --runtime <value> local | cloud (invalid values exit non-zero)
904
+ --agent-id <id> Cloud agent identifier (default: none)
905
+ --cloud-check Verify change artifacts are committed and pushed
906
+ (cloud: non-zero on failure; local: warning, exit 0)
742
907
  ```
743
908
 
744
909
  ## Directory Reference
@@ -774,8 +939,31 @@ openspec/ # Committed — spec-driven workflow
774
939
  changes/ # Active work; <name>/handoff.md indexes session state
775
940
  ```
776
941
 
942
+ ## Roadmap
943
+
944
+ The kit moves toward an Agentic Factory in four phases. **One phase = one OpenSpec change**; the next phase does not start until the previous change is archived.
945
+ 1. `add-factory-gates-and-mcp` — local review gate on commit and Figma-style MCP launchers (GitHub / GitLab / browser). Implemented: `hooks-setup`, `mcp-setup`, `gate-check --staged`, MCP health in `status`.
946
+ 2. `add-factory-memory-and-skills` — git-canonical decisions with Memory MCP as a mirror, plus a machine skill inventory. Implemented: append-only `decisions.md`, Skill health in `status`.
947
+ 3. `add-cloud-agent-handoff` — session artifacts exist only on git-tracked paths. Implemented: `## Runtime` in `handoff.md`, `--runtime` / `--agent-id` / `--cloud-check`, cloud Session Exit.
948
+ 4. Phase 4 (`add-factory-control-plane`) is an opt-in platform decision, not the next sprint.
949
+ Phase bounds and non-goals: [`openspec/specs/agentic-factory-roadmap/spec.md`](openspec/specs/agentic-factory-roadmap/spec.md).
950
+
777
951
  ## Changelog
778
952
 
953
+ ### 0.4.0
954
+ - Factory phases 1–3: `hooks-setup` / `gate-check --staged`, `mcp-setup` (GitHub / GitLab / browser), MCP and Skill health in `status`
955
+ - Git-canonical append-only `decisions.md`; Memory `Decision:*` is a file→Memory mirror
956
+ - Cloud agent handoff: `## Runtime` in `handoff.md`, `--runtime` / `--agent-id` / `--cloud-check`
957
+
958
+ ### 0.3.0
959
+ - **`archive` CLI** — deterministic archive with gates, `--sync` delta merge, and rollback on validate failure
960
+ - **Task contract** — `gate-check --tasks` enforces `Files:` / `Do:` / `Done-when:` (`pipeline.task_contract: warn|strict|off`)
961
+ - **Tiered review** — `gate-check --review` is machine Tier 1; `spec-reviewer` writes `apply-notes.md` on APPROVE
962
+ - Lean apply (parent-driven) and parent-driven session handoff; `opsx-archive.md` is a thin CLI wrapper
963
+
964
+ ### 0.2.0
965
+ - Thinned always-apply rules and `AGENTS.md` / `CLAUDE.md` (context budget); details stay in on-demand skills
966
+
779
967
  ### 0.1.14
780
968
  - **HARD STOP session handoff** — `session-handoff` subagent at start/exit; Amp isolated `subagent-session-handoff`
781
969
  - **`handoff` CLI** — writes `handoff.md`, upserts `.cursor/memory.json` with an absolute path, prints an expanded self-contained next-thread prompt