prizmkit 1.0.35 → 1.0.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/bundled/VERSION.json +3 -3
  2. package/bundled/agents/prizm-dev-team-dev.md +11 -11
  3. package/bundled/agents/prizm-dev-team-reviewer.md +10 -10
  4. package/bundled/dev-pipeline/README.md +14 -17
  5. package/bundled/dev-pipeline/assets/prizm-dev-team-integration.md +16 -22
  6. package/bundled/dev-pipeline/launch-bugfix-daemon.sh +8 -0
  7. package/bundled/dev-pipeline/launch-daemon.sh +2 -0
  8. package/bundled/dev-pipeline/lib/worktree.sh +164 -0
  9. package/bundled/dev-pipeline/retry-bug.sh +5 -2
  10. package/bundled/dev-pipeline/retry-feature.sh +5 -2
  11. package/bundled/dev-pipeline/run-bugfix.sh +167 -2
  12. package/bundled/dev-pipeline/run.sh +169 -2
  13. package/bundled/dev-pipeline/scripts/check-session-status.py +3 -1
  14. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +0 -8
  15. package/bundled/dev-pipeline/scripts/update-bug-status.py +24 -1
  16. package/bundled/dev-pipeline/scripts/update-feature-status.py +3 -2
  17. package/bundled/dev-pipeline/templates/bootstrap-tier1.md +3 -9
  18. package/bundled/dev-pipeline/templates/bootstrap-tier2.md +2 -8
  19. package/bundled/dev-pipeline/templates/bootstrap-tier3.md +36 -43
  20. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +1 -1
  21. package/bundled/dev-pipeline/templates/session-status-schema.json +1 -1
  22. package/bundled/dev-pipeline/tests/test_check_session.py +4 -0
  23. package/bundled/dev-pipeline/tests/test_update_feature_status.py +70 -0
  24. package/bundled/dev-pipeline/tests/test_worktree.py +236 -0
  25. package/bundled/dev-pipeline/tests/test_worktree_integration.py +796 -0
  26. package/bundled/skills/_metadata.json +1 -1
  27. package/bundled/skills/prizmkit-implement/SKILL.md +4 -2
  28. package/bundled/team/prizm-dev-team.json +3 -17
  29. package/package.json +1 -1
  30. package/src/clean.js +0 -2
  31. package/src/manifest.js +8 -4
  32. package/src/scaffold.js +69 -3
  33. package/src/upgrade.js +32 -5
  34. package/bundled/agents/prizm-dev-team-coordinator.md +0 -141
  35. package/bundled/agents/prizm-dev-team-pm.md +0 -126
@@ -1,5 +1,5 @@
1
1
  {
2
- "frameworkVersion": "1.0.35",
3
- "bundledAt": "2026-03-17T13:12:38.845Z",
4
- "bundledFrom": "2597a15"
2
+ "frameworkVersion": "1.0.45",
3
+ "bundledAt": "2026-03-18T12:24:34.664Z",
4
+ "bundledFrom": "6127c1a"
5
5
  }
@@ -18,7 +18,7 @@ skills: prizmkit-implement, prizmkit-prizm-docs
18
18
 
19
19
  ### 项目上下文
20
20
 
21
- 项目文档在 `.prizm-docs/`。实现前先读 `root.prizm` 了解规则和已知陷阱(TRAPS),修改某模块时读该模块的文档。
21
+ 项目文档在 `.prizm-docs/`。实现前先读 `context-snapshot.md`(若存在于 `.prizmkit/specs/###-feature-name/`),其 Section 3 含 Prizm Context、Section 4 含源文件,无需再读 `.prizm-docs/` 或原始源文件。若 snapshot 不存在,则读 `root.prizm` 了解规则和已知陷阱(TRAPS),修改某模块时读该模块的文档。
22
22
 
23
23
  ### 制品路径
24
24
 
@@ -32,17 +32,17 @@ skills: prizmkit-implement, prizmkit-prizm-docs
32
32
  1. 按照分配的任务和 plan.md 中的接口设计实现功能模块
33
33
  2. 遵循 TDD 方式:先写测试,再实现,再验证
34
34
  3. 产出的代码必须通过本模块的单元测试
35
- 4. 发现接口设计歧义时,立即通过 Coordinator 上报 PM(不自行假设)
35
+ 4. 发现接口设计歧义时,立即上报给 Orchestrator(不自行假设)
36
36
  5. 遵循 `/prizmkit-implement` 工作流:读取 plan.md(含 Tasks section)+ spec.md,逐任务实现
37
37
  6. 每个任务完成后**立即**标记 plan.md Tasks section 中的 `[x]`(不批量标记)
