@sulhadin/orchestrator 3.0.0-beta.9 → 3.1.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 (49) hide show
  1. package/README.md +17 -13
  2. package/bin/build-template.js +34 -5
  3. package/bin/index.js +26 -8
  4. package/package.json +2 -2
  5. package/template/.claude-plugin/plugin.json +10 -0
  6. package/template/.orchestra/README.md +93 -45
  7. package/template/.orchestra/config.yml +9 -4
  8. package/template/.orchestra/knowledge.md +1 -1
  9. package/template/.orchestra/roles/product-manager.md +43 -11
  10. package/template/CLAUDE.md +18 -2
  11. package/template/{.claude/agents → agents}/conductor.md +174 -16
  12. package/template/{.claude/agents → agents}/reviewer.md +1 -1
  13. package/template/{.claude/commands/orchestra → commands}/help.md +3 -1
  14. package/template/commands/rewind.md +60 -0
  15. package/template/{.claude/commands/orchestra → commands}/start.md +6 -2
  16. package/template/{.claude/commands/orchestra → commands}/status.md +2 -2
  17. package/template/commands/verifier.md +52 -0
  18. package/bin/merge-config.test.js +0 -135
  19. /package/template/{.claude/commands/orchestra → commands}/adaptive.md +0 -0
  20. /package/template/{.claude/commands/orchestra → commands}/architect.md +0 -0
  21. /package/template/{.claude/commands/orchestra → commands}/backend.md +0 -0
  22. /package/template/{.claude/commands/orchestra → commands}/blueprint.md +0 -0
  23. /package/template/{.claude/commands/orchestra → commands}/create-role.md +0 -0
  24. /package/template/{.claude/commands/orchestra → commands}/frontend.md +0 -0
  25. /package/template/{.claude/commands/orchestra → commands}/hotfix.md +0 -0
  26. /package/template/{.claude/commands/orchestra → commands}/orchestrator.md +0 -0
  27. /package/template/{.claude/commands/orchestra → commands}/pm.md +0 -0
  28. /package/template/{.claude/rules → rules}/acceptance-check.orchestra.md +0 -0
  29. /package/template/{.claude/rules → rules}/code-standards.orchestra.md +0 -0
  30. /package/template/{.claude/rules → rules}/commit-format.orchestra.md +0 -0
  31. /package/template/{.claude/rules → rules}/phase-limits.orchestra.md +0 -0
  32. /package/template/{.claude/rules → rules}/role-boundaries.orchestra.md +0 -0
  33. /package/template/{.claude/rules → rules}/stuck-detection.orchestra.md +0 -0
  34. /package/template/{.claude/rules → rules}/testing-standards.orchestra.md +0 -0
  35. /package/template/{.claude/rules → rules}/verification-gate.orchestra.md +0 -0
  36. /package/template/{.claude/skills → skills}/accessibility.orchestra.md +0 -0
  37. /package/template/{.claude/skills → skills}/auth-setup.orchestra.md +0 -0
  38. /package/template/{.claude/skills → skills}/best-practices.orchestra.md +0 -0
  39. /package/template/{.claude/skills → skills}/code-optimizer.orchestra.md +0 -0
  40. /package/template/{.claude/skills → skills}/core-web-vitals.orchestra.md +0 -0
  41. /package/template/{.claude/skills → skills}/crud-api.orchestra.md +0 -0
  42. /package/template/{.claude/skills → skills}/debug.orchestra.md +0 -0
  43. /package/template/{.claude/skills → skills}/deployment.orchestra.md +0 -0
  44. /package/template/{.claude/skills → skills}/frontend-design.orchestra.md +0 -0
  45. /package/template/{.claude/skills → skills}/fullstack-infrastructure.orchestra.md +0 -0
  46. /package/template/{.claude/skills → skills}/react-best-practices.orchestra.md +0 -0
  47. /package/template/{.claude/skills → skills}/review.orchestra.md +0 -0
  48. /package/template/{.claude/skills → skills}/testing.orchestra.md +0 -0
  49. /package/template/{.claude/skills → skills}/web-quality-audit.orchestra.md +0 -0
