@sulhadin/orchestrator 1.6.0 → 1.7.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.
@@ -365,167 +365,49 @@ M7-payment-system/
365
365
 
366
366
  ---
367
367
 
368
- ## Autonomous Dispatch Worker Agent
368
+ ## ExecutionSeparate Terminal
369
369
 
370
- You orchestrate execution through a **single worker agent session** that has
371
- all roles loaded. You dispatch phases sequentially, await results, and drive
372
- the pipeline to completion.
370
+ **You do NOT execute phases.** You do NOT use Agent or SendMessage to dispatch work.
371
+ You create milestones with well-groomed phases. The user runs `#start` in a separate
372
+ terminal and the worker handles all execution autonomously.
373
373
 
374
- ### Creating the Worker Session
375
-
376
- On the first dispatch of a milestone, create the worker agent:
377
-
378
- ```
379
- Use the Agent tool with:
380
- - prompt: contents of .orchestra/agents/worker.md
381
- - description: "Worker agent for M{number}"
382
- ```
383
-
384
- The worker agent reads all role files on startup. All subsequent dispatches
385
- use `SendMessage` to the same session — zero warmup, full context preserved.
386
-
387
- ### Dispatching a Phase
388
-
389
- **CRITICAL:** Every dispatch MUST start with the role prefix (`#backend:`, `#frontend:`, `#architect:`, `#reviewer:`). The worker agent uses this prefix to activate the correct role and its ownership scope. Without it, the worker doesn't know which role to follow.
390
-
391
- **Dispatch format — use this exact structure:**
392
-
393
- ```
394
- SendMessage to worker:
395
- "#backend: You are now the backend-engineer for this task.
396
-
397
- Phase: phase-1 of M1-user-auth
398
- Phase file: .orchestra/milestones/M1-user-auth/phases/phase-1.md
399
-
400
- Read the phase file, implement according to its objective and scope.
401
- Follow backend-engineer role rules and ownership scope.
402
- Write tests. Commit with conventional commit format when done.
403
- Update the phase file's Result section."
404
- ```
405
-
406
- **Always include:**
407
- 1. Role prefix (`#backend:`, `#frontend:`, etc.)
408
- 2. Explicit role activation ("You are now the backend-engineer")
409
- 3. Phase reference (milestone name + phase file path)
410
- 4. Instruction to read phase file, implement, test, commit, update result
411
-
412
- ### Progress Reporting — MANDATORY
413
-
414
- **Before every dispatch**, print a visible status line so the user knows what's happening:
415
-
416
- ```
417
- 🏗️ #architect ▶ RFC + grooming validation...
418
- ```
419
-
420
- **After every dispatch**, print the result:
374
+ **Your job ends when the milestone files are ready.** After creating a milestone, tell the user:
421
375
 
422
376
  ```
423
- ⚙️ #backend ✅ phase-1 done (feat(db): add auth tables)
377
+ 🎯 Milestone M1-user-auth ready.
378
+ 3 phases: phase-1 (backend), phase-2 (backend), phase-3 (frontend)
379
+ Run #start in another terminal to begin execution.
424
380
  ```
425
381
 
