Skip to content

Claude Code

Shiba supports Claude Code as a first-class coding agent harness. When selected, the orchestrator delegates the approved task to a Cloudflare Sandbox container running Anthropic’s official claude CLI.

Claude Code is the default agent for tasks originated from Slack mentions and Telegram chats, providing high reasoning capability and fluid multi-turn code refactoring.

Attribute Specification
Harness ID claude-code
CLI Binary claude
Pinned Version 2.1.277 (in Dockerfile)
Default Model anthropic/claude-sonnet-4-6
Supported Models anthropic/claude-sonnet-4-6, anthropic/claude-3-7-sonnet-20250219, anthropic/claude-3-5-haiku-20241022
Credential Model AI Gateway BYOK (dummy key inside sandbox; real key injected at egress)
Invocation claude -p "<task>" --print --output-format stream-json --dangerously-skip-permissions
Developer Request
└── CodingOrchestrator generates delegate_coding_task({ harness: "claude-code" })
└── Human signs off on exact prompt & repository
└── Ephemeral Cloudflare Sandbox boots
├── Clones repository via scoped git token
├── Executes: claude -p "<task>" --output-format stream-json
├── Streams newline-delimited JSON events back to Dashboard/Slack
└── Produces unified diff & optional pull request

You can configure Claude Code globally across your deployment or select it on a per-task basis.

1. Configure the Provider Key in AI Gateway

Section titled “1. Configure the Provider Key in AI Gateway”

Store your Anthropic API key in your Cloudflare AI Gateway under the provider ID anthropic. The Sandbox runtime provides a dummy key to the container environment, while Worker egress replaces it with the authentic key on calls to api.anthropic.com.

Set your preferred harness and model defaults in apps/backend/wrangler.jsonc or via environment variables:

Terminal window
# Use Claude Code as the deployment-wide default harness
pnpm wrangler secret put AGENT_HARNESS # enter "claude-code"
# Set the default Anthropic model
pnpm wrangler secret put CLAUDE_CODE_MODEL # enter "anthropic/claude-sonnet-4-6"

Slack and Telegram can independently pin their agent harness:

  • SLACK_AGENT_HARNESS=claude-code
  • TELEGRAM_AGENT_HARNESS=claude-code

When delegating from the API, dashboard, or chat triggers, specify harness: "claude-code":

{
"repoUrl": "https://github.com/acme/backend",
"task": "Migrate database connection pool to PgBouncer syntax",
"baseBranch": "main",
"harness": "claude-code",
"codingModel": "anthropic/claude-sonnet-4-6"
}

Claude Code emits newline-delimited JSON envelopes via --output-format stream-json. The Shiba runtime parses each event in real time:

  • Tool invocations (file reads, bash commands, edits) are extracted and displayed in the run transcript.
  • Any envelope carrying is_error: true is treated as an immediate failure and surfaced honestly with the provider’s exact error message.
  • Clean completion triggers git status collection, index-to-add staging, and diff computation.