package/README.md CHANGED
@@ -4,7 +4,7 @@ AI team orchestration for [Claude Code](https://docs.anthropic.com/en/docs/claud
4
4
 
5
5
  ## What is Orchestra?
6
6
 
7
- Orchestra turns a single Claude Code session into a coordinated development team. A Product Manager plans features, a Conductor executes them — switching between specialized roles (backend, frontend, architect) automatically. Each role has strict boundaries, every commit passes verification, and the system learns from past milestones.
7
+ Orchestra turns a single Claude Code session into a coordinated development team. A Product Manager plans features, a Conductor orchestrates them — delegating each phase to a sub-agent with the right role (backend, frontend, architect). Sub-agents own implementation and verification; conductor owns commits. Each role has strict boundaries, every commit passes verification, and the system learns from past milestones.
8
8
 
9
9
  No infrastructure. No API keys. Just markdown files and Claude Code.
10
10
 
@@ -23,12 +23,12 @@ Terminal 1 (PM): Terminal 2 (Conductor):
23
23
  /orchestra pm /orchestra start
24
24
  │ │
25
25
  ├─ Discuss features ├─ Scan milestones
26
- ├─ Create milestones ├─ Activate architect → RFC
27
- ├─ Groom phases ├─ Activate backend → code + tests
28
- │ ├─ Activate frontend → UI
26
+ ├─ Create milestones ├─ Delegate to architect → RFC
27
+ ├─ Groom phases ├─ Delegate to backend → code + tests
28
+ │ ├─ Delegate to frontend → UI
29
29
  │ (plan M2 while M1 runs) ├─ Call reviewer → code review
30
30
  │ ├─ Push → milestone done
31
- │ └─ Loop next milestone
31
+ │ └─ Stop (inline) or next milestone (agent)
32
32
  ```
33
33
 
34
34
  ## Quick Example
@@ -49,8 +49,7 @@ PM challenges scope, creates M1-user-auth with 3 phases
49
49
  ⚙️ backend → phase-2: API endpoints → committed
50
50
  🎨 frontend → phase-3: Login UI → committed
51
51
  🔍 reviewer → approved
52
- 🚦 Push? yes
53
- ✅ M1-user-auth done. Checking for next milestone...
52
+ M1-user-auth done. Pushed to origin.
54
53
  ```
55
54
 
56
55
  ## Commands
@@ -63,6 +62,8 @@ PM challenges scope, creates M1-user-auth with 3 phases
63
62
  | `/orchestra start --auto` | Fully autonomous — warns once, then auto-push |
64
63
  | `/orchestra hotfix {desc}` | Ultra-fast fix: implement → verify → commit → push |
65
64
  | `/orchestra status` | Milestone status report (PM only) |
65
+ | `/orchestra verifier [N]` | Verify milestones match PRD/RFC requirements (PM only) |
66
+ | `/orchestra rewind [N]` | Review execution history: decisions, metrics, insights (PM only) |
66
67
  | `/orchestra blueprint {name}` | Generate milestones from template |
67
68
  | `/orchestra blueprint add` | Save current work as reusable template |
68
69
  | `/orchestra create-role` | Create a new role interactively (Orchestrator only) |
@@ -86,7 +87,7 @@ PM challenges scope, creates M1-user-auth with 3 phases
86
87
  │ ├── conductor.md ← Autonomous milestone executor
87
88
  │ └── reviewer.md ← Independent code review
88
89
  ├── skills/*.orchestra.md ← 14 domain checklists
89
- ├── rules/*.orchestra.md ← 8 discipline rules
90
+ ├── rules/*.orchestra.md ← Discipline rules (auto-loaded)
90
91
  └── commands/orchestra/ ← /orchestra commands
91
92
 
92
93
  .orchestra/ ← Project data + config
@@ -101,10 +102,11 @@ PM challenges scope, creates M1-user-auth with 3 phases
101
102
 
102
103
  **Config-driven pipeline** — `.orchestra/config.yml` controls everything: verification commands (customize for Go, Python, Rust), approval gates, thresholds, parallel execution. No hardcoded assumptions.
103
104
 
104
- **Three complexity levels** — PM sets per milestone:
105
- - `quick` Engineer Commit Push (trivial changes)
106
- - `standard` Engineer Review Push (typical features)
107
- - `full` Architect Engineer Review → Push (complex work)
105
+ **Four complexity levels with model tiering** — PM sets per phase:
106
+ - `trivial` (haiku)Config changes, version bumps
107
+ - `quick` (sonnet)Single-file fixes, simple CRUD
108
+ - `standard` (sonnet)Typical features (default)
109
+ - `complex` (opus) → New subsystems, architectural changes
108
110
 
109
111
  **Verification gate** — Tests + lint must pass before every commit. Commands come from config. Fails 3 times → phase marked failed, escalated to user.
110
112
 
@@ -116,6 +118,8 @@ PM challenges scope, creates M1-user-auth with 3 phases
116
118
 
117
119
  **Role boundaries** — Enforced via `.claude/rules/`. PM cannot write code. Engineers cannot modify system files. Orchestrator cannot write features. Boundaries checked by file path, not by words.
118
120
 
121
+ **Milestone isolation** — `inline` mode stops after each milestone (user compacts manually). `agent` mode spawns each milestone in its own sub-agent — context freed automatically, enabling 20+ milestones in a single `--auto` session.
122
+
119
123
  **Stuck detection** — Detects repeated failures, circular fixes, over-engineering. Tries different approach once, then escalates. Auto mode skips to next phase.
120
124
 
121
125
  ## Upgrading
@@ -135,7 +139,7 @@ Smart merge on upgrade:
135
139
  | Blueprints (your custom) | Preserved |
136
140
  | milestones/ | Untouched |
137
141
  | knowledge.md | Preserved |
138
- | config.yml | Preserved |
142
+ | config.yml | Smart merged (user values preserved, new keys added) |
139
143
 
140
144
  ## Documentation
141
145
 
@@ -6,12 +6,32 @@ const path = require("path");
6
6
  const rootDir = process.cwd();
7
7
  const templateDir = path.join(rootDir, "template");
8
8
 
9
- // System files to include in the template
9
+ // Dev-only agents that should NOT be published to users
10
+ const DEV_ONLY_AGENTS = new Set([
11
+ "codebase-deep-analyzer.md",
12
+ "orchestra-analyzer.md",
13
+ "orchestra-reviewer.md",
14
+ "repo-deep-analyzer.md",
15
+ ]);
16
+
17
+ // Plugin manifest
18
+ const PLUGIN_MANIFEST = {
19
+ name: "orchestra",
20
+ description: "AI Team Orchestration — multi-role coordination with milestones, phases, and quality gates for Claude Code",
21
+ version: require("../package.json").version,
22
+ author: { name: "Sulhadin Öney" },
23
+ repository: "https://github.com/sulhadin/orchestrator",
24
+ license: "MIT",
25
+ };
26
+
27
+ // System files to include in the template (plugin-compatible structure)
28
+ // Plugin dirs (agents/, commands/, skills/, rules/) go at root level
29
+ // .orchestra/ and CLAUDE.md also go at root level
10
30
  const SYSTEM_PATHS = [
11
- { src: ".claude/agents", dest: ".claude/agents" },
12
- { src: ".claude/commands/orchestra", dest: ".claude/commands/orchestra" },
13
- { src: ".claude/rules", dest: ".claude/rules", filter: (f) => f.endsWith(".orchestra.md") },
14
- { src: ".claude/skills", dest: ".claude/skills", filter: (f) => f.endsWith(".orchestra.md") },
31
+ { src: ".claude/agents", dest: "agents", filter: (f) => !DEV_ONLY_AGENTS.has(f) },
32
+ { src: ".claude/commands/orchestra", dest: "commands" },
33
+ { src: ".claude/rules", dest: "rules", filter: (f) => f.endsWith(".orchestra.md") },
34
+ { src: ".claude/skills", dest: "skills", filter: (f) => f.endsWith(".orchestra.md") },
15
35
  { src: ".orchestra/roles", dest: ".orchestra/roles" },
16
36
  { src: ".orchestra/blueprints", dest: ".orchestra/blueprints" },
17
37
  { src: ".orchestra/config.yml", dest: ".orchestra/config.yml" },
@@ -74,5 +94,14 @@ for (const item of SYSTEM_PATHS) {
74
94
  console.log(` [+] Packed: ${item.src}`);
75
95
  }
76
96
 
97
+ // Write plugin manifest
98
+ const pluginDir = path.join(templateDir, ".claude-plugin");
99
+ ensureDir(pluginDir);
100
+ fs.writeFileSync(
101
+ path.join(pluginDir, "plugin.json"),
102
+ JSON.stringify(PLUGIN_MANIFEST, null, 2) + "\n"
103
+ );
104
+ console.log(" [+] Generated .claude-plugin/plugin.json");
105
+
77
106
  console.log("\n Done! Template is updated and ready for release.");
78
107
  console.log(" Run 'yarn build' to test the installation from this template.\n");
package/bin/index.js CHANGED
@@ -6,6 +6,14 @@ const path = require("path");
6
6
  const targetDir = process.cwd();
7
7
  const templateDir = path.join(__dirname, "..", "template");
8
8
 
9
+ // Plugin-to-standalone mapping: plugin root dirs → .claude/ subdirs
10
+ const PLUGIN_TO_CLAUDE = {
11
+ agents: ".claude/agents",
12
+ commands: ".claude/commands/orchestra",
13
+ rules: ".claude/rules",
14
+ skills: ".claude/skills",
15
+ };
16
+
9
17
  const ORCHESTRA_SECTION_START = "<!-- orchestra -->";
10
18
  const ORCHESTRA_SECTION_END = "<!-- /orchestra -->";
11
19
 
@@ -295,7 +303,6 @@ function run() {
295
303
  console.log("");
296
304
 
297
305
  const orchestraSrc = path.join(templateDir, ".orchestra");
298
- const claudeSrc = path.join(templateDir, ".claude");
299
306
  const orchestraDest = path.join(targetDir, ".orchestra");
300
307
  const claudeDest = path.join(targetDir, ".claude");
301
308
  const isUpgrade = fs.existsSync(orchestraDest);
@@ -384,18 +391,24 @@ function run() {
384
391
  copyDirRecursive(orchestraSrc, orchestraDest);
385
392
  console.log(" [+] .orchestra/ installed");
386
393
 
387
- if (fs.existsSync(claudeSrc)) {
388
- copyDirRecursive(claudeSrc, claudeDest);
389
- console.log(" [+] .claude/ orchestra files installed");
394
+ // Copy plugin dirs → .claude/ (plugin-to-standalone mapping)
395
+ for (const [pluginDir, claudeSubdir] of Object.entries(PLUGIN_TO_CLAUDE)) {
396
+ const src = path.join(templateDir, pluginDir);
397
+ if (fs.existsSync(src)) {
398
+ const dest = path.join(targetDir, claudeSubdir);
399
+ copyDirRecursive(src, dest);
400
+ }
390
401
  }
402
+ console.log(" [+] .claude/ orchestra files installed");
391
403
 
392
404
  // ── Restore user data ──
393
405
  for (const [key, { backupPath, type, dir }] of Object.entries(backups)) {
394
406
  const baseDest = type === "orchestra" ? orchestraDest : claudeDest;
395
407
  const restorePath = path.join(baseDest, dir);
408
+ // Plugin structure: claude dirs are at template root, orchestra dirs under .orchestra/
396
409
  const templateDirPath = type === "orchestra"
397
410
  ? path.join(orchestraSrc, dir)
398
- : path.join(claudeSrc, dir);
411
+ : path.join(templateDir, dir);
399
412
 
400
413
  if (dir === "milestones") {
401
414
  if (fs.existsSync(restorePath)) rmDirRecursive(restorePath);
@@ -433,10 +446,15 @@ function run() {
433
446
  copyDirRecursive(orchestraSrc, orchestraDest);
434
447
  console.log(" [+] .orchestra/ installed");
435
448
 
436
- if (fs.existsSync(claudeSrc)) {
437
- copyDirRecursive(claudeSrc, claudeDest);
438
- console.log(" [+] .claude/ installed");
449
+ // Copy plugin dirs → .claude/ (plugin-to-standalone mapping)
450
+ for (const [pluginDir, claudeSubdir] of Object.entries(PLUGIN_TO_CLAUDE)) {
451
+ const src = path.join(templateDir, pluginDir);
452
+ if (fs.existsSync(src)) {
453
+ const dest = path.join(targetDir, claudeSubdir);
454
+ copyDirRecursive(src, dest);
455
+ }
439
456
  }
457
+ console.log(" [+] .claude/ installed");
440
458
  }
441
459
 
442
460
  // ── Handle CLAUDE.md ──
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@sulhadin/orchestrator",
3
- "version": "3.0.0-beta.9",
3
+ "version": "3.1.0",
4
4
  "description": "AI Team Orchestration System — multi-role coordination for Claude Code",
5
5
  "bin": "bin/index.js",
6
6
  "scripts": {
7
- "test": "node --test bin/**/*.test.js",
7
+ "test": "node --test test/**/*.test.js",
8
8
  "template": "node bin/build-template.js",
9
9
  "prepare": "husky"
10
10
  },
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "orchestra",
3
+ "description": "AI Team Orchestration — multi-role coordination with milestones, phases, and quality gates for Claude Code",
4
+ "version": "3.1.0",
5
+ "author": {
6
+ "name": "Sulhadin Öney"
7
+ },
8
+ "repository": "https://github.com/sulhadin/orchestrator",
9
+ "license": "MIT"
10
+ }
@@ -10,14 +10,13 @@ Terminal 1 (PM): Terminal 2 (Conductor):
10
10
  /orchestra pm /orchestra start
