agent-orchestrator-kit 0.3.0 → 0.5.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,24 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.5.0] - 2026-08-29
8
+
9
+ ### Added
10
+ - **Change metrics** — git-tracked `openspec/changes/<name>/metrics.json`: `handoff --restore` records the session start (`pending` marker), `handoff <name>` closes the session (duration, closed role → phase `explore|design|spec|review|apply|archive`, runtime, tasks snapshot, optional `--model` / `--input-tokens` / `--output-tokens` / `--total-tokens` / `--cost-usd`, `--started-at` when restore was skipped, `--no-metrics` to opt out), `archive <name>` sets `archivedAt`; per-phase and total aggregates (durations, tokens, cost, agents, models, `leadTimeMs`) are recomputed on every write and unreported values stay null-honest
11
+ - **`npx agent-orchestrator-kit metrics [change-name] [--json]`** — human summary (phases table, spend, recent sessions) or raw JSON; resolves archived changes under `openspec/changes/archive/*-<name>` too
12
+
13
+ ## [0.4.0] - 2026-08-28
14
+
15
+ ### Added
16
+ - **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
17
+ - **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`
18
+ - **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
19
+ - **`agentic-factory-roadmap`** — planning (docs-only) capability: sequences factory phases 1–4 and records platform-level non-goals; implementation stays in later changes
20
+ - **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/`)
21
+ - **`mcp-setup`** — GitHub / GitLab / browser stdio launchers (Figma pattern); VCS host from `git remote origin` (not `--ci`); `--vcs` override; `--no-browser`
22
+ - **MCP health** in `status` (`ok` / `not configured` / `skipped`) without printing token values
23
+ - Committed examples list `memory`, `figma`, `github`, `gitlab`, `browser`; gitignored `.agents/github.local.env` and `.agents/gitlab.local.env`
24
+
7
25
  ## [0.3.0] - 2026-08-18
8
26
 
9
27
  ### Added
@@ -181,6 +199,8 @@ All notable changes to this project will be documented in this file.
181
199
  ### Added
182
200
  - Initial release: 5-role orchestration pipeline, `/opsx:*` commands, IDE sync
183
201
 
202
+ [0.5.0]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.4.0...v0.5.0
203
+ [0.4.0]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.3.0...v0.4.0
184
204
  [0.3.0]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.2.0...v0.3.0
185
205
  [0.2.0]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.1.14...v0.2.0
186
206
  [0.1.14]: https://github.com/makshc2/agent-orchestrator-kit/compare/v0.1.13...v0.1.14
package/README.md CHANGED
@@ -74,12 +74,14 @@ npx agent-orchestrator-kit@latest init --profile generic --ci gitlab --spec-veri
74
74
 
75
75
  See [Installation](#installation) for profile/CI options.
76
76
 
77
- **🔄 Already have the kit installed? Upgrade to latest (lean pipeline v2 / archive CLI in v0.3.0+, handoff CLI in v0.1.14+, Figma PAT in v0.1.11+):**
77
+ **🔄 Already have the kit installed? Upgrade to latest (change metrics in v0.5.0+, 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+):**
78
78
 
79
79
  ```bash
80
80
  npx agent-orchestrator-kit@latest update
81
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
82
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
83
85
  npx agent-orchestrator-kit@latest status
84
86
  ```
85
87
 
@@ -189,7 +191,7 @@ your-project/
189
191
  | OpenSpec skills | All 7 skills for `/opsx:*` workflow |
190
192
  | IDE sync | Cursor + Claude Code sync script (`--delete` semantics — removes stale skills/subagents) |
191
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 |
192
- | 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`) |
194
+ | CLI gates | `npx agent-orchestrator-kit status` / `gate-check` / `archive` / `handoff` / `metrics` / `memory-setup` — deterministic review-gate, archive, session-handoff, and change metrics (always via `npx`; see `cli-via-npm.mdc`) |
193
195
  | CI | `agent-verify.yml` — GitHub (default) or GitLab fragment + `prebuild` hook, both run `gate-check` |
194
196
  | AI Spec Verifier | `spec-verify.yml` + verifier scripts — GitLab or GitHub, opt-in (`--spec-verify`) |
195
197
  | MCP templates | Memory MCP for Cursor and Amp |
@@ -468,13 +470,13 @@ Orchestration hard rules (review approval, one active change) used to rely entir
468
470
  npx agent-orchestrator-kit status
469
471
  ```
470
472
 
471
- 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)`.
472
474
 
473
475
  ```bash