38
- 7. 实现前读取 `.prizm-docs/` TRAPS 段避免已知陷阱
38
+ 7. 实现前读取 TRAPS 段避免已知陷阱:优先从 `context-snapshot.md` Section 3 获取,若 snapshot 不存在则读 `.prizm-docs/`
39
39
  8. 检查点任务须验证构建通过和测试通过后才能继续下一阶段
40
40
  9. 顺序任务按序执行,失败则停止;并行 `[P]` 任务可继续
41
41
  10. 新建子模块时,生成对应的 `.prizm-docs/` L2 文档
42
42
 
43
43
  ### 绝不做 (NEVER)
44
44
 
45
- - 不修改 plan.md 中的接口设计(修改需通过 PM
45
+ - 不修改 plan.md 中的接口设计(修改需通过 Orchestrator
46
46
  - 不修改其他 Dev Agent 负责的模块代码
47
47
  - 不进行集成测试(Reviewer 的职责)
48
48
  - **不执行任何 git 操作**(git commit / git add / git reset / git push 均禁止 — 由 Orchestrator 通过 /prizmkit-committer 统一提交)
@@ -62,7 +62,7 @@ DEV-06: 不得引入未在任务描述中声明的外部依赖
62
62
  DEV-07: 遵循 /prizmkit-implement 工作流
63
63
  DEV-08: 每个任务完成后立即标记 plan.md Tasks section [x]
64
64
  DEV-09: TDD:先写测试 → 再实现 → 再验证
65
- DEV-10: 实现每个模块前必须读取 .prizm-docs/ TRAPS 段
65
+ DEV-10: 实现每个模块前必须读取 TRAPS 段:优先从 context-snapshot.md Section 3 获取,无 snapshot 时读 .prizm-docs/
66
66
  DEV-11: 检查点任务必须验证构建通过和测试通过
67
67
  DEV-12: 新建子模块时生成 L2 .prizm-docs/ 文档
68
68
  DEV-13: 禁止执行任何 git 命令(git add/commit/reset/push 全部禁止)
@@ -72,13 +72,13 @@ DEV-14: 若 `npm test` 中存在 pre-existing 失败,不得忽略——必须
72
72
  ### 工作流程
73
73
 
74
74
  1. 接收任务分配
75
- 2. 读取 `.prizm-docs/root.prizm` 和相关模块文档
75
+ 2. 读取 `.prizmkit/specs/###-feature-name/context-snapshot.md`(若存在)——Section 3 含 Prizm Context,Section 4 含源文件。若 snapshot 不存在,则读取 `.prizm-docs/root.prizm` 和相关模块文档
76
76
  3. 读取 `.prizmkit/specs/###-feature-name/` 中的 `plan.md`(含 Tasks section)、`spec.md`
77
77
  4. 对每个分配的任务,按 plan.md Tasks 顺序执行:
78
- a. 读取目标文件模块的文档(检查 TRAPS DECISIONS)
78
+ a. context-snapshot.md 获取目标文件上下文和 TRAPS(若无 snapshot 则读取目标文件模块的文档)
79
79
  b. TDD:基于验收标准编写测试 → 实现功能代码 → 运行测试验证
80
80
  c. 在 plan.md Tasks section 中标记该任务为 `[x]`
81
- d. 发送 STATUS_UPDATE 给 Coordinator
81
+ d. 发送 STATUS_UPDATE 给 Orchestrator
82
82
  5. 如遇检查点任务,验证构建通过和测试通过后才继续
83
83
  6. 遇到接口设计歧义,发送 ESCALATION(不自行假设)
84
84
  7. 如新建了子模块,生成对应 `.prizm-docs/` L2 文档
@@ -88,14 +88,14 @@ DEV-14: 若 `npm test` 中存在 pre-existing 失败,不得忽略——必须
88
88
 
89
89
  | 场景 | 策略 |
90
90
  |------|------|
91
- | 接口设计歧义 | 标记 BLOCKED → ESCALATION → 等待 PM 裁定 |
91
+ | 接口设计歧义 | 标记 BLOCKED → ESCALATION → 等待 Orchestrator 裁定 |
92
92
  | 单元测试失败 | 最多重试修复 3 次 → 仍失败则 ISSUE_REPORT |
93
93
  | 外部依赖不可用 | 使用 Mock → 标注说明 |
94
- | 任务超出预估 | ESCALATION → 建议 PM 拆分任务 |
94
+ | 任务超出预估 | ESCALATION → 建议 Orchestrator 拆分任务 |
95
95
 
96
96
  ### 通信规则
97
97
 
98
- 允许 Agent 之间直接通信,但关键消息和结论必须通知 Coordinator
98
+ 允许 Agent 之间直接通信,但关键消息和结论必须通知 Orchestrator
99
99
  - 发送 STATUS_UPDATE 汇报每个子任务完成
100
100
  - 发送 COMPLETION_SIGNAL 标志所有任务完成
101
101
  - 发送 ESCALATION 上报接口歧义或任务阻塞
@@ -16,7 +16,7 @@ skills: prizmkit-code-review, prizmkit-analyze, prizmkit-prizm-docs
16
16
 
17
17
  ### 项目上下文
18
18
 
19
- 项目文档在 `.prizm-docs/`。审查前先读 `root.prizm` 了解项目规则(RULES)、模式(PATTERNS)和已知陷阱(TRAPS),需要时读取模块级文档。
19
+ 项目文档在 `.prizm-docs/`。审查前先读 `context-snapshot.md`(若存在于 `.prizmkit/specs/###-feature-name/`),其 Section 3 含 Prizm Context(RULES、PATTERNS、TRAPS),无需再读 `.prizm-docs/` 或原始源文件。若 snapshot 不存在,则读 `root.prizm` 了解项目规则(RULES)、模式(PATTERNS)和已知陷阱(TRAPS),需要时读取模块级文档。
20
20
 
21
21
  ### 制品路径
22
22
 
@@ -40,8 +40,8 @@ skills: prizmkit-code-review, prizmkit-analyze, prizmkit-prizm-docs
40
40
  ### 绝不做 (NEVER)
41
41
 
42
42
  - 不编写实现代码(Dev 的职责)
43
- - 不分解任务(PM 的职责)
44
- - 不进行任务调度(Coordinator 的职责)
43
+ - 不分解任务(Orchestrator 的职责)
44
+ - 不进行任务调度(Orchestrator 的职责)
45
45
  - **不执行任何 git 操作**(git commit / git add / git reset / git push 均禁止)
46
46
  - 不使用 TaskCreate/TaskUpdate 创建或修改 Orchestrator 层的任务(Task 工具仅用于内部进度追踪,且任务 ID 在各 agent 子会话中互不共享)
47
47
 
@@ -62,21 +62,21 @@ REV-10: 禁止使用 timeout 命令(macOS 不兼容)。运行测试时直接
62
62
 
63
63
  ### Phase 4 工作流程:交叉校验
64
64
 
65
- **前置条件**: PM 已完成 spec.md / plan.md(含 Tasks section)
65
+ **前置条件**: Orchestrator 已完成 spec.md / plan.md(含 Tasks section)
66
66
 
67
67
  1. 调用 `/prizmkit-analyze` skill(**不是 CLI 命令**,使用 Skill 工具或 `/prizmkit-analyze` 指令调用)
68
68
  - 输入: spec.md, plan.md(含 Tasks section)
69
69
  - 6 个检测通道: 重复检测、歧义检测、不完整检测、Prizm 规则对齐、覆盖缺口、不一致性
70
70
  - 输出: 一致性分析报告(仅对话输出)
71
71
  - 若 Skill 工具不可用,则根据 6 个检测通道手动执行交叉一致性分析
72
- 2. 如发现 CRITICAL 问题,报告给 Coordinator 退回 PM 修复
72
+ 2. 如发现 CRITICAL 问题,报告给 Orchestrator 退回修复
73
73
  3. 发送 COMPLETION_SIGNAL(含分析结果)
74
74
 
75
75
  ### Phase 6 工作流程:评审
76
76
 
77
77
  **前置条件**: Dev 已完成实现,所有任务标记 `[x]`
78
78
 
79
- 1. 读取 `.prizm-docs/root.prizm`,重点关注 RULES 和 PATTERNS
79
+ 1. 读取 `context-snapshot.md`(若存在),其 Section 3 含 RULES 和 PATTERNS。若 snapshot 不存在,则读 `.prizm-docs/root.prizm`
80
80
  2. 运行 `/prizmkit-code-review`(只读)
81
81
  - 6 个审查维度: 规格符合度、计划遵循度、代码质量、安全性、一致性、测试覆盖
82
82
  - 判定: PASS | PASS WITH WARNINGS | NEEDS FIXES
@@ -109,15 +109,15 @@ REV-10: 禁止使用 timeout 命令(macOS 不兼容)。运行测试时直接
109
109
 
110
110
  | 场景 | 策略 |
111
111
  |------|------|
112
- | analyze 发现 CRITICAL | 报告 Coordinator退回 PM 修复 |
113
- | code-review 发现 CRITICAL | 报告 Coordinator → 退回 Dev 修复 |
114
- | 集成测试失败 | 分类严重级别 → ISSUE_REPORT → Coordinator 派发给 Dev |
112
+ | analyze 发现 CRITICAL | 报告 Orchestrator退回修复 |
113
+ | code-review 发现 CRITICAL | 报告 Orchestrator → 退回 Dev 修复 |
114
+ | 集成测试失败 | 分类严重级别 → ISSUE_REPORT → Orchestrator 派发给 Dev |
115
115
  | 审查发现超过 30 个 | 只保留最严重的 30 个 |
116
116
  | Prizm RULES 违规 | 自动标记为 CRITICAL |
117
117
 
118
118
  ### 通信规则
119
119
 
120
- 允许 Agent 之间直接通信,但关键消息和结论必须通知 Coordinator
120
+ 允许 Agent 之间直接通信,但关键消息和结论必须通知 Orchestrator
121
121
  - 发送 COMPLETION_SIGNAL(含判定结果)标志完成
122
122
  - 发送 ISSUE_REPORT 报告 CRITICAL 发现
123
123
  - 接收 TASK_ASSIGNMENT 获取分配的工作
@@ -221,12 +221,9 @@ run.sh main loop
221
221
  ├─ AI CLI session # cbc --print -y < prompt (CodeBuddy)
222
222
  │ │ # claude --print -p "$(cat prompt)" --yes (Claude Code)
223
223
  │ └─ prizm-dev-team # Multi-agent team implements the feature
224
- │ ├─ Coordinator # Orchestrates the 10-phase pipeline
225
- │ ├─ PM # Phase 1-4: specify plan → tasks → analyze
226
- ├─ Dev x N # Phase 6: implement with TDD
227
- │ ├─ QA # Phase 7: integration tests + code review
228
- │ ├─ Review # Phase 7: code consistency audit
229
- │ └─ Coordinator # Phase 9: summarize → commit → retrospective
224
+ │ ├─ Orchestrator # Main agent: init, plan, schedule, summarize, commit
225
+ │ ├─ Dev x N # Implementation with TDD
226
+ └─ Reviewer # Analyze + code review
230
227
 
231
228
  ├─ check-session-status.py # Parse session outcome
232
229
  ├─ update-feature-status.py # Update feature state (completed/failed/retry)
@@ -238,19 +235,19 @@ run.sh main loop
238
235
 
239
236
  Each AI CLI session drives the prizm-dev-team through these phases. **All phases are mandatory** — the bootstrap prompt enforces sequential execution.
240
237
 
241
- > **Note**: The Coordinator Agent definition describes a simplified **8-phase** view (Phase 0-7) where Phases 1-3 and Phase 5 are consolidated. The bootstrap prompt adapts these phases based on complexity mode (lite/standard/full). The 10-phase breakdown below is the most granular view for pipeline monitoring.
238
+ > **Note**: The bootstrap prompt adapts these phases based on complexity mode (lite/standard/full). The 10-phase breakdown below is the most granular view for pipeline monitoring.
242
239
 
243
240
  | Phase | Name | Agent | PrizmKit Skills | Artifacts |
244
241
  |-------|------|-------|----------------|-----------|
245
- | 0 | Init | Coordinator | `prizmkit-init` | `.prizm-docs/root.prizm`, `.prizmkit/config.json` |
246
- | 1 | Specify | PM | `prizmkit-specify`, `prizmkit-clarify` | `.prizmkit/specs/spec.md` |
247
- | 2 | Plan + Tasks | PM | `prizmkit-plan` | `.prizmkit/specs/plan.md` (含 Tasks section) |
248
- | 3 | Analyze | PM | `prizmkit-analyze` | Analysis report (no CRITICAL issues) |
249
- | 4 | Schedule | Coordinator | — | TaskList entries assigned |
242
+ | 0 | Init | Orchestrator | `prizmkit-init` | `.prizm-docs/root.prizm`, `.prizmkit/config.json` |
243
+ | 1 | Specify | Orchestrator | `prizmkit-specify`, `prizmkit-clarify` | `.prizmkit/specs/spec.md` |
244
+ | 2 | Plan + Tasks | Orchestrator | `prizmkit-plan` | `.prizmkit/specs/plan.md` (含 Tasks section) |
245
+ | 3 | Analyze | Reviewer | `prizmkit-analyze` | Analysis report (no CRITICAL issues) |
246
+ | 4 | Schedule | Orchestrator | — | TaskList entries assigned |
250
247
  | 5 | Implement | Dev x N | `prizmkit-implement` | Code + tests, plan.md Tasks marked `[x]` |
251
- | 6 | Review | QA + Review | `prizmkit-code-review` | Integration tests, review report |
248
+ | 6 | Review | Reviewer | `prizmkit-code-review` | Integration tests, review report |
252
249
  | 7 | Fix Loop | Dev | — | Max 3 rounds of fixes |
253
- | 8 | Summarize & Commit | Coordinator | `prizmkit-summarize`, `prizmkit-committer`, `prizmkit-retrospective` | REGISTRY.md, git commit, .prizm-docs/ updated |
250
+ | 8 | Summarize & Commit | Orchestrator | `prizmkit-summarize`, `prizmkit-committer`, `prizmkit-retrospective` | REGISTRY.md, git commit, .prizm-docs/ updated |
254
251
 
255
252
  ### Feature Dependency Resolution
256
253
 
@@ -461,7 +458,7 @@ The pipeline expects:
461
458
 
462
459
  | Resource | Location | Description |
463
460
  |----------|----------|-------------|
464
- | Agent Definitions | `.codebuddy/agents/prizm-dev-team-*.md` | 4 agent types: coordinator, pm, dev, reviewer |
461
+ | Agent Definitions | `.codebuddy/agents/prizm-dev-team-*.md` | 2 agent types: dev, reviewer |
465
462
  | Team Config | `~/.codebuddy/teams/prizm-dev-team/config.json` | Team runtime configuration |
466
463
  | Team Inboxes | `~/.codebuddy/teams/prizm-dev-team/inboxes/` | Agent message inboxes |
467
464
 
@@ -469,7 +466,7 @@ The pipeline expects:
469
466
 
470
467
  | Resource | Location | Description |
471
468
  |----------|----------|-------------|
472
- | Agent Definitions | `.claude/agents/prizm-dev-team-*.md` | 4 agent types: coordinator, pm, dev, reviewer |
469
+ | Agent Definitions | `.claude/agents/prizm-dev-team-*.md` | 2 agent types: dev, reviewer |
473
470
  | Team Config | `.claude/team-info.json` | Team runtime configuration (project-level) |
474
471
 
475
472
  The `generate-bootstrap-prompt.py` script resolves these paths automatically. If paths are incorrect, check the `build_replacements()` function in that script.
@@ -576,7 +573,7 @@ dev-pipeline/bugfix-state/ # Runtime state (gitignored)
576
573
  | State dir | `state/` | N/A (in-session) | `bugfix-state/` |
577
574
  | Ordering | Dependencies DAG → priority | N/A (single refactor per session) | Severity → priority (no dependencies) |
578
575
  | Phases | 10-phase (specify → plan → tasks → implement → review) | 6-phase (analyze → plan → tasks → implement → review → commit) | 5-phase (triage → reproduce → fix → verify → commit) |
579
- | Agents | Coordinator + PM + Dev + Reviewer | Dev + Reviewer only | Dev + Reviewer only |
576
+ | Agents | Orchestrator + Dev + Reviewer | Dev + Reviewer only | Dev + Reviewer only |
580
577
  | Artifacts | spec.md, plan.md, tasks.md, REGISTRY.md | refactor-analysis.md, plan.md, tasks.md | fix-plan.md, fix-report.md only |
581
578
  | Commit prefix | `feat(<scope>):` | `refactor(<scope>):` | `fix(<scope>):` |
582
579
  | Scope Guard | N/A | ✅ (behavior change → STOP) | N/A |
@@ -13,18 +13,14 @@ dev-pipeline (outer loop)
13
13
  ├── scripts/ Python state management scripts
14
14
  ├── templates/bootstrap-prompt.md Session prompt template
15
15
 
16
- └── [per session] CodeBuddy CLI
16
+ └── [per session] AI CLI
17
17
 
18
- ├── TeamCreate("prizm-dev-team-F-NNN")
19
- ├── Spawn Coordinator agent
20
- │ │
21
- ├── Phase 0: Init
22
- ├── Phase 1-4: PM (specify/plan/tasks/analyze)
23
- │ ├── Phase 5: Schedule & Assign
24
- │ ├── Phase 6: Dev x N (parallel implement)
25
- │ ├── Phase 7: QA + Review (parallel)
26
- │ ├── Phase 8: Fix Loop (max 3 rounds)
27
- │ └── Phase 9: Summarize & Commit
18
+ ├── Phase 0: Init (Orchestrator)
19
+ ├── Phase 1-2: Context snapshot + Plan & Tasks (Orchestrator)
20
+ ├── Phase 3-4: Analyze (Reviewer agent)
21
+ ├── Phase 5: Implement (Dev agent)
22
+ ├── Phase 6: Review (Reviewer agent)
23
+ └── Phase 7: Summarize & Commit (Orchestrator)
28
24
 
29
25
  └── Write session-status.json → exit
30
26
  ```
@@ -33,16 +29,14 @@ dev-pipeline (outer loop)
33
29
 
34
30
  | Agent | Definition Path | Type |
35
31
  |-------|----------------|------|
36
- | Coordinator | `agent-team-master/prizm-dev-team/prizm-dev-team-coordinator/subagent.md` | prizm-dev-team-coordinator |
37
- | PM | `agent-team-master/prizm-dev-team/prizm-dev-team-pm/subagent.md` | prizm-dev-team-pm |
38
- | Dev | `agent-team-master/prizm-dev-team/prizm-dev-team-dev/subagent.md` | prizm-dev-team-dev |
39
- | QA | `agent-team-master/prizm-dev-team/prizm-dev-team-qa/subagent.md` | prizm-dev-team-qa |
40
- | Review | `agent-team-master/prizm-dev-team/prizm-dev-team-review/subagent.md` | prizm-dev-team-review |
41
- | Doc-Reader | `agent-team-master/prizm-dev-team/prizm-dev-team-doc-reader/subagent.md` | prizm-dev-team-doc-reader |
32
+ | Dev | `core/agents/prizm-dev-team-dev.md` | prizm-dev-team-dev |
33
+ | Reviewer | `core/agents/prizm-dev-team-reviewer.md` | prizm-dev-team-reviewer |
34
+
35
+ Note: The Orchestrator role is handled by the main agent (session orchestrator) directly — no separate agent definition needed.
42
36
 
43
37
  ## Validator Scripts
44
38
 
45
- Located at `agent-team-master/prizm-dev-team/prizm-dev-team-coordinator/scripts/`:
39
+ Located at `dev-pipeline/scripts/`:
46
40
 
47
41
  | Script | Checkpoint | Purpose |
48
42
  |--------|-----------|---------|
@@ -82,13 +76,13 @@ Located at `agent-team-master/prizm-dev-team/prizm-dev-team-coordinator/scripts/
82
76
  ### 1. Session Start
83
77
 
84
78
  The bootstrap prompt instructs the agent to:
85
- - Create a team named `prizm-dev-team-{FEATURE_ID}`
86
- - Spawn the Coordinator with the full subagent.md prompt
87
- - Coordinator then spawns PM, Dev, QA, Review as needed
79
+ - Execute phases directly as the session orchestrator
80
+ - Spawn Dev and Reviewer agents as subagents for implementation and review phases
81
+ - The orchestrator handles context building, planning, summarize, and commit phases directly
88
82
 
89
83
  ### 2. Pipeline Execution
90
84
 
91
- The Coordinator drives the 10-phase pipeline with 8 checkpoints (CP-0 through CP-7). Each checkpoint validates artifacts using the validator scripts.
85
+ The Orchestrator drives the pipeline phases with checkpoints (CP-0 through CP-3). Each checkpoint validates artifacts.
92
86
 
93
87
  ### 3. Session End
94
88
 
@@ -430,6 +430,14 @@ Examples:
430
430
  ./launch-bugfix-daemon.sh logs --follow # Live log tailing
431
431
  ./launch-bugfix-daemon.sh stop # Graceful shutdown
432
432
  ./launch-bugfix-daemon.sh restart # Stop + start
433
+
434
+ Environment Variables (pass via --env):
435
+ MAX_RETRIES Max retries per bug (default: 3)
436
+ SESSION_TIMEOUT Session timeout in seconds (default: 0 = no limit)
437
+ VERBOSE Set to 1 for verbose AI CLI output
438
+ HEARTBEAT_INTERVAL Heartbeat log interval in seconds (default: 30)
439
+ USE_WORKTREE Enable git worktree isolation per session (default: 1, set 0 to disable)
440
+ AUTO_PUSH Auto-push to remote after successful worktree merge (default: 0, set 1 to enable)
433
441
  HELP
434
442
  }
435
443
 
@@ -576,6 +576,8 @@ Environment Variables (pass via --env):
576
576
  SESSION_TIMEOUT Session timeout in seconds (default: 0 = no limit)
577
577
  VERBOSE Set to 1 for verbose AI CLI output
578
578
  HEARTBEAT_INTERVAL Heartbeat log interval in seconds (default: 30)
579
+ USE_WORKTREE Enable git worktree isolation per session (default: 1, set 0 to disable)
580
+ AUTO_PUSH Auto-push to remote after successful worktree merge (default: 0, set 1 to enable)
579
581
  HELP
580
582
  }
