## Decisions


## decisions.mine()


Mine every `AskUserQuestion` decision round under `root`.


Usage

``` python
decisions.mine(root)
```


Walks the transcript tree at `root` -- one `*.jsonl` per session -- and lifts every typed round into a [DecisionRow](decisions.md#cc_steer.decisions.DecisionRow), keyed by the transcript's stem as the session id. Uses whose result predates the typed lift are quarantined, never dropped.


#### Parameters


`root: Path`  
The transcript directory to mine, for example a corpus mirror or `~/.claude/projects`.


#### Returns


<a href="decisions.html#cc_steer.decisions.MineResult" class="gdls-link gdls-code"><code>MineResult</code></a>  
The mined rows and the quarantined uses.


## decisions.DecisionRow


One `AskUserQuestion` round: the question, its options, and the user's pick.


Usage

``` python
decisions.DecisionRow(
    id,
    session_id,
    occurred_at,
    turn_index,
    event_uuid,
    tool_use_id,
    question,
    header,
    options,
    multi_select,
    answer,
    chosen_index,
    is_custom,
    split
)
```


#### Attributes


`id: str`  
The round's stable content id (session, event, tool use, and round index hashed), the parquet dedup key.

`session_id: str`  
The session the round was mined from.

`occurred_at: str`  
ISO-8601 timestamp of the assistant turn that asked.

`turn_index: int`  
The turn the round fired in -- the anchor into the session.

`event_uuid: str`  
The uuid of the asking assistant event, the precise anchor.

`tool_use_id: str | None`  
The `AskUserQuestion` tool-use block id, or None.

`question: str`  
The prompt text shown to the user.

`header: str | None`  
The round's short header, or None when the ask omitted one.

`options: tuple[str, …]`  
The offered option labels, in presentation order, verbatim (a trailing `" (Recommended)"` is kept).

`multi_select: bool`  
Whether the round accepted more than one selection.

`answer: str | None`  
The user's pick, verbatim -- the raw answer string the platform recorded (joined labels and/or custom text), or None when unanswered.

`chosen_index: tuple[int, …]`  
The `options` indices the user selected, in pick order; empty when the pick was entirely off-menu or the round was unanswered.

`is_custom: bool`  
Whether the answer carried free-typed text beyond the offered options -- the user went off-menu.

`split: str`  
The deterministic session-hash split (`train`/`test`).


#### Methods

| Name | Description |
|----|----|
| [from_record()](#cc_steer.decisions.DecisionRow.from_record) | Rebuild a row from one decisions-parquet record. |
| [to_record()](#cc_steer.decisions.DecisionRow.to_record) | The row as an Arrow-writable mapping, tuples lowered to lists. |


##### from_record()


Rebuild a row from one decisions-parquet record.


Usage

``` python
from_record(record)
```


##### to_record()


The row as an Arrow-writable mapping, tuples lowered to lists.


Usage

``` python
to_record()
```


## decisions.MineResult


The mined decision rows and the quarantined, un-typed uses.


Usage

``` python
decisions.MineResult(rows, quarantined)
```


#### Attributes


`rows: tuple[`<a href="decisions.html#cc_steer.decisions.DecisionRow" class="gdls-link gdls-code"><code>DecisionRow</code></a>`, …]`  
One [DecisionRow](decisions.md#cc_steer.decisions.DecisionRow) per typed decision round.

`quarantined: tuple[`<a href="decisions.html#cc_steer.decisions.Quarantine" class="gdls-link gdls-code"><code>Quarantine</code></a>`, …]`  
One [Quarantine](decisions.md#cc_steer.decisions.Quarantine) per `AskUserQuestion` use whose result predates the typed lift.


## decisions.Quarantine


An `AskUserQuestion` use whose result carries no typed rounds.


Usage

``` python
decisions.Quarantine(session_id, event_uuid, tool_use_id, result_type)
```


#### Attributes


`session_id: str`  
The session the use was mined from.

`event_uuid: str`  
The uuid of the asking assistant event.

`tool_use_id: str | None`  
The `AskUserQuestion` tool-use block id, or None.

`result_type: str`  
The result type that displaced the typed round, e.g. `TextResult` (a rejection), `OtherResult`, or `NoneType` (never answered).


## decisions.write_decisions()


Write the mined rows to `out` as parquet, stamping the digest and quarantine count.


Usage

``` python
decisions.write_decisions(result, out)
```


The order-invariant `~cc_steer.retrain.data.dataset_digest()` and the quarantine count ride in the parquet schema metadata, so a later [read_decisions()](decisions.md#cc_steer.decisions.read_decisions) reads the receipt back off the file itself.


#### Returns


`DatasetDigest`  
The dataset digest stamped into the file.


## decisions.read_decisions()


Read a decisions parquet back into rows, its digest, and its quarantine count.


Usage

``` python
decisions.read_decisions(path)
```


## decisions.stats_of()


Aggregate mined rows into the counts the `decisions stats` command prints.


Usage

``` python
decisions.stats_of(rows, *, quarantined)
```


## decisions.DecisionStats


Aggregate counts over a decisions dataset.


Usage

``` python
decisions.DecisionStats(total, by_split, multi_select, custom, quarantined)
```


#### Attributes


`total: int`  
The number of mined decision rounds.

`by_split: Mapping[str, int]`  
Round counts keyed by split, descending.

`multi_select: int`  
Rounds that accepted more than one selection.

`custom: int`  
Rounds whose answer went off-menu.

`quarantined: int`  
`AskUserQuestion` uses that carried no typed rounds.


#### Methods

| Name | Description |
|----|----|
| [render()](#cc_steer.decisions.DecisionStats.render) | The human-readable summary the `decisions stats` command prints. |
| [to_dict()](#cc_steer.decisions.DecisionStats.to_dict) | Serializes the stats to a JSON-ready dictionary. |


##### render()


The human-readable summary the `decisions stats` command prints.


Usage

``` python
render()
```


##### to_dict()


Serializes the stats to a JSON-ready dictionary.


Usage

``` python
to_dict()
```
