# ResearchState All research state lives in PostgreSQL (`packages/db/migrations/001_init.sql`), not in the model's context window. Sessions are resumable and replayable. ## Entities - **Session** — question, status (`pending → running → synthesizing → completed|failed`), objectives, budgets, final answer. - **Source** — every URL seen. `found → fetched|failed`. Fetched sources store up to 120k chars of markdown. `citation_index` is assigned mechanically at synthesis. - **Evidence** — verbatim quote from a source, attached to a claim with a stance (`supports | contradicts | context`). Quotes are soft-verified against stored content; unverified quotes get flagged in `note`. - **Claim** — falsifiable statement with status (`exploring | supported | contradicted | uncertain`) and confidence (0..1 probability). - **Contradiction** — first-class record of credible disagreement, referencing the conflicting evidence ids. ## Provenance chain `answer sentence → [n] marker → citation_index → source → evidence quotes → claims` Citation indices are derived mechanically from state (sources ordered by first evidence use). The synthesis model never invents numbering. ## Events Every mutation appends exactly one event row (`research_events`, monotonic `seq`). The event log is the replay/debug record: replaying a session's events from seq 0 reconstructs everything the user saw live.