# LIFECYCLE-v2

Lifecycle rule version 2 of this record: the rule by which every difference
this record detects between two readings of a tracked document is placed in
exactly one stage, with the basis of the act that placed it. The stages are
five, in this order:

OBSERVED → DIFFERENCE DETECTED → CANDIDATE RESOLVED (confirmed · not-changed ·
blocked · undetermined) → REVISION CONFIRMED → EVIDENCE RECORD PUBLISHED.

OBSERVED is counted in observation days of tracked entries, not in
differences: a day on which a reading was taken and no difference was
recorded. A difference enters at DIFFERENCE DETECTED, and every difference is
in one of the four stages after OBSERVED.

The projection `state/lifecycle.json` is rebuilt every night from the stores
it reads, which it never writes: the observation store, the staging store
`state/revision-staging/`, the nightly placements `state/candidate-states.json`,
the acts (`confirmations.jsonl` in `state/`), the receipts
`state/revision-confirmations.jsonl`, the reconciliation events
`state/reconciliations.jsonl` and the revision entries under
`src/content/revisions/`. The projection holds the counts under `counts`, and
one function writes them. The method page lists the pages and endpoints that
read their counts of a stage from there, and the figures that are still read
from another store.

The counts include one partition of the candidates in four parts:
`offered` (confirmed, with a document as subject), `offered_witness`
(confirmed, with the page about a document as subject), `waiting` (at
DIFFERENCE DETECTED) and `withheld` (resolved as not-changed, blocked or
undetermined). `front_line_by_day` holds the same partition for each day a
candidate's id carries.

What version 2 changes from version 1, and nothing else: it reads the
reconciliation events, and adds step 10. A reconciliation event is written by
`scripts/machine_confirm.py --reconcile` for a revision confirmed by a recorded
act that no verdict receipt names. It is dated the day it is written, its basis
is derived, and it cites the act's line, the two digests and the triple result
read that night. It is not a verdict receipt. Version 1 stays published at
`/lifecycle/LIFECYCLE-v1.md`, unedited.

A basis is the act's own: derived, model-read or publisher-stated, as the act
recorded it; person-ratified only where a receipt written by a person's key
stands. Nothing in this rule writes a person's word.

A new version of this rule is a new document beside this one, and its first
day is a dated line in `state/lifecycle-rules.jsonl`, which names the digest of
the rule block and of the whole document. A published version is not edited in
place: a run whose document no longer has the digest its first line records
writes nothing. A new version is a change in this record's rule. It is not a
change in any document's text.

The rule is stated in prose in the `steps` of the `rule` block and in data in
its other fields. The `vectors` block holds hand-written inputs, each with the
placement this version gives it; the `count-vectors` block holds the counts
those vectors produce over a hand-written observation tally. A plant in
`make gx-build` (`scripts/plants/a/test_lifecycle.py`) replays every vector
through the code and requires every stated field to be reproduced, and
requires the `placement`, `receipt` and stage words stated here to be the ones
the code holds.

## Identity

```json
{
 "block": "identity",
 "rule": "LIFECYCLE-v2",
 "version": 2,
 "in_force_from": {
  "date": "2026-11-05"
 },
 "implemented_by": "scripts/lifecycle.py",
 "projection": "state/lifecycle.json",
 "rule_events": "state/lifecycle-rules.jsonl",
 "supersedes": "/lifecycle/LIFECYCLE-v1.md"
}
```

## Rule

