agent-orchestrator-kit 0.1.14 → 0.3.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 (33) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +50 -16
  3. package/bin/agent-orchestrator.js +405 -3
  4. package/package.json +1 -1
  5. package/profiles/generic/orchestrator.yaml +2 -1
  6. package/profiles/mvp/openspec-config.yaml.example +2 -0
  7. package/profiles/mvp/orchestrator.yaml +2 -1
  8. package/profiles/node/orchestrator.yaml +2 -1
  9. package/profiles/vue3/openspec-config.yaml.example +2 -0
  10. package/profiles/vue3/orchestrator.yaml +2 -1
  11. package/templates/.agents/commands/opsx-apply.md +18 -46
  12. package/templates/.agents/commands/opsx-archive.md +10 -163
  13. package/templates/.agents/commands/opsx-design.md +3 -10
  14. package/templates/.agents/commands/opsx-explore.md +3 -10
  15. package/templates/.agents/commands/opsx-propose.md +14 -10
  16. package/templates/.agents/commands/opsx-quick.md +3 -10
  17. package/templates/.agents/commands/opsx-review.md +27 -55
  18. package/templates/.agents/commands/opsx-sync.md +2 -0
  19. package/templates/.agents/rules/agent-orchestration.mdc +21 -69
  20. package/templates/.agents/rules/figma-token-setup.mdc +1 -1
  21. package/templates/.agents/rules/memory-mcp-autosetup.mdc +4 -67
  22. package/templates/.agents/rules/session-handoff.mdc +21 -37
  23. package/templates/.agents/skills/agent-orchestration/SKILL.md +28 -29
  24. package/templates/.agents/skills/openspec-apply-change/SKILL.md +15 -20
  25. package/templates/.agents/skills/openspec-archive-change/SKILL.md +12 -99
  26. package/templates/.agents/skills/openspec-propose/SKILL.md +11 -0
  27. package/templates/.agents/subagents/session-handoff.md +5 -5
  28. package/templates/.agents/subagents/spec-architect.md +1 -1
  29. package/templates/.agents/subagents/spec-archiver.md +1 -1
  30. package/templates/.agents/subagents/spec-reviewer.md +11 -7
  31. package/templates/AGENTS.md +22 -124
  32. package/templates/CLAUDE.md +6 -68
  33. package/templates/orchestrator.yaml +2 -1
@@ -9,115 +9,28 @@ metadata:
9
9
  generatedBy: "1.4.1"
10
10
  ---
11
11
 
12
- Archive a completed change in the experimental workflow.
12
+ Archive a completed change. The phase is fully deterministic — one CLI call, no phase subagents.
13
13
 
14
- **Input**: Optionally specify a change name. If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
15
-
16
- **Conductor delegation is mandatory:** after resolving the change and confirming archive gates, spawn `spec-archiver` with a self-contained prompt. The parent MUST NOT compare/merge main specs or move the change itself; it only verifies the structured report, archive path, and validation result.
14
+ **Input**: Optionally specify a change name. If omitted or ambiguous, run `npx openspec list --json` and use the **AskUserQuestion tool** to let the user pick an active change. Never guess or auto-select.
17
15
 
18
16
  **Steps**
19
17
 
20
- 1. **If no change name provided, prompt for selection**
21
-
22
- Run `npx openspec list --json` to get available changes. Use the **AskUserQuestion tool** to let the user select.
23
-
24
- Show only active changes (not already archived).
25
- Include the schema used for each change if available.
26
-
27
- **IMPORTANT**: Do NOT guess or auto-select a change. Always let the user choose.
28
-
29
- 2. **Check artifact completion status**
30
-
31
- Run `npx openspec status --change "<name>" --json` to check artifact completion.
32
-
33
- Parse the JSON to understand:
34
- - `schemaName`: The workflow being used
35
- - `planningHome`, `changeRoot`, `artifactPaths`, and `actionContext`: path and scope context
36
- - `artifacts`: List of artifacts with their status (`done` or other)
37
-
38
- If status reports `actionContext.mode: "workspace-planning"`, explain that workspace archive is not supported in this slice and STOP. Do not move workspace changes into repo-local archives or edit linked repos.
39
-
40
- **If any artifacts are not `done`:**
41
- - Display warning listing incomplete artifacts
42
- - Use **AskUserQuestion tool** to confirm user wants to proceed
43
- - Proceed if user confirms
44
-
45
- 3. **Check task completion status**
46
-
47
- Read the tasks file (typically `tasks.md`) to check for incomplete tasks.
48
-
49
- Count tasks marked with `- [ ]` (incomplete) vs `- [x]` (complete).
50
-
51
- **If incomplete tasks found:**
52
- - Display warning showing count of incomplete tasks
53
- - Use **AskUserQuestion tool** to confirm user wants to proceed
54
- - Proceed if user confirms
55
-
56
- **If no tasks file exists:** Proceed without task-related warning.
57
-
58
- 4. **Assess delta spec sync state**
18
+ 1. **Resolve the change name** (see Input above).
59
19
 
