# Module LittleGhost::Harnesses

Documentation version: Edge

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

Harnesses run external coding-agent command-line tools, such as Claude Code,
Codex, and OpenCode, as bounded subprocesses: inside an isolating Sandbox with
the tool's own safeguards off, or on the host with them on.

Each harness builds the tool's non-interactive command line, reads its JSON
event stream, and returns one Harnesses::Result. Progress arrives as
`:harness` StreamEvent values while the tool works.

    harness = LittleGhost::Harnesses.resolve(:claude_code).new(
      sandbox: run.sandbox,
      executable: "/opt/harnesses/bin/claude",
      home_root: :scratch,
      defaults: {base_url: "http://127.0.0.1:3130"}
    )
    request = LittleGhost::Harnesses::Request.new(
      prompt: "Add a test for the refund policy lookup.",
      budget_usd: 2,
      max_turns: 40,
      timeout: 900
    )
    result = harness.run(request) { |event| puts event.data[:event][:kind] }
    result.status # => :completed

Built-in harnesses are registered as `:claude_code`,
`:codex`, and `:open_code`. Use Harnesses::Tool to let
an Agent delegate work to them. See the [Harnesses
guide](../harnesses.md).

## Class methods

<a id="method-c-names"></a>
### `.names`

```ruby
.names()
```

Registered harness names.

<a id="method-c-register"></a>
### `.register`

```ruby
.register(name, harness)
```

Registers `harness`, a Harnesses::Base subclass, under `name`. Registering an
existing name replaces it.

<a id="method-c-resolve"></a>
### `.resolve`

```ruby
.resolve(name)
```

Returns the harness class registered under `name`. Raises ConfigurationError
when no harness has that name.
