Record Format¶
This page is a guide to the OpenALR 0.1 record format: what each kind of record is
for, when it is written, and what its fields mean. Every example line below was
written by alr-emit 0.1.0 from synthetic data.
The Schemas and the Specification Are Normative
The JSON Schemas and the published specification in the openalr/openalr repository define the format. This page is a guide to them. Where this page and a schema differ, the schema is right.
The Short Version¶
An OpenALR record file is a text file with one JSON object per line. Each line is one document. A record says what one agent request or task used: its tokens, its cost, its models, its turns, and how it ended. Beside the records, a few smaller documents amend or explain them. They add a grade, a tag, or a corrected cost, or they describe a plan or an acceptance.
Every line names its own kind in an alr_schema field, such as alr/0.1 or
alr-grade/0.1. A reader picks the schema to check a line against from that value,
never from the file's name or place.
alr_schema |
What It Is | Written by |
|---|---|---|
alr/0.1 |
The record of one request or task | The emitters |
alr-grade/0.1 |
A quality grade for a request | alr grade, /alr-grade |
alr-tag/0.1 |
One tag added to or removed from a request | alr tag, /alr-tag |
alr-cost/0.1 |
A corrected cost for a request or record | Your own code (see Cost Correction) |
alr-session/0.1 |
A change to a session's tags or metering | /alr-tag, /alr-ctl |
alr-plan/0.1 |
A project's budget, task by task | alr plan |
alr-acceptance/0.1 |
A task accepted, or an acceptance withdrawn | alr accept |
Grades, tags, and corrected costs are called amendments. They never edit a record. They are new lines added after it, and a reader applies them when it reads (see How Amendments Apply).
How to Read the Field Tables¶
- Type is the JSON type. A type that lists
nullmeans the field may holdnull. An optional field that holdsnullmeans the same as an omitted one. - Required says whether a line without the field is invalid. Every field not marked required is optional.
- Timestamps are RFC 3339 date-times with an offset, such as
2026-11-28T20:30:08Zor2026-11-28T20:30:08+01:00. A timestamp with no offset is invalid. - Every schema is open. A line may carry fields the schema does not name, and a reader ignores them (see Extension Fields).
Record (alr/0.1)¶
What it is for. One record describes one executed agent request or task, as metadata only. It holds counts, ids, and figures. It never holds what was asked or answered (see No Prompts or Replies).
When it is written. The emitters write it when the work ends. For Claude Code,
a hook writes one record per turn and one record for the session. A turn's record
is first written with no cost. Claude Code reports its cost once, when the session
ends, so at that point the turn's record is written again, with its share of the
cost, and the new line names the old one in supersedes. If you run alr
otel-sink, each turn's record carries its own cost when the turn ends.
Written by alr-emit 0.1¶
Every field here is one the emitters write when they know it. An optional field appears on a line only when it has a value.
| Field | Type | Required | Meaning |
|---|---|---|---|
alr_id |
string | Yes | The unique id of this record. A record set that repeats an alr_id is invalid. |
alr_schema |
string | Yes | Always alr/0.1. |
request_id |
string | Yes | The unique id of the request or task that was executed. |
agent_id |
string | Yes | A stable name for the agent that did the work. |
outcome |
string | Yes | How the work ended: ok, error, timeout, blocked, hitl_escalated, or interrupted. A human escalation is its own outcome, not an error. interrupted means the operator stopped the work after it had used resources. |
emitted_at |
string | Yes | When this record was written. |
finished_at |
string | Yes | When the work ended. |
tokens |
object | Yes | The token counts (see Tokens). |
cost_usd |
number or null | Yes | The cost in US dollars. null means the cost is honestly unknown. A cost is never invented. |
cost_is_partial |
boolean | Yes | true when the cost is known to be incomplete. |
pricing_source |
string | Yes | How the cost was obtained: harness_reported, computed, or unknown. unknown goes with a cost_usd of null. |
synthetic |
boolean | Yes | true keeps benchmark and test work out of totals. |
runtime |
string or null | No | A free-form class of runtime, such as cli. It is not a fixed list. |
model |
string or null | No | The main model used. |
models |
array of strings or null | No | Every model used. |
harness |
string or null | No | The program that ran the work, such as claude-code. |
harness_version |
string or null | No | The version of that program, so costs can be compared by version. |
provider |
string or null | No | The service that served and billed the model calls, such as anthropic, openai, x_ai, aws.bedrock, or gcp.vertex_ai. It should be an OpenTelemetry gen_ai.provider.name value when one applies. It is not the same as the harness or the model. |
started_at |
string or null | No | When the work began. |
wall_ms |
integer or null | No | Elapsed time in milliseconds (0 or more). |
llm_calls |
integer or null | No | The number of model calls (0 or more). |
turns |
integer or null | No | The number of agent turns (0 or more). |
tool_call_count |
integer or null | No | The number of tool calls (0 or more). |
tool_calls |
array or null | No | Detail for each tool. The shape of an item is up to the emitter. |
session_id |
string or null | No | The harness's id for the session. |
task_class |
string or null | No | A label for the kind of task. It matches ^[a-z0-9][a-z0-9._:-]{0,63}$. |
tags |
array of strings or null | No | Labels from whoever started the work (see Tags). |
origin_kind |
string or null | No | Who started the request: human, agent, or system. |
cost_basis |
string or null | No | What cost_usd is. metered is money charged. api-equivalent is a valuation at API list prices, where no money changed hands. Never add the two together. |
cost_allocation |
string or null | No | Set when the cost on this record is its share of a figure obtained for a larger unit of work, such as a session total split over turns. It names the method, for example price-weighted or token-weighted. Compare it for equality only. It needs a cost_usd or a cost_share_usd on the same record. |
cost_share_usd |
number or null | No | Only on a cost_in_parent record. This record's share of its parent's cost, 0 or more. It is a breakdown and is never added to any total. |
attempt |
integer or null | No | The 1-based order of this record among the emitter's records for the same request_id. It orders records and never means one replaces another. |
supersedes |
string or null | No | The alr_id of the record this one replaces. It must be the same request_id and agent_id, and never the record's own id. |
turn_index |
integer or null | No | The 1-based number of this record's turn within its session_id and agent_id. It is fixed when the record is written and kept by a restatement. |
turn_index_space |
string or null | No | How turn_index was numbered. eager means numbered when the turn starts, and shared with session events. Never compare a turn_index across records of different spaces. |
parent_request_id |
string or null | No | The request_id of the work that started this work. It is a request id, never an alr_id. |
parent_inclusion |
string or null | No | How this record's figures relate to its parent's: separate, cost_in_parent, or included_in_parent (see Parents and Children). |
credential |
object or null | No | A reference to the billing credential the provider charged: named, never held. It is never the secret itself (see Credential). |
The Hermes adapter fills tool_calls and task_class. No other adapter does.
Defined by the Standard; alr-emit 0.1 Does Not Write It¶
The standard defines these fields. They are all optional, and alr-emit 0.1 never
writes them. A reader may meet them on a line from another producer.
| Field | Type | Meaning |
|---|---|---|
chain_id |
string or null | The id of a multi-hop chain this work belongs to. |
conversation_id |
string or null | The id of the wider conversation or thread. |
assigned_at |
string or null | When the request was assigned or queued. |
notional_value_usd |
number or null | The shadow price of the work: what it was worth, as distinct from what it cost. It is an estimate that someone supplies, and it is never a cost. |
billing_basis |
string or null | Free text about the commercial arrangement, such as api-key. It is not a key to group by. Use cost_basis for that. |
pricing_version |
string or null | An opaque reference to the price book used. Compare it for equality, and never parse it. |
Tokens¶
Every key is optional, and a missing key means 0, not unknown. Each is an integer of 0 or more.
| Key | Meaning |
|---|---|
input |
Input tokens, not counting cached ones. |
output |
Output tokens. |
cache_read |
Input tokens read from a cache. |
cache_write |
Input tokens written to a cache. |
reasoning |
Reasoning tokens. This is a breakdown of output. It is never added to it. |
input, cache_read, and cache_write do not overlap, so they add up. A producer
whose provider reports one total for the prompt subtracts the cache counts to get
input.
Tags¶
tags is a list. Each tag is a string that matches ^[A-Za-z0-9:_.-]{1,128}$.
Tags are compared byte by byte, and case matters. The text before the first : is
the tag's key.
Five keys are reserved: project:, task:, client:, cost_center:, and
work_type:. A record carries at most one tag for each reserved key. Any other tag
may appear more than once. See One-Value and Many-Value Tags.
Credential¶
credential is a reference to a credential: the key, workspace, or plan the provider
charged. It is never the secret itself. It must not carry key material or any value
made from it, such as a hash, a prefix, or a suffix. It must have an id or a
label. alr-emit drops any member that looks like key material, with a warning,
and writes kind, id, and label only from your configuration.
| Key | Type | Meaning |
|---|---|---|
kind |
string or null | api_key, subscription, workspace, or other. null or missing means not stated. |
id |
string or null | An identifier from the provider that is not secret. An id that identifies an account is opt-in only. |
label |
string or null | A name you chose, such as team-a-prod. A label alone is always acceptable. |
Parents and Children¶
Work can start other work, such as a subagent, or a turn inside a session. A child
names its parent in parent_request_id, and parent_inclusion says how to count it.
parent_inclusion |
Tokens | Cost |
|---|---|---|
separate |
Added | Added |
cost_in_parent |
Added | Never added. The parent's cost already includes it. |
included_in_parent |
Never added | Never added |
With no parent_request_id, the value is ignored and the record counts as
separate, so a record with no parent link never drops out of a total.
A cost_in_parent record has a cost_usd of null. Its cost_share_usd, when
known, is its share of the parent's cost. The share is only a breakdown, and the
rest of the cost stays with the parent. cost_share_usd is only for a
cost_in_parent record.
For Claude Code, each turn's record is a cost_in_parent child of the session's
record. The session's record has the session id as its request_id and holds the
session's own cost.
Example¶
One turn of a Claude Code session, as the emitter wrote it when the session ended.
It restates the turn's earlier record (supersedes) and now carries the turn's
share of the session's cost.
{"alr_id":"2ef9147c-27ea-5395-af6b-0f8147dfa30e","alr_schema":"alr/0.1","request_id":"a166a7f5-0707-4ae9-a747-0d3556628c3c:t0001","agent_id":"demo-dev","outcome":"ok","emitted_at":"2026-11-28T20:29:25.086377+00:00","finished_at":"2026-10-14T02:56:22.538000+00:00","tokens":{"input":2,"output":5,"cache_read":14124,"cache_write":6067},"cost_usd":null,"cost_is_partial":false,"pricing_source":"harness_reported","synthetic":false,"runtime":"cli","model":"claude-opus-5-5","models":["claude-opus-5-5"],"harness":"claude-code","harness_version":"2.1.296","started_at":"2026-10-14T02:56:19.767000+00:00","wall_ms":2771,"llm_calls":1,"turns":1,"tool_call_count":0,"session_id":"a166a7f5-0707-4ae9-a747-0d3556628c3c","origin_kind":"human","attempt":2,"supersedes":"a24e7ebf-1c14-582e-ab94-a60799010e4b","turn_index":1,"parent_request_id":"a166a7f5-0707-4ae9-a747-0d3556628c3c","parent_inclusion":"cost_in_parent","provider":"anthropic","cost_share_usd":0.0628165417845475,"cost_allocation":"price-weighted","claude_code_usage":{"cache_write_5m":6067,"cache_write_1h":0},"turn_index_space":"eager"}
The claude_code_usage member is an extension field (see
Extension Fields).
Grade (alr-grade/0.1)¶
What it is for. A quality grade, from 1 (worst) to 5 (best), for one request.
When it is written. When you run alr grade or /alr-grade. To change a grade,
write a new one. The latest grade for a request wins.
Written by alr-emit 0.1¶
| Field | Type | Required | Meaning |
|---|---|---|---|
alr_schema |
string | Yes | Always alr-grade/0.1. |
grade_id |
string | Yes | The unique id of this grade. |
request_id |
string | Yes | The request being graded. |
grade |
integer | Yes | The grade, 1 to 5. |
grader |
string | Yes | Who graded: a person or an agent. |
graded_at |
string | Yes | When the grade was given. |
comment |
string or null | No | The reason, in free text. It may be sensitive. Remove it before you publish a record outside your organization. |
Defined by the Standard; alr-emit 0.1 Does Not Write It¶
None. alr-emit 0.1 writes every field of this type.
{"alr_schema":"alr-grade/0.1","grade_id":"134c283d-77ef-4750-a6bd-5f9c57d3c096","request_id":"a166a7f5-0707-4ae9-a747-0d3556628c3c:t0001","grade":5,"grader":"demo-dev","graded_at":"2026-11-28T20:29:31.976578+00:00","comment":"regraded after review"}
Tag (alr-tag/0.1)¶
What it is for. Adds or removes one tag on the records of a request, after the records were written.
When it is written. When you run alr tag, or /alr-tag in a session. A tag
added from the shell to a whole session, or to some of its turns, writes one event
for each request. A move writes two lines for each (see Moving a Tag).
Written by alr-emit 0.1¶
| Field | Type | Required | Meaning |
|---|---|---|---|
alr_schema |
string | Yes | Always alr-tag/0.1. |
tag_id |
string | Yes | The unique id of this tag event. |
tag |
string | Yes | One tag, in the same form as a record's tags. Compared byte by byte, with case. |
action |
string | Yes | add or remove. |
request_id |
string | Yes | The request whose records the event applies to. |
tagged_by |
string | Yes | Who made the change. |
tagged_at |
string | Yes | When the event was made. |
alr_id |
string or null | No | Limits the event to the lineage of this one record (see How Amendments Apply). It must name a record of the same request_id. null is the same as omitted: every record of the request. |
reason |
string or null | No | The reason, in free text. It may be sensitive. |
Defined by the Standard; alr-emit 0.1 Does Not Write It¶
None. alr-emit 0.1 writes every field of this type.
This line is the add half of a move. It carries the extension field x_move.
{"alr_schema":"alr-tag/0.1","tag_id":"87da7ef9-d5b9-4bff-9400-06d540236a67","tag":"task:writing","action":"add","request_id":"a166a7f5-0707-4ae9-a747-0d3556628c3c:t0001","tagged_by":"demo-dev","tagged_at":"2026-11-28T20:29:31.376449+00:00","alr_id":"2ef9147c-27ea-5395-af6b-0f8147dfa30e","reason":"the task was renamed","x_move":"4d5fea95-fefe-497e-acb2-897bbec0745a"}
Cost Correction (alr-cost/0.1)¶
What it is for. A corrected cost for a request, or for one record of it. For example, an invoice shows a figure that differs from the one the harness reported.
When it is written. Only by code you write. alr-emit reads these lines and
applies them in its reports, but no alr command writes one. The package builds the
line for you with alr_emit.build_cost_correction.
Written by alr-emit 0.1¶
| Field | Type | Required | Meaning |
|---|---|---|---|
alr_schema |
string | Yes | Always alr-cost/0.1. |
correction_id |
string | Yes | The unique id of this correction. |
request_id |
string | Yes | The request whose cost is corrected. |
cost_usd |
number | Yes | The corrected cost. It is never null, because a correction always knows its figure. |
reason |
string | Yes | Why the correction was made. |
occurred_at |
string | Yes | When the correction was made. |
source |
string or null | No | Where the figure came from. |
alr_id |
string or null | No | The one record, of the same request_id, whose cost this replaces. Without it the correction covers the request's current records written at or before occurred_at. |
cost_basis |
string or null | No | metered or api-equivalent: the basis of the corrected figure. Without it, the basis of the record or records corrected. |
Defined by the Standard; alr-emit 0.1 Does Not Write It¶
None. The package builds every field of this type.
{"alr_schema":"alr-cost/0.1","correction_id":"0e081587-c340-45ef-a072-30425dafd1f8","request_id":"a166a7f5-0707-4ae9-a747-0d3556628c3c","cost_usd":0.17,"reason":"the invoice shows a different figure","occurred_at":"2026-11-28T20:30:23.591552+00:00","source":"invoice","alr_id":"14d73742-62df-5e2e-bd1c-c124bcde34f6","cost_basis":"api-equivalent"}
Session Event (alr-session/0.1)¶
What it is for. A change to the state of one harness session: the tags in force,
the task_class, or whether turns are metered. It does not change any record. It
tells a reader which tags and which metering applied from which turn on, and it
shows a gap when metering was stopped.
When it is written. When a command in the session changes that state, such as
/alr-tag add, /alr-tag move ... from-now, or /alr-ctl stop. In 0.1.0 these
events are kept in the session's own outbox file, changes.jsonl in the state
directory, and nothing sends them on.
Written by alr-emit 0.1¶
| Field | Type | Required | Meaning |
|---|---|---|---|
alr_schema |
string | Yes | Always alr-session/0.1. |
session_id |
string | Yes | The session the event belongs to. It is the session_id of its records. |
agent_id |
string | Yes | The agent whose turns the event governs. Turns are counted for each session_id and agent_id. |
harness |
string | Yes | The program that ran the session. |
seq |
integer | Yes | The event's place in the session's events, 1 or more. With session_id it is the event's key. |
prev_seq |
integer or null | Yes | The seq of the event this one follows. null only on the first. It is less than seq. A prev_seq the reader does not hold is a gap, which is reported and not refused. |
effective_from_turn |
integer | Yes | The first turn, in the eager numbering, that the new state applies to. |
from |
object | Yes | The state before the change (see below). |
to |
object | Yes | The state from effective_from_turn on. |
cause |
string | Yes | What made the change, such as command, door_verb, or config. A producer may add values, and a reader treats an unknown one as an unspecified cause. |
changed_at |
string | Yes | When the change was made. |
changed_by |
string or null | No | Who made it. |
reason |
string or null | No | The reason, in free text. It may be sensitive. |
alr-emit 0.1 writes the cause values command and config. It does not write
door_verb.
Defined by the Standard; alr-emit 0.1 Does Not Write It¶
None. alr-emit 0.1 writes every field of this type.
from and to each hold the whole state, not a difference.
| Key | Type | Required | Meaning |
|---|---|---|---|
tags |
array of strings | Yes | Every tag in force. The same form as a record's tags, with no repeats and one value for each reserved key. |
emitting |
boolean | Yes | Whether the session's turns are metered. |
task_class |
string or null | No | The task_class in force. null or missing means none. |
This event moved a session's tags from task:docs to task:writing. The member
x_command is an extension field, and so is x_move.
{"alr_schema":"alr-session/0.1","session_id":"a166a7f5-0707-4ae9-a747-0d3556628c3c","agent_id":"demo-dev","harness":"claude-code","seq":2,"prev_seq":1,"effective_from_turn":5,"from":{"tags":["project:demo-app","task:docs"],"task_class":"interactive","emitting":true},"to":{"tags":["project:demo-app","task:writing"],"task_class":"interactive","emitting":true},"cause":"command","changed_by":"demo-dev","changed_at":"2026-11-28T20:29:31.385Z","reason":"the task was renamed","x_command":"move task:docs task:writing","x_move":"4d5fea95-fefe-497e-acb2-897bbec0745a"}
Plan (alr-plan/0.1)¶
What it is for. The budget for one project in one cost basis, task by task. A plan is what a reader compares the records' costs against. Earned value (EV, PV, CPI, and SPI) is worked out by readers from plans, acceptances, and records. It is never stored in a plan.
When it is written. When you run alr plan new (version 1) or alr plan
revise (the next version). A new version replaces earlier ones from its
issued_at, and the earlier versions are kept.
A plan is identified by project, cost_basis, and plan_version.
Written by alr-emit 0.1¶
| Field | Type | Required | Meaning |
|---|---|---|---|
alr_schema |
string | Yes | Always alr-plan/0.1. |
project |
string | Yes | The value of the project: tag the plan covers, without the key. 1 to 120 characters from A-Za-z0-9:_.-. |
cost_basis |
string | Yes | metered or api-equivalent: the basis the budget is stated in. Never null. |
plan_version |
integer | Yes | The version, 1 or more. Versions are ordered by this number, never by issued_at. |
issued_at |
string | Yes | When this version was issued. |
issued_by |
string | Yes | Who issued it. |
tasks |
array | Yes | The plan's tasks, at least one. The budget at completion is the sum of their budget_usd. |
dropped_tasks |
array or null | No | Tasks of the previous version that this version no longer holds. |
reason |
string or null | No | Why this version was issued. It may be sensitive. |
Defined by the Standard; alr-emit 0.1 Does Not Write It¶
None. alr-emit 0.1 writes every field of this type.
Version 1 has no change on any task and no dropped_tasks.
Task¶
| Field | Type | Required | Meaning |
|---|---|---|---|
task |
string | Yes | The value of the task's task: tag, without the key. 1 to 123 characters from A-Za-z0-9:_.-. No two tasks of a plan share one. |
budget_usd |
number | Yes | The task's budget in the plan's cost basis, 0 or more. |
planned_start |
string or null | No | The planned start: a full date such as 2026-10-13, or a date-time with an offset. A full date covers its whole UTC day. |
planned_finish |
string or null | No | The planned finish, in the same forms. It is not before planned_start. |
human_baseline |
array or null | No | What the task would cost if people did it, one item for each role (see below). Its value is the sum of hours times rate_usd. An empty list says the task has no human effort of its own, with a value of 0. A missing or null baseline means not stated. |
baseline_method |
string or null | No | How the baseline was reached: estimate, historical, quote, or measured. It is required whenever human_baseline is present. |
baseline_note |
string or null | No | Free text about the baseline. It is required, and not blank, when human_baseline is an empty list. It may be sensitive. |
change |
string or null | No | Why the task differs from the previous version: scope, re_estimate, basis, or schedule. schedule means no money moved. |
planned_start and planned_finish go together: give both or neither.
alr-emit also writes three extension fields on a task when the plan gives them:
client, cost_center, and work_type. Each holds the value of the matching tag,
without the key (see Extension Fields).
Each item of human_baseline:
| Field | Type | Required | Meaning |
|---|---|---|---|
role |
string | Yes | The role, in your own words. It may be sensitive. |
hours |
number | Yes | The hours this role would take, 0 or more. |
rate_usd |
number | Yes | The hourly rate for the role in US dollars, 0 or more. |
Each item of dropped_tasks:
| Field | Type | Required | Meaning |
|---|---|---|---|
task |
string | Yes | The dropped task. |
change |
string | Yes | Why it was dropped: scope, re_estimate, or basis. Never schedule, because dropping a task moves money. |
{"alr_schema":"alr-plan/0.1","project":"demo-app","cost_basis":"api-equivalent","plan_version":1,"issued_at":"2026-11-28T20:30:08Z","issued_by":"demo-dev","tasks":[{"task":"docs","budget_usd":2.00,"planned_start":"2026-10-13","planned_finish":"2026-10-16","human_baseline":[{"role":"technical writer","hours":4,"rate_usd":90}],"baseline_method":"estimate","baseline_note":"four hours of writing at the usual rate"},{"task":"review","budget_usd":1.00,"planned_start":"2026-10-14","planned_finish":"2026-10-15","human_baseline":[],"baseline_method":"estimate","baseline_note":"the reviewer's time is counted in the docs task"}],"reason":"first plan"}
Acceptance (alr-acceptance/0.1)¶
What it is for. Says that a task of a project is accepted, or that an earlier acceptance is withdrawn. A reader counts a task's human baseline only once the task is accepted.
When it is written. When you run alr accept, or alr accept --withdraw.
A task's acceptances are identified by project, task, and seq. The one with
the greatest seq decides the task's state, not the one with the latest
accepted_at.
Written by alr-emit 0.1¶
| Field | Type | Required | Meaning |
|---|---|---|---|
alr_schema |
string | Yes | Always alr-acceptance/0.1. |
project |
string | Yes | The value of the project: tag, without the key, as in the plan. |
task |
string | Yes | The value of the task: tag, without the key, as in the plan. |
seq |
integer | Yes | The place in the acceptances of this project and task, 1 or more. |
accepted_at |
string | Yes | When the task was accepted or the acceptance withdrawn. |
accepted_by |
string | Yes | Who accepted. It should differ from whoever did the work. |
withdrawn |
boolean | Yes | false for an acceptance. true for a withdrawal, after which the task is no longer accepted. |
grade |
integer or null | No | The accepting person's grade for the task, 1 to 5. It is a grade of the task, not of any request. It is null or missing on a withdrawal. |
evidence |
string or null | No | Where the accepted work can be found or checked, such as a link or a commit. It may be sensitive. |
reason |
string or null | No | Why the task was accepted or withdrawn. It may be sensitive. |
Defined by the Standard; alr-emit 0.1 Does Not Write It¶
None. alr-emit 0.1 writes every field of this type.
{"alr_schema":"alr-acceptance/0.1","project":"demo-app","task":"docs","seq":1,"accepted_at":"2026-11-28T20:30:08Z","accepted_by":"demo-reviewer","withdrawn":false,"grade":4,"evidence":"commit 1a2b3c4","reason":"reviewed and merged"}
How Amendments Apply¶
A reader never edits a line. It reads every line, then works out the current picture in a fixed order.
- Replace records that were restated. A record with
supersedesreplaces the record it names. A link is ignored when it points at the record itself, at a record of anotherrequest_id, at a record of anotheragent_id, or when the links form a loop. Records that share arequest_idwith no link between them are separate work, and they are added together. Of a chain of restatements, the latestemitted_atis current. The records that are current are the ones the steps below act on. - Apply tags. Start from the record's own
tags. Then apply the tag events that target it (see below). - Apply grades. For each request, the grade with the latest
graded_atwins. If two share a time, the greatergrade_idwins. - Apply cost corrections. A correction with an
alr_idreplaces the cost of that record, if it is current. A correction without one covers the request's current records written at or before itsoccurred_at. The latest correction wins. A correction that shares only some of its records with a later one is not applied and is reported. Totals are kept for eachcost_basis, and bases are never added together. A record whose cost is inside its parent's is never corrected, and a correction that names only such records is ignored and reported.
Plans, acceptances, and session events change no record and no total. Readers use them alongside the records.
Which Records a Tag Event Reaches¶
- With no
alr_id, the event applies to every record of itsrequest_id. - With an
alr_id, the event applies to that record's lineage: the record and every record it replaces or is replaced by. This keeps a tag on a turn when the turn's record is restated. - An event that matches no record is kept and reported, never applied or dropped.
This happens when the
alr_idis not held, names a record of another request, or when no record of therequest_idis held.
Which Event Wins¶
Tag events decide each tag on their own. For one record and one tag, the event with
the latest tagged_at wins. If two share a time, the greater tag_id wins, compared
byte by byte. An add that wins puts the tag on the record, and a remove that wins
takes it off. Tags the events never name stay as the record had them.
One-Value and Many-Value Tags¶
A reserved key (project:, task:, client:, cost_center:, work_type:) holds
one value for a record. An add of a reserved-key tag also removes every other tag
with that key, so adding task:writing replaces task:docs. A tag with any other
key, or with no key, is many-value: adding it keeps the others, and only a remove
takes it away.
Keys are compared byte by byte, so Project:x is an ordinary tag and not the
reserved project:. If a record still ends up with two values for one reserved key,
for example because two sources set it, the key is ambiguous. A reader reports the
ambiguity. It does not give the record to either value and does not split it. A
required key that is ambiguous still counts as present.
Moving a Tag¶
alr tag --move OLD NEW and /alr-tag move change a tag on turns already done.
For each turn, the move writes two alr-tag/0.1 lines: a remove of the old tag,
then an add of the new one. Each names the turn's record in alr_id. Every line
of one move carries the same reason and the same x_move id, and the lines are
written together in one append. A move also covers the records that each turn
started, such as a subagent's.
A move keeps the key: OLD and NEW must share the text before the first :. It
is all or nothing. If a turn does not carry the old tag, nothing is written. A turn
that already carries the new tag is left alone, so moving back restores the turns
exactly.
A reader that ignores x_move still applies both lines and gets the same tags. The
id only lets a tool show the two lines as one move. With --from-now, the move
also writes one session event, with the same x_move, for the tags in force from
the next turn.
Extension Fields¶
Every schema is open: additionalProperties is true in all of them. A producer
may add fields to any line at any time without changing the version, and a reader
must ignore the fields it does not know. This holds at every version.
OpenALR reserves one prefix for itself, alr_. A field you add should not start with
it. alr-emit names most of its own extension fields with an x_ prefix.
| Field | On | What It Holds |
|---|---|---|
x_move |
Tag events and session events | The id shared by every line of one move. |
x_command |
Session events | The command that made the change. |
x_undoes |
Session events | The event an undo reverted. |
x_grok_turn_number |
Grok Build records | Grok Build's own number for the turn. |
x_grok_pairing |
Grok Build records | A note on a turn that could not be paired cleanly. |
x_grok_cancelled_turns |
Grok Build records | The usage of cancelled turns a record carries. |
client, cost_center, work_type |
Plan tasks | The value of the task's client:, cost_center:, or work_type: tag, without the key. |
claude_code_usage |
Claude Code records | How the cache-write tokens split between the 5-minute and 1-hour caches. |
A reader may rely on the fields the schema names. It must not rely on an extension field being there.
Versioning¶
Every record and amendment names its schema in alr_schema, such as alr/0.1,
alr-grade/0.1, or alr-cost/0.1. A reader chooses the schema to check a line
against by reading that value. It does not guess, and it does not go by the file's
place.
While OpenALR is before 1.0:
- A minor revision, such as
alr/0.1toalr/0.2, may add new optional fields. - A minor revision must not rename, remove, or change the type of any field, required or optional.
- Any change that would break an existing reader must change the schema string, even before 1.0. That includes renaming, removing, or retyping a field, and changing whether a field is required.
- Unknown fields are always legal, at every version.
The alr/0.1 specification froze on 2026-11-06. Until 2026-12-01, only fixes to
wording, and to how readers are told to read the format, are admitted. No new
fields, events, enum values, or schema strings are. From 2026-12-01 on, every change
follows the rules above, and a new optional field needs a new minor schema string,
such as alr/0.2.
No Prompts or Replies¶
A record never holds a prompt or a reply. It holds counts, ids, names, times, and
figures. The fields that carry free text are the ones you write yourself: a grade's
comment, a tag's or a session event's reason, an acceptance's evidence, a
plan's baseline_note and role names. These may be sensitive. Check them before
you share records outside your organization.
Checking a Record File¶
alr check lists the lines and documents the viewer could not use. To test whether
a line is valid, check it against its JSON Schema.
For the words used to describe a record's cost, see How Costs Are Computed.