11
11
  │ │
12
12
  ├─ Discuss features with user ├─ Scan milestones
13
- ├─ Create milestones ├─ 🏗️ architect → RFC
13
+ ├─ Create milestones ├─ 🏗️ delegate to architect → RFC
14
14
  ├─ Groom phases ├─ 🚦 User approves RFC
15
- ├─ Always available ├─ ⚙️ backend → phase by phase
16
- │ ├─ 🎨 frontend → phase by phase
15
+ ├─ Always available ├─ ⚙️ delegate to backend → phase by phase
16
+ │ ├─ 🎨 delegate to frontend → phase by phase
17
17
  │ (can plan M2 while M1 runs) ├─ 🔍 reviewer → review commits
18
- │ ├─ 🚦 User approves push
19
18
  │ ├─ git push → milestone done
20
- │ └─ Loop next milestone
19
+ │ └─ Stop (inline) or next milestone (agent)
21
20
  ```
22
21
 
23
22
  ## Directory Structure
@@ -25,7 +24,7 @@ Terminal 1 (PM): Terminal 2 (Conductor):
25
24
  ```
26
25
  .orchestra/
27
26
  ├── README.md # This file
28
- ├── roles/ # Role identities (slim, ~15 lines each)
27
+ ├── roles/ # Role identities (one file per role)
29
28
  │ ├── product-manager.md
