Claude Code as a Local Agent
Claude Code is a local agent that operates on your file system and runs shell commands — without needing the Computer Use API. For most development and file-system automation tasks, Claude Code is faster, cheaper, and more reliable than full computer use.
What Claude Code Can Do Locally
Claude Code has four built-in tool capabilities:
- Read files: Read any file in your project directory — source code, config files, logs, data files
- Write files: Create new files or overwrite existing ones — generate code, update config, write reports
- Search: Search file contents (grep-like) and file names across the project tree
- Run shell commands: Execute any shell command and receive the output — run tests, build projects, install packages, call APIs via curl, interact with git
This is enough for most development automation tasks without any GUI interaction. If your task involves files, code, or the command line, Claude Code is the right tool — not the Computer Use API.
Claude Code vs Computer Use API
Use Claude Code when
- Task involves files, code, or shell commands
- No GUI interaction needed
- Speed matters — no screenshot round-trips
- Cost matters — text-only, no image tokens
- Interactive development session
Use Computer Use API when
- Task requires interacting with a GUI app
- Software has no API or CLI interface
- Web scraping of JavaScript-rendered pages
- Multi-step web form workflows
- Visual verification of rendered output
Multi-Step Local Automation
Claude Code can run multi-step automation loops autonomously. A typical pattern:
# Example task given to Claude Code:
"Run the test suite. For each failing test, find the
relevant source file, diagnose the issue, and apply a fix.
Then re-run the tests. Repeat until all tests pass or
you've made 5 fix attempts."
# Claude Code will:
# 1. Run: npm test (or pytest, etc.)
# 2. Read failing test output
# 3. Read the relevant source files
# 4. Write fixes
# 5. Run tests again
# 6. RepeatThis "test, fix, test again" loop is one of the most productive Claude Code use patterns. It works because the shell command output gives Claude precise, unambiguous feedback — unlike a screenshot of a GUI.
Setting Up Autonomous Tasks
For longer autonomous runs where you want minimal interruption:
- Write a clear task description in CLAUDE.md or the initial prompt — ambiguity leads to approval prompts
- Use
claude --dangerously-skip-permissionsfor fully autonomous runs (no approval prompts) — only in sandboxed environments - Use
claude --allowedTools Bash,Read,Writeto restrict which tools are available for the task - Pipe in the task:
echo "Your task here" | claude --dangerously-skip-permissions - For scripted automation, use the
--output-format jsonflag to parse Claude's final response programmatically
Approval Prompts: Controlling When Claude Acts
By default, Claude Code asks for approval before certain operations. The three permission responses:
- Allow: Execute this one action
- Allow always: Allow this tool/pattern for the rest of the session without prompting
- Deny: Block this action — Claude will adapt and find an alternative approach
Pre-approve expected operations in .claude/settings.json to reduce interruptions for common safe operations:
// .claude/settings.json
{
"permissions": {
"allow": [
"Bash(npm test)",
"Bash(npm run build)",
"Bash(git status)",
"Bash(git diff*)"
],
"deny": [
"Bash(git push*)",
"Bash(rm -rf*)"
]
}
}Checklist: Do You Understand This?
- Claude Code = local agent with read, write, search, and bash tools — no GUI, no screenshots, no Computer Use API
- Prefer Claude Code over Computer Use API for any task involving files, code, or shell commands
- Test-fix-test loop is a high-value pattern: run tests → read failures → fix source → repeat
- Autonomous mode:
--dangerously-skip-permissionsfor unattended runs (sandbox only) - Pre-approve safe operations in
settings.jsonto reduce approval prompts during development