Code inventory ยท 8 November 2026

Implicit state machines

AUT remembers what happened so it can attribute work, resume delivery, and decide what to run next.

Source a46470cScope Python application and packagingStatus Static analysis, human review pending

What the code shows

52 entries in 11 families. Entries include nested machines, shared protocols, and two systems with named business states. They are not independent processes.

What counts here

A state machine remembers prior events and uses that memory to change how it handles the next event.

The state names below are descriptive unless the source already names them. A row can describe an extended state machine with counters, timestamps, or sets.

Ordinary arithmetic, pure classifiers, raw counters, and generic runtime internals are excluded. Simple caches appear only where their state affects retries, attribution, or resource use.

1. Delivery and durable state

Rows reach storage through a sequence of acknowledgements. A saved offset means delivery has already returned.

1.2 Collector drain loop

State
Watermark before pass; changed watermark; unchanged watermark; pass cap.
Transitions
Re-run collection when serialized state changes. Stop at a fixed point or MAX_DRAIN_PASSES.
Boundary
The caller must execute callbacks before requesting another pass. Full-scan collectors finish after one unchanged pass.

collectors/__init__.py:61 ยท drain

1.3 Transport delivery protocol

State
Usage undelivered; webhook delivered; remaining rows delivered; fallback delivered; failed.
Transitions
Webhook success sends session, activity, and time rows through PostgreSQL. Webhook failure tries PostgreSQL for the whole batch.
Boundary
Fallback is tried per batch, not latched for the run. Webhook-only mode deliberately skips non-usage rows and still acknowledges.

push.py:183 ยท _Sender

1.5 State recovery and ownership

State
Missing; valid; corrupt; unreadable; lock free; lock held; replacement committed.
Transitions
Missing starts empty. Corrupt JSON is copied aside and reset. Read errors stop. Saving locks, merges only owned collector names, and atomically replaces the file.
Boundary
The lock protects read-merge-write, not an entire scan. Concurrent runs of one collector can repeat work.

state.py:53 ยท load_state
state.py:78 ยท _locked
state.py:103 ยท save_state
state.py:144 ยท atomic_write_text

1.6 Repository identity initialization

State
Salt unchecked; usable; absent and safe to create; absent with existing sink keys; invalid.
Transitions
Sending commands check the salt and existing sink identity. Lazy loading creates a salt through a first-writer-wins link, then caches it.
Boundary
A missing salt with old sink keys blocks creation. Webhook-only machines cannot make that sink check and receive a warning.

repo_keys.py:41 ยท require_readable_salt
repo_keys.py:65 ยท refuse_new_salt
repo_keys.py:94 ยท _load_salt
repo_keys.py:131 ยท RepoKeys

2. Incremental log parsing

The parsers carry more than byte offsets. Earlier metadata controls the meaning of later records.

2.1 File tail lifecycle

State
Unseen; same inode and offset; replaced or truncated; complete records; partial final line; unreadable.
Transitions
Resume matching files. Restart replacements and truncations. Hold back a final line without a newline. Commit complete records through the batch callback.
Boundary
The 50,000-line cap yields resumable chunks. File identity uses inode and size, with a documented cross-volume collision limit.

collectors/_util.py:91 ยท read_new_lines
collectors/_util.py:117 ยท same_file
collectors/_util.py:136 ยท changed_files

2.2 Collector state migration

State
Legacy watermark; current state_v; individual entry needing rebuild.
Transitions
Claude and Pi upgrade carried pending calls and link hashes. Codex drops entries without prompt ordinals and reconstructs missing metadata from the header.
Boundary
Migration is encoded by dictionary shape and version checks. It runs before ordinary collection.

collectors/claude_code.py:199 ยท _upgrade_state
collectors/codex.py:316 ยท _upgrade_state
collectors/pi.py:207 ยท _upgrade_state

2.3 Session, model, and turn attribution

State
Header identity; current model/provider/cwd; current turn.
Transitions
Codex session_meta and turn_context update attribution; task_started sets the turn. Pi session/model_change and user messages update state. Claude user promptId changes the turn.
Boundary
Subagents can retain the parent turn. Codex keeps first identity metadata even when later metadata changes the usage seed.