60
- Use `artifactPaths.specs.existingOutputPaths` from status JSON to identify delta specs. Pass these paths and the user's sync preference to `spec-archiver`; the parent MUST NOT compare or merge specs itself.
20
+ 2. **Decide on delta-spec sync.** If the change has delta specs, ask the user: merge them into main specs (`--sync`, recommended) or archive without merging (`--no-sync --force`).
61
21
 
62
- **If delta specs exist:**
63
- - Ask whether main specs should be synced before archive
64
- - Include the delta and main spec paths in the `spec-archiver` prompt
65
- - Have `spec-archiver` return the combined sync summary in its report
66
-
67
- **Prompt options:**
68
- - If changes needed: "Sync now (recommended)", "Archive without syncing"
69
- - If already synced: "Archive now", "Sync anyway", "Cancel"
70
-
71
- The `spec-archiver` performs any requested comparison and sync as part of its isolated work; do not spawn a generic sync agent.
72
-
73
- 5. **Spawn the specialist and perform the archive**
74
-
75
- Spawn `spec-archiver`, require `## Subagent report: spec-archiver`, and delegate the sync/archive operations below. Do not run them in the parent session.
76
-
77
- Create an `archive` directory under `planningHome.changesDir` if it doesn't exist:
78
- ```bash
79
- mkdir -p "<planningHome.changesDir>/archive"
80
- ```
81
-
82
- Generate target name using current date: `YYYY-MM-DD-<change-name>`
83
-
84
- **Check if target already exists:**
85
- - If yes: Fail with error, suggest renaming existing archive or using different date
86
- - If no: Move `changeRoot` to the archive directory
22
+ 3. **Run the CLI:**
87
23
 
88
24
  ```bash
89
- mv "<changeRoot>" "<planningHome.changesDir>/archive/YYYY-MM-DD-<name>"
25
+ npx agent-orchestrator-kit archive <name> [--sync | --no-sync --force]
90
26
  ```
91
27
 
92
- 6. **Verify the report and display summary**
93
-
94
- The conductor verifies `Status: done`, the reported archive path, and modified main specs before reporting completion.
95
-
96
- Show archive completion summary including:
97
- - Change name
98
- - Schema that was used
99
- - Archive location
100
- - Whether specs were synced (if applicable)
101
- - Note about any warnings (incomplete artifacts/tasks)
102
-
103
- **Output On Success**
104
-
105
- ```
106
- ## Archive Complete
107
-
108
- **Change:** <change-name>
109
- **Schema:** <schema-name>
110
- **Archived to:** the archive path derived from `planningHome.changesDir`/YYYY-MM-DD-<name>/
111
- **Specs:** ✓ Synced to main specs (or "No delta specs" or "Sync skipped")
28
+ The CLI checks gates (review APPROVE when `require_spec_review: true`, all tasks `[x]`, no existing target archive), merges delta specs on `--sync` (ADDED append, MODIFIED replace, REMOVED delete), moves the change to `openspec/changes/archive/YYYY-MM-DD-<name>`, runs `npx openspec validate --all --strict` with full rollback on failure, and writes the final `handoff.md` (`next_command: none`) plus memory upsert.
112
29
 
113
- All artifacts complete. All tasks complete.
114
- ```
30
+ 4. **Show the CLI stdout as-is.** On exit ≠ 0, report the failed gate from stderr and stop.
115
31
 
116
32
  **Guardrails**
117
- - Always prompt for change selection if not provided
118
- - Use artifact graph (openspec status --json) for completion checking
119
- - Don't block archive on warnings - just inform and confirm
120
- - Preserve .openspec.yaml when moving to archive (it moves with the directory)
121
- - Show clear summary of what happened
122
- - If sync is requested, use openspec-sync-specs approach (agent-driven)
123
- - If delta specs exist, always run the sync assessment and show the combined summary before prompting
33
+ - Do NOT merge main specs, move the change, or edit anything manually — the CLI owns the whole operation.
34
+ - Spawn `spec-archiver` ONLY as a fallback when the `agent-orchestrator-kit archive` CLI is unavailable or failed for environmental reasons (not for unmet gates).
35
+ - On a sync conflict reported by the CLI, use the `openspec-sync-specs` skill to resolve it, then re-run `archive`.
36
+ - The pipeline ends here: no next-thread prompt is required after a successful archive.
@@ -24,6 +24,17 @@ When ready to implement, run /opsx:apply
24
24
 
