# Class LittleGhost::Harnesses::ClaudeCode

Documentation version: Edge

Canonical HTML: https://littleghostai.org/docs/LittleGhost/Harnesses/ClaudeCode.html

Runs Claude Code in non-interactive print mode with `--output-format
stream-json`.

The command uses `--bare`, so the tool ignores hooks, skills, and
settings found in the working directory, and `--strict-mcp-config`,
so it starts with only the request's `mcp_servers`, whose tools are allowed.
Automatic updates and nonessential traffic are disabled, and configuration
lives under `home`.

In `:isolated` mode the allowed tools run without permission
prompts and `ANTHROPIC_API_KEY` is the placeholder. In
`:native_guards` mode the command uses `--permission-mode
dontAsk`, so only the allowed tools run and everything else is denied;
the default list allows file and search tools and denies shell and web access.
Claude Code then authenticates from the inherited environment, such as
`ANTHROPIC_API_KEY`.

`defaults` accepts:

`:base_url`
:   Sets `ANTHROPIC_BASE_URL`, for example a Network::Facade address.

`:api_key`
:   Placeholder sent as `ANTHROPIC_API_KEY` in `:isolated` mode. A
    gateway replaces it.

`:model`
:   Model used when the request does not name one.

`:effort`
:   Effort level used when the request does not name one.

`:allowed_tools`, `:disallowed_tools`
:   Claude Code tool names. In `:isolated` mode the defaults allow
    file, search, shell, and subagent tools and disallow web access.

Claude Code enforces `budget_usd` and `max_turns` itself and reports cost,
turns, and token usage in its final result.

## Inheritance

`LittleGhost::Harnesses::ClaudeCode < LittleGhost::Harnesses::Base`

## Instance methods

<a id="method-i-command"></a>
### `#command`

```ruby
#command(request)
```

Returns the Claude Code command line for `request`.

<a id="method-i-environment"></a>
### `#environment`

```ruby
#environment(request)
```

Returns Claude Code's configuration and update settings, and in
`:isolated` mode its credential placeholder.

<a id="method-i-parse_line"></a>
### `#parse_line`

```ruby
#parse_line(line, state)
```

Parses one stream-json message.
