yycode 0.3.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/__init__.py +33 -0
- agent/acp/__init__.py +2 -0
- agent/acp/approval_adapter.py +134 -0
- agent/acp/content_adapter.py +45 -0
- agent/acp/jsonrpc.py +92 -0
- agent/acp/server.py +197 -0
- agent/acp/session_manager.py +193 -0
- agent/acp/update_adapter.py +192 -0
- agent/app_paths.py +25 -0
- agent/approval.py +169 -0
- agent/cancellation.py +52 -0
- agent/change_snapshot.py +186 -0
- agent/context_compressor.py +116 -0
- agent/graph.py +137 -0
- agent/llm_retry.py +434 -0
- agent/logger.py +97 -0
- agent/lsp/__init__.py +13 -0
- agent/lsp/client.py +151 -0
- agent/lsp/manager.py +234 -0
- agent/lsp/types.py +119 -0
- agent/message_context_manager.py +322 -0
- agent/message_format.py +105 -0
- agent/nodes/llm_node.py +58 -0
- agent/nodes/state.py +12 -0
- agent/nodes/task_guard_node.py +50 -0
- agent/nodes/tools_node.py +70 -0
- agent/plan_snapshot.py +70 -0
- agent/providers/__init__.py +13 -0
- agent/providers/anthropic_provider.py +268 -0
- agent/providers/base.py +52 -0
- agent/providers/openai_provider.py +279 -0
- agent/providers/text_tool_calls.py +118 -0
- agent/runtime/approval_service.py +184 -0
- agent/runtime/context.py +43 -0
- agent/runtime/tool_events.py +368 -0
- agent/runtime/tool_executor.py +208 -0
- agent/runtime/tool_output.py +261 -0
- agent/runtime/tool_registry.py +91 -0
- agent/runtime/tool_scheduler.py +35 -0
- agent/runtime/workflow_guard.py +217 -0
- agent/runtime/workspace.py +5 -0
- agent/runtime/workspace_tools.py +22 -0
- agent/session.py +787 -0
- agent/session_replay.py +95 -0
- agent/session_store.py +186 -0
- agent/skills.py +254 -0
- agent/streaming.py +248 -0
- agent/subagent.py +634 -0
- agent/task_memory.py +340 -0
- agent/todo_manager.py +304 -0
- agent/tool_retry.py +106 -0
- agent/tui/__init__.py +14 -0
- agent/tui/app.py +1325 -0
- agent/tui/approval.py +53 -0
- agent/tui/commands/__init__.py +6 -0
- agent/tui/commands/base.py +48 -0
- agent/tui/commands/clear.py +37 -0
- agent/tui/commands/help.py +27 -0
- agent/tui/commands/registry.py +94 -0
- agent/tui/help_content.py +108 -0
- agent/tui/renderers.py +1961 -0
- agent/tui/runner.py +439 -0
- agent/tui/state.py +653 -0
- main.py +465 -0
- tools/__init__.py +50 -0
- tools/apply_patch.py +305 -0
- tools/bash.py +76 -0
- tools/diff_utils.py +139 -0
- tools/edit_file.py +40 -0
- tools/git_diff.py +72 -0
- tools/git_show.py +65 -0
- tools/grep.py +149 -0
- tools/list_files.py +90 -0
- tools/list_skills.py +24 -0
- tools/load_skill.py +30 -0
- tools/lsp_definition.py +27 -0
- tools/lsp_diagnostics.py +32 -0
- tools/lsp_document_symbols.py +23 -0
- tools/lsp_hover.py +29 -0
- tools/lsp_references.py +37 -0
- tools/lsp_utils.py +38 -0
- tools/lsp_workspace_symbols.py +23 -0
- tools/read_file.py +61 -0
- tools/read_many_files.py +50 -0
- tools/safety.py +50 -0
- tools/subagent.py +57 -0
- tools/todo.py +89 -0
- tools/verify.py +107 -0
- tools/web_search.py +250 -0
- tools/workspace.py +36 -0
- tools/workspace_state.py +60 -0
- tools/write_file.py +88 -0
- utils/__init__.py +5 -0
- utils/retry.py +13 -0
- yycode-0.3.2.data/data/skills/code_review.md +61 -0
- yycode-0.3.2.data/data/skills/code_workflow.md +404 -0
- yycode-0.3.2.data/data/skills/drawio/SKILL.md +636 -0
- yycode-0.3.2.data/data/skills/drawio/agents/openai.yaml +19 -0
- yycode-0.3.2.data/data/skills/drawio/assets/demo-erd.drawio +84 -0
- yycode-0.3.2.data/data/skills/drawio/assets/demo-layered-cn.drawio +91 -0
- yycode-0.3.2.data/data/skills/drawio/assets/demo-layered-cn.png +0 -0
- yycode-0.3.2.data/data/skills/drawio/assets/demo-layered.drawio +112 -0
- yycode-0.3.2.data/data/skills/drawio/assets/demo-layered.png +0 -0
- yycode-0.3.2.data/data/skills/drawio/assets/demo-ml.drawio +90 -0
- yycode-0.3.2.data/data/skills/drawio/assets/demo-ring-cn.drawio +68 -0
- yycode-0.3.2.data/data/skills/drawio/assets/demo-ring-cn.png +0 -0
- yycode-0.3.2.data/data/skills/drawio/assets/demo-ring.drawio +86 -0
- yycode-0.3.2.data/data/skills/drawio/assets/demo-ring.png +0 -0
- yycode-0.3.2.data/data/skills/drawio/assets/demo-sequence.drawio +116 -0
- yycode-0.3.2.data/data/skills/drawio/assets/demo-star-cn.drawio +66 -0
- yycode-0.3.2.data/data/skills/drawio/assets/demo-star-cn.png +0 -0
- yycode-0.3.2.data/data/skills/drawio/assets/demo-star.drawio +79 -0
- yycode-0.3.2.data/data/skills/drawio/assets/demo-star.png +0 -0
- yycode-0.3.2.data/data/skills/drawio/assets/demo-uml-class.drawio +64 -0
- yycode-0.3.2.data/data/skills/drawio/assets/microservices-example.drawio +173 -0
- yycode-0.3.2.data/data/skills/drawio/assets/microservices-example.png +0 -0
- yycode-0.3.2.data/data/skills/drawio/assets/workflow-cn.drawio +120 -0
- yycode-0.3.2.data/data/skills/drawio/assets/workflow-cn.png +0 -0
- yycode-0.3.2.data/data/skills/drawio/assets/workflow.drawio +120 -0
- yycode-0.3.2.data/data/skills/drawio/assets/workflow.png +0 -0
- yycode-0.3.2.data/data/skills/drawio/docs/index.html +469 -0
- yycode-0.3.2.data/data/skills/drawio/docs/zh.html +456 -0
- yycode-0.3.2.data/data/skills/drawio/references/style-extraction.md +254 -0
- yycode-0.3.2.data/data/skills/drawio/styles/schema.json +112 -0
- yycode-0.3.2.data/data/skills/plan.md +115 -0
- yycode-0.3.2.data/data/skills/ppt/SKILL.md +254 -0
- yycode-0.3.2.dist-info/METADATA +12 -0
- yycode-0.3.2.dist-info/RECORD +131 -0
- yycode-0.3.2.dist-info/WHEEL +5 -0
- yycode-0.3.2.dist-info/entry_points.txt +2 -0
- yycode-0.3.2.dist-info/top_level.txt +4 -0
utils/__init__.py
ADDED
utils/retry.py
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code_review
|
|
3
|
+
description: "Perform comprehensive code reviews focused on code quality, error handling, testing, documentation, and actionable feedback. When deeper verification is needed, consider using a subagent with the tester role to inspect test coverage, run focused checks, or validate risky changes."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Review Skill
|
|
7
|
+
|
|
8
|
+
## Purpose
|
|
9
|
+
Perform comprehensive code reviews to ensure quality, readability, and maintainability.
|
|
10
|
+
|
|
11
|
+
## Review Checklist
|
|
12
|
+
|
|
13
|
+
### 1. Code Quality
|
|
14
|
+
- [ ] Clear and descriptive variable/function names
|
|
15
|
+
- [ ] Proper function decomposition (single responsibility)
|
|
16
|
+
- [ ] Avoid code duplication
|
|
17
|
+
- [ ] Appropriate comments where necessary
|
|
18
|
+
- [ ] Consistent coding style
|
|
19
|
+
|
|
20
|
+
### 2. Error Handling
|
|
21
|
+
- [ ] Proper exception handling
|
|
22
|
+
- [ ] Input validation
|
|
23
|
+
- [ ] Edge case consideration
|
|
24
|
+
- [ ] Meaningful error messages
|
|
25
|
+
|
|
26
|
+
### 3. Testing
|
|
27
|
+
- [ ] Unit tests exist for new functionality
|
|
28
|
+
- [ ] Tests cover edge cases
|
|
29
|
+
- [ ] All existing tests pass
|
|
30
|
+
- [ ] Test descriptions are clear
|
|
31
|
+
|
|
32
|
+
### 4. Documentation
|
|
33
|
+
- [ ] Docstrings for public functions/classes
|
|
34
|
+
- [ ] README updates if needed
|
|
35
|
+
- [ ] Examples for complex functionality
|
|
36
|
+
|
|
37
|
+
## Review Process
|
|
38
|
+
|
|
39
|
+
1. **Read the code** to understand what it does
|
|
40
|
+
2. **Check against the checklist** above
|
|
41
|
+
3. **Suggest improvements** with specific examples
|
|
42
|
+
4. **Ask questions** about unclear parts
|
|
43
|
+
5. **Provide constructive feedback** that helps the developer learn
|
|
44
|
+
|
|
45
|
+
## Common Issues to Look For
|
|
46
|
+
|
|
47
|
+
- Magic numbers without explanation
|
|
48
|
+
- Overly complex functions that do too much
|
|
49
|
+
- Missing error handling
|
|
50
|
+
- Inconsistent naming conventions
|
|
51
|
+
- Unused imports or variables
|
|
52
|
+
- Hardcoded paths or configurations
|
|
53
|
+
- Lack of type hints (for Python)
|
|
54
|
+
|
|
55
|
+
## Feedback Format
|
|
56
|
+
|
|
57
|
+
When providing review feedback:
|
|
58
|
+
1. Start with what's done well
|
|
59
|
+
2. Then suggest improvements
|
|
60
|
+
3. Provide specific code examples when possible
|
|
61
|
+
4. Explain the reasoning behind suggestions
|
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code_workflow
|
|
3
|
+
description: "Universal code development workflow for ANY project: confirm requirements with the user → save the confirmed plan as a document → coordinate subagents by role → implement → verify → evaluate against requirements. Follow this for ALL coding tasks."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Workflow Skill
|
|
7
|
+
|
|
8
|
+
## Universal Workflow for Any Coding Task
|
|
9
|
+
|
|
10
|
+
Follow this exact process for ANY code development/modification task, in ANY project:
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Hard Gates
|
|
15
|
+
|
|
16
|
+
Do not skip these gates:
|
|
17
|
+
|
|
18
|
+
1. **Confirm requirements with the user before implementation.**
|
|
19
|
+
- You may inspect workspace state and read relevant files first if needed to ask better questions.
|
|
20
|
+
- Do not edit files or run implementation commands before the user confirms the requirements and approach.
|
|
21
|
+
|
|
22
|
+
2. **Save the confirmed plan as a document before implementation.**
|
|
23
|
+
- After the user confirms, write the agreed plan to a markdown document.
|
|
24
|
+
- Prefer `docs/` when it exists. Suggested path:
|
|
25
|
+
`docs/confirmed_plan_<short_task_name>.md`
|
|
26
|
+
- The document must include: user goal, confirmed requirements, scope, non-goals, affected files/areas, subagent assignments, implementation plan, verification plan, risks, and approval timestamp/context.
|
|
27
|
+
|
|
28
|
+
3. **Use subagents by role for non-trivial work.**
|
|
29
|
+
- `explorer`: investigates code and evidence.
|
|
30
|
+
- `architect`: designs the approach and tradeoffs.
|
|
31
|
+
- `worker`: implements scoped changes.
|
|
32
|
+
- `tester`: verifies behavior and test coverage.
|
|
33
|
+
- `security`: reviews security-sensitive or risky changes.
|
|
34
|
+
|
|
35
|
+
4. **Task State is mandatory.**
|
|
36
|
+
- Every user request must be represented with `todo`.
|
|
37
|
+
- Keep exactly one item `in_progress` while work remains.
|
|
38
|
+
- Do not finish until all todo items are completed.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Phase 1: Requirements Analysis & Workspace Exploration
|
|
43
|
+
|
|
44
|
+
**Always start here - no exceptions!**
|
|
45
|
+
|
|
46
|
+
### 1.1 Understand User Requirements
|
|
47
|
+
- Carefully read and analyze the user's request
|
|
48
|
+
- Identify the core problem to solve
|
|
49
|
+
- Clarify ambiguous requirements
|
|
50
|
+
- Define clear success criteria
|
|
51
|
+
- Note all constraints and edge cases
|
|
52
|
+
- Prepare a concise confirmation proposal for the user
|
|
53
|
+
|
|
54
|
+
### 1.2 Check Workspace State
|
|
55
|
+
```
|
|
56
|
+
Call workspace_state()
|
|
57
|
+
→ Understand current branch and uncommitted changes
|
|
58
|
+
→ Confirm we're in the correct directory
|
|
59
|
+
→ Avoid overwriting user's existing work
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 1.3 Check Git Diff
|
|
63
|
+
```
|
|
64
|
+
Call git_diff()
|
|
65
|
+
→ See what the user has already changed
|
|
66
|
+
→ Understand current context
|
|
67
|
+
→ Do NOT overwrite or conflict with user changes
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### 1.4 Explore the Codebase
|
|
71
|
+
- Use `list_files` to understand project structure
|
|
72
|
+
- Use `grep` to search for relevant code patterns
|
|
73
|
+
- Use `read_file` to examine key files
|
|
74
|
+
- Use `read_many_files` for multiple related files
|
|
75
|
+
- Prefer these built-in navigation tools over `bash` for normal code search and file reading
|
|
76
|
+
- Use `subagent` with `role="explorer"` for large/complex codebases
|
|
77
|
+
- Use `list_skills` + `load_skill` for project-specific or domain-specific guidance
|
|
78
|
+
|
|
79
|
+
### 1.5 Confirm Requirements With User
|
|
80
|
+
Before implementation, send the user a short confirmation message:
|
|
81
|
+
|
|
82
|
+
```text
|
|
83
|
+
I will implement the following confirmed scope:
|
|
84
|
+
- Goal: ...
|
|
85
|
+
- Requirements: ...
|
|
86
|
+
- Non-goals: ...
|
|
87
|
+
- Proposed approach: ...
|
|
88
|
+
- Verification: ...
|
|
89
|
+
- Subagent roles: ...
|
|
90
|
+
|
|
91
|
+
Please confirm before I proceed.
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Rules:
|
|
95
|
+
- If the user has not confirmed, do not implement.
|
|
96
|
+
- If the user changes scope, update the confirmation and ask again.
|
|
97
|
+
- If the task is tiny and already fully specified, still provide a brief confirmation and wait.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Phase 2: Confirmed Plan Document & Technical Planning
|
|
102
|
+
|
|
103
|
+
### 2.1 Create Task State
|
|
104
|
+
Every user request must be represented in Task State with the `todo` tool before the task can finish. For simple work, create a single item. For larger work, create a short, concrete plan:
|
|
105
|
+
```
|
|
106
|
+
Call todo(items=[
|
|
107
|
+
{"id": "1", "text": "Analyze requirements and explore codebase", "status": "in_progress"},
|
|
108
|
+
{"id": "2", "text": "Confirm requirements and save confirmed plan document", "status": "pending"},
|
|
109
|
+
{"id": "3", "text": "Create technical design", "status": "pending"},
|
|
110
|
+
{"id": "4", "text": "Implement the solution", "status": "pending"},
|
|
111
|
+
{"id": "5", "text": "Run tests and verification", "status": "pending"},
|
|
112
|
+
{"id": "6", "text": "Evaluate results against requirements", "status": "pending"}
|
|
113
|
+
], memory={
|
|
114
|
+
"user_goal": "[one sentence goal]",
|
|
115
|
+
"constraints": ["[important constraints]"],
|
|
116
|
+
"next_steps": ["Analyze requirements and explore codebase"]
|
|
117
|
+
})
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Task State rules:
|
|
121
|
+
- Keep exactly one item `in_progress` while work remains.
|
|
122
|
+
- Keep compact memory current: goal, constraints, inspected/modified files, decisions, test results, risks, and next steps.
|
|
123
|
+
- Do not provide a final answer until all items are `completed`.
|
|
124
|
+
|
|
125
|
+
### 2.2 Save Confirmed Plan Document
|
|
126
|
+
After the user confirms the requirement and approach, save the plan:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
Call write_file(
|
|
130
|
+
path="docs/confirmed_plan_<short_task_name>.md",
|
|
131
|
+
content="[confirmed plan markdown]"
|
|
132
|
+
)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
The document must include:
|
|
136
|
+
|
|
137
|
+
- Title
|
|
138
|
+
- User goal
|
|
139
|
+
- Confirmed requirements
|
|
140
|
+
- Scope
|
|
141
|
+
- Non-goals
|
|
142
|
+
- Affected files or areas
|
|
143
|
+
- Subagent assignments
|
|
144
|
+
- Implementation plan
|
|
145
|
+
- Verification plan
|
|
146
|
+
- Security/risk considerations
|
|
147
|
+
- Confirmation note, including the fact that the user confirmed the plan
|
|
148
|
+
|
|
149
|
+
If `docs/` does not exist, either create it or use a clearly named root-level markdown file such as `confirmed_plan_<short_task_name>.md`.
|
|
150
|
+
|
|
151
|
+
### 2.3 Use Architect Subagent
|
|
152
|
+
For non-trivial features or when design guidance is needed:
|
|
153
|
+
```
|
|
154
|
+
Call subagent(
|
|
155
|
+
role="architect",
|
|
156
|
+
task="Design the technical solution for: [describe requirements in detail]",
|
|
157
|
+
context="[provide relevant files, existing code, and constraints]"
|
|
158
|
+
)
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### 2.4 Refine & Update Todo
|
|
162
|
+
```
|
|
163
|
+
Call todo(items=[... update statuses and add detailed implementation steps ...])
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Phase 2.5: Subagent Coordination
|
|
169
|
+
|
|
170
|
+
For non-trivial tasks, assign focused subagent work before or during implementation:
|
|
171
|
+
|
|
172
|
+
### Explorer
|
|
173
|
+
Use for evidence and codebase understanding:
|
|
174
|
+
|
|
175
|
+
```
|
|
176
|
+
Call subagent(
|
|
177
|
+
role="explorer",
|
|
178
|
+
task="Investigate the relevant code paths, files, existing behavior, and constraints for: [confirmed task]",
|
|
179
|
+
context="[user-confirmed plan, workspace findings]"
|
|
180
|
+
)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Architect
|
|
184
|
+
Use for design:
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
Call subagent(
|
|
188
|
+
role="architect",
|
|
189
|
+
task="Design a minimal, safe technical approach for: [confirmed task]",
|
|
190
|
+
context="[explorer findings, confirmed plan]"
|
|
191
|
+
)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Worker
|
|
195
|
+
Use for implementation:
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
Call subagent(
|
|
199
|
+
role="worker",
|
|
200
|
+
task="Implement only the scoped changes from the confirmed plan.",
|
|
201
|
+
context="[confirmed plan document path, architect design, relevant files]"
|
|
202
|
+
)
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### Tester
|
|
206
|
+
Use for verification:
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
Call subagent(
|
|
210
|
+
role="tester",
|
|
211
|
+
task="Verify the implementation against the confirmed requirements and report test coverage, failures, and residual risks.",
|
|
212
|
+
context="[confirmed plan, changed files, worker summary]"
|
|
213
|
+
)
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Security
|
|
217
|
+
Use when changes affect inputs, auth, permissions, file access, shell commands, networking, secrets, or dependency behavior:
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
Call subagent(
|
|
221
|
+
role="security",
|
|
222
|
+
task="Review the implementation for security risks and concrete mitigations.",
|
|
223
|
+
context="[confirmed plan, changed files, diff summary]"
|
|
224
|
+
)
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Rules:
|
|
228
|
+
- Subagents must receive focused, bounded tasks.
|
|
229
|
+
- Do not ask subagents to make broad unrelated changes.
|
|
230
|
+
- Prefer a single `worker` for implementation by default.
|
|
231
|
+
- Only use multiple `worker` subagents when the implementation spans many files and the write scope can be split cleanly.
|
|
232
|
+
- Never assign multiple `worker` subagents to edit the same file.
|
|
233
|
+
- When using multiple `worker` subagents, give each one an explicit file ownership boundary and a disjoint write set.
|
|
234
|
+
- Integrate subagent results yourself and update Task State memory.
|
|
235
|
+
- For simple one-file tasks, subagents may be skipped only after the user-confirmed plan document is saved.
|
|
236
|
+
|
|
237
|
+
---
|
|
238
|
+
|
|
239
|
+
## Phase 3: Implementation
|
|
240
|
+
|
|
241
|
+
Implementation may start only after:
|
|
242
|
+
- The user has confirmed the requirements and approach.
|
|
243
|
+
- The confirmed plan document has been saved.
|
|
244
|
+
- Task State reflects the confirmed plan.
|
|
245
|
+
|
|
246
|
+
### 3.1 Choose the Right Tools
|
|
247
|
+
- **`apply_patch`**: Preferred for ALL existing-file edits. Patch only the minimal changed block; never pass the whole file for a small edit.
|
|
248
|
+
- **`write_file`**: Only for brand new files or generated artifacts
|
|
249
|
+
- **`edit_file`**: Avoid for normal code edits; use apply_patch instead
|
|
250
|
+
- **`bash`**: For running necessary commands (use carefully, avoid destructive operations)
|
|
251
|
+
- Use `bash` only when built-in tools cannot express the needed inspection or command
|
|
252
|
+
|
|
253
|
+
### 3.2 Use Worker Subagent When Appropriate
|
|
254
|
+
For well-defined implementation tasks:
|
|
255
|
+
```
|
|
256
|
+
Call subagent(
|
|
257
|
+
role="worker",
|
|
258
|
+
task="Implement [specific feature/fix in detail]",
|
|
259
|
+
context="[provide design, relevant files, and requirements]"
|
|
260
|
+
)
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Worker assignment rules:
|
|
264
|
+
- Default to one `worker` for the whole implementation whenever possible.
|
|
265
|
+
- Split implementation across multiple `worker` subagents only when there are many files and the work can be partitioned safely.
|
|
266
|
+
- Do not let multiple `worker` subagents operate on the same file.
|
|
267
|
+
- If you split work, state each worker's owned files or modules clearly in the task context.
|
|
268
|
+
|
|
269
|
+
### 3.3 Track Progress
|
|
270
|
+
Update todo items as you complete each part:
|
|
271
|
+
```
|
|
272
|
+
Call todo(items=[... update statuses, mark items as completed/in_progress ...])
|
|
273
|
+
```
|
|
274
|
+
Also update `memory` with inspected files, modified files, decisions, test results, open risks, and next steps.
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Phase 4: Verification & Testing
|
|
279
|
+
|
|
280
|
+
**DO NOT SKIP THIS STEP - ALWAYS VERIFY YOUR CHANGES!**
|
|
281
|
+
|
|
282
|
+
### 4.1 Run Tests
|
|
283
|
+
```
|
|
284
|
+
Call verify(kind="tests", target="specific_test_file.py")
|
|
285
|
+
→ Start narrow with specific tests related to your changes
|
|
286
|
+
→ Then run broader test suites if everything passes
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### 4.2 (Optional) Use Tester Subagent
|
|
290
|
+
For non-trivial changes, use tester subagent:
|
|
291
|
+
```
|
|
292
|
+
Call subagent(
|
|
293
|
+
role="tester",
|
|
294
|
+
task="Thoroughly test the implementation, including edge cases",
|
|
295
|
+
context="[provide changes made and requirements]"
|
|
296
|
+
)
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### 4.3 Additional Verification (if project is configured)
|
|
300
|
+
- `verify(kind="lint")` - Code style and lint checks
|
|
301
|
+
- `verify(kind="typecheck")` - Type checking
|
|
302
|
+
- `verify(kind="all")` - Full verification suite
|
|
303
|
+
|
|
304
|
+
### 4.4 (Optional) Security Review
|
|
305
|
+
For security-sensitive or risk-bearing changes:
|
|
306
|
+
```
|
|
307
|
+
Call subagent(
|
|
308
|
+
role="security",
|
|
309
|
+
task="Review the code for potential security issues",
|
|
310
|
+
context="[provide changes made]"
|
|
311
|
+
)
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
## Phase 5: Result Evaluation (Critical Final Step)
|
|
317
|
+
|
|
318
|
+
**ALWAYS COMPLETE THIS STEP BEFORE FINISHING!**
|
|
319
|
+
|
|
320
|
+
### 5.1 Review Your Changes
|
|
321
|
+
- Use `git_diff()` to see exactly what was modified
|
|
322
|
+
- Verify all changes are necessary and relevant to the requirements
|
|
323
|
+
- Ensure no unintended changes were made
|
|
324
|
+
- Check that the code follows project conventions
|
|
325
|
+
|
|
326
|
+
### 5.2 Evaluate Against Requirements
|
|
327
|
+
Go through EACH requirement and verify:
|
|
328
|
+
|
|
329
|
+
1. **Functional Completeness**
|
|
330
|
+
- ✓ Does it implement ALL requested features?
|
|
331
|
+
- ✓ Are all edge cases handled properly?
|
|
332
|
+
- ✓ Does it handle errors gracefully?
|
|
333
|
+
- ✓ Is the functionality correct?
|
|
334
|
+
|
|
335
|
+
2. **Code Quality**
|
|
336
|
+
- ✓ Is the code clean and maintainable?
|
|
337
|
+
- ✓ Are there appropriate comments/documentation?
|
|
338
|
+
- ✓ Does it follow project coding conventions?
|
|
339
|
+
- ✓ Is the implementation efficient?
|
|
340
|
+
|
|
341
|
+
3. **Verification Status**
|
|
342
|
+
- ✓ Do ALL tests pass?
|
|
343
|
+
- ✓ Are there no lint or type errors?
|
|
344
|
+
- ✓ Was the solution verified thoroughly?
|
|
345
|
+
|
|
346
|
+
4. **User Experience**
|
|
347
|
+
- ✓ Is the solution intuitive to use?
|
|
348
|
+
- ✓ Does it solve the user's actual problem?
|
|
349
|
+
- ✓ Is the solution robust?
|
|
350
|
+
|
|
351
|
+
### 5.3 Provide Summary Report
|
|
352
|
+
Before the final answer, call `todo` with every item marked `completed`. Only then give the user a clear, concise summary:
|
|
353
|
+
- What was implemented/changed
|
|
354
|
+
- What verification was performed
|
|
355
|
+
- Any remaining concerns, tradeoffs, or follow-up considerations
|
|
356
|
+
- How to use the new feature/fix (if applicable)
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## Summary: Full Universal Workflow Loop
|
|
361
|
+
|
|
362
|
+
```
|
|
363
|
+
1. workspace_state/git_diff → Understand current workspace state
|
|
364
|
+
2. list_files/grep/read_file/read_many_files → Explore and understand codebase
|
|
365
|
+
3. subagent(explorer) when useful → Deep codebase exploration
|
|
366
|
+
4. Confirm requirements and approach with the user → Mandatory gate
|
|
367
|
+
5. todo → Create/align Task State
|
|
368
|
+
6. write_file → Save confirmed plan document
|
|
369
|
+
7. subagent(architect) → Technical design for non-trivial work
|
|
370
|
+
8. subagent(worker) or apply_patch/write_file → Implement scoped changes
|
|
371
|
+
9. todo → Track progress and decisions
|
|
372
|
+
10. verify + subagent(tester) → Test and verify
|
|
373
|
+
11. subagent(security) when relevant → Security review
|
|
374
|
+
12. git_diff → Review all changes
|
|
375
|
+
13. Evaluate against confirmed requirements → Check completeness and quality
|
|
376
|
+
14. todo completed → Final report
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
---
|
|
380
|
+
|
|
381
|
+
## Complete Tool Reference
|
|
382
|
+
|
|
383
|
+
| Tool | Purpose | Best Used For |
|
|
384
|
+
|------|---------|---------------|
|
|
385
|
+
| `workspace_state` | Check git status and current branch | Always start here |
|
|
386
|
+
| `git_diff` | View current changes in workspace | Before and after making changes |
|
|
387
|
+
| `list_files` | List directory contents | Understanding project structure |
|
|
388
|
+
| `grep` | Search code for patterns | Finding functions, classes, references |
|
|
389
|
+
| `read_file` | Read a single file | Examining specific code |
|
|
390
|
+
| `read_many_files` | Read multiple files at once | Understanding related code |
|
|
391
|
+
| `git_show` | Show git history for a file | Understanding why code changed |
|
|
392
|
+
| `apply_patch` | Safely apply a minimal diff | PREFERRED for existing-file edits |
|
|
393
|
+
| `write_file` | Write content to a file | New files or generated artifacts |
|
|
394
|
+
| `edit_file` | Blocked fallback | Avoid; use apply_patch |
|
|
395
|
+
| `bash` | Run shell commands | Setup, scripts, or project-specific commands |
|
|
396
|
+
| `verify` | Run tests, lint, or type checks | Verification (critical!) |
|
|
397
|
+
| `todo` | Track and manage tasks | Multi-step projects |
|
|
398
|
+
| `list_skills` | See available skills | Finding project-specific guidance |
|
|
399
|
+
| `load_skill` | Load a specific skill | Using specialized guidance |
|
|
400
|
+
| `subagent(explorer)` | Explore codebase | Large/complex projects |
|
|
401
|
+
| `subagent(architect)` | Create technical design | Complex features |
|
|
402
|
+
| `subagent(worker)` | Implement features | Well-defined implementation tasks |
|
|
403
|
+
| `subagent(tester)` | Test thoroughly | Comprehensive testing |
|
|
404
|
+
| `subagent(security)` | Security review | Security-sensitive code |
|