25
25
  **Conductor delegation is mandatory:** spawn `spec-architect` with the resolved name, decision brief, design brief if present, and artifact instructions. The parent MUST NOT create or edit proposal/design/specs/tasks; after the structured report it may only verify paths, run status, and run strict validation.
26
26
 
27
+ **Task contract (mandatory tasks.md format):** every task must carry indented `Files:`, `Do:`, `Done-when:` fields:
28
+
29
+ ```markdown
30
+ - [ ] 2.1 Short title
31
+ Files: src/router/index.js, new file: src/stores/auth.js
32
+ Do: concrete change in 1–3 lines — no vague wording ("as needed", "if necessary", "as appropriate")
33
+ Done-when: verifiable condition or command
34
+ ```
35
+
36
+ Each task must be self-contained for a blind implementer — executable without reading design.md. `Files:` paths must exist unless prefixed with `new file:`. Lint: `npx agent-orchestrator-kit gate-check --tasks <name>` (mode via `pipeline.task_contract: warn|strict|off`).
37
+
27
38
  **Steps**
28
39
 
29
40
  1. **If no clear input provided, ask what they want to build**
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  name: session-handoff
3
- description: ALWAYS use at the start of every /opsx:* session to restore Memory and handoff.md, and at session exit to persist Memory, write handoff.md, run `npx agent-orchestrator-kit handoff`, and emit the expanded next-thread prompt. Do NOT use to write src/, specs, review.md, or to perform the phase specialist's work.
3
+ description: FALLBACK ONLY — use when the parent-driven protocol in `.agents/rules/session-handoff.mdc` fails. Restore mode when both `npx agent-orchestrator-kit handoff --restore` and reading handoff.md failed; persist mode when `npx agent-orchestrator-kit handoff <name>` failed after the parent wrote handoff.md. Never a routine step. Do NOT use to write src/, specs, review.md, or to perform the phase specialist's work.
4
4
  ---
5
5
 
6
- You are the session-boundary specialist. You restore or persist orchestration state. You do not implement features, write specs, or review code.
6
+ You are the session-boundary fallback specialist. The routine Session Start / Session Exit protocol is parent-driven (see `.agents/rules/session-handoff.mdc`); you run only when that protocol failed. You restore or persist orchestration state. You do not implement features, write specs, or review code.
7
7
 
8
- The parent is the conductor. Amp MUST spawn this skill as an isolated subagent (`subagent-session-handoff`) with fresh context and MUST NOT execute this body in the main thread.
8
+ When spawned, Amp runs this skill as an isolated subagent (`subagent-session-handoff`) with fresh context never as the main thread body.
9
9
 
10
10
  ## Restore mode
11
11
 
12
- Use when the conductor says restore / session start.
12
+ Use when the parent's restore failed (CLI restore and handoff.md both unavailable).
13
13
 
14
14
  1. Run `npx agent-orchestrator-kit status`.
15
15
  2. Run `npx agent-orchestrator-kit handoff --restore` (add `<name>` when known).
@@ -19,7 +19,7 @@ Use when the conductor says restore / session start.
19
19
 
20
20
  ## Persist mode
21
21
 
22
- Use when the conductor says persist / session exit. A session is not closed until this mode succeeds.
22
+ Use when the parent's persist failed (`npx agent-orchestrator-kit handoff <name>` did not exit 0). A session is not closed until persist succeeds.
23
23
 
24
24
  1. Write or update `openspec/changes/<name>/handoff.md` with every required section: Closed role, Change, Done, Decisions, Blocked, Next command, Next role, Attach, Subagents to spawn, Constraints.
25
25
  2. Run `npx agent-orchestrator-kit handoff <name>` and require exit 0. This upserts `.cursor/memory.json` using an absolute path and prints the expanded next-session prompt on stdout.
@@ -10,7 +10,7 @@ Workflow:
10
10
  1. Read `openspec/config.yaml`, existing main specs, the exploration decision brief, and `design-brief.md` when present.
11
11
  2. Create or update `proposal.md`, `design.md`, `specs/<capability>/spec.md`, and `tasks.md` using the repository's OpenSpec schema and conventions.
12
12
  3. Keep requirements testable: each requirement uses SHALL/MUST language and includes concrete scenarios.
