Skip to content
Cockpit0.29.0
A snapshot: read at commit 707a04c7ce8 on 2026-10-18T00:06:01Z by majordomus 0.29.0. Nothing on this page is read again. See it live

I0804

Close a session into an envelope derived from the ledger

Where it stands

devtask.issue
Readiness
complete completion is recorded and every required evidence token is present
Status
DONE
Can start
not now
Milestone
Milestone status
ACTIVE
Wave
2
Waiting on
none
Holds back
Behind it in all
5
Evidence
2 of 2
A move writes the repository: it stamps one field of this issue's record and appends one event to the ledger, and a commit will carry both.
The same moves from a terminal

majordomus plan start I0804

majordomus plan verify I0804

majordomus plan done I0804

What it is

Objective
Implement `session close`: read the active record, derive the episode's references from the ledger between its start and now, write an immutable closed record with computed end-state git facts and an optional authored summary body, remove the active record, and append the close event to the ledger.
Why
This is the mechanism that makes the session an envelope rather than a narrative. Nothing accumulates references during the episode, so no command outside session pays for them; and because the ledger is append-only and machine-written, the envelope is a derivation of existing evidence rather than a second account of it.
Now
The ledger records task, checkpoint, handover, finish, decision, question, plan and maintenance events, each with a timestamp, a branch and a head. Nothing reads a time range out of it.
Wanted
A closed record under .majordomus/state/sessions/ carries the computed identity, started_at and closed_at, start and end head and working tree, the outcome, and reference lists of task ids, issue ids, milestone ids, checkpoint paths, handover paths, decision entries and question ids observed in the ledger window. It copies no body. An authored summary on stdin is optional and is stored as the record body, subject to the identity-field refusal every other record uses.
Done when
unknown: the record declares no `completion`
Risk
The ledger window is bounded by timestamps with second resolution, so two episodes that abut within one second could each claim an event. The ledger's line order is the existing tiebreak for exactly this and has to be used rather than the timestamps alone.

Acceptance

  • Closing writes an immutable record, removes the active record, and appends one ledger event
  • The reference lists match the events the ledger holds in the window, and nothing outside the window appears
  • An episode that spans two tasks names both; a task that spans two sessions is named by both
  • No body of any referenced record appears in the session file, and a case asserts that
  • An authored summary containing an identity field is refused, as it is for a checkpoint
Validation
bash test/run.sh 60_session_lifecyclebash test/run.sh 61_session_envelope
Evidence required
session_closesenvelope_is_references
Evidence present
session_closesenvelope_is_references

Scope

Touches
lib/session.shtest/cases/60_session_lifecycle.shtest/cases/61_session_envelope.sh
Not
Reading a closed record back, which is its own issueRetention and archivingAny copying of a checkpoint, handover or decision body into the session file
Depends on
Priority
p1
Profile
deep-work
Parallel safe
false
Owner
unknown: the record declares no `owner`

The work so far

Branches
none
Merged
none
Commits
0
Trunk
master
Sessions
none
Created
2026-09-04
Updated
2026-09-04T17:38:33Z
Started
2026-09-04T17:26:46Z
Verified
unknown: the record declares no `verified_at`
Completed
2026-09-04T17:38:33Z

Synchronisation

Adapter
scripts/github-sync
Repository
unknown: the derived plan's header carries no repository
External issue
unknown: a live GitHub state; this executable makes no network call, so only `scripts/github-sync --check` can answer it
State there
unknown: a live GitHub state; this executable makes no network call, so only `scripts/github-sync --check` can answer it

Findings

Nothing is wrong with these records.