```json
{
 "block": "rule",
 "stages": [
  "OBSERVED",
  "DIFFERENCE DETECTED",
  "CANDIDATE RESOLVED",
  "REVISION CONFIRMED",
  "EVIDENCE RECORD PUBLISHED"
 ],
 "outcomes": [
  "confirmed",
  "not-changed",
  "blocked",
  "undetermined"
 ],
 "bases": [
  "derived",
  "model-read",
  "publisher-stated",
  "person-ratified"
 ],
 "placement": {
  "CONFIRMED-DERIVED": [
   "confirmed",
   "derived"
  ],
  "CONFIRMED-MODEL-READ": [
   "confirmed",
   "model-read"
  ],
  "CONFIRMED-PUBLISHER-STATED": [
   "confirmed",
   "publisher-stated"
  ],
  "NOT-CHANGED": [
   "not-changed",
   "derived"
  ],
  "BLOCKED": [
   "blocked",
   "derived"
  ],
  "UNDETERMINED": [
   "undetermined",
   "derived"
  ]
 },
 "placement_not_a_resolution": [
  "WAITING"
 ],
 "receipt": {
  "confirm": "confirmed",
  "decline": "not-changed",
  "witness-change-noted": "confirmed"
 },
 "steps": [
  "1. The act: the earliest line of the acts store (confirmations.jsonl in state/) whose subject is the candidate, whose basis is derived, model-read or publisher-stated, and whose field and value are the question confirmation_basis.candidate_question() names for the placement and the staged after digest.",
  "2. The outcome: the placement's state, read through `placement`; a WAITING placement states no outcome; with no placement, a recorded act states confirmed; then a person's latest receipt, read through `receipt`, with basis person-ratified; then, for a candidate no longer staged whose latest receipt was written by analysis, that receipt, with basis derived.",
  "3. An act recorded for a candidate whose placement does not confirm it: CANDIDATE RESOLVED, outcome undetermined, class act-and-placement-differ.",
  "4. No outcome: DIFFERENCE DETECTED where the candidate is staged; otherwise the candidate is not an item.",
  "5. An outcome other than confirmed, or a confirmation whose subject is the witness: CANDIDATE RESOLVED.",
  "6. A confirmation of the document with neither an act nor a person's confirm receipt: CANDIDATE RESOLVED.",
  "7. A confirmation of the document with an act or a person's confirm receipt: REVISION CONFIRMED, with the act's basis, or person-ratified where only the receipt stands; EVIDENCE RECORD PUBLISHED where src/content/revisions/ holds an entry for it that is not withdrawn.",
  "8. ratified_by_person: the latest receipt was written by a person and states the item's outcome (a decline states not-changed or blocked). person_disagrees: it was written by a person and states another outcome.",
  "9. OBSERVED: for each tracked entry, the days on which the observation store holds a reading of it, less the days that are the later day of one of its candidates.",
  "10. A revision confirmed by a recorded act that no verdict receipt names carries the first reconciliation event for its id in `reconciliation`. Where that event's result is reconciled, the item stays where step 7 places it, with basis_source the reconciliation store. Where it is undetermined, the item is CANDIDATE RESOLVED, outcome undetermined, basis derived, class reconciliation-does-not-support. Every item names its reconciliation event, or null."
 ],
 "counts": "scripts/lifecycle.py counts(): every lifecycle count, stored under `counts` in the projection",
 "reconciliation": {
  "store": "state/reconciliations.jsonl",
  "results": [
   "reconciled",
   "undetermined"
  ],
  "undetermined_class": "reconciliation-does-not-support",
  "first_event_stands": true
 }
}
```

## Vectors