474
- 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]
475
477
  ```
476
478
 
477
- 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`.
478
480
 
479
481
  ```bash
480
482
  npx agent-orchestrator-kit gate-check --tasks <change-name>
@@ -488,6 +490,60 @@ npx agent-orchestrator-kit gate-check --review <change-name> [--json]
488
490
 
489
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.
490
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.
546
+
491
547
  ---
492
548
 
493
549
  ### Design intake: `/opsx:design`
@@ -695,6 +751,92 @@ Handoff:add-bulk-export next_role: implementer, next_command: /opsx:apply add
695
751
 
696
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.
697
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
+ ### Change metrics
801
+
802
+ Every change accumulates git-tracked `openspec/changes/<name>/metrics.json` — the data source for planning the next feature: how long each phase took, how many sessions it needed, what it cost.
803
+
804
+ - **Session start** — `handoff --restore` writes a `pending` marker (`startedAt`, expected role).
805
+ - **Session end** — `handoff <name>` closes the pending session: duration, closed role, mapped phase (`explore` / `design` / `spec` / `review` / `apply` / `archive`), runtime (local/cloud), tasks snapshot (`n/m`), and — when the agent passes them — `--model`, `--input-tokens`, `--output-tokens`, `--total-tokens`, `--cost-usd`. No restore marker? Pass `--started-at <iso>` or the duration stays honestly `null`.
806
+ - **Archive** — `archive <name>` sets `archivedAt` and clears any pending marker; the file moves to the archive folder with the change.
807
+
808
+ Aggregates are recomputed on every write: per-phase totals (`durationMs`, tokens, `costUsd`, `sessions`, agents, models) plus overall `totals` (`sessions`, `cloudSessions`, `durationMs` = sum of session work time, `leadTimeMs` = wall clock from first session start to last session end) and `spend` (token/cost sums). Numbers are null-honest: a metric nobody reported stays `null`, never a fake `0`.
809
+
810
+ ```bash
811
+ npx agent-orchestrator-kit handoff add-thing --input-tokens 12000 --output-tokens 3000 --cost-usd 0.42 --model claude-sonnet
812
+ npx agent-orchestrator-kit metrics add-thing # human summary: phases, tokens, cost, agents
813
+ npx agent-orchestrator-kit metrics add-thing --json # raw metrics.json (works for archived changes too)
814
+ ```
815
+
816
+ Recording is on by default and never blocks persist; opt out per session with `--no-metrics`.
817
+
818
+ ### Skill inventory
819
+
820
+ `.agents/orchestrator.yaml` carries a machine-readable `skills:` section (`kit` / `stack` / `external`) instead of hardcoded skill names in the CLI:
821
+
822
+ ```yaml
823
+ skills:
824
+ kit:
825
+ - agent-orchestration
826
+ - openspec-howto
827
+ # ... remaining kit skills
828
+ stack: [] # vue3: vue-core, vue-pinia, vue-axios, vue-router
829
+ external: "" # vue3/node: frontend-agent-skills
830
+ ```
831
+
832
+ `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:
833
+
834
+ ```bash
835
+ npx frontend-agent-skills install --agent all --yes
836
+ ```
837
+
838
+ 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`).
839
+
698
840
  ## Amp Code — Deep Integration Notes
699
841
 
700
842
  Amp is the **primary target** of this kit. It reads `.agents/skills/` and `AGENTS.md` without any sync step — your team commits `.agents/` and everyone gets the same orchestration behavior automatically.
@@ -739,6 +881,7 @@ npx agent-orchestrator-kit init [options]
739
881
  --name <name> Project name (default: directory name)
740
882
  --ci <provider> CI provider: gitlab | github | none (default: github)
741
883
  --spec-verify Install AI Spec Verifier blocking gate (GitLab or GitHub)
884
+ --hooks Opt-in: install pre-commit gate-check hook (husky-first)
742
885
  --force Overwrite existing files
743
886
 
744
887
  npx agent-orchestrator-kit update
@@ -750,20 +893,46 @@ npx agent-orchestrator-kit sync [options]
750
893
  present in .agents/ (does not touch memory.json, .mcp.json, CLAUDE.md, etc.)
751
894
 
752
895
  npx agent-orchestrator-kit status
753
- Show progress, review verdict, and archive-readiness for active changes
896
+ Show progress, review verdict, archive-readiness, MCP health, and Skill health
897
+ (warn-only; missing/stale skills do not fail the command)
754
898
 
755
899
  npx agent-orchestrator-kit gate-check [change-name] [options]
756
900
  --src-glob <glob> Source path filter used to detect code changes (default: src/)
757
901
  --base <ref> Git ref to diff against (default: HEAD~1)
902
+ --staged Check staged files (git diff --cached) instead of --base
758
903
  --tasks <name> Lint task contracts (Files / Do / Done-when)
759
904
  --review <name> Deterministic Tier 1 review (optional --json)
760
905
  Exit non-zero when require_spec_review is true, src/ changed, and the
761
906
  active change has no review.md with Verdict: APPROVE. Graceful no-op
762
907
  otherwise (missing config, review not required, no relevant diff).
763
908
 
909
+ npx agent-orchestrator-kit hooks-setup
910
+ Opt-in pre-commit gate (husky-first, else core.hooksPath=.githooks)
911
+
912
+ npx agent-orchestrator-kit mcp-setup [--vcs github|gitlab] [--no-browser]
913
+ Install GitHub/GitLab (from origin) and browser MCP launchers
914
+
764
915
  npx agent-orchestrator-kit archive <name> [--sync | --no-sync --force]
765
916
  Gate-check a completed change, optionally merge delta specs, move to
766
917
  openspec/changes/archive/YYYY-MM-DD-<name>, validate, write final handoff
918
+
919
+ npx agent-orchestrator-kit handoff [change-name] [options]
920
+ --restore Print the restore briefing instead of persisting
921
+ (also records the session start into metrics.json)
922
+ --runtime <value> local | cloud (invalid values exit non-zero)
923
+ --agent-id <id> Cloud agent identifier (default: none)
924
+ --cloud-check Verify change artifacts are committed and pushed
925
+ (cloud: non-zero on failure; local: warning, exit 0)
926
+ --started-at <iso> Session start override when --restore was not run
927
+ --model <name> Model used in this session (metrics.json)
928
+ --input-tokens <n> / --output-tokens <n> / --total-tokens <n>
929
+ Token spend for this session (total defaults to in+out)
930
+ --cost-usd <usd> Session cost in USD
931
+ --no-metrics Skip recording this session into metrics.json
932
+
933
+ npx agent-orchestrator-kit metrics [change-name] [--json]
934
+ Show recorded session metrics for a change (active or archived):
935
+ time per phase, sessions, tokens, cost, agents, models, lead time
767
936
  ```
