SPEC-003: Run log¶
- Status: Implemented
- Milestone: M1
- Owners: lead maintainer
1. Purpose¶
The log is the product. Everything a viewer, evaluator or report needs MUST be in it; nothing is recomputed by rerunning. This spec fixes the format first because everything reads it. Machine-readable form: specs/schemas/runlog.schema.json.
2. Terms¶
- Log: a UTF-8 JSONL file, one event per line. Event: one JSON object.
- Log version: integer
log_version, starting at 1.
3. Requirements¶
Format¶
- LOG-001 A log MUST be UTF-8 JSON Lines: one JSON object per line,
\nseparators, no blank lines. - LOG-002 Every event MUST contain
type(string),seq(integer, 0 for the first event, increasing by 1) andts(UTC ISO-8601 timestamp). - LOG-003 The first event MUST be
run_startand the last MUST berun_end. A log withoutrun_endis incomplete and tools MUST say so. - LOG-004 Every log MUST validate against
runlog.schema.json; unknown event types and fields MUST be ignored by readers (forward compatibility), but MUST NOT be emitted by this version.
Event types¶
- LOG-005
run_startMUST contain:log_version,run_id,seed,world(name, version),agents(list of id, kind, model if known, capabilities),limits,scenario_sha256, andversions(agentplaykit, python, platform). - LOG-006
turn_startMUST containstepandto_act. - LOG-007
observationMUST containagent,stepand the observation data exactly as sent. - LOG-008
actionMUST containagent,step, the submittedactionand optionalreasoning. - LOG-009
step_resultMUST containagent,step,ok,error,done,rewards,info. - LOG-010
messageMUST containfrom,to(agent ID, list, or"*"for public),textandstep(SPEC-008). - LOG-011
usageMUST containagent,step,input_tokens,output_tokens,cost_usd,provider,model(as the provider reports) and cumulativetotal_cost_usd. - LOG-012
provider_errorandagent_errorMUST be separate event types, each withagent,step,messageand, for provider errors,attemptandretryable. - LOG-013
forfeitMUST containagent,reason;limit_hitMUST containlimit(steps,time,cost) andvalue. - LOG-019
message_droppedMUST containfrom,to,text,stepandreason(SPEC-008 MSG-011). - LOG-020
warningMUST containmessageand MAY containagent; it records conditions a reader should know about, such as an agent whose cost is unknown. - LOG-021
usageMAY also containmode("tool"or"text", how the action was obtained) andestimated(true when token counts were estimated).limit_hit.limitMAY also be"tokens". - LOG-022
run_start.worldMUST carry the world'sviewwhen itsdescribe()declares one (SPEC-012). Additive; readers MUST treat a missingviewas "no hint". - LOG-014
run_endMUST containreason(finished,step_limit,time_limit,budget_exceeded,forfeit,world_error,aborted),outcome(winners, scores, or null),steps,total_cost_usdandduration_s.
Integrity and safety¶
- LOG-015 Only
corewrites the log, and it MUST flush each event so a crashed run keeps what happened. - LOG-016 Secrets MUST be redacted before writing (SEC-002). Redaction replaces the value with
"[REDACTED]". - LOG-017 Given the same config, seed and recorded agent replies, the log MUST be byte-identical apart from
ts,run_id,duration_sandversions; golden tests pin the format with these fields normalized. - LOG-023 Each
run_start.agents[]entry MUST carryuse(the scenario reference as written) when the run comes from a scenario, andnamewhen the scenario gives one (SPEC-013 RPT-001). Additive; readers MUST treat both as optional. - LOG-024
run_end.outcomeMAY carry extra world data such aschecksandsandbox(SPEC-014).run_endMUST carryerror(redacted, SEC-002) when the run endedworld_errororaborted. Additive; readers MUST treat both as optional. - LOG-018 A schema change that breaks readers MUST bump
log_versionand add a migration note.
4. Acceptance criteria¶
| Requirement | Test ID | Notes |
|---|---|---|
| LOG-001..004 | LOG-001..LOG-004 |
every test-suite log validates against the schema |
| LOG-005..014 | LOG-005..LOG-014 |
one sample per event type |
| LOG-015..016 | LOG-015, LOG-016 |
crash mid-run; planted fake key never appears |
| LOG-017 | LOG-017 |
golden log |
| LOG-018 | LOG-018 |
schema carries log_version const |
5. Examples¶
{"seq":0,"ts":"2026-11-30T10:00:00Z","type":"run_start","log_version":1,"run_id":"r1","seed":7,"world":{"name":"tic-tac-toe","version":"1"},"agents":[{"id":"x","kind":"scripted"},{"id":"o","kind":"scripted"}],"limits":{"max_steps":50},"scenario_sha256":"…","versions":{"agentplaykit":"0.1.0","python":"3.12.0","platform":"linux"}}
{"seq":1,"ts":"2026-11-30T10:00:00Z","type":"turn_start","step":0,"to_act":["x"]}
6. Open questions¶
- Compress large logs (
.jsonl.gz)? Deferred. - Store full raw provider responses? Default no (cost, secrets); optional later.
7. Change log¶
- 2026-11-30: Initial draft.
- 2026-11-30: Accepted by the lead maintainer.
- 2026-11-30: Added LOG-019 (
message_droppedevent). Additive;log_versionstays 1 before the first release. - 2026-11-30: Added LOG-020 (
warning) and LOG-021 (usagemode/estimated, token limit). Additive. - 2026-11-30: Implemented in v0.1.0; every requirement has a test (PRO-004, PRO-011).
- 2026-11-30: The reference world
oxis renamedtic-tac-toe(ADR-0006); no alias. - 2026-12-01: Added LOG-022 (
world.view), with SPEC-012.log_versionstays 1. - 2026-12-01: Added LOG-023 (agent
useandnameinrun_start), with SPEC-013.log_versionstays 1. - 2026-12-01: Added LOG-024 (
run_end.error, extra outcome data), with SPEC-014.log_versionstays 1.