create-sdd-project 0.15.0 → 0.16.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 CHANGED
@@ -338,7 +338,7 @@ Cross-model reviews only trigger when at least one external CLI is available (Ge
338
338
  - **Standard** (features): 0 → 1 → 2 → 3 → 4 → 5 (+QA) → 6
339
339
  - **Complex** (architectural changes): 0 → 1 (+ADR) → 2 → 3 → 4 → 5 (+QA) → 6
340
340
 
341
- ### 4 Autonomy Levels
341
+ ### 5 Autonomy Levels
342
342
 
343
343
  | Level | Name | Human Checkpoints | Best For |
344
344
  |-------|------|-------------------|----------|
@@ -346,6 +346,7 @@ Cross-model reviews only trigger when at least one external CLI is available (Ge
346
346
  | L2 | Trusted | Plan + Merge | Normal development **(default)** |
347
347
  | L3 | Autopilot | Merge only | Well-defined, repetitive tasks |
348
348
  | L4 | Full Auto | None (CI/CD gates only) | Bulk simple tasks |
349
+ | L5 | PM Autonomous | None + auto feature sequencing | Multi-feature batch execution via `start pm` |
349
350
 
350
351
  Quality gates (tests, lint, build, validators) **always run** regardless of level.
351
352
 
@@ -434,7 +435,7 @@ project/
434
435
 
435
436
  ├── .gemini/
436
437
  │ ├── agents/ # 10 agents (Gemini format)
437
- │ ├── skills/ # Same 4 skills
438
+ │ ├── skills/ # Same 5 skills
438
439
  │ ├── commands/ # Slash commands (workflow + review + context + project review)
439
440
  │ └── settings.json # Gemini configuration
440
441
 
package/lib/config.js CHANGED
@@ -82,6 +82,7 @@ const AUTONOMY_LEVELS = [
82
82
  { level: 2, name: 'Trusted', desc: 'Human reviews plans + merges only (normal development)', default: true },
83
83
  { level: 3, name: 'Autopilot', desc: 'Human only approves merges (well-defined, repetitive tasks)' },
84
84
  { level: 4, name: 'Full Auto', desc: 'No human checkpoints, CI/CD gates only (bulk simple tasks)' },
85
+ { level: 5, name: 'PM Autonomous', desc: 'PM Agent orchestrates features end-to-end (requires "start pm" to activate)' },
85
86
  ];
86
87
 
87
88
  const BRANCHING_STRATEGIES = [
@@ -83,7 +83,7 @@ function runInitDiffReport(config) {
83
83
  if (aiTools !== 'gemini') {
84
84
  const claudeSkills = countFiles(path.join(templateDir, '.claude', 'skills'));
85
85
  wouldCreate.push(` .claude/agents/ ${agentCount} agents${removedAgents > 0 ? ` (${removedAgents} removed: ${projectType}-only)` : ''}`);
86
- wouldCreate.push(` .claude/skills/ ${claudeSkills} files (4 skills)`);
86
+ wouldCreate.push(` .claude/skills/ ${claudeSkills} files (5 skills)`);
87
87
  wouldCreate.push(' .claude/hooks/ quick-scan.sh');
88
88
  wouldCreate.push(' .claude/settings.json');
89
89
  wouldCreate.push(' .claude/commands/ .gitkeep');
@@ -93,7 +93,7 @@ function runInitDiffReport(config) {
93
93
  const geminiSkills = countFiles(path.join(templateDir, '.gemini', 'skills'));
94
94
  const geminiCmds = countFiles(path.join(templateDir, '.gemini', 'commands'));
95
95
  wouldCreate.push(` .gemini/agents/ ${agentCount} agents${removedAgents > 0 ? ` (${removedAgents} removed: ${projectType}-only)` : ''}`);
96
- wouldCreate.push(` .gemini/skills/ ${geminiSkills} files (4 skills)`);
96
+ wouldCreate.push(` .gemini/skills/ ${geminiSkills} files (5 skills)`);
97
97
  wouldCreate.push(` .gemini/commands/ ${geminiCmds} commands`);
98
98
  wouldCreate.push(' .gemini/styles/ default.md');
99
99
  wouldCreate.push(' .gemini/settings.json');
@@ -163,14 +163,14 @@ function runUpgradeDiffReport(config, state) {
163
163
  if (aiTools !== 'gemini') {
164
164
  const agentCount = countAgents(projectType);
165
165
  replaceItems.push(`.claude/agents/ ${agentCount} agents`);
166
- replaceItems.push('.claude/skills/ 4 skills');
166
+ replaceItems.push('.claude/skills/ 5 skills');
167
167
  replaceItems.push('.claude/hooks/ quick-scan.sh');
168
168
  replaceItems.push('.claude/settings.json hooks updated, permissions preserved');
169
169
  }
170
170
  if (aiTools !== 'claude') {
171
171
  const agentCount = countAgents(projectType);
172
172
  replaceItems.push(`.gemini/agents/ ${agentCount} agents`);
173
- replaceItems.push('.gemini/skills/ 4 skills');
173
+ replaceItems.push('.gemini/skills/ 5 skills');
174
174
  replaceItems.push('.gemini/commands/ TOML commands');
175
175
  replaceItems.push('.gemini/styles/ default.md');
176
176
  replaceItems.push('.gemini/settings.json');
package/lib/doctor.js CHANGED
@@ -13,6 +13,7 @@ const {
13
13
  getPackageVersion,
14
14
  detectAiTools,
15
15
  detectProjectType,
16
+ readAutonomyLevel,
16
17
  } = require('./upgrade-generator');
17
18
 
18
19
  const PASS = 'pass';
@@ -66,6 +67,9 @@ function runDoctor(cwd) {
66
67
  // 10. Project Memory
67
68
  results.push(checkProjectMemory(cwd));
68
69
 
70
+ // 11. Autonomy/Skills Consistency
71
+ results.push(checkAutonomySkillConsistency(cwd, aiTools));
72
+
69
73
  return results;
70
74
  }
71
75
 
@@ -486,6 +490,45 @@ function checkProjectMemory(cwd) {
486
490
  };
487
491
  }
488
492
 
493
+ function checkAutonomySkillConsistency(cwd, aiTools) {
494
+ const { level } = readAutonomyLevel(cwd);
495
+
496
+ if (level < 5) {
497
+ return {
498
+ status: PASS,
499
+ message: 'Autonomy/skills consistency: OK',
500
+ details: [],
501
+ };
502
+ }
503
+
504
+ // L5 set — verify pm-orchestrator skill exists in all configured tools
505
+ const toolDirs = [];
506
+ if (aiTools !== 'gemini') toolDirs.push('.claude');
507
+ if (aiTools !== 'claude') toolDirs.push('.gemini');
508
+
509
+ const missing = [];
510
+ for (const dir of toolDirs) {
511
+ const pmSkillPath = path.join(cwd, dir, 'skills', 'pm-orchestrator', 'SKILL.md');
512
+ if (!fs.existsSync(pmSkillPath)) {
513
+ missing.push(`${dir}/skills/pm-orchestrator/SKILL.md`);
514
+ }
515
+ }
516
+
517
+ if (missing.length > 0) {
518
+ return {
519
+ status: WARN,
520
+ message: 'L5 (PM Autonomous) set but pm-orchestrator skill missing',
521
+ details: [...missing.map((f) => `Missing: ${f}`), 'Run: npx create-sdd-project --upgrade'],
522
+ };
523
+ }
524
+
525
+ return {
526
+ status: PASS,
527
+ message: 'Autonomy/skills consistency: L5 + pm-orchestrator present',
528
+ details: [],
529
+ };
530
+ }
531
+
489
532
  module.exports = {
490
533
  runDoctor,
491
534
  printResults,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-sdd-project",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
4
4
  "description": "Create a new SDD DevFlow project with AI-assisted development workflow",
5
5
  "bin": {
6
6
  "create-sdd-project": "bin/cli.js"
@@ -19,7 +19,7 @@
19
19
  "hooks": [
20
20
  {
21
21
  "type": "command",
22
- "command": "echo '{\"additionalContext\": \"Context was compacted. BEFORE doing anything else: (1) Read the product tracker Active Session (docs/project_notes/product-tracker.md) for context recovery. (2) Re-read the SKILL.md for your current workflow (.claude/skills/development-workflow/SKILL.md) to know what actions are required at your current step. (3) If at Step 5 or later, you MUST read references/merge-checklist.md and fill the Merge Checklist Evidence table in the ticket before requesting merge approval.\"}'",
22
+ "command": "bash -c 'if [ -f \"$CLAUDE_PROJECT_DIR/docs/project_notes/pm-session.lock\" ]; then echo \"{\\\"additionalContext\\\": \\\"PM Autonomous session active. BEFORE doing anything else: (1) Read docs/project_notes/pm-session.md for full PM state. (2) Read the product tracker Active Session. (3) Run: continue pm\\\"}\"; else echo \"{\\\"additionalContext\\\": \\\"Context was compacted. BEFORE doing anything else: (1) Read the product tracker Active Session (docs/project_notes/product-tracker.md) for context recovery. (2) Re-read the SKILL.md for your current workflow (.claude/skills/development-workflow/SKILL.md) to know what actions are required at your current step. (3) If at Step 5 or later, you MUST read references/merge-checklist.md and fill the Merge Checklist Evidence table in the ticket before requesting merge approval.\\\"}\"; fi'",
23
23
  "statusMessage": "Injecting recovery context..."
24
24
  }
25
25
  ]
@@ -39,17 +39,19 @@ description: "Orchestrates the complete development workflow for each feature. I
39
39
 
40
40
  Read the **Autonomy Level** from `CLAUDE.md` section 2.
41
41
 
42
- | Checkpoint | L1 Full Control | L2 Trusted | L3 Autopilot | L4 Full Auto |
43
- |------------|:-:|:-:|:-:|:-:|
44
- | Spec Approval (Step 0) | Required | Auto | Auto | Auto |
45
- | Ticket Approval (Step 1) | Required | Auto | Auto | Auto |
46
- | Plan Approval (Step 2) | Required | Required | Auto | Auto |
47
- | Commit Approval (Step 4) | Required | Auto | Auto | Auto |
48
- | Merge Approval (Step 5) | Required | Required | Required | Auto |
42
+ | Checkpoint | L1 Full Control | L2 Trusted | L3 Autopilot | L4 Full Auto | L5 PM Auto |
43
+ |------------|:-:|:-:|:-:|:-:|:-:|
44
+ | Spec Approval (Step 0) | Required | Auto | Auto | Auto | Auto |
45
+ | Ticket Approval (Step 1) | Required | Auto | Auto | Auto | Auto |
46
+ | Plan Approval (Step 2) | Required | Required | Auto | Auto | Auto |
47
+ | Commit Approval (Step 4) | Required | Auto | Auto | Auto | Auto |
48
+ | Merge Approval (Step 5) | Required | Required | Required | Auto | Auto |
49
+ | Next Feature (PM loop) | — | — | — | — | Auto |
49
50
 
50
51
  - **Auto** = proceed without asking; log in product tracker → "Auto-Approved Decisions" table
51
52
  - **Required** = ask user explicitly; do NOT continue without approval
52
53
  - **Quality gates always run** regardless of level (tests, lint, build, validators)
54
+ - **L5** behaves like L4 for individual checkpoints. The `pm-orchestrator` skill handles automatic feature sequencing via `start pm`.
53
55
  - **Steps are strictly sequential.** Do NOT start a later step before the current checkpoint is approved — even when the checkpoint is Auto (auto-approval still happens in order, not in parallel). In particular, do NOT generate the Implementation Plan (Step 2) while Spec Approval (Step 0) is still pending. Reason: if the spec review finds issues, any plan built on the flawed spec must be discarded and redone — parallelizing wastes work and risks shipping a plan that doesn't match the final spec.
54
56
 
55
57
  ---
@@ -77,6 +77,7 @@ Complexity and Autonomy Level combine to determine the effective workflow overhe
77
77
  | Standard + L3-4 | Fast execution, quality gates + QA still enforced |
78
78
  | Complex + L1 | Full ceremony (all checkpoints + QA + ADR) |
79
79
  | Complex + L3-4 | Fast but with QA engineer + ADR |
80
+ | Any + L5 | Same as L4 per feature, but PM Orchestrator auto-sequences features via `start pm` |
80
81
 
81
82
  **Note:** The user can override the autonomy level per-task. E.g., "use level 1 for this task" forces all checkpoints regardless of the project-level setting.
82
83
 
@@ -0,0 +1,212 @@
1
+ ---
2
+ name: pm-orchestrator
3
+ description: "PM Agent that orchestrates sequential multi-feature development. Invoke with: 'start pm', 'continue pm', 'stop pm', or 'pm status'."
4
+ ---
5
+
6
+ # PM Orchestrator
7
+
8
+ Autonomously develops multiple features in sequence using the `development-workflow` skill. Requires **L5 (PM Autonomous)** autonomy level.
9
+
10
+ ## Commands
11
+
12
+ | Command | Action |
13
+ |---------|--------|
14
+ | `start pm` | Start a new autonomous session — classify batch, then loop |
15
+ | `continue pm` | Resume after /compact or session restart |
16
+ | `stop pm` | Graceful stop after current feature completes |
17
+ | `pm status` | Show progress summary from pm-session.md |
18
+
19
+ ## Prerequisites
20
+
21
+ Before starting:
22
+
23
+ 1. **Autonomy Level must be L5.** Read `CLAUDE.md` → verify `Autonomy Level: 5 (PM Autonomous)`. If not L5, tell the user and stop.
24
+ 2. **Product tracker must have pending features.** Read `docs/project_notes/product-tracker.md` → Features table. If no features have step < 6/6, there is nothing to do.
25
+ 3. **Working tree must be clean.** Run `git status`. If dirty, ask user to commit or stash.
26
+ 4. **No active PM session.** Check if `docs/project_notes/pm-session.lock` exists. If it does, another PM session may be running — ask user before proceeding.
27
+
28
+ ---
29
+
30
+ ## `start pm` — New Autonomous Session
31
+
32
+ ### Phase 1: Batch Selection
33
+
34
+ 1. Read `docs/project_notes/product-tracker.md` → collect all features with step < 6/6.
35
+ 2. **Filter out** features whose dependencies are not yet done (check the Dependencies column and verify the dependency feature has step 6/6).
36
+ 3. **Sort** by priority (High > Medium > Low), then by feature ID ascending.
37
+ 4. Present the first **1-3 eligible features** to the user as a rolling batch:
38
+
39
+ ```
40
+ PM Orchestrator — Batch Classification
41
+
42
+ These features are ready to develop:
43
+
44
+ | # | Feature | Type | Priority | Dependencies |
45
+ |---|---------|------|----------|--------------|
46
+ | 1 | F014 — Short Name | backend | High | F006 (done) |
47
+ | 2 | F015 — Short Name | backend | Medium | none |
48
+ | 3 | F016 — Short Name | fullstack | Medium | F014 |
49
+
50
+ Classify complexity for each (Simple / Standard / Complex):
51
+ ```
52
+
53
+ 5. Wait for user to classify all features in the batch.
54
+
55
+ ### Phase 2: Session Initialization
56
+
57
+ 1. Create `docs/project_notes/pm-session.lock` with content: `session started at {ISO date}`.
58
+ 2. Create `docs/project_notes/pm-session.md` from `references/pm-session-template.md`:
59
+ - Fill **Started** date, **Session ID** (short random ID), **Target Branch** (from `docs/project_notes/key_facts.md` → branching strategy: github-flow → `main`, gitflow → `develop`).
60
+ - Fill the **Current Batch** table with classified features.
61
+ - Set **Status** to `in-progress`.
62
+
63
+ ### Phase 3: Orchestration Loop
64
+
65
+ For each feature in the batch:
66
+
67
+ #### a. Pre-flight Checks
68
+
69
+ - **Kill switch**: If `docs/project_notes/pm-stop.md` exists → stop gracefully (go to Shutdown).
70
+ - **Lock**: If `docs/project_notes/pm-session.lock` is missing → stop (session was terminated externally).
71
+ - **Circuit breaker**: If 3 consecutive features are `blocked` → stop and report to user.
72
+ - **Clean workspace**: Run `git status`. If dirty, commit or stash before proceeding.
73
+
74
+ #### b. Start Feature
75
+
76
+ 1. Update `pm-session.md`: set current feature status to `in-progress`, note step 0/6.
77
+ 2. Invoke the `development-workflow` skill:
78
+ - Command: `start task FXXX as [Simple|Standard|Complex]`
79
+ - The development-workflow reads L5 → all checkpoints auto-approve.
80
+ - All quality gates run as normal (tests, lint, build, validators, code review, QA).
81
+ - At Step 5 (Review): execute `/audit-merge` before the merge checklist evidence.
82
+
83
+ #### c. Feature Completed (Step 6 done)
84
+
85
+ 1. Verify `docs/project_notes/product-tracker.md` shows the feature at step 6/6 with status `done`.
86
+ 2. **Post-merge sanity check**: Run `npm test` (or the project's test command) on the target branch.
87
+ - If tests **fail** → STOP immediately. The merged feature broke the target branch. Report to user.
88
+ - If tests **pass** → continue.
89
+ 3. Update `pm-session.md`: set feature status to `done`, record approximate duration.
90
+ 4. Reset consecutive failure counter to 0.
91
+
92
+ #### d. Feature Failed
93
+
94
+ If the development-workflow encounters a failure during any step:
95
+
96
+ 1. The existing retry/fix loop runs (max 3 retries per step, per the `failure-handling.md` reference).
97
+ 2. If retries exhausted:
98
+ - Update `pm-session.md`: set feature status to `blocked`, note the failure reason.
99
+ - Increment consecutive failure counter.
100
+ - Skip to the next feature in the batch.
101
+ 3. If merge conflicts prevent completion:
102
+ - Mark as `blocked` with reason "merge conflict".
103
+ - Skip to next feature.
104
+
105
+ #### e. Batch Boundary
106
+
107
+ After each completed or blocked feature:
108
+
109
+ 1. **Re-read** `docs/project_notes/product-tracker.md` to check for newly unblocked features (dynamic dependency resolution).
110
+ 2. If the current batch is exhausted and more eligible features remain:
111
+ - Present the next 1-3 features to the user for complexity classification.
112
+ - Add them to the batch in `pm-session.md`.
113
+ 3. If **3+ features completed** in this session → suggest the user run `/compact` before continuing (context may be getting heavy).
114
+ 4. If max session limit reached (**5 features**) → stop and report.
115
+
116
+ ### Phase 4: Shutdown
117
+
118
+ 1. Update `pm-session.md`:
119
+ - Set **Status** to `completed` (if all done) or `stopped` (if interrupted).
120
+ - Ensure all feature statuses are up to date.
121
+ 2. Remove `docs/project_notes/pm-session.lock`.
122
+ 3. Remove `docs/project_notes/pm-stop.md` if it exists.
123
+ 4. Print final report:
124
+
125
+ ```
126
+ PM Session Complete
127
+
128
+ | Feature | Status | Duration | Notes |
129
+ |---------|--------|----------|-------|
130
+ | F014 | done | ~8 min | Clean |
131
+ | F015 | done | ~12 min | 1 QA fix |
132
+ | F016 | blocked | — | Merge conflict |
133
+
134
+ Completed: 2/3 | Blocked: 1/3 | Remaining: 0
135
+ ```
136
+
137
+ ---
138
+
139
+ ## `continue pm` — Resume After /compact or Restart
140
+
141
+ 1. Read `docs/project_notes/pm-session.md`. If it doesn't exist, inform user there is no active session.
142
+ 2. **Validate session Status.** If Status is `completed` or `stopped`, inform user the session has ended. To start a new one, delete pm-session.md and run `start pm`.
143
+ 3. **Re-create lock.** If `docs/project_notes/pm-session.lock` is missing (e.g., after terminal crash), re-create it with content: `session resumed at {ISO date}`.
144
+ 4. Find the feature with status `in-progress`:
145
+ - Read its ticket file and the product tracker Active Session to determine current step.
146
+ - Resume the `development-workflow` from that step.
147
+ 5. After the in-progress feature completes, re-enter the Orchestration Loop at step (e).
148
+ 6. If no `in-progress` feature exists but `pending` features remain, pick the next one and enter step (b).
149
+
150
+ ---
151
+
152
+ ## `stop pm` — Graceful Stop
153
+
154
+ 1. Create `docs/project_notes/pm-stop.md` with content: `stop requested at {ISO date}`.
155
+ 2. The orchestration loop will detect this file at the next pre-flight check and shut down gracefully.
156
+ 3. The current feature will complete its current step before stopping.
157
+
158
+ ---
159
+
160
+ ## `pm status` — Progress Summary
161
+
162
+ 1. Read `docs/project_notes/pm-session.md`.
163
+ 2. Display the Current Batch table and Recovery Instructions.
164
+ 3. If no session exists, inform the user.
165
+
166
+ ---
167
+
168
+ ## Guardrails
169
+
170
+ | Guardrail | Value | Rationale |
171
+ |-----------|-------|-----------|
172
+ | Max features per session | 5 | Model attention degrades after many iterations |
173
+ | Consecutive failure circuit breaker | 3 | Prevent wasting resources on a systemic issue |
174
+ | Kill switch | `pm-stop.md` or `stop pm` | User can always halt the loop |
175
+ | Session lock | `pm-session.lock` | Prevents concurrent PM sessions |
176
+ | Quality gates | Always enforced | Tests, lint, build, validators, code review, QA, `/audit-merge` |
177
+ | Post-merge sanity | `npm test` on target branch | Catch regressions immediately |
178
+ | Rolling batch | 1-3 features | Avoid over-committing; allows dynamic re-prioritization |
179
+ | Clean workspace | `git status` before each feature | Prevent dirty state contamination |
180
+
181
+ ## Edge Cases
182
+
183
+ 1. **Feature mid-execution during /compact**: `continue pm` reads pm-session.md → finds in-progress feature → reads tracker Active Session → resumes development-workflow from that step.
184
+
185
+ 2. **pm-session.md vs tracker disagreement**: Product tracker is the **source of truth**. If pm-session.md says "done" but tracker says "in-progress", trust the tracker and re-verify.
186
+
187
+ 3. **User modifies tracker mid-session**: PM re-reads tracker between features (not mid-feature). Changes take effect at the next feature boundary.
188
+
189
+ 4. **Branch already exists**: development-workflow Step 1 handles this — checks out existing branch and resumes.
190
+
191
+ 5. **L5 selected but `start task` used directly**: development-workflow at L5 behaves exactly like L4 (all checkpoints auto). The PM loop is opt-in via `start pm`, not forced by L5.
192
+
193
+ 6. **Batch classification changes**: User can `stop pm`, edit pm-session.md complexity column, then `continue pm`.
194
+
195
+ 7. **Post-merge sanity check fails**: STOP immediately. The merged feature introduced a regression on the target branch. Do NOT continue — user must investigate manually.
196
+
197
+ 8. **Gemini CLI limitations**: PM Orchestrator instructions are mirrored for Gemini. L5 PM Orchestrator is fully designed for Claude Code; Gemini support is best-effort.
198
+
199
+ ## References
200
+
201
+ - `references/pm-session-template.md` — Template for the session state file
202
+ - `.claude/skills/development-workflow/SKILL.md` — The workflow invoked for each feature
203
+ - `docs/project_notes/product-tracker.md` — Source of truth for feature status
204
+ - `.claude/skills/development-workflow/references/failure-handling.md` — Retry and rollback patterns
205
+
206
+ ## Constraints
207
+
208
+ - **One feature at a time.** Sequential execution only — no parallel features.
209
+ - **Do NOT skip quality gates.** Even at L5, tests/lint/build/validators/review/QA always execute.
210
+ - **Do NOT force-resolve merge conflicts.** Mark as blocked and skip.
211
+ - **Do NOT modify pm-session.md format.** Follow the template structure exactly.
212
+ - **Do NOT continue after post-merge sanity failure.** Stop and report.
@@ -0,0 +1,39 @@
1
+ # PM Autonomous Session
2
+
3
+ **Started:** {date}
4
+ **Session ID:** {short-id}
5
+ **Autonomy Level:** L5 (PM Autonomous)
6
+ **Status:** in-progress
7
+ **Target Branch:** {main|develop}
8
+
9
+ ## Current Batch
10
+
11
+ | Feature | Complexity | Status | Duration | Notes |
12
+ |---------|------------|--------|----------|-------|
13
+ | F0XX | Simple | pending | — | — |
14
+
15
+ ## Completed Features
16
+
17
+ _(Move features here as they complete)_
18
+
19
+ | Feature | Complexity | Duration | Notes |
20
+ |---------|------------|----------|-------|
21
+ <!-- | F0XX | Simple | ~8 min | Clean | -->
22
+
23
+ ## Blocked Features
24
+
25
+ _(Move features here if blocked)_
26
+
27
+ | Feature | Reason | Step |
28
+ |---------|--------|------|
29
+ <!-- | F0XX | Merge conflict | 5/6 | -->
30
+
31
+ ## Recovery Instructions
32
+
33
+ **Current feature:** (none yet)
34
+ **Branch:** (none yet)
35
+ **Next features:** (see Current Batch table)
36
+ **Blocked:** (none)
37
+
38
+ To resume after /compact: run `continue pm`
39
+ To stop gracefully: run `stop pm`
@@ -39,17 +39,19 @@ description: "Orchestrates the complete development workflow for each feature. I
39
39
 
40
40
  Read the **Autonomy Level** from `GEMINI.md`.
41
41
 
42
- | Checkpoint | L1 Full Control | L2 Trusted | L3 Autopilot | L4 Full Auto |
43
- |------------|:-:|:-:|:-:|:-:|
44
- | Spec Approval (Step 0) | Required | Auto | Auto | Auto |
45
- | Ticket Approval (Step 1) | Required | Auto | Auto | Auto |
46
- | Plan Approval (Step 2) | Required | Required | Auto | Auto |
47
- | Commit Approval (Step 4) | Required | Auto | Auto | Auto |
48
- | Merge Approval (Step 5) | Required | Required | Required | Auto |
42
+ | Checkpoint | L1 Full Control | L2 Trusted | L3 Autopilot | L4 Full Auto | L5 PM Auto |
43
+ |------------|:-:|:-:|:-:|:-:|:-:|
44
+ | Spec Approval (Step 0) | Required | Auto | Auto | Auto | Auto |
45
+ | Ticket Approval (Step 1) | Required | Auto | Auto | Auto | Auto |
46
+ | Plan Approval (Step 2) | Required | Required | Auto | Auto | Auto |
47
+ | Commit Approval (Step 4) | Required | Auto | Auto | Auto | Auto |
48
+ | Merge Approval (Step 5) | Required | Required | Required | Auto | Auto |
49
+ | Next Feature (PM loop) | — | — | — | — | Auto |
49
50
 
50
51
  - **Auto** = proceed without asking; log in product tracker → "Auto-Approved Decisions" table
51
52
  - **Required** = ask user explicitly; do NOT continue without approval
52
53
  - **Quality gates always run** regardless of level (tests, lint, build, validators)
54
+ - **L5** behaves like L4 for individual checkpoints. The `pm-orchestrator` skill handles automatic feature sequencing via `start pm`.
53
55
  - **Steps are strictly sequential.** Do NOT start a later step before the current checkpoint is approved — even when the checkpoint is Auto (auto-approval still happens in order, not in parallel). In particular, do NOT generate the Implementation Plan (Step 2) while Spec Approval (Step 0) is still pending. Reason: if the spec review finds issues, any plan built on the flawed spec must be discarded and redone — parallelizing wastes work and risks shipping a plan that doesn't match the final spec.
54
56
 
55
57
  ---
@@ -77,6 +77,7 @@ Complexity and Autonomy Level combine to determine the effective workflow overhe
77
77
  | Standard + L3-4 | Fast execution, quality gates + QA still enforced |
78
78
  | Complex + L1 | Full ceremony (all checkpoints + QA + ADR) |
79
79
  | Complex + L3-4 | Fast but with QA engineer + ADR |
80
+ | Any + L5 | Same as L4 per feature, but PM Orchestrator auto-sequences features via `start pm` |
80
81
 
81
82
  **Note:** The user can override the autonomy level per-task. E.g., "use level 1 for this task" forces all checkpoints regardless of the project-level setting.
82
83
 
@@ -0,0 +1,212 @@
1
+ ---
2
+ name: pm-orchestrator
3
+ description: "PM Agent that orchestrates sequential multi-feature development. Invoke with: 'start pm', 'continue pm', 'stop pm', or 'pm status'."
4
+ ---
5
+
6
+ # PM Orchestrator
7
+
8
+ Autonomously develops multiple features in sequence using the `development-workflow` skill. Requires **L5 (PM Autonomous)** autonomy level.
9
+
10
+ ## Commands
11
+
12
+ | Command | Action |
13
+ |---------|--------|
14
+ | `start pm` | Start a new autonomous session — classify batch, then loop |
15
+ | `continue pm` | Resume after /compact or session restart |
16
+ | `stop pm` | Graceful stop after current feature completes |
17
+ | `pm status` | Show progress summary from pm-session.md |
18
+
19
+ ## Prerequisites
20
+
21
+ Before starting:
22
+
23
+ 1. **Autonomy Level must be L5.** Read `GEMINI.md` → verify `Autonomy Level: 5 (PM Autonomous)`. If not L5, tell the user and stop.
24
+ 2. **Product tracker must have pending features.** Read `docs/project_notes/product-tracker.md` → Features table. If no features have step < 6/6, there is nothing to do.
25
+ 3. **Working tree must be clean.** Run `git status`. If dirty, ask user to commit or stash.
26
+ 4. **No active PM session.** Check if `docs/project_notes/pm-session.lock` exists. If it does, another PM session may be running — ask user before proceeding.
27
+
28
+ ---
29
+
30
+ ## `start pm` — New Autonomous Session
31
+
32
+ ### Phase 1: Batch Selection
33
+
34
+ 1. Read `docs/project_notes/product-tracker.md` → collect all features with step < 6/6.
35
+ 2. **Filter out** features whose dependencies are not yet done (check the Dependencies column and verify the dependency feature has step 6/6).
36
+ 3. **Sort** by priority (High > Medium > Low), then by feature ID ascending.
37
+ 4. Present the first **1-3 eligible features** to the user as a rolling batch:
38
+
39
+ ```
40
+ PM Orchestrator — Batch Classification
41
+
42
+ These features are ready to develop:
43
+
44
+ | # | Feature | Type | Priority | Dependencies |
45
+ |---|---------|------|----------|--------------|
46
+ | 1 | F014 — Short Name | backend | High | F006 (done) |
47
+ | 2 | F015 — Short Name | backend | Medium | none |
48
+ | 3 | F016 — Short Name | fullstack | Medium | F014 |
49
+
50
+ Classify complexity for each (Simple / Standard / Complex):
51
+ ```
52
+
53
+ 5. Wait for user to classify all features in the batch.
54
+
55
+ ### Phase 2: Session Initialization
56
+
57
+ 1. Create `docs/project_notes/pm-session.lock` with content: `session started at {ISO date}`.
58
+ 2. Create `docs/project_notes/pm-session.md` from `references/pm-session-template.md`:
59
+ - Fill **Started** date, **Session ID** (short random ID), **Target Branch** (from `docs/project_notes/key_facts.md` → branching strategy: github-flow → `main`, gitflow → `develop`).
60
+ - Fill the **Current Batch** table with classified features.
61
+ - Set **Status** to `in-progress`.
62
+
63
+ ### Phase 3: Orchestration Loop
64
+
65
+ For each feature in the batch:
66
+
67
+ #### a. Pre-flight Checks
68
+
69
+ - **Kill switch**: If `docs/project_notes/pm-stop.md` exists → stop gracefully (go to Shutdown).
70
+ - **Lock**: If `docs/project_notes/pm-session.lock` is missing → stop (session was terminated externally).
71
+ - **Circuit breaker**: If 3 consecutive features are `blocked` → stop and report to user.
72
+ - **Clean workspace**: Run `git status`. If dirty, commit or stash before proceeding.
73
+
74
+ #### b. Start Feature
75
+
76
+ 1. Update `pm-session.md`: set current feature status to `in-progress`, note step 0/6.
77
+ 2. Invoke the `development-workflow` skill:
78
+ - Command: `start task FXXX as [Simple|Standard|Complex]`
79
+ - The development-workflow reads L5 → all checkpoints auto-approve.
80
+ - All quality gates run as normal (tests, lint, build, validators, code review, QA).
81
+ - At Step 5 (Review): execute `/audit-merge` before the merge checklist evidence.
82
+
83
+ #### c. Feature Completed (Step 6 done)
84
+
85
+ 1. Verify `docs/project_notes/product-tracker.md` shows the feature at step 6/6 with status `done`.
86
+ 2. **Post-merge sanity check**: Run `npm test` (or the project's test command) on the target branch.
87
+ - If tests **fail** → STOP immediately. The merged feature broke the target branch. Report to user.
88
+ - If tests **pass** → continue.
89
+ 3. Update `pm-session.md`: set feature status to `done`, record approximate duration.
90
+ 4. Reset consecutive failure counter to 0.
91
+
92
+ #### d. Feature Failed
93
+
94
+ If the development-workflow encounters a failure during any step:
95
+
96
+ 1. The existing retry/fix loop runs (max 3 retries per step, per the `failure-handling.md` reference).
97
+ 2. If retries exhausted:
98
+ - Update `pm-session.md`: set feature status to `blocked`, note the failure reason.
99
+ - Increment consecutive failure counter.
100
+ - Skip to the next feature in the batch.
101
+ 3. If merge conflicts prevent completion:
102
+ - Mark as `blocked` with reason "merge conflict".
103
+ - Skip to next feature.
104
+
105
+ #### e. Batch Boundary
106
+
107
+ After each completed or blocked feature:
108
+
109
+ 1. **Re-read** `docs/project_notes/product-tracker.md` to check for newly unblocked features (dynamic dependency resolution).
110
+ 2. If the current batch is exhausted and more eligible features remain:
111
+ - Present the next 1-3 features to the user for complexity classification.
112
+ - Add them to the batch in `pm-session.md`.
113
+ 3. If **3+ features completed** in this session → suggest the user run `/compact` before continuing (context may be getting heavy).
114
+ 4. If max session limit reached (**5 features**) → stop and report.
115
+
116
+ ### Phase 4: Shutdown
117
+
118
+ 1. Update `pm-session.md`:
119
+ - Set **Status** to `completed` (if all done) or `stopped` (if interrupted).
120
+ - Ensure all feature statuses are up to date.
121
+ 2. Remove `docs/project_notes/pm-session.lock`.
122
+ 3. Remove `docs/project_notes/pm-stop.md` if it exists.
123
+ 4. Print final report:
124
+
125
+ ```
126
+ PM Session Complete
127
+
128
+ | Feature | Status | Duration | Notes |
129
+ |---------|--------|----------|-------|
130
+ | F014 | done | ~8 min | Clean |
131
+ | F015 | done | ~12 min | 1 QA fix |
132
+ | F016 | blocked | — | Merge conflict |
133
+
134
+ Completed: 2/3 | Blocked: 1/3 | Remaining: 0
135
+ ```
136
+
137
+ ---
138
+
139
+ ## `continue pm` — Resume After /compact or Restart
140
+
141
+ 1. Read `docs/project_notes/pm-session.md`. If it doesn't exist, inform user there is no active session.
142
+ 2. **Validate session Status.** If Status is `completed` or `stopped`, inform user the session has ended. To start a new one, delete pm-session.md and run `start pm`.
143
+ 3. **Re-create lock.** If `docs/project_notes/pm-session.lock` is missing (e.g., after terminal crash), re-create it with content: `session resumed at {ISO date}`.
144
+ 4. Find the feature with status `in-progress`:
145
+ - Read its ticket file and the product tracker Active Session to determine current step.
146
+ - Resume the `development-workflow` from that step.
147
+ 5. After the in-progress feature completes, re-enter the Orchestration Loop at step (e).
148
+ 6. If no `in-progress` feature exists but `pending` features remain, pick the next one and enter step (b).
149
+
150
+ ---
151
+
152
+ ## `stop pm` — Graceful Stop
153
+
154
+ 1. Create `docs/project_notes/pm-stop.md` with content: `stop requested at {ISO date}`.
155
+ 2. The orchestration loop will detect this file at the next pre-flight check and shut down gracefully.
156
+ 3. The current feature will complete its current step before stopping.
157
+
158
+ ---
159
+
160
+ ## `pm status` — Progress Summary
161
+
162
+ 1. Read `docs/project_notes/pm-session.md`.
163
+ 2. Display the Current Batch table and Recovery Instructions.
164
+ 3. If no session exists, inform the user.
165
+
166
+ ---
167
+
168
+ ## Guardrails
169
+
170
+ | Guardrail | Value | Rationale |
171
+ |-----------|-------|-----------|
172
+ | Max features per session | 5 | Model attention degrades after many iterations |
173
+ | Consecutive failure circuit breaker | 3 | Prevent wasting resources on a systemic issue |
174
+ | Kill switch | `pm-stop.md` or `stop pm` | User can always halt the loop |
175
+ | Session lock | `pm-session.lock` | Prevents concurrent PM sessions |
176
+ | Quality gates | Always enforced | Tests, lint, build, validators, code review, QA, `/audit-merge` |
177
+ | Post-merge sanity | `npm test` on target branch | Catch regressions immediately |
178
+ | Rolling batch | 1-3 features | Avoid over-committing; allows dynamic re-prioritization |
179
+ | Clean workspace | `git status` before each feature | Prevent dirty state contamination |
180
+
181
+ ## Edge Cases
182
+
183
+ 1. **Feature mid-execution during /compact**: `continue pm` reads pm-session.md → finds in-progress feature → reads tracker Active Session → resumes development-workflow from that step.
184
+
185
+ 2. **pm-session.md vs tracker disagreement**: Product tracker is the **source of truth**. If pm-session.md says "done" but tracker says "in-progress", trust the tracker and re-verify.
186
+
187
+ 3. **User modifies tracker mid-session**: PM re-reads tracker between features (not mid-feature). Changes take effect at the next feature boundary.
188
+
189
+ 4. **Branch already exists**: development-workflow Step 1 handles this — checks out existing branch and resumes.
190
+
191
+ 5. **L5 selected but `start task` used directly**: development-workflow at L5 behaves exactly like L4 (all checkpoints auto). The PM loop is opt-in via `start pm`, not forced by L5.
192
+
193
+ 6. **Batch classification changes**: User can `stop pm`, edit pm-session.md complexity column, then `continue pm`.
194
+
195
+ 7. **Post-merge sanity check fails**: STOP immediately. The merged feature introduced a regression on the target branch. Do NOT continue — user must investigate manually.
196
+
197
+ 8. **Gemini CLI limitations**: PM Orchestrator instructions are mirrored for Gemini. L5 PM Orchestrator is fully designed for Claude Code; Gemini support is best-effort.
198
+
199
+ ## References
200
+
201
+ - `references/pm-session-template.md` — Template for the session state file
202
+ - `.gemini/skills/development-workflow/SKILL.md` — The workflow invoked for each feature
203
+ - `docs/project_notes/product-tracker.md` — Source of truth for feature status
204
+ - `.gemini/skills/development-workflow/references/failure-handling.md` — Retry and rollback patterns
205
+
206
+ ## Constraints
207
+
208
+ - **One feature at a time.** Sequential execution only — no parallel features.
209
+ - **Do NOT skip quality gates.** Even at L5, tests/lint/build/validators/review/QA always execute.
210
+ - **Do NOT force-resolve merge conflicts.** Mark as blocked and skip.
211
+ - **Do NOT modify pm-session.md format.** Follow the template structure exactly.
212
+ - **Do NOT continue after post-merge sanity failure.** Stop and report.
@@ -0,0 +1,39 @@
1
+ # PM Autonomous Session
2
+
3
+ **Started:** {date}
4
+ **Session ID:** {short-id}
5
+ **Autonomy Level:** L5 (PM Autonomous)
6
+ **Status:** in-progress
7
+ **Target Branch:** {main|develop}
8
+
9
+ ## Current Batch
10
+
11
+ | Feature | Complexity | Status | Duration | Notes |
12
+ |---------|------------|--------|----------|-------|
13
+ | F0XX | Simple | pending | — | — |
14
+
15
+ ## Completed Features
16
+
17
+ _(Move features here as they complete)_
18
+
19
+ | Feature | Complexity | Duration | Notes |
20
+ |---------|------------|----------|-------|
21
+ <!-- | F0XX | Simple | ~8 min | Clean | -->
22
+
23
+ ## Blocked Features
24
+
25
+ _(Move features here if blocked)_
26
+
27
+ | Feature | Reason | Step |
28
+ |---------|--------|------|
29
+ <!-- | F0XX | Merge conflict | 5/6 | -->
30
+
31
+ ## Recovery Instructions
32
+
33
+ **Current feature:** (none yet)
34
+ **Branch:** (none yet)
35
+ **Next features:** (see Current Batch table)
36
+ **Blocked:** (none)
37
+
38
+ To resume after /compact: run `continue pm`
39
+ To stop gracefully: run `stop pm`
@@ -59,6 +59,18 @@ The project includes pre-configured hooks in `.claude/settings.json`:
59
59
 
60
60
  Personal notification hooks (macOS/Linux) are in `.claude/settings.local.json` — see that file for examples.
61
61
 
62
+ ## Available Skills
63
+
64
+ Skills orchestrate multi-step workflows. Invoke by telling the AI assistant what you want to do.
65
+
66
+ | Skill | Invocation | Description |
67
+ |-------|-----------|-------------|
68
+ | `development-workflow` | `start task F001` | Complete feature development (6-step workflow) |
69
+ | `bug-workflow` | `report bug`, `fix bug` | Bug triage, investigation, and resolution |
70
+ | `health-check` | `health check` | Quick project health scan (tests, build, lint, etc.) |
71
+ | `project-memory` | `set up project memory` | Initialize/maintain docs/project_notes/ |
72
+ | `pm-orchestrator` | `start pm`, `continue pm` | L5: Autonomous multi-feature sequential orchestration |
73
+
62
74
  ## Standards References
63
75
 
64
76
  - [Base Standards](./ai-specs/specs/base-standards.mdc) — Constitution, methodology, workflow, agents
@@ -3,7 +3,7 @@
3
3
 
4
4
  ## Claude-Specific Configuration
5
5
 
6
- <!-- CONFIG: Set your preferred autonomy level (1-4). See base-standards.mdc § Autonomy Levels for definitions. -->
6
+ <!-- CONFIG: Set your preferred autonomy level (1-5). See base-standards.mdc § Autonomy Levels for definitions. -->
7
7
  **Autonomy Level: 2 (Trusted)**
8
8
 
9
9
  <!-- CONFIG: Set branching strategy in docs/project_notes/key_facts.md (github-flow or gitflow) -->
@@ -18,3 +18,4 @@ After context compaction or new session — BEFORE continuing work:
18
18
  4. If at Step 5 or later → read `references/merge-checklist.md` and check if the ticket's `## Merge Checklist Evidence` table needs to be filled
19
19
  5. Do NOT proceed past any checkpoint without user confirmation (respect autonomy level)
20
20
  6. If Active Session shows a pending checkpoint, ask before continuing
21
+ 7. If L5 (PM Autonomous) and `docs/project_notes/pm-session.md` exists → read it and run `continue pm` to resume the PM Orchestrator session
@@ -4,7 +4,18 @@
4
4
 
5
5
  ## Gemini-Specific Configuration
6
6
 
7
- <!-- CONFIG: Set your preferred autonomy level (1-4). See base-standards.mdc § Autonomy Levels for definitions. -->
7
+ <!-- CONFIG: Set your preferred autonomy level (1-5). See base-standards.mdc § Autonomy Levels for definitions. -->
8
8
  **Autonomy Level: 2 (Trusted)**
9
9
 
10
10
  <!-- CONFIG: Set branching strategy in docs/project_notes/key_facts.md (github-flow or gitflow) -->
11
+
12
+ ## Session Recovery (Gemini)
13
+
14
+ After context loss or new session — BEFORE continuing work:
15
+
16
+ 1. Read product tracker (`docs/project_notes/product-tracker.md`) → **Active Session**
17
+ 2. If active feature → read referenced ticket in `docs/tickets/`
18
+ 3. Re-read the workflow skill (`.gemini/skills/development-workflow/SKILL.md`) to know what actions the current step requires
19
+ 4. If at Step 5 or later → read `references/merge-checklist.md` and check if the ticket's `## Merge Checklist Evidence` table needs to be filled
20
+ 5. Respect the autonomy level set above
21
+ 6. If L5 (PM Autonomous) and `docs/project_notes/pm-session.md` exists → read it and run `continue pm` to resume the PM Orchestrator session
@@ -22,7 +22,7 @@ alwaysApply: true
22
22
 
23
23
  These conventions adapt per-project via `<!-- CONFIG: -->` comments in `CLAUDE.md` and `key_facts.md`:
24
24
 
25
- - **Autonomy Level** → `CLAUDE.md` (1-4)
25
+ - **Autonomy Level** → `CLAUDE.md` (1-5)
26
26
  - **Tech Stack** → `backend-standards.mdc` / `frontend-standards.mdc`
27
27
  - **Monorepo Layout** → `CLAUDE.md`
28
28
  - **Branching Strategy** → `key_facts.md` (github-flow or gitflow)
@@ -59,18 +59,20 @@ Complex: 0 → 1 (+ADR) → 2 → 3 → 4 → 5 (+QA) → 6
59
59
 
60
60
  Quality gates (tests, lint, build, validators) **always run** regardless of level.
61
61
 
62
- | Checkpoint | L1 Full Control | L2 Trusted | L3 Autopilot | L4 Full Auto |
63
- |------------|:-:|:-:|:-:|:-:|
64
- | Spec Approval | Required | Auto | Auto | Auto |
65
- | Ticket Approval | Required | Auto | Auto | Auto |
66
- | Plan Approval | Required | Required | Auto | Auto |
67
- | Commit Approval | Required | Auto | Auto | Auto |
68
- | Merge Approval | Required | Required | Required | Auto |
62
+ | Checkpoint | L1 Full Control | L2 Trusted | L3 Autopilot | L4 Full Auto | L5 PM Auto |
63
+ |------------|:-:|:-:|:-:|:-:|:-:|
64
+ | Spec Approval | Required | Auto | Auto | Auto | Auto |
65
+ | Ticket Approval | Required | Auto | Auto | Auto | Auto |
66
+ | Plan Approval | Required | Required | Auto | Auto | Auto |
67
+ | Commit Approval | Required | Auto | Auto | Auto | Auto |
68
+ | Merge Approval | Required | Required | Required | Auto | Auto |
69
+ | Next Feature | — | — | — | — | Auto |
69
70
 
70
71
  - **L1 Full Control**: New project or learning SDD — human approves every step.
71
72
  - **L2 Trusted**: Comfortable with SDD — AI handles routine, human reviews plans and merges.
72
73
  - **L3 Autopilot**: Battle-tested workflow — human only reviews PRs before merge.
73
74
  - **L4 Full Auto**: Full automation — human reviews completed features only.
75
+ - **L5 PM Autonomous**: PM Orchestrator runs features end-to-end sequentially. Invoke with `start pm`.
74
76
 
75
77
  **Auto** = proceed without asking; log in product tracker → "Auto-Approved Decisions" table.
76
78
 
@@ -46,3 +46,7 @@ npm-debug.log*
46
46
 
47
47
  # Claude Code (local settings are personal — hooks, permissions, notifications)
48
48
  .claude/settings.local.json
49
+
50
+ # SDD PM Orchestrator (ephemeral session control files)
51
+ docs/project_notes/pm-session.lock
52
+ docs/project_notes/pm-stop.md