Skip to content

Garry's Opinionated OpenClaw/Hermes Agent Brain

TypeScript

v0.60.43.0: CHANGELOG, TODOS and wave notes for the auto_chronicle fix wave (#5876)

garrytan9d461cea30f9
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 763cd33a9d..272cda9b60 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,112 @@ credits are retained; no result has been reassigned to another provider. Origina
identifiers and attribution are available in the pre-removal Git revision
`6040075c6cb95be5881cc2e1b76ef7d71f4e5d29` (retained on 2026-09-23).
+## [0.60.43.0] - 2026-10-04
+
+**Meeting notes, conversations and past calendar events turn into timeline events on their own again. Each page costs one paid chat call, capped at $0.25 per page and 200 calls a day. Turn it off with `gbrain config set auto_chronicle false`.**
+
+When you save a meeting, conversation or calendar page, gbrain reads it once with your chat model and writes what happened (the meeting, decisions, commitments) as timeline events, so `gbrain day 2026-09-28` can answer "what happened that day". The `auto_chronicle` setting promised this, but since v0.51 nothing read it, so new pages were never swept and only a manual backfill extracted events.
+
+This is now on by default, under the rule that new features ship on with a documented opt-out. **The default flipped without a measured live quality lift:** nobody has yet compared an agent with these events against one without them. The run below measures whether extraction is accurate and what it costs, not whether it makes answers better.
+
+### What it costs, and the limits
+
+| Limit | Default | Setting |
+| --- | --- | --- |
+| Per page | one chat call, capped at $0.25 | `chronicle.job_budget_usd` |
+| Per rolling 24 hours | 200 automatic calls | `chronicle.auto_daily_limit` |
+| Worst case | 200 x $0.25 = $50 a day | per-call cap times call count, not a daily budget |
+| Which pages | dated within the last 30 days | `chronicle.auto_recent_days` |
+| When | after the page stays unchanged for 3 minutes; invites only after they end | `chronicle.auto_settle_seconds` |
+
+On the measured run below a page cost about $0.003 with the default chat model. If gbrain has no price for your chat model, the per-page cap cannot apply: calls still run, warn, and stay limited by the daily count. A cap you set yourself refuses an unpriced model and tells the agent how to register the price. Pages already in the brain are not swept on upgrade.
+
+### How to use it
+
+```bash
+gbrain config set auto_chronicle false # opt out (unsetting the key means on)
+gbrain config set auto_chronicle true # keep it; clears the doctor/advisor notice
+gbrain dream --phase chronicle # run pending pages now (paid); autopilot runs them otherwise
+gbrain chronicle-backfill --since 2026-09-01 --limit 50 --dry-run # history: count + estimated cost
+gbrain chronicle-backfill --since 2026-09-01 --limit 50 --yes # only after the user agrees
+```
+
+`chronicle-backfill` now needs `--yes` to spend money; `--dry-run` shows the candidates, the estimated cost and why other pages are skipped.
+
+### Privacy
+
+Page text goes to your configured chat provider. Events from a private page are private: remote callers cannot see them in search, `get_page` or the `day`/`since`/`on-this-day` reads, and an event whose source page was renamed or purged is hidden from them too. Diary pages and dream output are never mined. Writers confined to a slug prefix or a delegated grant never trigger paid extraction.
+
+### Measured on a labeled fixture (two runs, default chat model `anthropic:claude-sonnet-4-6`)
+
+31 pages: 24 that should be extracted (16 meetings including one private, 6 conversations, 2 past calendar invites), 6 that must not be (a note, a person page, a diary entry, a dream summary, a too-short meeting, a concept page) and 1 future invite. 53 hand-labeled expected events.
+
+| | Run 1 | Run 2 |
+| --- | --- | --- |
+| Pages judged (one call each) | 24 | 24 |
+| Controls or future invite judged | 0 | 0 |
+| Events written | 54 | 52 |
+| Expected events found (recall) | 46/53 (87%) | 45/53 (85%) |
+| Wrong or not-yet-happened events | 4 (17% of judged pages) | 4 (17%) |
+| Duplicated events | 1 | 1 |
+| Recorded spend | $0.068 | $0.068 |
+| Wall time (writes + extraction) | 57 s | 56 s |
+
+The four wrong events per run come from two patterns: a planned future date mentioned in a past meeting written as an event (an offsite and a leave start date), and a launch plan in a chat written as if it happened. Both private-page events were stored private. Recall is lowest on short conversations (75-83%) and highest on meetings (87%). The deterministic `gbrain eval chronicle` scores 6/6 on both master and this release.
+
+### Things to watch
+
+- Every write receipt for a meeting, conversation or calendar page carries `chronicle_backstop`: `{ "pending": "next_cycle" }` or `{ "skipped": "<code>", "why": ..., "fix": ... }`. `docs/guides/life-chronicle.md` lists every code and its fix.
+- `gbrain doctor` (`auto_chronicle`) reports on/off, the last 24 hours against the daily limit, 7-day extracted/failed/skipped counts and spend, pending pages and which writers caused the calls. It also says when no chat provider is configured, in which case nothing runs.
+- Restart every `gbrain serve`, autopilot and worker after upgrading.
+
+Thanks to @andreineacsu for the design input on #5876 (where to hook extraction, and whether agent writes should trigger it).
+
+## To take advantage of v0.60.43.0
+
+`gbrain upgrade` should do this automatically. If it didn't, or `gbrain doctor` warns about a partial migration:
+
+1. **Run the orchestrator manually:**
+ ```bash
+ gbrain apply-migrations --yes --no-autopilot-install
+ ```
+ Schema migration v199 adds the `chronicle_page_state` ledger and the `chronicle_judge_reservations` table.
+2. **Your agent reads `skills/migrations/v0.60.43.0.md` the next time you interact with it.** It relays the cost, asks whether to keep the feature, and records the answer with `gbrain config set auto_chronicle true|false`.
+3. **Verify the outcome:**
+ ```bash
+ gbrain doctor --json | grep -A3 '"auto_chronicle"'
+ gbrain chronicle-backfill --limit 5 --dry-run
+ ```
+4. **If any step fails or the numbers look wrong,** please file an issue:
+ https://github.com/garrytan/gbrain/issues with:
+ - output of `gbrain doctor`
+ - contents of `~/.gbrain/upgrade-errors.jsonl` if it exists
+ - which step broke
+
+### Itemized changes
+
+#### Automatic extraction (#5876)
+- Every coordinated page publication that imports a page (`put_page`, `capture`, `edit_page`, `restore_page`, `revert_version`, managed sync and connector imports) records one `chronicle_page_state` row for the published content inside the publication transaction (`recordChronicleDecision`, `src/core/chronicle/ledger.ts`) and returns `chronicle_backstop` on the receipt. Ordinary notes get neither. `--no-extract` syncs, confined writers and grants without `extract_facts` skip with a reason.
+- New global `chronicle` cycle phase (`src/core/cycle/chronicle.ts`) executes settled rows round-robin across sources (at most 50 judged pages and a wall-time bound per run), so PGLite brains run extraction without a worker. Unmanaged brains are scanned directly; managed pages written before this release activated (`chronicle.activated_at`) are left to backfill (`no_write_decision`).
+- Each judge call runs in a `chronicle:auto` or `chronicle:backfill` BudgetTracker scope with the per-page cap and a post-call cap check, reusing the extract-atoms cost gate. The rolling daily limit is a reservation taken right before each automatic call (retries count), shared by every executor; backfill is exempt but bounded by its `--limit`.
+- Judge failures are failures: a provider error, truncation, unparseable output or a refusal is recorded as `judge_chat_error` / `judge_truncated` / `judge_parse_failed` / `judge_refused` (failed rows retry with backoff), never as `no_events`. A missing provider records `judge_llm_unavailable`.
+- Re-extraction retires the previous generation's automatic events (`retired_by: life-chronicle`) only after a complete new generation; events an operator edited or deleted are never touched.
+- Event pages carry the depth page's visibility; `search/private-visibility.ts` hides events whose `event.depth` origin is private or missing from remote callers.
+- `chronicle_extract` jobs queued by older releases drain through the same executor. The old `runChronicleBackstop` hook is removed.
+
+#### Settings and surfaces
+- `auto_chronicle` reads on when unset; `true/false/1/0/yes/no/on/off` are accepted, and any other word reads as off with doctor `auto_chronicle_invalid`. `gbrain config set` validates `chronicle.job_budget_usd` (0.01-10), `chronicle.auto_daily_limit` (1-10000), `chronicle.auto_recent_days` (1-3650), `chronicle.auto_settle_seconds` (0-86400) and `chronicle.judge_max_tokens` (1-128000) and refuses unknown `chronicle.*` keys.
+- One reason table, `src/core/chronicle/reasons.ts` (`CHRONICLE_REASONS`: stage, meaning and a fix Action with argv, preview argv, consent and actor); receipts, doctor, advisor, the guide's table and tests render from it. `auto_chronicle_off` has no fix: it is off by choice.
+- Doctor `auto_chronicle` replaces the wave-8 "has no effect" warning with a real health signal; new `chronicle_config_invalid` check; doctor and the advisor show `auto_chronicle_default_on` (ask the user) until `config set auto_chronicle` answers it. A one-shot post-upgrade notice says the same.
+- `gbrain chronicle-backfill`: `--yes` required for paid runs, `--dry-run` reports `estimated_usd` and skip reasons, one global `--limit` across types and sources, `--dated-since` filters on the page's own date, `--recent` applies the automatic window, and the rescue prefixes (`meetings/`, `conversations/`, `cal/`, `calendar/`) are scanned regardless of type. The ledger, not job idempotency keys, records what was extracted, so `gbrain jobs prune` never causes a second payment.
+- New guide `docs/guides/life-chronicle.md`; `troubleshooting.md#auto_chronicle-has-no-effect` now points to it; `skills/meeting-ingestion/SKILL.md` tells the agent to check the receipt and never hand-write `life/events/`.
+
+#### Schema
+- Migration v199 `chronicle_page_state` (keyed by source, page, content hash and extractor version) and `chronicle_judge_reservations`.
+
+#### Tests
+- `test/chronicle-auto-{decision,phase,unmanaged}.test.ts`, `test/chronicle-event-privacy.test.ts`, `test/chronicle-backfill.test.ts`, `test/chronicle-reasons-5876.test.ts`, `test/chronicle-config-5876.test.ts`, `test/chronicle-upgrade-notice-5876.test.ts`, `test/auto-chronicle-surfaces-5876.test.ts`, with Postgres arms in `test/e2e/chronicle-*-postgres.test.ts`.
+
## [0.60.41.0] - 2026-10-04
**A keyword-only `query` whose answer is in the top five now grades `moderate` again when the question merely uses a word the brain never writes, while questions about a missing attribute or an unknown company still grade `weak` (#5919). Conversation pages can set their own segmentation gap (#5918).**
diff --git a/TODOS.md b/TODOS.md
index 42d047d839..8f21b550ed 100644
--- a/TODOS.md
+++ b/TODOS.md
@@ -1,5 +1,26 @@
# TODOS
+## auto_chronicle wave follow-ups (filed 2026-10-04, follow-up from v0.60.43.0, #5876)
+
+- [ ] **P1 — facts-backstop jobs have no executor on PGLite.**
+ **What:** `facts_backstop` effects enqueue jobs that `gbrain jobs work` refuses to run on PGLite (`commands/jobs/work.ts`), the same root cause the chronicle cycle phase fixed for events. **Fix:** run them from a cycle phase or the inline drain, bounded per run. **Effort:** M. **Priority:** P1.
+- [ ] **P2 — Drop future-dated events extracted from past pages.**
+ **What:** the measured run wrote 2 not-yet-happened events per 24 judged pages (a planned offsite date and a leave start date mentioned in past meetings) and 2 events for a launch plan stated in a chat. **Fix:** refuse proposals dated after the extraction time (or after the page's own date plus a margin) before publication, and tell the judge prompt to emit only what already happened; re-measure on the labeled fixture described in `docs/fix-wave-notes/capy-fix-wave-chronicle.md`. **Effort:** S. **Priority:** P2.
+- [ ] **P2 — Event slug identity collapses distinct same-day proposals.**
+ **What:** an event slug hashes who, what and the depth page, so two different proposals with the same summary on one day collapse into one event (`publish.ts` `buildChronicleEvent`). **Effort:** S. **Priority:** P2.
+- [ ] **P2 — Restore retired events on revert without a model call.**
+ **What:** A to B to A re-extracts A once (at most `chronicle.job_budget_usd`). A durable proposal manifest that survives the 72 h tombstone purge would restore A's events for free. **Effort:** M. **Priority:** P2.
+- [ ] **P2 — Deterministic projection for calendar invites.**
+ **What:** an ended invite costs a chat call although its event (title, time, attendees) is fully structured. Project it without the model; an ended invite is still not proof of attendance. **Effort:** M. **Priority:** P2.
+- [ ] **P2 — Register `chronicle_skipped` with the agent-operator contract.**
+ **What:** once the agent-operator wave is on master, swap `ChronicleAction`/`ChronicleEffect`/`ChronicleActor` (`src/core/chronicle/reasons.ts`) for its `Action`/`Effect`/`Actor`, move the doctor `auto_chronicle` decisions and readiness to its helpers, and register `chronicle_skipped` with the `CHRONICLE_REASONS` codes as its reasons in `src/core/error-registry.ts` (plus `NOTICE_CODES` for `auto_chronicle_default_on` if it becomes a notice). **Effort:** S. **Priority:** P2.
+- [ ] **P3 — One LLM pass for atoms and events on meeting pages.**
+ **What:** a meeting page pays for atom extraction and event extraction separately. **Effort:** M. **Priority:** P3.
+- [ ] **P3 — Judge input beyond 12,000 characters.**
+ **What:** long transcripts are truncated to 12,000 characters before the judge reads them; later events are never seen. **Fix:** chunk and merge, bounded by the per-page cap. **Effort:** M. **Priority:** P3.
+- [ ] **P3 — One doctor surface for derived extraction.**
+ **What:** facts, atoms, conversation facts and events each report health in their own doctor check. **Effort:** M. **Priority:** P3.
+
## Foundations 1 follow-ups (filed 2026-10-03, follow-up from v0.60.37.0)
- [ ] **P1 — Mutation attribution for the writers still unattributed.**
diff --git a/docs/fix-wave-notes/capy-fix-wave-chronicle.md b/docs/fix-wave-notes/capy-fix-wave-chronicle.md
new file mode 100644
index 0000000000..6028c0d095
--- /dev/null
+++ b/docs/fix-wave-notes/capy-fix-wave-chronicle.md
@@ -0,0 +1,132 @@
+# auto_chronicle fix wave notes (`capy/fix-wave-chronicle`, v0.60.43.0, #5876)
+
+One integrated PR. Two lanes were built in parallel on master v0.60.39.0
+(`f4739fff`) and merged here, in order, on top of master v0.60.41.0:
+
+- Lane 1, core (`capy/chronicle-lane-core`): the `chronicle_page_state` ledger
+ and write-time decision, the global `chronicle` cycle phase, the per-page
+ budget scope, judge failure classes, publication with snapshot re-validation,
+ event privacy lineage and generation reconciliation.
+- Lane 2, surfaces (`capy/chronicle-lane-surfaces`): config keys and
+ validation, doctor and advisor, the reason table and receipt field, the
+ upgrade notice and migration skill, the guide and docs, backfill CLI changes.
+
+The architecture is the approved cycle phase plus durable ledger. There is no
+effects-queue kind, no dispatcher and no legacy import hook; the old
+`runChronicleBackstop` is deleted.
+
+## Integration decisions
+
+1. **One reason table.** `src/core/chronicle/reasons.ts` (`CHRONICLE_REASONS`,
+ stored fix Actions, never a stored next command) is the only table.
+ `chronicleReceipt` in `ledger.ts` delegates to `chronicleBackstopReceipt`.
+ `contract.ts` lost its duplicate table, its `next_command`/`ask_user`
+ strings and the config keys and defaults that `config.ts` owns. Added the
+ Lane 1 code Lane 2 lacked: `already_extracted`. `auto_chronicle_off` has no
+ fix (off by choice). An invalid `auto_chronicle` word now records
+ `auto_chronicle_invalid` (which has a fix) instead of `auto_chronicle_off`.
+ The phase's no-chat-provider result carries the table's fix Action instead
+ of a hand-written command.
+2. **Config.** Lane 2's bounded `chronicle/config.ts` (ranges enforced by
+ `config set`, malformed rows listed in `invalid`), so runtime and doctor
+ read the same values.
+3. **Ledger stub removed.** `test/helpers/chronicle-ledger-stub.ts` is gone. The
+ surface tests seed rows on the real migration through
+ `test/helpers/chronicle-ledger-rows.ts`, which creates a real page per row so
+ the ledger's foreign keys hold.
+4. **Migration skill** renamed to `skills/migrations/v0.60.43.0.md`.
+5. **KEY_FILES** chronicle entry merged from both lanes.
+6. **Tests.** Lane 1's tests that stayed red until Lane 2 replaced the old
+ no-effect check pass after the merge. `test/auto-chronicle-no-effect-5876.test.ts` is deleted;
+ `test/auto-chronicle-surfaces-5876.test.ts` replaces it. The only remaining
+ mention of the old file is the wave 8 notes, which record what wave 8 did.
+7. **Agent-operator contract.** The agent-operator wave is not on master yet, so
+ Lane 2's stand-ins stay (`ChronicleAction`, `ChronicleEffect`,
+ `ChronicleActor` in `reasons.ts`; doctor `auto_chronicle`'s inline
+ `readiness`/`ask_user` details). TODOS.md lists the swap.
+8. **Migration number.** Lane 1's placeholder v198 collided with master's v198
+ (`publication_failure_detail`); the ledger is migration v199.
+
+## Measured run (C9/C15)
+
+Fixture: 31 pages written through `put_page` on a managed PGLite brain with the
+feature at its default (on), `chronicle.auto_settle_seconds 0`, the default chat
+model `anthropic:claude-sonnet-4-6`, then the `chronicle` phase run until
+nothing was pending. Pages:
+
+- 24 eligible: 16 meetings (one `visibility: private`), 6 conversations, 2
+ calendar invites under `calendar/` whose end time had passed.
+- 6 controls that must never be judged: a note, a person page, a diary page, a
+ `dream_generated` meeting, a meeting under 80 characters, a concept page.
+- 1 calendar invite that ends 16 days in the future.
+
+Each eligible page carries hand-written expected events (53 in total), each with
+a date and a set of keywords. An extracted event matches an expected event when
+its day equals the expected date and its summary contains one of the keywords;
+matching is a maximum bipartite matching per page. Unmatched extracted events
+were then reviewed by hand: dated after the run day is premature; a plan stated
+as if it happened is false; a second event for an already matched occurrence is
+a duplicate; a true event the labels did not list is supported.
+
+| | Run 1 | Run 2 |
+|---|---|---|
+| Receipts | 24 `pending`, 1 `not_yet_happened`, 1 `dream_generated`, 1 `too_short`, 4 without the field | same |
+| Judged calls | 24 (each eligible page once) | 24 |
+| Controls or the future invite judged | 0 | 0 |
+| Events written | 54 | 52 |
+| Recall (matched / expected) | 46/53 = 86.8% | 45/53 = 84.9% |
+| False | 2 | 2 |
+| Premature | 2 | 2 |
+| False + premature, share of judged pages | 4/24 = 16.7% | 4/24 = 16.7% |
+| Duplicates | 1 | 1 |
+| Supported but unlabeled | 3 | 2 |
+| Recorded spend | $0.0684 | $0.0679 |
+| Unpriced calls | 0 | 0 |
+| Wall time (writes + 4 phase runs of at most 8 pages) | 57.3 s | 55.8 s |
+
+By page class: meetings recall 34/39 in both runs with 2 premature events
+(16 pages); conversations recall 10/12 and 9/12 with 2 false events (6 pages,
+both from one chat about a launch plan); calendar invites 2/2 with none wrong.
+Both events of the private meeting were stored `visibility: private`.
+
+Gate: false + premature must stay at or under 20% of judged pages, and recall at
+or above 60%. Both runs pass (16.7%, 85-87%), so the automatic path was not
+narrowed. Counting the duplicate as well gives 5/24 = 20.8%. The four wrong
+events come from two patterns, filed in TODOS.md: a future date mentioned in a
+past meeting becomes an event, and a plan in a chat is written as if it
+happened. Total provider spend for the measurement: $0.136.
+
+`gbrain eval chronicle` (deterministic, 6 tasks): 6/6 on master `101799f1f`
+and 6/6 on this branch.
+
+No live OFF-vs-ON quality comparison was run; the default is on by the
+default-on rule, not by a measured lift.
+
+## Gate
+
+Recorded in the PR body with the final branch SHA.
+
+## For the agent-operator wave
+
+When the agent-operator wave lands on master:
+
+- Replace `ChronicleAction`, `ChronicleEffect` and `ChronicleActor`
+ (`src/core/chronicle/reasons.ts`) with `Action`, `Effect` and `Actor` from
+ `src/core/agent-output.ts`; the field names already match.
+- Doctor `auto_chronicle` (`src/commands/doctor/checks/auto-chronicle.ts`):
+ move `readiness: 'disabled_by_choice'` and the `auto_chronicle_default_on`
+ `ask_user` decision (keep: `gbrain config set auto_chronicle true`; opt out:
+ `gbrain config set auto_chronicle false`) onto its readiness and decision
+ helpers.
+- Register `chronicle_skipped` in `src/core/error-registry.ts` `CODES` with
+ `reasons` = the `CHRONICLE_REASONS` keys: `auto_chronicle_off`,
+ `auto_chronicle_invalid`, `slug_bound_client`, `operation_bound_client`,
+ `no_extract`, `history`, `not_yet_happened`, `too_short`, `dream_generated`,
+ `no_write_decision`, `not_chronicle_shaped`, `already_extracted`,
+ `superseded`, `daily_limit`, `judge_llm_unavailable`, `no_pricing`,
+ `budget_exhausted`, `judge_chat_error`, `judge_truncated`,
+ `judge_parse_failed`, `malformed_proposal`, `publish_error`,
+ `judge_refused`, `page_missing`, `no_events`, `no_chat_provider`.
+- If the post-upgrade notice and the advisor's `auto_chronicle_default_on`
+ become notices, add `auto_chronicle_default_on` to `NOTICE_CODES`.
+- Then run `bun run build:error-codes` and `bun run check:agent-contract`.