dev-playbooks 1.6.5 → 1.6.6
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/package.json
CHANGED
|
@@ -186,4 +186,87 @@ When producing documents or proposals:
|
|
|
186
186
|
|
|
187
187
|
---
|
|
188
188
|
|
|
189
|
+
## 5. AI Tool Usage Protocol
|
|
190
|
+
|
|
191
|
+
> **Core principle**: Correct, efficient, and reliable tool usage is the foundation of task completion. Tool call failures are not endpoints, but starting points for learning and improvement.
|
|
192
|
+
|
|
193
|
+
### 5.1 Tool Call Completeness
|
|
194
|
+
|
|
195
|
+
**Hard rules**:
|
|
196
|
+
1. **Every required parameter must be filled; no empty values**
|
|
197
|
+
- Bad: calling `Write` tool with empty `file_path` or `content`
|
|
198
|
+
- Good: ensure all required parameters have valid values
|
|
199
|
+
|
|
200
|
+
2. **Parameter values must match the tool's required format**
|
|
201
|
+
- Bad: passing relative path when absolute path is required, passing string when JSON is required
|
|
202
|
+
- Good: carefully read tool documentation and ensure parameter format is correct
|
|
203
|
+
|
|
204
|
+
3. **Different tools have different parameter structures; do not confuse them**
|
|
205
|
+
- Bad: using `Read` tool parameters for `Write` tool
|
|
206
|
+
- Good: confirm the parameter list for the current tool before each call
|
|
207
|
+
|
|
208
|
+
### 5.2 Learning from Failures
|
|
209
|
+
|
|
210
|
+
**Hard rules**:
|
|
211
|
+
1. **After the first failure, immediately adjust strategy instead of repeating the same mistake**
|
|
212
|
+
- Bad: after tool call fails, retry the same call without analyzing the cause
|
|
213
|
+
- Good:
|
|
214
|
+
- Analyze failure cause (parameter error? path doesn't exist? permission issue?)
|
|
215
|
+
- Adjust strategy (fix parameters, create directory, use alternative tool)
|
|
216
|
+
- Try again
|
|
217
|
+
|
|
218
|
+
2. **After 2 consecutive failures, must stop and rethink**
|
|
219
|
+
- If the same operation fails twice, the current strategy has fundamental issues
|
|
220
|
+
- Must:
|
|
221
|
+
- Explain the current problem to the user
|
|
222
|
+
- List attempted methods and failure reasons
|
|
223
|
+
- Propose new solutions or request user help
|
|
224
|
+
|
|
225
|
+
### 5.3 Large File Handling Strategy
|
|
226
|
+
|
|
227
|
+
**Hard rules**:
|
|
228
|
+
1. **For very long content, segmented writing is more reliable than single write**
|
|
229
|
+
- Writing files over 1000 lines in one call is prone to failure or truncation
|
|
230
|
+
- Good approach:
|
|
231
|
+
- Write the first half of the file
|
|
232
|
+
- After confirming success, append the second half
|
|
233
|
+
- Or use `Edit` tool for segmented modifications
|
|
234
|
+
|
|
235
|
+
2. **Use offset and limit parameters when reading large files**
|
|
236
|
+
- Bad: directly reading a 5000-line file, may timeout or truncate
|
|
237
|
+
- Good:
|
|
238
|
+
- Read first 500 lines to understand structure
|
|
239
|
+
- Read specific regions as needed
|
|
240
|
+
- Use `Grep` tool to search instead of full-text reading
|
|
241
|
+
|
|
242
|
+
### 5.4 Tool Selection Principles
|
|
243
|
+
|
|
244
|
+
**Priority**:
|
|
245
|
+
1. **Use specialized tools instead of Bash commands**
|
|
246
|
+
- File reading: use `Read` instead of `cat`
|
|
247
|
+
- File editing: use `Edit` instead of `sed`
|
|
248
|
+
- File searching: use `Grep` instead of `grep` command
|
|
249
|
+
- File finding: use `Glob` instead of `find` command
|
|
250
|
+
|
|
251
|
+
2. **Consider parallel execution for batch operations**
|
|
252
|
+
- If multiple operations are independent, call multiple tools in parallel in one message
|
|
253
|
+
- If operations have dependencies, must execute sequentially
|
|
254
|
+
|
|
255
|
+
3. **Use Task tool to delegate complex tasks to specialized agents**
|
|
256
|
+
- Codebase exploration: use `Explore` agent
|
|
257
|
+
- Implementation planning: use `Plan` agent
|
|
258
|
+
- Do not perform overly complex operations in the main flow
|
|
259
|
+
|
|
260
|
+
### 5.5 Self-Checklist (before each tool call)
|
|
261
|
+
|
|
262
|
+
- [ ] Is the tool I selected the most suitable for this task?
|
|
263
|
+
- [ ] Are all required parameters filled?
|
|
264
|
+
- [ ] Do parameter formats match tool requirements?
|
|
265
|
+
- [ ] If this call fails, what is my backup plan?
|
|
266
|
+
- [ ] Can this operation be executed in parallel with others?
|
|
267
|
+
|
|
268
|
+
**Violating Tool Usage Protocol = inefficiency; must improve.**
|
|
269
|
+
|
|
270
|
+
---
|
|
271
|
+
|
|
189
272
|
From now on, enable these rules by default in all future outputs.
|