collectors/codex.py:374 ยท _note_session_meta
collectors/codex.py:383 ยท _note_context
collectors/pi.py:223 ยท _note_model_change
collectors/pi.py:272 ยท _advance_session
collectors/claude_code.py:314 ยท _next_turn

2.4 Copied and imported history boundary

State
Copied prefix; native tail; import boundary unchecked; carried state reconciled.
Transitions
Codex counts down skip across chunks for fork copies. Import metadata can trigger reconstruction of carried activity. Pi suppresses session/activity attribution for copied pre-fork records.
Boundary
Copied usage and native activity have different rules. Imported prompts preserve ordinals without emitting new human rows.

collectors/codex.py:349 ยท parsed_records
collectors/codex.py:501 ยท _prepare_import
collectors/codex.py:463 ยท _chunk_rows
collectors/pi.py:95 ยท is_fork_copy

2.5 Legacy prompt recognition

State
Legacy Codex prompts; modern user_message observed; imported prefix format; first old Claude loop firing; repeats.
Transitions
Codex has_um switches the accepted prompt representation. Claude counts only the first old-format /loop record per chunk. A fresh /usage-only chunk loses human rows.
Boundary
Several compatibility counters are chunk-local. The source documents split-scan differences for old files.

collectors/codex.py:197 ยท prompt_of
collectors/codex.py:463 ยท _chunk_rows
collectors/claude_code.py:369 ยท _chunk_rows
collectors/claude_code.py:352 ยท _only_ran_usage

3. Turn and tool reconstruction

Each agent uses a different rule for opening and closing work. Shared helpers add smaller state machines inside each turn.

3.1 Claude turn and link lifecycle

State
Aggregating tools; link open; turn closed; idle closure pending.
Transitions
turn_duration emits and clears tool aggregates and pending commits. Link records also close after a one-hour record gap or a fully read file idle for one hour.
Boundary
Open links force revisits without new bytes. Subagents lack normal turn-duration records, so idle closure matters.

collectors/claude_code_activity.py:302 ยท Activity._turn
collectors/claude_code_activity.py:145 ยท Activity._close_link_after_gap
collectors/claude_code_activity.py:102 ยท Activity.finish
collectors/claude_code.py:432 ยท _has_open_link_turn

3.2 Interrupt and queued-prompt carryover

State
No interrupt; interrupt pending; next prompt marked after_interrupt; cleared. Claude also tracks enqueued prompt hashes.
Transitions
Claude user records carry interrupt state. Codex interrupted aborts set a flag consumed by the next prompt. Pi aborted replies set a flag consumed by a prompt.
Boundary
Claude queue hashes are chunk-local. Pi classifies a prompt after toolResult as queued. These rules are agent-specific.

collectors/claude_code_activity.py:200 ยท Activity._user
collectors/claude_code_activity.py:163 ยท Activity._note_queued
collectors/codex.py:432 ยท _prompt_rows
collectors/pi.py:153 ยท _Activity._prompt
collectors/pi.py:171 ยท _Activity._assistant

3.3 Pending tool-call correlation

State
Call not seen; arguments saved by call ID; result matched; emitted or rejected; forgotten.
Transitions
Claude and Pi save commit calls until their results arrive. Cursor keeps call arguments across root lists. Session digests repeat call/result pairing for local displays.
Boundary
Turn closure drops unanswered commit calls in Claude and Pi. Codex can read command and output from one completed item.

collectors/claude_code_activity.py:240 ยท Activity._tool_use
collectors/claude_code_activity.py:254 ยท Activity._tool_result
collectors/pi.py:185 ยท _Activity._tool_call
collectors/cursor_cli.py:189 ยท _Activity
collectors/session_digest.py:169 ยท _claude_blocks
collectors/session_digest.py:242 ยท _pi_message

3.4 Tool deduplication and repeated-call detection