30
29
  │ ├── architect.md
31
30
  │ ├── backend-engineer.md
@@ -56,8 +55,10 @@ You can plan new milestones while the conductor is executing another one.
56
55
 
57
56
  ### Terminal 2: `/orchestra start` (Execution)
58
57
 
59
- Conductor reads milestones, executes phases autonomously. Activates roles per phase.
60
- Loops to the next milestone when done. Maintains `context.md` for resume capability.
58
+ Conductor reads milestones, delegates each phase to a sub-agent with the right role.
59
+ Sub-agents implement + verify; conductor commits. After milestone completion, behavior
60
+ depends on `milestone_isolation` config: stops (inline) or continues to next (agent).
61
+ Maintains `context.md` for resume capability.
61
62
 
62
63
  ```
63
64
  /orchestra start
@@ -81,7 +82,6 @@ PM discusses feature with user
81
82
  → Conductor executes frontend phases (sequential, each → commit)
82
83
  → Conductor calls reviewer agent (reviews unpushed commits)
83
84
  → FIX cycle if changes-requested (re-review if fix >= 30 lines)
84
- → [USER APPROVAL GATE: Push to origin]
85
85
  → Conductor pushes, PM verifies acceptance criteria, closes milestone
86
86
  → Conductor appends 5-line retrospective to knowledge.md
87
87
 
@@ -94,19 +94,45 @@ Hotfix (production bugs):
94
94
  ### Milestone Lock
95
95
 
96
96
  Conductor claims a milestone by writing `Locked-By: {timestamp}` to milestone.md before execution.
97
- Other conductors skip locked milestones. Lock expires after 2 hours (stale protection).
97
+ Other conductors skip locked milestones. Lock expires after config.yml `thresholds.milestone_lock_timeout` minutes (default 120).
98
98
 
99
99
  ### Pipeline Modes (Complexity)
100
100
 
101
- PM sets a `Complexity` level on each milestone that determines the pipeline:
101
+ PM sets `Complexity` on milestone (pipeline) and `complexity` on each phase (model selection):
102
102
 
103
- | Complexity | Pipeline | Use when |
104
- |------------|----------|----------|
105
- | `quick` | Engineer → Commit → Push | Config tweaks, copy changes, trivial fixes |
106
- | `standard` | EngineerReview → Push | Typical features, clear requirements |
107
- | `full` | Architect Engineer → Review → Push | Complex features, new subsystems |
103
+ | Complexity | Model | Pipeline | Use when |
104
+ |------------|-------|----------|----------|
105
+ | `trivial` | Haiku | Phases → Commit → Push | Version bumps, env vars, config changes |
106
+ | `quick` | Sonnet | Phases Commit → Push (skip review) | Single-file fixes, simple CRUD |
107
+ | `standard` | Sonnet | Phases → Review → Push | Typical features, clear requirements |
108
+ | `complex` | Opus | Architect → Phases → Review → Push | New subsystems, unfamiliar territory |
108
109
 
109
- Default is `full` if not specified. Conductor reads the `Complexity` field from `milestone.md`.
110
+ Defaults: config.yml `pipeline.default_pipeline` and `pipeline.default_complexity`.
111
+
112
+ ### Milestone Isolation
113
+
114
+ Config `pipeline.milestone_isolation` controls how the conductor handles multiple milestones:
115
+
116
+ | Mode | Behavior | Best for |
117
+ |------|----------|----------|
118
+ | `inline` (default) | Conductor runs milestone directly, **stops** after completion. User runs `/compact` then `/orchestra start` for next milestone. | Manual sessions, PC-based work |
119
+ | `agent` | Conductor spawns a sub-agent per milestone. Context freed automatically after each. Loops to next milestone. | `--auto` overnight batch runs |
120
+
121
+ ```
122
+ Inline mode: Agent mode:
123
+ /orchestra start /orchestra start --auto
124
+ → M1 executes → done → STOP → Spawn Agent(M1) → done → freed
125
+ user: /compact → Spawn Agent(M2) → done → freed
126
+ /orchestra start → Spawn Agent(M3) → done → freed
127
+ → M2 executes → done → STOP → All done
128
+ ```
129
+
130
+ In agent mode, the delegation is two-tier:
131
+ ```
132
+ Conductor (lean dispatcher)
133
+ └── Milestone Agent (fresh context)
134
+ └── Phase Agent (unchanged)
135
+ ```
110
136
 
111
137
  ### Milestone Statuses
112
138
 
@@ -142,8 +168,8 @@ Within each domain (backend/frontend), phases run in order: phase-1 → phase-2
142
168
  **Parallel execution:** If PM sets `depends_on` in phase frontmatter, independent phases
143
169
  can run in parallel via subagent worktree isolation. No `depends_on` = sequential (default).
144
170
 
145
- **Verification Gate:** Before every commit, conductor MUST pass type check + tests + lint
146
- (commands from config.yml). Commit is blocked until all checks pass.
171
+ **Verification Gate:** Sub-agents run typecheck + tests + lint (from config.yml) before reporting.
172
+ Conductor NEVER commits unless verification passes.
147
173
 
148
174
  ---
149
175
 
@@ -151,7 +177,8 @@ can run in parallel via subagent worktree isolation. No `depends_on` = sequentia
151
177
 
152
178
  - Each phase completion → **one conventional commit** on the current branch
153
179
  - No branch creation or switching — work happens on whatever branch is checked out
154
- - Milestone completion → **push to origin** (after user approval)
180
+ - Milestone completion → **push to origin** (automatic after review passes)
181
+ - Commits stay local until milestone fully completes — no partial push on failure
155
182
  - Reviewer reviews unpushed commits: `git log origin/{branch}..HEAD`
156
183
  - Clean git history: each commit maps to a phase
157
184
 
@@ -185,16 +212,14 @@ Rules:
185
212
 
186
213
  The user must approve before these transitions:
187
214
  - **Milestone creation** — PM discusses and plans, but must get user approval before creating the milestone directory and files
188
- - **RFC → Implementation** — user reviews architect's RFC
189
- - **Push to origin** — user approves the final changeset
215
+ - **RFC → Implementation** — user reviews architect's RFC (if `rfc_approval` is not `skip`)
190
216
 
191
- All other transitions are automatic.
217
+ Push is automatic after review passes. All other transitions are automatic.
192
218
 
193
219
  ### Rejection Handling
194
220
 
195
221
  If the user says **no** at any gate:
196
- - **RFC rejected** → Architect revises based on feedback, re-submits (max 3 rounds)
197
- - **Push rejected** → Conductor creates fix phase, implements, re-submits push gate
222
+ - **RFC rejected** → Architect revises based on feedback, re-submits (max config `pipeline.max_rfc_rounds`)
198
223
  - **Milestone rejected** → PM revises in PM terminal
199
224
 
200
225
  Rejections are normal. The system does not stall — it loops back with feedback.
@@ -213,12 +238,12 @@ Conductor calls reviewer agent
213
238
  → Returns: approved / approved-with-comments / changes-requested
214
239
  ```
