Persist ACP notifications to a per-session event log #135

Closed
opened 2026-09-03 10:36:15 +01:00 by naps62-yolo · 0 comments
Collaborator

Every session/update notification the adapter sends is appended to
<sidecar_dir>/<id>.events.jsonl before it is broadcast, one JSON object per
line, seq being the line's position. The log is the source of truth for the
transcript; the live broadcast is a convenience.

This is what makes the restart story acceptable while the agent is still a daemon
child: the process dies, the conversation does not. Reopening the session reads
the log, and a respawn calls session/load with the stored ACP session id.

SidecarStore already owns the directory (crates/maestro-daemon/src/sidecar.rs)
— extend it rather than introducing a second store. delete removes the log along
with the sidecar. load_all ignores .jsonl files.

Reads take a since cursor (forward, for a client catching up) and a before
cursor (backward, for paging history without folding the whole log before first
paint). A malformed line is skipped, not fatal — a log truncated by a hard kill
must still open.

Non-goal: retention or compaction. Logs grow; a session's log dies with the
session.

Depends on: #134

Every `session/update` notification the adapter sends is appended to `<sidecar_dir>/<id>.events.jsonl` **before** it is broadcast, one JSON object per line, seq being the line's position. The log is the source of truth for the transcript; the live broadcast is a convenience. This is what makes the restart story acceptable while the agent is still a daemon child: the process dies, the conversation does not. Reopening the session reads the log, and a respawn calls `session/load` with the stored ACP session id. `SidecarStore` already owns the directory (`crates/maestro-daemon/src/sidecar.rs`) — extend it rather than introducing a second store. `delete` removes the log along with the sidecar. `load_all` ignores `.jsonl` files. Reads take a `since` cursor (forward, for a client catching up) and a `before` cursor (backward, for paging history without folding the whole log before first paint). A malformed line is skipped, not fatal — a log truncated by a hard kill must still open. Non-goal: retention or compaction. Logs grow; a session's log dies with the session. Depends on: #134
naps62-yolo added this to the Structured view milestone 2026-09-03 10:36:15 +01:00
naps62-yolo added the area/daemondifficulty/mediumtype/feat labels 2026-09-03 10:36:15 +01:00
naps62-yolo added a new dependency 2026-09-03 10:36:29 +01:00
naps62-yolo added a new dependency 2026-09-03 10:36:29 +01:00
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Reference: naps62/maestro#135