Skip to content

Hand unfinished work to the next session

Stop mid-task and leave the next worker something to act on that is not a transcript.

verified Sessions and handoverbasicagentcontributorwrites state

Situation

A session ends with the work half done. The usual handover is a paste of the conversation, which the next worker has to read in full to find the three facts that matter, and which is stale the moment the branch moves.

What you run

  • checkpoint: a short progress record inside the active task, refused if it grows into a report
  • handover: an append-only record with computed front matter and the sections the policy requires
  • context: the next session reads this instead of the transcript, within a line budget

Scenario

setup: active-task
given:
  - 'an active task scoped to lib, with work done inside that scope'
steps:
  - id: checkpoint
    run: ['checkpoint']
    stdin: checkpoint-body.md
    note: 'a short progress record inside the task'
    expect:
      exit: 0
      stdout_contains: ['\.ai/local/state/checkpoints/']
  - id: handover
    run: ['handover']
    stdin: handover-body.md
    note: 'the record the next session resumes from, with the sections the policy requires'
    expect:
      exit: 0
      stdout_contains: ['\.ai/local/state/handovers/']
  - id: resume
    run: ['context']
    note: 'what the next worker reads instead of a transcript'
    expect:
      exit: 0
      stdout_contains: ['^## GIT', '^## TASK', 'narrow the parser']
  - id: verify
    run: ['check']
    note: 'the task is still consistent with git'
    expect:
      exit: 0
      stdout_contains: ['0 failing']
then:
  - 'the handover carries the branch and head it was written at'
  - 'the next context names the task, the profile and the scope'

Outcome

The next worker starts from durable state with the git position it was written at, and is told how far the repository has moved since.

The scenario

Executed against the real tool, in a repository prepared by active-task, every time this site is generated. What follows is not a description of what should happen; it is what happened.

given

  • an active task scoped to lib, with work done inside that scope

when

  1. 1majordomus checkpoint
  2. 2majordomus handover
  3. 3majordomus context
  4. 4majordomus check

then

  • the handover carries the branch and head it was written at
  • the next context names the task, the profile and the scope

What the tool did

Evidence of the run this page was generated from: pass, 4 step(s). Output is normalised: the repository's path, timestamps, ids and durations are placeholders; nothing else is edited.

Tested by test/cases/94_use_cases.sh, which runs every scenario and refuses a step whose recorded output is not what it produced.

  1. 1$ majordomus checkpoint exit 0< checkpoint-body.md

    a short progress record inside the task

    .ai/local/state/checkpoints/<time>--main--<head>--<hash>.md
    • exit 0
    • stdout_contains /\.ai/local/state/checkpoints//
  2. 2$ majordomus handover exit 0< handover-body.md

    the record the next session resumes from, with the sections the policy requires

    .ai/local/state/handovers/<time>--main--<head>--<hash>.md
    • exit 0
    • stdout_contains /\.ai/local/state/handovers//
  3. what the next worker reads instead of a transcript

    # Majordomus context — <time>
    # a projection of durable state, not a source of truth: validate every line against git
    
    ## GIT
    repository   <repo>
    branch       main
    head         <sha>
    working_tree dirty
    task_record  exact (recorded head <head>)
    
    ## TASK
    id           t-<id>
    task         narrow the parser
    profile      implementation
    owner        <owner>
    outcome      active
    scope        lib
    started      <time> (<age> ago)
    checkpoint   <time> (<age> ago, interval 15m)
    
    ## PROFILE implementation
    capability   standard
    effort       medium
    verbosity    concise
    presentation engineering
    verification verify command
    output       outcome, changes, verification, blockers, next_action
    
    ## CONTEXT DOCUMENTS (for the scope, root first; majordomus context explain <path>)
    lib  ai.layer
    
    ## KNOWLEDGE (candidates awaiting review on this branch; majordomus knowledge candidates)
    No knowledge candidates await review on this branch. That is an answer, not a gap: `majordomus knowledge candidates` lists every branch.
    
    ## DECISIONS (5 most recent for this task)
    (none)
    
    ## LATEST CHECKPOINT (.ai/local/state/checkpoints/<time>--main--<head>--<hash>.md, <age> ago, exact)
    the parser now refuses tabs; the message names the column
    
    ## LATEST COMPATIBLE HANDOVER (.ai/local/state/handovers/<time>--main--<head>--<hash>.md)
    match        same_worktree_same_branch
    git state    exact
    created      <time> (<age> ago)
    task         t-<id>
    # Objective
    narrow the parser
    # Current State
    tabs are refused with a message
    # Next Action
    none
    
    ## FILES TOUCHED IN SCOPE (1)
    lib/a
    
    ## EXCLUDED
    - history — profile implementation sets context.recent_history_depth: 0
    
    ## BUDGET
    60 of 300 lines
    • exit 0
    • stdout_contains /^## GIT/
    • stdout_contains /^## TASK/
    • stdout_contains /narrow the parser/
  4. the task is still consistent with git

    OK   knowledge   records — 0 record(s) valid against knowledge/v1; every reference resolves  [reproduce: majordomus knowledge check]
    ·    checkpoint  t-<id> — <timed against the checkpoint interval>
    INFO checkpoint  .ai/local/state/checkpoints/<time>--main--<head>--<hash>.md — newest record, <age> ago  [reproduce: majordomus checkpoint --show]
    OK   records     ledger.jsonl — every line is a well-formed event
    OK   blockers    t-<id> — none open
    OK   records     decisions.md — every entry is attributable
    OK   scope       t-<id> — 1 touched file(s), all within scope
    OK   state       t-<id> — exact (head <head>)
    INFO mesh        t-<id> — the repository declares no enabled mesh
    INFO use-case    30 advisory gap(s) — not covered by an active use case, and the policy does not require it: command:init command:update command:doctor command:watch command:start command:context command:checkpoint command:handover command:check command:finish command:history command:decision command:question command:prompt command:evidence command:skills command:capture command:search command:doctrine command:plan command:version command:session command:knowledge command:adr command:usecase command:rules command:migrate command:recover command:bench command:archive  [reproduce: majordomus usecase coverage]
    OK   use-case    0 of 30 target(s) covered — every public command the policy requires is named and run by an active use case (policy use_cases.coverage)
    INFO obligation  t-<id> — the task declares no obligations
    INFO gate        t-<id> — this repository declares no CI model at .ai/repo/ci/gates.yaml; nothing can be planned
    check: 13 finding(s), 0 failing
    • exit 0
    • stdout_contains /0 failing/

Why the tool knows this

The chain from this page to the code: the use case names commands, rules and claims; each rule is dispatched from the registry and each claim names the test that proves it; the scenario above executed the commands. Nothing in this chain is prose about intent.

The rules that make it hold

Guarantees exercised

Related use cases

Computed from what they share: claims, rules, commands, category, applications. Nobody maintains this list.

The moments this answers

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