agent-cli 0.61.2__py3-none-any.whl → 0.70.2__py3-none-any.whl
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.
- agent_cli/_extras.json +13 -0
- agent_cli/_requirements/.gitkeep +0 -0
- agent_cli/_requirements/audio.txt +79 -0
- agent_cli/_requirements/faster-whisper.txt +215 -0
- agent_cli/_requirements/kokoro.txt +425 -0
- agent_cli/_requirements/llm.txt +183 -0
- agent_cli/_requirements/memory.txt +355 -0
- agent_cli/_requirements/mlx-whisper.txt +222 -0
- agent_cli/_requirements/piper.txt +176 -0
- agent_cli/_requirements/rag.txt +402 -0
- agent_cli/_requirements/server.txt +154 -0
- agent_cli/_requirements/speed.txt +77 -0
- agent_cli/_requirements/vad.txt +155 -0
- agent_cli/agents/assistant.py +3 -1
- agent_cli/agents/autocorrect.py +5 -2
- agent_cli/agents/chat.py +3 -1
- agent_cli/agents/memory/__init__.py +2 -1
- agent_cli/agents/memory/add.py +2 -0
- agent_cli/agents/memory/proxy.py +7 -12
- agent_cli/agents/rag_proxy.py +5 -10
- agent_cli/agents/speak.py +3 -1
- agent_cli/agents/transcribe.py +7 -2
- agent_cli/agents/transcribe_daemon.py +3 -1
- agent_cli/agents/voice_edit.py +3 -1
- agent_cli/cli.py +19 -3
- agent_cli/config_cmd.py +1 -0
- agent_cli/core/chroma.py +4 -4
- agent_cli/core/deps.py +177 -25
- agent_cli/core/openai_proxy.py +9 -4
- agent_cli/core/process.py +2 -2
- agent_cli/core/reranker.py +5 -4
- agent_cli/core/utils.py +5 -3
- agent_cli/core/vad.py +2 -1
- agent_cli/core/watch.py +8 -6
- agent_cli/dev/cli.py +31 -34
- agent_cli/dev/coding_agents/base.py +1 -2
- agent_cli/dev/skill/SKILL.md +141 -0
- agent_cli/dev/skill/examples.md +571 -0
- agent_cli/dev/worktree.py +53 -5
- agent_cli/docs_gen.py +12 -42
- agent_cli/install/__init__.py +1 -1
- agent_cli/install/extras.py +174 -0
- agent_cli/memory/__init__.py +1 -18
- agent_cli/memory/_files.py +4 -1
- agent_cli/memory/_indexer.py +3 -2
- agent_cli/memory/_ingest.py +6 -5
- agent_cli/memory/_retrieval.py +18 -8
- agent_cli/memory/_streaming.py +2 -2
- agent_cli/memory/api.py +1 -1
- agent_cli/memory/client.py +1 -1
- agent_cli/memory/engine.py +1 -1
- agent_cli/rag/__init__.py +0 -19
- agent_cli/rag/_indexer.py +3 -2
- agent_cli/rag/api.py +1 -0
- agent_cli/scripts/.runtime/.gitkeep +0 -0
- agent_cli/scripts/check_plugin_skill_sync.py +50 -0
- agent_cli/scripts/sync_extras.py +138 -0
- agent_cli/server/cli.py +26 -24
- agent_cli/server/common.py +3 -4
- agent_cli/server/tts/api.py +1 -1
- agent_cli/server/whisper/backends/faster_whisper.py +30 -23
- agent_cli/server/whisper/wyoming_handler.py +22 -27
- agent_cli/services/_wyoming_utils.py +4 -2
- agent_cli/services/asr.py +13 -3
- agent_cli/services/llm.py +2 -1
- agent_cli/services/tts.py +5 -2
- agent_cli/services/wake_word.py +6 -3
- {agent_cli-0.61.2.dist-info → agent_cli-0.70.2.dist-info}/METADATA +168 -73
- {agent_cli-0.61.2.dist-info → agent_cli-0.70.2.dist-info}/RECORD +72 -54
- {agent_cli-0.61.2.dist-info → agent_cli-0.70.2.dist-info}/WHEEL +1 -2
- agent_cli-0.61.2.dist-info/top_level.txt +0 -1
- {agent_cli-0.61.2.dist-info → agent_cli-0.70.2.dist-info}/entry_points.txt +0 -0
- {agent_cli-0.61.2.dist-info → agent_cli-0.70.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agent-cli-dev
|
|
3
|
+
description: Spawns AI coding agents in isolated git worktrees. Use when the user asks to spawn or launch an agent, delegate a task to a separate agent, work in a separate worktree, or parallelize development across features.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Parallel Development with agent-cli dev
|
|
7
|
+
|
|
8
|
+
This skill teaches you how to spawn parallel AI coding agents in isolated git worktrees using the `agent-cli dev` command.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
If `agent-cli` is not available, install it first:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
# Install globally
|
|
16
|
+
uv tool install agent-cli -p 3.13
|
|
17
|
+
|
|
18
|
+
# Or run directly without installing
|
|
19
|
+
uvx --python 3.13 agent-cli dev new <branch-name> --agent --prompt "..."
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## When to spawn parallel agents
|
|
23
|
+
|
|
24
|
+
Spawn separate agents when:
|
|
25
|
+
- Multiple independent features/tasks can be worked on in parallel
|
|
26
|
+
- Tasks benefit from isolation (separate branches, no conflicts)
|
|
27
|
+
- Large refactoring that can be split by module/component
|
|
28
|
+
- Test-driven development (one agent for tests, one for implementation)
|
|
29
|
+
|
|
30
|
+
Do NOT spawn when:
|
|
31
|
+
- Tasks are small and sequential
|
|
32
|
+
- Tasks have tight dependencies requiring constant coordination
|
|
33
|
+
- The overhead of context switching exceeds the benefit
|
|
34
|
+
|
|
35
|
+
## Core command
|
|
36
|
+
|
|
37
|
+
For new features (starts from origin/main):
|
|
38
|
+
```bash
|
|
39
|
+
agent-cli dev new <branch-name> --agent --prompt "Implement the new feature..."
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
For work on current branch (review, test, fix) - use `--from HEAD`:
|
|
43
|
+
```bash
|
|
44
|
+
agent-cli dev new <branch-name> --from HEAD --agent --prompt "Review/test/fix..."
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
For longer prompts (recommended for multi-line or complex instructions):
|
|
48
|
+
```bash
|
|
49
|
+
agent-cli dev new <branch-name> --from HEAD --agent --prompt-file path/to/prompt.md
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This creates:
|
|
53
|
+
1. A new git worktree with its own branch
|
|
54
|
+
2. Runs project setup (installs dependencies)
|
|
55
|
+
3. Saves your prompt to `.claude/TASK.md` in the worktree (for reference)
|
|
56
|
+
4. Opens a new terminal tab with an AI coding agent
|
|
57
|
+
5. Passes your prompt to the agent
|
|
58
|
+
|
|
59
|
+
**Important**: Use `--prompt-file` for prompts longer than a single line. The `--prompt` option passes text through the shell, which can cause issues with special characters (exclamation marks, dollar signs, backticks, quotes) in ZSH and other shells. Using `--prompt-file` avoids all shell quoting issues.
|
|
60
|
+
|
|
61
|
+
## Writing effective prompts for spawned agents
|
|
62
|
+
|
|
63
|
+
Spawned agents work in isolation, so prompts must be **self-contained**. Include:
|
|
64
|
+
|
|
65
|
+
1. **Clear task description**: What to implement/fix/refactor
|
|
66
|
+
2. **Relevant context**: File locations, patterns to follow, constraints
|
|
67
|
+
3. **Report request**: Ask the agent to write conclusions to `.claude/REPORT.md`
|
|
68
|
+
|
|
69
|
+
### Using --prompt-file (recommended)
|
|
70
|
+
|
|
71
|
+
For any prompt longer than a single sentence:
|
|
72
|
+
|
|
73
|
+
1. Write the prompt to a temporary file (e.g., `.claude/spawn-prompt.md`)
|
|
74
|
+
2. Use `--prompt-file` to pass it to the agent
|
|
75
|
+
3. The file can be deleted after spawning
|
|
76
|
+
|
|
77
|
+
Example workflow:
|
|
78
|
+
```bash
|
|
79
|
+
# 1. Write prompt to file (Claude does this with the Write tool)
|
|
80
|
+
# 2. Spawn agent with the file
|
|
81
|
+
agent-cli dev new my-feature --agent --prompt-file .claude/spawn-prompt.md
|
|
82
|
+
# 3. Optionally clean up
|
|
83
|
+
rm .claude/spawn-prompt.md
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Prompt template
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
<Task description>
|
|
90
|
+
|
|
91
|
+
Context:
|
|
92
|
+
- <Key file locations>
|
|
93
|
+
- <Patterns to follow>
|
|
94
|
+
- <Constraints or requirements>
|
|
95
|
+
|
|
96
|
+
When complete, write a summary to .claude/REPORT.md including:
|
|
97
|
+
- What you implemented/changed
|
|
98
|
+
- Key decisions you made
|
|
99
|
+
- Any questions or concerns for review
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
## Checking spawned agent results
|
|
103
|
+
|
|
104
|
+
After spawning, you can check progress:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# List all worktrees and their status
|
|
108
|
+
agent-cli dev status
|
|
109
|
+
|
|
110
|
+
# Read an agent's report
|
|
111
|
+
agent-cli dev run <branch-name> cat .claude/REPORT.md
|
|
112
|
+
|
|
113
|
+
# Open the worktree in your editor
|
|
114
|
+
agent-cli dev editor <branch-name>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Example: Multi-feature implementation
|
|
118
|
+
|
|
119
|
+
If asked to implement auth, payments, and notifications:
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# Spawn three parallel agents
|
|
123
|
+
agent-cli dev new auth-feature --agent --prompt "Implement JWT authentication..."
|
|
124
|
+
agent-cli dev new payment-integration --agent --prompt "Add Stripe payment processing..."
|
|
125
|
+
agent-cli dev new email-notifications --agent --prompt "Implement email notification system..."
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Each agent works independently in its own branch. Results can be reviewed and merged separately.
|
|
129
|
+
|
|
130
|
+
## Key options
|
|
131
|
+
|
|
132
|
+
| Option | Description |
|
|
133
|
+
|--------|-------------|
|
|
134
|
+
| `--agent` / `-a` | Start AI coding agent after creation |
|
|
135
|
+
| `--prompt` / `-p` | Initial prompt for the agent (short prompts only) |
|
|
136
|
+
| `--prompt-file` / `-P` | Read prompt from file (recommended for longer prompts) |
|
|
137
|
+
| `--from` / `-f` | Base ref (default: origin/main). **Use `--from HEAD` when reviewing/testing current branch!** |
|
|
138
|
+
| `--with-agent` | Specific agent: claude, aider, codex, gemini |
|
|
139
|
+
| `--agent-args` | Extra arguments for the agent |
|
|
140
|
+
|
|
141
|
+
@examples.md
|
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
# Examples: Parallel Agent Workflows
|
|
2
|
+
|
|
3
|
+
Real-world scenarios for spawning parallel AI coding agents, optimized for Claude 4.5 models.
|
|
4
|
+
|
|
5
|
+
> **Note on prompts**: The examples below show prompt content inline for readability. In practice, **always use `--prompt-file`** for these multi-line prompts to avoid shell quoting issues:
|
|
6
|
+
>
|
|
7
|
+
> ```bash
|
|
8
|
+
> # Write prompt to file, then spawn
|
|
9
|
+
> agent-cli dev new my-feature --agent --prompt-file .claude/spawn-prompt.md
|
|
10
|
+
> ```
|
|
11
|
+
|
|
12
|
+
## Prompt structure guidelines
|
|
13
|
+
|
|
14
|
+
Each prompt for a spawned agent should follow this structure:
|
|
15
|
+
|
|
16
|
+
1. **Explicit task description** - Be specific about what to implement
|
|
17
|
+
2. **Workflow directive** - Read files in parallel, commit incrementally, verify before completing
|
|
18
|
+
3. **Code exploration** - Read and understand existing code before writing
|
|
19
|
+
4. **Context with motivation** - Explain why patterns matter
|
|
20
|
+
5. **Focused scope** - Keep solutions minimal, implement only what's requested
|
|
21
|
+
6. **Structured report** - Write conclusions to `.claude/REPORT.md`
|
|
22
|
+
|
|
23
|
+
## Scenario 1: Code review of current branch
|
|
24
|
+
|
|
25
|
+
**User request**: "Review the code on this branch" or "Spawn an agent to review my changes"
|
|
26
|
+
|
|
27
|
+
**CRITICAL**: Use `--from HEAD` (or the branch name) so the review agent has access to the changes!
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
# Review the current branch - MUST use --from HEAD
|
|
31
|
+
agent-cli dev new review-changes --from HEAD --agent --prompt "Review the code changes on this branch.
|
|
32
|
+
|
|
33
|
+
<workflow>
|
|
34
|
+
- Run git diff origin/main...HEAD to identify all changes
|
|
35
|
+
- Read changed files in parallel to understand context
|
|
36
|
+
- Check CLAUDE.md for project-specific guidelines
|
|
37
|
+
- Test changes with real services if applicable
|
|
38
|
+
</workflow>
|
|
39
|
+
|
|
40
|
+
<code_exploration>
|
|
41
|
+
- Use git diff origin/main...HEAD to see the full diff
|
|
42
|
+
- Read each changed file completely before judging
|
|
43
|
+
- Look at surrounding code to understand patterns
|
|
44
|
+
- Check existing tests to understand expected behavior
|
|
45
|
+
</code_exploration>
|
|
46
|
+
|
|
47
|
+
<context>
|
|
48
|
+
Code review catches issues before merge. Focus on real problems - not style nitpicks. Apply these criteria:
|
|
49
|
+
- Code cleanliness: Is the implementation clean and well-structured?
|
|
50
|
+
- DRY principle: Does it avoid duplication?
|
|
51
|
+
- Code reuse: Are there parts that should be reused from other places?
|
|
52
|
+
- Organization: Is everything in the right place?
|
|
53
|
+
- Consistency: Is it in the same style as other parts of the codebase?
|
|
54
|
+
- Simplicity: Is it over-engineered? Remember KISS and YAGNI. No dead code paths, no defensive programming.
|
|
55
|
+
- No pointless wrappers: Functions that just call another function should be inlined.
|
|
56
|
+
- User experience: Does it provide a good user experience?
|
|
57
|
+
- Tests: Are tests meaningful or just trivial coverage?
|
|
58
|
+
- Live tests: Test changes with real services if applicable.
|
|
59
|
+
- Rules: Does the code follow CLAUDE.md guidelines?
|
|
60
|
+
</context>
|
|
61
|
+
|
|
62
|
+
<scope>
|
|
63
|
+
Review only - identify issues but do not fix them. Write findings to report.
|
|
64
|
+
</scope>
|
|
65
|
+
|
|
66
|
+
<report>
|
|
67
|
+
Write your review to .claude/REPORT.md:
|
|
68
|
+
|
|
69
|
+
## Summary
|
|
70
|
+
[Overall assessment of the changes]
|
|
71
|
+
|
|
72
|
+
## Issues Found
|
|
73
|
+
| Severity | File:Line | Issue | Suggestion |
|
|
74
|
+
|----------|-----------|-------|------------|
|
|
75
|
+
| Critical/High/Medium/Low | path:123 | description | fix |
|
|
76
|
+
|
|
77
|
+
## Positive Observations
|
|
78
|
+
[What's well done]
|
|
79
|
+
</report>"
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Common mistake**: Forgetting `--from HEAD` means the agent starts from `origin/main` and won't see any of the branch changes!
|
|
83
|
+
|
|
84
|
+
## Scenario 2: Multi-feature implementation
|
|
85
|
+
|
|
86
|
+
**User request**: "Implement user auth, payment processing, and email notifications"
|
|
87
|
+
|
|
88
|
+
**Strategy**: Three independent features → spawn three agents.
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
agent-cli dev new auth-feature --agent --prompt "Implement JWT-based user authentication.
|
|
92
|
+
|
|
93
|
+
<workflow>
|
|
94
|
+
- Read multiple files in parallel when exploring the codebase
|
|
95
|
+
- Make incremental git commits as you complete each component
|
|
96
|
+
- Run tests and linting before writing your final report
|
|
97
|
+
</workflow>
|
|
98
|
+
|
|
99
|
+
<code_exploration>
|
|
100
|
+
Start by reading these files (in parallel if independent):
|
|
101
|
+
- src/api/routes/ to understand existing endpoint patterns
|
|
102
|
+
- src/models/ to see how models are structured
|
|
103
|
+
- Any existing auth-related code to avoid duplication
|
|
104
|
+
|
|
105
|
+
Think carefully about the existing patterns before designing your implementation.
|
|
106
|
+
</code_exploration>
|
|
107
|
+
|
|
108
|
+
<context>
|
|
109
|
+
Backend is FastAPI in src/api/. This authentication system protects all user-facing endpoints, so reliability and security are critical. Follow the exact patterns in existing endpoints to maintain codebase consistency.
|
|
110
|
+
</context>
|
|
111
|
+
|
|
112
|
+
<requirements>
|
|
113
|
+
Implement these endpoints following existing route patterns:
|
|
114
|
+
- POST /auth/register - create new user with password hashing
|
|
115
|
+
- POST /auth/login - validate credentials and return JWT token
|
|
116
|
+
- GET /auth/me - return current user (requires valid JWT)
|
|
117
|
+
- Create an auth dependency for protecting other routes
|
|
118
|
+
- Store JWT_SECRET in environment variable
|
|
119
|
+
</requirements>
|
|
120
|
+
|
|
121
|
+
<scope>
|
|
122
|
+
Keep the implementation simple and focused. Implement only what is requested. A working, minimal implementation is better than an over-designed one. Reuse existing abstractions where possible.
|
|
123
|
+
</scope>
|
|
124
|
+
|
|
125
|
+
<report>
|
|
126
|
+
After verifying tests pass and linting is clean, write to .claude/REPORT.md:
|
|
127
|
+
|
|
128
|
+
## Summary
|
|
129
|
+
[2-3 sentences on what was implemented]
|
|
130
|
+
|
|
131
|
+
## Files Changed
|
|
132
|
+
- path/to/file.py - description of change
|
|
133
|
+
|
|
134
|
+
## Key Decisions
|
|
135
|
+
- Decision 1: rationale
|
|
136
|
+
|
|
137
|
+
## Testing
|
|
138
|
+
How to verify the implementation works
|
|
139
|
+
|
|
140
|
+
## Questions/Concerns
|
|
141
|
+
Any items needing review
|
|
142
|
+
</report>"
|
|
143
|
+
|
|
144
|
+
agent-cli dev new payment-integration --agent --prompt "Integrate Stripe payment processing.
|
|
145
|
+
|
|
146
|
+
<workflow>
|
|
147
|
+
- Read multiple files in parallel when exploring the codebase
|
|
148
|
+
- Make incremental git commits as you complete each component
|
|
149
|
+
- Run tests and linting before writing your final report
|
|
150
|
+
</workflow>
|
|
151
|
+
|
|
152
|
+
<code_exploration>
|
|
153
|
+
Read these files to understand the codebase (parallelize independent reads):
|
|
154
|
+
- src/api/routes/ for endpoint patterns and error handling
|
|
155
|
+
- src/models/ for existing model patterns
|
|
156
|
+
- Any existing payment or billing code
|
|
157
|
+
|
|
158
|
+
Only make claims about code you have actually read.
|
|
159
|
+
</code_exploration>
|
|
160
|
+
|
|
161
|
+
<context>
|
|
162
|
+
This payment integration handles real money transactions and must be implemented correctly. Stripe webhooks are essential for tracking payment status - the system cannot rely solely on client-side confirmation. Use the stripe Python package and store STRIPE_SECRET_KEY in environment.
|
|
163
|
+
</context>
|
|
164
|
+
|
|
165
|
+
<requirements>
|
|
166
|
+
- POST /payments/create-intent - create Stripe PaymentIntent, return client_secret
|
|
167
|
+
- POST /payments/webhook - handle Stripe webhook events (payment_intent.succeeded, payment_intent.failed)
|
|
168
|
+
- Add Payment model to track transaction status
|
|
169
|
+
- Include proper webhook signature verification for security
|
|
170
|
+
</requirements>
|
|
171
|
+
|
|
172
|
+
<scope>
|
|
173
|
+
Implement only what is specified. Focus on a working, secure implementation. Skip subscription handling, multiple payment methods, or other features unless explicitly requested.
|
|
174
|
+
</scope>
|
|
175
|
+
|
|
176
|
+
<report>
|
|
177
|
+
After verifying tests pass, write to .claude/REPORT.md:
|
|
178
|
+
|
|
179
|
+
## Summary
|
|
180
|
+
[What was implemented]
|
|
181
|
+
|
|
182
|
+
## Files Changed
|
|
183
|
+
[List with descriptions]
|
|
184
|
+
|
|
185
|
+
## Security Considerations
|
|
186
|
+
[How webhook verification works, secret handling]
|
|
187
|
+
|
|
188
|
+
## Testing
|
|
189
|
+
[How to test with Stripe test mode]
|
|
190
|
+
|
|
191
|
+
## Questions/Concerns
|
|
192
|
+
[Any items for review]
|
|
193
|
+
</report>"
|
|
194
|
+
|
|
195
|
+
agent-cli dev new email-notifications --agent --prompt "Implement email notification system.
|
|
196
|
+
|
|
197
|
+
<workflow>
|
|
198
|
+
- Read multiple files in parallel when exploring the codebase
|
|
199
|
+
- Make incremental git commits as you complete each component
|
|
200
|
+
- Run tests and linting before writing your final report
|
|
201
|
+
</workflow>
|
|
202
|
+
|
|
203
|
+
<code_exploration>
|
|
204
|
+
Start by reading the codebase to understand patterns:
|
|
205
|
+
- Examine src/api/ for how background tasks are handled
|
|
206
|
+
- Check existing configuration patterns for external services
|
|
207
|
+
- Look for template handling patterns
|
|
208
|
+
|
|
209
|
+
Understand the existing architecture before implementing.
|
|
210
|
+
</code_exploration>
|
|
211
|
+
|
|
212
|
+
<context>
|
|
213
|
+
Email notifications are user-facing and must be reliable. Background processing prevents blocking API responses. Template-based emails allow content changes without code changes.
|
|
214
|
+
</context>
|
|
215
|
+
|
|
216
|
+
<requirements>
|
|
217
|
+
- Use an appropriate email library for the stack (e.g., fastapi-mail or aiosmtplib)
|
|
218
|
+
- Implement as background tasks to avoid blocking API responses
|
|
219
|
+
- Create templates for: welcome, password_reset, order_confirmation
|
|
220
|
+
- POST /notifications/send-test - endpoint for testing email delivery
|
|
221
|
+
- Store SMTP settings (host, port, user, password) in environment
|
|
222
|
+
</requirements>
|
|
223
|
+
|
|
224
|
+
<scope>
|
|
225
|
+
Implement the minimum required for reliable email delivery. Skip notification preferences, SMS, or push notifications unless requested.
|
|
226
|
+
</scope>
|
|
227
|
+
|
|
228
|
+
<report>
|
|
229
|
+
After verifying tests pass, write to .claude/REPORT.md with summary, files changed, library choice rationale, testing instructions, and any concerns.
|
|
230
|
+
</report>"
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Scenario 3: Test-driven development
|
|
234
|
+
|
|
235
|
+
**User request**: "Add a caching layer with comprehensive tests"
|
|
236
|
+
|
|
237
|
+
**Strategy**: One agent writes tests first, another implements.
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
agent-cli dev new cache-tests --agent --prompt "Write comprehensive tests for a caching layer.
|
|
241
|
+
|
|
242
|
+
<task>
|
|
243
|
+
Create a complete test suite that drives the implementation of a caching system. The tests define the interface - write them as if the implementation already exists.
|
|
244
|
+
</task>
|
|
245
|
+
|
|
246
|
+
<workflow>
|
|
247
|
+
- Read test files in parallel to understand existing patterns
|
|
248
|
+
- Commit tests incrementally as you complete each test category
|
|
249
|
+
- Verify tests are syntactically valid before finishing
|
|
250
|
+
</workflow>
|
|
251
|
+
|
|
252
|
+
<code_exploration>
|
|
253
|
+
First, explore the codebase (parallelize these reads):
|
|
254
|
+
- tests/ for existing test patterns and fixtures
|
|
255
|
+
- conftest.py for shared fixtures
|
|
256
|
+
- Project testing conventions
|
|
257
|
+
|
|
258
|
+
Follow the exact testing patterns you find.
|
|
259
|
+
</code_exploration>
|
|
260
|
+
|
|
261
|
+
<interface_spec>
|
|
262
|
+
The cache system should support:
|
|
263
|
+
- get(key: str) -> Any | None
|
|
264
|
+
- set(key: str, value: Any, ttl_seconds: int | None = None) -> None
|
|
265
|
+
- delete(key: str) -> bool
|
|
266
|
+
- clear() -> None
|
|
267
|
+
- Support for Redis backend and in-memory fallback
|
|
268
|
+
</interface_spec>
|
|
269
|
+
|
|
270
|
+
<test_requirements>
|
|
271
|
+
Write tests in tests/test_cache.py using pytest:
|
|
272
|
+
- Basic get/set/delete operations
|
|
273
|
+
- TTL expiration (use time mocking)
|
|
274
|
+
- Cache miss returns None
|
|
275
|
+
- Backend switching/fallback behavior
|
|
276
|
+
- Concurrent access patterns
|
|
277
|
+
- Edge cases: empty keys, None values, large values
|
|
278
|
+
</test_requirements>
|
|
279
|
+
|
|
280
|
+
<scope>
|
|
281
|
+
Write only tests, not the implementation. The tests should fail initially and pass once implementation is complete. Write tests that verify behavior, not implementation details.
|
|
282
|
+
</scope>
|
|
283
|
+
|
|
284
|
+
<report>
|
|
285
|
+
When complete, write to .claude/REPORT.md:
|
|
286
|
+
|
|
287
|
+
## Test Cases
|
|
288
|
+
| Test Name | What It Verifies |
|
|
289
|
+
|-----------|------------------|
|
|
290
|
+
| test_xxx | description |
|
|
291
|
+
|
|
292
|
+
## Interface Decisions
|
|
293
|
+
- Why the interface is designed this way
|
|
294
|
+
|
|
295
|
+
## Edge Cases Covered
|
|
296
|
+
- List of edge cases and why they matter
|
|
297
|
+
|
|
298
|
+
## Implementation Suggestions
|
|
299
|
+
- Hints for the implementer
|
|
300
|
+
</report>"
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
After reviewing the tests:
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
agent-cli dev new cache-impl --from cache-tests --agent --prompt "Implement the caching layer to pass existing tests.
|
|
307
|
+
|
|
308
|
+
<workflow>
|
|
309
|
+
- Read all test files first to understand the complete interface
|
|
310
|
+
- Run tests frequently as you implement: pytest tests/test_cache.py -v
|
|
311
|
+
- Make incremental git commits after each passing test group
|
|
312
|
+
- Verify all tests pass before writing your report
|
|
313
|
+
</workflow>
|
|
314
|
+
|
|
315
|
+
<code_exploration>
|
|
316
|
+
CRITICAL: Read the tests completely before writing any implementation.
|
|
317
|
+
- Read tests/test_cache.py to understand expected behavior
|
|
318
|
+
- Note the exact interface the tests expect
|
|
319
|
+
- Identify edge cases the tests check for
|
|
320
|
+
|
|
321
|
+
The tests define the contract - implement to match them exactly.
|
|
322
|
+
</code_exploration>
|
|
323
|
+
|
|
324
|
+
<requirements>
|
|
325
|
+
Implement in src/cache.py:
|
|
326
|
+
- CacheBackend abstract base class
|
|
327
|
+
- RedisBackend implementation (use redis-py)
|
|
328
|
+
- MemoryBackend implementation (dict-based with TTL support)
|
|
329
|
+
- Cache facade that selects backend based on configuration
|
|
330
|
+
</requirements>
|
|
331
|
+
|
|
332
|
+
<scope>
|
|
333
|
+
Implement exactly what the tests require. Skip features the tests don't verify. Skip distributed caching, cache warming, or advanced features unless tests require them.
|
|
334
|
+
</scope>
|
|
335
|
+
|
|
336
|
+
<report>
|
|
337
|
+
After ALL tests pass, write to .claude/REPORT.md:
|
|
338
|
+
|
|
339
|
+
## Implementation Approach
|
|
340
|
+
[How the cache system works]
|
|
341
|
+
|
|
342
|
+
## Test Results
|
|
343
|
+
[Output of pytest run showing all tests pass]
|
|
344
|
+
|
|
345
|
+
## Deviations
|
|
346
|
+
[Any places where tests seemed incorrect or ambiguous]
|
|
347
|
+
|
|
348
|
+
## Performance Notes
|
|
349
|
+
[Any performance considerations]
|
|
350
|
+
</report>"
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
## Scenario 4: Large refactoring by module
|
|
354
|
+
|
|
355
|
+
**User request**: "Refactor the API to use consistent error handling"
|
|
356
|
+
|
|
357
|
+
**Strategy**: Split by module, each agent handles one area.
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
agent-cli dev new refactor-users-errors --agent --prompt "Refactor error handling in the users module.
|
|
361
|
+
|
|
362
|
+
<workflow>
|
|
363
|
+
- Read all relevant files in parallel before making any changes
|
|
364
|
+
- Make incremental git commits as you refactor each endpoint
|
|
365
|
+
- Run tests after each change to catch regressions early
|
|
366
|
+
- Run linting before writing your final report
|
|
367
|
+
</workflow>
|
|
368
|
+
|
|
369
|
+
<code_exploration>
|
|
370
|
+
Think carefully about the current state before making changes:
|
|
371
|
+
- Read ALL files in src/api/routes/users.py and related user logic
|
|
372
|
+
- Document the current error handling patterns you find
|
|
373
|
+
- Check how errors are handled in other modules for comparison
|
|
374
|
+
- Look for any error handling utilities that already exist
|
|
375
|
+
|
|
376
|
+
Only modify code you have read and understood.
|
|
377
|
+
</code_exploration>
|
|
378
|
+
|
|
379
|
+
<context>
|
|
380
|
+
Inconsistent error responses make API clients fragile and debugging difficult. A standard error format allows clients to handle errors programmatically and provides clear information for debugging. Logging errors with context is essential for production troubleshooting.
|
|
381
|
+
</context>
|
|
382
|
+
|
|
383
|
+
<target_pattern>
|
|
384
|
+
Use HTTPException with structured detail:
|
|
385
|
+
{
|
|
386
|
+
\"error\": \"ERROR_CODE\",
|
|
387
|
+
\"message\": \"Human readable description\",
|
|
388
|
+
\"details\": {} // optional additional context
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
Error codes for users: USER_NOT_FOUND, USER_ALREADY_EXISTS, INVALID_CREDENTIALS, EMAIL_NOT_VERIFIED, etc.
|
|
392
|
+
|
|
393
|
+
Before raising, log with context:
|
|
394
|
+
logger.warning(f\"User not found: {user_id}\", extra={\"user_id\": user_id})
|
|
395
|
+
</target_pattern>
|
|
396
|
+
|
|
397
|
+
<scope>
|
|
398
|
+
ONLY modify files in src/api/routes/users.py and directly related user logic. Other agents are handling other modules.
|
|
399
|
+
</scope>
|
|
400
|
+
|
|
401
|
+
<report>
|
|
402
|
+
After tests pass and linting is clean, write to .claude/REPORT.md:
|
|
403
|
+
|
|
404
|
+
## Changes Made
|
|
405
|
+
| File | Change Description |
|
|
406
|
+
|------|-------------------|
|
|
407
|
+
| path | what changed |
|
|
408
|
+
|
|
409
|
+
## Error Codes Introduced
|
|
410
|
+
| Code | When Used | HTTP Status |
|
|
411
|
+
|------|-----------|-------------|
|
|
412
|
+
|
|
413
|
+
## Breaking Changes
|
|
414
|
+
[Any API response changes that could affect clients]
|
|
415
|
+
|
|
416
|
+
## Testing
|
|
417
|
+
[How to verify the changes work]
|
|
418
|
+
</report>"
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
## Scenario 5: Documentation and implementation in parallel
|
|
422
|
+
|
|
423
|
+
**User request**: "Add a plugin system with documentation"
|
|
424
|
+
|
|
425
|
+
**Strategy**: One agent implements, another writes docs simultaneously.
|
|
426
|
+
|
|
427
|
+
```bash
|
|
428
|
+
agent-cli dev new plugin-system --agent --prompt "Implement a plugin system.
|
|
429
|
+
|
|
430
|
+
<workflow>
|
|
431
|
+
- Read existing codebase structure in parallel before designing
|
|
432
|
+
- Make incremental git commits as you complete each component
|
|
433
|
+
- Run tests and linting before writing your final report
|
|
434
|
+
</workflow>
|
|
435
|
+
|
|
436
|
+
<code_exploration>
|
|
437
|
+
Think carefully about the architecture before implementing:
|
|
438
|
+
- Read the existing codebase structure to understand where plugins fit
|
|
439
|
+
- Check for any existing extension points or hooks
|
|
440
|
+
- Look at how configuration is handled
|
|
441
|
+
- Understand the application lifecycle
|
|
442
|
+
|
|
443
|
+
Design the plugin system to integrate naturally with existing patterns.
|
|
444
|
+
</code_exploration>
|
|
445
|
+
|
|
446
|
+
<requirements>
|
|
447
|
+
- Plugin base class with lifecycle hooks: on_load(), on_unload(), on_event(event_name, data)
|
|
448
|
+
- Plugin registry for discovery and management
|
|
449
|
+
- Auto-load plugins from plugins/ directory
|
|
450
|
+
- Create one example plugin demonstrating the interface
|
|
451
|
+
- Plugins should be able to register event handlers
|
|
452
|
+
</requirements>
|
|
453
|
+
|
|
454
|
+
<scope>
|
|
455
|
+
Implement the minimal system that allows extending functionality through plugins. Skip: plugin dependencies, versioning, hot-reloading, sandboxing, or a plugin marketplace.
|
|
456
|
+
</scope>
|
|
457
|
+
|
|
458
|
+
<implementation_notes>
|
|
459
|
+
- Use importlib for dynamic loading
|
|
460
|
+
- Simple dict-based event system is sufficient
|
|
461
|
+
- Plugins should fail gracefully without crashing the app
|
|
462
|
+
</implementation_notes>
|
|
463
|
+
|
|
464
|
+
<report>
|
|
465
|
+
After tests pass, write to .claude/REPORT.md:
|
|
466
|
+
|
|
467
|
+
## Architecture
|
|
468
|
+
[Diagram or description of how plugins integrate]
|
|
469
|
+
|
|
470
|
+
## Plugin Interface
|
|
471
|
+
\`\`\`python
|
|
472
|
+
class Plugin:
|
|
473
|
+
# document the interface
|
|
474
|
+
\`\`\`
|
|
475
|
+
|
|
476
|
+
## Example Plugin
|
|
477
|
+
[Show the example plugin code]
|
|
478
|
+
|
|
479
|
+
## Usage
|
|
480
|
+
[How to create and register a plugin]
|
|
481
|
+
</report>"
|
|
482
|
+
|
|
483
|
+
agent-cli dev new plugin-docs --agent --prompt "Write documentation for the plugin system.
|
|
484
|
+
|
|
485
|
+
<context>
|
|
486
|
+
Implementation is happening in parallel in another branch. Write documentation based on a standard plugin system design. The implementation agent will adapt if needed, or you can update docs after reviewing their work.
|
|
487
|
+
</context>
|
|
488
|
+
|
|
489
|
+
<assumptions>
|
|
490
|
+
- Plugin base class with on_load, on_unload, on_event hooks
|
|
491
|
+
- Plugin registry pattern with auto-discovery
|
|
492
|
+
- Plugins loaded from plugins/ directory
|
|
493
|
+
- Event-based communication
|
|
494
|
+
</assumptions>
|
|
495
|
+
|
|
496
|
+
<deliverables>
|
|
497
|
+
Create these documentation files:
|
|
498
|
+
- docs/plugins/overview.md - What plugins are, why use them, architecture diagram
|
|
499
|
+
- docs/plugins/creating-plugins.md - Step-by-step tutorial with complete example
|
|
500
|
+
- docs/plugins/api-reference.md - Complete API documentation for Plugin class and registry
|
|
501
|
+
|
|
502
|
+
Use clear examples and explain the \"why\" not just the \"how\".
|
|
503
|
+
</deliverables>
|
|
504
|
+
|
|
505
|
+
<workflow>
|
|
506
|
+
- Commit each documentation file as you complete it
|
|
507
|
+
- Ensure markdown renders correctly
|
|
508
|
+
</workflow>
|
|
509
|
+
|
|
510
|
+
<report>
|
|
511
|
+
When complete, write to .claude/REPORT.md:
|
|
512
|
+
|
|
513
|
+
## Documentation Structure
|
|
514
|
+
[Outline of what was created]
|
|
515
|
+
|
|
516
|
+
## Assumptions Made
|
|
517
|
+
[What you assumed about the implementation]
|
|
518
|
+
|
|
519
|
+
## Suggestions for Implementation
|
|
520
|
+
[Any insights from writing docs that could improve the design]
|
|
521
|
+
|
|
522
|
+
## Open Questions
|
|
523
|
+
[Things that need clarification from the implementation]
|
|
524
|
+
</report>"
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
## Reviewing results
|
|
528
|
+
|
|
529
|
+
After agents complete their work:
|
|
530
|
+
|
|
531
|
+
```bash
|
|
532
|
+
# Check status of all worktrees
|
|
533
|
+
agent-cli dev status
|
|
534
|
+
|
|
535
|
+
# Read reports from each agent
|
|
536
|
+
agent-cli dev run auth-feature cat .claude/REPORT.md
|
|
537
|
+
agent-cli dev run payment-integration cat .claude/REPORT.md
|
|
538
|
+
agent-cli dev run email-notifications cat .claude/REPORT.md
|
|
539
|
+
|
|
540
|
+
# Open a worktree to review code
|
|
541
|
+
agent-cli dev editor auth-feature
|
|
542
|
+
|
|
543
|
+
# Run tests in a worktree
|
|
544
|
+
agent-cli dev run cache-impl pytest tests/test_cache.py -v
|
|
545
|
+
|
|
546
|
+
# Clean up after merging
|
|
547
|
+
agent-cli dev clean --merged
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
## Report format reference
|
|
551
|
+
|
|
552
|
+
All spawned agents should write to `.claude/REPORT.md` with at minimum:
|
|
553
|
+
|
|
554
|
+
```markdown
|
|
555
|
+
## Summary
|
|
556
|
+
[2-3 sentences describing what was done]
|
|
557
|
+
|
|
558
|
+
## Files Changed
|
|
559
|
+
- path/to/file.py - what changed and why
|
|
560
|
+
|
|
561
|
+
## Key Decisions
|
|
562
|
+
- Decision: rationale for the choice made
|
|
563
|
+
|
|
564
|
+
## Testing
|
|
565
|
+
How to verify the implementation works correctly
|
|
566
|
+
|
|
567
|
+
## Questions/Concerns
|
|
568
|
+
Any items that need human review or clarification
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
This consistent format makes it easy to review work from multiple agents.
|