State
Unseen call; counted call; same-call run; different-call reset; turn reset.
Transitions
Seen IDs suppress re-logged tools. add_call() tracks the prior tool/input hash, consecutive run, and maximum run. Turn closure emits retry and runaway flags.
Boundary
Dedup scopes differ: Claude carries only the newest 20 open-turn IDs; Codex matches duplicated MCP items; Cursor tracks call and blob IDs.

collectors/activity_common.py:254 ยท add_call
collectors/activity_common.py:263 ยท turn_attrs
collectors/claude_code_activity.py:42 ยท Activity
collectors/codex.py:290 ยท _Activity._item
collectors/cursor_cli.py:277 ยท _read_turns

3.5 Turn link evidence

State
No evidence; ranked repo/branch sources and capped reference sets; emitted; reset.
Transitions
Messages and tools add hashed references. Commit, worktree, session, and record evidence compete by rank. Closure resolves the source and clears turn evidence.
Boundary
A default-branch marker blocks lower-ranked branch substitution. A branch is selected only within the chosen repository.

collectors/activity_common.py:105 ยท Link

3.6 Pi turn lifecycle

State
No open turn; user-opened turn; assistant/tool activity; retry; terminal reply; replaced by next prompt.
Transitions
A user opens a turn and can close the prior one. stop, aborted, and length close it. error alone permits a later assistant retry.
Boundary
An open turn without a later prompt or terminal reply can remain open indefinitely. No idle revisit closes it.

collectors/pi.py:101 ยท _Activity

3.7 Cursor root-list turn reconstruction

State
Request seen; follow-up prompts collected; open; inferred closed; delivered in done.
Transitions
Root lists rebuild requestId turns. A different prompt or one-hour database inactivity closes a turn. The callback saves done and open counts.
Boundary
Same-requestId follow-ups stay in one turn. Prompts absent from surviving roots can be counted after idle but emit no turn/link row.

collectors/cursor_cli.py:176 ยท _Turn
collectors/cursor_cli.py:250 ยท _read_list
collectors/cursor_cli.py:324 ยท _closed_turn_rows
collectors/cursor_cli.py:407 ยท _read_chat

4. Cursor account and run collection

Cursor has separate lifecycles for automated origin, completed SDK runs, and account usage windows.

4.1 Automated Cursor registration

State
No chat; empty chat created; origin durably registered; prompt sent; run ended or failed.
Transitions
cursor-run creates a chat, locks and writes the trusted registry, then sends its first prompt. Collectors check registration after the message snapshot.
Boundary
Registration remains after a failed run. There is no local unregister transition; direct Cursor invocations bypass the wrapper.

cursor_run.py:41 ยท run
cursor_run.py:22 ยท automated_sessions
collectors/cursor_cli.py:324 ยท _closed_turn_rows

4.3 Cursor API catch-up and pagination

State
Disabled; no authentication; user resolved; day window; page; closed window; current window.
Transitions
Walk gaps oldest-first in one-day windows. Read pages until empty, short, old, or capped. Acknowledgement advances a closed window to its boundary and an open window to its newest accepted event.
Boundary
A 200-page cap warns but can leave a day incomplete. endDate inclusivity is documented as unverified against the real API.

collectors/cursor_api.py:171 ยท _fetch_events
collectors/cursor_api.py:195 ยท collect

5. ActivityWatch and active-time grouping

Time collection waits for events to settle. Retention and platform lookup use independent stopping rules.

5.1 ActivityWatch settled-range cursor

State
No buckets; waiting for settled time; readable daily chunk; acknowledged end.
Transitions
Read from wm.end or the first bucket time. Stop five minutes behind now. Wait if less than one minute remains. Delivery advances end.
Boundary
The drain loop consumes successive days. Source failures preserve the prior cursor and degrade the scan.

collectors/activitywatch.py:270 ยท _read_range
collectors/activitywatch.py:306 ยท collect
collectors/activitywatch.py:348 ยท intervals

5.2 ActivityWatch retention backlog

State
Disabled; expired rows available; deletion in progress; empty; budget exhausted; failed.
Transitions
Read expired batches and delete each fully expired event until no eligible rows remain or 20 seconds pass.
Boundary
No separate checkpoint exists. Remaining source events are the resume state. Partial events spanning the cutoff remain.

