@sulhadin/orchestrator 1.13.0 → 1.15.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/README.md +6 -5
- package/package.json +1 -1
- package/template/.orchestra/README.md +54 -8
- package/template/.orchestra/agents/worker.md +318 -13
- package/template/.orchestra/blueprints/README.md +87 -0
- package/template/.orchestra/blueprints/api-only.md +46 -0
- package/template/.orchestra/blueprints/component-crud-resource.md +25 -0
- package/template/.orchestra/blueprints/saas-starter.md +69 -0
- package/template/.orchestra/knowledge.md +93 -0
- package/template/.orchestra/roles/adaptive.md +104 -0
- package/template/.orchestra/roles/architect.md +21 -5
- package/template/.orchestra/roles/backend-engineer.md +20 -11
- package/template/.orchestra/roles/code-reviewer.md +17 -16
- package/template/.orchestra/roles/frontend-engineer.md +17 -5
- package/template/.orchestra/roles/owner.md +136 -7
- package/template/.orchestra/roles/product-manager.md +114 -6
- package/template/.orchestra/skills/accessibility.md +26 -0
- package/template/.orchestra/skills/auth-setup.md +26 -0
- package/template/.orchestra/skills/best-practices.md +24 -0
- package/template/.orchestra/skills/code-optimizer.md +22 -0
- package/template/.orchestra/skills/core-web-vitals.md +27 -0
- package/template/.orchestra/skills/crud-api.md +27 -0
- package/template/.orchestra/skills/debug.md +23 -0
- package/template/.orchestra/skills/deployment.md +26 -0
- package/template/.orchestra/skills/frontend-design.md +25 -0
- package/template/.orchestra/skills/react-best-practices.md +26 -0
- package/template/.orchestra/skills/review.md +27 -0
- package/template/.orchestra/skills/testing.md +24 -0
- package/template/.orchestra/skills/web-quality-audit.md +42 -0
- package/template/CLAUDE.md +42 -10
package/README.md
CHANGED
|
@@ -77,7 +77,7 @@ Close the terminal, reopen, type `#start` — it resumes from where it left off.
|
|
|
77
77
|
| **Fast Track** | `quick/standard/full` pipeline complexity — skip unnecessary steps for simple work |
|
|
78
78
|
| **Verification Gate** | Tests + lint must pass before every commit — broken code can't be committed |
|
|
79
79
|
| **Skills** | Domain checklists (auth, CRUD, deploy) assigned to phases |
|
|
80
|
-
| **Blueprints** | Project templates —
|
|
80
|
+
| **Blueprints** | Project templates — `#blueprint saas-starter` creates 5 milestones instantly |
|
|
81
81
|
| **Hotfix** | `#hotfix {desc}` — implement, verify, commit, push in one command |
|
|
82
82
|
| **Learning** | knowledge.md accumulates decisions and lessons across milestones |
|
|
83
83
|
| **Parallel Phases** | Independent phases run simultaneously via `depends_on` |
|
|
@@ -96,8 +96,8 @@ Close the terminal, reopen, type `#start` — it resumes from where it left off.
|
|
|
96
96
|
| `#help` | Any | Show all commands |
|
|
97
97
|
| `#help skills` | Any | List available skills |
|
|
98
98
|
| `#help blueprints` | Any | List available blueprints |
|
|
99
|
-
|
|
|
100
|
-
|
|
|
99
|
+
| `#blueprint {name}` | Terminal 1 | Generate milestones from template |
|
|
100
|
+
| `#blueprint add` | Terminal 1 | Save current work as reusable template |
|
|
101
101
|
|
|
102
102
|
Manual roles (any terminal):
|
|
103
103
|
|
|
@@ -108,6 +108,7 @@ Manual roles (any terminal):
|
|
|
108
108
|
| `#reviewer` | Code Reviewer |
|
|
109
109
|
| `#architect` | Architect |
|
|
110
110
|
| `#owner` | System maintenance |
|
|
111
|
+
| `#adaptive` | Adaptive expert (iOS, DevOps, ML, etc.) |
|
|
111
112
|
|
|
112
113
|
## Documentation
|
|
113
114
|
|
|
@@ -115,9 +116,9 @@ See [docs/](https://github.com/sulhadin/orchestrator/blob/main/docs/README.md) f
|
|
|
115
116
|
|
|
116
117
|
- [Getting Started](https://github.com/sulhadin/orchestrator/blob/main/docs/getting-started.md) — installation, first milestone, two-terminal model
|
|
117
118
|
- [Commands](https://github.com/sulhadin/orchestrator/blob/main/docs/commands.md) — all commands with examples
|
|
118
|
-
- [Roles](https://github.com/sulhadin/orchestrator/blob/main/docs/roles.md) —
|
|
119
|
+
- [Roles](https://github.com/sulhadin/orchestrator/blob/main/docs/roles.md) — 7 roles, responsibilities, boundaries
|
|
119
120
|
- [Features](https://github.com/sulhadin/orchestrator/blob/main/docs/features.md) — verification gate, fast track, parallel, hotfix, and more
|
|
120
|
-
- [Blueprints](https://github.com/sulhadin/orchestrator/blob/main/docs/blueprints.md) — project templates,
|
|
121
|
+
- [Blueprints](https://github.com/sulhadin/orchestrator/blob/main/docs/blueprints.md) — project templates, `#blueprint add`
|
|
121
122
|
- [Skills](https://github.com/sulhadin/orchestrator/blob/main/docs/skills.md) — domain checklists, creating new skills
|
|
122
123
|
|
|
123
124
|
## License
|
package/package.json
CHANGED
|
@@ -30,9 +30,13 @@ Terminal 1 (PM): Terminal 2 (Worker):
|
|
|
30
30
|
│ ├── architect.md
|
|
31
31
|
│ ├── backend-engineer.md
|
|
32
32
|
│ ├── code-reviewer.md
|
|
33
|
-
│
|
|
33
|
+
│ ├── frontend-engineer.md
|
|
34
|
+
│ └── owner.md
|
|
34
35
|
├── agents/ # Worker agent definitions
|
|
35
36
|
│ └── worker.md # Multi-role execution agent prompt
|
|
37
|
+
├── skills/ # Domain-specific checklists (auth, CRUD, deploy)
|
|
38
|
+
├── blueprints/ # Project/component milestone templates
|
|
39
|
+
├── knowledge.md # Append-only project knowledge log
|
|
36
40
|
├── milestones/ # Feature work (one dir per feature)
|
|
37
41
|
│ └── M1-feature-name/
|
|
38
42
|
│ ├── prd.md # Product requirements (PM writes)
|
|
@@ -90,11 +94,34 @@ PM discusses feature with user
|
|
|
90
94
|
→ Worker executes backend phases (sequential, each → commit)
|
|
91
95
|
→ Worker executes frontend phases (sequential, each → commit)
|
|
92
96
|
→ Worker activates #reviewer (reviews unpushed commits)
|
|
93
|
-
→ FIX cycle if changes-requested (
|
|
97
|
+
→ FIX cycle if changes-requested (re-review if fix >= 30 lines)
|
|
94
98
|
→ [USER APPROVAL GATE: Push to origin]
|
|
95
|
-
→
|
|
99
|
+
→ Worker pushes, PM verifies acceptance criteria, closes milestone
|
|
100
|
+
→ Worker appends 5-line retrospective to knowledge.md
|
|
101
|
+
|
|
102
|
+
Hotfix (production bugs):
|
|
103
|
+
#hotfix {description}
|
|
104
|
+
→ Auto-create milestone + phase → Implement → Verify → Commit → Push
|
|
105
|
+
→ No RFC, no review, no approval gates (except verification)
|
|
96
106
|
```
|
|
97
107
|
|
|
108
|
+
### Milestone Lock
|
|
109
|
+
|
|
110
|
+
Worker claims a milestone by writing `Locked-By: {timestamp}` to milestone.md before execution.
|
|
111
|
+
Other workers skip locked milestones. Lock expires after 2 hours (stale protection).
|
|
112
|
+
|
|
113
|
+
### Pipeline Modes (Complexity)
|
|
114
|
+
|
|
115
|
+
PM sets a `Complexity` level on each milestone that determines the pipeline:
|
|
116
|
+
|
|
117
|
+
| Complexity | Pipeline | Use when |
|
|
118
|
+
|------------|----------|----------|
|
|
119
|
+
| `quick` | Engineer → Commit → Push | Config tweaks, copy changes, trivial fixes |
|
|
120
|
+
| `standard` | Engineer → Review → Push | Typical features, clear requirements |
|
|
121
|
+
| `full` | Architect → Engineer → Review → Push | Complex features, new subsystems |
|
|
122
|
+
|
|
123
|
+
Default is `full` if not specified. Worker reads the `Complexity` field from `milestone.md`.
|
|
124
|
+
|
|
98
125
|
### Milestone Statuses
|
|
99
126
|
|
|
100
127
|
| Status | Meaning |
|
|
@@ -126,6 +153,12 @@ Phases always execute in this order:
|
|
|
126
153
|
|
|
127
154
|
Within each domain (backend/frontend), phases run in order: phase-1 → phase-2 → phase-3.
|
|
128
155
|
|
|
156
|
+
**Parallel execution:** If PM sets `depends_on` in phase frontmatter, independent phases
|
|
157
|
+
can run in parallel via subagent worktree isolation. No `depends_on` = sequential (default).
|
|
158
|
+
|
|
159
|
+
**Verification Gate:** Before every commit, worker MUST pass type check + tests + lint.
|
|
160
|
+
Commit is blocked until all checks pass (max 3 retries, then phase fails).
|
|
161
|
+
|
|
129
162
|
---
|
|
130
163
|
|
|
131
164
|
## Git Boundaries
|
|
@@ -158,7 +191,7 @@ Rules:
|
|
|
158
191
|
- Breaking changes add `!` after type
|
|
159
192
|
- Body explains WHY, not WHAT
|
|
160
193
|
- Subject line ≤ 72 characters
|
|
161
|
-
- **No `Co-Authored-By` trailers** —
|
|
194
|
+
- **No `Co-Authored-By` trailers** — NEVER add co-author lines to commit messages. This applies to ALL commits in ALL repositories using Orchestra. No exceptions.
|
|
162
195
|
|
|
163
196
|
---
|
|
164
197
|
|
|
@@ -171,6 +204,15 @@ The user must approve before these transitions:
|
|
|
171
204
|
|
|
172
205
|
All other transitions are automatic.
|
|
173
206
|
|
|
207
|
+
### Rejection Handling
|
|
208
|
+
|
|
209
|
+
If the user says **no** at any gate:
|
|
210
|
+
- **RFC rejected** → Architect revises based on feedback, re-submits (max 3 rounds)
|
|
211
|
+
- **Push rejected** → Worker creates fix phase, implements, re-submits push gate
|
|
212
|
+
- **Milestone rejected** → PM revises in PM terminal
|
|
213
|
+
|
|
214
|
+
Rejections are normal. The system does not stall — it loops back with feedback.
|
|
215
|
+
|
|
174
216
|
---
|
|
175
217
|
|
|
176
218
|
## Review Flow (Git-Native)
|
|
@@ -182,13 +224,15 @@ Worker activates #reviewer
|
|
|
182
224
|
→ Reviewer runs: git log origin/{branch}..HEAD
|
|
183
225
|
→ Reviewer runs: git diff origin/{branch}...HEAD
|
|
184
226
|
→ Reviewer applies full checklist (backend or frontend mode)
|
|
185
|
-
→ Returns: approved
|
|
227
|
+
→ Returns: approved / approved-with-comments / changes-requested
|
|
186
228
|
```
|
|
187
229
|
|
|
188
|
-
**If approved** →
|
|
230
|
+
**If approved** → proceed to push gate.
|
|
231
|
+
|
|
232
|
+
**If approved-with-comments** → proceed to push gate. Comments are logged in context.md for future reference.
|
|
189
233
|
|
|
190
234
|
**If changes-requested** → Worker switches to the relevant role, fixes
|
|
191
|
-
and commits.
|
|
235
|
+
and commits. Re-review triggered if fix >= 30 lines changed.
|
|
192
236
|
|
|
193
237
|
---
|
|
194
238
|
|
|
@@ -244,12 +288,14 @@ Each role has exclusive write access to specific directories:
|
|
|
244
288
|
|
|
245
289
|
| Role | Owns (can write) | Reads |
|
|
246
290
|
|------|-------------------|-------|
|
|
247
|
-
| owner | `.orchestra/roles/*`, `.orchestra/README.md`, `CLAUDE.md` | Everything |
|
|
291
|
+
| owner | `.orchestra/roles/*`, `.orchestra/README.md`, `CLAUDE.md`, `.orchestra/agents/*`, `.orchestra/skills/*`, `.orchestra/blueprints/*`, `.orchestra/knowledge.md` | Everything |
|
|
248
292
|
| product-manager | `.orchestra/milestones/*` (prd.md, milestone.md, grooming.md, phases) | Everything |
|
|
249
293
|
| architect | `.orchestra/milestones/*/rfc.md`, `.orchestra/milestones/*/architecture.md`, `.orchestra/milestones/*/adrs/*`, project configs (initial setup) | Everything |
|
|
250
294
|
| backend-engineer | `src/`, `tests/`, `src/**/__tests__/*`, `migrations/`, `package.json`, `tsconfig.json` | `.orchestra/milestones/*/phases/*` |
|
|
251
295
|
| code-reviewer | Review findings only — never modifies source code | `src/`, `tests/`, `frontend/` |
|
|
252
296
|
| frontend-engineer | `frontend/`, `frontend/**/__tests__/*`, `frontend/**/e2e/*`, `.orchestra/milestones/*/design.md` | `.orchestra/milestones/*/phases/*` |
|
|
297
|
+
| adaptive | Defined by `scope:` field in phase file — dynamic per phase | `.orchestra/milestones/*/phases/*` |
|
|
298
|
+
| worker (all roles) | `.orchestra/milestones/*/context.md`, `.orchestra/knowledge.md` (append only) | Everything in active milestone |
|
|
253
299
|
|
|
254
300
|
---
|
|
255
301
|
|
|
@@ -11,13 +11,22 @@ Two modes:
|
|
|
11
11
|
| Command | Behavior |
|
|
12
12
|
|---------|----------|
|
|
13
13
|
| `#start` | Asks user at approval gates (RFC, push) |
|
|
14
|
-
| `#start --auto` | Fully autonomous —
|
|
14
|
+
| `#start --auto` | Fully autonomous — confirms once, then auto-approves all gates |
|
|
15
15
|
|
|
16
16
|
When the user types `#start` or `#start --auto`:
|
|
17
17
|
|
|
18
|
-
1. Detect mode: if `--auto` was specified,
|
|
18
|
+
1. Detect mode: if `--auto` was specified, show a one-time warning before proceeding:
|
|
19
|
+
```
|
|
20
|
+
⚠️ Auto mode: ALL approval gates will be skipped (RFC, push). Code will be pushed without confirmation.
|
|
21
|
+
Type "confirm" to proceed, or switch to #start for manual gates.
|
|
22
|
+
```
|
|
23
|
+
Wait for user to type "confirm". Then set **auto mode** (skip all approval gates).
|
|
19
24
|
2. Read `.orchestra/README.md` for orchestration rules
|
|
20
|
-
3.
|
|
25
|
+
3. Do NOT read all role files upfront — only read the role file needed for each phase:
|
|
26
|
+
- At startup: read NO role files yet (wait until first phase determines the role)
|
|
27
|
+
- At each phase: read `.orchestra/roles/{role-from-phase}.md` for the active role only
|
|
28
|
+
- When switching roles between phases: read the new role file, previous role context is no longer needed
|
|
29
|
+
- Also read `.orchestra/knowledge.md` once at milestone start (if it exists)
|
|
21
30
|
4. Scan `.orchestra/milestones/` for work:
|
|
22
31
|
- Find milestones with `status: in-progress` → resume from last incomplete phase
|
|
23
32
|
- If none, find milestones with `status: planning` → start from the beginning
|
|
@@ -26,6 +35,37 @@ When the user types `#start` or `#start --auto`:
|
|
|
26
35
|
|
|
27
36
|
## Execution Loop
|
|
28
37
|
|
|
38
|
+
### Pipeline Selection — Based on Complexity
|
|
39
|
+
|
|
40
|
+
Before starting a milestone, read the `Complexity` field from `milestone.md`:
|
|
41
|
+
|
|
42
|
+
| Complexity | Pipeline | What to skip |
|
|
43
|
+
|------------|----------|-------------|
|
|
44
|
+
| `quick` | Phases → Commit → Push | Skip architect phase, skip review phase |
|
|
45
|
+
| `standard` | Phases → Review → Push | Skip architect phase (unless a phase has `role: architect`) |
|
|
46
|
+
| `full` | Architect → Phases → Review → Push | Nothing skipped — full pipeline |
|
|
47
|
+
|
|
48
|
+
**Rules:**
|
|
49
|
+
- If `Complexity` is missing, treat as `full` (safe default)
|
|
50
|
+
- `quick` mode still requires Verification Gate (test + lint) before commit
|
|
51
|
+
- `quick` mode still requires push approval gate (unless `--auto`)
|
|
52
|
+
- If a `quick` milestone fails verification, escalate to `standard` automatically:
|
|
53
|
+
"⚠️ Escalating from quick to standard — verification failed, adding review phase"
|
|
54
|
+
|
|
55
|
+
### Milestone Lock — Prevent Concurrent Execution
|
|
56
|
+
|
|
57
|
+
Before starting a milestone, check for concurrent workers:
|
|
58
|
+
|
|
59
|
+
1. Read `milestone.md` — check for `Locked-By` field
|
|
60
|
+
2. If `Locked-By` exists and timestamp is less than 2 hours old → **skip this milestone**:
|
|
61
|
+
"⚠️ Skipping {milestone}: locked by another worker since {timestamp}"
|
|
62
|
+
3. If no lock or lock is stale (>2 hours) → **claim it**: add `Locked-By: {timestamp}` to milestone.md
|
|
63
|
+
4. On milestone completion or failure → remove the `Locked-By` field
|
|
64
|
+
|
|
65
|
+
This prevents two `#start` terminals from executing the same milestone simultaneously.
|
|
66
|
+
|
|
67
|
+
### Milestone Execution
|
|
68
|
+
|
|
29
69
|
For each milestone (in order: in-progress first, then planning):
|
|
30
70
|
|
|
31
71
|
```
|
|
@@ -99,6 +139,7 @@ Role mapping:
|
|
|
99
139
|
| `#backend` | backend-engineer | ⚙️ |
|
|
100
140
|
| `#frontend` | frontend-engineer | 🎨 |
|
|
101
141
|
| `#reviewer` | code-reviewer | 🔍 |
|
|
142
|
+
| `#adaptive` | adaptive | 🔧 |
|
|
102
143
|
|
|
103
144
|
### Active Role Enforcement
|
|
104
145
|
|
|
@@ -110,6 +151,7 @@ You can only write to files owned by the **currently active** role:
|
|
|
110
151
|
| `#backend` | `src/*`, `tests/*`, `migrations/*`, `package.json`, `tsconfig.json` |
|
|
111
152
|
| `#frontend` | `frontend/*`, `.orchestra/milestones/*/design.md` |
|
|
112
153
|
| `#reviewer` | Review findings only — never modify source code |
|
|
154
|
+
| `#adaptive` | Defined by `scope:` field in phase file — dynamic per phase |
|
|
113
155
|
|
|
114
156
|
If you need to write outside your active role's scope, **do not do it**. Note it
|
|
115
157
|
as a CONCERN in context.md and continue.
|
|
@@ -157,8 +199,35 @@ to update; write incrementally as you work.
|
|
|
157
199
|
|
|
158
200
|
## Concerns
|
|
159
201
|
- (any issues spotted during implementation)
|
|
202
|
+
|
|
203
|
+
## Cost Tracking
|
|
204
|
+
| Phase | Duration | Verification Retries |
|
|
205
|
+
|-------|----------|---------------------|
|
|
206
|
+
| phase-1 | ~3min | 0 |
|
|
207
|
+
| phase-2 | ~7min | 1 (lint fix) |
|
|
160
208
|
```
|
|
161
209
|
|
|
210
|
+
### Learning System — Knowledge Persistence
|
|
211
|
+
|
|
212
|
+
The file `.orchestra/knowledge.md` is a project-wide, append-only knowledge log.
|
|
213
|
+
|
|
214
|
+
**Before starting a milestone:**
|
|
215
|
+
- Read ONLY the **Active Knowledge** section of `.orchestra/knowledge.md` (skip Archive)
|
|
216
|
+
- Check for relevant lessons, patterns, or decisions that apply to the current work
|
|
217
|
+
- If a previous lesson says "use X instead of Y" — follow it
|
|
218
|
+
|
|
219
|
+
**After completing a milestone (before push gate):**
|
|
220
|
+
- Append a new entry to `.orchestra/knowledge.md` with:
|
|
221
|
+
- Key technical decisions made during this milestone and WHY
|
|
222
|
+
- Lessons learned (anything harder than expected, any mistakes corrected)
|
|
223
|
+
- Reusable patterns discovered or established
|
|
224
|
+
- Keep entries concise — 3-5 bullet points per section, skip empty sections
|
|
225
|
+
|
|
226
|
+
**Rules:**
|
|
227
|
+
- NEVER edit previous entries — append only
|
|
228
|
+
- If a previous entry is wrong, add a correction entry
|
|
229
|
+
- Read knowledge.md at milestone start, write to it at milestone end
|
|
230
|
+
|
|
162
231
|
### Resuming from context.md
|
|
163
232
|
|
|
164
233
|
When `#start` is called and a milestone has `status: in-progress`:
|
|
@@ -169,17 +238,105 @@ When `#start` is called and a milestone has `status: in-progress`:
|
|
|
169
238
|
|
|
170
239
|
## Phase Execution
|
|
171
240
|
|
|
172
|
-
|
|
241
|
+
### Parallel Execution — Based on `depends_on`
|
|
242
|
+
|
|
243
|
+
Before executing phases sequentially, check if parallel execution is possible:
|
|
244
|
+
|
|
245
|
+
1. Read all phase files and their `depends_on` frontmatter
|
|
246
|
+
2. Build a dependency graph:
|
|
247
|
+
- Phase with `depends_on: []` or no `depends_on` field → can run immediately
|
|
248
|
+
- Phase with `depends_on: [phase-1]` → must wait for phase-1 to complete
|
|
249
|
+
3. Identify independent phases — phases that have no unmet dependencies at the same time
|
|
250
|
+
4. If 2+ phases can run simultaneously:
|
|
251
|
+
- Launch each independent phase as a **subagent with worktree isolation** (`isolation: "worktree"`)
|
|
252
|
+
- Each subagent gets its own git worktree — no conflicts
|
|
253
|
+
- Wait for all parallel phases to complete
|
|
254
|
+
5. **Merge parallel results** back to the main branch (in phase order: phase-2 before phase-3):
|
|
255
|
+
- Merge one worktree at a time, in ascending phase order
|
|
256
|
+
- After each merge, run verification gate (tsc + test + lint) to confirm no integration issues
|
|
257
|
+
- **If merge conflict occurs:**
|
|
258
|
+
- Conflicts in different files → auto-resolve (accept both changes)
|
|
259
|
+
- Conflicts in same file → STOP, report to user with both versions, ask which to keep
|
|
260
|
+
- In `--auto` mode: attempt auto-resolve. If same-file conflict → set both phases to `failed`, log details, move on
|
|
261
|
+
- **If verification fails after merge** → the last merged phase likely broke integration. Revert that merge, set its phase to `failed`, continue with remaining phases
|
|
262
|
+
6. Continue with the next group of phases whose dependencies are now met
|
|
263
|
+
|
|
264
|
+
**Example:**
|
|
265
|
+
```
|
|
266
|
+
phase-1 (backend: DB migration) depends_on: []
|
|
267
|
+
phase-2 (backend: Auth endpoints) depends_on: [phase-1]
|
|
268
|
+
phase-3 (backend: User endpoints) depends_on: [phase-1]
|
|
269
|
+
phase-4 (frontend: Auth UI) depends_on: [phase-2]
|
|
270
|
+
phase-5 (frontend: User UI) depends_on: [phase-3]
|
|
271
|
+
|
|
272
|
+
Execution:
|
|
273
|
+
Round 1: phase-1 (sequential — only one ready)
|
|
274
|
+
Round 2: phase-2 + phase-3 (parallel — both depend only on phase-1 which is done)
|
|
275
|
+
Round 3: phase-4 + phase-5 (parallel — each dependency is met)
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
**Rules:**
|
|
279
|
+
- If NO `depends_on` fields exist in any phase → fall back to sequential order (backward compatible)
|
|
280
|
+
- Parallel execution requires `depends_on` to be explicitly set by PM
|
|
281
|
+
- Each parallel subagent follows the same phase execution steps below
|
|
282
|
+
- Verification Gate runs independently in each subagent's worktree
|
|
283
|
+
- Commits happen in each worktree, then merge to main branch in order
|
|
284
|
+
|
|
285
|
+
### Sequential Execution (default)
|
|
286
|
+
|
|
287
|
+
For each phase (in order, or when parallel is not applicable):
|
|
173
288
|
|
|
174
289
|
1. **Read the phase file** — check `role:` field, objective, scope, acceptance criteria
|
|
175
290
|
2. **Activate the role from `role:` field** — read the corresponding role file in `.orchestra/roles/`, follow its rules, principles, ownership scope
|
|
176
|
-
3. **
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
291
|
+
3. **Load Skills (if specified)** — check the phase file for a `skills:` field in frontmatter:
|
|
292
|
+
- If present (e.g. `skills: [auth-setup, crud-api]`), read each skill file from `.orchestra/skills/{name}.md`
|
|
293
|
+
- Follow the skill's checklist alongside the role's engineering standards
|
|
294
|
+
- If a skill file doesn't exist, skip it and log: "⚠️ Skill '{name}' not found — skipping"
|
|
295
|
+
- Skills are supplementary — they don't override role rules, they add domain-specific checklists
|
|
296
|
+
4. **Research (before writing code)** — understand the codebase before making changes:
|
|
297
|
+
- Read existing files in the directories the phase will modify
|
|
298
|
+
- Check current dependency versions in `package.json` — do NOT assume versions from memory
|
|
299
|
+
- If the phase references an external library, verify its current API
|
|
300
|
+
- Identify potential conflicts: are other phases modifying the same files?
|
|
301
|
+
- If the phase builds on a previous phase's output, verify that output exists
|
|
302
|
+
- Time-box research to ~2 minutes. Note what's unclear and proceed with best knowledge
|
|
303
|
+
- Record key findings in context.md under current phase before starting implementation
|
|
304
|
+
5. **Print start status** — `{icon} #role ▶ phase-N: description...`
|
|
305
|
+
6. **Implement** — write code, tests, following the role's engineering standards + loaded skills
|
|
306
|
+
|
|
307
|
+
**Phase Limits (enforced during implementation):**
|
|
308
|
+
- **Time limit:** If a phase exceeds ~15 minutes, pause and report:
|
|
309
|
+
"⏰ Phase-{N} exceeded 15min. Continue or stop?"
|
|
310
|
+
In `--auto` mode: continue but log the overage in context.md
|
|
311
|
+
- **Scope guard:** If you find yourself working on something NOT listed in the phase's
|
|
312
|
+
acceptance criteria → STOP. Note it as a concern in context.md, don't implement it.
|
|
313
|
+
The phase scope is defined by PM — don't expand it.
|
|
314
|
+
- **Tool call guard:** If you've made 40+ tool calls in one phase without committing,
|
|
315
|
+
you're likely over-engineering or stuck. Pause, assess: commit what you have or escalate.
|
|
316
|
+
7. **Verification Gate (MANDATORY before commit)** — you MUST pass ALL checks:
|
|
317
|
+
- Run type check: `npx tsc --noEmit` → must exit 0
|
|
318
|
+
- Run tests: `npm test` / `npx vitest run` → must exit 0
|
|
319
|
+
- Run lint: `npm run lint` → must exit 0 (if configured)
|
|
320
|
+
- Run checks in order. Stop at first failure. Fix and re-run ALL from step 1.
|
|
321
|
+
- Max 3 fix attempts per check. After 3 failures → set phase `failed`, report to user.
|
|
322
|
+
- **NEVER commit if verification fails.**
|
|
323
|
+
- If a check command doesn't exist, skip it but log: "⚠️ No {check} command found — skipping"
|
|
324
|
+
8. **Acceptance Check (after verification, before commit)** — verify you built the right thing:
|
|
325
|
+
- Re-read the phase file's acceptance criteria
|
|
326
|
+
- For EACH criterion, ask: "Does my implementation satisfy this?"
|
|
327
|
+
- If YES → proceed
|
|
328
|
+
- If NO → fix it, re-run verification gate
|
|
329
|
+
- If UNCERTAIN → flag in context.md: "Unverified: {criterion} — {reason}"
|
|
330
|
+
- This catches "code works but doesn't do what was asked" — verification gate only checks if code compiles and tests pass
|
|
331
|
+
9. **Commit** — one conventional commit per phase on current branch (only after verification + acceptance check pass)
|
|
332
|
+
10. **Update phase file** — set `status: done`, fill `## Result`
|
|
333
|
+
11. **Update context.md** — append what was done, decisions made, files touched
|
|
334
|
+
12. **Update Cost Tracking** — append a row to the Cost Tracking table in context.md:
|
|
335
|
+
- Phase name
|
|
336
|
+
- Approximate duration (time from phase start to commit)
|
|
337
|
+
- Number of verification retries (0 if passed first try)
|
|
338
|
+
- This helps PM identify which phases are expensive and improve future grooming
|
|
339
|
+
13. **Print completion status** — `{icon} #role ✅ phase-N done (commit message)`
|
|
183
340
|
|
|
184
341
|
## Architect Phase
|
|
185
342
|
|
|
@@ -197,7 +354,25 @@ Always runs last, after all implementation phases:
|
|
|
197
354
|
- Full changeset: `git diff origin/{branch}...HEAD`
|
|
198
355
|
- Apply the full review checklist (detect backend or frontend mode)
|
|
199
356
|
- If **approved** → proceed to push gate
|
|
200
|
-
- If **
|
|
357
|
+
- If **approved with comments** → proceed to push gate, but log comments in context.md for future reference
|
|
358
|
+
- If **changes-requested** → fix cycle (see below)
|
|
359
|
+
|
|
360
|
+
### Fix Cycle with Conditional Re-review
|
|
361
|
+
|
|
362
|
+
When reviewer returns `changes-requested`:
|
|
363
|
+
|
|
364
|
+
1. Switch to the relevant role (`#backend` or `#frontend`)
|
|
365
|
+
2. Fix the issues identified in the review
|
|
366
|
+
3. Run Verification Gate (test + lint must pass)
|
|
367
|
+
4. Commit the fix
|
|
368
|
+
5. **Check fix size:** count changed lines in the fix commit (`git diff HEAD~1 --stat`)
|
|
369
|
+
- **Fix < 30 lines** → proceed to push gate (no re-review needed)
|
|
370
|
+
- **Fix >= 30 lines** → trigger **abbreviated re-review**:
|
|
371
|
+
- Switch to `#reviewer`
|
|
372
|
+
- Review ONLY the fix commit (`git diff HEAD~1`), not the entire codebase
|
|
373
|
+
- If approved → proceed to push gate
|
|
374
|
+
- If changes-requested again → one more fix round, then proceed regardless
|
|
375
|
+
6. Update context.md: "Fix cycle: {N} lines changed, re-review: {yes/no}"
|
|
201
376
|
|
|
202
377
|
## Approval Gates
|
|
203
378
|
|
|
@@ -214,7 +389,36 @@ Print the gate status but don't wait:
|
|
|
214
389
|
🚦 Push to origin — auto-pushing
|
|
215
390
|
```
|
|
216
391
|
|
|
217
|
-
|
|
392
|
+
### Rejection Flow — When the User Says "No"
|
|
393
|
+
|
|
394
|
+
Gates are not just "yes" checkpoints — the user can reject. Handle each case:
|
|
395
|
+
|
|
396
|
+
**RFC Rejected:**
|
|
397
|
+
1. Ask: "What would you like changed in the RFC?"
|
|
398
|
+
2. Collect specific feedback from the user
|
|
399
|
+
3. Switch back to `#architect` role
|
|
400
|
+
4. Revise the RFC based on feedback — don't start from scratch, amend the existing RFC
|
|
401
|
+
5. Update context.md: "RFC revision round {N}: {what changed}"
|
|
402
|
+
6. Re-submit for approval: "🚦 RFC revised. Approve to start implementation?"
|
|
403
|
+
7. Max 3 revision rounds. After 3 rejections → report: "RFC rejected 3 times. Please clarify the requirements or adjust the PRD."
|
|
404
|
+
|
|
405
|
+
**Push Rejected:**
|
|
406
|
+
1. Ask: "What needs to change before pushing?"
|
|
407
|
+
2. Collect specific feedback
|
|
408
|
+
3. Based on feedback:
|
|
409
|
+
- If code changes needed → create a fix phase, switch to relevant engineer role, implement fix, commit
|
|
410
|
+
- If review concerns → re-trigger abbreviated review (reviewer only checks the fix, not entire codebase)
|
|
411
|
+
- If scope change → report to PM terminal: "User wants scope change — PM should update milestone"
|
|
412
|
+
4. After fix is done → re-submit push gate: "🚦 Fix applied. Push to origin?"
|
|
413
|
+
|
|
414
|
+
**Milestone Rejected (PM terminal):**
|
|
415
|
+
- PM revises the milestone based on user feedback
|
|
416
|
+
- Re-present for approval
|
|
417
|
+
- This is handled in the PM terminal, not the worker terminal
|
|
418
|
+
|
|
419
|
+
## Error Handling & Stuck Detection
|
|
420
|
+
|
|
421
|
+
### Basic Error Handling
|
|
218
422
|
|
|
219
423
|
If something fails mid-phase:
|
|
220
424
|
1. Set phase status to `failed`
|
|
@@ -222,6 +426,86 @@ If something fails mid-phase:
|
|
|
222
426
|
3. Report to user: what failed, why, options (retry / skip / stop)
|
|
223
427
|
4. Wait for user input before proceeding
|
|
224
428
|
|
|
429
|
+
### Stuck Detection
|
|
430
|
+
|
|
431
|
+
You are **stuck** when any of these happen:
|
|
432
|
+
- **Same error 3 times** — you've attempted the same fix 3 times and it still fails
|
|
433
|
+
- **Circular fix** — fixing issue A creates issue B, fixing B recreates A
|
|
434
|
+
- **Verification loop** — verification gate fails 3 times on the same check
|
|
435
|
+
- **No progress** — you're reading files and running commands but not making meaningful code changes after 5+ tool calls
|
|
436
|
+
|
|
437
|
+
### Recovery Protocol
|
|
438
|
+
|
|
439
|
+
When stuck is detected:
|
|
440
|
+
|
|
441
|
+
1. **STOP immediately.** Do not attempt another fix.
|
|
442
|
+
2. **Log the stuck state** in context.md:
|
|
443
|
+
```
|
|
444
|
+
## Stuck — {timestamp}
|
|
445
|
+
- Phase: {phase-name}
|
|
446
|
+
- Symptom: {what's failing}
|
|
447
|
+
- Attempts: {what you tried, numbered}
|
|
448
|
+
- Root cause hypothesis: {your best guess}
|
|
449
|
+
```
|
|
450
|
+
3. **Try a different approach** (ONE attempt):
|
|
451
|
+
- If the same code fix failed 3x → try an entirely different implementation strategy
|
|
452
|
+
- If a dependency is broken → check if an alternative library solves the problem
|
|
453
|
+
- If tests fail due to environment → try isolating the test
|
|
454
|
+
4. **If the different approach also fails** → escalate to user:
|
|
455
|
+
```
|
|
456
|
+
🚨 Stuck on phase-{N}: {description}
|
|
457
|
+
Tried: {numbered list of approaches}
|
|
458
|
+
Root cause: {hypothesis}
|
|
459
|
+
Options:
|
|
460
|
+
1. I'll try {specific alternative} — say "try"
|
|
461
|
+
2. Skip this phase and continue — say "skip"
|
|
462
|
+
3. Stop execution — say "stop"
|
|
463
|
+
```
|
|
464
|
+
5. **Wait for user input.** Do NOT auto-retry indefinitely.
|
|
465
|
+
|
|
466
|
+
### Auto-Recovery (--auto mode)
|
|
467
|
+
|
|
468
|
+
In `--auto` mode, stuck detection still applies but recovery changes:
|
|
469
|
+
- Try the different approach (step 3) automatically
|
|
470
|
+
- If that also fails → set phase to `failed`, log everything to context.md, **move to the next phase**
|
|
471
|
+
- Report the failure in the milestone completion summary
|
|
472
|
+
|
|
473
|
+
## Hotfix Pipeline — `#hotfix {description}`
|
|
474
|
+
|
|
475
|
+
When the user types `#hotfix {description}`, execute an ultra-fast fix pipeline:
|
|
476
|
+
|
|
477
|
+
```
|
|
478
|
+
#hotfix fix login 500 error on invalid email
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
**Pipeline (single flow, no gates except verification):**
|
|
482
|
+
|
|
483
|
+
1. **Create hotfix milestone** automatically:
|
|
484
|
+
- Directory: `.orchestra/milestones/HF-{timestamp}-{slug}/`
|
|
485
|
+
- `milestone.md` with `Complexity: quick`, `Status: in-progress`
|
|
486
|
+
- Single phase file: `phase-1.md` with `role: backend-engineer` (or frontend if user specifies)
|
|
487
|
+
2. **Read relevant code** — based on description, identify likely files
|
|
488
|
+
3. **Implement the fix** — focused, minimal change
|
|
489
|
+
4. **Verification Gate** — test + lint MUST pass (this is the only gate)
|
|
490
|
+
5. **Commit** — `fix({scope}): {description}`
|
|
491
|
+
6. **Push immediately** — no push approval gate for hotfixes
|
|
492
|
+
7. **Update knowledge.md** — append a one-liner:
|
|
493
|
+
`- Hotfix {date}: {description} → {root cause} → {fix applied}`
|
|
494
|
+
8. **Print summary:**
|
|
495
|
+
```
|
|
496
|
+
🚑 Hotfix complete: fix({scope}): {description}
|
|
497
|
+
Commit: {hash}
|
|
498
|
+
Pushed to: {branch}
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
**Rules:**
|
|
502
|
+
- Hotfix NEVER skips verification gate — broken fix is worse than slow fix
|
|
503
|
+
- Hotfix NEVER creates an RFC or triggers review — speed is the priority
|
|
504
|
+
- If verification fails after 3 attempts → STOP, report to user, do NOT push
|
|
505
|
+
- Hotfix works on current branch — no branch creation
|
|
506
|
+
- If `--auto` is active, hotfix runs without any prompts
|
|
507
|
+
- After hotfix, worker returns to normal milestone execution (if `#start` was active)
|
|
508
|
+
|
|
225
509
|
## User Interruptions
|
|
226
510
|
|
|
227
511
|
The user can talk to you at any time during execution. When the user sends a
|
|
@@ -237,6 +521,27 @@ message while you're working:
|
|
|
237
521
|
|
|
238
522
|
The user is the boss. Their input always takes priority over the current phase.
|
|
239
523
|
|
|
524
|
+
## Milestone Retrospective — Auto-Generated After Completion
|
|
525
|
+
|
|
526
|
+
After a milestone is pushed (or after push gate in `--auto` mode), **before moving to the next milestone**, generate a concise retrospective and append it to `.orchestra/knowledge.md`.
|
|
527
|
+
|
|
528
|
+
**Format — exactly 5 lines, no more:**
|
|
529
|
+
|
|
530
|
+
```
|
|
531
|
+
## Retro: {milestone-id} — {milestone-title} ({date})
|
|
532
|
+
- Longest phase: {phase-name} (~{duration}) — {why it was slow}
|
|
533
|
+
- Verification retries: {total count} — {which phases had retries}
|
|
534
|
+
- Stuck: {yes/no} — {if yes, on which phase and root cause}
|
|
535
|
+
- Review findings: {N blocking, N non-blocking} — {top issue if any}
|
|
536
|
+
- Missing skill: {skill name that would have helped, or "none"}
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
**Rules:**
|
|
540
|
+
- Pull data from context.md Cost Tracking table + review results
|
|
541
|
+
- Keep it factual, not narrative — numbers and short labels only
|
|
542
|
+
- If a field has nothing notable, write "none" — don't skip the line
|
|
543
|
+
- This retrospective feeds future grooming: PM reads it before creating similar milestones
|
|
544
|
+
|
|
240
545
|
## What You Do NOT Do
|
|
241
546
|
|
|
242
547
|
- You do NOT create milestones (PM does that)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# Blueprints — Pre-Built Milestone Templates
|
|
2
|
+
|
|
3
|
+
Blueprints are ready-made milestone sets for common project types. Instead of
|
|
4
|
+
PM writing every milestone from scratch, say `#blueprint{name}` and get a full
|
|
5
|
+
set of milestones pre-groomed with phases, skills, and acceptance criteria.
|
|
6
|
+
|
|
7
|
+
## How to Use
|
|
8
|
+
|
|
9
|
+
1. PM activates: `#blueprintsaas-starter`
|
|
10
|
+
2. PM reviews the generated milestones — customize as needed
|
|
11
|
+
3. PM approves → milestones are created in `.orchestra/milestones/`
|
|
12
|
+
4. Worker executes with `#start`
|
|
13
|
+
|
|
14
|
+
## How to Customize
|
|
15
|
+
|
|
16
|
+
Blueprints are starting points, not rigid templates:
|
|
17
|
+
- **Add phases** — need an extra API endpoint? Add a phase to the relevant milestone
|
|
18
|
+
- **Remove phases** — no mobile? Remove React Native phases
|
|
19
|
+
- **Change skills** — using Clerk instead of custom auth? Swap skill references
|
|
20
|
+
- **Reorder milestones** — want CI/CD first? Move it up
|
|
21
|
+
- **Adjust complexity** — blueprint says `full` but you know the domain? Change to `standard`
|
|
22
|
+
|
|
23
|
+
## How to Create a New Blueprint
|
|
24
|
+
|
|
25
|
+
Create a new `.md` file in this directory. Follow the format:
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
# Blueprint: {name}
|
|
29
|
+
|
|
30
|
+
## Description
|
|
31
|
+
What this blueprint is for, what it produces.
|
|
32
|
+
|
|
33
|
+
## Milestones
|
|
34
|
+
|
|
35
|
+
### M1 — {title}
|
|
36
|
+
- Complexity: {quick/standard/full}
|
|
37
|
+
- Phases:
|
|
38
|
+
1. (backend) {description} [skills: {skill-list}]
|
|
39
|
+
2. (backend) {description}
|
|
40
|
+
3. (frontend) {description}
|
|
41
|
+
- Acceptance Criteria:
|
|
42
|
+
- [ ] {criterion}
|
|
43
|
+
|
|
44
|
+
### M2 — {title}
|
|
45
|
+
...
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## How to Add a Component Template
|
|
49
|
+
|
|
50
|
+
If you have a recurring component (e.g. "add a new CRUD resource", "add OAuth provider"),
|
|
51
|
+
create it as a **component blueprint** — a single milestone that can be mixed into any project:
|
|
52
|
+
|
|
53
|
+
```markdown
|
|
54
|
+
# Blueprint: component-crud-resource
|
|
55
|
+
|
|
56
|
+
## Description
|
|
57
|
+
Adds a complete CRUD resource: DB table, API endpoints, validation, tests.
|
|
58
|
+
Use this whenever you need a new entity in your API.
|
|
59
|
+
|
|
60
|
+
## Parameters
|
|
61
|
+
- RESOURCE_NAME: The name of the resource (e.g. "product", "order")
|
|
62
|
+
- FIELDS: List of fields (e.g. "name:string, price:number, active:boolean")
|
|
63
|
+
|
|
64
|
+
## Milestones
|
|
65
|
+
|
|
66
|
+
### M{N} — {RESOURCE_NAME} CRUD
|
|
67
|
+
- Complexity: standard
|
|
68
|
+
- Phases:
|
|
69
|
+
1. (backend) DB schema + migration for {RESOURCE_NAME} [skills: crud-api]
|
|
70
|
+
2. (backend) CRUD endpoints + validation + tests [skills: crud-api]
|
|
71
|
+
3. (frontend) {RESOURCE_NAME} list + detail + form UI
|
|
72
|
+
- Acceptance Criteria:
|
|
73
|
+
- [ ] All CRUD operations work
|
|
74
|
+
- [ ] Input validation on all mutations
|
|
75
|
+
- [ ] Pagination on list endpoint
|
|
76
|
+
- [ ] Tests cover happy path + edge cases
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
PM uses it: `#blueprintcomponent-crud-resource` with `RESOURCE_NAME=product`.
|
|
80
|
+
|
|
81
|
+
## Available Blueprints
|
|
82
|
+
|
|
83
|
+
| Name | Type | Description |
|
|
84
|
+
|------|------|-------------|
|
|
85
|
+
| `saas-starter` | Full project | Auth + DB + API + Dashboard + Deploy |
|
|
86
|
+
| `api-only` | Full project | DB + API + Auth + CI/CD (no frontend) |
|
|
87
|
+
| `component-crud-resource` | Component | Single CRUD entity (reusable) |
|