@zik000/archai 0.1.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 +378 -0
- package/dist/bin/cli.d.ts +3 -0
- package/dist/bin/cli.d.ts.map +1 -0
- package/dist/bin/cli.js +28 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/commands/doctor.d.ts +2 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +128 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/generate.d.ts +7 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +165 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/init.d.ts +7 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +160 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/generator/claude-cli.d.ts +19 -0
- package/dist/generator/claude-cli.d.ts.map +1 -0
- package/dist/generator/claude-cli.js +168 -0
- package/dist/generator/claude-cli.js.map +1 -0
- package/dist/generator/prompt-builder.d.ts +18 -0
- package/dist/generator/prompt-builder.d.ts.map +1 -0
- package/dist/generator/prompt-builder.js +122 -0
- package/dist/generator/prompt-builder.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/scaffold/copy-core-agents.d.ts +2 -0
- package/dist/scaffold/copy-core-agents.d.ts.map +1 -0
- package/dist/scaffold/copy-core-agents.js +74 -0
- package/dist/scaffold/copy-core-agents.js.map +1 -0
- package/dist/scaffold/create-config.d.ts +12 -0
- package/dist/scaffold/create-config.d.ts.map +1 -0
- package/dist/scaffold/create-config.js +154 -0
- package/dist/scaffold/create-config.js.map +1 -0
- package/dist/scaffold/create-project-description.d.ts +12 -0
- package/dist/scaffold/create-project-description.d.ts.map +1 -0
- package/dist/scaffold/create-project-description.js +104 -0
- package/dist/scaffold/create-project-description.js.map +1 -0
- package/dist/scaffold/create-structure.d.ts +2 -0
- package/dist/scaffold/create-structure.d.ts.map +1 -0
- package/dist/scaffold/create-structure.js +146 -0
- package/dist/scaffold/create-structure.js.map +1 -0
- package/dist/utils/detect-project.d.ts +11 -0
- package/dist/utils/detect-project.d.ts.map +1 -0
- package/dist/utils/detect-project.js +124 -0
- package/dist/utils/detect-project.js.map +1 -0
- package/dist/utils/logger.d.ts +10 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +30 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/validate-config.d.ts +23 -0
- package/dist/utils/validate-config.d.ts.map +1 -0
- package/dist/utils/validate-config.js +109 -0
- package/dist/utils/validate-config.js.map +1 -0
- package/package.json +59 -0
- package/templates/ARCHAI_README.md +326 -0
- package/templates/PROMPTS.md +480 -0
- package/templates/core-agents/cleanup-agent.md +132 -0
- package/templates/core-agents/code-reviewer.md +191 -0
- package/templates/core-agents/deep-analyst.md +170 -0
- package/templates/core-agents/finalization-agent.md +175 -0
- package/templates/core-agents/implementation-agent.md +173 -0
- package/templates/core-agents/iteration-controller.md +320 -0
- package/templates/core-agents/plan-validator.md +125 -0
- package/templates/core-agents/task-orchestrator.md +191 -0
- package/templates/core-agents/tdd-designer.md +205 -0
- package/templates/specialist-meta.md +275 -0
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
# archai Prompt Templates
|
|
2
|
+
|
|
3
|
+
Complete reference for using the agent system. Copy and customize these prompts.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Full Orchestration Prompt (Recommended)
|
|
8
|
+
|
|
9
|
+
Copy this to start the full three-phase workflow:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
Follow the orchestration guide in .claude/agents/iteration-controller.md to create an
|
|
13
|
+
implementation plan for: {YOUR TASK DESCRIPTION}
|
|
14
|
+
|
|
15
|
+
PHASE 1 INSTRUCTIONS (Planning - requires approval):
|
|
16
|
+
1. Read each agent's full instruction file from .claude/agents/ BEFORE spawning
|
|
17
|
+
2. Pass the COMPLETE instructions to each subagent in the Task prompt
|
|
18
|
+
3. Save ALL agent outputs to .claude/state/ directory
|
|
19
|
+
4. Run at least 2 planning iterations (THINK → VALIDATE → TEST DESIGN → VALIDATE TESTS → RETHINK)
|
|
20
|
+
5. After planning complete, write final plan to .claude/plans/{task-name}.md
|
|
21
|
+
6. STOP and present the plan summary - do NOT implement until I say "APPROVE"
|
|
22
|
+
|
|
23
|
+
PHASE 2 INSTRUCTIONS (Implementation - AUTONOMOUS after approval):
|
|
24
|
+
When I say "APPROVE", execute Phase 2 AUTONOMOUSLY:
|
|
25
|
+
- Implement ALL steps without stopping to ask
|
|
26
|
+
- Run tests after each step
|
|
27
|
+
- Fix failures automatically (up to 5 attempts per step)
|
|
28
|
+
- Only report back when ALL DONE or truly BLOCKED
|
|
29
|
+
- DO NOT ask "should I proceed?" - just execute the full loop
|
|
30
|
+
- When Phase 2 complete, present summary and wait for FINAL APPROVAL
|
|
31
|
+
|
|
32
|
+
PHASE 3 INSTRUCTIONS (Finalization - after implementation approved):
|
|
33
|
+
When I say "APPROVE" on implementation:
|
|
34
|
+
- Read .claude/agents/finalization-agent.md
|
|
35
|
+
- Spawn finalization-agent to verify, cleanup, commit, push, wait for CI/CD
|
|
36
|
+
- Report final status
|
|
37
|
+
|
|
38
|
+
Start with Phase 1, Iteration 1: Read .claude/agents/deep-analyst.md and
|
|
39
|
+
spawn a deep-analyst subagent to analyze the task.
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Phase 2 Only Prompt (After Plan is Approved)
|
|
45
|
+
|
|
46
|
+
Use this when resuming after approval:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
The plan in .claude/plans/{task-name}.md has been APPROVED.
|
|
50
|
+
|
|
51
|
+
Execute Phase 2 AUTONOMOUSLY:
|
|
52
|
+
1. Read .claude/agents/implementation-agent.md
|
|
53
|
+
2. Spawn implementation-agent with FULL instructions
|
|
54
|
+
3. The agent must execute ALL steps WITHOUT stopping to ask
|
|
55
|
+
4. Loop: implement → test → fix failures → next step → repeat
|
|
56
|
+
5. Only report back when COMPLETELY DONE or truly BLOCKED
|
|
57
|
+
6. When done, present summary and wait for FINAL APPROVAL
|
|
58
|
+
|
|
59
|
+
DO NOT ask for permission between steps. Just execute until done.
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Phase 3 Only Prompt (After Implementation is Approved)
|
|
65
|
+
|
|
66
|
+
Use this when implementation is done and you've approved it:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
The implementation is complete and APPROVED.
|
|
70
|
+
|
|
71
|
+
Execute Phase 3 (Finalization):
|
|
72
|
+
1. Read .claude/agents/finalization-agent.md
|
|
73
|
+
2. Spawn finalization-agent with FULL instructions
|
|
74
|
+
3. The agent will:
|
|
75
|
+
- Verify all acceptance criteria against original task
|
|
76
|
+
- Run local quality checks (typecheck, lint)
|
|
77
|
+
- Clean up temp files
|
|
78
|
+
- Commit with proper message
|
|
79
|
+
- Push to remote (triggers CI/CD)
|
|
80
|
+
- Wait for CI/CD to pass
|
|
81
|
+
4. Report final status when complete
|
|
82
|
+
|
|
83
|
+
Branch: {branch-name}
|
|
84
|
+
Task file: {.tasks/epics/TASK-XXX/epic.md or original task}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## Planning Phase Only
|
|
90
|
+
|
|
91
|
+
### Deep Analysis
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
Read .claude/agents/deep-analyst.md and spawn a deep-analyst to analyze:
|
|
95
|
+
{WHAT TO ANALYZE}
|
|
96
|
+
|
|
97
|
+
Focus on:
|
|
98
|
+
- What is the REAL problem we're solving?
|
|
99
|
+
- What are the dependencies?
|
|
100
|
+
- What could go wrong?
|
|
101
|
+
|
|
102
|
+
DO NOT create an implementation plan yet - just analysis.
|
|
103
|
+
Output to .claude/state/analysis-{topic}.md
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Examples:**
|
|
107
|
+
```
|
|
108
|
+
Read .claude/agents/deep-analyst.md and spawn a deep-analyst to analyze
|
|
109
|
+
our current authentication flow.
|
|
110
|
+
|
|
111
|
+
Trace:
|
|
112
|
+
1. How users log in
|
|
113
|
+
2. How tokens are validated
|
|
114
|
+
3. How sessions are managed
|
|
115
|
+
|
|
116
|
+
DO NOT create an implementation plan yet - just analysis.
|
|
117
|
+
Output to .claude/state/auth-flow-analysis.md
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Plan Validation
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
Read .claude/agents/plan-validator.md and spawn a plan-validator to
|
|
124
|
+
challenge the plan in .claude/state/{plan-file}.md
|
|
125
|
+
|
|
126
|
+
Your job is to FIND PROBLEMS, not approve the plan.
|
|
127
|
+
Look for:
|
|
128
|
+
- Vague steps ("handle edge cases")
|
|
129
|
+
- Missing error handling
|
|
130
|
+
- Untested assumptions
|
|
131
|
+
- Performance concerns
|
|
132
|
+
|
|
133
|
+
Output critique to .claude/state/plan-validation.md
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Test Design (TDD)
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
Read .claude/agents/tdd-designer.md and spawn a tdd-designer to create
|
|
140
|
+
test designs for: {FEATURE DESCRIPTION}
|
|
141
|
+
|
|
142
|
+
Focus on:
|
|
143
|
+
- Real user workflows, not implementation details
|
|
144
|
+
- Concrete values (not "test with valid input")
|
|
145
|
+
- Tests that would FAIL if code is broken
|
|
146
|
+
- Edge cases and boundary conditions
|
|
147
|
+
|
|
148
|
+
Output to .claude/state/test-design-{feature}.md
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Examples:**
|
|
152
|
+
```
|
|
153
|
+
Read .claude/agents/tdd-designer.md and spawn a tdd-designer to create
|
|
154
|
+
test designs for the user registration flow.
|
|
155
|
+
|
|
156
|
+
Focus on:
|
|
157
|
+
- Valid registration with all fields
|
|
158
|
+
- Missing required fields (each field separately)
|
|
159
|
+
- Invalid email formats
|
|
160
|
+
- Password strength requirements
|
|
161
|
+
- Duplicate email handling
|
|
162
|
+
|
|
163
|
+
Use concrete values like:
|
|
164
|
+
- email: "test@example.com"
|
|
165
|
+
- password: "SecureP@ss123"
|
|
166
|
+
|
|
167
|
+
Output to .claude/state/test-design-registration.md
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Implementation Phase Only
|
|
173
|
+
|
|
174
|
+
### Direct Implementation (Skip Planning)
|
|
175
|
+
|
|
176
|
+
Use only for simple, well-defined tasks:
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
Read .claude/agents/implementation-agent.md and spawn an implementation-agent to:
|
|
180
|
+
{SPECIFIC TASK}
|
|
181
|
+
|
|
182
|
+
Execute WITHOUT stopping to ask. Just implement and test.
|
|
183
|
+
Report back when DONE or truly BLOCKED.
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**Examples:**
|
|
187
|
+
```
|
|
188
|
+
Read .claude/agents/implementation-agent.md and spawn an implementation-agent to:
|
|
189
|
+
Fix the typo in src/components/Header.tsx - change "Welcom" to "Welcome"
|
|
190
|
+
|
|
191
|
+
Execute WITHOUT stopping to ask. Report back when done.
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
Read .claude/agents/implementation-agent.md and spawn an implementation-agent to:
|
|
196
|
+
Add a loading spinner to the submit button in LoginForm.tsx
|
|
197
|
+
|
|
198
|
+
Requirements:
|
|
199
|
+
- Show spinner when form is submitting
|
|
200
|
+
- Disable button during submission
|
|
201
|
+
- Hide spinner when complete
|
|
202
|
+
|
|
203
|
+
Execute WITHOUT stopping to ask. Run tests after changes.
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Code Review
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
Read .claude/agents/code-reviewer.md and spawn a code-reviewer to
|
|
210
|
+
review the changes in: {LOCATION}
|
|
211
|
+
|
|
212
|
+
Focus on:
|
|
213
|
+
- Does it match the approved plan?
|
|
214
|
+
- Are there bugs or edge cases missed?
|
|
215
|
+
- Is error handling complete?
|
|
216
|
+
- Are tests adequate?
|
|
217
|
+
|
|
218
|
+
Output review to .claude/state/code-review-{feature}.md
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Examples:**
|
|
222
|
+
```
|
|
223
|
+
Read .claude/agents/code-reviewer.md and spawn a code-reviewer to
|
|
224
|
+
review the changes in src/api/auth/
|
|
225
|
+
|
|
226
|
+
Focus on:
|
|
227
|
+
- Security vulnerabilities
|
|
228
|
+
- Error handling completeness
|
|
229
|
+
- Test coverage
|
|
230
|
+
- API contract compliance
|
|
231
|
+
|
|
232
|
+
Output review to .claude/state/code-review-auth-api.md
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Finalization Phase
|
|
238
|
+
|
|
239
|
+
### Cleanup Before Commit
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
Read .claude/agents/cleanup-agent.md and spawn a cleanup-agent for task: {TASK}
|
|
243
|
+
|
|
244
|
+
Clean up:
|
|
245
|
+
- .claude/state/ (except archived)
|
|
246
|
+
- .agents/scratch/
|
|
247
|
+
- .agents/thoughts/
|
|
248
|
+
- Any temporary files
|
|
249
|
+
|
|
250
|
+
Preserve:
|
|
251
|
+
- .knowledge/ (all of it)
|
|
252
|
+
- .claude/plans/ (approved plans)
|
|
253
|
+
- Actual source code changes
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Full Finalization
|
|
257
|
+
|
|
258
|
+
```
|
|
259
|
+
Read .claude/agents/finalization-agent.md and spawn a finalization-agent.
|
|
260
|
+
|
|
261
|
+
Task: {TASK DESCRIPTION}
|
|
262
|
+
Branch: {BRANCH NAME}
|
|
263
|
+
|
|
264
|
+
The agent will:
|
|
265
|
+
1. Verify all acceptance criteria
|
|
266
|
+
2. Run quality checks (typecheck, lint)
|
|
267
|
+
3. Clean temporary files
|
|
268
|
+
4. Commit with proper message
|
|
269
|
+
5. Push to remote
|
|
270
|
+
6. Wait for CI/CD
|
|
271
|
+
7. Report final status
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
---
|
|
275
|
+
|
|
276
|
+
## Task Management
|
|
277
|
+
|
|
278
|
+
### Pick Up Next Task
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
Read .claude/agents/task-orchestrator.md and spawn a task-orchestrator to:
|
|
282
|
+
Pick up the next task from .tasks/inbox/
|
|
283
|
+
|
|
284
|
+
The agent will:
|
|
285
|
+
1. Scan inbox for available tasks
|
|
286
|
+
2. Select highest priority task
|
|
287
|
+
3. Move to .tasks/epics/
|
|
288
|
+
4. Create branch
|
|
289
|
+
5. Begin Phase 1 planning
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### Create New Epic
|
|
293
|
+
|
|
294
|
+
```
|
|
295
|
+
Read .claude/agents/task-orchestrator.md and spawn a task-orchestrator to:
|
|
296
|
+
Create an epic for: {FEATURE DESCRIPTION}
|
|
297
|
+
|
|
298
|
+
Include:
|
|
299
|
+
- Clear acceptance criteria
|
|
300
|
+
- Priority level
|
|
301
|
+
- Estimated complexity
|
|
302
|
+
- Dependencies (if any)
|
|
303
|
+
|
|
304
|
+
Save to .tasks/inbox/TASK-{XXX}/epic.md
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Specialist Agents
|
|
310
|
+
|
|
311
|
+
After running `archai generate`, use your project-specific specialists:
|
|
312
|
+
|
|
313
|
+
### Template: Invoke Any Specialist
|
|
314
|
+
|
|
315
|
+
```
|
|
316
|
+
Read .claude/agents/{specialist-name}.md and spawn a {specialist-name} to:
|
|
317
|
+
{SPECIFIC TASK}
|
|
318
|
+
|
|
319
|
+
Context:
|
|
320
|
+
- {relevant context}
|
|
321
|
+
|
|
322
|
+
Output to .claude/state/{output-file}.md
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
### Common Specialist Prompts
|
|
326
|
+
|
|
327
|
+
```
|
|
328
|
+
# Frontend work
|
|
329
|
+
Read .claude/agents/frontend-specialist.md and spawn a frontend-specialist to:
|
|
330
|
+
Create a reusable modal component with:
|
|
331
|
+
- Backdrop click to close
|
|
332
|
+
- ESC key to close
|
|
333
|
+
- Focus trap
|
|
334
|
+
- Smooth animations
|
|
335
|
+
|
|
336
|
+
Output to .claude/state/modal-component-design.md
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
```
|
|
340
|
+
# Backend work
|
|
341
|
+
Read .claude/agents/backend-specialist.md and spawn a backend-specialist to:
|
|
342
|
+
Add rate limiting to the API endpoints in src/api/
|
|
343
|
+
|
|
344
|
+
Requirements:
|
|
345
|
+
- 100 requests per minute per IP
|
|
346
|
+
- Return 429 with Retry-After header
|
|
347
|
+
- Whitelist internal services
|
|
348
|
+
|
|
349
|
+
Output to .claude/state/rate-limiting-design.md
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
```
|
|
353
|
+
# Database work
|
|
354
|
+
Read .claude/agents/database-specialist.md and spawn a database-specialist to:
|
|
355
|
+
Optimize the slow query in getUserOrders()
|
|
356
|
+
|
|
357
|
+
Current query takes 2+ seconds with 10k orders.
|
|
358
|
+
Target: under 100ms
|
|
359
|
+
|
|
360
|
+
Output to .claude/state/query-optimization.md
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Quick Reference Card
|
|
366
|
+
|
|
367
|
+
| I want to... | Use this prompt... |
|
|
368
|
+
|--------------|-------------------|
|
|
369
|
+
| Implement a feature | `Use iteration-controller for: X. Run Phase 1, wait for APPROVE.` |
|
|
370
|
+
| Analyze code first | `Read deep-analyst.md, spawn deep-analyst to analyze: X` |
|
|
371
|
+
| Design tests only | `Read tdd-designer.md, spawn tdd-designer to design tests for: X` |
|
|
372
|
+
| Get specialist help | `Read {name}-specialist.md, spawn {name}-specialist for: X` |
|
|
373
|
+
| Resume implementation | `The plan in .claude/plans/X.md has been APPROVED. Execute Phase 2 AUTONOMOUSLY.` |
|
|
374
|
+
| Finalize (commit/push) | `Implementation APPROVED. Execute Phase 3 with finalization-agent.` |
|
|
375
|
+
| Clean up before commit | `Read cleanup-agent.md, spawn cleanup-agent for task: X` |
|
|
376
|
+
| Approve a plan | `APPROVE` |
|
|
377
|
+
| Approve implementation | `APPROVE` (triggers Phase 3 finalization) |
|
|
378
|
+
| Request changes | `REVISE: [specific changes]` |
|
|
379
|
+
| Stop workflow | `REJECT: [reason]` |
|
|
380
|
+
|
|
381
|
+
---
|
|
382
|
+
|
|
383
|
+
## Step-by-Step Examples
|
|
384
|
+
|
|
385
|
+
### Example 1: Implement a New Feature
|
|
386
|
+
|
|
387
|
+
**Task:** "Add user authentication with JWT"
|
|
388
|
+
|
|
389
|
+
**Step 1: Start the orchestrated workflow**
|
|
390
|
+
```
|
|
391
|
+
Use iteration-controller to implement: Add user authentication with JWT
|
|
392
|
+
that supports login, logout, and token refresh.
|
|
393
|
+
|
|
394
|
+
Run Phase 1 with at least 2 iterations.
|
|
395
|
+
Write plan to .claude/plans/jwt-auth.md.
|
|
396
|
+
STOP and wait for my APPROVE before implementing.
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
**Step 2: Wait for Phase 1 to complete**
|
|
400
|
+
|
|
401
|
+
The agent will:
|
|
402
|
+
1. Spawn `deep-analyst` → Creates analysis in `.claude/state/phase1_analysis.md`
|
|
403
|
+
2. Spawn `plan-validator` → Challenges plan in `.claude/state/phase1_validation.md`
|
|
404
|
+
3. Spawn `tdd-designer` → Designs tests in `.claude/state/phase1_test_design.md`
|
|
405
|
+
4. Iterate 2-4 times until plan is solid
|
|
406
|
+
5. Write final plan to `.claude/plans/jwt-auth.md`
|
|
407
|
+
6. **STOP and present summary**
|
|
408
|
+
|
|
409
|
+
**Step 3: Review and approve**
|
|
410
|
+
```
|
|
411
|
+
# Review the plan
|
|
412
|
+
Read .claude/plans/jwt-auth.md
|
|
413
|
+
|
|
414
|
+
# If satisfied:
|
|
415
|
+
APPROVE
|
|
416
|
+
|
|
417
|
+
# If changes needed:
|
|
418
|
+
REVISE: Add support for refresh token rotation, also consider session invalidation on password change
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
**Step 4: Autonomous implementation**
|
|
422
|
+
|
|
423
|
+
After APPROVE, Phase 2 runs without stopping:
|
|
424
|
+
- Implements each step
|
|
425
|
+
- Runs tests after each step
|
|
426
|
+
- Fixes failures automatically
|
|
427
|
+
- Reports only when DONE or BLOCKED
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
### Example 2: Quick Bug Fix
|
|
432
|
+
|
|
433
|
+
**Task:** "Fix the broken date formatting in user profiles"
|
|
434
|
+
|
|
435
|
+
```
|
|
436
|
+
Read .claude/agents/implementation-agent.md and spawn an implementation-agent to:
|
|
437
|
+
Fix the date formatting bug in src/components/UserProfile.tsx
|
|
438
|
+
|
|
439
|
+
The issue: Dates show as "Invalid Date" for users with null birthdates.
|
|
440
|
+
|
|
441
|
+
Fix: Add null check before formatting.
|
|
442
|
+
Test: Verify with null, valid date, and edge cases.
|
|
443
|
+
|
|
444
|
+
Execute WITHOUT stopping. Report when done.
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
---
|
|
448
|
+
|
|
449
|
+
### Example 3: Analysis Without Implementation
|
|
450
|
+
|
|
451
|
+
**Task:** "Understand how the caching layer works before optimizing"
|
|
452
|
+
|
|
453
|
+
```
|
|
454
|
+
Read .claude/agents/deep-analyst.md and spawn a deep-analyst to analyze
|
|
455
|
+
the caching implementation in src/services/cache/.
|
|
456
|
+
|
|
457
|
+
Trace:
|
|
458
|
+
1. What gets cached and for how long
|
|
459
|
+
2. Cache invalidation strategy
|
|
460
|
+
3. Memory usage patterns
|
|
461
|
+
4. Performance bottlenecks
|
|
462
|
+
|
|
463
|
+
DO NOT create an implementation plan - just analysis.
|
|
464
|
+
Output to .claude/state/cache-analysis.md
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
---
|
|
468
|
+
|
|
469
|
+
## Tips for Best Results
|
|
470
|
+
|
|
471
|
+
1. **Be specific** - More detail = better results
|
|
472
|
+
2. **Include context** - Mention relevant files, constraints, or requirements
|
|
473
|
+
3. **Start with iteration-controller** - For any non-trivial task
|
|
474
|
+
4. **Use specialists** - They know your project's patterns
|
|
475
|
+
5. **Let Phase 2 run** - Don't interrupt unless truly necessary
|
|
476
|
+
6. **Review plans carefully** - Reject vague steps
|
|
477
|
+
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
*Generated by archai. See README.md for full documentation.*
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: cleanup-agent
|
|
3
|
+
description: "Pre-commit cleanup. Removes state files, scratch work, and temporary artifacts while preserving knowledge base. Use before committing."
|
|
4
|
+
tools: Read, Glob, Bash
|
|
5
|
+
model: haiku
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
You are a cleanup agent. Your job is to clean up temporary files before committing.
|
|
9
|
+
|
|
10
|
+
## Core Philosophy
|
|
11
|
+
|
|
12
|
+
**CLEAN BUT PRESERVE.** Remove temporary work files, but preserve anything valuable in the knowledge base.
|
|
13
|
+
|
|
14
|
+
## What to Clean
|
|
15
|
+
|
|
16
|
+
### Always Clean (temporary files)
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
.claude/state/* # Working state (except archived/)
|
|
20
|
+
.agents/scratch/* # Scratch work
|
|
21
|
+
.agents/thoughts/* # Reasoning logs
|
|
22
|
+
.agents/plans/* # Temporary plans
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Archive First, Then Clean
|
|
26
|
+
|
|
27
|
+
Before deleting `.claude/state/` files:
|
|
28
|
+
1. Check if task is complete
|
|
29
|
+
2. If complete, archive to `.claude/state/archived/{task-id}/`
|
|
30
|
+
3. Then delete the working files
|
|
31
|
+
|
|
32
|
+
### Never Clean
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
.knowledge/** # Permanent knowledge (decisions, learnings)
|
|
36
|
+
.claude/agents/** # Agent definitions
|
|
37
|
+
.claude/plans/archived/** # Completed plans
|
|
38
|
+
.tasks/** # Task management
|
|
39
|
+
.supervisor/** # Coordination files
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Cleanup Protocol
|
|
43
|
+
|
|
44
|
+
### Step 1: Check Task Status
|
|
45
|
+
|
|
46
|
+
Read `.claude/state/iteration_log.md` to determine:
|
|
47
|
+
- Is the task complete?
|
|
48
|
+
- Were there valuable learnings?
|
|
49
|
+
|
|
50
|
+
### Step 2: Archive if Needed
|
|
51
|
+
|
|
52
|
+
If task is complete:
|
|
53
|
+
```bash
|
|
54
|
+
# Create archive folder
|
|
55
|
+
mkdir -p .claude/state/archived/{task-id}
|
|
56
|
+
|
|
57
|
+
# Move important files
|
|
58
|
+
mv .claude/state/task_anchor.md .claude/state/archived/{task-id}/
|
|
59
|
+
mv .claude/state/phase1_*.md .claude/state/archived/{task-id}/
|
|
60
|
+
mv .claude/state/iteration_log.md .claude/state/archived/{task-id}/
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Step 3: Extract Learnings
|
|
64
|
+
|
|
65
|
+
If there were valuable learnings during the task:
|
|
66
|
+
1. Create a learning document in `.knowledge/learnings/`
|
|
67
|
+
2. Document what was learned
|
|
68
|
+
3. Reference the task for context
|
|
69
|
+
|
|
70
|
+
### Step 4: Clean Temporary Files
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Clean scratch space
|
|
74
|
+
rm -rf .agents/scratch/*
|
|
75
|
+
rm -rf .agents/thoughts/*
|
|
76
|
+
rm -rf .agents/plans/*
|
|
77
|
+
|
|
78
|
+
# Clean working state (after archiving)
|
|
79
|
+
rm -f .claude/state/*.md
|
|
80
|
+
|
|
81
|
+
# Ensure .gitkeep files remain
|
|
82
|
+
touch .agents/scratch/.gitkeep
|
|
83
|
+
touch .agents/thoughts/.gitkeep
|
|
84
|
+
touch .agents/plans/.gitkeep
|
|
85
|
+
touch .claude/state/.gitkeep
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Step 5: Verify Cleanliness
|
|
89
|
+
|
|
90
|
+
Check that:
|
|
91
|
+
- [ ] No temporary files in `.agents/`
|
|
92
|
+
- [ ] No working state in `.claude/state/` (only archived/)
|
|
93
|
+
- [ ] `.gitkeep` files are in place
|
|
94
|
+
- [ ] Knowledge base is intact
|
|
95
|
+
|
|
96
|
+
## Output Format
|
|
97
|
+
|
|
98
|
+
```markdown
|
|
99
|
+
# CLEANUP REPORT
|
|
100
|
+
|
|
101
|
+
## Archived
|
|
102
|
+
- Task: {task-id}
|
|
103
|
+
- Files archived: [list]
|
|
104
|
+
- Location: .claude/state/archived/{task-id}/
|
|
105
|
+
|
|
106
|
+
## Cleaned
|
|
107
|
+
- Scratch files removed: X
|
|
108
|
+
- State files removed: X
|
|
109
|
+
- Thoughts files removed: X
|
|
110
|
+
|
|
111
|
+
## Preserved
|
|
112
|
+
- Knowledge base: intact
|
|
113
|
+
- Agent definitions: intact
|
|
114
|
+
- Task history: intact
|
|
115
|
+
|
|
116
|
+
## Learnings Captured
|
|
117
|
+
- [learning document path] (if any)
|
|
118
|
+
|
|
119
|
+
## Status: CLEAN
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## When NOT to Clean
|
|
123
|
+
|
|
124
|
+
- Task is still in progress
|
|
125
|
+
- Files might be needed for debugging
|
|
126
|
+
- User hasn't approved final result yet
|
|
127
|
+
|
|
128
|
+
In these cases, wait for explicit instruction to clean up.
|
|
129
|
+
|
|
130
|
+
## Remember
|
|
131
|
+
|
|
132
|
+
**Archive before delete.** Valuable work should never be lost. When in doubt, archive it.
|