Skip to content

I2301 — Whether the work is done is answered by measurement: the done invariant asks about debt, what was left behind and the backlog

Add to the done invariant the three questions a person asks when a session ends that it does not yet ask — did the recorded debt grow, is a branch or worktree created since the task started still there, is a pull request opened since still open — each read from the record that holds the fact, and state as a project rule that a closing question is answered by that reading and never by a worker's recollection.

DONE wave 0 · p1 · implementation profile · parallel safe

Part of development-runtime — The runtime has a development surface.

Objective

Add to the done invariant the three questions a person asks when a session ends that it does not yet ask — did the recorded debt grow, is a branch or worktree created since the task started still there, is a pull request opened since still open — each read from the record that holds the fact, and state as a project rule that a closing question is answered by that reading and never by a worker's recollection.

Why

On 2026-10-10 the owner asked one session seven times whether everything was done, merged and deployed, whether debt was added, and whether there were fewer pull requests, branches and worktrees than at the start. Each of the seven answers was written from what the session remembered doing and described only its own footprint. Measured on the eighth: 52 pull requests open against 49 at the session's start, 42 conflicting with the trunk; 117 worktrees where the previous session left 96; 225 local branches, 59 reached by the trunk and 13 holding commits no remote had; 10 stashes unaudited; v0.20.0 untagged. The done invariant (apps/majordomus-cli/src/gates/done.rs) asked nineteen questions of a task and took every answer from its source, but none of the nineteen was about the repository over time, so that half of the question had nowhere to be read from. Owner order of 2026-10-10 16:00Z: enforce it, cover it with tests, in .ai, document it in the pages.

Current state

gates.completion carries nineteen questions; `no-stale-topology` reads convergence.report (work held on one disk). Nothing reads whether a debt baseline grew, what was created since the task started, or what the forge's backlog gained. No rule says how a closing question is answered.

Desired state

gates.completion carries twenty-two questions. `no-new-debt` compares the entries of every .ai/repo/*-baseline.txt at the commit the task started at with the working tree and refuses on growth, naming the baseline and the numbers; `nothing-accumulated` names the local branches and linked worktrees git's reflogs date since the task started and is owed while one remains; `backlog-not-grown` numbers the pull requests the recorded forge observation dates since the task started. A reading that could not be taken is unknown and says why. `majordomus check` names each as id=status. project.a-closing-question-is-answered-by-measurement states the behaviour and names its cases; docs/CLI.md documents the three questions and the claim the-closing-question-is-measured has its page.

Scope

  • apps/majordomus-cli/src/gates/closing.rs
  • apps/majordomus-cli/src/gates/done.rs
  • apps/majordomus-cli/src/gates/mod.rs
  • apps/majordomus-cli/src/capability/builtin/gates.rs
  • .ai/repo/rules/project
  • .ai/repo/workflows/task-lifecycle.md
  • lib/gates.sh
  • docs/CLI.md
  • docs/CLAIMS.yaml
  • docs/claims/the-closing-question-is-measured.md
  • test/cases/1037_the_closing_question_is_measured.sh
  • test/cases/131_completion_gates.sh

Out of scope

  • A count of branches, worktrees and pull requests recorded at the start, and with it an exact 'fewer than at the start': removals leave no record in git, so that needs a snapshot written when a task or an episode opens, which is a change to the records the shell tool writes and their schemas.
  • Attributing a branch or a worktree to the session that created it: git records no creator.
  • Refusing `finish` on these questions: the done invariant is reported by `check`, and what refuses completion stays the gates and the obligations.
  • Removing anything: reduction is project.accumulation-is-measured's, and pull request 882's.

Dependencies

None. This issue is a root of the graph.

Acceptance criteria

  • An entry added to a debt baseline since the task's first commit makes `no-new-debt` fail and names the baseline with its entries then and now, whether or not the addition is committed; removing it answers the question
  • A baseline that did not exist at the task's first commit is named as recorded for the first time and is not growth
  • A branch and a linked worktree created after the task started make `nothing-accumulated` queued and are named; it passes once both are gone
  • A pull request the recorded observation dates after the task's start makes `backlog-not-grown` queued and is numbered; an observation older than the task, or none, is unknown with the reason
  • With no task record the three questions are unknown and say that there is no start to measure from
  • `majordomus check` names each of the three that is not answered as id=status

Validation

  • bin/majordomus plan validate
  • MJ_TEST_JOBS=4 bash test/run.sh 1037_the_closing_question_is_measured
  • MJ_TEST_JOBS=4 bash test/run.sh 131_completion_gates
  • cargo test --manifest-path apps/majordomus-cli/Cargo.toml --lib gates::

Evidence required

  • closing_readings_unit_tests
  • the_closing_question_is_measured_case

Evidence

coverstypecommandresultat commit
closing_readings_unit_teststestcargo test --manifest-path apps/majordomus-cli/Cargo.toml --lib gates::ok at ecb51b2772: 59 passed, 0 failed; the closing readings over a real repository, an unread reading unknown, growth in one baseline not paid for by anotherecb51b2
the_closing_question_is_measured_casetestMJ_TEST_JOBS=4 bash test/run.sh 1037_the_closing_question_is_measured 131_completion_gatesok at ecb51b2772: case 1037 (119 s) with its mutation, case 131 (1390 s); majordomus check names no-new-debt, nothing-accumulated and backlog-not-grown as id=statusecb51b2

Timeline

started
2026-10-10T21:36:49Z
verified
2026-10-10T21:36:58Z
completed
2026-10-10T21:56:14Z

Those three fields, the evidence above and the state of the dependencies are all the status is made of. There is no status field to disagree with them.

Canonical record: .ai/repo/project/issues/I2301.yaml. Read it back with majordomus plan show I2301.

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