Skip to content

I0806 — Make the session rules doctrines, with retention and archiving

Declare the session rules in share/standard/majordomus/ with validators that doctor and watch dispatch — a malformed active or closed record, a session left open past its policy, a reference to a record that does not exist, and retention over the declared cap — and implement policy-driven archiving that never deletes and never overwrites.

READY wave 4 · p1 · implementation profile · runs alone

Part of M003 — A session is a durable envelope, and knowledge is compiled from what is already canonical.

Ready. Every dependency is done, so majordomus plan start I0806 will be accepted.

Objective

Declare the session rules in share/standard/majordomus/ with validators that doctor and watch dispatch — a malformed active or closed record, a session left open past its policy, a reference to a record that does not exist, and retention over the declared cap — and implement policy-driven archiving that never deletes and never overwrites.

Why

A rule enforced by an inline check in one command is the declared-but-not-wired failure this tool measures in other people's repositories. Every enforced rule here is declared in the registry and dispatched from it, or it is not enforced.

Current state

The doctrine registry declares every enforced rule with a validator, the commands that dispatch it, a claim and a test. history --rotate is the existing precedent for retention that archives rather than deletes and refuses to overwrite an existing archive.

Desired state

session_record_integrity and session_reference_integrity are declared and dispatched. The policy carries a session block with the retention cap and whether archiving is enabled, its keys are in the policy allowlist, and majordomus.retention-caps reports sessions alongside checkpoints and handovers. Archiving happens only when a command asks for it.

Scope

  • share/standard/majordomus/
  • share/allow/policy.txt
  • share/skeleton
  • lib/session.sh
  • lib/doctor.sh
  • lib/watch.sh
  • .majordomus/policy.yaml
  • test/cases/63_session_doctrines.sh

Out of scope

  • Any background or automatic maintenance
  • Deleting a record under any circumstance

Dependencies

What waits on this

Acceptance criteria

  • Both doctrines appear in doctrine list with a validator that exists, and doctor proves each reaches the command that claims to run it
  • A malformed closed record fails doctor and drifts watch, and the finding carries a reproduce command
  • A session naming a checkpoint path that does not exist is reported, naming both
  • Archiving moves records without deleting them and refuses to overwrite an existing archive
  • A session left open longer than the policy allows is reported by watch and does not block anything

Validation

  • bash test/run.sh 63_session_doctrines
  • bin/majordomus doctor
  • bin/majordomus watch

Evidence required

  • session_doctrines_wired

Evidence

None recorded. Every token above needs a command or an artifact behind it before this issue can be completed; narrative is refused.

Risk

An open session is normal for most of its life, so the staleness rule has to be advisory. A blocking check on an open session would refuse work during the episode it is meant to describe.

Timeline

started
verified
completed

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/I0806.yaml. Read it back with majordomus plan show I0806.