13
- 4. Make tasks ordered, independently verifiable, and traceable to the design and delta specs.
13
+ 4. Make tasks ordered, independently verifiable, and traceable to the design and delta specs. Every task MUST follow the task contract: indented `Files:` (existing paths, or `new file:` prefix for new ones), `Do:` (concrete change, no vague wording like "as needed" / "if necessary" / "as appropriate"), and `Done-when:` (verifiable condition or command). Each task must be self-contained for a blind implementer without reading design.md.
14
14
  5. Report which validation command the conductor should run; do not cross into review or implementation.
15
15
 
16
16
  Rules:
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: spec-archiver
3
- description: OpenSpec completion specialist. ALWAYS use for /opsx:archive after merge/verification to merge delta specs and archive the completed change. Do NOT use to implement features, alter product behavior, or archive incomplete work.
3
+ description: OpenSpec completion fallback. Use ONLY when the `agent-orchestrator-kit archive` CLI is unavailable or failed for environmental reasons — /opsx:archive normally runs `npx agent-orchestrator-kit archive <name>` directly with no subagent. Do NOT use to implement features, alter product behavior, or archive incomplete work.
4
4
  ---
5
5
 
6
6
  You finalize one completed OpenSpec change. Your writable scope is the affected `openspec/specs/` capabilities and the archive move under `openspec/changes/archive/`.
@@ -3,29 +3,33 @@ name: spec-reviewer
3
3
  description: Pre-implementation OpenSpec gate reviewer. ALWAYS use for /opsx:review to assess proposal/design/specs/tasks and write review.md. Do NOT use for post-implementation code review, edit src/, or change tasks.md.
4
4
  ---
5
5
 
6
- You review one OpenSpec change before apply. You are read-only except for `openspec/changes/<name>/review.md`.
6
+ You are Tier 2 of a two-tier review: you run only after `npx agent-orchestrator-kit gate-check --review <name>` passed. You review one OpenSpec change before apply. You are read-only except for `openspec/changes/<name>/review.md` and, on APPROVE, `openspec/changes/<name>/apply-notes.md`.
7
7
 
8
8
  Workflow:
9
9
 
10
10
  1. Read the complete change directory, relevant main specs, `openspec/config.yaml`, and repository paths referenced by the artifacts.
11
- 2. Check proposal design delta specs tasks traceability, scope consistency, testability, migration impact, and compliance with project gates.
12
- 3. Run `npx openspec validate <name> --strict --type change` and record its actual result.
13
- 4. Write `review.md` with findings ordered by severity and exactly one verdict: `APPROVE` or `REQUEST CHANGES`.
14
- 5. Approve only when artifacts are implementable without material guessing and strict validation passes.
11
+ 2. Apply the LLM-only checklist do NOT re-check what Tier 1 covered (strict validation, contract field presence, proposal sections, delta-spec section structure):
12
+ - proposal design tasks consistency (no contradictions or drift);
13
+ - conflicts with existing `openspec/specs/` requirements;
14
+ - scope creep vs proposal Non-goals;
15
+ - task self-sufficiency: a blind implementer can execute each task from Files/Do/Done-when alone, without design.md.
16
+ 3. Write `review.md` with findings ordered by severity and exactly one verdict: `APPROVE` or `REQUEST CHANGES`.
17
+ 4. On APPROVE, also write `apply-notes.md` (≤ 20 lines): critical constraints, pitfalls, what NOT to touch, verification commands. It is the second and last file you may write.
18
+ 5. Approve only when artifacts are implementable without material guessing.
15
19
 
16
20
  Rules:
17
21
 
18
22
  - Do NOT edit `src/`, tests, proposal/design/spec files, or `tasks.md`.
19
23
  - Do NOT implement fixes found during review.
20
24
  - Do NOT substitute for `code-reviewer`; that agent reviews the implementation diff after apply.
21
- - Do NOT approve based only on validation syntax; verify semantics and repository references.
25
+ - Do NOT approve based only on Tier 1 passing; verify semantics and repository references.
22
26
 
23
27
  Return exactly this report contract:
24
28
 
