loop: rework done tool
Smaller, simpler schema.
Eliminates $ref, which some LLMs don't like / don't understand.
Seems to work just as well.
diff --git a/loop/donetool.go b/loop/donetool.go
index aba8d98..e044f3b 100644
--- a/loop/donetool.go
+++ b/loop/donetool.go
@@ -43,61 +43,43 @@
const (
doneDescription = `Use this tool when you have achieved the user's goal. The parameters form a checklist which you should evaluate.`
doneChecklistJSONSchema = `{
- "$schema": "http://json-schema.org/draft-07/schema#",
- "title": "Checklist",
- "description": "A schema for tracking checklist items with status and comments",
"type": "object",
- "required": ["checklist_items"],
"properties": {
- "checklist_items": {
- "type": "object",
- "description": "Collection of checklist items",
- "properties": {
- "checked_guidance": {
- "$ref": "#/definitions/checklistItem",
- "description": "I checked for and followed any directory-specific guidance files for all modified files."
- },
- "wrote_tests": {
- "$ref": "#/definitions/checklistItem",
- "description": "If code was changed, tests were written or updated."
- },
- "passes_tests": {
- "$ref": "#/definitions/checklistItem",
- "description": "If any commits were made, tests pass."
- },
- "code_reviewed": {
- "$ref": "#/definitions/checklistItem",
- "description": "If any commits were made, the codereview tool was run and its output was addressed."
- },
- "git_commit": {
- "$ref": "#/definitions/checklistItem",
- "description": "Create git commits for any code changes you made. A git hook will add Co-Authored-By and Change-ID trailers. The git user is already configured correctly."
- }
- },
- "additionalProperties": {
- "$ref": "#/definitions/checklistItem"
- }
- }
- },
- "definitions": {
- "checklistItem": {
+ "checked_guidance": {
"type": "object",
"required": ["status"],
"properties": {
- "status": {
- "type": "string",
- "description": "Current status of the checklist item",
- "enum": ["yes", "no", "not applicable", "other"]
- },
- "description": {
- "type": "string",
- "description": "Description of what this checklist item verifies"
- },
- "comments": {
- "type": "string",
- "description": "Additional comments or context for this checklist item"
- }
- }
+ "status": {"type": "string", "enum": ["yes", "no", "n/a"]},
+ "comments": {"type": "string"}
+ },
+ "description": "Checked for and followed any directory-specific guidance files for all modified files."
+ },
+ "tested": {
+ "type": "object",
+ "required": ["status"],
+ "properties": {
+ "status": {"type": "string", "enum": ["yes", "no", "n/a"]},
+ "comments": {"type": "string"}
+ },
+ "description": "If code was changed, tests were written or updated, and all tests pass."
+ },
+ "code_reviewed": {
+ "type": "object",
+ "required": ["status"],
+ "properties": {
+ "status": {"type": "string", "enum": ["yes", "no", "n/a"]},
+ "comments": {"type": "string"}
+ },
+ "description": "If any commits were made, the codereview tool was run and its output addressed."
+ },
+ "git_commit": {
+ "type": "object",
+ "required": ["status"],
+ "properties": {
+ "status": {"type": "string", "enum": ["yes", "no", "n/a"]},
+ "comments": {"type": "string"}
+ },
+ "description": "All code changes were committed. A git hook adds Co-Authored-By and Change-ID trailers. The git user is already configured correctly."
}
}
}`
diff --git a/loop/testdata/agent_loop.httprr b/loop/testdata/agent_loop.httprr
index 66cae4f..b523252 100644
--- a/loop/testdata/agent_loop.httprr
+++ b/loop/testdata/agent_loop.httprr
@@ -1,9 +1,9 @@
httprr trace v1
-18427 2414
+18101 2303
POST https://api.anthropic.com/v1/messages HTTP/1.1
Host: api.anthropic.com
User-Agent: Go-http-client/1.1
-Content-Length: 18229
+Content-Length: 17903
Anthropic-Version: 2023-06-01
Content-Type: application/json
@@ -192,46 +192,9 @@
"name": "done",
"description": "Use this tool when you have achieved the user's goal. The parameters form a checklist which you should evaluate.",
"input_schema": {
- "$schema": "http://json-schema.org/draft-07/schema#",
- "title": "Checklist",
- "description": "A schema for tracking checklist items with status and comments",
"type": "object",
- "required": [
- "checklist_items"
- ],
"properties": {
- "checklist_items": {
- "type": "object",
- "description": "Collection of checklist items",
- "properties": {
- "checked_guidance": {
- "$ref": "#/definitions/checklistItem",
- "description": "I checked for and followed any directory-specific guidance files for all modified files."
- },
- "wrote_tests": {
- "$ref": "#/definitions/checklistItem",
- "description": "If code was changed, tests were written or updated."
- },
- "passes_tests": {
- "$ref": "#/definitions/checklistItem",
- "description": "If any commits were made, tests pass."
- },
- "code_reviewed": {
- "$ref": "#/definitions/checklistItem",
- "description": "If any commits were made, the codereview tool was run and its output was addressed."
- },
- "git_commit": {
- "$ref": "#/definitions/checklistItem",
- "description": "Create git commits for any code changes you made. A git hook will add Co-Authored-By and Change-ID trailers. The git user is already configured correctly."
- }
- },
- "additionalProperties": {
- "$ref": "#/definitions/checklistItem"
- }
- }
- },
- "definitions": {
- "checklistItem": {
+ "checked_guidance": {
"type": "object",
"required": [
"status"
@@ -239,23 +202,77 @@
"properties": {
"status": {
"type": "string",
- "description": "Current status of the checklist item",
"enum": [
"yes",
"no",
- "not applicable",
- "other"
+ "n/a"
]
},
- "description": {
+ "comments": {
+ "type": "string"
+ }
+ },
+ "description": "Checked for and followed any directory-specific guidance files for all modified files."
+ },
+ "tested": {
+ "type": "object",
+ "required": [
+ "status"
+ ],
+ "properties": {
+ "status": {
"type": "string",
- "description": "Description of what this checklist item verifies"
+ "enum": [
+ "yes",
+ "no",
+ "n/a"
+ ]
},
"comments": {
- "type": "string",
- "description": "Additional comments or context for this checklist item"
+ "type": "string"
}
- }
+ },
+ "description": "If code was changed, tests were written or updated, and all tests pass."
+ },
+ "code_reviewed": {
+ "type": "object",
+ "required": [
+ "status"
+ ],
+ "properties": {
+ "status": {
+ "type": "string",
+ "enum": [
+ "yes",
+ "no",
+ "n/a"
+ ]
+ },
+ "comments": {
+ "type": "string"
+ }
+ },
+ "description": "If any commits were made, the codereview tool was run and its output addressed."
+ },
+ "git_commit": {
+ "type": "object",
+ "required": [
+ "status"
+ ],
+ "properties": {
+ "status": {
+ "type": "string",
+ "enum": [
+ "yes",
+ "no",
+ "n/a"
+ ]
+ },
+ "comments": {
+ "type": "string"
+ }
+ },
+ "description": "All code changes were committed. A git hook adds Co-Authored-By and Change-ID trailers. The git user is already configured correctly."
}
}
}
@@ -540,24 +557,24 @@
Anthropic-Organization-Id: 3c473a21-7208-450a-a9f8-80aebda45c1b
Anthropic-Ratelimit-Input-Tokens-Limit: 2000000
Anthropic-Ratelimit-Input-Tokens-Remaining: 2000000
-Anthropic-Ratelimit-Input-Tokens-Reset: 2025-07-24T18:29:22Z
+Anthropic-Ratelimit-Input-Tokens-Reset: 2025-07-24T22:15:37Z
Anthropic-Ratelimit-Output-Tokens-Limit: 400000
Anthropic-Ratelimit-Output-Tokens-Remaining: 400000
-Anthropic-Ratelimit-Output-Tokens-Reset: 2025-07-24T18:29:26Z
+Anthropic-Ratelimit-Output-Tokens-Reset: 2025-07-24T22:15:42Z
Anthropic-Ratelimit-Requests-Limit: 4000
Anthropic-Ratelimit-Requests-Remaining: 3999
-Anthropic-Ratelimit-Requests-Reset: 2025-07-24T18:29:21Z
+Anthropic-Ratelimit-Requests-Reset: 2025-07-24T22:15:36Z
Anthropic-Ratelimit-Tokens-Limit: 2400000
Anthropic-Ratelimit-Tokens-Remaining: 2400000
-Anthropic-Ratelimit-Tokens-Reset: 2025-07-24T18:29:22Z
+Anthropic-Ratelimit-Tokens-Reset: 2025-07-24T22:15:37Z
Cf-Cache-Status: DYNAMIC
-Cf-Ray: 96457b868b1a17e4-SJC
+Cf-Ray: 9646c6f5691fce74-SJC
Content-Type: application/json
-Date: Thu, 24 Jul 2025 18:29:26 GMT
-Request-Id: req_011CRSKREDtTu6EhURJSoHyZ
+Date: Thu, 24 Jul 2025 22:15:42 GMT
+Request-Id: req_011CRScfwLXsX2Ug7WSdEZnN
Server: cloudflare
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Via: 1.1 google
X-Robots-Tag: none
-{"id":"msg_019AzMcwE57Xjjpv7Q8aUPZQ","type":"message","role":"assistant","model":"claude-sonnet-4-20250514","content":[{"type":"text","text":"Here are the tools available to me:\n\n**File & Code Management:**\n- `bash` - Execute shell commands\n- `patch` - Modify files with precise text edits\n- `keyword_search` - Search codebase by concepts/terms\n\n**Task Management:**\n- `todo_read` / `todo_write` - Track and manage task lists\n- `think` - Take notes and form plans\n\n**Development Workflow:**\n- `codereview` - Run automated code review\n- `done` - Complete tasks with verification checklist\n\n**Browser Automation:**\n- `browser_navigate` - Navigate to URLs\n- `browser_click` - Click elements\n- `browser_type` - Type into inputs\n- `browser_wait_for` - Wait for elements\n- `browser_get_text` - Read page text\n- `browser_eval` - Execute JavaScript\n- `browser_scroll_into_view` - Scroll to elements\n- `browser_resize` - Resize browser window\n- `browser_recent_console_logs` - Get console logs\n- `browser_clear_console_logs` - Clear console logs\n- `browser_take_screenshot` - Take screenshots\n\n**Utility:**\n- `read_image` - Read and encode image files\n- `about_sketch` - Get help with Sketch functionality"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":3,"cache_creation_input_tokens":4236,"cache_read_input_tokens":0,"output_tokens":298,"service_tier":"standard"}}
\ No newline at end of file
+{"id":"msg_01So9qajkJgERbHBwNUwEkmF","type":"message","role":"assistant","model":"claude-sonnet-4-20250514","content":[{"type":"text","text":"Here are the tools available to me:\n\n**File & Code Management:**\n- `bash` - Execute shell commands\n- `keyword_search` - Search for files/content in codebases\n- `patch` - Modify files with precise text edits\n\n**Task Management:**\n- `think` - Record thoughts and plans\n- `todo_read` / `todo_write` - Manage task lists\n- `done` - Mark completion with checklist verification\n\n**Development Workflow:**\n- `codereview` - Run automated code review\n- `about_sketch` - Get help with Sketch functionality\n\n**Browser Automation:**\n- `browser_navigate` - Navigate to URLs\n- `browser_click` / `browser_type` - Interact with elements\n- `browser_wait_for` / `browser_get_text` - Wait for and read content\n- `browser_eval` - Execute JavaScript\n- `browser_scroll_into_view` / `browser_resize` - Control viewport\n- `browser_take_screenshot` / `read_image` - Capture and read images\n- `browser_recent_console_logs` / `browser_clear_console_logs` - Access console output"}],"stop_reason":"end_turn","stop_sequence":null,"usage":{"input_tokens":3,"cache_creation_input_tokens":4142,"cache_read_input_tokens":0,"output_tokens":269,"service_tier":"standard"}}
\ No newline at end of file