@crewpilot/agent 2.0.0 → 3.0.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.
Files changed (27) hide show
  1. package/README.md +131 -131
  2. package/dist-npm/cli.js +5 -5
  3. package/dist-npm/index.js +100 -100
  4. package/package.json +69 -69
  5. package/prompts/agent.md +282 -282
  6. package/prompts/copilot-instructions.md +36 -36
  7. package/prompts/{catalyst.config.json → crewpilot.config.json} +72 -72
  8. package/prompts/skills/assure-code-quality/SKILL.md +112 -112
  9. package/prompts/skills/assure-pr-intelligence/SKILL.md +148 -148
  10. package/prompts/skills/assure-review-functional/SKILL.md +114 -114
  11. package/prompts/skills/assure-review-standards/SKILL.md +106 -106
  12. package/prompts/skills/assure-threat-model/SKILL.md +182 -182
  13. package/prompts/skills/assure-vulnerability-scan/SKILL.md +146 -146
  14. package/prompts/skills/autopilot-meeting/SKILL.md +434 -434
  15. package/prompts/skills/autopilot-worker/SKILL.md +737 -737
  16. package/prompts/skills/daily-digest/SKILL.md +188 -188
  17. package/prompts/skills/deliver-change-management/SKILL.md +132 -132
  18. package/prompts/skills/deliver-deploy-guard/SKILL.md +144 -144
  19. package/prompts/skills/deliver-doc-governance/SKILL.md +130 -130
  20. package/prompts/skills/engineer-feature-builder/SKILL.md +270 -270
  21. package/prompts/skills/engineer-root-cause-analysis/SKILL.md +150 -150
  22. package/prompts/skills/engineer-test-first/SKILL.md +148 -148
  23. package/prompts/skills/insights-knowledge-base/SKILL.md +202 -202
  24. package/prompts/skills/insights-pattern-detection/SKILL.md +142 -142
  25. package/prompts/skills/strategize-architecture-planner/SKILL.md +141 -141
  26. package/prompts/skills/strategize-solution-design/SKILL.md +118 -118
  27. package/scripts/postinstall.js +108 -108