25
29
  ```
26
30
  ## Subagent report: spec-reviewer
27
31
  **Status:** done | blocked
28
- **Files:** review.md
32
+ **Files:** review.md (+ apply-notes.md on APPROVE)
29
33
  **Done:** verdict and validation result
30
34
  **Blocked:** missing artifacts or none
31
35
  **Risks:** non-blocking review notes or none
@@ -2,138 +2,36 @@
2
2
 
3
3
  > Powered by [agent-orchestrator-kit](https://github.com/makshc2/agent-orchestrator-kit) v{{KIT_VERSION}}
4
4
 
5
- This project uses a **spec-driven, role-separated AI pipeline** built on [OpenSpec](https://github.com/fission-ai/openspec).
6
- Every feature follows the same cycle regardless of stack or IDE.
7
-
8
- ## Pipeline
5
+ Spec-driven OpenSpec pipeline. Each phase is a **separate chat**. Delegation is differentiated (lean model): explore/design/propose/review spawn a mandatory specialist; **apply is parent-driven** — the parent implements from `tasks.md` + `apply-notes.md`, subagents are optional (≥ 2 independent tasks or explicit request; `design-implementer` for design-brief/Figma); **archive is a CLI** (`npx agent-orchestrator-kit archive <name> [--sync]`), no subagent.
9
6
 
10
7
  ```
11
8
  explore → [design] → propose → review → apply → verify → archive
