# LIFECYCLE-v1

Lifecycle rule version 1 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` 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.

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-v1",
 "version": 1,
 "in_force_from": {
  "date": "2026-11-04"
 },
 "implemented_by": "scripts/lifecycle.py",
 "projection": "state/lifecycle.json",
 "rule_events": "state/lifecycle-rules.jsonl"
}
```

## 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."
 ],
 "counts": "scripts/lifecycle.py counts(): every lifecycle count, stored under `counts` in the projection"
}
```

## 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"
   }
  }
 ]
}
```

## Count vectors

```json
{
 "block": "count-vectors",
 "observed": {
  "entry-a": {
   "days": 10,
   "readings": 12
  },
  "entry-b": {
   "days": 30,
   "readings": 31
  }
 },
 "expect": {
  "population.candidates": 15,
  "population.observation_days": 40,
  "population.readings": 43,
  "population.entries": 2,
  "stage.observed": 25,
  "stage.difference-detected": 2,
  "stage.candidate-resolved": 7,
  "stage.revision-confirmed": 5,
  "stage.evidence-record-published": 1,
  "resolved.confirmed": 3,
  "resolved.not-changed": 1,
  "resolved.blocked": 1,
  "resolved.undetermined": 2,
  "unresolved": 2,
  "waiting": 1,
  "confirmed.total": 9,
  "confirmed.subject.instrument": 8,
  "confirmed.subject.witness": 1,
  "confirmed.basis.derived": 7,
  "confirmed.basis.publisher-stated": 1,
  "confirmed.basis.person-ratified": 1,
  "confirmed.basis.model-read": 0,
  "revisions.confirmed": 6,
  "revisions.basis.derived": 4,
  "revisions.basis.person-ratified": 1,
  "revisions.basis.publisher-stated": 1,
  "revisions.without_verdict_receipt": 3,
  "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": 8,
  "front_line.offered_witness": 1,
  "front_line.waiting": 2,
  "front_line.withheld": 4,
  "front_line_by_day.2026-01-08.offered_witness": 1,
  "front_line_by_day.2026-01-05.withheld": 1
 }
}
```
