Skip to content

Record what one worker did in one sitting

Open a session, do the work under whatever tasks it touches, and close it into an envelope that references what it produced and copies nothing.

guaranteed Sessions and handoverbasicagentoperatorwrites state

Situation

A worker touches two tasks in one sitting and makes two decisions an hour apart. Nothing records that one worker made both, so later they look unrelated, and the only witness is a conversation nobody can search.

Scenario

setup: installed
given:
  - 'Majordomus installed, no session open'
steps:
  - id: open
    run: ['session', 'start', '--worker', 'some-provider/some-model']
    note: 'one execution episode of one worker begins'
    expect:
      exit: 0
      stdout_contains: ['^session s-[0-9]+-[0-9a-f]+ opened at']
  - id: refuse-a-second
    run: ['session', 'start']
    note: 'one session per checkout at a time'
    expect:
      exit: 15
      stdout_contains: ['is open here']
  - id: close
    run: ['session', 'close']
    note: 'the envelope: identity, a temporal boundary, references to what the episode produced'
    expect:
      exit: 0
      stdout_contains: ['^\.ai/repo/sessions/']
  - id: an-object-of-the-layer
    run: ['knowledge', 'nodes', '--kind', 'session']
    note: 'the record is a shared object the moment it is committed: one source class discovers it, and the index, MCP, the object routes, the graph and the site follow without being told'
    expect:
      exit: 0
  - id: ledger
    run: ['history']
    note: 'the ledger carries both ends of the episode'
    expect:
      exit: 0
      stdout_contains: ['session.started', 'session.closed']
then:
  - 'a closed session is an envelope, never a transcript'
  - 'the envelope is a shared object of the layer, discovered rather than registered'
  - 'which work happened together, and in what order, is answerable'

Outcome

The session is a record with a start and an end; while it is open it is the one execution episode of this checkout, and once closed it references the tasks, records and decisions it produced and copies none of them.

The scenario

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

given

  • Majordomus installed, no session open

when

  1. 1majordomus session start --worker some-provider/some-model
  2. 2majordomus session start
  3. 3majordomus session close
  4. 4majordomus knowledge nodes --kind session
  5. 5majordomus history

then

  • a closed session is an envelope, never a transcript
  • the envelope is a shared object of the layer, discovered rather than registered
  • which work happened together, and in what order, is answerable

What the tool did

Evidence of the run this page was generated from: pass, 5 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. one execution episode of one worker begins

    session s-<id> opened at <time> (head <head>)
    working context: .ai/local/session-contexts/<time>--s-<id>.md
    next: majordomus plan next; majordomus context; majordomus session close when the episode ends
    • exit 0
    • stdout_contains /^session s-[0-9]+-[0-9a-f]+ opened at/
  2. one session per checkout at a time

    majordomus: session s-<id> is open here since <time>; run majordomus session close first
    • exit 15
    • stdout_contains /is open here/
  3. the envelope: identity, a temporal boundary, references to what the episode produced

    majordomus: session close: knowledge derived: knowledge derive: 0 written, 0 unchanged, 0 skipped for episode s-<id>
    .ai/repo/sessions/<time>--s-<id>--main--<head>--<hash>.md
    • exit 0
    • stdout_contains /^\.ai/repo/sessions//
  4. the record is a shared object the moment it is committed: one source class discovers it, and the index, MCP, the object routes, the graph and the site follow without being told

    knowledge nodes: 0 in scope all, kind session
    INFO knowledge   . — the schema check was not asked for (MAJORDOMUS_KNOWLEDGE_SCHEMA=unasked), so no file was checked against the schema of its kind
    • exit 0
  5. the ledger carries both ends of the episode

    <time>  projections.updated -                      <head>  targets=3
    <time>  session.started     -                      <head>  
    <time>  knowledge.derived   -                      <head>  
    <time>  session.closed      -                      <head>  
    • exit 0
    • stdout_contains /session.started/
    • stdout_contains /session.closed/

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.