12
9
  ```
13
10
 
14
- `[design]` is optional — run `/opsx:design` when the change has UI and you need a durable design brief (Figma, screenshot, or photo). Skip for non-UI work; use `Design: none` in `proposal.md` when `require_design_brief: true`.
15
-
16
- Each phase runs in a **separate agent session** with a dedicated role, model hint, and permissions.
17
- Never mix phases in one chat — this is the single most important rule.
18
-
19
- The parent `/opsx:*` session is a **conductor**: it restores handoff state, spawns the required specialist, verifies the structured report, and never performs the specialist's work itself.
20
-
21
- ## Roles
22
-
23
- | Role | Command | Mode | Model hint |
24
- |------|---------|------|------------|
25
- | Explorer | `/opsx:explore` | read-only | fast |
26
- | Design Intake | `/opsx:design <name>` | writes `design-brief.md` + `assets/` only | strong |
27
- | Architect | `/opsx:propose <name>` | conductor; `spec-architect` writes change artifacts | strong |
28
- | Spec Reviewer | `/opsx:review <name>` | conductor; `spec-reviewer` writes only `review.md` | medium/strong |
29
- | Implementer | `/opsx:apply <name>` | conductor; apply specialists write code/tests | strong |
30
- | Verifier | CI (automatic) | scripts only | — |
31
-
32
- ## Conductor Routing
33
-
34
- | Phase / signal | Subagent |
35
- |----------------|----------|
36
- | Status, gate failure, next command | `openspec-guide` |
37
- | Session start restore / session exit persist | `session-handoff` |
38
- | Broken kit, MCP, or sync | `setup-doctor` |
39
- | `/opsx:explore` repository research | `codebase-explorer` |
40
- | `/opsx:design` | `design-intake` |
41
- | `/opsx:propose` | `spec-architect` |
42
- | `/opsx:review` | `spec-reviewer` |
43
- | Apply with design evidence | `design-implementer` |
44
- | Apply ordinary task | `code-writer` |
45
- | Apply tests | `test-writer` |
46
- | Apply pre-PR review | `code-reviewer` |
47
- | `/opsx:archive` | `spec-archiver` |
48
-
49
- This routing is mandatory and exclusive. `spec-reviewer` is not `code-reviewer`; only the conductor marks `tasks.md` after a verified `Status: done` report.
50
-
51
- Verifier runs on **GitHub Actions** (default) or **GitLab** via `prebuild` → `verify:openspec` when using `init --ci gitlab`. GitLab projects do not use `.github/workflows/`.
52
-
53
- With `init --ci gitlab --spec-verify` or `init --ci github --spec-verify`, an **AI Spec Verifier** also runs on MRs/PRs changing `src/`: an Amp agent checks the changed code against `openspec/specs/` and a **BLOCKED verdict fails the pipeline** (gate `spec-verify-blocking` in `.agents/orchestrator.yaml`).
54
-
55
- Both CI fragments also run `npx agent-orchestrator-kit gate-check` — a deterministic check that fails the pipeline when `src/` changed but the active change has no `review.md` with `Verdict: APPROVE` (when `require_spec_review: true`), and optionally requires `design-brief.md` (when `require_design_brief: true`, unless `proposal.md` has `Design: none`). At session start run `npx agent-orchestrator-kit status` (not a bare global binary — Amp PATH often lacks it; see `.agents/rules/cli-via-npm.mdc`).
56
-
57
- ## Hard Rules
58
-
59
- - **One active change per developer** at a time.
60
- - **No apply without spec-review approval** (explicit Approve in chat).
61
- - **No code edits** during explore, design-intake, or spec-review sessions.
62
- - **Archive after every merge** (`/opsx:archive`).
63
- - **Always run local build/lint** before opening a PR.
64
- - **Conductor MUST spawn** the routed specialist and MUST NOT do specialist work in the parent session.
65
-
66
- ## Handoff Gates
67
-
68
- | Transition | Gate |
69
- |------------|------|
70
- | explore → design | UI change needs a brief; change name chosen |
71
- | explore → propose | Decision brief written; change name chosen (skip design if non-UI) |
72
- | design → propose | `design-brief.md` (+ `assets/`) written |
73
- | propose → review | `npx openspec validate <name> --strict --type change` passes ✓ |
74
- | review → apply | Reviewer writes explicit **Approve** — enforced in CI by `gate-check` |
75
- | apply → verify | All `tasks.md` checkboxes `[x]`; local build OK |
76
- | verify → archive | CI green; PR merged — check `npx agent-orchestrator-kit status` for "ready to archive" |
77
-
78
- ## Context to Pin per Role
79
-
80
- | Role | Attach (`@`) |
81
- |------|-------------|
82
- | Explorer | `@openspec/specs/` + relevant `@src/` subtree |
83
- | Design Intake | design source (Figma URL / images) + `@openspec/changes/<name>/` |
84
- | Architect | `@openspec/config.yaml` + explore brief (+ `@design-brief.md` if present) |
85
- | Reviewer | entire `@openspec/changes/<name>/` |
86
- | Implementer | `@openspec/changes/<name>/tasks.md` + `@openspec/changes/<name>/design-brief.md` |
87
-
88
- ## Configuration
89
-
90
- See `.agents/orchestrator.yaml` for role config, pipeline flags, and MCP baseline.
91
-
92
- ## Session Handoff
93
-
94
- **HARD STOP.** A `/opsx:*` session is incomplete without persist + the fenced next-thread prompt. Amp often skips Memory MCP and in-thread specialist work — use the CLI and isolated `subagent-*` spawns.
95
-
96
- At session start, before specialist work: honor the pasted `/opsx:*` command, run `npx agent-orchestrator-kit status`, run `npx agent-orchestrator-kit handoff --restore`, read Memory `Change:<name>`, `Handoff:<name>`, `Decision:*`, then fall back to `openspec/changes/<name>/handoff.md`. Spawn `session-handoff` in restore mode when context is incomplete (Amp: isolated `subagent-session-handoff`). Then spawn the routed phase specialist (Amp: isolated wrapper, never the main thread).
97
-
98
- At exit, in order: spawn `session-handoff` persist → write `handoff.md` → `npx agent-orchestrator-kit handoff <name>` (exit 0, upserts absolute-path Memory JSON) → paste the CLI stdout prompt as one fenced block. The prompt body uses `project.agent_language`, has no service banner, and MUST be self-contained (Done, Decisions, Blocked, attach, which subagent to spawn, HARD STOP). Never start the next phase in the current chat.
99
-
100
- OpenSpec artifacts remain the source of truth for requirements and tasks. Memory and `handoff.md` index the phase. The pasted prompt is the next thread's operating brief even if Memory is ignored.
101
-
102
- Memory MCP MUST use `node scripts/memory-mcp-launcher.cjs` (never a relative `MEMORY_FILE_PATH`). Run `npx agent-orchestrator-kit memory-setup` when the launcher is missing.
103
-
104
- ### Optional: Figma personal token
105
-
106
- For design intake against private Figma files, each developer configures a local token (never commit, never paste into chat):
107
-
108
- ```bash
109
- npx agent-orchestrator-kit figma-setup
110
- # edit .agents/figma.local.env → FIGMA_ACCESS_TOKEN=...
111
- npx agent-orchestrator-kit figma-status
112
- ```
113
-
114
- MCP starts via `scripts/figma-mcp-launcher.cjs` (secret stays out of `.mcp.json`). See kit README → **Figma token**.
11
+ `[design]` is optional (`/opsx:design`). Non-UI: `Design: none` in `proposal.md` when `require_design_brief: true`. MVP: `/opsx:quick` when `require_spec_review: false`.
115
12
 
116
- ## Skills & Commands
13
+ Routing table, HARD STOP, and CLI forms: `.agents/rules/` (`agent-orchestration`, `session-handoff`, `cli-via-npm`). Config: `.agents/orchestrator.yaml`.
117
14
 
118
- All skills live in `.agents/skills/` (committed to git).
119
- Local IDE sync: run `./scripts/sync-local-agent-skills.sh`.
15
+ ## Commands
16
+ | Role | Command |
17
+ |------|---------|
18
+ | Explorer | `/opsx:explore` |
19
+ | Design Intake | `/opsx:design <name>` |
20
+ | Architect | `/opsx:propose <name>` |
21
+ | Spec Reviewer | `/opsx:review <name>` |
22
+ | Implementer | `/opsx:apply <name>` |
23
+ | Quick (MVP) | `/opsx:quick <name>` |
24
+ | Archive | `/opsx:archive` |
120
25
 
121
- | Skill | When |
122
- |-------|------|
123
- | `agent-orchestration` | Pipeline decisions, role selection, handoff |
124
- | `openspec-howto` | OpenSpec CLI, cycle, naming |
125
- | `openspec-propose` | Creating change artifacts |
126
- | `openspec-apply-change` | Implementing tasks |
127
- | `openspec-archive-change` | Archiving after merge |
26
+ Session Start / Exit are **parent-driven** — canonical protocol in `.agents/rules/session-handoff.mdc`. Start: `status` → `handoff --restore` → `handoff.md` fallback. Exit HARD STOP: parent writes `handoff.md` → `npx agent-orchestrator-kit handoff <name>` (exit 0) → paste the CLI `/opsx:*` prompt. `session-handoff` subagent = fallback only. Do not start the next phase here.
128
27
 
129
- ## Metrics (track per change)
28
+ Quality gates: `gate-check --tasks <name>` lints the task contract (Files/Do/Done-when, `pipeline.task_contract: warn|strict|off`); `gate-check --review <name>` is deterministic Tier 1 of review — spec-reviewer (Tier 2) is spawned only after it passes and writes `apply-notes.md` on APPROVE.
130
29
 
131
- | Metric | Target |
132
- |--------|--------|
133
- | Sessions per change | 4–8 |
134
- | Apply iterations to PR | 2 |
135
- | Spec review loops | 1 |
136
- | Tasks rework after apply | 10% |
137
- | CI fails on PR | ≤ 1 |
30
+ ## Hard rules
31
+ - One active change (unless mvp profile).
32
+ - No apply without explicit Approve when `require_spec_review: true`.
33
+ - No `src/` in explore, design, or review.
34
+ - Archive after merge. Build/lint before PR.
35
+ - Memory MCP: `node scripts/memory-mcp-launcher.cjs` (never relative `MEMORY_FILE_PATH`).
138
36
 
139
- If apply iterations > 2 fix in Architect/Reviewer, not Implementer.
37
+ Pin only the files for the current role (`tasks.md`, the change folder, relevant `src/` subtree) — not entire `openspec/specs/`.
@@ -1,77 +1,15 @@
1
1
  # {{PROJECT_NAME}} — Claude Code Context
2
2
 
3
- > agent-orchestrator-kit v{{KIT_VERSION}} | Spec-driven pipeline with OpenSpec
3
+ > agent-orchestrator-kit v{{KIT_VERSION}} | OpenSpec pipeline
4
4
 
5
- ## Project
6
-
7
- See `AGENTS.md` for the full orchestration pipeline, roles, and hard rules.
8
- See `openspec/config.yaml` for stack context and agent language.
9
-
10
- ## Skills
11
-
12
- Project skills live in `.claude/skills/` (synced from `.agents/skills/`).
13
- Use `/skill-name` or let Claude auto-load based on context.
14
-
15
- | Skill | Command | When |
16
- |-------|---------|------|
17
- | Agent Orchestration | `/agent-orchestration` | Role selection, pipeline, handoff decisions |
18
- | OpenSpec Howto | `/openspec-howto` | CLI, cycle, naming |
19
- | OpenSpec Propose | `/openspec-propose` | Creating change artifacts |
20
- | OpenSpec Apply | `/openspec-apply-change` | Implementing tasks |
21
- | OpenSpec Archive | `/openspec-archive-change` | Archiving after merge |
22
-
23
- ## Pipeline Commands
5
+ See `AGENTS.md` and `.agents/rules/` for routing, HARD STOP, and CLI (`npx` only). Config: `.agents/orchestrator.yaml`.
24
6
 
25
7
  ```
