daemon: durable per-host spawn history + recent-dirs query #24

Closed
opened 2026-06-20 14:38:57 +01:00 by naps62-yolo · 0 comments
Collaborator

Durable source for the spawn form's "recent working dirs" picker. Sidecars are deleted on kill, so they can't be the history source — use an append log.

Storage

New daemon module spawn_history, JSONL at <state_dir>/spawn-history.jsonl, one record per successful spawn:

{ "cwd": "/home/u/git/maestro", "command": "claude",
  "name": "neon-drifter", "worktree_branch": null,
  "at": "2026-06-20T10:00:00Z" }
  • Write: SessionManager::create appends after a successful spawn. Best-effort — a log-write failure must never fail the spawn.
  • Read/dedup: recent_dirs() folds newest-first, dedups by cwd, drops entries older than the recency cap, caps result count.
  • Prune: opportunistic on read; compaction rewrites the file past a size threshold.
  • Cap config: [daemon].spawn_history_days (default 30, 0 disables history).

Tests

Unit tests over a temp state dir: append, dedup-by-cwd newest-first, recency-cap prune, compaction.


Part of #21 (spawn dialog rework).

Durable source for the spawn form's "recent working dirs" picker. Sidecars are deleted on kill, so they can't be the history source — use an append log. ### Storage New daemon module `spawn_history`, JSONL at `<state_dir>/spawn-history.jsonl`, one record per successful spawn: ```jsonc { "cwd": "/home/u/git/maestro", "command": "claude", "name": "neon-drifter", "worktree_branch": null, "at": "2026-06-20T10:00:00Z" } ``` - **Write:** `SessionManager::create` appends after a successful spawn. Best-effort — a log-write failure must never fail the spawn. - **Read/dedup:** `recent_dirs()` folds newest-first, dedups by `cwd`, drops entries older than the recency cap, caps result count. - **Prune:** opportunistic on read; compaction rewrites the file past a size threshold. - **Cap config:** `[daemon].spawn_history_days` (default 30, `0` disables history). ### Tests Unit tests over a temp state dir: append, dedup-by-cwd newest-first, recency-cap prune, compaction. --- Part of #21 (spawn dialog rework).
naps62-yolo self-assigned this 2026-06-20 21:48:39 +01:00
This repo is archived. You cannot comment on issues.
1 Participants
Due Date
No due date set.
Reference: naps62/maestro#24