> ## Documentation Index
> Fetch the complete documentation index at: https://docs.10et.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Training Buffer

> Capturing learning data from agent runs and sessions

The training buffer (`.tenet/training-buffer.jsonl`) captures every agent action and its outcome. This data trains the policy head and provides experiment history for future runs.

## Format

Each line is a training tuple:

```json theme={null}
{
  "id": "tb_eyJjb21wb3Np",
  "v": "1",
  "ts": "2026-03-22T21:30:00Z",
  "agent": "test-coverage",
  "state": {
    "composite_score": 0.1276,
    "dimension_scores": { "test_pass_rate": 1.0, "build_health": 1.0 },
    "tests_passing": 1414,
    "tests_total": 1414,
    "trajectory_length": 3,
    "recent_deltas": [0.0031, -0.0002],
    "agent": "test-coverage"
  },
  "action": {
    "type": "test",
    "description": "Add tests for claude-md-generator.ts",
    "files_affected": ["src/utils/__tests__/claude-md-generator.test.ts"],
    "scope": "medium",
    "branch": "session/test-coverage-4bc3ff95-2026-03-22"
  },
  "reward": {
    "composite_delta": 0.0031,
    "dimension_deltas": {},
    "tests_added": 48,
    "quality_score": 0.0,
    "improved": true
  }
}
```

## Data Sources

Tuples come from three sources:

| Source          | When                         | What                                  |
| --------------- | ---------------------------- | ------------------------------------- |
| **Agent runs**  | Each round                   | State, action, reward from eval delta |
| **Tuple miner** | Nightly pre-flight           | Extracts tuples from journal entries  |
| **Manual**      | `tenet_training_buffer` tool | Record observations during sessions   |

## Querying the Buffer

```bash theme={null}
# Total tuples
wc -l .tenet/training-buffer.jsonl

# Tuples by agent
jq -r '.agent' .tenet/training-buffer.jsonl | sort | uniq -c | sort -rn

# Recent improvements
jq 'select(.reward.improved == true)' .tenet/training-buffer.jsonl | tail -5
```

## Mining Tuples

The tuple miner extracts learning data from journals:

```bash theme={null}
# Mine from all sources
tenet eval mine --all

# Mine from specific source
tenet eval mine --source journals
tenet eval mine --source evals
tenet eval mine --source sessions
```

## Buffer Health

Check the nightly scorecard for buffer stats:

```bash theme={null}
bash eval/nightly-scorecard.sh
```

```
  Training Buffer
  ───────────────
    Total tuples:     2764
    Last 24h:         62 new tuples
    Reward distribution:
      test-coverage    +8 / -2 / =0  (80% positive)
      code-quality     +4 / -3 / =1  (50% positive)
```

## When Policy Head Retrains

The policy head retrains when the buffer has 50+ new tuples since last training. This happens automatically in the nightly loop, or manually:

```bash theme={null}
tenet train transform && tenet train policy-head --force
```