```json
{
 "block": "vectors",
 "vectors": [
  {
   "id": "entry-a-2026-01-01",
   "instrument_id": "entry-a",
   "input": {
    "staged": true,
    "hash_after": "2222222222222222222222222222222222222222222222222222222222222222",
    "placement": null,
    "acts": [],
    "receipts": [],
    "entry": null
   },
   "output": {
    "stage": "DIFFERENCE DETECTED",
    "outcome": null,
    "basis": "detected"
   }
  },
  {
   "id": "entry-a-2026-01-02",
   "instrument_id": "entry-a",
   "input": {
    "staged": true,
    "hash_after": "2222222222222222222222222222222222222222222222222222222222222222",
    "placement": {
     "state": "WAITING",
     "rule_version": "sha256:0000000000000000",
     "cause": "evidence-not-banked"
    },
    "acts": [],
    "receipts": [],
    "entry": null
   },
   "output": {
    "stage": "DIFFERENCE DETECTED",
    "outcome": null,
    "class": "evidence-not-banked"
   }
  },
  {
   "id": "entry-a-2026-01-03",
   "instrument_id": "entry-a",
   "input": {
    "staged": true,
    "hash_after": "2222222222222222222222222222222222222222222222222222222222222222",
    "placement": {
     "state": "BLOCKED",
     "rule_version": "sha256:0000000000000000",
     "cause": "referent-mismatch"
    },
    "acts": [],
    "receipts": [],
    "entry": null
   },
   "output": {
    "stage": "CANDIDATE RESOLVED",
    "outcome": "blocked",
    "basis": "derived",
    "class": "referent-mismatch"
   }
  },
  {
   "id": "entry-a-2026-01-04",
   "instrument_id": "entry-a",
   "input": {
    "staged": true,
    "hash_after": "2222222222222222222222222222222222222222222222222222222222222222",
    "placement": {
     "state": "NOT-CHANGED",
     "rule_version": "sha256:0000000000000000",
     "class": "furniture-only"
    },
    "acts": [],
    "receipts": [],
    "entry": null
   },
   "output": {
    "stage": "CANDIDATE RESOLVED",
    "outcome": "not-changed",
    "basis": "derived",
    "class": "furniture-only"
   }
  },
  {
   "id": "entry-a-2026-01-05",
   "instrument_id": "entry-a",
   "input": {
    "staged": true,
    "hash_after": "2222222222222222222222222222222222222222222222222222222222222222",
    "placement": {
     "state": "UNDETERMINED",
     "rule_version": "sha256:0000000000000000",
     "cause": "unplaced-verdict"
    },
    "acts": [],
    "receipts": [],
    "entry": null
   },
   "output": {
    "stage": "CANDIDATE RESOLVED",
    "outcome": "undetermined",
    "basis": "derived"
   }
  },
  {
   "id": "entry-a-2026-01-06",
   "instrument_id": "entry-a",
   "input": {
    "staged": true,
    "hash_after": "2222222222222222222222222222222222222222222222222222222222222222",
    "placement": {
     "state": "CONFIRMED-DERIVED",
     "rule_version": "sha256:0000000000000000",
     "subject": "instrument"
    },
    "acts": [],
    "receipts": [],
    "entry": null
   },
   "output": {
    "stage": "CANDIDATE RESOLVED",
    "outcome": "confirmed",
    "basis": "derived",
    "subject": "instrument"
   }
  },
  {
   "id": "entry-b-2026-01-07",
   "instrument_id": "entry-b",
   "input": {
    "staged": true,
    "hash_after": "2222222222222222222222222222222222222222222222222222222222222222",
    "placement": {
     "state": "CONFIRMED-DERIVED",
     "rule_version": "sha256:0000000000000000",
     "subject": "instrument"
    },
    "acts": [
     {
      "basis": "derived",
      "check_date": "2026-01-02",
      "at": "2026-01-02",
      "confirmation_id": "entry-b-2026-01-07--revision--2026-01-02--derived",
      "subject": {
       "kind": "revision-candidate",
       "id": "entry-b-2026-01-07",
       "field": "revision"
      },
      "value": "2222222222222222222222222222222222222222222222222222222222222222"
     }
    ],
    "receipts": [],
    "entry": null
   },
   "output": {
    "stage": "REVISION CONFIRMED",
    "outcome": "confirmed",
    "basis": "derived",
    "verdict_receipt": null,
    "ratified_by_person": false
   }
  },
  {
   "id": "entry-b-2026-01-08",
   "instrument_id": "entry-b",
   "input": {
    "staged": true,
    "hash_after": "2222222222222222222222222222222222222222222222222222222222222222",
    "placement": {
     "state": "CONFIRMED-DERIVED",
     "rule_version": "sha256:0000000000000000",
     "subject": "witness"
    },
    "acts": [
     {
      "basis": "derived",
      "check_date": "2026-01-02",
      "at": "2026-01-02",
      "confirmation_id": "entry-b-2026-01-08--witness-change--2026-01-02--derived",
      "subject": {
       "kind": "revision-candidate",
       "id": "entry-b-2026-01-08",
       "field": "witness-change"
      },
      "value": "2222222222222222222222222222222222222222222222222222222222222222"
     }
    ],
    "receipts": [
     {
      "at": "2026-01-03",
      "candidate_id": "entry-b-2026-01-08",
      "decision": "witness-change-noted",
      "actor": "human"
     }
    ],
    "entry": null
   },
   "output": {
    "stage": "CANDIDATE RESOLVED",
    "outcome": "confirmed",
    "subject": "witness",
    "basis": "derived",
    "ratified_by_person": true
   }
  },
  {
   "id": "entry-b-2026-01-09",
   "instrument_id": "entry-b",
   "input": {
    "staged": true,
    "hash_after": "2222222222222222222222222222222222222222222222222222222222222222",
    "placement": {
     "state": "CONFIRMED-DERIVED",
     "rule_version": "sha256:0000000000000000",
     "subject": "instrument"
    },
    "acts": [
     {
      "basis": "derived",
      "check_date": "2026-01-02",
      "at": "2026-01-02",
      "confirmation_id": "entry-b-2026-01-09--revision--2026-01-02--derived",
      "subject": {
       "kind": "revision-candidate",
       "id": "entry-b-2026-01-09",
       "field": "revision"
      },
      "value": "2222222222222222222222222222222222222222222222222222222222222222"
     }
    ],
    "receipts": [],
    "entry": {
     "withdrawn": false
    }
   },
   "output": {
    "stage": "EVIDENCE RECORD PUBLISHED",
    "outcome": "confirmed",
    "basis": "derived"
   }
  },
  {
   "id": "entry-b-2026-01-10",
   "instrument_id": "entry-b",
   "input": {
    "staged": true,
    "hash_after": "2222222222222222222222222222222222222222222222222222222222222222",
    "placement": {
     "state": "BLOCKED",
     "rule_version": "sha256:0000000000000000",
     "cause": "extractor-moved-after"
    },
    "acts": [
     {
      "basis": "derived",
      "check_date": "2026-01-02",
      "at": "2026-01-02",
      "confirmation_id": "entry-b-2026-01-10--revision--2026-01-02--derived",
      "subject": {
       "kind": "revision-candidate",
       "id": "entry-b-2026-01-10",
       "field": "revision"
      },
      "value": "2222222222222222222222222222222222222222222222222222222222222222"
     }
    ],
    "receipts": [],
    "entry": null
   },
   "output": {
    "stage": "CANDIDATE RESOLVED",
    "outcome": "undetermined",
    "class": "act-and-placement-differ"
   }
  },
  {
   "id": "entry-b-2026-01-11",
   "instrument_id": "entry-b",
   "input": {
    "staged": false,
    "hash_after": "2222222222222222222222222222222222222222222222222222222222222222",
    "placement": null,
    "acts": [],
    "receipts": [
     {
      "at": "2026-01-03",
      "candidate_id": "entry-b-2026-01-11",
      "decision": "confirm",
      "actor": "human"
     }
    ],
    "entry": null
   },
   "output": {
    "stage": "REVISION CONFIRMED",
    "outcome": "confirmed",
    "basis": "person-ratified",
    "ratified_by_person": true
   }
  },
  {
   "id": "entry-b-2026-01-12",
   "instrument_id": "entry-b",
   "input": {
    "staged": true,
    "hash_after": "2222222222222222222222222222222222222222222222222222222222222222",
    "placement": {
     "state": "CONFIRMED-DERIVED",
     "rule_version": "sha256:0000000000000000",
     "subject": "instrument"
    },
    "acts": [
     {
      "basis": "derived",
      "check_date": "2026-01-02",
      "at": "2026-01-02",
      "confirmation_id": "entry-b-2026-01-12--revision--2026-01-02--derived",
      "subject": {
       "kind": "revision-candidate",
       "id": "entry-b-2026-01-12",
       "field": "revision"
      },
      "value": "3333333333333333333333333333333333333333333333333333333333333333"
     }
    ],
    "receipts": [],
    "entry": null
   },
   "output": {
    "stage": "CANDIDATE RESOLVED",
    "outcome": "confirmed",
    "act": null
   }
  },
  {
   "id": "entry-b-2026-01-13",
   "instrument_id": "entry-b",
   "input": {
    "staged": true,
    "hash_after": "2222222222222222222222222222222222222222222222222222222222222222",
    "placement": {
     "state": "CONFIRMED-DERIVED",
     "rule_version": "sha256:0000000000000000",
     "subject": "instrument"
    },
    "acts": [
     {
      "basis": "derived",
      "check_date": "2026-01-02",
      "at": "2026-01-02",
      "confirmation_id": "entry-b-2026-01-13--revision--2026-01-02--derived",
      "subject": {
       "kind": "revision-candidate",
       "id": "entry-b-2026-01-13",
       "field": "revision"
      },
      "value": "2222222222222222222222222222222222222222222222222222222222222222"
     }
    ],
    "receipts": [
     {
      "at": "2026-01-03",
      "candidate_id": "entry-b-2026-01-13",
      "decision": "decline",
      "actor": "machine"
     }
    ],
    "entry": null
   },
   "output": {
    "stage": "REVISION CONFIRMED",
    "verdict_receipt": "decline",
    "ratified_by_person": false,
    "person_disagrees": false
   }
  },
  {
   "id": "entry-b-2026-01-14",
   "instrument_id": "entry-b",
   "input": {
    "staged": true,
    "hash_after": "2222222222222222222222222222222222222222222222222222222222222222",
    "placement": {
     "state": "CONFIRMED-DERIVED",
     "rule_version": "sha256:0000000000000000",
     "subject": "instrument"
    },
    "acts": [
     {
      "basis": "derived",
      "check_date": "2026-01-02",
      "at": "2026-01-02",
      "confirmation_id": "entry-b-2026-01-14--revision--2026-01-02--derived",
      "subject": {
       "kind": "revision-candidate",
       "id": "entry-b-2026-01-14",
       "field": "revision"
      },
      "value": "2222222222222222222222222222222222222222222222222222222222222222"
     }
    ],
    "receipts": [
     {
      "at": "2026-01-03",
      "candidate_id": "entry-b-2026-01-14",
      "decision": "decline",
      "actor": "human"
     }
    ],
    "entry": null
   },
   "output": {
    "stage": "REVISION CONFIRMED",
    "ratified_by_person": false,
    "person_disagrees": true
   }
  },
  {
   "id": "entry-b-2026-01-15",
   "instrument_id": "entry-b",
   "input": {
    "staged": true,
    "hash_after": "2222222222222222222222222222222222222222222222222222222222222222",
    "placement": {
     "state": "CONFIRMED-PUBLISHER-STATED",
     "rule_version": "sha256:0000000000000000",
     "subject": "instrument"
    },
    "acts": [
     {
      "basis": "publisher-stated",
      "check_date": "2026-01-02",
      "at": "2026-01-02",
      "confirmation_id": "entry-b-2026-01-15--revision--2026-01-02--publisher-stated",
      "subject": {
       "kind": "revision-candidate",
       "id": "entry-b-2026-01-15",
       "field": "revision"
      },
      "value": "2222222222222222222222222222222222222222222222222222222222222222"
     }
    ],
    "receipts": [],
    "entry": null
   },
   "output": {
    "stage": "REVISION CONFIRMED",
    "basis": "publisher-stated"
   }
  },
  {
   "id": "entry-c-2026-01-20",
   "instrument_id": "entry-c",
   "input": {
    "staged": true,
    "hash_after": "3333333333333333333333333333333333333333333333333333333333333333",
    "placement": {
     "state": "CONFIRMED-DERIVED",
     "rule_version": "sha256:0000000000000000"
    },
    "acts": [
     {
      "confirmation_id": "entry-c-2026-01-20--revision--2026-01-22--derived--000000000000",
      "basis": "derived",
      "check_date": "2026-01-22",
      "subject": {
       "kind": "revision-candidate",
       "id": "entry-c-2026-01-20",
       "field": "revision"
      },
      "value": "3333333333333333333333333333333333333333333333333333333333333333"
     }
    ],
    "receipts": [],
    "entry": null,
    "reconciliation": {
     "kind": "reconciliation",
     "reconciliation_id": "entry-c-2026-01-20--reconciliation--2026-02-01--000000000000",
     "candidate_id": "entry-c-2026-01-20",
     "result": "reconciled",
     "reconciled_on": "2026-02-01"
    }
   },
   "output": {
    "stage": "REVISION CONFIRMED",
    "outcome": "confirmed",
    "basis": "derived",
    "basis_source": "state/reconciliations.jsonl",
    "reconciliation": {
     "reconciliation_id": "entry-c-2026-01-20--reconciliation--2026-02-01--000000000000",
     "result": "reconciled",
     "reconciled_on": "2026-02-01"
    }
   }
  },
  {
   "id": "entry-c-2026-01-21",
   "instrument_id": "entry-c",
   "input": {
    "staged": true,
    "hash_after": "3333333333333333333333333333333333333333333333333333333333333333",
    "placement": {
     "state": "CONFIRMED-DERIVED",
     "rule_version": "sha256:0000000000000000"
    },
    "acts": [
     {
      "confirmation_id": "entry-c-2026-01-21--revision--2026-01-22--derived--000000000000",
      "basis": "derived",
      "check_date": "2026-01-22",
      "subject": {
       "kind": "revision-candidate",
       "id": "entry-c-2026-01-21",
       "field": "revision"
      },
      "value": "3333333333333333333333333333333333333333333333333333333333333333"
     }
    ],
    "receipts": [],
    "entry": null,
    "reconciliation": {
     "kind": "reconciliation",
     "reconciliation_id": "entry-c-2026-01-21--reconciliation--2026-02-01--000000000000",
     "candidate_id": "entry-c-2026-01-21",
     "result": "undetermined",
     "reconciled_on": "2026-02-01"
    }
   },
   "output": {
    "stage": "CANDIDATE RESOLVED",
    "outcome": "undetermined",
    "basis": "derived",
    "basis_source": "state/reconciliations.jsonl",
    "class": "reconciliation-does-not-support"
   }
  }
 ]
}
```

