The chronicle shipped in fly release v697 (commits f3cfaf2..b294ddc) and is backfilling in prod. Every phi run now gets [CHRONICLE], a summary of every episodic record since 2026-03-24. It is shaped like an LSM tree: recent records stay detailed and older spans fold into coarser entries. Two things are still open: confirm a live run actually receives the block, and decide whether the daily reflection should stay.
why #
All of phi's ambient context covered 48h or less: ops log, encounters, recent conversations, posting inventory. Atlas and docket are on-demand projections. She had 2,004 episodic records going back to 03-24 but saw them only when a query happened to recall one. The daily reflection had shrunk to chicken bookkeeping: over its last 16 runs it averaged ≤2 tool calls and posted once. The goal was always-on awareness of the long tail that doesn't drown out current context, and that uses the cheap DeepSeek context.
what shipped #
-
src/bot/memory/chronicle.py, stored in the private turbopuffer namespacephi-chronicle:- Flush: 30 episodic records, or any record 2 days old, become a level-1 entry of ≤120 words.
- Merge: a level with more than 4 entries merges its oldest 4 into one entry at the next level (≤160 words at L2, ≤200 above). Spans grow geometrically with age.
- Versioning (borrowed from Anthropic's Dreams): a merge writes the new entry and patches its inputs to
status=merged, merged_into=<id>in one write. Inputs are never rewritten and stay readable. - Tombstones: retired episodic rows are excluded. Superseded rows are marked as superseded in the prompt.
- Isolation: the summarizer (
chronicle_model, default DeepSeek v4.1 flash) sees only its inputs, never goals or ambient context. This is the residue lesson (42a5b23).
-
Poller:
_schedule_chroniclerunscompact()everychronicle_interval(600s, 0 disables), with at most 20 operations per tick and one task at a time. -
Agent: the
inject_chronicleblock is registered right after[GOALS], with a 5-minute cache invalidated on writes. -
Tool:
correct_chronicle(entry_id, correction)attaches a dated correction. It renders under the entry and overrides it in later merges. Risk is declaredlowinabilities.py. -
Docs:
system-prompt.md,memory.md(with a named feedback loop: a run that restates a chronicle claim writes it back into the stream),architecture.mdmodels table,architecture.jsonmemory node,CHANGELOG.md. -
Tests:
tests/test_chronicle.pycovers:- 2,000-record tiling with no gaps, ≤4 entries per level, and coarser entries with age;
- age-based flush;
- retired and superseded handling;
- corrections surviving merges;
- an empty summary writing nothing.
The full suite passes on every commit (
git rebase -x). Proving the tests caught a real bug: retired rows could shrink a page below the flush threshold, andread_rawnow paginates.
prod state at handoff (2026-11-03 ~08:25Z)
/healthhealthy on v697.- 8 active entries, levels
{1: 2, 2: 3, 3: 3}, covering 1,860 records from 03-24 to 10-26, with no overlaps. The rendered block is ~9k chars (~2.2k tokens). - The backfill should reach the tail within a few more ticks. After that it flushes about daily.
- A local dry run of the real summarizer on 11-01 to 11-02 records gave an accurate 120-word entry.
- Backfill cost is ~100 DeepSeek-flash calls, cents total.