# Class LittleGhost::Harnesses::State

Documentation version: Edge

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

Mutable progress that a harness parser records while reading one run's output.
Base#run creates one State per run and passes it to Base#parse_line and
Base#finalize; it is not shared across threads.

## Inheritance

`LittleGhost::Harnesses::State < Object`

## Attributes

<a id="attribute-i-cost_usd"></a>
### `cost_usd` (RW)

Reported spend in US dollars.

<a id="attribute-i-malformed_lines"></a>
### `malformed_lines` (RW)

Count of output lines that were not JSON objects.

<a id="attribute-i-model"></a>
### `model` (RW)

Model reported by the tool.

<a id="attribute-i-session_id"></a>
### `session_id` (RW)

Session identifier reported by the tool.

<a id="attribute-i-status"></a>
### `status` (RW)

Result status reported by the tool, overriding the exit code.

<a id="attribute-i-stop_reason"></a>
### `stop_reason` (RW)

The tool's own reason for stopping.

<a id="attribute-i-text"></a>
### `text` (RW)

The tool's latest or final answer text.

<a id="attribute-i-turns"></a>
### `turns` (RW)

Completed agent turns.

<a id="attribute-i-usage"></a>
### `usage` (RW)

Accumulated token counts as a LittleGhost::Usage.

<a id="attribute-i-values"></a>
### `values` (R)

Parser-specific scratch values.

## Class methods

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

```ruby
.new()
```

Builds empty progress.

## Instance methods

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

```ruby
#add_usage(**counts)
```

Adds token counts to #usage.
