fable-agent/PHASES/phase-13-state-repository.md

34 lines
1.1 KiB
Markdown

# Phase 13: State Repository
**Purpose:** Cross-session knowledge base — outcomes, patterns, insights accumulate.
**TS Module:** `src/tier3-compounding/state-repository.ts`
## What It Does
Records every meaningful event across sessions:
- Observations, insights, patterns, metrics, artifacts
- Tagged for fast retrieval
- Queryable by tag, type, time range, source, or minimum score
## Entry Types
| Type | Description | Example |
|------|-------------|---------|
| `observation` | Raw factual observation | "Model returned 429 on 3rd retry" |
| `insight` | Derived understanding | "Guidance scale > 12 causes oversaturation" |
| `pattern` | Recurring behavior | "First iteration always overfits" |
| `metric` | Numeric measurement | "Avg quality: 0.82 over 10 runs" |
| `artifact` | Produced work | "Session checkpoint at iteration 7" |
## Compaction
Old entries (>7 days) are summarized into compacted entries grouped by tag.
Keeps the knowledge base from growing unbounded while preserving signal.
## Usage
```bash
fable-agent state --stats
fable-agent state --tag <tag>
```