26
- /opsx:explore think through ideas (read-only, no code)
27
- /opsx:design — capture design into design-brief.md + assets/ (optional)
28
- /opsx:propose — create change artifacts
29
- /opsx:review — spec review (read-only, no code)
30
- /opsx:apply — implement tasks
31
- /opsx:archive — archive after merge
8
+ /opsx:explore · /opsx:design · /opsx:propose · /opsx:review · /opsx:apply · /opsx:archive
32
9
  ```
33
10
 
34
- The parent command session is a conductor. It MUST spawn the phase specialist and MUST NOT perform specialist work itself:
35
-
36
- | Signal | Subagent |
37
- |--------|----------|
38
- | Status / next command | `openspec-guide` |
39
- | Session restore / persist / next-thread prompt | `session-handoff` |
40
- | Kit / MCP / sync failure | `setup-doctor` |
41
- | Explore research | `codebase-explorer` |
42
- | Design intake | `design-intake` |
43
- | Propose | `spec-architect` |
44
- | Spec review | `spec-reviewer` |
45
- | Apply UI / ordinary task / tests / pre-PR review | `design-implementer` / `code-writer` / `test-writer` / `code-reviewer` |
46
- | Archive | `spec-archiver` |
47
-
48
- ## Key Rules for This Session
49
-
50
- - Check `.agents/orchestrator.yaml` for project-specific pipeline config.
51
- - One active change at a time — run `npx openspec list` / `npx agent-orchestrator-kit status` to confirm.
52
- - No code edits in explore, design, or review mode.
53
- - Design Intake writes only `design-brief.md` and `assets/` — never `src/`.
54
- - After completing apply: run build/lint before declaring done.
55
- - Only the conductor marks `tasks.md`, after a specialist reports `Status: done` and its files are verified.
56
- - Use `npx openspec validate --all --strict` or `npx openspec validate <name> --strict --type change`.
57
- - Never bare `openspec` / `agent-orchestrator-kit` without `npx` (Amp PATH → exit 127). See `.agents/rules/cli-via-npm.mdc`.
58
-
59
- ## Session Handoff
60
-
61
- **HARD STOP.** Before work: `npx agent-orchestrator-kit handoff --restore`, then Memory `Change:<name>`, `Handoff:<name>`, `Decision:*`; if unavailable, `openspec/changes/<name>/handoff.md`. Spawn `session-handoff` restore when needed (Amp: isolated `subagent-session-handoff`). Spawn the phase specialist isolated — never in the Amp main thread.
62
-
63
- At exit: persist via `session-handoff` → `handoff.md` → `npx agent-orchestrator-kit handoff <name>` (exit 0) → paste the full CLI stdout `/opsx:*` prompt. The prompt MUST be self-contained. Do not begin the next phase in the same chat.
64
-
65
- OpenSpec files are the requirements/tasks source of truth. Memory and `handoff.md` index phase state. The pasted prompt is the next thread's operating brief.
11
+ Lean delegation: explore/design/propose/review spawn a mandatory specialist; apply is parent-driven from `tasks.md` + `apply-notes.md` (subagents optional for independent tasks); archive runs `npx agent-orchestrator-kit archive <name> [--sync]` — no subagent. Review is two-tiered: `gate-check --review` (deterministic) before `spec-reviewer`; `gate-check --tasks` lints the Files/Do/Done-when task contract.
66
12
 
67
- ## File Locations
13
+ Session Start/Exit are parent-driven (canonical: `.agents/rules/session-handoff.mdc`): restore with `npx agent-orchestrator-kit handoff --restore`; exit — write `handoff.md`, run `npx agent-orchestrator-kit handoff <name>` (exit 0), paste the CLI prompt. `session-handoff` subagent is a fallback only. Do not start the next phase in this chat.
68
14
 
69
- | What | Where |
70
- |------|-------|
71
- | Active changes | `openspec/changes/` |
72
- | Design brief | `openspec/changes/<name>/design-brief.md` + `assets/` |
73
- | Session handoff index | `openspec/changes/<name>/handoff.md` |
74
- | Specs (source of truth) | `openspec/specs/` |
75
- | Project config | `openspec/config.yaml` |
76
- | Orchestration config | `.agents/orchestrator.yaml` |
77
- | Skills | `.claude/skills/` |
15
+ One active change. No `src/` in explore/design/review. After apply: build/lint. Skills: `.claude/skills/` (synced from `.agents/skills/`).
@@ -12,6 +12,7 @@ pipeline:
12
12
  require_design_brief: false
13
13
  max_active_changes: 1
14
14
  archive_after_merge: true
15
+ task_contract: warn
15
16
 
16
17
  roles:
17
18
  explorer:
@@ -50,7 +51,7 @@ handoff:
50
51
  persist_on_exit: true
51
52
  emit_next_session_prompt: true
52
53
  prompt_self_contained: true
53
- spawn_handoff_subagent: true
54
+ spawn_handoff_subagent: false
54
55
 
55
56
  memory:
56
57
  enabled: true