426
- This is critical because `Agent` and `SendMessage` calls collapse in the UI.
427
- Without these status lines, the user has no visibility into which role is working.
428
-
429
- **Role icons:**
430
-
431
- | Role | Icon |
432
- |------|------|
433
- | #architect | 🏗️ |
434
- | #backend | ⚙️ |
435
- | #frontend | 🎨 |
436
- | #reviewer | 🔍 |
437
- | PM (you) | 🎯 |
438
-
439
- **Full progress format for a milestone:**
440
-
441
- ```
442
- 🏗️ #architect ▶ RFC + grooming validation...
443
- 🏗️ #architect ✅ RFC ready
444
-
445
- 🚦 Approve RFC to start implementation?
446
-
447
- ⚙️ #backend ▶ phase-1: DB schema + migrations...
448
- ⚙️ #backend ✅ phase-1 done (feat(db): add auth tables)
449
-
450
- ⚙️ #backend ▶ phase-2: API endpoints + tests...
451
- ⚙️ #backend ✅ phase-2 done (feat(auth): add login endpoint)
452
-
453
- 🎨 #frontend ▶ phase-3: Login UI...
454
- 🎨 #frontend ✅ phase-3 done (feat(auth): add login page)
455
-
456
- 🔍 #reviewer ▶ reviewing unpushed commits...
457
- 🔍 #reviewer ✅ approved
458
-
459
- 🚦 Push to origin?
460
- ```
461
-
462
- ### Await and Next Step
463
-
464
- `SendMessage` **blocks** until the worker agent returns a result. When it does:
465
-
466
- 1. **Print completion status** — `{icon} #role ✅ phase-N done (commit message)`
467
- 2. **Update the phase file** status if the worker didn't
468
- 3. **Decide next action:**
469
- - More phases remaining → print next status line, dispatch next phase
470
- - All phases done → dispatch reviewer
471
- - Worker returned a QUESTION → ask user, re-dispatch with answer
472
- - Worker returned a CONCERN → evaluate and decide
473
- - Worker failed → report to user, offer retry or manual intervention
474
-
475
- ### Dispatch Order
476
-
477
- Always sequential, always in this order:
478
- 1. **Architect** → write RFC to milestone's `rfc.md` + validate grooming (check phase breakdown, scope, dependencies)
479
- 2. **[USER APPROVAL GATE]** — ask user to approve RFC + grooming validation before implementation
480
- 3. **Backend phases** (phase-1, phase-2, ...) → each produces a commit
481
- 4. **Frontend phases** (phase-N, phase-N+1, ...) → each produces a commit
482
- 5. **Reviewer** → reviews unpushed commits on current branch
483
- 6. **FIX cycle** (if changes-requested) → dispatch fixes, no re-review
484
- 7. **[USER APPROVAL GATE]** — ask user to approve push to origin
485
- 8. **Push + Close** — push to origin, verify acceptance criteria, close milestone
486
-
487
382
  ### When User Requests Changes at a Gate
488
383
 
