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
State is spread across dictionary keys, callbacks, sets, timestamps, files, and process handles.
The main safety rule is delivery before progress. Inferred turn endings and daily attempt markers follow different rules.
This inventory describes existing behavior. It makes no application changes and proposes no framework migration.
Scope limit: external database jobs and live service behavior can add transitions beyond this checkout. See the coverage section.
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.1 Batch acknowledgement
State
Private parsed copy; buffered rows and callbacks; acknowledged in memory; saved on disk.
Transitions
take() buffers rows. flush() sends first, then runs callbacks. run_scan() saves acknowledged progress, including earlier batches when a later batch fails.
Boundary
A crash after delivery and before persistence repeats delivery. Dry runs advance only the in-memory copy.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
โ This artifact overflows horizontally at this width - wrap wide tables / diagrams / pre blocks so they scroll, or they will clip on a phone.