215
240
 
216
- **If approved** → proceed to push gate.
241
+ **If approved** → push immediately.
217
242
 
218
- **If approved-with-comments** → proceed to push gate. Comments are logged in context.md.
243
+ **If approved-with-comments** → push immediately. Comments are logged in context.md.
219
244
 
220
- **If changes-requested** → Conductor switches to the relevant role, fixes
221
- and commits. Re-review triggered if fix >= config `re_review_lines` threshold.
245
+ **If changes-requested** → Conductor continues the phase's sub-agent via SendMessage with
246
+ reviewer findings. Re-review triggered if fix >= config `re_review_lines` threshold.
222
247
 
223
248
  ---
224
249
 
@@ -283,16 +308,21 @@ PM and conductor run in **separate terminals**. They communicate through milesto
283
308
 
284
309
  ### Context Persistence
285
310
 
286
- Conductor maintains `context.md` in each milestone directory. This allows:
287
- - Resume after terminal close/reopen
288
- - Track decisions made during implementation
289
- - Record what was committed in each phase
311
+ Conductor maintains `context.md` in each milestone directory with a fixed structure:
312
+ - `## Status` milestone id, start date, pipeline type
313
+ - `## Phases` per-phase status, commit hash, files changed, errors
314
+ - `## Codebase Map` scout-generated file map (survives milestone clear)
315
+ - `## Decisions` — key choices from each phase that affect later phases
316
+ - `## Metrics` — phase duration and verification retries (used by `/orchestra status`)
317
+
318
+ This enables resume after terminal close/reopen. On restart, conductor reads context.md and skips completed phases.
290
319
 