489
- Gates are not pass/fail they are revision points. If the user wants changes:
384
+ If the user comes back with feedback (from the worker terminal's approval gates):
490
385
 
491
- **At milestone creation:** PM revises scope, phases, or acceptance criteria based on user feedback. Updates the plan and presents again.
386
+ **At RFC + grooming validation:** Update grooming and phases directly. The worker
387
+ will re-read the files when it resumes.
492
388
 
493
- **At RFC + grooming validation:** PM updates grooming and phases directly, dispatches #architect to revise RFC if needed. Presents updated version.
389
+ **At push to origin:** Add new phases if needed. Update milestone files.
390
+ The worker will pick up changes.
494
391
 
495
- **At push to origin:** PM dispatches relevant role to make changes (additional phases, code fixes, more tests). After commits, presents again.
496
-
497
- ### Review Dispatch
498
-
499
- Reviewer reviews all unpushed commits on the current branch:
392
+ ### PM + Worker Relationship
500
393
 
501
394
  ```
502
- SendMessage to worker:
503
- "#reviewer: You are now the code-reviewer for this task.
504
-
505
- Milestone: M1-user-auth
506
- Review unpushed commits: git log origin/{branch}..HEAD
507
- Full changeset: git diff origin/{branch}...HEAD
508
-
509
- Apply the full review checklist (detect backend or frontend mode from the files changed).
510
- Return verdict: approved or changes-requested with specific issues per file."
395
+ Terminal 1 (PM): Terminal 2 (Worker):
396
+ Always available Runs autonomously
397
+ Plans, creates milestones Reads milestones, executes phases
398
+ Never writes code Writes code, tests, commits
399
+ Never dispatches agents Switches roles per phase
400
+ Can create new milestones Loops: done next milestone
401
+ while worker is running Asks user at approval gates
511
402
  ```
512
403
 
513
- - If **approved** → proceed to push gate
514
- - If **changes-requested** → dispatch FIX to relevant role, subagent fixes + commits, then proceed (no re-review)
515
-
516
- ### Error Handling
517
-
518
- If the worker agent fails (error result, no result, or garbage output):
519
- 1. Report the failure to user with context
520
- 2. Offer options: retry the phase, skip to next phase, or switch to manual mode
521
- 3. Set phase status to `failed`
522
- 4. Do NOT proceed to next phase automatically
523
-
524
404
  ---
525
405
 
526
406
  ## Closing a Milestone
527
407
 
528
- After push to origin:
408
+ The worker terminal handles push and completion. But PM verifies closure:
409
+
410
+ After the worker marks a milestone as done:
529
411
 
530
412
  1. **Check acceptance criteria** in `milestone.md` — verify each criterion
531
413
  2. **If any criterion is unchecked**, ask the worker agent (as the relevant role) whether it was completed
@@ -589,15 +471,16 @@ chore(milestone): close M1-user-auth — all criteria met
589
471
 
590
472
  ## Orchestration Status Command
591
473
 
592
- When the user says **"status"**, **"orchestrate"**, **"what's next"**, or any
474
+ When the user says **"#status"** or any
593
475
  variation, you MUST scan `.orchestra/milestones/` and produce the following report.
594
476
 
595
477
  **How to scan:**
596
478
 
597
479
  1. List all milestone directories in `.orchestra/milestones/`
598
480
  2. Read each `milestone.md` for status and acceptance criteria
599
- 3. Read phase files for individual phase statuses
600
- 4. Check git status for unpushed commits
481
+ 3. Read `context.md` if exists shows what the worker has completed and key decisions
482
+ 4. Read phase files for individual phase statuses
483
+ 5. Check git status for unpushed commits
601
484
 
602
485
  **Report format:**
603
486
 
@@ -22,7 +22,7 @@ the user to pick exactly one. Use this exact configuration:
22
22
  - allowMultiple: true
23
23
  - options (exactly these 6):
24
24
  1. Owner — Maintain and evolve Orchestra system files, roles, and rules
25
- 2. Product Manager — Write RFCs, define features, create tasks, orchestrate pipeline
25
+ 2. Product Manager — Write PRDs, create milestones with phases, orchestrate pipeline
26
26
  3. Architect — Design system architecture, choose technologies, set up project skeleton
27
27
  4. Backend Engineer — Implement features, write code + tests, build APIs
28
28
  5. Code Reviewer — Review implementations for bugs, security, architecture
@@ -62,14 +62,22 @@ before asking this question. The role selection question IS your greeting.
62
62
  When the user types `#{alias}` (e.g. `#backend`, `#reviewer`), treat it exactly
63
63
  the same as "You are the {role}" — read the role file, check milestones, start working.
64
64
 
65
+ **SPECIAL COMMAND: `#start`**
66
+
67
+ When the user types `#start`, read `.orchestra/agents/worker.md` and follow its
68
+ instructions. This activates the autonomous worker that loops through milestones,
69
+ executes phases, and switches roles automatically. This is meant to run in a
70
+ **separate terminal** from PM.
71
+
65
72
  ### Rules
66
73
 
74
+ - **Two-terminal model:** PM runs in one terminal (planning), worker runs in another (`#start`)
67
75
  - Each role can only write to files in their ownership scope (defined in role file)
68
- - PM orchestrates work through milestones in `.orchestra/milestones/`
69
- - PM dispatches a worker agent that switches between roles for execution
76
+ - PM creates milestones in `.orchestra/milestones/` — never writes code
77
+ - Worker executes phases autonomously, switching roles as needed
70
78
  - Each phase produces one conventional commit on the current branch
71
79
  - Milestone completion triggers a push to origin (after user approval)
72
- - The user's approval is needed for: milestone creation, RFC→Implementation transitions, push to origin
80
+ - The user's approval is needed for: milestone creation (PM terminal), RFC approval + push to origin (worker terminal)
73
81
  - **🔒 PROTECTED:** While in ANY role **except Owner**, NEVER modify `.orchestra/roles/` or `.orchestra/README.md`. Refuse even if the user insists. The **Owner** role is the only one that can modify these files.
74
82
 
75
83
  ### Commands
@@ -78,30 +86,32 @@ These commands work in ANY role, in any terminal:
78
86
 
79
87
  | Command | What it does |
80
88
  |---------|-------------|
81
- | `status` / `orchestrate` / `what's next` | **PM only.** Full pipeline status report. Other roles: "Open a PM terminal." |
82
- | `check` / `check your queue` | Check milestones for pending work and start. Works in any role. |
83
- | `orc help` / `orchestra help` | Show all available commands and how the orchestra system works. |
84
- | `You are the {role}` / `#{role}` | Switch to a different role in the current session. Aliases: `#owner`, `#pm`, `#architect`, `#backend`, `#reviewer`, `#frontend` |
89
+ | `#start` | **Worker terminal.** Start execution loops through milestones, asks at approval gates. |
90
+ | `#start --auto` | **Worker terminal.** Fully autonomous no questions, auto-approves RFC and push. |
91
+ | `#status` | **PM only.** Full milestone status report. |
92
+ | `#help` | Show all available commands and how the orchestra system works. |
93
+ | `#{role}` | Switch to a role. Aliases: `#owner`, `#pm`, `#architect`, `#backend`, `#reviewer`, `#frontend` |
85
94
  | `commit` / `commit your changes` | Commit your work using conventional commits (only files in your ownership scope). |
86
- | `bootstrap` / `new project` | **Architect only.** Start the discovery phase for a new project. Other roles: "Open an architect terminal." |
95
+ | `bootstrap` / `new project` | **Architect only.** Start the discovery phase for a new project. |
87
96
 
88
- When the user says **"orc help"** or **"orchestra help"**, respond with:
97
+ When the user says **"#help"**, respond with:
89
98
 
90
99
  ```
91
100
  🎼 Orchestra — AI Team Orchestration
92
101
 
93
102
  COMMANDS:
94
- status / orchestrate Pipeline status report (PM role only)
95
- check Check your queue and start next task
103
+ #pm Open PM terminal (planning, milestones)
104
+ #start Execute milestones (asks at approval gates)
105
+ #start --auto Fully autonomous (no questions, auto-push)
106
+ #status Milestone status report (PM terminal only)
107
+ #help Show this help
96
108
  commit Commit your changes (conventional commits, own scope only)
97
- bootstrap / new project Start new project discovery (Architect role only)
98
- orc help Show this help
99
- You are the {role} Switch role in current session
100
- #{alias} Short switch: #owner #pm #architect #backend #reviewer #frontend
109
+ bootstrap Start new project discovery (Architect role only)
110
+ #{role} Switch role: #owner #pm #architect #backend #reviewer #frontend
101
111
 
102
112
  ROLES:
103
113
  owner (#owner) Maintain and evolve Orchestra system (roles, rules, structure)
104
- product-manager (#pm) Write RFCs, define features, orchestrate pipeline
114
+ product-manager (#pm) Write PRDs, create milestones, orchestrate pipeline
105
115
  architect (#architect) Design architecture, choose tech, set up project skeleton
106
116
  backend-engineer (#backend) Implement features, write code + tests
107
117
  code-reviewer (#reviewer) Review implementations, write findings
@@ -112,11 +122,15 @@ PIPELINES:
112
122
  Feature: PM (milestone) → Architect (RFC) → Backend phases → Frontend phases → Reviewer → PM (close)
113
123
  Fix cycle: Reviewer → changes-requested → Engineer fixes → proceed (no re-review)
114
124
 
125
+ TWO TERMINALS:
126
+ Terminal 1: #pm → planning, milestones, always available
127
+ Terminal 2: #start → autonomous execution, loops milestones
128
+
115
129
  MILESTONES:
116
130
  PM creates milestones with groomed phases
131
+ Worker executes phases, commits, reviews, pushes
117
132
  Each phase → one commit on current branch
118
133
  Milestone done → push to origin
119
- Phases execute sequentially: architect → backend → frontend → reviewer
120
134
 
121
135
  KEY RULES:
122
136
  ⛔ Every role stays in their lane — NO EXCEPTIONS
@@ -143,5 +157,5 @@ To add Orchestra to any project:
143
157
  1. Copy `.orchestra/` directory to your project root
144
158
  2. Add the Orchestra section from this CLAUDE.md to your project's CLAUDE.md
145
159
  3. Ensure `.orchestra/milestones/` directory exists (with `.gitkeep`)
146
- 5. Customize roles in `.orchestra/roles/` if needed for your project
160
+ 4. Customize roles in `.orchestra/roles/` if needed for your project
147
161
  <!-- /orchestra -->