agent-orchestrator-kit 0.1.13 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +18 -11
  3. package/bin/agent-orchestrator.js +558 -2
  4. package/package.json +2 -2
  5. package/profiles/generic/orchestrator.yaml +3 -0
  6. package/profiles/mvp/orchestrator.yaml +3 -0
  7. package/profiles/node/orchestrator.yaml +3 -0
  8. package/profiles/vue3/orchestrator.yaml +3 -0
  9. package/templates/.agents/amp.settings.json.example +2 -5
  10. package/templates/.agents/commands/opsx-apply.md +10 -3
  11. package/templates/.agents/commands/opsx-archive.md +10 -3
  12. package/templates/.agents/commands/opsx-design.md +10 -3
  13. package/templates/.agents/commands/opsx-explore.md +10 -3
  14. package/templates/.agents/commands/opsx-propose.md +10 -3
  15. package/templates/.agents/commands/opsx-quick.md +10 -3
  16. package/templates/.agents/commands/opsx-review.md +10 -3
  17. package/templates/.agents/mcp.json.example +2 -5
  18. package/templates/.agents/rules/agent-orchestration.mdc +17 -10
  19. package/templates/.agents/rules/cli-via-npm.mdc +2 -1
  20. package/templates/.agents/rules/memory-mcp-autosetup.mdc +24 -11
  21. package/templates/.agents/rules/session-handoff.mdc +46 -0
  22. package/templates/.agents/skills/agent-orchestration/SKILL.md +36 -19
  23. package/templates/.agents/subagents/session-handoff.md +48 -0
  24. package/templates/.agents/subagents/setup-doctor.md +1 -1
  25. package/templates/AGENTS.md +8 -3
  26. package/templates/CLAUDE.md +5 -2
  27. package/templates/orchestrator.yaml +6 -0
  28. package/templates/scripts/memory-mcp-launcher.cjs +46 -0
  29. package/templates/scripts/sync-local-agent-skills.sh +1 -1
@@ -10,7 +10,7 @@ Diagnosis steps:
10
10
  1. Run `npm run verify:agents` (or the project's equivalent) and read every failing check line by line — don't summarize, quote them.
11
11
  2. Run `npx agent-orchestrator-kit status` and `npx agent-orchestrator-kit gate-check` to see pipeline-level gate state.
12
12
  3. Check `.agents/orchestrator.yaml` → `kit_version` against the installed package version; flag drift.
13
- 4. Check that `.mcp.json` / `.amp/settings.json` exist (copy from their `.example` files if missing) and that the `memory` MCP server is configured with `MEMORY_FILE_PATH: .cursor/memory.json`.
13
+ 4. Check that `.mcp.json` / `.amp/settings.json` exist and that Memory MCP uses `node scripts/memory-mcp-launcher.cjs` (never a relative `MEMORY_FILE_PATH`). If the path is relative or the launcher is missing, run `npx agent-orchestrator-kit memory-setup`.
14
14
  5. Optional Figma: run `npx agent-orchestrator-kit figma-status`. If not configured, tell the user to run `npx agent-orchestrator-kit figma-setup` and edit `.agents/figma.local.env` locally — **never ask them to paste the token into chat**. Confirm `.gitignore` contains `.agents/figma.local.env` and that `scripts/figma-mcp-launcher.cjs` exists.
15
15
  6. Check `.cursor/skills/`, `.cursor/rules/`, `.cursor/agents/` (and `.claude/` equivalents) are present and not stale relative to `.agents/` — if stale, this is fixed by running `sync`, not by hand-editing.
16
16
 
@@ -34,6 +34,7 @@ The parent `/opsx:*` session is a **conductor**: it restores handoff state, spaw
34
34
  | Phase / signal | Subagent |
35
35
  |----------------|----------|
36
36
  | Status, gate failure, next command | `openspec-guide` |
37
+ | Session start restore / session exit persist | `session-handoff` |
37
38
  | Broken kit, MCP, or sync | `setup-doctor` |
38
39
  | `/opsx:explore` repository research | `codebase-explorer` |
39
40
  | `/opsx:design` | `design-intake` |
@@ -90,11 +91,15 @@ See `.agents/orchestrator.yaml` for role config, pipeline flags, and MCP baselin
90
91
 
91
92
  ## Session Handoff
92
93
 
93
- At session start: honor the pasted `/opsx:*` command, read Memory `Change:<name>`, `Handoff:<name>`, `Decision:*`, then fall back to `openspec/changes/<name>/handoff.md` when Memory is unavailable or empty.
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.
94
95
 
95
- At exit, in order: update Memory write `handoff.md` print one fenced next-session prompt beginning with `/opsx:*`. The prompt body uses `project.agent_language`, asks the next session to read Memory, has no service banner, and does not repeat the full summary. Never start the next phase in the current chat.
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).
96
97
 
97
- OpenSpec artifacts remain the source of truth for requirements and tasks. Memory and `handoff.md` are only a durable index of the current phase, decisions, blockers, and next command.
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.
98
103
 