581
583
 
@@ -0,0 +1,164 @@
1
+ #!/usr/bin/env bash
2
+ # ============================================================
3
+ # dev-pipeline/lib/worktree.sh - Git Worktree Lifecycle Library
4
+ #
5
+ # Shared by run.sh and run-bugfix.sh to isolate AI CLI sessions
6
+ # in separate git worktrees. Each session runs on its own branch
7
+ # inside a worktree directory, enabling parallel-safe execution
8
+ # and clean main branch history.
9
+ #
10
+ # Functions:
11
+ # worktree_create — Create worktree + branch before session
12
+ # worktree_merge — Merge worktree branch into target after success
13
+ # worktree_cleanup — Remove worktree directory and branch
14
+ # worktree_prune_stale — Prune stale worktree references
15
+ #
16
+ # Environment:
17
+ # USE_WORKTREE — Set to 1 to enable (default), 0 to disable
18
+ # AUTO_PUSH — Set to 1 to auto-push after successful merge
19
+ # ============================================================
20
+
21
+ # worktree_create <project_root> <worktree_base_dir> <session_id> <source_branch>
22
+ #
23
+ # Creates a git worktree and sets global vars:
24
+ # _WORKTREE_PATH — absolute path to the worktree directory
25
+ # _WORKTREE_BRANCH — branch name (worktree/<session_id>)
26
+ #
27
+ # Returns 0 on success, 1 on failure.
28
+ worktree_create() {
29
+ local project_root="$1"
30
+ local worktree_base_dir="$2"
31
+ local session_id="$3"
32
+ local source_branch="$4"
33
+
34
+ _WORKTREE_PATH=""
35
+ _WORKTREE_BRANCH=""
36
+
37
+ local branch_name="worktree/${session_id}"
38
+ local worktree_path="${worktree_base_dir}/${session_id}"
39
+
40
+ # Ensure base directory exists
41
+ mkdir -p "$worktree_base_dir"
42
+
43
+ # Check if worktree path already exists
44
+ if [[ -d "$worktree_path" ]]; then
45
+ log_warn "Worktree path already exists: $worktree_path"
46
+ return 1
47
+ fi
48
+
49
+ # Check if branch already exists
50
+ if git -C "$project_root" rev-parse --verify "$branch_name" >/dev/null 2>&1; then
51
+ log_warn "Branch already exists: $branch_name"
52
+ return 1
53
+ fi
54
+
55
+ # Create worktree with new branch
56
+ if ! git -C "$project_root" worktree add -b "$branch_name" "$worktree_path" "$source_branch" 2>/dev/null; then
57
+ log_error "Failed to create worktree at $worktree_path"
58
+ return 1
59
+ fi
60
+
61
+ _WORKTREE_PATH="$worktree_path"
62
+ _WORKTREE_BRANCH="$branch_name"
63
+
64
+ log_info "Created worktree: $worktree_path (branch: $branch_name)"
65
+ return 0
66
+ }
67
+
68
+ # worktree_merge <project_root> <worktree_branch> <target_branch> <item_id> <session_id>
69
+ #
70
+ # Merges worktree branch into target branch (no fast-forward).
71
+ # Sets global var:
72
+ # _MERGE_RESULT — "success", "conflict", or "error"
73
+ #
74
+ # Returns 0 on success, 1 on conflict, 2 on other error.
75
+ worktree_merge() {
76
+ local project_root="$1"
77
+ local worktree_branch="$2"
78
+ local target_branch="$3"
79
+ local item_id="$4"
80
+ local session_id="$5"
81
+
82
+ _MERGE_RESULT=""
83
+
84
+ # Switch to target branch in the main working tree
85
+ local current_branch
86
+ current_branch=$(git -C "$project_root" rev-parse --abbrev-ref HEAD 2>/dev/null) || {
87
+ log_error "Failed to determine current branch"
88
+ _MERGE_RESULT="error"
89
+ return 2
90
+ }
91
+
92
+ if [[ "$current_branch" != "$target_branch" ]]; then
93
+ if ! git -C "$project_root" checkout "$target_branch" 2>/dev/null; then
94
+ log_error "Failed to checkout target branch: $target_branch"
95
+ _MERGE_RESULT="error"
96
+ return 2
97
+ fi
98
+ fi
99
+
100
+ # Attempt merge (no fast-forward to preserve history)
101
+ local merge_msg="Merge ${worktree_branch} for ${item_id} (session: ${session_id})"
102
+ if git -C "$project_root" merge --no-ff -m "$merge_msg" "$worktree_branch" 2>/dev/null; then
103
+ _MERGE_RESULT="success"
104
+ log_success "Merged $worktree_branch into $target_branch"
105
+ return 0
106
+ else
107
+ # Check if it's a merge conflict
108
+ if git -C "$project_root" diff --name-only --diff-filter=U 2>/dev/null | head -1 | read -r _; then
109
+ # Abort the merge to leave working tree clean
110
+ git -C "$project_root" merge --abort 2>/dev/null || true
111
+ _MERGE_RESULT="conflict"
112
+ log_warn "Merge conflict detected for $worktree_branch"
113
+ return 1
114
+ else
115
+ git -C "$project_root" merge --abort 2>/dev/null || true
116
+ _MERGE_RESULT="error"
117
+ log_error "Merge failed for $worktree_branch"
118
+ return 2
119
+ fi
120
+ fi
121
+ }
122
+
123
+ # worktree_cleanup <project_root> <worktree_path> <worktree_branch>
124
+ #
125
+ # Removes worktree directory and deletes the branch.
126
+ # Idempotent — safe to call even if worktree/branch don't exist.
127
+ #
128
+ # Returns 0 always.
129
+ worktree_cleanup() {
130
+ local project_root="$1"
131
+ local worktree_path="$2"
132
+ local worktree_branch="$3"
133
+
134
+ # Remove the worktree (if it exists)
135
+ if [[ -n "$worktree_path" && -d "$worktree_path" ]]; then
136
+ git -C "$project_root" worktree remove --force "$worktree_path" 2>/dev/null || {
137
+ # Fallback: manual removal
138
+ rm -rf "$worktree_path" 2>/dev/null || true
139
+ }
140
+ log_info "Removed worktree: $worktree_path"
141
+ fi
142
+
143
+ # Delete the branch (if it exists)
144
+ if [[ -n "$worktree_branch" ]]; then
145
+ git -C "$project_root" branch -D "$worktree_branch" 2>/dev/null || true
146
+ fi
147
+
148
+ # Prune stale worktree entries
149
+ git -C "$project_root" worktree prune 2>/dev/null || true
150
+
151
+ return 0
152
+ }
153
+
154
+ # worktree_prune_stale <project_root>
155
+ #
156
+ # Runs `git worktree prune` to clean up stale worktree references.
157
+ #
158
+ # Returns 0 always.
159
+ worktree_prune_stale() {
160
+ local project_root="$1"
161
+
162
+ git -C "$project_root" worktree prune 2>/dev/null || true
163
+ return 0
164
+ }
@@ -232,17 +232,20 @@ if [[ -n "${MODEL:-}" ]]; then
232
232
  MODEL_FLAG="--model $MODEL"
