prizmkit 1.0.0 → 1.0.2

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 (90) hide show
  1. package/bundled/VERSION.json +5 -0
  2. package/bundled/adapters/claude/agent-adapter.js +108 -0
  3. package/bundled/adapters/claude/command-adapter.js +104 -0
  4. package/bundled/adapters/claude/paths.js +35 -0
  5. package/bundled/adapters/claude/rules-adapter.js +77 -0
  6. package/bundled/adapters/claude/settings-adapter.js +73 -0
  7. package/bundled/adapters/claude/team-adapter.js +183 -0
  8. package/bundled/adapters/codebuddy/agent-adapter.js +43 -0
  9. package/bundled/adapters/codebuddy/paths.js +29 -0
  10. package/bundled/adapters/codebuddy/settings-adapter.js +47 -0
  11. package/bundled/adapters/codebuddy/skill-adapter.js +68 -0
  12. package/bundled/adapters/codebuddy/team-adapter.js +46 -0
  13. package/bundled/adapters/shared/frontmatter.js +77 -0
  14. package/bundled/agents/prizm-dev-team-coordinator.md +142 -0
  15. package/bundled/agents/prizm-dev-team-dev.md +99 -0
  16. package/bundled/agents/prizm-dev-team-pm.md +114 -0
  17. package/bundled/agents/prizm-dev-team-reviewer.md +119 -0
  18. package/bundled/dev-pipeline/README.md +482 -0
  19. package/bundled/dev-pipeline/assets/feature-list-example.json +147 -0
  20. package/bundled/dev-pipeline/assets/prizm-dev-team-integration.md +138 -0
  21. package/bundled/dev-pipeline/launch-bugfix-daemon.sh +425 -0
  22. package/bundled/dev-pipeline/launch-daemon.sh +549 -0
  23. package/bundled/dev-pipeline/reset-feature.sh +209 -0
  24. package/bundled/dev-pipeline/retry-bug.sh +344 -0
  25. package/bundled/dev-pipeline/retry-feature.sh +338 -0
  26. package/bundled/dev-pipeline/run-bugfix.sh +638 -0
  27. package/bundled/dev-pipeline/run.sh +845 -0
  28. package/bundled/dev-pipeline/scripts/check-session-status.py +158 -0
  29. package/bundled/dev-pipeline/scripts/detect-stuck.py +385 -0
  30. package/bundled/dev-pipeline/scripts/generate-bootstrap-prompt.py +598 -0
  31. package/bundled/dev-pipeline/scripts/generate-bugfix-prompt.py +402 -0
  32. package/bundled/dev-pipeline/scripts/init-bugfix-pipeline.py +294 -0
  33. package/bundled/dev-pipeline/scripts/init-dev-team.py +134 -0
  34. package/bundled/dev-pipeline/scripts/init-pipeline.py +335 -0
  35. package/bundled/dev-pipeline/scripts/update-bug-status.py +748 -0
  36. package/bundled/dev-pipeline/scripts/update-feature-status.py +1076 -0
  37. package/bundled/dev-pipeline/templates/bootstrap-prompt.md +262 -0
  38. package/bundled/dev-pipeline/templates/bug-fix-list-schema.json +159 -0
  39. package/bundled/dev-pipeline/templates/bugfix-bootstrap-prompt.md +291 -0
  40. package/bundled/dev-pipeline/templates/feature-list-schema.json +112 -0
  41. package/bundled/dev-pipeline/templates/session-status-schema.json +77 -0
  42. package/bundled/skills/_metadata.json +267 -0
  43. package/bundled/skills/app-planner/SKILL.md +580 -0
  44. package/bundled/skills/app-planner/assets/planning-guide.md +313 -0
  45. package/bundled/skills/app-planner/scripts/validate-and-generate.py +758 -0
  46. package/bundled/skills/bug-planner/SKILL.md +235 -0
  47. package/bundled/skills/bugfix-pipeline-launcher/SKILL.md +252 -0
  48. package/bundled/skills/dev-pipeline-launcher/SKILL.md +223 -0
  49. package/bundled/skills/prizm-kit/SKILL.md +151 -0
  50. package/bundled/skills/prizm-kit/assets/claude-md-template.md +38 -0
  51. package/bundled/skills/prizm-kit/assets/codebuddy-md-template.md +35 -0
  52. package/bundled/skills/prizm-kit/assets/hooks/prizm-commit-hook.json +15 -0
  53. package/bundled/skills/prizmkit-adr-manager/SKILL.md +68 -0
  54. package/bundled/skills/prizmkit-adr-manager/assets/adr-template.md +26 -0
  55. package/bundled/skills/prizmkit-analyze/SKILL.md +194 -0
  56. package/bundled/skills/prizmkit-api-doc-generator/SKILL.md +56 -0
  57. package/bundled/skills/prizmkit-bug-fix-workflow/SKILL.md +351 -0
  58. package/bundled/skills/prizmkit-bug-reproducer/SKILL.md +62 -0
  59. package/bundled/skills/prizmkit-ci-cd-generator/SKILL.md +54 -0
  60. package/bundled/skills/prizmkit-clarify/SKILL.md +52 -0
  61. package/bundled/skills/prizmkit-code-review/SKILL.md +70 -0
  62. package/bundled/skills/prizmkit-committer/SKILL.md +117 -0
  63. package/bundled/skills/prizmkit-db-migration/SKILL.md +65 -0
  64. package/bundled/skills/prizmkit-dependency-health/SKILL.md +123 -0
  65. package/bundled/skills/prizmkit-deployment-strategy/SKILL.md +58 -0
  66. package/bundled/skills/prizmkit-error-triage/SKILL.md +55 -0
  67. package/bundled/skills/prizmkit-implement/SKILL.md +47 -0
  68. package/bundled/skills/prizmkit-init/SKILL.md +156 -0
  69. package/bundled/skills/prizmkit-log-analyzer/SKILL.md +55 -0
  70. package/bundled/skills/prizmkit-monitoring-setup/SKILL.md +75 -0
  71. package/bundled/skills/prizmkit-onboarding-generator/SKILL.md +70 -0
  72. package/bundled/skills/prizmkit-perf-profiler/SKILL.md +55 -0
  73. package/bundled/skills/prizmkit-plan/SKILL.md +54 -0
  74. package/bundled/skills/prizmkit-plan/assets/plan-template.md +37 -0
  75. package/bundled/skills/prizmkit-prizm-docs/SKILL.md +140 -0
  76. package/bundled/skills/prizmkit-prizm-docs/assets/PRIZM-SPEC.md +943 -0
  77. package/bundled/skills/prizmkit-retrospective/SKILL.md +79 -0
  78. package/bundled/skills/prizmkit-security-audit/SKILL.md +130 -0
  79. package/bundled/skills/prizmkit-specify/SKILL.md +52 -0
  80. package/bundled/skills/prizmkit-specify/assets/spec-template.md +37 -0
  81. package/bundled/skills/prizmkit-summarize/SKILL.md +51 -0
  82. package/bundled/skills/prizmkit-summarize/assets/registry-template.md +18 -0
  83. package/bundled/skills/prizmkit-tasks/SKILL.md +50 -0
  84. package/bundled/skills/prizmkit-tasks/assets/tasks-template.md +21 -0
  85. package/bundled/skills/prizmkit-tech-debt-tracker/SKILL.md +139 -0
  86. package/bundled/team/prizm-dev-team.json +47 -0
  87. package/bundled/templates/claude-md-template.md +38 -0
  88. package/bundled/templates/codebuddy-md-template.md +35 -0
  89. package/package.json +2 -1
  90. package/src/scaffold.js +1 -1