@@ -1,270 +1,270 @@
1
- # Feature Builder
2
-
3
- > **Pillar**: Engineer | **ID**: `engineer-feature-builder`
4
-
5
- ## Purpose
6
-
7
- The **primary entry point** for implementation requests. Handles everything from "add a loading spinner" to "build a notification system" by auto-classifying complexity and scaling ceremony accordingly. Infers what it can, confirms briefly, asks only when genuinely ambiguous.
8
-
9
- ## Activation Triggers
10
-
11
- - "build this feature", "implement", "scaffold", "create a new"
12
- - "add functionality", "develop", "code this up"
13
- - "can you implement", "make this work", "add X to Y"
14
- - After `architecture-planner` defines a milestone to implement
15
-
16
- ## Methodology
17
-
18
- ### Process Flow
19
-
20
- ```dot
21
- digraph feature_builder {
22
- rankdir=TB;
23
- node [shape=box];
24
-
25
- triage [label="Phase 0\nComplexity Triage\n(universal entry point)", shape=diamond, style=filled, fillcolor="#ffffcc"];
26
- trivial [label="Trivial\nJust build it"];
27
- simple [label="Simple\nState approach → build"];
28
- moderate_route [label="Route to\nautopilot-worker\n(monolith)", shape=hexagon, style=filled, fillcolor="#cce5ff"];
29
- complex_route [label="Route to\nautopilot-worker\n(full ceremony)", shape=hexagon, style=filled, fillcolor="#cce5ff"];
30
- user_skip [label="User says\n'just build it'", shape=diamond];
31
- clarify [label="Phase 1\nRequirement Clarification"];
32
- plan [label="Phase 2\nImplementation Plan"];
33
- scaffold [label="Phase 3\nScaffold"];
34
- implement [label="Phase 4\nImplement"];
35
- escalate [label="Mid-build escalation\n'this is bigger than expected'", shape=diamond, style=filled, fillcolor="#ffe0cc"];
36
- verify [label="Phase 5\nVerify", shape=diamond, style=filled, fillcolor="#ccffcc"];
37
- done [label="Done + Hints", shape=doublecircle];
38
- fix [label="Fix Issues"];
39
-
40
- triage -> trivial [label="1 file\nclear intent"];
41
- triage -> simple [label="1-3 files\nobvious pattern"];
42
- triage -> moderate_route [label="3-10 files\nmulti-concern"];
43
- triage -> complex_route [label="10+ files\nnew system"];
44
- triage -> trivial [label="user overrides\n'just do it'", style=dashed];
45
- moderate_route -> user_skip [label="user says\nskip ceremony"];
46
- user_skip -> clarify [label="yes"];
47
- complex_route -> user_skip [label="user says\nskip ceremony"];
48
- trivial -> implement;
49
- simple -> implement;
50
- clarify -> plan;
51
- plan -> scaffold;
52
- scaffold -> implement;
53
- implement -> escalate [label="discovers more\ncomplexity"];
54
- escalate -> moderate_route [label="user agrees\nto escalate"];
55
- escalate -> implement [label="user says\ncontinue"];
56
- implement -> verify;
57
- verify -> done [label="all checks pass"];
58
- verify -> fix [label="tests/lint fail"];
59
- fix -> verify;
60
- }
61
- ```
62
-
63
- ### Phase 0 — Complexity Triage
64
-
65
- **This is the universal entry point for all implementation requests.** Before anything else, scan the codebase and classify the request. Announce the routing decision in one line so the user knows what's happening.
66
-
67
- #### Override Rules
68
- - If the user explicitly says "autopilot", "full pipeline", "end to end" → route directly to `autopilot-worker`, skip triage.
69
- - If the user provides a board issue number ("#42") → route to `autopilot-worker` (issue already has structure).
70
- - If the user says "just do it", "skip ceremony", "don't overthink it" → stay in feature-builder regardless of complexity.
71
-
72
- #### Routing Signals
73
-
74
- | Signal | How to Detect | Weight |
75
- |---|---|---|
76
- | **Files likely touched** | Scan codebase for probable touch points | 1 = trivial, 1-3 = simple, 3-10 = moderate, 10+ = complex |
77
- | **Ambiguity** | Is the request specific or open-ended? | Clear = lower, vague = higher |
78
- | **Architectural impact** | Isolated module or cross-cutting? | Isolated = lower, new system = higher |
79
- | **Existing patterns** | Follows known pattern or novel? | Known = lower, novel = higher |
80
- | **External dependencies** | New packages, services, APIs? | None = lower, new deps = higher |
81
- | **Keywords** | "system", "architecture", "service", "pipeline", "integration" | Push toward complex |
82
- | **Board context** | Issue has `needs-design` or `needs-architecture` label? | → complex |
83
-
84
- #### Tier Assignment & Routing
85
-
86
- #### Trivial (1 file, clear intent, < 30 min)
87
- > Examples: "add a loading spinner", "fix the typo in the header", "make the button blue"
88
-
89
- **Route: feature-builder (this skill) — skip to Phase 4.**
90
-
91
- - **Do not ask questions.** Just implement.
92
- - Announce: *"Small change — implementing directly."*
93
- - Skip Phases 1-3. Go directly to Phase 4 (Implement) → Phase 5 (Verify).
94
-
95
- #### Simple (1-3 files, well-understood pattern)
96
- > Examples: "add input validation to the signup form", "add a 404 page"
97
-
98
- **Route: feature-builder (this skill) — Phase 1 brief → Phase 4.**
99
-
100
- - State your approach in 2-3 sentences. Include which files you'll touch.
101
- - Ask **at most 1** clarifying question — only if there's genuine ambiguity.
102
- - Skip Phase 3 (Scaffold).
103
-
104
- #### Moderate (3-10 files, some ambiguity, multi-concern)
105
- > Examples: "add pagination to all API endpoints", "implement role-based access"
106
-
107
- **Route: autopilot-worker (board tracking + plan approval + review pipeline).**
108
-
109
- Announce:
110
- > *"This touches ~{N} files across {concerns}. I'd like to route this to the full pipeline — I'll first confirm the task details with you, create a board issue, plan the work, and get your approval before building. [Say 'just build it' to skip the pipeline.]"*
111
-
112
- - If user says "just build it" → stay in feature-builder, run Phases 1-5 with inferred acceptance criteria.
113
- - Otherwise → hand off to `autopilot-worker` with the request context. The worker will confirm the task before creating a board issue.
114
-
115
- #### Complex (10+ files, new system, architectural decisions)
116
- > Examples: "build a notification system with email + webhooks", "add multi-tenancy"
117
-
118
- **Route: autopilot-worker (full ceremony with design/architecture phases).**
119
-
120
- Announce:
121
- > *"This is a significant change — new {system/component} touching {N} areas. Routing to full autopilot with design phase. [Say 'just build it' to skip ceremony and I'll use my best judgment.]"*
122
-
123
- - If user says "just build it" → stay in feature-builder, proceed with best-judgment approach, note assumptions explicitly.
124
- - Otherwise → hand off to `autopilot-worker`. If the request signals design needs, suggest adding `needs-design` or `needs-architecture` labels to trigger those phases.
125
-
126
- **The golden rule: Infer first, confirm second, ask last.**
127
- - Can you infer acceptance criteria? → Generate them, show briefly inline.
128
- - Can you infer the approach from codebase patterns? → State it, proceed.
129
- - Is there genuine ambiguity with divergent outcomes? → Ask ONE question.
130
- - Never block on info the agent can figure out from the codebase.
131
-
132
- ### Phase 1 — Requirement Clarification
133
- *(Skipped for trivial tier. Brief for simple tier. Full for moderate/complex.)*
134
-
135
- 1. Restate the feature in one sentence
136
- 2. **Generate** acceptance criteria from the request + codebase context — show them inline, don't ask the user to write them:
137
- > *"Based on your request and the codebase, here's what 'done' looks like: [criteria]. Sound right?"*
138
- 3. List inputs, outputs, and side effects
139
- 4. Scan existing codebase for related code: similar features, shared patterns, reusable utilities
140
- 5. Ask ONE clarifying question if genuinely ambiguous. Otherwise, proceed.
141
-
142
- ### Phase 2 — Implementation Plan
143
- 1. List files to create/modify (with specific changes per file)
144
- 2. Identify the dependency order — what must be built first
145
- 3. Flag external dependencies that need installing
146
- 4. Determine if existing patterns should be followed or if this is a new pattern
147
-
148
- Present as an ordered task list:
149
- ```
150
- 1. [ ] Create {file} — {purpose}
151
- 2. [ ] Modify {file} — {what changes}
152
- 3. [ ] Add tests in {file} — {what to test}
153
- ```
154
-
155
- ### Phase 3 — Scaffold
156
- 1. Create file skeletons with proper structure (exports, imports, type signatures)
157
- 2. Add TODO comments at implementation points
158
- 3. Follow existing project conventions (naming, file organization, import style)
159
- 4. If `scaffold_tests` is enabled in config, create test file skeletons alongside
160
-
161
- ### Phase 4 — Implement
162
- 1. Fill in implementation file by file, following the dependency order
163
- 2. Each function: write the signature → implement core logic → handle edge cases → add error handling
164
- 3. Use existing utilities — do NOT reinvent what already exists in the codebase
165
- 4. Keep functions focused — if a function grows beyond ~25 lines, consider splitting
166
-
167
- **Mid-build escalation check:** During implementation, if you discover the task is significantly larger than estimated:
168
- - Touching more files than expected (e.g., triaged as simple but now touching 6+ files)
169
- - Encountering architectural decisions that weren't apparent upfront
170
- - Realizing the change has cross-cutting impact (auth, DB schema, public APIs)
171
-
172
- Then **pause and offer escalation:**
173
- > *"This is more involved than expected — I'm now touching {N} files and there's {concern}. Want me to switch to the full pipeline with board tracking, a proper plan, and review? Or should I continue as-is?"*
174
-
175
- - If user says **"switch"** / **"escalate"** → hand off to `autopilot-worker` with: what's been discovered so far (files examined, patterns found, partial understanding). The worker enters at Phase 2 (planning) with this context.
176
- - If user says **"continue"** → proceed with implementation, but note the scope change in the final output.
177
-
178
- ### Phase 5 — Verify
179
-
180
- <HARD-GATE>
181
- Do NOT declare the feature complete until all verification checks pass.
182
- Do NOT skip test execution, lint checks, or the self-review against acceptance criteria.
183
- If any check fails, fix it before proceeding.
184
- </HARD-GATE>
185
-
186
- 1. Run existing tests to ensure nothing broke
187
- 2. Run the new tests
188
- 3. Check for TypeScript/lint errors
189
- 4. Self-review: does this implementation match the acceptance criteria?
190
-
191
- ## Tools Required
192
-
193
- - `codebase` — Understand existing structure, find reusable code
194
- - `terminal` — Install dependencies, run tests, run linters
195
- - `findTestFiles` — Locate existing test patterns
196
- - `catalyst_metrics_coverage` — Verify coverage after implementation
197
-
198
- ## Output Format
199
-
200
- ```
201
- ## [Catalyst → Feature Builder]
202
-
203
- ### Feature: {name}
204
- **Acceptance criteria**: {list}
205
-
206
- ### Plan
207
- {ordered task list}
208
-
209
- ### Changes Made
210
- | File | Action | Description |
211
- |---|---|---|
212
- | {path} | Created/Modified | {what} |
213
-
214
- ### Verification
215
- - Tests: {pass/fail count}
216
- - Lint: {clean/issues}
217
- - Coverage: {%}
218
- ```
219
-
220
- ## Chains To
221
-
222
- - `autopilot-worker` — Phase 0 routes moderate/complex tasks to the full pipeline; Phase 4 escalates mid-build if complexity grows
223
- - `solution-design` — When Phase 0 detects complex tier and user wants design exploration
224
- - `architecture-planner` — When Phase 0 detects complex tier with architectural impact
225
- - `test-first` — If TDD enforcement is strict, chains BEFORE implementation
226
- - `change-management` — Commit the completed feature
227
- - `doc-governance` — Update docs if the feature changes public APIs
228
-
229
- ## Capability Hints
230
-
231
- After completing work, append **one** contextual hint to the response based on what the user just did. Show each hint **at most once per session**. Place it after the main output, never before. Keep it to one line.
232
-
233
- | Context | Hint |
234
- |---|---|
235
- | User said "implement X" without a board issue | 💡 *I can also track this as a board issue and manage the full lifecycle — say "autopilot" next time.* |
236
- | Code was implemented but not committed | 💡 *I can generate conventional commits and split multi-concern changes — say "commit this".* |
237
- | Implementation touched public APIs or config | 💡 *I can check if your docs are out of sync with the code — say "check docs".* |
238
- | Bug was fixed | 💡 *I can run a systematic root cause analysis to find the real cause, not just the symptom — say "debug this" next time.* |
239
- | Tests were not written (no test framework or user declined) | 💡 *I can enforce TDD — write failing tests first, then implement — say "test first" next time.* |
240
- | Complex feature completed | 💡 *I can run code quality, security scan, and deploy readiness checks — say "review this" or "ready to deploy?".* |
241
- | First interaction in session | 💡 *I'm Catalyst — I can plan, build, test, review, and ship code end-to-end. Say "autopilot" for the full pipeline, or just tell me what to build.* |
242
-
243
- **Rules:**
244
- - One hint per response, max. Never stack multiple hints.
245
- - Do the work first, hint after. Hints never block or delay the output.
246
- - Include the activation phrase so the user knows what to say.
247
- - If the user has already used the hinted feature in this session, skip the hint.
248
-
249
- ## Anti-Patterns
250
-
251
- - Do NOT start coding before scanning existing patterns
252
- - Do NOT create utilities that already exist in the codebase
253
- - Do NOT skip the verification phase
254
- - Do NOT implement everything in one massive file
255
- - Do NOT add features beyond what was requested
256
-
257
- ## No Placeholders
258
-
259
- Every step in a plan and every file produced must contain real, working content. The following are **plan failures** — never write them:
260
-
261
- | Forbidden Pattern | Why It Fails |
262
- |---|---|
263
- | "TBD", "TODO", "implement later" | Defers work that should be done now |
264
- | "Add appropriate error handling" | Vague — specify which errors and how to handle them |
265
- | "Add validation" | Which inputs? What rules? What error messages? |
266
- | "Handle edge cases" | Name the edge cases or don't mention them |
267
- | "Write tests for the above" | Show the actual test code |
268
- | "Similar to Task N" | Repeat the code — the reader may not have Task N context |
269
- | Steps without code blocks | If a step changes code, show the code |
270
- | References to undefined types/functions | Every symbol must be defined in a task |
1
+ # Feature Builder
2
+
3
+ > **Pillar**: Engineer | **ID**: `engineer-feature-builder`
4
+
5
+ ## Purpose
6
+
7
+ The **primary entry point** for implementation requests. Handles everything from "add a loading spinner" to "build a notification system" by auto-classifying complexity and scaling ceremony accordingly. Infers what it can, confirms briefly, asks only when genuinely ambiguous.
8
+
9
+ ## Activation Triggers
10
+
11
+ - "build this feature", "implement", "scaffold", "create a new"
12
+ - "add functionality", "develop", "code this up"
13
+ - "can you implement", "make this work", "add X to Y"
14
+ - After `architecture-planner` defines a milestone to implement
15
+
16
+ ## Methodology
17
+
18
+ ### Process Flow
19
+
20
+ ```dot
21
+ digraph feature_builder {
22
+ rankdir=TB;
23
+ node [shape=box];
24
+
25
+ triage [label="Phase 0\nComplexity Triage\n(universal entry point)", shape=diamond, style=filled, fillcolor="#ffffcc"];
26
+ trivial [label="Trivial\nJust build it"];
27
+ simple [label="Simple\nState approach → build"];
28
+ moderate_route [label="Route to\nautopilot-worker\n(monolith)", shape=hexagon, style=filled, fillcolor="#cce5ff"];
29
+ complex_route [label="Route to\nautopilot-worker\n(full ceremony)", shape=hexagon, style=filled, fillcolor="#cce5ff"];
30
+ user_skip [label="User says\n'just build it'", shape=diamond];
31
+ clarify [label="Phase 1\nRequirement Clarification"];
32
+ plan [label="Phase 2\nImplementation Plan"];
33
+ scaffold [label="Phase 3\nScaffold"];
34
+ implement [label="Phase 4\nImplement"];
35
+ escalate [label="Mid-build escalation\n'this is bigger than expected'", shape=diamond, style=filled, fillcolor="#ffe0cc"];
36
+ verify [label="Phase 5\nVerify", shape=diamond, style=filled, fillcolor="#ccffcc"];
37
+ done [label="Done + Hints", shape=doublecircle];
38
+ fix [label="Fix Issues"];
39
+
40
+ triage -> trivial [label="1 file\nclear intent"];
41
+ triage -> simple [label="1-3 files\nobvious pattern"];
42
+ triage -> moderate_route [label="3-10 files\nmulti-concern"];
43
+ triage -> complex_route [label="10+ files\nnew system"];
44
+ triage -> trivial [label="user overrides\n'just do it'", style=dashed];
45
+ moderate_route -> user_skip [label="user says\nskip ceremony"];
46
+ user_skip -> clarify [label="yes"];
47
+ complex_route -> user_skip [label="user says\nskip ceremony"];
48
+ trivial -> implement;
49
+ simple -> implement;
50
+ clarify -> plan;
51
+ plan -> scaffold;
52
+ scaffold -> implement;
53
+ implement -> escalate [label="discovers more\ncomplexity"];
54
+ escalate -> moderate_route [label="user agrees\nto escalate"];
55
+ escalate -> implement [label="user says\ncontinue"];
56
+ implement -> verify;
57
+ verify -> done [label="all checks pass"];
58
+ verify -> fix [label="tests/lint fail"];
59
+ fix -> verify;
60
+ }
61
+ ```
62
+
63
+ ### Phase 0 — Complexity Triage
64
+
65
+ **This is the universal entry point for all implementation requests.** Before anything else, scan the codebase and classify the request. Announce the routing decision in one line so the user knows what's happening.
66
+
67
+ #### Override Rules
68
+ - If the user explicitly says "autopilot", "full pipeline", "end to end" → route directly to `autopilot-worker`, skip triage.
69
+ - If the user provides a board issue number ("#42") → route to `autopilot-worker` (issue already has structure).
70
+ - If the user says "just do it", "skip ceremony", "don't overthink it" → stay in feature-builder regardless of complexity.
71
+
72
+ #### Routing Signals
73
+
74
+ | Signal | How to Detect | Weight |
75
+ |---|---|---|
76
+ | **Files likely touched** | Scan codebase for probable touch points | 1 = trivial, 1-3 = simple, 3-10 = moderate, 10+ = complex |
77
+ | **Ambiguity** | Is the request specific or open-ended? | Clear = lower, vague = higher |
78
+ | **Architectural impact** | Isolated module or cross-cutting? | Isolated = lower, new system = higher |
79
+ | **Existing patterns** | Follows known pattern or novel? | Known = lower, novel = higher |
80
+ | **External dependencies** | New packages, services, APIs? | None = lower, new deps = higher |
81
+ | **Keywords** | "system", "architecture", "service", "pipeline", "integration" | Push toward complex |
82
+ | **Board context** | Issue has `needs-design` or `needs-architecture` label? | → complex |
83
+
84
+ #### Tier Assignment & Routing
85
+
86
+ #### Trivial (1 file, clear intent, < 30 min)
87
+ > Examples: "add a loading spinner", "fix the typo in the header", "make the button blue"
88
+
89
+ **Route: feature-builder (this skill) — skip to Phase 4.**
90
+
91
+ - **Do not ask questions.** Just implement.
92
+ - Announce: *"Small change — implementing directly."*
93
+ - Skip Phases 1-3. Go directly to Phase 4 (Implement) → Phase 5 (Verify).
94
+
95
+ #### Simple (1-3 files, well-understood pattern)
96
+ > Examples: "add input validation to the signup form", "add a 404 page"
97
+
98
+ **Route: feature-builder (this skill) — Phase 1 brief → Phase 4.**
99
+
100
+ - State your approach in 2-3 sentences. Include which files you'll touch.
101
+ - Ask **at most 1** clarifying question — only if there's genuine ambiguity.
102
+ - Skip Phase 3 (Scaffold).
103
+
104
+ #### Moderate (3-10 files, some ambiguity, multi-concern)
105
+ > Examples: "add pagination to all API endpoints", "implement role-based access"
106
+
107
+ **Route: autopilot-worker (board tracking + plan approval + review pipeline).**
108
+
109
+ Announce:
110
+ > *"This touches ~{N} files across {concerns}. I'd like to route this to the full pipeline — I'll first confirm the task details with you, create a board issue, plan the work, and get your approval before building. [Say 'just build it' to skip the pipeline.]"*
111
+
112
+ - If user says "just build it" → stay in feature-builder, run Phases 1-5 with inferred acceptance criteria.
113
+ - Otherwise → hand off to `autopilot-worker` with the request context. The worker will confirm the task before creating a board issue.
114
+
115
+ #### Complex (10+ files, new system, architectural decisions)
116
+ > Examples: "build a notification system with email + webhooks", "add multi-tenancy"
117
+
118
+ **Route: autopilot-worker (full ceremony with design/architecture phases).**
119
+
120
+ Announce:
121
+ > *"This is a significant change — new {system/component} touching {N} areas. Routing to full autopilot with design phase. [Say 'just build it' to skip ceremony and I'll use my best judgment.]"*
122
+
123
+ - If user says "just build it" → stay in feature-builder, proceed with best-judgment approach, note assumptions explicitly.
124
+ - Otherwise → hand off to `autopilot-worker`. If the request signals design needs, suggest adding `needs-design` or `needs-architecture` labels to trigger those phases.
125
+
126
+ **The golden rule: Infer first, confirm second, ask last.**
127
+ - Can you infer acceptance criteria? → Generate them, show briefly inline.
128
+ - Can you infer the approach from codebase patterns? → State it, proceed.
129
+ - Is there genuine ambiguity with divergent outcomes? → Ask ONE question.
130
+ - Never block on info the agent can figure out from the codebase.
131
+
132
+ ### Phase 1 — Requirement Clarification
133
+ *(Skipped for trivial tier. Brief for simple tier. Full for moderate/complex.)*
134
+
135
+ 1. Restate the feature in one sentence
136
+ 2. **Generate** acceptance criteria from the request + codebase context — show them inline, don't ask the user to write them:
137
+ > *"Based on your request and the codebase, here's what 'done' looks like: [criteria]. Sound right?"*
138
+ 3. List inputs, outputs, and side effects
139
+ 4. Scan existing codebase for related code: similar features, shared patterns, reusable utilities
140
+ 5. Ask ONE clarifying question if genuinely ambiguous. Otherwise, proceed.
141
+
142
+ ### Phase 2 — Implementation Plan
143
+ 1. List files to create/modify (with specific changes per file)
144
+ 2. Identify the dependency order — what must be built first
145
+ 3. Flag external dependencies that need installing
146
+ 4. Determine if existing patterns should be followed or if this is a new pattern
147
+
148
+ Present as an ordered task list:
149
+ ```
150
+ 1. [ ] Create {file} — {purpose}
151
+ 2. [ ] Modify {file} — {what changes}
152
+ 3. [ ] Add tests in {file} — {what to test}
153
+ ```
154
+
155
+ ### Phase 3 — Scaffold
156
+ 1. Create file skeletons with proper structure (exports, imports, type signatures)
157
+ 2. Add TODO comments at implementation points
158
+ 3. Follow existing project conventions (naming, file organization, import style)
159
+ 4. If `scaffold_tests` is enabled in config, create test file skeletons alongside
160
+
161
+ ### Phase 4 — Implement
162
+ 1. Fill in implementation file by file, following the dependency order
163
+ 2. Each function: write the signature → implement core logic → handle edge cases → add error handling
164
+ 3. Use existing utilities — do NOT reinvent what already exists in the codebase
165
+ 4. Keep functions focused — if a function grows beyond ~25 lines, consider splitting
166
+
167
+ **Mid-build escalation check:** During implementation, if you discover the task is significantly larger than estimated:
168
+ - Touching more files than expected (e.g., triaged as simple but now touching 6+ files)
169
+ - Encountering architectural decisions that weren't apparent upfront
170
+ - Realizing the change has cross-cutting impact (auth, DB schema, public APIs)
171
+
172
+ Then **pause and offer escalation:**
173
+ > *"This is more involved than expected — I'm now touching {N} files and there's {concern}. Want me to switch to the full pipeline with board tracking, a proper plan, and review? Or should I continue as-is?"*
174
+
175
+ - If user says **"switch"** / **"escalate"** → hand off to `autopilot-worker` with: what's been discovered so far (files examined, patterns found, partial understanding). The worker enters at Phase 2 (planning) with this context.
176
+ - If user says **"continue"** → proceed with implementation, but note the scope change in the final output.
177
+
178
+ ### Phase 5 — Verify
179
+
180
+ <HARD-GATE>
181
+ Do NOT declare the feature complete until all verification checks pass.
182
+ Do NOT skip test execution, lint checks, or the self-review against acceptance criteria.
183
+ If any check fails, fix it before proceeding.
184
+ </HARD-GATE>
185
+
186
+ 1. Run existing tests to ensure nothing broke
187
+ 2. Run the new tests
188
+ 3. Check for TypeScript/lint errors
189
+ 4. Self-review: does this implementation match the acceptance criteria?
190
+
191
+ ## Tools Required
192
+
193
+ - `codebase` — Understand existing structure, find reusable code
194
+ - `terminal` — Install dependencies, run tests, run linters
195
+ - `findTestFiles` — Locate existing test patterns
196
+ - `crewpilot_metrics_coverage` — Verify coverage after implementation
197
+
198
+ ## Output Format
199
+
200
+ ```
201
+ ## [CrewPilot → Feature Builder]
202
+
203
+ ### Feature: {name}
204
+ **Acceptance criteria**: {list}
205
+
206
+ ### Plan
207
+ {ordered task list}
208
+
209
+ ### Changes Made
210
+ | File | Action | Description |
211
+ |---|---|---|
212
+ | {path} | Created/Modified | {what} |
213
+
214
+ ### Verification
215
+ - Tests: {pass/fail count}
216
+ - Lint: {clean/issues}
217
+ - Coverage: {%}
218
+ ```
219
+
220
+ ## Chains To
221
+
222
+ - `autopilot-worker` — Phase 0 routes moderate/complex tasks to the full pipeline; Phase 4 escalates mid-build if complexity grows
223
+ - `solution-design` — When Phase 0 detects complex tier and user wants design exploration
224
+ - `architecture-planner` — When Phase 0 detects complex tier with architectural impact
225
+ - `test-first` — If TDD enforcement is strict, chains BEFORE implementation
226
+ - `change-management` — Commit the completed feature
227
+ - `doc-governance` — Update docs if the feature changes public APIs
228
+
229
+ ## Capability Hints
230
+
231
+ After completing work, append **one** contextual hint to the response based on what the user just did. Show each hint **at most once per session**. Place it after the main output, never before. Keep it to one line.
232
+
233
+ | Context | Hint |
234
+ |---|---|
235
+ | User said "implement X" without a board issue | 💡 *I can also track this as a board issue and manage the full lifecycle — say "autopilot" next time.* |
236
+ | Code was implemented but not committed | 💡 *I can generate conventional commits and split multi-concern changes — say "commit this".* |
237
+ | Implementation touched public APIs or config | 💡 *I can check if your docs are out of sync with the code — say "check docs".* |
238
+ | Bug was fixed | 💡 *I can run a systematic root cause analysis to find the real cause, not just the symptom — say "debug this" next time.* |
239
+ | Tests were not written (no test framework or user declined) | 💡 *I can enforce TDD — write failing tests first, then implement — say "test first" next time.* |
240
+ | Complex feature completed | 💡 *I can run code quality, security scan, and deploy readiness checks — say "review this" or "ready to deploy?".* |
241
+ | First interaction in session | 💡 *I'm CrewPilot — I can plan, build, test, review, and ship code end-to-end. Say "autopilot" for the full pipeline, or just tell me what to build.* |
242
+
243
+ **Rules:**
244
+ - One hint per response, max. Never stack multiple hints.
245
+ - Do the work first, hint after. Hints never block or delay the output.
246
+ - Include the activation phrase so the user knows what to say.
247
+ - If the user has already used the hinted feature in this session, skip the hint.
248
+
249
+ ## Anti-Patterns
250
+
251
+ - Do NOT start coding before scanning existing patterns
252
+ - Do NOT create utilities that already exist in the codebase
253
+ - Do NOT skip the verification phase
254
+ - Do NOT implement everything in one massive file
255
+ - Do NOT add features beyond what was requested
256
+
257
+ ## No Placeholders
258
+
259
+ Every step in a plan and every file produced must contain real, working content. The following are **plan failures** — never write them:
260
+
261
+ | Forbidden Pattern | Why It Fails |
262
+ |---|---|
263
+ | "TBD", "TODO", "implement later" | Defers work that should be done now |
264
+ | "Add appropriate error handling" | Vague — specify which errors and how to handle them |
265
+ | "Add validation" | Which inputs? What rules? What error messages? |
266
+ | "Handle edge cases" | Name the edge cases or don't mention them |
267
+ | "Write tests for the above" | Show the actual test code |
268
+ | "Similar to Task N" | Repeat the code — the reader may not have Task N context |
269
+ | Steps without code blocks | If a step changes code, show the code |
270
+ | References to undefined types/functions | Every symbol must be defined in a task |