291
320
  ### Approval Gates (Conductor Terminal)
292
321
 
293
- Conductor asks the user directly (not PM) at these points:
294
- 1. **RFC ready** — "Approve RFC to start implementation?"
295
- 2. **Push to origin** — "All done. Push to origin?"
322
+ Conductor asks the user directly (not PM) at this point:
323
+ 1. **RFC ready** — "Approve RFC to start implementation?" (if `rfc_approval` is not `skip`)
324
+
325
+ Push is automatic after review passes — no approval needed.
296
326
 
297
327
  ---
298
328
 
@@ -330,16 +360,18 @@ sequenceDiagram
330
360
  C->>C: Fix → commit
331
361
  end
332
362
 
333
- C->>U: Push to origin?
334
- U->>C: Yes
335
363
  C->>C: git push → milestone done
336
364
 
337
- C->>C: Next milestone? → loop or done
365
+ alt Inline mode (default)
366
+ C->>C: STOP — user compacts and restarts
367
+ else Agent mode
368
+ C->>C: Next milestone? → loop or done
369
+ end
338
370
 
339
371
  Note over PM: PM is free the entire time<br/>Can plan M2 while M1 executes
340
372
  ```
341
373
 
342
- ### 2. Conductor Execution Loop
374
+ ### 2. Conductor Execution Loop (Inline Mode)
343
375
 
344
376
  ```mermaid
345
377
  sequenceDiagram
@@ -354,11 +386,27 @@ sequenceDiagram
354
386
  C->>C: reviewer → approved
355
387
  C->>C: Push → M1 done
356
388
 
