Skip to content

Rotating the ledger archives the oldest lines and never deletes them

ledger.retention_max_lines has always been reported by doctor and watch when exceeded. majordomus history --rotate is the action that resolves it: the oldest lines move into a dated archive file beside the ledger, and the newest stay.

declared statusdeclared status: guaranteed Declared deterministic and blocking, implemented, and naming the behavioural test that is to prove it. Whether a recorded run supports it is the evidence verdict, shown beside it.

recorded evidencerecorded evidence: not run Declared guaranteed, and not supported by a recorded run: the test is named, and no passing run of the current inputs is recorded. how evidence is recorded

Refuses to overwrite an existing archive, and does nothing when the ledger is under its cap.

What it means

ledger.retention_max_lines has always been reported by doctor and watch when exceeded. majordomus history --rotate is the action that resolves it: the oldest lines move into a dated archive file beside the ledger, and the newest stay.

Nothing is deleted, ever.

How it works

The archive is state/ledger.<utc-compact>.jsonl.archived. Rotation refuses if that path already exists rather than appending to or overwriting it, writes the archive before truncating the ledger, and appends a ledger.rotated event recording how many lines moved, how many were kept, and the archive's path — so the history of the history is itself in the history.

Under the cap it does nothing and says so, rather than producing an empty archive.

How to see it

before=$(wc -l < .ai/local/state/ledger.jsonl)
majordomus history --rotate
# rotated: 4812 line(s) to .ai/local/state/ledger.20260903T204411Z.jsonl.archived, 5000 kept

archived=$(wc -l < .ai/local/state/ledger.*.jsonl.archived)
kept=$(wc -l < .ai/local/state/ledger.jsonl)
# archived + kept accounts for every line that existed, plus the rotation event itself

majordomus history --event ledger.rotated --all

What it does not cover

Rotation is manual. Nothing rotates on a schedule or on write; doctor and watch report the cap and a person or a hook decides. A tool that silently truncated a record store while you were not looking would be the opposite of the point.

history reads the live ledger only. An archived file is a plain JSONL you can read yourself; nothing joins it back automatically.

Handover and checkpoint stores have caps that are reported and never enforced. There is no rotation for record files, because deleting a continuation record is a decision a person should make deliberately.

Why it exists

Append-only stores that nobody prunes become the thing that made an append-only store seem like a bad idea. One repository in the material this design came from accumulated gigabytes of snapshots that nothing ever read. A cap with no action is a nag; an action that deletes is a hazard. Archiving is the version that is safe to run.

Detail rendered from docs/claims/record-retention.md.

From the statement to the proof

  1. 1 · the public statement

    Rotating the ledger archives the oldest lines and never deletes them

    Made on Provenance, Watch.

  2. 2 · the canonical claim

    record-retentiondeclared status: guaranteed in docs/CLAIMS.yaml

    Defined in read it on this site · docs/SCHEMAS.md

  3. 3 · the implementation

    lib/history.sh · majordomus history

  4. 4 · the test and the scenarios

    Test: test/cases/22_history.sh

    Executed in Read back what happened, and keep the ledger within its cap.

  5. 5 · the recorded runs

    recorded evidence: not run how evidence is recorded

Verify it yourself

The test runs in a disposable temporary repository and asserts the behaviour, not a string in the source.

from a clone of the repository
bash test/run.sh 22_history

Where this claim is used

Related claims same implementation

The moments this answers

Searches the titles and descriptions of every page this site publishes.