99
104
  ### Optional: Figma personal token
100
105
 
@@ -36,6 +36,7 @@ The parent command session is a conductor. It MUST spawn the phase specialist an
36
36
  | Signal | Subagent |
37
37
  |--------|----------|
38
38
  | Status / next command | `openspec-guide` |
39
+ | Session restore / persist / next-thread prompt | `session-handoff` |
39
40
  | Kit / MCP / sync failure | `setup-doctor` |
40
41
  | Explore research | `codebase-explorer` |
41
42
  | Design intake | `design-intake` |
@@ -57,9 +58,11 @@ The parent command session is a conductor. It MUST spawn the phase specialist an
57
58
 
58
59
  ## Session Handoff
59
60
 
60
- Before work, read Memory `Change:<name>`, `Handoff:<name>`, `Decision:*`; if unavailable or empty, read `openspec/changes/<name>/handoff.md`. At exit: Memory → `handoff.md` one fenced `/opsx:*` prompt localized to `project.agent_language`, with no banner or duplicated summary. Do not begin the next phase in the same chat.
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.
61
62
 
62
- OpenSpec files are the requirements/tasks source of truth. Memory and `handoff.md` only index phase state, decisions, blockers, and the next command.
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.
63
66
 
64
67
  ## File Locations
65
68
 
@@ -49,10 +49,13 @@ handoff:
49
49
  restore_on_start: true
50
50
  persist_on_exit: true
51
51
  emit_next_session_prompt: true
52
+ prompt_self_contained: true
53
+ spawn_handoff_subagent: true
52
54
 
53
55
  memory:
54
56
  enabled: true
55
57
  file: .cursor/memory.json
58
+ launcher: scripts/memory-mcp-launcher.cjs
56
59
 
57
60
  mcp:
58
61
  baseline:
@@ -76,6 +79,9 @@ verifier:
76
79
  cli:
77
80
  status: npx agent-orchestrator-kit status
78
81
  gate_check: npx agent-orchestrator-kit gate-check
82
+ handoff: npx agent-orchestrator-kit handoff <name>
83
+ handoff_restore: npx agent-orchestrator-kit handoff --restore
84
+ memory_setup: npx agent-orchestrator-kit memory-setup
79
85
  openspec_list: npx openspec list
80
86
  openspec_validate_change: npx openspec validate <name> --strict --type change
81
87
  openspec_validate_all: npx openspec validate --all --strict
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+ const { spawn } = require('child_process');
3
+ const { existsSync, mkdirSync } = require('fs');
4
+ const { dirname, join } = require('path');
5
+
6
+ function findProjectDir(startDir) {
7
+ let dir = startDir;
8
+ while (dir !== dirname(dir)) {
9
+ if (
10
+ existsSync(join(dir, 'AGENTS.md')) ||
11
+ existsSync(join(dir, '.agents', 'orchestrator.yaml'))
12
+ ) {
13
+ return dir;
14
+ }
15
+ dir = dirname(dir);
16
+ }
17
+ return join(startDir, '..');
18
+ }
19
+
20
+ const projectDir = findProjectDir(__dirname);
21
+ const cursorDir = join(projectDir, '.cursor');
22
+ const memoryFile = join(cursorDir, 'memory.json');
23
+
24
+ mkdirSync(cursorDir, { recursive: true });
25
+
26
+ const child = spawn('npx', ['-y', '@modelcontextprotocol/server-memory'], {
27
+ stdio: 'inherit',
28
+ env: {
29
+ ...process.env,
30
+ MEMORY_FILE_PATH: memoryFile,
31
+ },
32
+ shell: process.platform === 'win32',
33
+ });
34
+
35
+ child.on('exit', (code, signal) => {
36
+ if (signal) {
37
+ process.kill(process.pid, signal);
38
+ return;
39
+ }
40
+ process.exit(code == null ? 1 : code);
41
+ });
42
+
43
+ child.on('error', (error) => {
44
+ console.error(`[memory-mcp-launcher] Failed to start memory MCP: ${error.message}`);
45
+ process.exit(1);
46
+ });
@@ -50,7 +50,7 @@ if [ -d .agents/subagents ]; then
50
50
  echo ""
51
51
  echo "<!-- AUTO-GENERATED from ${sub} — edit the source file, then re-run this script -->"
52
52
  echo ""
53
- echo "Parent MUST spawn this skill as an isolated subagent with fresh context. Do not execute it in the main thread. Return only the structured subagent report."
53
+ echo "CRITICAL (Amp / Cursor / Claude): Parent MUST spawn this skill as an isolated subagent with fresh context. Do not execute it in the main thread. If spawn is unavailable, STOP and report blocked — do not perform this specialist's work in the parent. Return only the structured subagent report."
54
54
  echo ""
55
55
  awk '/^---$/{c++; next} c>=2{print}' "$sub"
56
56
  } > "$DIR/SKILL.md"