collectors/activitywatch.py:363 ยท purge

5.3 macOS lookup circuit breaker

State
Lookup enabled; app cached; first timeout; process-wide lookup disabled.
Transitions
A Spotlight timeout sets off=True. Later uncached apps return None without another lookup. Results remain cached for the process.
Boundary
This breaker resets only with a new process. Ordinary lookup errors do not trip it.

collectors/activitywatch.py:174 ยท _MacCategories

5.4 Active-time block builder

State
No block; same-category block open; category or gap closes it; qualifying block emitted.
Transitions
Adjacent same-category windows within AW_GAP_S join. A block emits only when long enough and containing no steer timestamp.
Boundary
This is an in-memory stream parser, not a persistent job. A prompt timestamp stands in for a full steer interval.

label/tasks.py:363 ยท _aw_blocks

6. Live label progress and evidence

Labels have separate controls for readable evidence, completed days, successful delivery, and current revisions.

6.1 Label task window and acknowledgement

State
Waiting for episode rebuild; eligible window; scored batch; delivered; cached; watermark saved; budget cut.
Transitions
Day tasks stop at the available episode rebuild boundary. Batches deliver before cache and watermark writes. A budget cut preserves pending completed rows.
Boundary
Recent outcome tasks do not use the ordinary time watermark. Calibrated and local estimates have separate watermark names.

label/run.py:98 ยท _day_window
label/run.py:164 ยท _run_task
label/run.py:150 ยท _flush
label/run.py:62 ยท _Run.advance

6.3 Prompt and reply interval attribution

State
No selected prompt; current selected prompt; latest reply; next prompt resets attribution.
Transitions
_join() attaches before/after replies within a prompt interval. Codex software prompts end it. Legacy Claude matching has its own last/cur loop. Pi follows parent ancestry and requires a unique terminal reply path.
Boundary
Ambiguous Codex interpretations drop uncertain context. Cursor omits replies without trustworthy timestamps. Episode and date boundaries limit eligible text.

label/context.py:73 ยท _join
label/context.py:134 ยท _codex_events
label/context.py:207 ยท _pi_context
label/context.py:269 ยท cursor_context
collectors/claude_code.py:236 ยท agent_replies

6.4 Evidence snapshot cache

State
Agent paths undiscovered; discovered; request-set snapshot absent; snapshot cached; request set changed.
Transitions
Source caches path indexes and one non-Claude context snapshot keyed by agent/session/event IDs and cutoff. Text and reply reads reuse the same snapshot.
Boundary
Local automation registrations are rechecked before cache use. This cache lasts one Source instance.

label/tasks.py:224 ยท Source._paths
label/tasks.py:233 ยท Source._other_context

7. Historical and mature-outcome label jobs

These jobs keep their own resumable progress, independent of live collection offsets.

7.1 Frozen historical replay

State
Prepared; preview; locked running; batch pending; batch acknowledged; budget-paused; complete; invalid.
Transitions
prepare() freezes manifest, recipe, identity, and timestamp. resume() validates them, scores in batches, delivers, then advances progress.next.
Boundary
Completion is derived from next == request count. Changed snapshots or identity block resume. A checkpoint failure repeats the same event identities.

label/replay.py:70 ยท prepare
label/replay.py:113 ยท resume
label/replay.py:130 ยท _resume

7.2 Recent/mature outcome coverage

State
Recent or mature queue; eligible revision; scored; revision rechecked; delivered; acknowledged; stale.
Transitions
Interleave both queues. Recheck no-code eligibility before delivery. Persist acknowledged hashes and the opposite of the last delivered phase.
Boundary
Unknown labels count as completed attempts. Mature age alone stops changing the key. Evidence or policy changes make work pending again.

label/outcome_coverage.py:14 ยท coverage_key
label/outcome_coverage.py:29 ยท pending_outcomes
label/covered_run.py:40 ยท covered_outcomes

7.3 Local label generation clock

State
No prior generation; reserved millisecond; later reservation; invalid journal.
Transitions
Under a lock, choose max(wall clock milliseconds, previous+1), then persist it. Live local runs and replay preparation share the journal.
Boundary
A missing journal with existing replay directories is an error. Clock rollback cannot make a new generation older.