357
- C->>C: Start M2
358
- C->>C: architect → RFC
359
- C->>C: backend phase-1
360
- C->>C: reviewer approved
361
- C->>C: Push → M2 done
389
+ Note over C: STOP. "Run /compact or /clear then /orchestra start"
390
+ ```
391
+
392
+ ### 3. Conductor Execution Loop (Agent Mode)
393
+
394
+ ```mermaid
395
+ sequenceDiagram
396
+ participant C as Conductor
397
+ participant MA as Milestone Agent
398
+
399
+ C->>C: Scan milestones/
400
+
401
+ C->>MA: Spawn Agent(M1)
402
+ MA->>MA: phase-1 → phase-2 → review → push
403
+ MA-->>C: {status: done, retro: ...}
404
+ Note over C: Write retro, ~1-2k tokens retained
405
+
406
+ C->>MA: Spawn Agent(M2)
407
+ MA->>MA: phase-1 → phase-2 → review → push
408
+ MA-->>C: {status: done, retro: ...}
409
+ Note over C: Write retro, ~1-2k tokens retained
362
410
 
363
411
  C->>C: No more milestones
364
412
  Note over C: "All done. Waiting for new work."
@@ -13,10 +13,7 @@ pipeline:
13
13
  standard: sonnet
14
14
  complex: opus
15
15
  # RFC approval gate: required | optional | skip
16
- rfc_approval: required
17
-
18
- # Push approval gate: required | auto
19
- push_approval: required
16
+ rfc_approval: skip
20
17
 
21
18
  # Code review: required | optional | skip
22
19
  review: required
@@ -25,6 +22,11 @@ pipeline:
25
22
  # When enabled, phases with depends_on: [] run in parallel
26
23
  parallel: disabled
27
24
 
25
+ # Milestone isolation mode: inline | agent
26
+ # inline: conductor runs milestones directly, stops after each. User compacts manually. (default)
27
+ # agent: each milestone runs in its own sub-agent. Context freed automatically. Best for --auto.
28
+ milestone_isolation: inline
29
+
28
30
  # Default pipeline when milestone Complexity is missing
29
31
  default_pipeline: full # quick | standard | full
30
32
 
@@ -34,6 +36,9 @@ pipeline:
34
36
  # Max RFC rejection rounds before escalating to user
35
37
  max_rfc_rounds: 3
36
38
 
39
+ # Max milestone review rounds before proceeding anyway with warnings
40
+ max_milestone_review_rounds: 3
41
+
37
42
  thresholds:
38
43
  # Milestone lock timeout in minutes (stale locks are ignored)
39
44
  milestone_lock_timeout: 120
@@ -69,7 +69,7 @@ Last 5 milestones. Conductor reads before every milestone start. PM reads before
69
69
 
70
70
  ### Decisions
71
71
  - Skill System (markdown-only): Lightweight `.orchestra/skills/` with domain checklists (auth, CRUD, deployment). No registry, no keyword matching — PM manually assigns via `skills:` frontmatter in phase files. Preserves zero-infrastructure philosophy.
72
- - Cost Awareness: Track duration + verification retries per phase in context.md Cost Tracking table. PM sees this in #status. No token counting (unreliable from prompt), focus on observable metrics.
72
+ - Cost Awareness: Track duration + verification retries per phase in context.md `## Metrics` section. PM sees this in `/orchestra status`. No token counting (unreliable from prompt), focus on observable metrics.
73
73
  - Re-review Threshold: Fix < 30 lines → no re-review. Fix >= 30 lines → abbreviated re-review (only the fix commit). Balances quality vs speed.
74
74
  - Rejection Flow: RFC rejected → architect revises (max 3 rounds). Push rejected → create fix phase. System no longer stalls on "no".
75
75
 
@@ -42,13 +42,44 @@ Cannot write: feature code, RFCs, architecture docs, review findings, system fil
42
42
  └── phase-2.md
43
43
  ```
44
44
 
45
- ### Pre-flight Checklist
45
+ ### Milestone Review Loop
46
46
 
47
+ After creating milestone files, launch a milestone-reviewer sub-agent before
48
+ marking the milestone as ready. This catches planning errors before conductor executes.
49
+
50
+ **Flow:** PM creates → reviewer sub-agent → PM fixes → reviewer again → max `pipeline.max_milestone_review_rounds`
51
+
52
+ Launch sub-agent (general-purpose, model: sonnet) with this prompt:
53
+
54
+ ```
55
+ You are reviewing a milestone for quality before execution. Read these files
56
+ in {milestone_path}/: prd.md, milestone.md, grooming.md, and all files in phases/.
57
+ (rfc.md and context.md don't exist yet — don't flag them as missing.)
58
+
59
+ ## Checklist
47
60
  1. Every phase has `role:` set?
