Authoritative record of which agents are live right now.

Agent registry (append-only log + marker cache)

Intent — An append-only registry, dual-written by every lifecycle tool, that is the authoritative record of which agents are in flight, so cleanup, tombstone, and merge decisions read a fact instead of guessing from filesystem timestamps.

SummaryAuthoritative record of which agents are live right now.
TargetAgent · Lifecycle & observability
Formobservability
EnforcementHard (deterministic) · signal/record — every lifecycle tool dual-writes; destructive-op gates query it before acting

Motivation — the failure it kills

With a fleet of concurrent agents living in worktrees, "which agents are live right now?" is the central question for every reclaim decision: cleanup, tombstoning, merge readiness. Answer it by scanning worktree directories and comparing mtimes and you get a heuristic that races with live agents: an agent mid-work can look identical to a stale one and have its worktree destroyed under it (the worktree-destruction-mid-flight incident). The failure is unsafe reclaim of live work, and it recurs on every cleanup pass.

Why it's not just "list the worktree dirs and check mtimes"

Directory-listing plus mtime is an inference about liveness, and it races: nothing in a timestamp tells you whether a process is still working. The registry is an authoritative append-only log that every lifecycle tool dual-writes (the JSONL record plus a fast per-agent marker cache), so "is this agent live?" becomes a lookup against a recorded fact, not a guess from the filesystem. The mtime heuristic is the alternative that fails, and it failed concretely: it destroyed in-flight work, which is why it was retired. A recorded fact cannot race the way an inferred one does.

Mechanism

The dispatch wrapper's prepare step dual-writes the JSONL registry and the per-agent marker cache at dispatch; lifecycle tools update both. cleanup-stale queries a three-gate chain (registry-gate, then marker-gate, then git-lock-gate) before removing anything. Tombstone and worktree-clean refuse to operate on an agent whose marker exists (the live-worktree guard). The registry is authoritative; the marker cache is a fast index that the registry wins over on any divergence.

Prerequisites

Consequences & costs

Known uses

Related mechanisms