Claude Code Agent
The Claude Code agent delegates your queries to Anthropic's Claude Code CLI, a locally installed tool that can read files, execute commands, and reason about infrastructure with full tool use capabilities.
Prerequisites
Install the Claude Code CLI:
npm install -g @anthropic-ai/claude-codeVerify the installation:
claude --versionYou also need a valid Anthropic API key or an active Claude Code subscription configured in your environment.
Usage
Single-Shot Queries
clanker ask --agent claude-code "list my running EC2 instances"Interactive Conversations
clanker talk --agent claude-codeThis starts a REPL session where Claude Code maintains context across turns:
$ clanker talk --agent claude-code
Claude Code Agent (interactive mode)
Type 'exit' or 'quit' to end the session.
you> What EC2 instances are running?
claude-code> [lists instances with details]
you> Which one has the highest CPU usage?
claude-code> [answers based on previous context]With AWS Context
When you have an AWS profile configured in ~/.clanker.yaml, Clanker automatically gathers infrastructure context and injects it into the prompt. This means Claude Code can reason about your live AWS environment without needing direct AWS SDK access.
clanker ask --agent claude-code --aws "analyze my security groups for overly permissive rules"Debug Mode
Enable debug output to see process lifecycle, tool calls, thinking steps, and cost information:
clanker ask --agent claude-code --debug "describe my infrastructure"Debug output includes:
- Claude Code CLI version
- AWS context gathering progress
- Tool calls (file reads, command execution)
- Thinking/reasoning steps
- Response duration and API cost
How It Works
When you use --agent claude-code, Clanker:
- Checks availability by running
claude --version. If the binary is not found, it returns an error with installation instructions. - Gathers AWS context (if an AWS profile is configured) by querying your live infrastructure and building a context string.
- Launches the Claude CLI with
--output-format stream-jsonfor streaming responses. - Parses streaming events including text chunks, tool calls, thinking blocks, and the final result.
- Displays the response with real-time streaming output.
For interactive talk mode, Clanker launches Claude Code with --input-format stream-json and --output-format stream-json, keeping the process alive across multiple turns.
Configuration
The Claude Code agent uses whatever authentication is configured for the claude CLI itself. Clanker does not pass API keys to Claude Code since it manages its own authentication.
You can configure the model used by Claude Code through the claude CLI's own settings. Refer to the Claude Code documentation for details.
Comparison with Other Agents
| Feature | Claude Code | Hermes |
|---|---|---|
| Tool use (file read/write, commands) | Yes (native) | Yes (via bridge) |
| Multi-turn conversations | Yes | Yes |
| AWS context injection | Yes | Yes |
| Code analysis | Excellent | Good |
| Infrastructure queries | Good | Good |
| Setup complexity | npm install -g | make setup-hermes |
| Underlying model | Claude (Anthropic) | Configurable (OpenAI, Anthropic, etc.) |
Troubleshooting
"claude CLI not found in PATH"
Install Claude Code:
npm install -g @anthropic-ai/claude-codeThen verify:
claude --versionAuthentication errors
Claude Code manages its own authentication. Run claude interactively to complete the login flow before using it as a Clanker agent.
Slow responses
Claude Code with --verbose and --output-format stream-json may include tool execution time. Use --debug to see where time is being spent.
See Also
- Agents Overview -- All available agents
- Hermes Agent -- Alternative agent with configurable AI providers
- ask -- Single-shot queries
- talk -- Interactive conversations