Memory that compounds, not clutters — Hindsight for pi

feat: durable outbox and async recall #1

Merged crooy.tngl.sh
targeting main from durable-outbox-async-recall
Merged opened by and assigned to crooy.tngl.sh
targeting main from durable-outbox-async-recall
  • Retain writes every turn to ~/.hindsight/outbox as markdown with front-matter before POSTing. A 2xx deletes the file; a failure keeps it. Sync runs at session start (background), after each retain, and via /hindsight sync (forced). Per-file exponential backoff (1 min doubling, 1 h cap), 20 MB folder cap, sent-mark guard against double sends. See docs/adr/0001-durable-outbox-offline-first.md.
  • Recall runs in the background at before_agent_start and delivers memories with deliverAs nextTurn before turn two. Offline, auth, and rate-limit failures disable recall for the session through one RecallState enum and a shared disableRecall helper.
  • recall_max_tokens defaults to 800 client-side; config overrides it and an explicit 0 is honoured.
  • Standards cleanup from the review: shared authHeaders/memoryItem request builders, readOutboxMeta helper, single outbox retry-delay computation, syncOutbox options destructured, unused session field dropped. docs/design/2026-11-03-review-findings.md records the resolution of all spec and standards findings.
  • Tests: 23 outbox unit and wiring tests drive the real hooks with mocked pi/fetch; full ladder green (node simulations, 4 vitest files).
Commits 0