Skip to content

The right prior record is resolved by worktree and branch, and an unrelated one is never offered

handover --resolve, checkpoint --show and context all answer the same question: of the records on disk, which one is about the work happening here? The answer is deterministic, it is explained, and when there is no safe answer it says so instead of offering the nearest thing.

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

Same worktree and branch, else same branch, else nothing. Ties within one second are broken by ledger order. Absence is reported as absence.

What it means

handover --resolve, checkpoint --show and context all answer the same question: of the records on disk, which one is about the work happening here? The answer is deterministic, it is explained, and when there is no safe answer it says so instead of offering the nearest thing.

How it works

mj_resolve_latest in lib/common.sh reads every record's front matter and keeps only candidates in the same repository, then ranks:

  1. same worktree and same branch
  2. same branch, when the branch is not detached
  3. nothing

There is no repository-wide tier. A record from another worktree or another branch is never a fallback, because a worker cannot tell that borrowed context is wrong until it has already acted on it.

Within a tier the newest wins. created_at has second resolution, so two records written inside one second would otherwise be ordered by their random filename suffixes; the ledger is append-only and written in command order, so mj_record_rank uses position in the ledger as the tiebreak — the one portable monotonic ordering available without sub-second timestamps.

The result carries its reasoning: the match class, the git label comparing the recorded head with the current one, the record's age, and its task. A malformed record is skipped with a warning on stderr, never silently, and doctor fails when any record was skipped.

How to see it

majordomus handover --resolve
# Handover: .ai/local/state/handovers/20260903T201455Z--main--9b1e2d4--c0ffee12.md
# Match: same_worktree_same_branch
# Git state: advanced
# Created: 2026-09-03T20:14:55Z (37m ago)
# Task: t-20260903193012-a4f1

git checkout -b unrelated
majordomus handover --resolve
# No relevant handover.

What it does not cover

It does not judge the content. A record that resolves may still be wrong; the git label tells you how far the repository has moved, and the rest is your judgement.

It does not follow a record across a rewritten history. A diverged label means the recorded commit is not an ancestor of the current one, and the record is reported rather than reinterpreted.

It does not merge records. The newest compatible one is offered whole.

Why it exists

The failure mode this prevents is specific and quiet: a repository accumulates records, a session on an unrelated branch resolves the globally newest one, and the worker proceeds confidently against another task's state. Absence is better than incorrect memory, so the resolver stops rather than reaching further.

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

From the statement to the proof

  1. 1 · the public statement

    The right prior record is resolved by worktree and branch, and an unrelated one is never offered

    Made on Continuity, Handover.

  2. 2 · the canonical claim

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

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

  3. 3 · the implementation

    lib/common.sh

  4. 4 · the test and the scenarios

    Test: test/cases/23_context.sh

    Executed in Hand work over with a question still open, and keep it blocking, Resume in the right worktree, never against somebody else’s task.

  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 23_context

Where this claim is used

responsibilities it covers

Related claims same implementation

The moments this answers

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