agent-orchestrator-kit 0.2.0 → 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.
- package/CHANGELOG.md +22 -0
- package/README.md +50 -16
- package/bin/agent-orchestrator.js +405 -3
- package/package.json +1 -1
- package/profiles/generic/orchestrator.yaml +2 -1
- package/profiles/mvp/openspec-config.yaml.example +2 -0
- package/profiles/mvp/orchestrator.yaml +2 -1
- package/profiles/node/orchestrator.yaml +2 -1
- package/profiles/vue3/openspec-config.yaml.example +2 -0
- package/profiles/vue3/orchestrator.yaml +2 -1
- package/templates/.agents/commands/opsx-apply.md +18 -46
- package/templates/.agents/commands/opsx-archive.md +10 -163
- package/templates/.agents/commands/opsx-design.md +3 -10
- package/templates/.agents/commands/opsx-explore.md +3 -10
- package/templates/.agents/commands/opsx-propose.md +14 -10
- package/templates/.agents/commands/opsx-quick.md +3 -10
- package/templates/.agents/commands/opsx-review.md +27 -55
- package/templates/.agents/commands/opsx-sync.md +2 -0
- package/templates/.agents/rules/agent-orchestration.mdc +15 -16
- package/templates/.agents/rules/session-handoff.mdc +18 -16
- package/templates/.agents/skills/agent-orchestration/SKILL.md +27 -28
- package/templates/.agents/skills/openspec-apply-change/SKILL.md +15 -20
- package/templates/.agents/skills/openspec-archive-change/SKILL.md +12 -99
- package/templates/.agents/skills/openspec-propose/SKILL.md +11 -0
- package/templates/.agents/subagents/session-handoff.md +5 -5
- package/templates/.agents/subagents/spec-architect.md +1 -1
- package/templates/.agents/subagents/spec-archiver.md +1 -1
- package/templates/.agents/subagents/spec-reviewer.md +11 -7
- package/templates/AGENTS.md +3 -3
- package/templates/CLAUDE.md +2 -2
- package/templates/orchestrator.yaml +2 -1
|
@@ -5,9 +5,9 @@ category: Workflow
|
|
|
5
5
|
description: Read-only spec review of an OpenSpec change — approve or request changes before apply
|
|
6
6
|
---
|
|
7
7
|
|
|
8
|
-
## Session Start
|
|
8
|
+
## Session Start
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Follow the canonical Session Start protocol in `.agents/rules/session-handoff.mdc`, then announce the Spec Reviewer role.
|
|
11
11
|
|
|
12
12
|
Review an OpenSpec change. Read artifacts, validate structure, output Approve or Request Changes.
|
|
13
13
|
|
|
@@ -15,7 +15,7 @@ Review an OpenSpec change. Read artifacts, validate structure, output Approve or
|
|
|
15
15
|
|
|
16
16
|
**Input**: Optionally specify a change name (e.g., `/opsx:review add-auth`). If omitted, auto-select if one active change exists, otherwise list and ask.
|
|
17
17
|
|
|
18
|
-
**
|
|
18
|
+
**Review is two-tiered:** Tier 1 is a deterministic script (`gate-check --review`) run by the parent **before** any artifact is read by an LLM. Tier 2 is the `spec-reviewer` subagent with a shortened, LLM-only checklist. Spawning `spec-reviewer` is mandatory only when Tier 1 passes. The parent MUST NOT review artifacts or write `review.md` itself when Tier 2 runs. Never substitute `code-reviewer`.
|
|
19
19
|
|
|
20
20
|
---
|
|
21
21
|
|
|
@@ -30,59 +30,36 @@ If name provided — use it. Otherwise:
|
|
|
30
30
|
|
|
31
31
|
Announce: "Reviewing change: **<name>**"
|
|
32
32
|
|
|
33
|
-
### 2.
|
|
34
|
-
|
|
35
|
-
Spawn `spec-reviewer` and delegate steps 3–6 below. Require `## Subagent report: spec-reviewer`. Do not perform the review in the parent session.
|
|
36
|
-
|
|
37
|
-
### 3. Validate structure
|
|
33
|
+
### 2. Tier 1 — deterministic gate-check
|
|
38
34
|
|
|
39
35
|
```bash
|
|
40
|
-
npx
|
|
36
|
+
npx agent-orchestrator-kit gate-check --review <name>
|
|
41
37
|
```
|
|
42
38
|
|
|
43
|
-
|
|
39
|
+
The script runs `openspec validate --strict --type change`, the task-contract lint (Files/Do/Done-when), the `Non-goals` / `Acceptance criteria` proposal sections check, and non-empty ADDED/MODIFIED/REMOVED delta-spec sections check. Add `--json` for a `{pass, errors[]}` report.
|
|
44
40
|
|
|
45
|
-
|
|
41
|
+
**If Tier 1 fails (exit ≠ 0):** do NOT spawn `spec-reviewer` and do NOT read the artifacts. Write `openspec/changes/<name>/review.md` with `Verdict: REQUEST CHANGES` listing the gate-check errors (source: gate-check), output the Request Changes verdict in chat, and go straight to Session Exit.
|
|
46
42
|
|
|
47
|
-
|
|
48
|
-
npx openspec status --change "<name>" --json
|
|
49
|
-
```
|
|
43
|
+
### 3. Tier 2 — spawn the specialist
|
|
50
44
|
|
|
51
|
-
|
|
52
|
-
- `proposal.md`
|
|
53
|
-
- `design.md`
|
|
54
|
-
- `tasks.md`
|
|
55
|
-
- all `specs/<domain>/spec.md` files
|
|
45
|
+
Only after Tier 1 passes: spawn `spec-reviewer` with the complete change paths, project constraints, and the shortened checklist below. Require `## Subagent report: spec-reviewer`. Do not perform the review in the parent session.
|
|
56
46
|
|
|
57
|
-
|
|
47
|
+
### 4. Review checklist (Tier 2 — LLM-only)
|
|
58
48
|
|
|
59
|
-
|
|
49
|
+
Do NOT re-check what Tier 1 already covered (strict validation, contract field presence, proposal sections, delta-spec section structure). Evaluate each item. Mark ✓ or ✗:
|
|
60
50
|
|
|
61
|
-
|
|
51
|
+
**Consistency**
|
|
52
|
+
- [ ] proposal ↔ design ↔ tasks tell the same story — no contradictions or drift
|
|
53
|
+
- [ ] Delta specs cover all changed/added behavior described in design
|
|
62
54
|
|
|
63
|
-
**
|
|
64
|
-
- [ ]
|
|
65
|
-
- [ ] Non-goals are listed
|
|
66
|
-
- [ ] Acceptance criteria are present and testable (not "should work" — must be verifiable)
|
|
67
|
-
- [ ] Scope matches a ~1–3 day change
|
|
55
|
+
**Main specs**
|
|
56
|
+
- [ ] No conflicts with existing `openspec/specs/` requirements
|
|
68
57
|
|
|
69
|
-
**
|
|
70
|
-
- [ ] Approach is concrete (not "we will handle this")
|
|
71
|
-
- [ ] Trade-offs or alternatives mentioned
|
|
72
|
-
- [ ] Does not contradict existing `openspec/specs/` domain specs
|
|
58
|
+
**Scope**
|
|
73
59
|
- [ ] No scope creep vs proposal Non-goals
|
|
74
60
|
|
|
75
|
-
**
|
|
76
|
-
- [ ]
|
|
77
|
-
- [ ] Each task has a clear done condition
|
|
78
|
-
- [ ] Tasks are in logical implementation order
|
|
79
|
-
- [ ] No task requires information not in design/spec
|
|
80
|
-
- [ ] No task says "update X as needed" (must be specific)
|
|
81
|
-
|
|
82
|
-
**Delta Specs**
|
|
83
|
-
- [ ] Cover all changed/added behavior
|
|
84
|
-
- [ ] ADDED/MODIFIED/REMOVED sections used correctly
|
|
85
|
-
- [ ] No conflicts with main `openspec/specs/`
|
|
61
|
+
**Task self-sufficiency**
|
|
62
|
+
- [ ] A blind implementer can execute each task from Files/Do/Done-when alone, without reading design.md
|
|
86
63
|
|
|
87
64
|
**Vue 3** (when `project.stack: vue3` in `.agents/orchestrator.yaml`)
|
|
88
65
|
- [ ] Components use `<script setup>` + Composition API (no Options API)
|
|
@@ -91,7 +68,7 @@ Evaluate each item. Mark ✓ or ✗:
|
|
|
91
68
|
- [ ] Tasks reference concrete component/store paths under `src/`
|
|
92
69
|
- [ ] No scope creep into unrelated UI refactors
|
|
93
70
|
|
|
94
|
-
###
|
|
71
|
+
### 5. Write and report the verdict
|
|
95
72
|
|
|
96
73
|
#### If all ✓ (or only minor notes):
|
|
97
74
|
|
|
@@ -131,11 +108,13 @@ Create or update `openspec/changes/<name>/review.md`:
|
|
|
131
108
|
<optional notes>
|
|
132
109
|
```
|
|
133
110
|
|
|
134
|
-
|
|
111
|
+
On **APPROVE**, `spec-reviewer` also writes `openspec/changes/<name>/apply-notes.md` (≤ 20 lines): critical constraints, pitfalls, what NOT to touch, verification commands. It is the distilled input for `/opsx:apply` and the **second allowed file** next to `review.md`.
|
|
112
|
+
|
|
113
|
+
For **REQUEST CHANGES**, write only `review.md` with `Verdict: REQUEST CHANGES` and the issues list.
|
|
135
114
|
|
|
136
|
-
|
|
115
|
+
`review.md` (always) and `apply-notes.md` (on APPROVE) are the **only files** you may write during review (not `src/`, not `tasks.md` checkboxes).
|
|
137
116
|
|
|
138
|
-
The conductor verifies the subagent's `Status: done`, checks that `review.md` exists with the reported verdict, and relays the result without editing
|
|
117
|
+
The conductor verifies the subagent's `Status: done`, checks that `review.md` exists with the reported verdict (and `apply-notes.md` on APPROVE), and relays the result without editing them.
|
|
139
118
|
|
|
140
119
|
#### If any ✗:
|
|
141
120
|
|
|
@@ -162,19 +141,12 @@ Fix the above, then re-run `/opsx:review <name>`.
|
|
|
162
141
|
|
|
163
142
|
## Session Exit (HARD STOP)
|
|
164
143
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
1. Spawn `session-handoff` in persist mode (Amp: isolated `subagent-session-handoff`). If spawn fails, persist in the parent — never skip.
|
|
168
|
-
2. Write `openspec/changes/<name>/handoff.md` with: Closed role, Change, Done, Decisions, Blocked, Next command, Next role, Attach, Subagents to spawn, Constraints.
|
|
169
|
-
3. Run `npx agent-orchestrator-kit handoff <name>` and require exit 0. The CLI upserts Memory JSON (absolute path) and prints the expanded self-contained prompt on stdout.
|
|
170
|
-
4. If Memory MCP tools work, also update `Change:<name>`, `Handoff:<name>`, and new `Decision:*`.
|
|
171
|
-
5. Paste CLI stdout into chat as one fenced block beginning with the next `/opsx:*` command (`/opsx:apply <name>` only after APPROVE). Keep it complete. No banner.
|
|
172
|
-
6. Stop. Do not start the next phase in this chat.
|
|
144
|
+
Close via the canonical Session Exit protocol in `.agents/rules/session-handoff.mdc`. First line of the pasted prompt is the next `/opsx:*` command (`/opsx:apply <name>` only after APPROVE). Do not start the next phase in this chat.
|
|
173
145
|
|
|
174
146
|
## Guardrails
|
|
175
147
|
|
|
176
148
|
- **Never** edit source code, `src/`, or `tasks.md` checkboxes
|
|
177
|
-
- **May write only** `openspec/changes/<name>/review.md` (verdict record for apply gate)
|
|
149
|
+
- **May write only** `openspec/changes/<name>/review.md` (verdict record for apply gate) and, on APPROVE, `openspec/changes/<name>/apply-notes.md`
|
|
178
150
|
- **Never** run apply commands
|
|
179
151
|
- Ask for clarification only if a critical artifact is missing or unreadable
|
|
180
152
|
- If proposal is ambiguous on scope, flag as ✗ — do not assume intent
|
|
@@ -7,6 +7,8 @@ description: Sync delta specs from a change to main specs
|
|
|
7
7
|
|
|
8
8
|
Sync delta specs from a change to main specs.
|
|
9
9
|
|
|
10
|
+
If run as a standalone `/opsx:*` session, follow the canonical Session Start / Session Exit protocol in `.agents/rules/session-handoff.mdc`.
|
|
11
|
+
|
|
10
12
|
This is an **agent-driven** operation - you will read delta specs and directly edit main specs to apply the changes. This allows intelligent merging (e.g., adding a scenario without copying the entire requirement).
|
|
11
13
|
|
|
12
14
|
**Input**: Optionally specify a change name after `/opsx:sync` (e.g., `/opsx:sync add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes.
|
|
@@ -10,22 +10,21 @@ Spec-driven pipeline. Read `.agents/orchestrator.yaml`. Details: skill `agent-or
|
|
|
10
10
|
## Commands
|
|
11
11
|
`/opsx:explore` read-only · `/opsx:design <name>` brief+assets only · `/opsx:propose <name>` change artifacts · `/opsx:review <name>` review.md · `/opsx:apply <name>` code (blocked without Approve when `require_spec_review`) · `/opsx:quick <name>` MVP propose+apply · `/opsx:archive`
|
|
12
12
|
|
|
13
|
-
The parent `/opsx:*` session is the **conductor**.
|
|
14
|
-
|
|
15
|
-
|
|
|
16
|
-
|
|
17
|
-
| Status / gate / next command | `openspec-guide` |
|
|
18
|
-
| Restore
|
|
19
|
-
| Broken kit / MCP / sync | `setup-doctor` |
|
|
20
|
-
| `/opsx:explore` | `codebase-explorer` |
|
|
21
|
-
| `/opsx:design` | `design-intake` |
|
|
22
|
-
| `/opsx:propose` | `spec-architect` |
|
|
23
|
-
| `/opsx:review` | `spec-reviewer` |
|
|
24
|
-
| Apply + design brief/Figma/image | `design-implementer` |
|
|
25
|
-
| Apply
|
|
26
|
-
| Apply
|
|
27
|
-
|
|
|
28
|
-
| `/opsx:archive` | `spec-archiver` |
|
|
13
|
+
The parent `/opsx:*` session is the **conductor**. Delegation is differentiated by phase: propose/review MUST spawn their specialist; apply is parent-driven with optional subagents; archive is a CLI call with phase subagents forbidden. Only the parent marks `tasks.md`. `spec-reviewer` ≠ `code-reviewer`.
|
|
14
|
+
|
|
15
|
+
| Phase / signal | Subagent | Status |
|
|
16
|
+
|--------|------------|--------|
|
|
17
|
+
| Status / gate / next command | `openspec-guide` | optional |
|
|
18
|
+
| Restore/persist when handoff CLI failed | `session-handoff` | fallback only |
|
|
19
|
+
| Broken kit / MCP / sync | `setup-doctor` | on signal |
|
|
20
|
+
| `/opsx:explore` | `codebase-explorer` | mandatory |
|
|
21
|
+
| `/opsx:design` | `design-intake` | mandatory |
|
|
22
|
+
| `/opsx:propose` | `spec-architect` | mandatory |
|
|
23
|
+
| `/opsx:review` (after `gate-check --review` passes) | `spec-reviewer` | mandatory |
|
|
24
|
+
| Apply + design brief/Figma/image | `design-implementer` | mandatory on signal |
|
|
25
|
+
| Apply: ≥ 2 independent tasks, no shared files, or explicit request | `code-writer` / `test-writer` | optional |
|
|
26
|
+
| Apply pre-PR | `code-reviewer` | optional |
|
|
27
|
+
| `/opsx:archive` | — use `npx agent-orchestrator-kit archive <name>` | CLI; subagent forbidden (`spec-archiver` = CLI-failure fallback only) |
|
|
29
28
|
|
|
30
29
|
## Session
|
|
31
30
|
Start: honor pasted `/opsx:*` → `npx agent-orchestrator-kit status` → `handoff --restore`. Spawn `session-handoff` restore **only if** restore CLI failed or printed no briefing (Amp: isolated `subagent-session-handoff`). Then spawn the phase specialist isolated. Free-form continue → `Handoff.next_command`.
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: Canonical Session Start and Session Exit protocol for every /opsx:* session
|
|
3
3
|
alwaysApply: true
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Session Handoff — HARD STOP
|
|
6
|
+
# Session Handoff — canonical protocol (HARD STOP)
|
|
7
7
|
|
|
8
|
-
A `/opsx:*` session is incomplete without persist + the fenced next-thread prompt. FORBIDDEN until persist succeeds: done/готово, next phase, or omitting the prompt.
|
|
8
|
+
This rule is the single source of the Session Start / Session Exit protocol. Commands reference it; they do not duplicate it. A `/opsx:*` session is incomplete without persist + the fenced next-thread prompt. FORBIDDEN until persist succeeds: done/готово, next phase, or omitting the prompt.
|
|
9
9
|
|
|
10
|
-
## Start (before
|
|
11
|
-
1. Honor pasted `/opsx:<phase> <name
|
|
10
|
+
## Session Start (before any work)
|
|
11
|
+
1. Honor pasted `/opsx:<phase> <name>` and announce the role.
|
|
12
12
|
2. `npx agent-orchestrator-kit status`
|
|
13
|
-
3. `npx agent-orchestrator-kit handoff --restore` (or `handoff <name> --restore`)
|
|
14
|
-
4.
|
|
15
|
-
5.
|
|
16
|
-
6.
|
|
17
|
-
7.
|
|
18
|
-
8. Free-form continue/next/«далі» with one active change → execute `Handoff.next_command`.
|
|
13
|
+
3. `npx agent-orchestrator-kit handoff --restore` (or `handoff <name> --restore`). The CLI briefing is canonical — it already reads memory.json and handoff.md; no separate Memory MCP read step.
|
|
14
|
+
4. If the restore CLI failed → read `openspec/changes/<name>/handoff.md` directly.
|
|
15
|
+
5. Spawn `session-handoff` in restore mode ONLY if both the CLI and handoff.md are unavailable (Amp: isolated `subagent-session-handoff`). This is a fallback, never a routine step.
|
|
16
|
+
6. Free-form continue/next/«далі» with one active change → execute `Handoff.next_command`.
|
|
17
|
+
7. Only then start phase work (spawn a specialist when the phase routing requires one).
|
|
19
18
|
|
|
20
|
-
## Exit (order)
|
|
21
|
-
1.
|
|
22
|
-
2.
|
|
23
|
-
3. `
|
|
24
|
-
4.
|
|
19
|
+
## Session Exit (order)
|
|
20
|
+
1. The parent writes `openspec/changes/<name>/handoff.md` itself: Closed role, Change, Done, Decisions, Blocked, Next command, Next role, Attach, Subagents to spawn, Constraints.
|
|
21
|
+
2. `npx agent-orchestrator-kit handoff <name>` — require exit 0 (upserts absolute-path Memory JSON, prints the expanded prompt on stdout).
|
|
22
|
+
3. Spawn `session-handoff` in persist mode ONLY if step 2 failed (Amp: isolated `subagent-session-handoff`). Fallback, never routine.
|
|
23
|
+
4. Memory MCP is an optional mirror: if tools are available, update `Change:<name>`, `Handoff:<name>`, `Decision:*` in one call; unavailability never blocks closing.
|
|
25
24
|
5. Paste CLI stdout as one fenced block. First line `/opsx:…`. Body uses `project.agent_language`. Self-contained (Done/Decisions/Blocked/spawn/HARD STOP). No banner.
|
|
26
25
|
6. Stop. Next role = new chat.
|
|
27
26
|
|
|
27
|
+
## Archive exception
|
|
28
|
+
`npx agent-orchestrator-kit archive <name>` writes the final `handoff.md` (`next_command: none`) in the archive folder and upserts memory itself. After a successful archive no fenced next-prompt is required — the pipeline is complete.
|
|
29
|
+
|
|
28
30
|
Memory MCP: launcher `node scripts/memory-mcp-launcher.cjs`, never a relative `MEMORY_FILE_PATH`.
|
|
@@ -42,26 +42,25 @@ Read `.agents/orchestrator.yaml` for project-specific config (language, flags, M
|
|
|
42
42
|
| Quick (MVP) | `/opsx:quick <name>` | specs+code | strong | `openspec/changes/` + `src/` |
|
|
43
43
|
| Verifier | CI / local scripts | — | — | exit codes |
|
|
44
44
|
|
|
45
|
-
## Conductor Routing (
|
|
46
|
-
|
|
47
|
-
The parent `/opsx:*` session is the conductor.
|
|
48
|
-
|
|
49
|
-
| Phase / signal |
|
|
50
|
-
|
|
51
|
-
| Status, gate failure, next command | `openspec-guide` |
|
|
52
|
-
|
|
|
53
|
-
| Broken kit, MCP, or generated-file sync | `setup-doctor` |
|
|
54
|
-
| `/opsx:explore` repository investigation | `codebase-explorer` |
|
|
55
|
-
| `/opsx:design` | `design-intake` |
|
|
56
|
-
| `/opsx:propose` | `spec-architect` |
|
|
57
|
-
| `/opsx:review` | `spec-reviewer` |
|
|
58
|
-
| Apply task with design brief/Figma/image | `design-implementer` |
|
|
59
|
-
| Apply
|
|
60
|
-
| Apply
|
|
61
|
-
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
`spec-reviewer` is not `code-reviewer`. During apply, specialists MUST NOT edit `tasks.md`; only the conductor may mark a checkbox after a `Status: done` report and verification that the reported files exist.
|
|
45
|
+
## Conductor Routing (Differentiated by Phase)
|
|
46
|
+
|
|
47
|
+
The parent `/opsx:*` session is the conductor. Delegation cost must match phase uncertainty: **propose and review MUST spawn their specialist** (the parent never writes artifacts or the verdict); **apply is parent-driven** — the parent writes code and tests itself from `tasks.md` + `apply-notes.md`, subagents are optional; **archive is one CLI call** — phase subagents are forbidden.
|
|
48
|
+
|
|
49
|
+
| Phase / signal | Subagent | Status |
|
|
50
|
+
|----------------|------------|--------|
|
|
51
|
+
| Status, gate failure, next command | `openspec-guide` | optional |
|
|
52
|
+
| Restore/persist when handoff CLI failed | `session-handoff` | fallback only |
|
|
53
|
+
| Broken kit, MCP, or generated-file sync | `setup-doctor` | on signal |
|
|
54
|
+
| `/opsx:explore` repository investigation | `codebase-explorer` | mandatory |
|
|
55
|
+
| `/opsx:design` | `design-intake` | mandatory |
|
|
56
|
+
| `/opsx:propose` | `spec-architect` | mandatory |
|
|
57
|
+
| `/opsx:review` (Tier 2, after `gate-check --review` passes) | `spec-reviewer` | mandatory |
|
|
58
|
+
| Apply task with design brief/Figma/image | `design-implementer` | mandatory on signal |
|
|
59
|
+
| Apply: ≥ 2 independent tasks with no shared files, or explicit user request | `code-writer` / `test-writer` | optional |
|
|
60
|
+
| Apply before PR/MR | `code-reviewer` | optional |
|
|
61
|
+
| `/opsx:archive` | — run `npx agent-orchestrator-kit archive <name>` | CLI; phase subagent forbidden (`spec-archiver` = CLI-failure fallback only) |
|
|
62
|
+
|
|
63
|
+
`spec-reviewer` is not `code-reviewer`. Spawned specialists MUST NOT edit `tasks.md`; the parent checks a box only after verifying the task's Done-when condition. If an apply task requires information beyond its Files/Do/Done-when contract + `apply-notes.md` + referenced artifacts, STOP: record the gap in `handoff.md` and route back to `/opsx:propose <name>` — improvisation is forbidden.
|
|
65
64
|
|
|
66
65
|
## Handoff Protocol
|
|
67
66
|
|
|
@@ -127,6 +126,7 @@ After PR merged + CI green:
|
|
|
127
126
|
```
|
|
128
127
|
/opsx:archive <name>
|
|
129
128
|
```
|
|
129
|
+
Archive is one deterministic CLI call — `npx agent-orchestrator-kit archive <name> [--sync | --no-sync --force]` — which checks gates, merges delta specs on `--sync`, moves the change to the dated archive, validates with rollback, and writes the final handoff. No phase subagent.
|
|
130
130
|
|
|
131
131
|
## Session Rules
|
|
132
132
|
|
|
@@ -145,12 +145,11 @@ After PR merged + CI green:
|
|
|
145
145
|
- Never edit files outside your role's allowed output
|
|
146
146
|
|
|
147
147
|
**End of each session (HARD STOP — you are NOT done):**
|
|
148
|
-
1.
|
|
149
|
-
2.
|
|
150
|
-
3.
|
|
151
|
-
4.
|
|
152
|
-
5.
|
|
153
|
-
6. Do not start the next phase in this chat. If apply, include build/lint status in the persisted Done section.
|
|
148
|
+
1. Write `openspec/changes/<name>/handoff.md` in the parent using the template below.
|
|
149
|
+
2. Run `npx agent-orchestrator-kit handoff <name>` and require exit 0. The CLI upserts Memory JSON with an absolute path and prints the expanded self-contained prompt on stdout. Spawn `session-handoff` in persist mode ONLY if this CLI step failed.
|
|
150
|
+
3. If Memory MCP tools are available, mirror `Change:<name>`, `Handoff:<name>`, and new `Decision:<topic>` entities in one call — optional; its absence never blocks closing.
|
|
151
|
+
4. Paste the CLI stdout as one fenced next-session prompt. First line is `/opsx:<next> <name>`; body uses `project.agent_language`; keep Done/Decisions/Blocked/spawn/HARD STOP complete. No banner. Do not emit a thin “read Memory” stub.
|
|
152
|
+
5. Do not start the next phase in this chat. If apply, include build/lint status in the persisted Done section.
|
|
154
153
|
|
|
155
154
|
`handoff.md` template:
|
|
156
155
|
|
|
@@ -213,9 +212,9 @@ The Prompt section is overwritten by `npx agent-orchestrator-kit handoff <name>`
|
|
|
213
212
|
|
|
214
213
|
## Mandatory Memory and Handoff Protocol
|
|
215
214
|
|
|
216
|
-
Before specialist work, the
|
|
215
|
+
Before specialist work, the parent MUST restore context in order: honor the pasted `/opsx:*` command; run `npx agent-orchestrator-kit handoff --restore` (the CLI briefing is canonical — no separate Memory MCP read step); if the CLI failed, read `openspec/changes/<name>/handoff.md`; spawn `session-handoff` in restore mode ONLY when both failed. Missing Memory MCP never blocks a session. With one active change, free-form “continue” uses `Handoff.next_command` instead of asking for the phase. Amp spawns any needed subagent as an isolated `subagent-*` skill.
|
|
217
216
|
|
|
218
|
-
Before declaring a session closed, the
|
|
217
|
+
Before declaring a session closed, the parent MUST, in order: (1) write `openspec/changes/<name>/handoff.md` itself, (2) run `npx agent-orchestrator-kit handoff <name>` (exit 0) — spawn `session-handoff` persist ONLY if this CLI step failed, (3) paste the CLI stdout prompt whose first line is `/opsx:<next> <name>`. Memory MCP mirroring is an optional single call. The prompt has no `NEXT_SESSION_PROMPT` label, uses `project.agent_language`, and MUST be self-contained (Done, Decisions, Blocked, attach, spawn, HARD STOP) so the next thread can run if Memory MCP is ignored. Never start the next phase in the current chat.
|
|
219
218
|
|
|
220
219
|
| Entity | Required fields |
|
|
221
220
|
|--------|-----------------|
|
|
@@ -13,7 +13,9 @@ Implement tasks from an OpenSpec change.
|
|
|
13
13
|
|
|
14
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
15
|
|
|
16
|
-
**
|
|
16
|
+
**Parent-driven apply:** the parent reads `tasks.md` + `apply-notes.md` (open `design.md`/`proposal.md` only when a task explicitly references them or a contract field is incomplete) and writes code and tests itself, task by task, checking its own `tasks.md` checkboxes. Subagents are optional: spawn `code-writer`/`test-writer` for ≥ 2 independent tasks with no shared files (parallelization) or on explicit user request. `design-implementer` remains mandatory for tasks with a design-brief/Figma signal.
|
|
17
|
+
|
|
18
|
+
**Escape valve (STOP — improvisation is forbidden):** if a task requires information beyond its Files/Do/Done-when + `apply-notes.md` + artifacts it explicitly references, STOP: record the gap in `handoff.md`, set the next command to `/opsx:propose <name>` (plan amendment), and end the session. Do not guess.
|
|
17
19
|
|
|
18
20
|
**Steps**
|
|
19
21
|
|
|
@@ -54,12 +56,9 @@ Implement tasks from an OpenSpec change.
|
|
|
54
56
|
|
|
55
57
|
**Workspace guard:** If status JSON reports `actionContext.mode: "workspace-planning"` and `allowedEditRoots` is empty, explain that full workspace apply is not supported in this slice. Treat linked repos and folders as read-only context, ask the user to select an affected area through an explicit implementation workflow, and STOP before editing files.
|
|
56
58
|
|
|
57
|
-
4. **Read
|
|
59
|
+
4. **Read the working set**
|
|
58
60
|
|
|
59
|
-
Read
|
|
60
|
-
The files depend on the schema being used:
|
|
61
|
-
- **spec-driven**: proposal, specs, design, tasks
|
|
62
|
-
- Other schemas: follow the contextFiles from CLI output
|
|
61
|
+
Read `tasks.md` and `apply-notes.md` — they are the primary input for apply. Open `design.md`, `proposal.md`, or delta specs only when a task explicitly references them or a contract field is incomplete. For non-spec-driven schemas, follow `contextFiles` from the CLI output.
|
|
63
62
|
|
|
64
63
|
5. **Show current progress**
|
|
65
64
|
|
|
@@ -73,15 +72,13 @@ Implement tasks from an OpenSpec change.
|
|
|
73
72
|
|
|
74
73
|
For each pending task:
|
|
75
74
|
- Show which task is being worked on
|
|
76
|
-
-
|
|
77
|
-
- Verify
|
|
78
|
-
-
|
|
79
|
-
- Only then, as conductor, mark the task complete in the tasks file: `- [ ]` → `- [x]`
|
|
75
|
+
- Implement it in the parent session from its Files/Do/Done-when contract (spawn `code-writer`/`test-writer` only for ≥ 2 independent tasks with no shared files, or on explicit user request; `design-implementer` for design-brief/Figma tasks)
|
|
76
|
+
- Verify the task's Done-when condition actually holds
|
|
77
|
+
- Mark the task complete in the tasks file: `- [ ]` → `- [x]`
|
|
80
78
|
- Continue to next task
|
|
81
79
|
|
|
82
|
-
**
|
|
83
|
-
-
|
|
84
|
-
- Implementation reveals a design issue → suggest updating artifacts
|
|
80
|
+
**STOP (escape valve) if:**
|
|
81
|
+
- The task requires information beyond its contract + `apply-notes.md` + referenced artifacts → record the gap in `handoff.md`, next command `/opsx:propose <name>` — never improvise
|
|
85
82
|
- Error or blocker encountered → report and wait for guidance
|
|
86
83
|
- User interrupts
|
|
87
84
|
|
|
@@ -146,13 +143,11 @@ What would you like to do?
|
|
|
146
143
|
|
|
147
144
|
**Guardrails**
|
|
148
145
|
- Keep going through tasks until done or blocked
|
|
149
|
-
- Always read
|
|
150
|
-
- If task is
|
|
151
|
-
-
|
|
152
|
-
-
|
|
153
|
-
-
|
|
154
|
-
- Pause on errors, blockers, or unclear requirements - don't guess
|
|
155
|
-
- Use contextFiles from CLI output, don't assume specific file names
|
|
146
|
+
- Always read `tasks.md` + `apply-notes.md` before starting
|
|
147
|
+
- If a task contract is insufficient, STOP via the escape valve — don't guess or improvise
|
|
148
|
+
- Keep code changes minimal and scoped to each task's `Files:` list
|
|
149
|
+
- Never let a spawned specialist update `tasks.md`; the parent checks a box only after verifying Done-when
|
|
150
|
+
- Pause on errors and blockers
|
|
156
151
|
|
|
157
152
|
**Fluid Workflow Integration**
|
|
158
153
|
|
|
@@ -9,115 +9,28 @@ metadata:
|
|
|
9
9
|
generatedBy: "1.4.1"
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
Archive a completed change
|
|
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,
|
|
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. **
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
25
|
+
npx agent-orchestrator-kit archive <name> [--sync | --no-sync --force]
|
|
90
26
|
```
|
|
91
27
|
|
|
92
|
-
|
|
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
|
-
|
|
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
|
-
-
|
|
118
|
-
-
|
|
119
|
-
-
|
|
120
|
-
-
|
|
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:
|
|
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
|
-
|
|
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
|
|
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
|
|
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:
|