feat(tools): require reason argument for delete and git_operator tools

This commit is contained in:
asepharyana
2026-07-15 02:01:24 +07:00
parent 2af8432ce4
commit c6ab063c21
3 changed files with 27 additions and 16 deletions
+17 -14
View File
@@ -8,25 +8,27 @@ For complex multi-step tasks that would benefit from parallel analysis or
independent verification, use workflow_run to orchestrate sub-agents. independent verification, use workflow_run to orchestrate sub-agents.
Core tools: Core tools:
- read(path) — Read file contents. Use when you need to inspect code. - read(path, limit?) — Read file contents. Use when you need to inspect code.
- grep(pattern, path?) — Search for a pattern in files. - grep(pattern, path) — Search for a pattern in files.
- glob(pattern) — List files matching a glob pattern. - glob(pattern, path) — List files matching a glob pattern in a directory.
- write(path, content, reason) — Write content to a file. Reason is required. - write(path, content, reason) — Write content to a file. Reason is required (>= 8 chars).
- edit(path, old, new, replace_all?, reason) — Replace text in a file. Reason is required. - edit(path, old, new, replace_all?, reason) — Replace text in a file. Reason is required (>= 8 chars).
- delete(path) — Delete a file or empty directory. - delete(path, reason) — Delete a file or empty directory. Reason is required (>= 8 chars).
- bash(command) — Run a shell command. Use for builds, tests, git ops. - bash(command, description?, timeout?, run_in_background?) — Run a shell command.
- bash_output(job_id) — Poll output of a background bash job. - bash_output(job_id) — Poll output of a background bash job.
- bash_kill(job_id) — Kill a background bash job. - bash_kill(job_id) — Kill a background bash job.
- cd(path) — Change working directory. - cd(path) — Change working directory.
- dir_list(path) — List directory contents. - dir_list(path) — List directory contents.
- dir_cache_update() — Refresh the directory cache. - dir_cache_update(path) — Refresh the directory cache for a path.
- pong(message?) — Simple connectivity check. Echoes back the message. - pong(message?) — Simple connectivity check. Echoes back the message.
Git tools: Git tools:
- git_operator(args, confirm_destructive?) — Run git commands. Some destructive - git_operator(operation, args, reason) — Run git commands (e.g. add, commit, status,
operations (force-push, reset --hard, branch -D) require confirm_destructive=true. diff, log). Reason explaining the operation is required (>= 8 chars). Destructive
- git_worktree(args) — Manage git worktrees. operations (force-push, reset --hard, branch -D) are blocked by the shell filter.
- git_cred(operation) — Manage git credentials. - git_worktree(name, base_ref) — Manage git worktrees: create a new worktree
with a given name and base ref (branch or commit).
- git_cred(operation) — Manage git credentials (store, get, or erase).
Memory & Planning: Memory & Planning:
@@ -86,5 +88,6 @@ Language Server Protocol (LSP) tools:
LSP auto-provisioning runs at startup for Rust (rust-analyzer), TypeScript LSP auto-provisioning runs at startup for Rust (rust-analyzer), TypeScript
(typescript-language-server), Go (gopls), and Java (jdtls). (typescript-language-server), Go (gopls), and Java (jdtls).
Each write/edit call MUST include a non-empty reason argument explaining Each write/edit/delete/git_operator call MUST include a non-empty reason
why the change is being made. This is enforced deterministically. argument (>= 8 chars) explaining why the operation is being made. This is
enforced deterministically.
+5 -1
View File
@@ -28,9 +28,13 @@ impl Tool for Delete {
"path": { "path": {
"type": "string", "type": "string",
"description": "Path to the file or directory to delete (relative to workspace root)" "description": "Path to the file or directory to delete (relative to workspace root)"
},
"reason": {
"type": "string",
"description": "Reason for the deletion (must be non-empty, >= 8 chars)"
} }
}, },
"required": ["path"] "required": ["path", "reason"]
}) })
} }
+5 -1
View File
@@ -30,9 +30,13 @@ impl Tool for GitOperator {
"type": "array", "type": "array",
"items": {"type": "string"}, "items": {"type": "string"},
"description": "Arguments for the git subcommand" "description": "Arguments for the git subcommand"
},
"reason": {
"type": "string",
"description": "Explain why this git operation is needed (>= 8 chars)"
} }
}, },
"required": ["operation", "args"] "required": ["operation", "args", "reason"]
}) })
} }