label/local.py:27 ยท reserve_label_time

8. Models, teaching, and evaluation

Models and evaluation files retain progress independently of label delivery.

8.1 Local ensemble batch lifecycle

State
Prepared request order; batch unscored; member loaded; all member scores validated; combined scores cached; scores consumed.
Transitions
Load and close one member at a time. Publish combined scores only after all members finish. distribution() pops cached scores and advances the batch offset.
Boundary
Changed request order, wrong model revision, low memory, invalid distributions, or an expired budget stop the batch.

label/local.py:132 ยท LocalBackend

8.2 Lazy model resource lifecycle

State
Unloaded; snapshot prepared; loaded; closed/unloaded; unavailable.
Transitions
MLX backends resolve local weights on prepare and load on first use. close() releases model memory. Encoder lazily validates and caches its model file.
Boundary
Preparation does not imply loaded weights. A new run can retry unavailable resources; collection never downloads weights.

label/backends.py:145 ยท MlxLetter
label/backends.py:370 ยท MlxPplx
label/backends.py:425 ยท MlxClef
label/backends.py:637 ยท Encoder

8.3 llama-server process lifecycle

State
Not started; child starting; health pending; ready; failed/dead; terminating; killed; closed.
Transitions
First distribution starts the server and polls health. Startup failure or timeout closes it. close() sends terminate, then kill after 30 seconds.
Boundary
SIGTERM and normal exit register cleanup. SIGKILL of AUT can leave the child running. A dead child is not automatically restarted while _proc remains set.

label/backends.py:497 ยท LlamaServer
label/backends.py:485 ยท _stop_on_sigterm

8.4 Teacher budget and failure breaker

State
Eligible; spending below budget; consecutive failures; disabled for this run.
Transitions
Successful calls reset failures and add returned cost. Exceptions increment failures. Budget reached or MAX_FAILS suppresses further calls.
Boundary
Budget is checked before calls and can overshoot by one call. An unusable distribution after a successful response is counted separately from an exception.

label/teach.py:81 ยท _SonnetRun
label/teach.py:88 ยท _sonnet_dist

8.5 Teacher and evaluation progress

State
Teacher/unit pair missing or saved; raw score missing or saved; evaluated; selected configuration; final test observed.
Transitions
Teaching skips saved pairs of the current task version. Evaluation reuses saved unit scores. choose() writes saved calibration. Final evaluations append separately and warn on repeated looks.
Boundary
Saved score identity does not include req.rev, a documented stale-evidence limit. Choosing a model that fails quality floors warns but still saves it.

label/teach.py:106 ยท run_teach
label/bakeoff.py:187 ยท _score
label/bakeoff.py:532 ยท choose
label/bakeoff.py:387 ยท run_final

9. Local review pages

Review pages remain open until their save protocol completes. Gold review also has navigation and undo state.

9.1 Gold annotation queue and undo

State
Current item; answered; skipped; undo available; exhausted; quit.
Transitions
Valid answers append gold and advance pos. Skip advances without gold. Undo rewinds position and removes the newest gold row when needed. Stale item submissions do nothing.
Boundary
Queue/history are in memory. Gold answers survive restart; skipped items and undo history do not.

label/gold.py:116 ยท _Sitting
label/gold.py:105 ยท _drop_last

9.2 Local HTTP save and shutdown

State
Serving; rejected request; callback running; save failed and serving; redirect and continue; closing response; shutdown.
Transitions
A valid token/body dispatches POST. Callback failure returns 500 and keeps serving. None redirects to the current item. Closing bytes start shutdown. Episode review saves then closes.
Boundary
Rejected bodies are drained with byte/time bounds. Persistence behavior belongs to each callback; there is no global save transaction.

local_page.py:51 ยท serve
review.py:195 ยท serve
label/gold.py:177 ยท serve

10. Git outcomes and daily coverage

Some state names are explicit here. The implicit machines are the rules for recomputing, retaining, acknowledging, and retrying them.

10.1 Commit outcome lifecycle (named states)