48
- 2. Every phase has `skills:` reviewed?
49
- 3. Every phase has clear, testable acceptance criteria?
50
- 4. `milestone.md` has `Complexity:` set?
51
- 5. Phase order and dependencies correct?
61
+ 2. Every phase has `complexity:` set?
62
+ 3. Every phase has `skills:` appropriate for the role and task?
63
+ 4. Every phase has `scope:` defining which files/dirs to touch?
64
+ 5. Acceptance criteria are testable? (not vague like "works well" — specific like "returns 200")
65
+ 6. `milestone.md` has `Complexity:` set?
66
+ 7. Phase order and `depends_on` are correct? (frontend depends on backend, etc.)
67
+ 8. No overlapping scope between phases? (two phases writing same files)
68
+ 9. PRD explains WHY, not just WHAT?
69
+
70
+ ## Return Format
71
+ verdict: approved | changes-requested
72
+ issues:
73
+ - [severity: blocking|suggestion] {description} — {file}
74
+ summary: {2-3 sentences}
75
+ ```
76
+
77
+ **Process:**
78
+ 1. If **approved** → proceed, milestone is ready for conductor
79
+ 2. If **changes-requested** → PM reads issues, fixes milestone files, re-launches reviewer
80
+ 3. After max rounds with no blocking issues → proceed with suggestions logged in grooming.md
81
+ 4. After max rounds with blocking issues still open → escalate to user, do NOT proceed
82
+ 5. Present verdict to user before finalizing
52
83
 
53
84
  ### milestone.md Format
54
85
 
@@ -59,7 +90,7 @@ Cannot write: feature code, RFCs, architecture docs, review findings, system fil
59
90
  |-------|-------|
60
91
  | Status | planning / in-progress / review / done |
61
92
  | Priority | P0 / P1 / P2 |
62
- | Complexity | quick / standard / full |
93
+ | Complexity | trivial / quick / standard / complex |
63
94
  | PRD | prd.md |
64
95
  | Created | {date} |
65
96
  ```
@@ -85,11 +116,12 @@ depends_on: []
85
116
 
86
117
  ### Complexity Levels
87
118
 
88
- | Level | Pipeline | When |
89
- |-------|----------|------|
90
- | `quick` | Engineer → Commit → Push | Trivial: config, copy, single-file fix |
91
- | `standard` | EngineerReview → Push | Typical features, clear requirements |
92
- | `full` | Architect Engineer → Review → Push | Complex: new subsystems, unfamiliar territory |
119
+ | Level | Model | Pipeline | When |
120
+ |-------|-------|----------|------|
121
+ | `trivial` | Haiku | Phases → Commit → Push | Version bumps, env vars, config changes |
122
+ | `quick` | Sonnet | Phases Commit → Push (skip review) | Single-file fixes, simple CRUD |
123
+ | `standard` | Sonnet | Phases → Review → Push | Typical features (default) |
124
+ | `complex` | Opus | Architect → Phases → Review → Push | New subsystems, unfamiliar territory |
93
125
 
94
126
  ### Blueprint Command
95
127
 
@@ -1,6 +1,6 @@
1
- # CLAUDE.md — Orchestra Setup Instructions
1
+ # CLAUDE.md
2
2
 
3
- This file is automatically read by Claude at the start of every session.
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
4
 
5
5
  <!-- orchestra -->
6
6
  ## Orchestra — AI Team Orchestration System
@@ -46,6 +46,22 @@ Role IDs: orchestrator, product-manager, architect, backend-engineer, frontend-e
46
46
  - Rules (`.claude/rules/*.orchestra.md`) auto-loaded. Skills loaded per phase.
47
47
  - **PROTECTED:** Non-Orchestrator roles NEVER modify `.orchestra/roles/`, `.orchestra/config.yml`, `.orchestra/README.md`, `.orchestra/blueprints/`, `.claude/agents/`, `.claude/rules/*.orchestra.md`, `.claude/skills/*.orchestra.md`, `.claude/commands/orchestra/`, `CLAUDE.md`, or `docs/`.
48
48
 
49
+ ## Development
50
+
51
+ This is an npm package (`@sulhadin/orchestrator`) — a CLI installer that copies Orchestra template files into user projects.
52
+
53
+ ```bash
54
+ yarn test # Run tests (node:test, test/**/*.test.js)
55
+ yarn template # Rebuild template/ from source files (bin/build-template.js)
56
+ yarn build # Full build (defined in lint-staged)
57
+ ```
58
+
59
+ **Architecture:** `bin/index.js` is the CLI entry point (runs via `npx`). It copies files from `template/` into the user's project, with smart YAML merge for `config.yml` (preserves user values, adds new keys). `bin/build-template.js` generates the `template/` directory from the source `.orchestra/` and `.claude/` files.
60
+
61
+ **npm publishes:** Only `bin/` and `template/` directories (see `package.json` `files` field). Tests, docs, and source orchestra files are excluded.
62
+
63
+ **Pre-commit:** Husky + lint-staged runs `yarn template && yarn build` on staged `.js`, `.md`, `.yml`, `.json` files.
64
+
49
65
  ## Installation
50
66
 
51
67
  See `docs/getting-started.md` for setup instructions.