## Count vectors

```json
{
 "block": "count-vectors",
 "observed": {
  "entry-a": {
   "days": 10,
   "readings": 12
  },
  "entry-b": {
   "days": 30,
   "readings": 31
  },
  "entry-c": {
   "days": 5,
   "readings": 5
  }
 },
 "expect": {
  "population.candidates": 17,
  "population.observation_days": 45,
  "population.readings": 48,
  "population.entries": 3,
  "stage.observed": 28,
  "stage.difference-detected": 2,
  "stage.candidate-resolved": 8,
  "stage.revision-confirmed": 6,
  "stage.evidence-record-published": 1,
  "resolved.confirmed": 3,
  "resolved.not-changed": 1,
  "resolved.blocked": 1,
  "resolved.undetermined": 3,
  "unresolved": 2,
  "waiting": 1,
  "confirmed.total": 10,
  "confirmed.subject.instrument": 9,
  "confirmed.subject.witness": 1,
  "confirmed.basis.derived": 8,
  "confirmed.basis.publisher-stated": 1,
  "confirmed.basis.person-ratified": 1,
  "confirmed.basis.model-read": 0,
  "revisions.confirmed": 7,
  "revisions.basis.derived": 5,
  "revisions.basis.person-ratified": 1,
  "revisions.basis.publisher-stated": 1,
  "revisions.without_verdict_receipt": 4,
  "revisions.person_confirmed": 1,
  "revisions.evidence_records": 1,
  "ratified_by_person": 2,
  "person_disagrees": 1,
  "by_entry.entry-b.revision-confirmed": 5,
  "by_entry.entry-a.observed": 4,
  "front_line.offered": 9,
  "front_line.offered_witness": 1,
  "front_line.waiting": 2,
  "front_line.withheld": 5,
  "front_line_by_day.2026-01-08.offered_witness": 1,
  "front_line_by_day.2026-01-05.withheld": 1,
  "revisions.reconciled": 1,
  "revisions.unreconciled": 3,
  "reconciliations.reconciled": 1,
  "reconciliations.undetermined": 1,
  "by_entry.entry-c.revision-confirmed": 1,
  "by_entry.entry-c.observed": 3,
  "front_line_by_day.2026-01-20.offered": 1,
  "front_line_by_day.2026-01-21.withheld": 1
 }
}
```