State
undecided; open; abandoned; superseded; merged; reverted; reworked.
Transitions
Age, merge ancestry or patch twins, branch reachability, amend succession, revert timing, and 14-day line survival determine the next observation.
Boundary
This is a recomputed classifier with append-only changes, not an enforced one-way transition graph. GitHub PR evidence uses an optional separate read path.

outcomes.py:215 ยท _decide
outcomes.py:178 ยท _decide_merged
outcomes.py:200 ยท _decide_unmerged
outcomes.py:261 ยท _measure

10.2 Outcome uncertainty and cache retention

State
Decidable; unreadable/sticky; previous stored state retained; no-revert exception; cached proof.
Transitions
pending() suppresses uncertain replacement of known outcomes. A contradicted old reverted result may change. Successful survival is cached; failed survival is retried. Positive PR answers persist; old negative answers become stable.
Boundary
No clone found can initially produce abandoned after 14 days. Cache results can outlive current clone readability.

outcomes.py:317 ยท pending
outcomes.py:242 ยท _ask_gh
outcomes.py:261 ยท _measure
outcomes.py:337 ยท _load_cache

10.3 Git source coverage lifecycle (named statuses)

State
complete; partial; failed; deferred; prior complete date coverage retained.
Transitions
Source observations union known salted commits. Complete observations extend or replace contiguous coverage. Failed or deferred reads preserve prior proven coverage.
Boundary
Zero days require coverage from every configured source. Conflicting author days or changed salt/policy fail closed. A reset requires every source freshly complete.

git_day_cache.py:84 ยท merge_sources
git_day_cache.py:56 ยท load_cache
git_days.py:370 ยท _collect

10.4 Daily Git ledger acknowledgement

State
Missing day; positive partial day; complete day; higher count; lower count refused; explicit reset.
Transitions
coverage_rows() inserts new or higher counts and promotes completeness. Delivery precedes identity-cache persistence and then the run watermark.
Boundary
Ordinary runs never lower counts. --allow-lower requires a complete fresh scan. A crash between the sink, cache, and watermark can repeat work.

git_days.py:311 ยท coverage_rows
git_days.py:282 ยท to_write
git_days.py:370 ยท _collect

10.5 Git-days due and retry scheduler

State
Disabled; not due; due; attempt reserved; complete; partial pending; retry waiting.
Transitions
A good run becomes due after 20 hours. Partial_pending bypasses that wait. Every attempt needs six hours since the last attempt, saved before running.
Boundary
A failed scheduled run does not fail the parent scan. Remote deferral expires at the configured ledger date.

git_days.py:463 ยท run_if_due
git_days.py:336 ยท run

10.6 Remote Git output parser

State
Between repositories; current repo log accumulating; repository boundary; read failure marker.
Transitions
Control-character markers flush one repository log, select the next repository, or count a failed read. End-of-stream injects a final flush.
Boundary
This parser is in-memory. It interprets the generated SSH script protocol, not arbitrary shell output.

git_days.py:219 ยท _scan_remote
git_days.py:159 ยท remote_script

10.7 Commit shell-directory parser

State
Unknown initial target; cd/pushd target accumulated; git -C target applied; commit found; dynamic target rejected.
Transitions
Walk parsed command segments in order. Directory changes affect later segments. Return the first commit target; variables or command substitutions make it unknowable.
Boundary
This is a bounded shell interpretation. Nested shell wrappers are expanded only when they contain a commit.

collectors/commits.py:70 ยท _segments
collectors/commits.py:107 ยท commit_dir

11. Scheduling and backup

Markers and timestamps are persistent state even when no class is named State.

11.1 Scheduled scan retry marker

State
No retry pending; retry marker armed; retry process running; scan succeeds; marker removed.
Transitions
Tunnel failure or nonzero scan exit creates retry-pending. launchd relaunches while the marker exists, throttled to 120 seconds. Success removes it.
Boundary
Missing tunnel configuration exits 2 without arming a marker. Linux supplies a separate systemd on-failure restart every 120 seconds.

packaging/launchd/aut-scan.sh:33
packaging/launchd/dev.aut.retry.plist:28
packaging/systemd/agent-usage-tracker.service:16

