Records and the Audit Trail¶
OpenALR keeps its history in one file of plain JSON lines. A line is added and never changed. This page says what a line is, what happens when something about past work turns out to be wrong, and what that gives a person who has to check the figures later.
One Record per Turn¶
A record is one JSON line that describes one turn of agent work: the model, the tokens, the cost, the tags, the time it took, and how it ended. What counts as a turn depends on the harness.
| Harness | One Record Is |
|---|---|
| Claude Code | A prompt that reaches the model, and everything the model did to answer it, tool calls included. The commands OpenALR answers itself (/alr-tag, /alr-ctl, /alr-turns, /alr-grade, /alr-help, and /alr) never reach the model, so they are not turns. Claude Code also writes one record for the session, which holds the session's own total (see How Costs Are Computed). |
| Grok Build, in a terminal session | A turn, as Grok Build counts it. A turn you cancel has no record of its own. |
| Grok Build, in a headless run | A run: one result document. |
| Hermes | A gateway turn. |
| Anthropic SDK | A turn of your own loop, when you wrap it in SdkSession (several API calls become one record), or a single API call when you record the call directly. |
A subagent writes records of its own, linked to the turn that started it. Each says whether its cost is already inside its parent's, so nothing is counted twice.
A record holds numbers, names, and times. It never holds a prompt or a reply (see Where Records Go, and What Stays Private). What its fields mean is defined by the Record Format.
A Record Is Never Rewritten¶
Every write to the record file adds whole lines at the end. Nothing already in the file is edited in place.
- A restated record replaces its earlier one. When OpenALR learns more about a turn (a late cost figure, say), it writes a new record that names the one it supersedes. Readers show only the current record, and the earlier line stays in the file.
- The one thing that removes lines is a purge that you ask for.
alr uninstall <harness> --purge --yesdeletes the records of the harness you name, and the grades, corrections, and tag lines that name only them. Every other line stays byte for byte. See Check, Uninstall, and Purge.
Changes Are Lines of Their Own¶
Everything you do after a turn is written as a new line that points back at the turn. The record itself stays as it was.
| What You Did | The Line | Written By |
|---|---|---|
| Tagged a past request or session, or removed a tag from it | An alr-tag/0.1 line: the tag, add or remove, who, when, and an optional reason |
alr tag |
| Changed the tags in force for the rest of a session | An alr-session/0.1 event in the session's state (changes.jsonl), not a line in the record file; later records carry the new tags |
/alr-tag add, rm, set, clear, undo |
| Moved a tag on past turns | Two alr-tag/0.1 lines per turn, a remove and an add, sharing one move id (x_move), each with the reason |
/alr-tag move, alr tag --move |
| Graded a turn | An alr-grade/0.1 line: 1 to 5, who graded, and an optional comment |
/alr-grade, alr grade |
| Corrected a cost | An alr-cost/0.1 line: the record, the new figure, and the reason |
Your own tooling or the library's build_cost_correction; this release has no command for it |
| Issued or revised a plan | An alr-plan/0.1 document, one per version |
alr plan new, alr plan revise |
| Accepted a task, or withdrew the acceptance | An alr-acceptance/0.1 document; a withdrawal carries a reason |
alr accept |
A tag move is the clearest example. Say turns 3 to 7 were booked to the wrong task. The move does not touch those five records. It adds a line that removes the old tag and a line that adds the new one, with your reason, and from then on every report shows the turns under the new task. See Tag Your Work.
How a Reader Applies Them¶
Any program that reads the file works out the current picture the same way, in this order:
- Supersession. Of each chain of restated records, only the current one counts.
- Cost corrections. A correction replaces the cost of the record it names.
Where there are several for one record, the latest by
occurred_atwins, and the figure is booked under the correction's cost basis. - Grades. The latest grade for a request, by
graded_at, wins. - Tags. A record's own tags are the starting point. The tag lines that name
it then decide each tag, the latest
tagged_atfirst. Adding a tag of a reserved key also removes any other value of that key, because a record holds one value of each (see Tags). - Plans and acceptances. These are kept apart from the records and never change a total. A plan's latest version is the one in force. A task counts as accepted when its latest acceptance is not a withdrawal.
A line the reader cannot use is counted and named by alr check, never dropped
silently. A tag line that names no record is kept and reported, never applied
and never discarded.
What This Gives an Auditor¶
- Every figure can be re-derived. The file is plain JSON lines. With the five
steps above and any tool you like, you get the same totals that
alr summaryprints.alr journalexports the same file again for the same records. - History is kept, not overwritten. A wrong tag, a wrong grade, and a wrong cost each leave both the first line and the line that changed it. You can see what the figure was before, what it is now, and when it changed.
- Changes say who and why. Tag lines carry
tagged_by, grades carrygrader, acceptances carryaccepted_by, and a move, a correction, and a withdrawal each need a reason. - Figures say what they are. Each cost is an own figure, an allocated share,
or an estimate, in
meteredorapi-equivalentdollars, as described in How Costs Are Computed.
An append-only file is not a tamper-proof one. OpenALR never edits a line, but anyone who can write to the file could. If you need evidence that the file was not altered, send the records to a log server as you go (see Sending Records On) and keep that copy.
Where the File Lives¶
%USERPROFILE%\.alr-emit\records.jsonl
~/.alr-emit/records.jsonl
One file holds the records and every line listed above, for every harness on
that machine. Each of these moves it, the first that is set winning:
--sink PATH on a command, the
ALR_EMIT_SINK
environment variable (a file), then the
log_dir setting or
ALR_LOG_DIR (a
folder). A harness on Windows and one in WSL keep separate files. See
Where Files Live for the
other files OpenALR keeps, and
Where Records Go, and What Stays Private for who may set where the
file lives.