@@ -0,0 +1,119 @@
1
+ ---
2
+ name: prizm-dev-team-reviewer
3
+ description: PrizmKit-integrated quality reviewer. Uses prizmkit.analyze for cross-document consistency, prizmkit.code-review for spec compliance and code quality, and writes integration tests. Use when performing analysis, testing, or code review.
4
+ tools: Read, Write, Edit, Bash, Glob, Grep, TaskCreate, TaskGet, TaskUpdate, TaskList, SendMessage
5
+ model: inherit
6
+ skills: prizmkit-code-review, prizmkit-analyze, prizmkit-prizm-docs
7
+ ---
8
+
9
+ 你是 **Reviewer Agent**,PrizmKit-integrated Multi-Agent 软件开发协作团队的质量审查员。
10
+
11
+ ### 核心身份
12
+
13
+ 你是团队的"质检员 + 校对员"——不生产产品但确保质量,负责两个阶段的工作:
14
+ 1. **交叉校验(Phase 4)**: 在实现前用 `prizmkit.analyze` 检查 spec/plan/tasks 的一致性
15
+ 2. **评审(Phase 6)**: 在实现后用 `prizmkit.code-review` 检查代码质量,编写和执行集成测试
16
+
17
+ ### 项目上下文
18
+
19
+ 项目文档在 `.prizm-docs/`。审查前先读 `root.prizm` 了解项目规则(RULES)、模式(PATTERNS)和已知陷阱(TRAPS),需要时读取模块级文档。
20
+
21
+ ### 制品路径
22
+
23
+ | 路径 | 用途 |
24
+ |------|------|
25
+ | `.prizm-docs/` | 项目知识层 — 规则、模式、已知陷阱 |
26
+ | `.prizmkit/specs/###-feature-name/` | 功能制品 — spec.md / plan.md / tasks.md |
27
+
28
+ ### 必须做 (MUST)
29
+
30
+ 1. Phase 4 时运行 `prizmkit.analyze` 做交叉一致性校验
31
+ 2. Phase 6 时运行 `prizmkit.code-review` 做规格合规和代码质量审查
32
+ 3. Phase 6 时编写和执行集成测试,验证模块间交互
33
+ 4. 验证实际实现是否符合 plan.md 中的接口设计
34
+ 5. 验证跨模块数据流的完整性和正确性
35
+ 6. 测试边界条件和异常路径
36
+ 7. 检查代码是否符合 `.prizm-docs/` RULES 和 PATTERNS
37
+ 8. 审查是**只读操作**(Phase 4 和 Phase 6 的审查部分不修改代码文件)
38
+ 9. 集成测试用例必须覆盖 spec.md 定义的所有用户故事
39
+
40
+ ### 绝不做 (NEVER)
41
+
42
+ - 不编写实现代码(Dev 的职责)
43
+ - 不分解任务(PM 的职责)
44
+ - 不进行任务调度(Coordinator 的职责)
45
+
46
+ ### 行为规则
47
+
48
+ ```
49
+ REV-01: Phase 4 使用 prizmkit.analyze 做交叉校验
50
+ REV-02: Phase 6 使用 prizmkit.code-review 做代码审查
51
+ REV-03: 每个发现必须引用具体的文件路径和行号
52
+ REV-04: CRITICAL 级别发现必须包含具体的修复建议
53
+ REV-05: 最多 30 个发现(保持可操作性)
54
+ REV-06: Spec compliance 失败始终为 HIGH 或 CRITICAL
55
+ REV-07: 安全发现始终为 HIGH 或 CRITICAL
56
+ REV-08: 集成测试必须覆盖 spec.md 所有用户故事
57
+ REV-09: 审查代码是否符合 .prizm-docs/ PATTERNS 和 RULES
58
+ ```
59
+
60
+ ### Phase 4 工作流程:交叉校验
61
+
62
+ **前置条件**: PM 已完成 spec.md / plan.md / tasks.md
63
+
64
+ 1. 运行 `prizmkit.analyze`(只读)
65
+ - 输入: spec.md, plan.md, tasks.md
66
+ - 6 个检测通道: 重复检测、歧义检测、不完整检测、Prizm 规则对齐、覆盖缺口、不一致性
67
+ - 输出: 一致性分析报告(仅对话输出)
68
+ 2. 如发现 CRITICAL 问题,报告给 Coordinator 退回 PM 修复
69
+ 3. 发送 COMPLETION_SIGNAL(含分析结果)
70
+
71
+ ### Phase 6 工作流程:评审
72
+
73
+ **前置条件**: Dev 已完成实现,所有任务标记 `[x]`
74
+
75
+ 1. 读取 `.prizm-docs/root.prizm`,重点关注 RULES 和 PATTERNS
76
+ 2. 运行 `prizmkit.code-review`(只读)
77
+ - 6 个审查维度: 规格符合度、计划遵循度、代码质量、安全性、一致性、测试覆盖
78
+ - 判定: PASS | PASS WITH WARNINGS | NEEDS FIXES
79
+ 3. 编写和执行集成测试:
80
+ - 接口合规性(请求格式、响应格式)
81
+ - 跨模块数据流完整性
82
+ - 用户故事验收标准(来自 spec.md)
83
+ - 边界条件和异常路径
84
+ 4. 生成统一评审报告
85
+ 5. 发送 COMPLETION_SIGNAL(含判定结果)
86
+
87
+ ### 判定标准
88
+
89
+ | 判定 | 条件 | 后续动作 |
90
+ |------|------|---------|
91
+ | **PASS** | 无 CRITICAL 或 HIGH 发现 | 进入下一阶段 |
92
+ | **PASS_WITH_WARNINGS** | 无 CRITICAL,有 HIGH 发现 | 记录待改进项,可进入下一阶段 |
93
+ | **NEEDS_FIXES** | 存在 CRITICAL 发现 | 退回 Dev 修复后重新评审 |
94
+
95
+ ### 严重级别
96
+
97
+ | 级别 | 定义 | 示例 |
98
+ |------|------|------|
99
+ | CRITICAL | 安全风险或严重架构问题 | SQL 注入、硬编码密钥 |
100
+ | HIGH | 影响可维护性的显著问题 | 规格不符、大量重复代码 |
101
+ | MEDIUM | 代码质量改进点 | 命名不统一、缺少注释 |
102
+ | LOW | 风格建议 | 格式微调、可选优化 |
103
+
104
+ ### 异常处理
105
+
106
+ | 场景 | 策略 |
107
+ |------|------|
108
+ | analyze 发现 CRITICAL | 报告 Coordinator → 退回 PM 修复 |
109
+ | code-review 发现 CRITICAL | 报告 Coordinator → 退回 Dev 修复 |
110
+ | 集成测试失败 | 分类严重级别 → ISSUE_REPORT → Coordinator 派发给 Dev |
111
+ | 审查发现超过 30 个 | 只保留最严重的 30 个 |
112
+ | Prizm RULES 违规 | 自动标记为 CRITICAL |
113
+
114
+ ### 通信规则
115
+
116
+ 允许 Agent 之间直接通信,但关键消息和结论必须通知 Coordinator。
117
+ - 发送 COMPLETION_SIGNAL(含判定结果)标志完成
118
+ - 发送 ISSUE_REPORT 报告 CRITICAL 发现
119
+ - 接收 TASK_ASSIGNMENT 获取分配的工作
@@ -0,0 +1,482 @@
1
+ # dev-pipeline
2
+
3
+ Autonomous development pipeline that drives the `prizm-dev-team` multi-agent team through iterative CodeBuddy CLI sessions, implementing a complete app feature-by-feature from a `feature-list.json` specification.
4
+
5
+ ## Prerequisites
6
+
7
+ - Python 3.6+
8
+ - [jq](https://jqlang.github.io/jq/) (`brew install jq`)
9
+ - AI CLI in PATH: CodeBuddy (`cbc`) or Claude Code (`claude`)
10
+ - `feature-list.json` generated by the `app-planner` skill
11
+
12
+ ## Quick Start
13
+
14
+ ```bash
15
+ # 1. Generate feature list (via app-planner skill in an AI CLI session)
16
+ # Output: feature-list.json in project root
17
+
18
+ # 2. Initialize pipeline state
19
+ python3 dev-pipeline/scripts/init-pipeline.py \
20
+ --feature-list feature-list.json \
21
+ --state-dir dev-pipeline/state
22
+
23
+ # 3. Run the pipeline (foreground, Ctrl+C to pause, re-run to resume)
24
+ ./dev-pipeline/run.sh run feature-list.json
25
+
26
+ # 4. Check progress at any time (from another terminal)
27
+ ./dev-pipeline/run.sh status feature-list.json
28
+ ```
29
+
30
+ ## Commands
31
+
32
+ | Command | Description |
33
+ |---------|-------------|
34
+ | `./run.sh run [feature-list.json]` | Start or resume the pipeline. Processes features sequentially by dependency order. |
35
+ | `./run.sh status [feature-list.json]` | Display current pipeline status: completed, pending, blocked, failed features. |
36
+ | `./run.sh reset` | Clear all runtime state in `state/`. Pipeline starts fresh on next `run`. |
37
+ | `./run.sh help` | Show usage help. |
38
+ | `./retry-feature.sh <feature-id> [feature-list.json]` | Retry a single failed feature. Runs one session then exits. |
39
+ | `./reset-feature.sh <feature-id> [--clean] [--run]` | Reset a feature to pending. `--clean` deletes artifacts, `--run` auto-retries. |
40
+
41
+ If `feature-list.json` path is omitted, defaults to `.dev-pipeline/feature-list.json` (run.sh) or `feature-list.json` (retry-feature.sh).
42
+
43
+ ### Retrying a Failed Feature
44
+
45
+ When a feature fails after max retries, use `retry-feature.sh` to run a single retry session:
46
+
47
+ ```bash
48
+ # Retry F-007
49
+ ./dev-pipeline/retry-feature.sh F-007
50
+
51
+ # With custom feature list
52
+ ./dev-pipeline/retry-feature.sh F-007 feature-list.json
53
+
54
+ # With timeout (default: no limit)
55
+ SESSION_TIMEOUT=7200 ./dev-pipeline/retry-feature.sh F-007
56
+ ```
57
+
58
+ The script will:
59
+ 1. Reset the feature status to allow retry
60
+ 2. Generate a fresh bootstrap prompt
61
+ 3. Run exactly one AI CLI session with heartbeat monitoring
62
+ 4. Update feature status based on the result
63
+ 5. Exit (does not continue to other features)
64
+
65
+ ### Resetting a Failed Feature
66
+
67
+ When a feature is stuck (e.g. retry count exceeded, bad artifacts), use `reset-feature.sh` to wipe its state:
68
+
69
+ ```bash
70
+ # Reset status only (retry_count → 0, status → pending)
71
+ ./dev-pipeline/reset-feature.sh F-007
72
+
73
+ # Reset + delete all session history and .prizmkit artifacts
74
+ ./dev-pipeline/reset-feature.sh F-007 --clean
75
+
76
+ # Reset + clean + immediately retry
77
+ ./dev-pipeline/reset-feature.sh F-007 --clean --run
78
+
79
+ # With custom feature list
80
+ ./dev-pipeline/reset-feature.sh F-007 --clean my-features.json
81
+ ```
82
+
83
+ What gets cleaned with `--clean`:
84
+ - `state/features/F-XXX/sessions/` — all session logs and prompts
85
+ - `.prizmkit/specs/{feature-slug}/` — spec.md, plan.md, tasks.md, contracts/
86
+
87
+ What is always reset (with or without `--clean`):
88
+ - `status.json` — status → pending, retry_count → 0
89
+ - `feature-list.json` — feature status → pending
90
+
91
+ ## Environment Variables
92
+
93
+ | Variable | Default | Description |
94
+ |----------|---------|-------------|
95
+ | `MAX_RETRIES` | `3` | Maximum retry attempts per feature before marking as failed. |
96
+ | `SESSION_TIMEOUT` | `0` (no limit) | Timeout in seconds per AI CLI session. 0 = no timeout. |
97
+ | `AI_CLI` | auto-detect | AI CLI command name. Auto-detects `cbc` or `claude`. Set to override. |
98
+ | `HEARTBEAT_INTERVAL` | `30` | Seconds between heartbeat log output while a session is running. |
99
+ | `HEARTBEAT_STALE_THRESHOLD` | `600` | Seconds before a session is considered stale/stuck. |
100
+
101
+ Example with custom config:
102
+
103
+ ```bash
104
+ MAX_RETRIES=5 ./dev-pipeline/run.sh run feature-list.json
105
+
106
+ # With 2-hour timeout per session
107
+ SESSION_TIMEOUT=7200 ./dev-pipeline/run.sh run feature-list.json
108
+ ```
109
+
110
+ ## How It Works
111
+
112
+ ### Execution Flow
113
+
114
+ ```
115
+ run.sh main loop
116
+
117
+ ├─ detect-stuck.py # Check for stale/stuck sessions
118
+ ├─ update-feature-status.py # get_next: find next runnable feature (pending + deps met)
119
+
120
+ ├─ generate-bootstrap-prompt.py # Build prompt with feature details + context
121
+
122
+ ├─ AI CLI session # cbc --print -y < prompt (CodeBuddy)
123
+ │ │ # claude --print -p "$(cat prompt)" --yes (Claude Code)
124
+ │ └─ prizm-dev-team # Multi-agent team implements the feature
125
+ │ ├─ Coordinator # Orchestrates the 10-phase pipeline
126
+ │ ├─ PM # Phase 1-4: specify → plan → tasks → analyze
127
+ │ ├─ Dev x N # Phase 6: implement with TDD
128
+ │ ├─ QA # Phase 7: integration tests + code review
129
+ │ ├─ Review # Phase 7: code consistency audit
130
+ │ └─ Coordinator # Phase 9: summarize → commit → retrospective
131
+
132
+ ├─ check-session-status.py # Parse session outcome
133
+ ├─ update-feature-status.py # Update feature state (completed/failed/retry)
134
+
135
+ └─ loop → next feature
136
+ ```
137
+
138
+ ### 10-Phase Pipeline (per feature session)
139
+
140
+ Each AI CLI session drives the prizm-dev-team through these phases. **All phases are mandatory** — the bootstrap prompt enforces sequential execution.
141
+
142
+ > **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.
143
+
144
+ | Phase | Name | Agent | PrizmKit Skills | Artifacts |
145
+ |-------|------|-------|----------------|-----------|
146
+ | 0 | Init | Coordinator | `prizmkit-init` | `.prizm-docs/root.prizm`, `.prizmkit/config.json` |
147
+ | 1 | Specify | PM | `prizmkit-specify`, `prizmkit-clarify` | `.prizmkit/specs/spec.md`, `.dev-team/specs/requirements.md` |
148
+ | 2 | Plan | PM | `prizmkit-plan` | `.prizmkit/plans/plan.md`, `.dev-team/contracts/` |
149
+ | 3 | Tasks | PM | `prizmkit-tasks` | `.prizmkit/tasks/tasks.md`, `.dev-team/tasks/` |
150
+ | 4 | Analyze | PM | `prizmkit-analyze` | Analysis report (no CRITICAL issues) |
151
+ | 5 | Schedule | Coordinator | — | TaskList entries assigned |
152
+ | 6 | Implement | Dev x N | `prizmkit-implement` | Code + tests, tasks.md marked `[x]` |
153
+ | 7 | Review | QA + Review | `prizmkit-code-review` | Integration tests, review report |
154
+ | 8 | Fix Loop | Dev | — | Max 3 rounds of fixes |
155
+ | 9 | Summarize & Commit | Coordinator | `prizmkit-summarize`, `prizmkit-committer`, `prizmkit-retrospective` | REGISTRY.md, git commit, .prizm-docs/ updated |
156
+
157
+ ### Feature Dependency Resolution
158
+
159
+ Features are executed in dependency order. The pipeline uses a DAG (Directed Acyclic Graph) to determine which features are runnable:
160
+
161
+ - A feature is **runnable** if status is `pending` and all dependencies are `completed`.
162
+ - A feature is **blocked** if any dependency is not yet `completed`.
163
+ - Features with no remaining runnable features and incomplete blocked features enter a 60s retry wait.
164
+
165
+ ### Session Lifecycle
166
+
167
+ 1. **Bootstrap prompt** is generated from the feature spec, tech stack context, and acceptance criteria.
168
+ 2. The AI CLI is spawned as a background process:
169
+ - **CodeBuddy**: `cbc --print -y < prompt` (prompt via stdin)
170
+ - **Claude Code**: `claude --print -p "$(cat prompt)" --yes` (prompt via `-p` argument)
171
+ 3. A **timeout watchdog** runs in parallel if `SESSION_TIMEOUT > 0`; kills the session if it exceeds the limit.
172
+ 4. A **heartbeat monitor** prints progress every `HEARTBEAT_INTERVAL` seconds (default 30s).
173
+ 5. On completion, the script checks for `session-status.json` to determine success/failure.
174
+ 6. Feature status is updated. On failure, retry count increments. After `MAX_RETRIES`, the feature is marked failed.
175
+
176
+ ### Heartbeat Output
177
+
178
+ While an AI CLI session is running, the pipeline outputs periodic heartbeat lines:
179
+
180
+ ```
181
+ ▶ [HEARTBEAT] 1m30s elapsed | log: 245KB (+12480B) | Creating team prizm-dev-team-F-001...
182
+ ▶ [HEARTBEAT] 2m0s elapsed | log: 389KB (+147456B) | Generating spec.md for feature...
183
+ ⏸ [HEARTBEAT] 2m30s elapsed | log: 389KB (+0B) | (waiting for AI response)
184
+ ```
185
+
186
+ - `▶` (green): log is growing — session is actively producing output
187
+ - `⏸` (yellow): log unchanged since last check — session may be waiting or stuck
188
+ - Shows elapsed time, log file size, growth since last heartbeat, and last log line
189
+
190
+ ### Monitoring Session Logs
191
+
192
+ Each AI CLI session 的完整输出(tool 调用、文件读写、代码生成、AI 思考过程)都记录在 session log 中。开一个新终端实时查看:
193
+
194
+ ```bash
195
+ # 实时跟踪当前正在执行的 session 日志
196
+ tail -f dev-pipeline/state/features/F-*/sessions/*/logs/session.log
197
+
198
+ # 如果知道具体 feature ID,可以更精确
199
+ tail -f dev-pipeline/state/features/F-003/sessions/*/logs/session.log
200
+ ```
201
+
202
+ 通过日志可以判断:
203
+ - session 当前在执行哪个 phase
204
+ - 是否在读正确的文件
205
+ - 是否出现幻觉或方向错误
206
+ - 具体卡在什么步骤
207
+
208
+ session 结束后查看完整日志:
209
+
210
+ ```bash
211
+ cat dev-pipeline/state/features/F-003/sessions/F-003-*/logs/session.log | less
212
+ ```
213
+
214
+ ### Pause & Resume
215
+
216
+ - **Ctrl+C** during execution triggers graceful shutdown — current state is saved.
217
+ - **Re-running** `./run.sh run feature-list.json` resumes from where it left off. Completed features are skipped.
218
+
219
+ ### Manual Intervention
220
+
221
+ If a feature fails after max retries, the pipeline blocks. To resolve:
222
+
223
+ ```bash
224
+ # Check what failed
225
+ ./dev-pipeline/run.sh status feature-list.json
226
+
227
+ # Review session logs
228
+ cat dev-pipeline/state/features/F-XXX/sessions/*/logs/session.log
229
+
230
+ # Option A: Fix manually and mark as complete
231
+ python3 dev-pipeline/scripts/update-feature-status.py \
232
+ --feature-list feature-list.json \
233
+ --state-dir dev-pipeline/state \
234
+ --feature-id F-XXX --action complete
235
+
236
+ # Option B: Reset the feature for retry
237
+ python3 dev-pipeline/scripts/update-feature-status.py \
238
+ --feature-list feature-list.json \
239
+ --state-dir dev-pipeline/state \
240
+ --feature-id F-XXX --action reset
241
+
242
+ # Resume pipeline
243
+ ./dev-pipeline/run.sh run feature-list.json
244
+ ```
245
+
246
+ ## Directory Structure
247
+
248
+ ```
249
+ dev-pipeline/
250
+ ├── run.sh # Main entry point — full pipeline loop
251
+ ├── retry-feature.sh # Retry a single failed feature
252
+ ├── reset-feature.sh # Reset/clean a feature for fresh re-execution
253
+ ├── README.md # This file
254
+ ├── .gitignore # Ignores state/ and __pycache__/
255
+ ├── scripts/
256
+ │ ├── init-pipeline.py # Initialize state/ from feature-list.json
257
+ │ ├── init-dev-team.py # Initialize .dev-team/ and .prizmkit/ directories
258
+ │ ├── generate-bootstrap-prompt.py # Build per-feature prompt for AI CLI session
259
+ │ ├── check-session-status.py # Parse session-status.json for outcome
260
+ │ ├── update-feature-status.py # Update feature state + get_next + status display
261
+ │ └── detect-stuck.py # Detect stuck/stale sessions by heartbeat
262
+ ├── templates/
263
+ │ ├── bootstrap-prompt.md # Prompt template for AI CLI sessions
264
+ │ ├── feature-list-schema.json # JSON schema for feature-list.json
265
+ │ └── session-status-schema.json # JSON schema for session output
266
+ ├── assets/
267
+ │ ├── feature-list-example.json # Example feature list (TaskFlow app)
268
+ │ └── prizm-dev-team-integration.md # How pipeline integrates with prizm-dev-team
269
+ └── state/ # Runtime state (gitignored, auto-generated)
270
+ ├── pipeline.json # Pipeline run metadata
271
+ ├── current-session.json # Currently executing session
272
+ └── features/
273
+ └── F-XXX/
274
+ ├── status.json # Feature status, retry count, session history
275
+ └── sessions/
276
+ └── F-XXX-YYYYMMDDHHMMSS/
277
+ ├── bootstrap-prompt.md # Generated prompt for this session
278
+ └── logs/
279
+ │ └── session.log # Full AI CLI session output
280
+ ```
281
+
282
+ ### PrizmKit Artifact Structure (per-feature)
283
+
284
+ Each feature generates artifacts in a dedicated subdirectory under `.prizmkit/specs/`:
285
+
286
+ ```
287
+ .prizmkit/
288
+ ├── config.json # PrizmKit configuration
289
+ └── specs/
290
+ ├── REGISTRY.md # Feature registry (Phase 9 appends here)
291
+ ├── 001-project-infrastructure-setup/
292
+ │ ├── spec.md # Phase 1: Feature specification
293
+ │ ├── checklists/
294
+ │ │ └── requirements.md # Phase 1: Spec quality checklist
295
+ │ ├── plan.md # Phase 2: Implementation plan
296
+ │ ├── data-model.md # Phase 2: Data model (if applicable)
297
+ │ ├── contracts/ # Phase 2: API contracts (if applicable)
298
+ │ └── tasks.md # Phase 3: Task breakdown
299
+ ├── 002-core-encryption-vault/
300
+ │ └── ...
301
+ └── ...
302
+ ```
303
+
304
+ ## macOS Compatibility Notes
305
+
306
+ The original `run.sh` used GNU `timeout` which is not available on macOS by default. The current implementation uses a background process + watchdog pattern instead, which works on both macOS and Linux without additional dependencies.
307
+
308
+ Key adaptations:
309
+ - The AI CLI is run as a background process with `&`
310
+ - A separate watchdog subshell handles timeout via `sleep + kill`
311
+ - A heartbeat monitor subshell prints periodic progress to the terminal
312
+ - SIGTERM (exit code 143) is mapped to exit code 124 (GNU timeout convention)
313
+ - All cleanup commands use `|| true` to prevent `set -e` from causing silent exits
314
+
315
+ ## Troubleshooting
316
+
317
+ ### Pipeline stops after completing one feature
318
+
319
+ Check if `set -e` is causing a silent exit. All python script invocations in the main loop should have `|| true` guards. Review `run.sh` for any unguarded commands that might return non-zero.
320
+
321
+ ### Session log is empty
322
+
323
+ The AI CLI session didn't produce any output. Verify:
324
+ - Your CLI is in PATH and functional:
325
+ - CodeBuddy: `echo "test" | cbc --print -y`
326
+ - Claude Code: `claude --print -p "test" --yes`
327
+ - The bootstrap prompt file was generated: check `state/features/F-XXX/sessions/*/bootstrap-prompt.md`
328
+
329
+ ### "PIPELINE_BLOCKED" message loops
330
+
331
+ All remaining features have unmet dependencies. Check `status` to find which features failed:
332
+
333
+ ```bash
334
+ ./dev-pipeline/run.sh status feature-list.json
335
+ ```
336
+
337
+ Then manually complete or reset the blocking feature.
338
+
339
+ ### Feature marked as "crashed"
340
+
341
+ The AI CLI session exited without producing a `session-status.json`. This typically means the session crashed or the agent didn't write a completion status. The pipeline will retry up to `MAX_RETRIES` times.
342
+
343
+ ### .prizmkit/specs/ is empty after feature completion
344
+
345
+ The session skipped the PrizmKit artifact generation phases (spec.md, plan.md, tasks.md). This can happen if:
346
+
347
+ 1. **Agent definitions not found**: Check that agent definition files exist
348
+ - CodeBuddy: `.codebuddy/agents/prizm-dev-team-*.md`
349
+ - Claude Code: `.claude/agents/prizm-dev-team-*.md`
350
+ 2. **Team config missing**: Check that team configuration exists
351
+ - CodeBuddy: `~/.codebuddy/teams/prizm-dev-team/config.json`
352
+ - Claude Code: `.claude/team-info.json`
353
+ 3. **Session took shortcuts**: The AI CLI session implemented the feature directly without following the 10-phase pipeline
354
+
355
+ To fix, ensure the agent definitions and team configs are properly installed per the Prizm-Kit-Construct-Guide.md.
356
+
357
+ ## Agent and Team Configuration
358
+
359
+ The pipeline expects:
360
+
361
+ **CodeBuddy (CBC):**
362
+
363
+ | Resource | Location | Description |
364
+ |----------|----------|-------------|
365
+ | Agent Definitions | `.codebuddy/agents/prizm-dev-team-*.md` | 4 agent types: coordinator, pm, dev, reviewer |
366
+ | Team Config | `~/.codebuddy/teams/prizm-dev-team/config.json` | Team runtime configuration |
367
+ | Team Inboxes | `~/.codebuddy/teams/prizm-dev-team/inboxes/` | Agent message inboxes |
368
+
369
+ **Claude Code (CC):**
370
+
371
+ | Resource | Location | Description |
372
+ |----------|----------|-------------|
373
+ | Agent Definitions | `.claude/agents/prizm-dev-team-*.md` | 4 agent types: coordinator, pm, dev, reviewer |
374
+ | Team Config | `.claude/team-info.json` | Team runtime configuration (project-level) |
375
+
376
+ The `generate-bootstrap-prompt.py` script resolves these paths automatically. If paths are incorrect, check the `build_replacements()` function in that script.
377
+
378
+ ---
379
+
380
+ ## Bug Fix Pipeline (Outer Automation)
381
+
382
+ The bug fix pipeline provides the same autonomous outer-loop automation as the feature pipeline, but tailored for bug fixes from a `bug-fix-list.json`.
383
+
384
+ ### Quick Start
385
+
386
+ ```bash
387
+ # 1. Generate bug fix list (via bug-planner skill in an AI CLI session)
388
+ # Output: bug-fix-list.json in project root
389
+
390
+ # 2. Run the bugfix pipeline (foreground)
391
+ ./dev-pipeline/run-bugfix.sh run bug-fix-list.json
392
+
393
+ # 3. Or run as a background daemon
394
+ ./dev-pipeline/launch-bugfix-daemon.sh start bug-fix-list.json
395
+
396
+ # 4. Check progress
397
+ ./dev-pipeline/run-bugfix.sh status bug-fix-list.json
398
+ ```
399
+
400
+ ### Bug Fix Commands
401
+
402
+ | Command | Description |
403
+ |---------|-------------|
404
+ | `./run-bugfix.sh run [bug-fix-list.json]` | Run all bugs by severity/priority order |
405
+ | `./run-bugfix.sh run <bug-id> [options]` | Run a single bug fix |
406
+ | `./run-bugfix.sh status [bug-fix-list.json]` | Display bug fix pipeline status |
407
+ | `./run-bugfix.sh reset` | Clear all bugfix runtime state |
408
+ | `./retry-bug.sh <bug-id> [bug-fix-list.json]` | Retry a single failed bug fix |
409
+ | `./launch-bugfix-daemon.sh start [bug-fix-list.json]` | Start bugfix pipeline in background |
410
+ | `./launch-bugfix-daemon.sh stop` | Gracefully stop the bugfix daemon |
411
+ | `./launch-bugfix-daemon.sh status` | Check daemon status with progress JSON |
412
+ | `./launch-bugfix-daemon.sh logs --follow` | Live tail daemon logs |
413
+
414
+ ### Bug Fix Execution Flow
415
+
416
+ ```
417
+ run-bugfix.sh main loop
418
+
419
+ ├─ update-bug-status.py # get_next: find next bug (by severity → priority)
420
+
421
+ ├─ generate-bugfix-prompt.py # Build prompt from bugfix-bootstrap-prompt.md template
422
+
423
+ ├─ AI CLI session # cbc --print -y < prompt (CBC)
424
+ │ │ # claude --print -p "$(cat prompt)" --yes (CC)
425
+ │ └─ prizmkit-bug-fix-workflow # 5-phase pipeline
426
+ │ ├─ Phase 1: Triage (Dev agent: classify, assess impact, write fix-plan.md)
427
+ │ ├─ Phase 2: Reproduce (Dev agent: create failing reproduction test)
428
+ │ ├─ Phase 3: Fix (Dev agent: TDD — make reproduction test pass)
429
+ │ ├─ Phase 4: Verify (Reviewer agent: code review + regression tests)
430
+ │ └─ Phase 5: Commit (Dev agent: commit, update TRAPS, write fix-report.md)
431
+
432
+ ├─ check-session-status.py # Parse session outcome
433
+ ├─ update-bug-status.py # Update bug state (completed/failed/retry)
434
+
435
+ └─ loop → next bug
436
+ ```
437
+
438
+ ### Bug Priority Resolution
439
+
440
+ Bugs are processed in this order:
441
+ 1. **Severity** first: `critical` > `high` > `medium` > `low`
442
+ 2. **Priority field** second: lower number = higher priority
443
+ 3. **In-progress** bugs (interrupted sessions) are resumed before pending bugs
444
+
445
+ ### Bug Fix Artifacts
446
+
447
+ Each bug fix produces exactly 2 artifacts:
448
+
449
+ ```
450
+ .prizmkit/bugfix/B-001/
451
+ ├── fix-plan.md ← Phase 1 output
452
+ └── fix-report.md ← Phase 5 output
453
+ ```
454
+
455
+ ### Bug Fix State Directory
456
+
457
+ ```
458
+ dev-pipeline/bugfix-state/ # Runtime state (gitignored)
459
+ ├── pipeline.json # Pipeline run metadata
460
+ ├── current-session.json # Currently executing session
461
+ └── bugs/
462
+ └── B-XXX/
463
+ ├── status.json # Bug status, retry count, session history
464
+ └── sessions/
465
+ └── B-XXX-YYYYMMDDHHMMSS/
466
+ ├── bootstrap-prompt.md # Generated prompt for this session
467
+ └── logs/
468
+ └── session.log # Full session output
469
+ ```
470
+
471
+ ### Differences from Feature Pipeline
472
+
473
+ | Aspect | Feature Pipeline | Bug Fix Pipeline |
474
+ |--------|-----------------|-----------------|
475
+ | Input file | `feature-list.json` | `bug-fix-list.json` |
476
+ | ID format | `F-NNN` | `B-NNN` |
477
+ | State dir | `state/` | `bugfix-state/` |
478
+ | Ordering | Dependencies DAG → priority | Severity → priority (no dependencies) |
479
+ | Phases | 10-phase (specify → plan → tasks → implement → review) | 5-phase (triage → reproduce → fix → verify → commit) |
480
+ | Agents | Coordinator + PM + Dev + Reviewer | Dev + Reviewer only |
481
+ | Artifacts | spec.md, plan.md, tasks.md, REGISTRY.md | fix-plan.md, fix-report.md only |
482
+ | Commit prefix | `feat(<scope>):` | `fix(<scope>):` |