768
937
 
769
938
  ## Directory Reference
@@ -796,11 +965,30 @@ CLAUDE.md # Committed — synced to .claude/CLAUDE.md
796
965
  openspec/ # Committed — spec-driven workflow
797
966
  config.yaml # Project context for AI
798
967
  specs/ # Source of truth after archive
799
- changes/ # Active work; <name>/handoff.md indexes session state
968
+ changes/ # Active work; <name>/handoff.md + metrics.json index session state
800
969
  ```
801
970
 
971
+ ## Roadmap
972
+
973
+ 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.
974
+ 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`.
975
+ 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`.
976
+ 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.
977
+ 4. Phase 4 (`add-factory-control-plane`) is an opt-in platform decision, not the next sprint.
978
+ Phase bounds and non-goals: [`openspec/specs/agentic-factory-roadmap/spec.md`](openspec/specs/agentic-factory-roadmap/spec.md).
979
+
802
980
  ## Changelog
803
981
 
982
+ ### 0.5.0
983
+ - **Change metrics** — git-tracked `openspec/changes/<name>/metrics.json` (session start on `handoff --restore`, close on persist)
984
+ - **`metrics` CLI** — human summary or `--json`; phases, tokens, cost, agents, models, lead time
985
+ - Optional persist spend flags: `--model`, `--input-tokens`, `--output-tokens`, `--total-tokens`, `--cost-usd`, `--started-at`, `--no-metrics`
986
+
987
+ ### 0.4.0
988
+ - Factory phases 1–3: `hooks-setup` / `gate-check --staged`, `mcp-setup` (GitHub / GitLab / browser), MCP and Skill health in `status`
989
+ - Git-canonical append-only `decisions.md`; Memory `Decision:*` is a file→Memory mirror
990
+ - Cloud agent handoff: `## Runtime` in `handoff.md`, `--runtime` / `--agent-id` / `--cloud-check`
991
+
804
992
  ### 0.3.0
805
993
  - **`archive` CLI** — deterministic archive with gates, `--sync` delta merge, and rollback on validate failure
806
994
  - **Task contract** — `gate-check --tasks` enforces `Files:` / `Do:` / `Done-when:` (`pipeline.task_contract: warn|strict|off`)