233
233
  fi
234
234
 
235
+ unset CLAUDECODE 2>/dev/null || true
236
+
235
237
  case "$CLI_CMD" in
236
238
  *claude*)
239
+ # Claude Code: prompt via -p argument, --dangerously-skip-permissions for auto-accept
237
240
  "$CLI_CMD" \
238
- --print \
239
241
  -p "$(cat "$BOOTSTRAP_PROMPT")" \
240
- --yes \
242
+ --dangerously-skip-permissions \
241
243
  $STREAM_JSON_FLAG \
242
244
  $MODEL_FLAG \
243
245
  > "$SESSION_LOG" 2>&1 &
244
246
  ;;
245
247
  *)
248
+ # CodeBuddy (cbc) and others: prompt via stdin
246
249
  "$CLI_CMD" \
247
250
  --print \
248
251
  -y \
@@ -233,17 +233,20 @@ if [[ -n "${MODEL:-}" ]]; then
233
233
  MODEL_FLAG="--model $MODEL"
234
234
  fi
235
235
 
236
+ unset CLAUDECODE 2>/dev/null || true
237
+
236
238
  case "$CLI_CMD" in
237
239
  *claude*)
240
+ # Claude Code: prompt via -p argument, --dangerously-skip-permissions for auto-accept
238
241
  "$CLI_CMD" \
239
- --print \
240
242
  -p "$(cat "$BOOTSTRAP_PROMPT")" \
241
- --yes \
243
+ --dangerously-skip-permissions \
242
244
  $STREAM_JSON_FLAG \
243
245
  $MODEL_FLAG \
244
246
  > "$SESSION_LOG" 2>&1 &
245
247
  ;;
246
248
  *)
249
+ # CodeBuddy (cbc) and others: prompt via stdin
247
250
  "$CLI_CMD" \
248
251
  --print \
249
252
  -y \