1 · DISCOVER
Find terminal assigned runs
The harvester reads agent_runs, run_events, and the Thread’s immutable Container assignment.
Data model
Each Container has a developer-set stable ID unique inside its Project. A Thread can stay unassigned or bind once to one Container in the same Organization and Project.
Schema
| Table or field | Job | Key identity |
|---|---|---|
| learning_containers | Project-owned context and developer-facing identity | organization_id + project_id + stable id |
| threads.learning_container_id | Optional immutable Thread binding | same Organization + Project + Container |
| learning_runs | Queue and runner state | Organization + Project + Container + run |
| learning_run_snapshots | Derived immutable input identity | exact agent run + assigned Thread + digest |
| learning_run_snapshot_members | Frozen ordered run input | run + snapshot + scoped Container + ordinal |
| learning_insights | Cited Learning output | run + Container + evidence + Skill eligibility |
| learning_skills | Published or retired artifact | Container + source Insight + revision |
| learning_skill_insights | Full Skill provenance | Skill + every supporting Insight + ordinal |
Input contract
1 · DISCOVER
The harvester reads agent_runs, run_events, and the Thread’s immutable Container assignment.
2 · REDUCE
The canonical reducer reads events for that persisted agent run, not the Thread’s newer full history.
3 · DERIVE
Object storage receives content-addressed derived bytes. Postgres stores scoped metadata and SHA-256.
4 · FREEZE
The first attempt caps snapshots, active Insights, and published Skills at 500 each, then selects stable Insight and Skill prefixes that leave room for the first snapshot.
Budget
Container prompt text, active Insights, and published Skills share one token budget. The planner projects both semantic lists before packing snapshots and still rejects a fixed prompt that cannot fit on its own.
Provenance
Each Skill records its source Insight, change reason, immutable revision, published or retired state, and ordered links to all supporting Insights. Each Insight keeps Thread and message IDs for product review.