Expand description
Real-time “memory pipeline” event stream powering the TUI’s Activity tab.
Mirrors jcode’s MemoryEvent design: each retrieval / injection /
reinforcement emits a small typed record to a JSONL file at
$DIFFLORE_HOME/activity.jsonl. The TUI tail-reads this file and
renders the last N events so users SEE rules being recalled and
reinforced as their agent runs.
Why a JSONL file rather than an in-process channel: the MCP server, CLI fix command, and TUI run as separate processes. A file is the cheapest cross-process bus that survives a TUI restart and needs no daemon. Capped at 1000 lines via tail-rotation so it never grows without bound.
Structs§
- Activity
Event - One line in
activity.jsonl.kindis the discriminant; payload fields live alongside it (flat layout — easier for ad-hocjqinspection than a tagged enum).
Enums§
Constants§
- MAX_
EVENTS - Hard cap on retained events. When a write would exceed this, the
file is truncated to the last
MAX_EVENTS - 1lines plus the new one. Keeps the file readable incatand bounded on disk.
Functions§
- record
- Append
payloadto the activity log. Best-effort: any IO failure is swallowed so telemetry never breaks the caller. When the file would exceedMAX_EVENTSlines, rotates by tail-keeping the most recent. - record_
to - Test-friendly variant of
recordthat writes to an explicit path instead of$DIFFLORE_HOME/activity.jsonl. Production callers should userecord; tests use this to avoid a shared-env-var race against the workspace-wideshared_test_home(). - tail
- Read the last
nevents from disk, newest-first. Best-effort: a missing or unreadable file yields an empty Vec so the TUI can render an empty state without erroring. - tail_
from - Test-friendly variant of
tail.