11.2 Once-per-day outcomes and labels

State
Not attempted today; marker written; running; ended; wait until next date.
Transitions
A successful scan permits each daily step. The wrapper writes outcomes-day or label-day before invoking the command. Labels also require AUT_LABEL=1.
Boundary
These markers mean attempted, not delivered. Failure or interruption does not automatically retry that daily step today. Separate concurrent wrappers have no shared lock here.

packaging/launchd/aut-scan.sh:79

11.3 SSH tunnel ownership

State
Direct mode; existing listener reused; opening owned tunnel; failed; owned tunnel closed.
Transitions
An existing local listener skips tunnel creation. Otherwise SSH starts one and sets opened. Only owned tunnels are targeted at normal wrapper exit.
Boundary
The wrapper has no EXIT trap. An interrupted wrapper can leave its tunnel alive; process matching uses the configured forwarding spec.

packaging/launchd/aut-scan.sh:44

11.4 Backup attempt and last-good status

State
Lock busy; preflight; skipped; snapshot saved; partial snapshot saved; failed; last-good timestamp retained.
Transitions
Low battery or unreachable storage skips. Password/repository errors stop. Restic code 0 or 3 records last_ok, then optional retention runs.
Boundary
A partial snapshot counts as good with a warning. A lock-busy skip records no new status. Check mode does not write backup progress.

backup.py:149 ยท run_backup
backup.py:171 ยท _locked
backup.py:80 ยท _record

11.5 Backup retention and weekly prune

State
Forget due after backup; prune not due; prune due; retention succeeded; retention failed.
Transitions
After a good snapshot, forget uses the retention policy. Prune runs when last_prune is missing or seven days old, and saves its timestamp only on success.
Boundary
Retention failure raises after the backup has already been recorded as good. It cannot be interpreted as snapshot failure.

backup.py:209 ยท _forget

Boundaries worth checking first

These are observed behavior and documented limits, not new bug findings.

BoundaryConsequenceInventory entry
Delivery succeeds, checkpoint failsRows are sent again. Stable event identities and sink deduplication are required.Batch acknowledgement; replay and coverage
Webhook-only transportSession, activity, and time rows are skipped while collection progress still advances.Transport protocol
Inferred turn closureLate Cursor activity can arrive after its insert-only turn was acknowledged. Pi can retain an open turn indefinitely.Pi turns; Cursor turns
Daily marker written before commandAn interrupted or failed labels/outcomes step waits until another date.Daily attempt markers
Evidence revision changesReplay, mature coverage, and evaluation score caches use different invalidation rules.Historical labels; evaluation progress
Partial Git coverageKnown positive counts survive offline sources. Missing days cannot automatically become proven zeros.Git coverage

Coverage and verification

Source revision: a46470c. The only initial worktree addition was an untracked .claude/ directory, which this inventory does not inspect or change.

Reviewed application modules under src/agent_usage_tracker/, collector implementations, label workflows, and platform scheduling files. Followed transition writers and their callers; checked related test definitions.

Not counted as additional machines: full-scan Cursor IDE and SDK manifest readers; CLI dispatch; configuration validation; redaction; pricing reductions; manual one-shot time/outcome inserts; database connection wrappers.

History-steer estimates gate output on existing counted days but do not retain their own progress cursor. Session digests reuse pending call/result and legacy-prompt patterns already listed.

Episode grouping, correction application, database views, and nightly episode rebuilding are external sink behavior. This repository reads and writes their contracts, but does not implement their complete transition logic.

Focused transition tests: 291 passed in 65.84 seconds. Covered state persistence, delivery, automated Cursor registration, Git coverage, backup, Claude activity, Cursor API windows, label progress, replay, mature coverage, review undo, local recipes, episode readiness, and commit outcomes.

The project virtual environment lacked pytest. The checks used its Python 3.13 interpreter through a temporary uv test environment containing pytest. No project dependencies or lockfiles changed.

No live logs, account APIs, remote Git hosts, database, model weights, restic repository, or installed scheduler jobs were queried. Static analysis does not prove every runtime path or concurrency interleaving.