From 93d985d5c3c5873809f2aab394d3bb836727bf49 Mon Sep 17 00:00:00 2001 From: Jiri Puc Date: Thu, 3 Sep 2026 14:28:19 +0200 Subject: [PATCH 1/8] design: world-time flows from the claim's window (D107) D106 fixed the observation adjudicator reading the wrong clock; the follow-up audit at 02b79904 found the same confusion in sixteen more places: relations' valid_from is never seeded (valid_at is a no-op on the relation side), the relation supersession prompt judges "the same period" without seeing one, undated supersessions cap at now() (histories depend on ingest wall-clock), the two adjudicators orient undated testimony in opposite directions, retrieval dedupes identical text across dates, the K fact sheet prints chat dates under "valid since", the timeline aggregate buckets by ingest year, and day-precision windows are zero-width points. Record the audit (plan/analysis/time_handling_audit.md), decide one contract (D107 + plan/designs/temporal_clocks_design.md): every stage reads the claim's resolved D41 window first; said-on time is provenance and at most an upper bound; a missing time stays missing. Fact windows are seeded by kind with a validity_basis column, widen only earlier, close at the successor's world-time start else said-on else coexist; one shared ordering comparator; the D106 two-clock block in every temporal prompt; window-aware dedupe; half-open precision ends; all four D41 kinds taught. Sequence it in plan/plans/temporal_clocks.md and banner the six affected designs. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016p9xB9T7VYREuVmohDPKjR --- decisions.md | 89 ++++++ plan/analysis/time_handling_audit.md | 301 ++++++++++++++++++ plan/designs/e2_e3_claims_relations_design.md | 8 + plan/designs/k_layers_design.md | 7 + plan/designs/locomo_benchmark_design.md | 6 + plan/designs/observations_design.md | 9 + plan/designs/registries_design.md | 7 + plan/designs/retrieval_design.md | 7 + plan/designs/temporal_clocks_design.md | 258 +++++++++++++++ plan/plans/temporal_clocks.md | 27 ++ 10 files changed, 719 insertions(+) create mode 100644 plan/analysis/time_handling_audit.md create mode 100644 plan/designs/temporal_clocks_design.md create mode 100644 plan/plans/temporal_clocks.md diff --git a/decisions.md b/decisions.md index 0d0dead08..77c5c4fcb 100644 --- a/decisions.md +++ b/decisions.md @@ -4989,3 +4989,92 @@ rung) and `plan/designs/locomo_benchmark_design.md` Full-v21 protocol. design named but never implemented) and D105's Full-v20 benchmark identity. Preserves D41 (claims stay the one home of asserted validity), D98 retrieval, D100/D102 identity, and D104/D105 answer-prompt contracts. + +## D107. World-time flows from the claim's window; said-on time is provenance, never validity + +**Decision (2026-09-03).** Every stage that reasons about *when* a fact held +reads the claim's resolved D41 window (what the statement **is about**) first +and treats the source's own date (when it was **said**) as provenance and, at +most, an upper bound. Concretely: + +1. A relation's or observation's validity window is **seeded** from the + triggering claim's D41 window by kind (state, event, measurement, + proposition), with a new `validity_basis` column recording whether the + window is `world_time`, `said_on`, or `unknown`. A first-occurrence + relation no longer starts at `NULL`. +2. Evidence may move a fact's start **earlier** to its is-about start, never + later; the end changes only by adjudication. +3. A supersede caps the predecessor at the successor's is-about start, else + its said-on date as an honest upper bound, else **not at all** — the pair + coexists with a recorded reason. `now()` is never a boundary, including on + the D55 retraction path. +4. Predecessor/successor orientation in both adjudicators and the observation + staging order use **one comparator** keyed on the is-about start (else + said-on), and an undated side never wins a cap. +5. Every prompt that compares, merges, ranks, or summarises facts shows the + D106 two-clock block (`said on` / `is about`, with definitions): relation + supersession, T4 identity candidates, the K prose writer, and the + benchmark answer agent. +6. Testimony deduplication keys include the D41 window; the fact-grain + envelope names the basis; P1 gains is-about filters; the timeline + aggregate buckets by world-time with an explicit `undated` bucket; entity + profiles rank by evidence then window recency, never by `updated_at`. +7. Extraction stores precision-derived ends **half-open** (a day is + `[00:00, next 00:00)`), shows the extractor the full source timestamp, + teaches all four D41 kinds and `open` with examples, and the normaliser + writes the absolute date into the *fact's* statement when the window is + known (claim text stays source-faithful, D32). +8. Consumer surfaces print a said-on date only under a said-on heading. + +**Context.** D106 fixed the observation adjudicator merging "won a +tournament last week" across a nine-month gap because it never read the +claims' resolved windows. The follow-up audit +(`plan/analysis/time_handling_audit.md`, revision `02b79904`) found the same +confusion in sixteen more places: relations' `valid_from` is never seeded, so +`valid_at` is a no-op on the relation side; the relation supersession prompt +asks the model about "the same period" while showing only document dates; +undated supersessions cap at the ingest wall-clock, so a rebuild on another +day yields a different history; the two adjudicators orient undated testimony +in opposite directions; retrieval dedupes identical text across dates +exactly as the adjudicator did before D106; the K fact sheet prints the chat +date under "valid since"; the timeline aggregate buckets by ingest year; the +answer agent is told to "use timestamps" without being told which; and +day-precision windows are stored as zero-width points that intraday as-of +queries miss. The docs (`/docs/concepts`, `fact_context`'s description) +promise world-time semantics the code does not keep. + +**Consequences.** `valid_at` / `facts_as_of` become true on both fact planes; +histories are rebuild-stable (D7) because no boundary depends on ingest +time; the two fact planes agree on undated testimony; recurring events and +retrospectives order by the world, not by who spoke last; readers and +compiled pages see resolved dates. Costs: one migration +(`validity_basis`), generation rolls for the extractor, normaliser, both +adjudicators and the flush component, a rebuild of existing stores +(re-seeding reads the claim rows already present; only the half-open ends and +new kinds need re-extraction), and one LoCoMo protocol roll for the whole +change. Fail-safe direction is preserved and widened: an unknown time now +yields a coexisting duplicate with a reason rather than an invented instant. + +**Rejected.** Seventeen local patches (the pattern recurs in every new +consumer); making the claim window the fact window by a view (D41 forbids a +fact window that is a reduction over many-valued claim columns — seeding +then adjudicating keeps the single monotonic verdict); keeping `now()` as the +undated cap (breaks D7 rebuild stability); a typed period/value column on +facts (D43 §4); stripping relative wording from claim text (D32). + +**Design.** `plan/designs/temporal_clocks_design.md`; amendment banners on +`e2_e3_claims_relations_design.md`, `observations_design.md`, +`registries_design.md`, `retrieval_design.md`, `k_layers_design.md`, +`locomo_benchmark_design.md`. + +**Analysis.** `plan/analysis/time_handling_audit.md`. + +**Sequencing.** `plan/plans/temporal_clocks.md`. + +**Amends.** D41's consequences become binding mechanics (claim windows seed +fact windows; a monotonic guard remains); D43 §3 (the cap boundary and +ordering key); D88/D90 (source-time ordering now means is-about time, else +said-on); D106 (its two-clock prompt block becomes the engine-wide contract; +its stored `valid_from` seeding gap is closed). Preserves D3 (supersession +over verdicts), D6 (one validity home per fact), D32, D49 (additive envelope +field only), D98, D100–D105. diff --git a/plan/analysis/time_handling_audit.md b/plan/analysis/time_handling_audit.md new file mode 100644 index 000000000..e91a3470a --- /dev/null +++ b/plan/analysis/time_handling_audit.md @@ -0,0 +1,301 @@ +# Time-handling audit: where the engine reads the wrong clock + +**Date:** 2026-09-03 + +**Status:** analysis (non-binding). The decision it motivated is D107; the +binding contract is `plan/designs/temporal_clocks_design.md`. + +**Revision audited:** `02b79904` (the merge of D106). Line numbers below are +for that revision; function and statement names are the stable anchors. + +## 1. Question + +D106 fixed one defect: the observation adjudicator compared two statements +as bare strings and merged "won a tournament last week" said in January with +the same words said in October, although both claims carried resolved D41 +windows nine months apart. That defect had a shape — a stage that *has* the +resolved world-time available and reasons on the source's date instead. This +audit asks whether the same shape occurs anywhere else, stage by stage. + +## 2. The clocks, so the findings read cold + +The engine records three distinct clocks, and the defects are all +confusions between the first two: + +| Clock | Column(s) | Meaning | Plain example | +| --- | --- | --- | --- | +| **said-on** | `claims.asserted_at` (from the document's `source_modified_at`) | when the SOURCE said it | the chat session was on 2022-10-06 | +| **is-about** | `claims.claim_valid_kind` / `claim_valid_from` / `claim_valid_until` / `claim_valid_precision` (D41) | the world-time the statement refers to, resolved by the extractor from the wording against the said-on date | "last week" in that session → 2022-09-29 | +| **believed** | `ingested_at` / `invalidated_at` | when the system held the belief | ingested 2026-09-01 | + +`claim_valid_kind` says what sort of interval the is-about window is: +`event_time` (a datable event), `measurement_period` (a figure for a span), +`effective_period` (a state that held over a span), `proposition_validity` +(the proposition was true over a span), or `NULL` when the source tied nothing +to a date. A resolved start with `claim_valid_until IS NULL` is an *open* +interval (unbounded end), not a point. + +The fact layer — `relations.valid_from/valid_until` and +`observations.valid_from/valid_until` — is meant to hold the adjudicated +world-time of each fact (D3, D43): the window a caller filters on with +`valid_at` / `facts_as_of`. + +## 3. Patterns + +Each finding is tagged with the pattern it instantiates: + +- **P1 ignored** — resolved timing is available on the row and not read. +- **P2 conflated** — the said-on clock is used where the is-about clock is meant. +- **P3 precision lost** — an interval is stored or compared as a point, or a + timestamp is truncated before use. +- **P4 blind model** — a model is asked a time-dependent question without + the dates it would need. +- **P5 wrong sort key** — ordering, deduplication, or supersession uses the + wrong clock. +- **P6 silent degrade** — a missing time is replaced by a value that changes + the meaning (typically `now()`). + +## 4. Findings, ordered by likely impact on answers + +### 4.1 Retrieval dedupes testimony by text only — the D106 defect, one layer up (P1, P5) + +`src/rememberstack/surfaces/query_engine.py` — `_group_claim_evidence` +(`:3388-3405`), invoked from `_testimony_context_retrieval` with +`group_exact_text=True` (`:2230`), which serves both `testimony_context` and +`answer_context` (`surfaces/operation_executor.py:75-117`). + +```python +grouped.setdefault(_normalize_hybrid_text(value=record.claim_text), []).append(record) +... +members[0].model_copy(update={"corroboration_count": len({m.doc_id for m in members}), ...}) +``` + +The group key is the normalised claim text. `asserted_at` and the four +`claim_valid_*` fields are on every `EvidenceResult` +(`model/envelope.py:294-298`) and are not consulted. Two claims with the same +words about different dates become one evidence row carrying only the +top-ranked member's dates, with `corroboration_count = 2`. The second date is +absent from the envelope, not merely unlabeled. The conv-42 counting question +escaped this only because the seven win claims were worded differently. + +### 4.2 Relations' `valid_from` is never seeded (P1, P6) + +`src/rememberstack/spine/fact_catalog.py:78-89`, `:523-533`, +`_LATEST_CLOSED_UNTIL` (`:867-877`). A new relation's `valid_from` is the +`max(valid_until)` of a previously *closed* spell of the same +`(subject, predicate, object)` — `NULL` for every first occurrence — and is +never written anywhere else: not from `claim_valid_from`, not from +`asserted_at`. D41's consequences say the opposite ("a claim 'Alice joined in +March 2024' can seed `works_for.valid_from`"), and the docs promise +`valid_at` answers "when was this true in the world" +(`website/src/app/docs/concepts/page.mdx:80`). `lookup_relations(valid_at=…)` +filters `valid_from IS NULL OR valid_from <= :as_of` +(`query_engine.py:3696`), so with `valid_from` always `NULL`, "who did Alice +work for in 2010?" returns her current employer. The as-of axis is a no-op on +the relation side. + +### 4.3 Relation supersession judges "the same period" without seeing any period (P2, P4) + +`src/rememberstack/spine/supersession.py` — `_ADJUDICATION_PROMPT` +(`:37-51`), formatted at `:231-238`: + +``` +EXISTING: {existing_label} + evidence: {existing_evidence!r} (asserted {existing_asserted}) +NEW: {new_label} + evidence: {new_evidence!r} (asserted {new_asserted}) +... +- contradict: the sources describe the SAME period incompatibly +``` + +Only the said-on dates are shown. `_LOAD_RELATION` (`:436-443`) and +`_BLOCK_CANDIDATES` (`:459-466`) select `c.claim_text, c.asserted_at` and not +the `claim_valid_*` columns on the same row. A 2024 memoir ("Alice worked for +Acme from 2015 to 2018") beside a 2023 email ("Alice works for Zeta") makes +the memoir look newer; `works_for Zeta` is superseded by a historical spell. + +### 4.4 Supersession boundaries are the speaking date, and undated ones become `now()` (P2, P6) + +`supersession.py:272-282` and `_CLOSE_WINDOW` (`:503-511`); +`observation_adjudication.py` `_CAP_WINDOW` (`:1539-1546`); +`lifecycle.py` `_CAP_RELATION` (`:929-936`, the D55 retraction path): + +```sql +SET valid_until = coalesce(:boundary_asserted, now()) +``` + +The cap is the *successor's said-on date* even when its is-about start is +known, and an undated successor caps the predecessor at the wall-clock +instant of ingestion. Consequences: `facts_as_of(valid_at='2026-09-02')` +reports Alice still at Acme the day before an undated CV was ingested, and +the same ingest replayed on another day yields a different history — the +value is not rebuild-stable (D7). + +### 4.5 E3 never sees the resolved window, so the fact statement keeps "last week" forever (P1, P6) + +`src/rememberstack/workers/e3.py:98-120` (normaliser prompt: `CLAIM +(attributed=…): {claim_text}`; no valid-time fields at `:436-441`). E2's prompt +correctly *forbids* writing the resolved date into `claim_text` +(`e2.py:176-179`), so the only place the date exists is the claim row. The +observation `statement` (and `obs_label`) is minted from `claim_text` +(`fact_catalog.py:571-581`, `observation_adjudication.py:1527-1537`), then +embedded by P1 (`workers/p1.py:214, 231-236`), returned as `FactResult.label` +(`query_engine.py:3709`), listed in entity profiles +(`profile_refresher.py:687`), and rendered into K pages. Every fact-grain +consumer reads "Nate won a video game tournament last week" with no anchor. + +### 4.6 The answer agent is never told which clock is which (P4, P2) + +`benchmarks/locomo/protocol.py:135-137` — the prompt says "Use timestamps to +resolve relative dates" and nothing else about time. The envelopes carry +`asserted_at`, `claim_valid_*`, and `validity.valid_from` (fact grain) side +by side; `_reader_trace_record` (`:344-347`) drops `None` fields, so for a +relation (4.2) the only surviving timestamp is `ingested_at` — the benchmark's +own run clock — and for an observation `validity.valid_from` is the session +date under a name that reads as world-time. Contrast +`observation_adjudication.py:63-72`, which spells the distinction out for the +verdict model. + +### 4.7 K fact sheets label the said-on date "valid since" and sort history by it (P2, P5) + +`src/rememberstack/core/knowledge_fact_sheet.py:55-63`, `:72-99`: the +"Current relations" column `valid since` is `fact.valid_from` (always empty +for relations, 4.2) and the observation table's `valid from` is the session +date; "Observation history" is sorted by that same value, so a back-dated +retrospective reads in the wrong order. + +### 4.8 The K prose writer's claims carry no dates at all (P4) + +`src/rememberstack/spine/knowledge.py:4636-4658` (`_SELECT_WRITER_CLAIMS`) +and `model/knowledge.py:531-543` (`KnowledgeWriterClaim`): `claim_text`, +`source_span`, `document_title`, `source_kind` — no `asserted_at`, no +`claim_valid_*`. The writer is asked to compile durable prose from "last +week". + +### 4.9 `aggregate(form="timeline")` buckets by ingest year (P2, P6) + +`query_engine.py:4285-4307`: `coalesce(valid_from, ingested_at)` for both fact +kinds. With 4.2, the relation half is entirely ingest time; the observation +half is said-on time. A 2015–2020 archive imported today is one bar labelled +2026, under a docstring that says "an entity's facts by year" (`:2087-2088`). + +### 4.10 Observation batch order — who supersedes whom — follows the said-on clock (P5) + +`fact_catalog.py:652`, `:725`; `observation_adjudication.py:1614`, `:1630`: +`ORDER BY c.asserted_at NULLS LAST, …`. The order fixes predecessor/successor +(`_is_strictly_earlier(asserted_at, existing_from)`, `:664-665`) and the cap +boundary (`:718-724`). "I moved to Berlin in 2019" said in 2023 caps "I live +in Prague" said in 2022 — the reverse of the world. D106 made the verdict +window-aware; not the ordering. + +### 4.11 The two adjudicators disagree about undated testimony (P5, P6) + +`supersession.py:545-562` (`_is_source_successor`: "dated testimony is later +than undated" → undated is the *predecessor*) versus +`observation_adjudication.py:1453-1481` (`_is_later_in_total_order`: +`asserted_at NULLS LAST` → undated is the *successor*). One document pair +yields contradictory histories on the two fact planes, and neither is +replay-stable under reordering. + +### 4.12 P1 offers a said-on filter and no is-about filter (P1, P2) + +`adapters/postgres_p1.py:1371-1400`: claim search accepts `asserted_from` / +`asserted_to` only; `_fact_filters` (`:1427-1446`) has nothing temporal. The +D41 partial index on `(claim_valid_from, claim_valid_until)` exists and is +unused by search. "Nate's claims about October" returns what was *spoken* in +October. + +### 4.13 Day/month/year precision is stored as a zero-width interval (P3) + +`workers/e2.py:181-186` (prompt: "the resolved date as both ISO ends"), +`_parse_iso_timestamp` (`:660-667`, date-only → midnight UTC); +`_CLAIMS_AS_OF_CANDIDATES` (`query_engine.py:3585-3600`) intersects closed +intervals. A day-precision May-7 claim is `[May 7 00:00, May 7 00:00]`, so +"what held during May 7, 09:00–23:00" returns nothing; a year-precision 2022 +claim ends at 2022-12-31 00:00. D106's `_windows_disjoint` inherits the point +semantics, so two same-day events from different wordings can read as +touching but not overlapping. + +### 4.14 E2 teaches only `event_time` (P4) + +`workers/e2.py:167-209`: all three worked examples are `event_time`; +`measurement_period`, `effective_period`, `proposition_validity` are never +named; `open` gets one structural mention and no example; `CandidateClaim` +(`model/claims.py:158-168`) has no field descriptions. "Alice has been CEO +since 2019" — `proposition_validity`, `open`, from=2019 — is emitted as a +point event or not at all. This starves D106 directly: its rung fires on +`about_kind == "event_time"` only. + +### 4.15 The document header shown to E2 drops the time of day (P3) + +`workers/e2.py:899-906`: `date {modified.date().isoformat()}` while +`asserted_at` keeps the full timestamp (`:599`). LoCoMo sessions carry wall +times; "this morning" cannot resolve, and two same-day sessions are the same +anchor. + +### 4.16 Entity profiles and the T4 candidate list carry no dates and rank by row-touch time (P4, P5) + +`spine/profile_refresher.py:838, 840, 877, 889, 677-695`; +`spine/resolver.py:1158-1175`: salient facts are bare strings ordered by +`evidence_count DESC, updated_at DESC` — `updated_at` is bumped by every +recount and label write (`fact_catalog.py:556, 616`). Two people named Nate +five years apart present to T4 with no temporal separation; a fact recounted +today outranks a heavily evidenced older one. The `valid_until IS NULL` gate +combined with 4.4 means one undated supersession removes a fact from every +profile and from T3 embeddings. + +### 4.17 `_pull_valid_from_earlier` widens the stored window with the speaking date (P2, P1) + +`observation_adjudication.py:917-962`: on evidence collapse the persisted +`valid_from` moves to the earliest `asserted_at`, while `_absorb_timing` +(`:1357-1383`) simultaneously widens the correct is-about window in memory and +discards it — nothing persists it (`_INSERT_OBSERVATION:1527-1537` stores no +window). Two sessions re-asserting one event leave the row's world-window at +`[earliest session, ∞)` although the event window `[2023-09-29, 2023-09-29]` +was computed one function away. + +## 5. Checked and sound + +Absence of a finding above is a result, not an omission: + +- **E2's D41 parse/validate gate** (`workers/e2.py:607-713`) — rejects naive + datetimes rather than inventing a zone, mirrors every DB CHECK, refuses to + promote a date-only input to `instant`, degrades the temporal fields to + unknown without dropping the claim; `asserted_at` comes from + `source_modified_at or published_at` (`:599`); the header reaches every + chunk's bundle (`:731, :759`). +- **D106's rung** (`observation_adjudication.py:1304-1354, 1398-1424, + 1503-1512`) — `None` ends are unbounded, incomparable values fail safe to + "overlap", one open supporting claim keeps the aggregate open; its prompt + (`:55-98`) is the model the other prompts should follow. +- **`claims_as_of`** (`query_engine.py:522-587`, `_CLAIMS_AS_OF_CANDIDATES`) + — filters on the is-about columns, refuses `unknown` precision, orders by + `claim_valid_from`, discloses `excluded_unstamped`; only 4.13's boundary + semantics apply. +- **The evidence-grain envelope** (`model/envelope.py:280-302`) — carries all + five D41 fields beside `asserted_at`; every confirmation query selects them. + D41's promise that evidence payloads surface `claim_valid_from/until` is + kept. The fact-grain `Validity` (`:171-179`) is where the conflation lives. +- **Belief-time plumbing** (`query_engine.py:3463-3483`; migration + `p9_03_0024_facts_as_of.py:92-95`) — the transaction-time axis is separate + and sound. +- **Query-space catalog typing** (`spine/query_space/catalog.py:371-434, + 447-509, 869-916`) — claim views expose all five D41 columns to open SQL. +- **D55 retraction shape discipline** (`spine/lifecycle.py:412-468`) — + relations cap at the withdrawing version's source time, observations use + `invalidated_at`; only the `now()` fallback (4.4) is wrong. +- **Adjudication transcripts** (`supersession.py:298-307`; + `observation_adjudication.py:553-571, 741-751`) — every cap boundary and + every D106 coercion is recorded, so all of the above is diagnosable from + the audit tables without a rerun. + +## 6. Why this is one decision, not seventeen fixes + +Every finding is the same confusion: the engine resolves world-time once, at +extraction, and then reasons on the source's date. The fix that closes all of +them is a single contract — world-time flows from the claim's is-about window +into fact windows, ordering, prompts, and consumer surfaces; said-on time is +provenance and an upper bound, never validity; a missing time stays missing +rather than becoming `now()`. That contract is D107 and +`plan/designs/temporal_clocks_design.md`; the sequencing is +`plan/plans/temporal_clocks.md`. diff --git a/plan/designs/e2_e3_claims_relations_design.md b/plan/designs/e2_e3_claims_relations_design.md index 803ec85d9..9a553ac48 100644 --- a/plan/designs/e2_e3_claims_relations_design.md +++ b/plan/designs/e2_e3_claims_relations_design.md @@ -1,5 +1,13 @@ # E2 / E3 — Claim Extraction and Relation Normalization (Design) +> **Binding D107 amendment (2026-09-03).** E2 emits all four D41 kinds and +> `open` with examples, stores precision-derived ends half-open, and sees the +> full source timestamp in the header. E3 receives each claim's resolved +> window, seeds a new relation's or observation's validity window from it by +> kind (with `validity_basis`), and writes the absolute date into the fact's +> statement when the window is known while the claim text stays source- +> faithful. Contract: `temporal_clocks_design.md` §3–§4. + How the system turns a chunk of source text into **claims** (atomic, standalone, verifiable assertions) and then into **relations** (the distinct facts those claims are evidence for). This is the cost center and the quality bottleneck of plane E, so the design is opinionated about *what* to diff --git a/plan/designs/k_layers_design.md b/plan/designs/k_layers_design.md index 98ba16bbf..cd397e81b 100644 --- a/plan/designs/k_layers_design.md +++ b/plan/designs/k_layers_design.md @@ -1,5 +1,12 @@ # K Plane — Compiled and Authored Knowledge (Design) +> **Binding D107 amendment (2026-09-03).** The K prose writer's claim bundle +> carries `asserted_at` and the D41 fields with the two-clock framing, and +> the deterministic fact sheet prints a date under `valid from`/`valid until` +> only for `world_time` rows, under `said on` for `said_on` rows, and `—` +> otherwise; observation history sorts by the fact window. Contract: +> `temporal_clocks_design.md` §5.1, §6. + > **Binding D98 amendment (2026-08-27).** D98 supersedes D11 and removes the > unproved global community analytics product. The shipped K layout has entity > pages, source digests, root indexes, and purpose-scope pages; it has no diff --git a/plan/designs/locomo_benchmark_design.md b/plan/designs/locomo_benchmark_design.md index d528728a1..549d2249e 100644 --- a/plan/designs/locomo_benchmark_design.md +++ b/plan/designs/locomo_benchmark_design.md @@ -1,5 +1,11 @@ # LoCoMo full-system benchmark design +> **Accepted D107 amendment (2026-09-03; rolls the protocol when implemented).** +> The answer-agent prompt gains the two-clock paragraph naming `asserted_at` +> (said on), `claim_valid_*` (is about), and `validity.valid_from`/`valid_until` +> with `validity_basis`; ingestion generations and the surface manifest roll +> with D107's work packages. Contract: `temporal_clocks_design.md` §5.1, §7. + > **Binding D106 amendment (2026-09-03).** The current protocol is > `RS-LoCoMo-Full-v21`. It retains v20's dataset, rendered documents, models, > tools, budgets, answer and judge prompts, counterfactual and complete-answer diff --git a/plan/designs/observations_design.md b/plan/designs/observations_design.md index 6830d4c67..6c480e0f0 100644 --- a/plan/designs/observations_design.md +++ b/plan/designs/observations_design.md @@ -1,5 +1,14 @@ # The Observation Layer — Non-Graph Facts with Temporal Validity (Design) +> **Binding D107 amendment (2026-09-03).** An observation's `valid_from` is +> seeded from the triggering claim's D41 window (basis `world_time`), from +> the said-on date only when the window is unknown (basis `said_on`), and +> otherwise stays `NULL` (basis `unknown`). Evidence widens the start earlier +> to its is-about start, never to a said-on time. A cap uses the successor's +> is-about start, else its said-on date, else no cap — never `now()`. The +> staging order and predecessor/successor orientation use the shared +> comparator of `temporal_clocks_design.md` §4.4; the D106 rung is unchanged. + > **Binding D98 amendment (2026-08-27).** Relations are the only fact kind > mapped as live graph edges over PostgreSQL views. Observations remain > PostgreSQL facts and P1 search targets but are not graph elements. There is no diff --git a/plan/designs/registries_design.md b/plan/designs/registries_design.md index f5f5ef0f2..2862741c3 100644 --- a/plan/designs/registries_design.md +++ b/plan/designs/registries_design.md @@ -1,5 +1,12 @@ # Registries Design — Entity Resolution, Ontology, Governance +> **Binding D107 amendment (2026-09-03).** The T4 candidate snapshot carries +> each salient fact's validity window and basis, ranked by evidence then +> window recency (never `updated_at`), and the relation supersession prompt +> and its evidence laterals show both clocks (`said on` / `is about`) as +> `temporal_clocks_design.md` §5.1 requires; the cap boundary and ordering +> follow §4.3–§4.4. + > **Binding D102 amendment (2026-08-31).** T0 remains candidate-only globally. > One current `T4_small` match may establish a derived exact-name binding inside > the same catalog document; later exact canonical-name occurrences replay it diff --git a/plan/designs/retrieval_design.md b/plan/designs/retrieval_design.md index 27d727dee..98d8da341 100644 --- a/plan/designs/retrieval_design.md +++ b/plan/designs/retrieval_design.md @@ -1,5 +1,12 @@ # Retrieval Design — the Query Machine +> **Binding D107 amendment (2026-09-03).** Testimony grouping keys include the +> claim's D41 window, so identical wording about different dates stays two +> evidence rows; the fact-grain `Validity` gains `validity_basis`; P1 accepts +> is-about (`valid_from`/`valid_until`) filters beside the said-on ones; and +> `aggregate(form="timeline")` buckets by world-time with an explicit `undated` +> bucket. Contract: `temporal_clocks_design.md` §5.2–§5.4. + > **Binding D98 amendment (2026-08-27).** The graph channel reads live > PostgreSQL authority views. Fixed one-hop server statements use SQL/PGQ; > depth-two/variable neighborhoods, entity paths, and citation paths use bounded diff --git a/plan/designs/temporal_clocks_design.md b/plan/designs/temporal_clocks_design.md new file mode 100644 index 000000000..50e6ee0a3 --- /dev/null +++ b/plan/designs/temporal_clocks_design.md @@ -0,0 +1,258 @@ +# Temporal Clocks — world-time flows from the claim's window (Design) + +**Status:** binding under D107 + +**Date:** 2026-09-03 + +**Analysis:** `plan/analysis/time_handling_audit.md` (seventeen findings at +`02b79904`, each cited by file and function) + +**Builds on:** D41 (claims carry an immutable, source-asserted validity +interval), D3/D4 (supersession over verdicts, the cheap-first cascade), D43 +(observations), D88/D90 (continuous ingest ordering), D106 (temporal +compatibility in observation adjudication), D7/D12 (rebuild and generations). + +> **Reading this cold.** RememberStack extracts **claims** (what a source said, +> immutable) and adjudicates them into **facts** (relations between two +> entities, and observations about one entity) that carry a validity window: +> the span of world-time over which the fact held. The extractor already +> resolves *when* a statement is about — "last week" said on 2022-10-06 +> becomes the calendar day 2022-09-29 — and stores it on the claim as its +> **D41 window**. This design says where that resolved time must flow, which +> clock every stage reasons on, and what happens when a time is unknown. + +## 1. The problem, in one sentence + +The engine resolves world-time once, at extraction, and then almost every +later stage — fact windows, supersession, ordering, deduplication, prompts, +summaries, filters, timelines — reasons on the *source's own date* instead. +The audit lists seventeen instances; D106 fixed one. This design closes the +class. + +## 2. The three clocks + +| Clock | Where it lives | Meaning | Role under this design | +| --- | --- | --- | --- | +| **said-on** | `claims.asserted_at` | when the source said it | provenance; an *upper bound* on when a described change had happened; never validity by itself | +| **is-about** | `claims.claim_valid_kind`, `claim_valid_from`, `claim_valid_until`, `claim_valid_precision` (D41) | the world-time the statement refers to, resolved from the wording against the said-on date | the source of every fact window, ordering decision, and temporal prompt line | +| **believed** | `ingested_at`, `invalidated_at` | when the system held the belief | belief-time only; never a substitute for world-time | + +`claim_valid_kind` is the *sort* of interval: `event_time` (something +happened — a win, a visit, a resignation), `effective_period` (a state held — +"was CEO"), `measurement_period` (a figure for a span — "FY2023 revenue"), +`proposition_validity` (the proposition held — "has lived in Prague since +2019"). `NULL` means the source tied nothing to a date. A resolved start with +`claim_valid_until IS NULL` is an **open** interval: its end is unbounded, +never the same instant as its start. + +Two rules follow everything below: + +- **Rule 1 — world-time comes from the is-about window.** A fact's validity, + the order in which facts supersede one another, whether two statements are + the same fact, what a model is shown, and what a summary prints all read the + is-about window first. +- **Rule 2 — a missing time stays missing.** When the is-about window is + unknown, the said-on date may serve only where it is logically an upper + bound (a change described by a source had happened by the time the source + said so), and it is recorded as such. Nothing is ever filled with `now()`, + and an undated statement never *wins* an ordering. + +## 3. Extraction (E2): emit every kind, keep precision honest + +- The extractor prompt defines and exemplifies **all four kinds** and the + **open** precision, one worked example each, in the same style as the + existing `event_time` examples: "has been CEO since 2019" → + `proposition_validity`, `open`, from 2019-01-01, until null; "FY2023 revenue + was $5M" → `measurement_period`, `year`, 2023; "worked at Acme from 2015 to + 2018" → `effective_period`, `year`, 2015–2018. The structured-output model + carries a field description for each. +- The document header shown to the extractor carries the **full source + timestamp**, not the date alone, so intraday expressions can resolve and two + same-day sources are distinguishable anchors. +- **Precision-derived ends are half-open.** A day-precision claim about + 2023-05-07 is stored as `[2023-05-07T00:00Z, 2023-05-08T00:00Z)`; a + year-precision claim about 2022 as `[2022-01-01, 2023-01-01)`. Comparisons + everywhere use `from < other.until AND other.from < until` (half-open + overlap), with a `NULL` until as +∞. `claim_valid_precision` remains the + honesty marker; the stored ends are what the precision means, not a point. + The existing DB checks still hold (`unknown` ⇒ both ends `NULL`). + +## 4. Fact windows: seeding, widening, closing + +### 4.1 Seeding at insert + +When E3 creates a relation or an observation from a claim, the fact's window +is seeded from that claim's is-about window **by kind**: + +| Triggering claim | `valid_from` | `valid_until` | `validity_basis` | +| --- | --- | --- | --- | +| `effective_period`, `proposition_validity` (a state or proposition held over a span) | `claim_valid_from` | `claim_valid_until` (NULL when open) | `world_time` | +| `event_time` (something happened) | `claim_valid_from` | `claim_valid_until` (the event's own span; NULL when open) | `world_time` | +| `measurement_period` (a figure for a span) | `claim_valid_from` | `claim_valid_until` | `world_time` | +| no is-about window, said-on known | `asserted_at` | NULL | `said_on` | +| neither | NULL | NULL | `unknown` | + +`validity_basis` is a new nullable column on `relations` and `observations` +(`world_time` / `said_on` / `unknown`) so a reader can tell a window the +source dated from one the engine inferred. This is not a second validity +authority (D41 §"why this is not…"): the window is still one value per fact, +recorded by the adjudicator, and only the adjudicator changes it. The claim +window *seeds* it, exactly as D41 anticipated. + +The previous re-occurrence rule — a relation reopened after an earlier closed +spell starts no earlier than that spell's end — remains as a monotonic floor +on the seeded start. + +### 4.2 Widening on evidence + +When a claim collapses as evidence onto an existing fact, the fact's start may +move **earlier** to the evidence's is-about start (or said-on start under +basis `said_on`), never later, and never past a neighbouring capped slice. +This replaces the current pull to the earliest *said-on* time. The end is +never changed by evidence. + +### 4.3 Closing (supersession, retraction) + +A supersede verdict caps the predecessor at the **successor's world-time +start**, chosen in this order: + +1. the successor's is-about start (`world_time`); +2. else the successor's said-on date — by the time the source said the new + state held, the old one had ended, so the said-on date is an honest upper + bound (`said_on`); +3. else **no cap**: the pair coexists and the adjudication row records + `reason = "successor undated -> coexist"`. This is D43's fail-safe applied + to time: a duplicate, never an invented instant. + +`now()` is never a boundary. The same order applies to the D55 retraction +cap on relations (basis: the withdrawing version's source time, else no cap). + +### 4.4 One ordering comparator + +Predecessor/successor orientation — in relation supersession, in the +observation staging order, and in the D90 re-split — uses one shared key: + +``` +(is-about start, else said-on start, NULLS LAST; claim_id) +``` + +with **undated never winning**: when one side is undated and the other is not, +the undated side is neither predecessor nor successor for capping purposes — +it coexists, recorded. The two adjudicators stop disagreeing about undated +testimony because they share the comparator. + +### 4.5 The observation statement carries its date + +E3's normaliser receives the claim's is-about window with the claim. When the +window is known, the observation `statement` must carry the absolute date in +its own words ("Nate won a video game tournament on 2022-09-29 (said 'last +week')"), because that statement is what P1 embeds, profiles list, K pages +print, and readers see. The claim text itself stays source-faithful (D32); the +date joins the *fact's* wording, not the *claim's*. + +## 5. Adjudication and retrieval + +### 5.1 Every temporal judgement sees both clocks + +The two-clock block D106 introduced for the observation verdict — + +``` +EXISTING: … + said on: + is about: +NEW: … + said on: … + is about: … +``` + +with its definitions — is the contract for **every** prompt that compares, +merges, ranks, or summarises facts: relation supersession, the T4 identity +candidate list (each salient fact with its window), the K prose writer's +claim bundle (each claim with said-on and is-about), and the benchmark answer +agent (which additionally names the envelope fields: `asserted_at`, +`claim_valid_*`, `validity.valid_from/valid_until`, `validity_basis`). + +### 5.2 Deduplication keys include the window + +Grouping identical testimony for a response (`testimony_context`, +`answer_context`) keys on `(normalised text, claim_valid_kind, +claim_valid_from, claim_valid_until)`; two claims with the same words about +different windows are two rows. When the window is unknown on both sides the +key falls back to text alone, as today. + +### 5.3 The fact-grain envelope names the clocks + +`Validity` gains `validity_basis` beside `valid_from` / `valid_until`, and the +evidence grain keeps all five D41 fields (already the case). A reader can +therefore always tell an inferred window from a source-dated one. + +### 5.4 Filters and timelines use world-time + +- P1 claim search accepts `valid_from` / `valid_until` filters (half-open + overlap on the D41 columns, using the existing partial index) beside the + said-on `asserted_from` / `asserted_to`; fact search accepts the same on the + fact window. +- `aggregate(form="timeline")` buckets facts by `valid_from` and emits an + explicit `undated` bucket; it never substitutes `ingested_at`. +- Entity profiles rank salient facts by evidence then by the fact window's + recency, never by `updated_at`; each salient fact carries its window. + +## 6. Consumer surfaces label honestly + +The K fact sheet's columns are `valid from` / `valid until` **only** for +`world_time` rows; rows with basis `said_on` print under `said on` and rows +with basis `unknown` print `—`. "Observation history" sorts by the fact +window under the same rule. Until the fact layer is re-seeded, existing sheets +must not print a said-on date under a world-time heading. + +## 7. Generations, rebuild, protocol + +- The extractor generation rolls (half-open ends, full-timestamp header, all + kinds); the normaliser and both adjudicator generations roll; the + `adjudicate_observations` flush component rolls again with the D106 + stop-drain-rebuild contract. +- The schema adds `validity_basis` on `relations` and `observations` (a + migration; head rolls). +- Existing stores are rebuilt (D7): fact windows are re-seeded from claim + rows, which already hold the D41 fields — no re-extraction is needed for + 4.1–4.4, only for §3's half-open ends and additional kinds. +- The LoCoMo protocol rolls once for the whole change (ingestion provenance + and the answer prompt both change); scores before and after are + directional. + +## 8. Alternatives considered + +- **Patch each finding where it sits.** Seventeen local fixes would leave the + next stage free to read the wrong clock again; the audit shows the pattern + recurs wherever a new consumer is written. One contract with one comparator + and one prompt block is smaller and stays true. +- **Make the claim window the fact window (a view, no seeding).** Rejected by + D41's own boundary: the fact window must be the adjudicator's single, + recorded, monotonic verdict, not a reduction over many-valued claim columns. + Seeding-then-adjudicating keeps that property. +- **Keep `now()` as the undated cap.** It makes histories depend on ingest + wall-clock and breaks rebuild stability (D7); coexisting with a recorded + reason is the D43 fail-safe and costs at most a duplicate. +- **A typed period/value column on facts.** D43 §4 rejected typed value + schemas; the window plus `validity_basis` is the minimum that makes as-of + queries true, and it is already the schema's shape. +- **Stripping relative wording from claim text.** Violates D32's + source-faithfulness; the absolute date belongs on the *fact's* statement + (§4.5), where it is the engine's wording. + +## 9. Non-goals (scope boundaries) + +- Recurrence ("every Q4") and anchor-relative time ("as of the merger") + remain outside the single-interval model, as D41 records. +- Belief-time (`ingested_at`/`invalidated_at`) semantics are unchanged. +- No new time authority: the claim window stays immutable evidence; the fact + window stays the one adjudicated home. + +## References + +Decisions: D107 (this design), D41, D3, D4, D43, D88, D90, D106, D7, D12, +D55. Analysis: `plan/analysis/time_handling_audit.md`. Sequencing: +`plan/plans/temporal_clocks.md`. Affected designs carry a D107 amendment +banner: `e2_e3_claims_relations_design.md`, `observations_design.md`, +`registries_design.md`, `retrieval_design.md`, `k_layers_design.md`, +`locomo_benchmark_design.md`. diff --git a/plan/plans/temporal_clocks.md b/plan/plans/temporal_clocks.md new file mode 100644 index 000000000..ebbd42f6f --- /dev/null +++ b/plan/plans/temporal_clocks.md @@ -0,0 +1,27 @@ +# Temporal clocks — sequencing (D107) + +**Status:** proposed sequencing; no work package is started by this document + +**Binding design:** `plan/designs/temporal_clocks_design.md` + +**Analysis:** `plan/analysis/time_handling_audit.md` + +Order follows answer impact and dependency: as-of correctness first (it makes +the documented `valid_at` promise true), then the prompts that decide +supersession and identity, then retrieval deduplication, then extraction +precision and vocabulary. Each package rolls the generations it touches and +lands with tests that assert the *clock*, not only the outcome. + +| WP | Scope | Audit findings closed | Generations rolled | Acceptance | +| --- | --- | --- | --- | --- | +| **WP-T.1 — fact windows and closing** | seed relation/observation windows from the claim's is-about window by kind; add `validity_basis`; widen only earlier; cap at the successor's world-time start, else said-on as upper bound, else coexist — never `now()`; one shared ordering comparator with undated-never-wins; apply to D55 retraction | 4.2, 4.4, 4.10, 4.11, 4.17 | normaliser, both adjudicators, obs flush component; schema head (migration) | `lookup_relations(valid_at=2010)` returns the 2010 employer on a seeded corpus; the same ingest replayed on different days yields byte-identical windows; the two adjudicators orient one undated/dated pair identically; no `now()` appears in any cap boundary | +| **WP-T.2 — two clocks in every temporal prompt** | relation supersession prompt and evidence laterals select and show `said on` / `is about`; T4 candidate salient facts carry windows and rank by evidence then window recency; K writer claims carry `asserted_at` + D41 fields; answer-agent prompt names the envelope fields | 4.3, 4.6, 4.8, 4.16 | relation adjudicator, resolver, K writer; LoCoMo protocol | a 2024 retrospective spell does not supersede a 2023 current fact in the supersession proofs; T4 sees windows in its candidate JSON; the answer prompt fixture contains the two-clock paragraph | +| **WP-T.3 — retrieval keys and envelopes** | testimony grouping keys include the D41 window; `Validity` gains `validity_basis`; P1 gains `valid_from`/`valid_until` filters; `aggregate(form="timeline")` buckets by `valid_from` with an `undated` bucket | 4.1, 4.9, 4.12 | query-space manifest / surface manifest hash; LoCoMo protocol | identical text on two dates is two evidence rows in `testimony_context`; a 2015–2020 archive imported today produces 2015–2020 timeline buckets | +| **WP-T.4 — extraction precision and vocabulary** | half-open precision-derived ends; full-timestamp header; all four kinds and `open` taught with examples and field descriptions; E3 statement carries the absolute date when known | 4.5, 4.13, 4.14, 4.15 | extractor, normaliser; LoCoMo protocol | `claims_as_of` over an intraday window finds a day-precision claim; "has been CEO since 2019" extracts as `proposition_validity`/`open`; an observation minted from "last week" carries the resolved date in its statement | +| **WP-T.5 — consumer labels** | K fact sheet columns by `validity_basis`; observation history sorted by fact window | 4.7 | K page generation | a sheet never prints a said-on date under a world-time heading | + +Dependencies: T.2 and T.3 depend on T.1's `validity_basis` column for the +envelope and labels; T.4 is independent of T.1–T.3 and can run in parallel; +T.5 depends on T.1. Every package updates the same-PR documentation the +CLAUDE.md rule requires (concepts and API pages for `valid_at`, the benchmark +README when the protocol rolls) and the project-status page. From a9e836a16b0bfb8c3e1bb0a279e00db697d6c5d0 Mon Sep 17 00:00:00 2001 From: Jiri Puc Date: Thu, 3 Sep 2026 14:45:58 +0200 Subject: [PATCH 2/8] design: two windows per fact; no said-on seeding; recorded verdicts only (D107 review) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codex's review of the first revision found four mechanisms that contradict decisions this design must live inside: seeding valid_from from the said-on date (provenance is not validity), seeding a measurement's end from its claim (D43 never caps a fixed-period figure), widening the verdict start on evidence (a reduction over claim columns, D41), and half-open storage (empties `instant`), plus a merged ordering key that conflated D90's total processing order with temporal succession. Replace them: a fact carries an adjudicated verdict window (seeded once by kind, per-endpoint bases, changed only by recorded verdicts — cap, extend_start, date_undated, D55) and a derived, non-authoritative occurrence window that widens with evidence; measurements and events are believed from their occurrence start and never capped; interval-aware evidence-target matching for bounded slices under the GiST EXCLUDE; temporal succession separate from D90 order, requiring world-time starts, else coexist; precision honoured at comparison time with storage unchanged; statements canonical and dated labels derived; the full D41 tuple in dedupe keys; the envelope/operation/protocol roll enumerated. Narrow five audit findings to what the code shows and add the consumption skill's wrong claims_as_of definition as 4.18. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016p9xB9T7VYREuVmohDPKjR --- decisions.md | 161 +++--- plan/analysis/time_handling_audit.md | 77 ++- plan/designs/e2_e3_claims_relations_design.md | 15 +- plan/designs/k_layers_design.md | 11 +- plan/designs/locomo_benchmark_design.md | 11 +- plan/designs/observations_design.md | 20 +- plan/designs/registries_design.md | 8 +- plan/designs/retrieval_design.md | 13 +- plan/designs/temporal_clocks_design.md | 509 ++++++++++-------- plan/plans/temporal_clocks.md | 25 +- 10 files changed, 496 insertions(+), 354 deletions(-) diff --git a/decisions.md b/decisions.md index 77c5c4fcb..55a7d872d 100644 --- a/decisions.md +++ b/decisions.md @@ -4993,74 +4993,106 @@ retrieval, D100/D102 identity, and D104/D105 answer-prompt contracts. ## D107. World-time flows from the claim's window; said-on time is provenance, never validity **Decision (2026-09-03).** Every stage that reasons about *when* a fact held -reads the claim's resolved D41 window (what the statement **is about**) first -and treats the source's own date (when it was **said**) as provenance and, at -most, an upper bound. Concretely: - -1. A relation's or observation's validity window is **seeded** from the - triggering claim's D41 window by kind (state, event, measurement, - proposition), with a new `validity_basis` column recording whether the - window is `world_time`, `said_on`, or `unknown`. A first-occurrence - relation no longer starts at `NULL`. -2. Evidence may move a fact's start **earlier** to its is-about start, never - later; the end changes only by adjudication. -3. A supersede caps the predecessor at the successor's is-about start, else - its said-on date as an honest upper bound, else **not at all** — the pair - coexists with a recorded reason. `now()` is never a boundary, including on - the D55 retraction path. -4. Predecessor/successor orientation in both adjudicators and the observation - staging order use **one comparator** keyed on the is-about start (else - said-on), and an undated side never wins a cap. -5. Every prompt that compares, merges, ranks, or summarises facts shows the - D106 two-clock block (`said on` / `is about`, with definitions): relation - supersession, T4 identity candidates, the K prose writer, and the - benchmark answer agent. -6. Testimony deduplication keys include the D41 window; the fact-grain - envelope names the basis; P1 gains is-about filters; the timeline - aggregate buckets by world-time with an explicit `undated` bucket; entity - profiles rank by evidence then window recency, never by `updated_at`. -7. Extraction stores precision-derived ends **half-open** (a day is - `[00:00, next 00:00)`), shows the extractor the full source timestamp, - teaches all four D41 kinds and `open` with examples, and the normaliser - writes the absolute date into the *fact's* statement when the window is - known (claim text stays source-faithful, D32). -8. Consumer surfaces print a said-on date only under a said-on heading. +reads the claim's resolved D41 window (what the statement **is about**) and +treats the source's own date (when it was **said**) as provenance shown +beside it — never as a window boundary. A missing time stays missing. +Concretely: + +1. A fact carries **two windows**: the adjudicated **verdict window** + (`valid_from`/`valid_until`, now with a basis per endpoint — + `world_time`, `verdict`, `source_removed`, `unknown`) and a derived, + non-authoritative **occurrence window** (`occurs_from`/`occurs_until`/ + `occurs_precision`: the union of its evidence's D41 windows). The verdict + is seeded **once** from the triggering claim by kind — a state's span + becomes its verdict window (a bounded past span is a closed historical + slice); an event or a measurement is believed from its occurrence start + onward and is never capped (D43's no-cap rule, extended to events); an + unknown window stays `NULL`/`unknown`. The said-on date is never written + into a window. +2. Evidence attaches to the slice whose verdict window overlaps its + occurrence window; a disjoint window is a new historical slice; undated + evidence attaches to the single open slice, else the most recent, and + never creates a second unbounded slice. Attaching evidence never changes + a verdict; it recomputes the occurrence window. +3. A verdict changes only by a recorded adjudication: a supersede cap, a + deterministic `extend_start` (a state's start moves earlier to the + earliest evidenced start, never later, never past a capped predecessor, + never touching the end), `date_undated`, or a D55 retraction. No verdict + reopens a closed end. +4. **Temporal succession** is separate from D90's processing order: B + succeeds A only when both are states with `world_time` starts and B's is + later; a cap lands at B's start with basis `verdict`. Otherwise the pair + coexists, recorded. `now()` is never a boundary; D55 keeps its + source-removal basis and closes on belief-time when that is unknown. +5. Precision is honoured at **comparison time** — one overlap function + derives each window's effective exclusive end from its precision (a day + covers the whole day; `instant` stays a point; `open` is +∞) — with + storage and schema `CHECK`s unchanged. +6. Every prompt that compares, merges, ranks, or summarises facts shows the + D106 two-clock block (`said on` / `is about`, defined): relation + supersession, T4 identity candidates, the K prose writer, the benchmark + answer agent. +7. Testimony deduplication keys on the full D41 tuple (or `asserted_at` when + unknown) and grouped rows keep every member's times; the fact-grain + envelope, `GraphEdge`, the K fact model and the `memory_v1` fact views + gain bases and occurrence (additive, D49; `fact_context@3`, + `answer_context@3`); P1 gains is-about claim filters and an `occurs` fact + mode; the timeline aggregate buckets by occurrence with an explicit + `undated` bucket; profiles rank by evidence then occurrence recency. +8. Extraction teaches all four D41 kinds and `open` with examples and shows + the extractor the full source timestamp. Statements stay canonical (D43); + dated labels are derived from the occurrence window. +9. Consumer surfaces print a date under a world-time heading only for + `world_time`/`verdict` bases and the consumption skill defines + `claims_as_of` over source world-time (D41), not system time. **Context.** D106 fixed the observation adjudicator merging "won a tournament last week" across a nine-month gap because it never read the claims' resolved windows. The follow-up audit (`plan/analysis/time_handling_audit.md`, revision `02b79904`) found the same -confusion in sixteen more places: relations' `valid_from` is never seeded, so -`valid_at` is a no-op on the relation side; the relation supersession prompt -asks the model about "the same period" while showing only document dates; -undated supersessions cap at the ingest wall-clock, so a rebuild on another -day yields a different history; the two adjudicators orient undated testimony -in opposite directions; retrieval dedupes identical text across dates -exactly as the adjudicator did before D106; the K fact sheet prints the chat -date under "valid since"; the timeline aggregate buckets by ingest year; the -answer agent is told to "use timestamps" without being told which; and -day-precision windows are stored as zero-width points that intraday as-of -queries miss. The docs (`/docs/concepts`, `fact_context`'s description) +confusion in seventeen more places: relations' `valid_from` is never seeded, +so a `valid_at` lookup cannot exclude a fact before its true beginning; the +relation supersession prompt asks the model about "the same period" while +showing only document dates; undated supersessions cap at the ingest +wall-clock, so a rebuild on another day yields a different history; the two +adjudicators orient undated testimony in opposite directions; retrieval +dedupes identical text across dates exactly as the adjudicator did before +D106; the K fact sheet sorts by a said-on date it does not show; the timeline +aggregate falls back to ingest year; the answer agent is told to "use +timestamps" without being told which; day-precision windows are compared as +zero-width points; and the consumption skill defines `claims_as_of` as a +system-time query. The docs (`/docs/concepts`, `fact_context`'s description) promise world-time semantics the code does not keep. +An independent Codex design review of the first revision withdrew four of +its mechanisms — said-on seeding, mechanical evidence widening, universal +half-open storage, and a merged ordering key — as violating Rule 2, D41, +the `instant` schema contract, and D90 respectively; the two-window model +above replaces them. + **Consequences.** `valid_at` / `facts_as_of` become true on both fact planes; histories are rebuild-stable (D7) because no boundary depends on ingest time; the two fact planes agree on undated testimony; recurring events and -retrospectives order by the world, not by who spoke last; readers and -compiled pages see resolved dates. Costs: one migration -(`validity_basis`), generation rolls for the extractor, normaliser, both -adjudicators and the flush component, a rebuild of existing stores -(re-seeding reads the claim rows already present; only the half-open ends and -new kinds need re-extraction), and one LoCoMo protocol roll for the whole -change. Fail-safe direction is preserved and widened: an unknown time now -yields a coexisting duplicate with a reason rather than an invented instant. - -**Rejected.** Seventeen local patches (the pattern recurs in every new -consumer); making the claim window the fact window by a view (D41 forbids a -fact window that is a reduction over many-valued claim columns — seeding -then adjudicating keeps the single monotonic verdict); keeping `now()` as the -undated cap (breaks D7 rebuild stability); a typed period/value column on -facts (D43 §4); stripping relative wording from claim text (D32). +retrospectives order by the world, not by who spoke last; readers, profiles +and compiled pages see resolved dates as labels while statements keep source +wording. Costs: one migration (four columns on each fact table), generation +rolls for the extractor, normaliser, both adjudicators and the flush +component, assured-operation version rolls, a rebuild of existing stores +(re-seeding reads the claim rows already present), and LoCoMo protocol +rolls per landed package. Undated, differently worded restatements of a +changing state now coexist as duplicates instead of capping at `now()`; the +count of `unknown`-basis slices per key is a reported metric and the lever +is extraction coverage of the D41 kinds. + +**Rejected.** Seeding windows from the said-on date (provenance is not +validity); seeding a measurement's or event's end from its claim (D43 +no-cap; the period belongs to the occurrence window); mechanical widening of +the verdict on evidence (a reduction over claim columns, D41); half-open +storage (empties `instant`); one coalesced key for processing and succession +(D90 needs a total processing order); capping at a retrospective's said-on +date; baking the resolved date into the observation statement (identity would +depend on arrival order, D43); seventeen local patches (the pattern recurs +in every new consumer); keeping `now()` as the undated cap (D7). **Design.** `plan/designs/temporal_clocks_design.md`; amendment banners on `e2_e3_claims_relations_design.md`, `observations_design.md`, @@ -5072,9 +5104,10 @@ facts (D43 §4); stripping relative wording from claim text (D32). **Sequencing.** `plan/plans/temporal_clocks.md`. **Amends.** D41's consequences become binding mechanics (claim windows seed -fact windows; a monotonic guard remains); D43 §3 (the cap boundary and -ordering key); D88/D90 (source-time ordering now means is-about time, else -said-on); D106 (its two-clock prompt block becomes the engine-wide contract; -its stored `valid_from` seeding gap is closed). Preserves D3 (supersession -over verdicts), D6 (one validity home per fact), D32, D49 (additive envelope -field only), D98, D100–D105. +fact verdicts once; explicit recorded verdicts revise them; the retrospective +guard holds); the observations design §3 (cap boundary, succession, the +no-cap rule extended to events); D88/D90 (processing order unchanged; +succession now needs world-time bounds); D106 (its two-clock prompt block +becomes the engine-wide contract; its `valid_from` seeding gap is closed); +D55 (unknown source time closes on belief-time, never `now()`). Preserves D3, +D6, D32, D43's untyped statement, D49 (additive fields only), D98, D100–D105. diff --git a/plan/analysis/time_handling_audit.md b/plan/analysis/time_handling_audit.md index e91a3470a..17410dd8e 100644 --- a/plan/analysis/time_handling_audit.md +++ b/plan/analysis/time_handling_audit.md @@ -7,6 +7,8 @@ binding contract is `plan/designs/temporal_clocks_design.md`. **Revision audited:** `02b79904` (the merge of D106). Line numbers below are for that revision; function and statement names are the stable anchors. +Findings 4.2, 4.6, 4.12, 4.13 and 4.14 were narrowed after an independent +Codex review verified each against the code; 4.18 was added from that review. ## 1. Question @@ -89,10 +91,12 @@ never written anywhere else: not from `claim_valid_from`, not from March 2024' can seed `works_for.valid_from`"), and the docs promise `valid_at` answers "when was this true in the world" (`website/src/app/docs/concepts/page.mdx:80`). `lookup_relations(valid_at=…)` -filters `valid_from IS NULL OR valid_from <= :as_of` -(`query_engine.py:3696`), so with `valid_from` always `NULL`, "who did Alice -work for in 2010?" returns her current employer. The as-of axis is a no-op on -the relation side. +does filter both ends (`valid_from IS NULL OR valid_from <= :as_of` and +`valid_until IS NULL OR valid_until > :as_of`, `query_engine.py:3696-3697`), +so a *capped* spell is excluded after its end — but with `valid_from` always +`NULL`, no fact can be excluded *before its true beginning*: "who did Alice +work for in 2010?" returns her 2024 employer alongside any earlier one. The +start half of the as-of axis is a no-op on the relation side. ### 4.3 Relation supersession judges "the same period" without seeing any period (P2, P4) @@ -149,12 +153,15 @@ consumer reads "Nate won a video game tournament last week" with no anchor. `benchmarks/locomo/protocol.py:135-137` — the prompt says "Use timestamps to resolve relative dates" and nothing else about time. The envelopes carry `asserted_at`, `claim_valid_*`, and `validity.valid_from` (fact grain) side -by side; `_reader_trace_record` (`:344-347`) drops `None` fields, so for a -relation (4.2) the only surviving timestamp is `ingested_at` — the benchmark's -own run clock — and for an observation `validity.valid_from` is the session -date under a name that reads as world-time. Contrast -`observation_adjudication.py:63-72`, which spells the distinction out for the -verdict model. +by side, and `fact_context` does include representative evidence rows with +`asserted_at` and claim windows (`query_engine.py:778-867`); but the direct +relation result's own `Validity` is all-`NULL` for a first-occurrence +relation (4.2), and `_reader_trace_record` (`:344-347`) drops `None` fields, +so on that row the only surviving timestamp is `ingested_at` — the +benchmark's own run clock — while for an observation `validity.valid_from` is +the session date under a name that reads as world-time. The reader is never +told which is which. Contrast `observation_adjudication.py:63-72`, which +spells the distinction out for the verdict model. ### 4.7 K fact sheets label the said-on date "valid since" and sort history by it (P2, P5) @@ -199,11 +206,14 @@ replay-stable under reordering. ### 4.12 P1 offers a said-on filter and no is-about filter (P1, P2) -`adapters/postgres_p1.py:1371-1400`: claim search accepts `asserted_from` / -`asserted_to` only; `_fact_filters` (`:1427-1446`) has nothing temporal. The -D41 partial index on `(claim_valid_from, claim_valid_until)` exists and is -unused by search. "Nate's claims about October" returns what was *spoken* in -October. +`adapters/postgres_p1.py:1371-1400`: *claim* search accepts `asserted_from` +/ `asserted_to` only — the D41 partial index on +`(claim_valid_from, claim_valid_until)` is unused by the search path, so +"Nate's claims about October" returns what was *spoken* in October. *Fact* +search is not time-blind: `_fact_time` (`:1449-1492`) offers as-of and window +selectors over the fact's `valid_from`/`valid_until` — which, per 4.2 and +4.17, hold the wrong clock, so the selector is correct over incorrect +inputs. ### 4.13 Day/month/year precision is stored as a zero-width interval (P3) @@ -212,19 +222,23 @@ October. `_CLAIMS_AS_OF_CANDIDATES` (`query_engine.py:3585-3600`) intersects closed intervals. A day-precision May-7 claim is `[May 7 00:00, May 7 00:00]`, so "what held during May 7, 09:00–23:00" returns nothing; a year-precision 2022 -claim ends at 2022-12-31 00:00. D106's `_windows_disjoint` inherits the point -semantics, so two same-day events from different wordings can read as -touching but not overlapping. +claim ends at 2022-12-31 00:00. D106's `_windows_disjoint` compares with +strict `<`, so two *equal* points do overlap; but two same-day events whose +wordings resolve to different instants of that day, or a day-precision and an +instant-precision claim, are points that miss each other although the day +contains both. ### 4.14 E2 teaches only `event_time` (P4) `workers/e2.py:167-209`: all three worked examples are `event_time`; `measurement_period`, `effective_period`, `proposition_validity` are never named; `open` gets one structural mention and no example; `CandidateClaim` -(`model/claims.py:158-168`) has no field descriptions. "Alice has been CEO -since 2019" — `proposition_validity`, `open`, from=2019 — is emitted as a -point event or not at all. This starves D106 directly: its rung fires on -`about_kind == "event_time"` only. +(`model/claims.py:158-168`) has no field descriptions. The kinds are exposed +structurally, so the model *can* emit `proposition_validity` / `open` for +"Alice has been CEO since 2019", but nothing teaches it their semantics; how +often it does is unmeasured. Whatever it emits instead, D106's rung fires on +`about_kind == "event_time"` only, so mislabelled kinds silently change which +pairs the rung governs. ### 4.15 The document header shown to E2 drops the time of day (P3) @@ -254,6 +268,17 @@ window). Two sessions re-asserting one event leave the row's world-window at `[earliest session, ∞)` although the event window `[2023-09-29, 2023-09-29]` was computed one function away. +### 4.18 The consumption skill defines `claims_as_of` as a system-time query (P2) + +`src/rememberstack/core/consumption_skill.py:191-194`: "`claims_as_of` means +what sources asserted as of a past **system** time" — D41 defines it over the +claims' *world*-time window, and the implementation filters +`claim_valid_from/until` (5. below). The skill's "Time and media" section +(`:202-210`) teaches fact validity versus ingestion but not the said-on / +is-about distinction. Under D60 the skill is part of the complete agent-facing +surface, so agents are taught the wrong clock in the one place meant to teach +clocks. + ## 5. Checked and sound Absence of a finding above is a result, not an omission: @@ -289,13 +314,13 @@ Absence of a finding above is a result, not an omission: every D106 coercion is recorded, so all of the above is diagnosable from the audit tables without a rerun. -## 6. Why this is one decision, not seventeen fixes +## 6. Why this is one decision, not eighteen fixes Every finding is the same confusion: the engine resolves world-time once, at extraction, and then reasons on the source's date. The fix that closes all of them is a single contract — world-time flows from the claim's is-about window -into fact windows, ordering, prompts, and consumer surfaces; said-on time is -provenance and an upper bound, never validity; a missing time stays missing -rather than becoming `now()`. That contract is D107 and +into fact windows, temporal succession, prompts, dedupe keys, and consumer +surfaces; said-on time is provenance, never validity; a missing time stays +missing rather than becoming `now()`. That contract is D107 and `plan/designs/temporal_clocks_design.md`; the sequencing is `plan/plans/temporal_clocks.md`. diff --git a/plan/designs/e2_e3_claims_relations_design.md b/plan/designs/e2_e3_claims_relations_design.md index 9a553ac48..537a2a875 100644 --- a/plan/designs/e2_e3_claims_relations_design.md +++ b/plan/designs/e2_e3_claims_relations_design.md @@ -1,12 +1,13 @@ # E2 / E3 — Claim Extraction and Relation Normalization (Design) -> **Binding D107 amendment (2026-09-03).** E2 emits all four D41 kinds and -> `open` with examples, stores precision-derived ends half-open, and sees the -> full source timestamp in the header. E3 receives each claim's resolved -> window, seeds a new relation's or observation's validity window from it by -> kind (with `validity_basis`), and writes the absolute date into the fact's -> statement when the window is known while the claim text stays source- -> faithful. Contract: `temporal_clocks_design.md` §3–§4. +> **Binding D107 amendment (2026-09-03).** E2 teaches all four D41 kinds and +> `open` with examples and sees the full source timestamp in the header; +> storage of windows is unchanged and precision is honoured at comparison +> time. E3 receives each claim's resolved window and seeds a new relation's +> or observation's verdict window from it once, by kind, with a basis per +> endpoint, and sets the derived occurrence window; statements stay +> source-faithful and canonical, and dated labels are derived from the +> occurrence window. Contract: `temporal_clocks_design.md` §3–§5. How the system turns a chunk of source text into **claims** (atomic, standalone, verifiable assertions) and then into **relations** (the distinct facts those claims are evidence for). This is diff --git a/plan/designs/k_layers_design.md b/plan/designs/k_layers_design.md index cd397e81b..89a151a02 100644 --- a/plan/designs/k_layers_design.md +++ b/plan/designs/k_layers_design.md @@ -1,11 +1,12 @@ # K Plane — Compiled and Authored Knowledge (Design) > **Binding D107 amendment (2026-09-03).** The K prose writer's claim bundle -> carries `asserted_at` and the D41 fields with the two-clock framing, and -> the deterministic fact sheet prints a date under `valid from`/`valid until` -> only for `world_time` rows, under `said on` for `said_on` rows, and `—` -> otherwise; observation history sorts by the fact window. Contract: -> `temporal_clocks_design.md` §5.1, §6. +> carries `asserted_at` and the D41 fields with the two-clock framing; the +> deterministic fact sheet prints `valid from`/`valid until` only for +> `world_time`/`verdict` bases, an `about` column from the occurrence window, +> and `—` for `unknown`; observation history sorts by occurrence start; the K +> fact model gains bases and occurrence. Contract: +> `temporal_clocks_design.md` §6–§7. > **Binding D98 amendment (2026-08-27).** D98 supersedes D11 and removes the > unproved global community analytics product. The shipped K layout has entity diff --git a/plan/designs/locomo_benchmark_design.md b/plan/designs/locomo_benchmark_design.md index 549d2249e..7c0f73a85 100644 --- a/plan/designs/locomo_benchmark_design.md +++ b/plan/designs/locomo_benchmark_design.md @@ -1,10 +1,11 @@ # LoCoMo full-system benchmark design -> **Accepted D107 amendment (2026-09-03; rolls the protocol when implemented).** -> The answer-agent prompt gains the two-clock paragraph naming `asserted_at` -> (said on), `claim_valid_*` (is about), and `validity.valid_from`/`valid_until` -> with `validity_basis`; ingestion generations and the surface manifest roll -> with D107's work packages. Contract: `temporal_clocks_design.md` §5.1, §7. +> **Binding D107 amendment (2026-09-03).** The answer-agent prompt carries the +> two-clock paragraph naming `asserted_at` (said on), `claim_valid_*` (is +> about), and the fact-grain `validity` fields with their bases and occurrence +> window. Each D107 work package that changes ingestion provenance or the +> assured surface rolls this protocol; the sequencing is +> `plan/plans/temporal_clocks.md`. Contract: `temporal_clocks_design.md` §6–§8. > **Binding D106 amendment (2026-09-03).** The current protocol is > `RS-LoCoMo-Full-v21`. It retains v20's dataset, rendered documents, models, diff --git a/plan/designs/observations_design.md b/plan/designs/observations_design.md index 6c480e0f0..16ebbb901 100644 --- a/plan/designs/observations_design.md +++ b/plan/designs/observations_design.md @@ -1,13 +1,17 @@ # The Observation Layer — Non-Graph Facts with Temporal Validity (Design) -> **Binding D107 amendment (2026-09-03).** An observation's `valid_from` is -> seeded from the triggering claim's D41 window (basis `world_time`), from -> the said-on date only when the window is unknown (basis `said_on`), and -> otherwise stays `NULL` (basis `unknown`). Evidence widens the start earlier -> to its is-about start, never to a said-on time. A cap uses the successor's -> is-about start, else its said-on date, else no cap — never `now()`. The -> staging order and predecessor/successor orientation use the shared -> comparator of `temporal_clocks_design.md` §4.4; the D106 rung is unchanged. +> **Binding D107 amendment (2026-09-03).** An observation carries two windows: +> the adjudicated verdict window (`valid_from`/`valid_until` with a basis per +> endpoint), seeded once from the triggering claim's D41 window by kind — a +> state's span; an event or measurement believed from its occurrence start +> onward and never capped; `NULL`/`unknown` when the source tied nothing to a +> date — and a derived occurrence window (`occurs_*`) that widens as evidence +> attaches. The said-on date is never a window boundary. A verdict changes only +> by a recorded adjudication (a cap at a successor's `world_time` start, a +> deterministic `extend_start`, D55); an undated pair coexists, never caps and +> never `now()`. D90's staging order is unchanged; temporal succession is the +> separate rule of `temporal_clocks_design.md` §4.4. The D106 rung is unchanged +> and uses the precision-aware overlap of §5. > **Binding D98 amendment (2026-08-27).** Relations are the only fact kind > mapped as live graph edges over PostgreSQL views. Observations remain diff --git a/plan/designs/registries_design.md b/plan/designs/registries_design.md index 2862741c3..635d071d3 100644 --- a/plan/designs/registries_design.md +++ b/plan/designs/registries_design.md @@ -1,11 +1,11 @@ # Registries Design — Entity Resolution, Ontology, Governance > **Binding D107 amendment (2026-09-03).** The T4 candidate snapshot carries -> each salient fact's validity window and basis, ranked by evidence then -> window recency (never `updated_at`), and the relation supersession prompt +> each salient fact's occurrence window and bases, ranked by evidence then +> occurrence recency (never `updated_at`); the relation supersession prompt > and its evidence laterals show both clocks (`said on` / `is about`) as -> `temporal_clocks_design.md` §5.1 requires; the cap boundary and ordering -> follow §4.3–§4.4. +> `temporal_clocks_design.md` §6 requires; evidence-target matching, verdict +> revision and temporal succession follow §4.2–§4.4. > **Binding D102 amendment (2026-08-31).** T0 remains candidate-only globally. > One current `T4_small` match may establish a derived exact-name binding inside diff --git a/plan/designs/retrieval_design.md b/plan/designs/retrieval_design.md index 98d8da341..f89a85232 100644 --- a/plan/designs/retrieval_design.md +++ b/plan/designs/retrieval_design.md @@ -1,11 +1,12 @@ # Retrieval Design — the Query Machine -> **Binding D107 amendment (2026-09-03).** Testimony grouping keys include the -> claim's D41 window, so identical wording about different dates stays two -> evidence rows; the fact-grain `Validity` gains `validity_basis`; P1 accepts -> is-about (`valid_from`/`valid_until`) filters beside the said-on ones; and -> `aggregate(form="timeline")` buckets by world-time with an explicit `undated` -> bucket. Contract: `temporal_clocks_design.md` §5.2–§5.4. +> **Binding D107 amendment (2026-09-03).** Testimony grouping keys on the full +> D41 tuple (or `asserted_at` when unknown) and grouped rows keep every +> member's times; the fact-grain `Validity`, `GraphEdge` and the `memory_v1` +> fact views gain per-endpoint bases and the occurrence window (additive; +> `fact_context@3`, `answer_context@3`); P1 accepts is-about claim filters and +> an `occurs` fact mode; `aggregate(form="timeline")` buckets by occurrence +> with an explicit `undated` bucket. Contract: `temporal_clocks_design.md` §7. > **Binding D98 amendment (2026-08-27).** The graph channel reads live > PostgreSQL authority views. Fixed one-hop server statements use SQL/PGQ; diff --git a/plan/designs/temporal_clocks_design.md b/plan/designs/temporal_clocks_design.md index 50e6ee0a3..428c4b59a 100644 --- a/plan/designs/temporal_clocks_design.md +++ b/plan/designs/temporal_clocks_design.md @@ -2,256 +2,331 @@ **Status:** binding under D107 -**Date:** 2026-09-03 +**Date:** 2026-09-03 (revised the same day after an independent Codex design +review; the first revision's said-on seeding, mechanical widening, universal +half-open ends, and merged ordering key were withdrawn — see §9) -**Analysis:** `plan/analysis/time_handling_audit.md` (seventeen findings at +**Analysis:** `plan/analysis/time_handling_audit.md` (eighteen findings at `02b79904`, each cited by file and function) **Builds on:** D41 (claims carry an immutable, source-asserted validity -interval), D3/D4 (supersession over verdicts, the cheap-first cascade), D43 -(observations), D88/D90 (continuous ingest ordering), D106 (temporal -compatibility in observation adjudication), D7/D12 (rebuild and generations). - -> **Reading this cold.** RememberStack extracts **claims** (what a source said, -> immutable) and adjudicates them into **facts** (relations between two -> entities, and observations about one entity) that carry a validity window: -> the span of world-time over which the fact held. The extractor already -> resolves *when* a statement is about — "last week" said on 2022-10-06 -> becomes the calendar day 2022-09-29 — and stores it on the claim as its -> **D41 window**. This design says where that resolved time must flow, which -> clock every stage reasons on, and what happens when a time is unknown. +interval; a fact's window is the adjudicator's single recorded verdict, never +a reduction over claim columns), D3/D4 (supersession over verdicts; the +cheap-first cascade), D43 (observations; the no-cap rule for fixed-period +figures), D88/D90 (continuous-ingest processing order and the re-split), +D106 (temporal compatibility in observation adjudication), D7/D12 (rebuild +and generations), D55 (retraction), D49 (envelopes). + +> **Reading this cold.** RememberStack extracts **claims** (what a source +> said, immutable) and adjudicates them into **facts** — relations between +> two entities, observations about one entity — each with a validity window: +> the span over which the system believes the fact held. The extractor +> already resolves *when* a statement is about ("last week" said on +> 2022-10-06 → 2022-09-29) and stores it on the claim as its **D41 window**. +> This design says where that resolved time must flow, which clock each +> stage reasons on, and what happens when a time is unknown. ## 1. The problem, in one sentence -The engine resolves world-time once, at extraction, and then almost every -later stage — fact windows, supersession, ordering, deduplication, prompts, -summaries, filters, timelines — reasons on the *source's own date* instead. -The audit lists seventeen instances; D106 fixed one. This design closes the -class. +The engine resolves world-time once, at extraction, and then most later +stages — fact windows, supersession, ordering, deduplication, prompts, +summaries, filters, timelines — reason on the *source's own date* instead. +The audit lists eighteen instances; D106 fixed one. This design closes the +class without creating a second validity authority. -## 2. The three clocks +## 2. The three clocks and the two rules -| Clock | Where it lives | Meaning | Role under this design | +| Clock | Where it lives | Meaning | Role | | --- | --- | --- | --- | -| **said-on** | `claims.asserted_at` | when the source said it | provenance; an *upper bound* on when a described change had happened; never validity by itself | -| **is-about** | `claims.claim_valid_kind`, `claim_valid_from`, `claim_valid_until`, `claim_valid_precision` (D41) | the world-time the statement refers to, resolved from the wording against the said-on date | the source of every fact window, ordering decision, and temporal prompt line | -| **believed** | `ingested_at`, `invalidated_at` | when the system held the belief | belief-time only; never a substitute for world-time | - -`claim_valid_kind` is the *sort* of interval: `event_time` (something -happened — a win, a visit, a resignation), `effective_period` (a state held — -"was CEO"), `measurement_period` (a figure for a span — "FY2023 revenue"), -`proposition_validity` (the proposition held — "has lived in Prague since -2019"). `NULL` means the source tied nothing to a date. A resolved start with -`claim_valid_until IS NULL` is an **open** interval: its end is unbounded, -never the same instant as its start. - -Two rules follow everything below: - -- **Rule 1 — world-time comes from the is-about window.** A fact's validity, - the order in which facts supersede one another, whether two statements are - the same fact, what a model is shown, and what a summary prints all read the - is-about window first. -- **Rule 2 — a missing time stays missing.** When the is-about window is - unknown, the said-on date may serve only where it is logically an upper - bound (a change described by a source had happened by the time the source - said so), and it is recorded as such. Nothing is ever filled with `now()`, - and an undated statement never *wins* an ordering. - -## 3. Extraction (E2): emit every kind, keep precision honest - -- The extractor prompt defines and exemplifies **all four kinds** and the - **open** precision, one worked example each, in the same style as the - existing `event_time` examples: "has been CEO since 2019" → - `proposition_validity`, `open`, from 2019-01-01, until null; "FY2023 revenue - was $5M" → `measurement_period`, `year`, 2023; "worked at Acme from 2015 to - 2018" → `effective_period`, `year`, 2015–2018. The structured-output model - carries a field description for each. -- The document header shown to the extractor carries the **full source - timestamp**, not the date alone, so intraday expressions can resolve and two - same-day sources are distinguishable anchors. -- **Precision-derived ends are half-open.** A day-precision claim about - 2023-05-07 is stored as `[2023-05-07T00:00Z, 2023-05-08T00:00Z)`; a - year-precision claim about 2022 as `[2022-01-01, 2023-01-01)`. Comparisons - everywhere use `from < other.until AND other.from < until` (half-open - overlap), with a `NULL` until as +∞. `claim_valid_precision` remains the - honesty marker; the stored ends are what the precision means, not a point. - The existing DB checks still hold (`unknown` ⇒ both ends `NULL`). - -## 4. Fact windows: seeding, widening, closing - -### 4.1 Seeding at insert - -When E3 creates a relation or an observation from a claim, the fact's window -is seeded from that claim's is-about window **by kind**: - -| Triggering claim | `valid_from` | `valid_until` | `validity_basis` | +| **said-on** | `claims.asserted_at` | when the source said it | provenance, shown beside every statement a model or reader judges; never written into a fact window | +| **is-about** | `claims.claim_valid_kind` / `claim_valid_from` / `claim_valid_until` / `claim_valid_precision` (D41) | the world-time the statement refers to, resolved from the wording against the said-on date | the source of every fact window, every temporal succession decision, every dated label, and every temporal prompt line | +| **believed** | `ingested_at` / `invalidated_at` | when the system held the belief | belief-time only; never a substitute for world-time | + +`claim_valid_kind` says what sort of interval the is-about window is: +`event_time` (something happened), `effective_period` (a state held over a +span), `measurement_period` (a figure for a reporting span), +`proposition_validity` (the proposition held over a span). `NULL` means the +source tied nothing to a date. A resolved start with `claim_valid_until IS +NULL` is an **open** interval; `instant` is a point (`until = from`, enforced +by the schema). + +- **Rule 1 — world-time comes from the is-about window.** Fact windows, + temporal succession, dated labels, dedupe keys, and every temporal prompt + read the is-about window. The said-on clock is displayed as provenance and + is never a window boundary. +- **Rule 2 — a missing time stays missing.** An unknown is-about window + leaves a fact window `NULL` with basis `unknown`. Nothing is ever filled + with `now()` or with the said-on date, and a fact whose timing is unknown + never caps another fact and is never capped by one; it coexists, recorded. + +## 3. Two windows on every fact + +The audit's confusions come from asking one column to be two things. A fact +carries two windows with different authority: + +| Window | Columns | Authority | Changes when | | --- | --- | --- | --- | -| `effective_period`, `proposition_validity` (a state or proposition held over a span) | `claim_valid_from` | `claim_valid_until` (NULL when open) | `world_time` | -| `event_time` (something happened) | `claim_valid_from` | `claim_valid_until` (the event's own span; NULL when open) | `world_time` | -| `measurement_period` (a figure for a span) | `claim_valid_from` | `claim_valid_until` | `world_time` | -| no is-about window, said-on known | `asserted_at` | NULL | `said_on` | -| neither | NULL | NULL | `unknown` | +| **verdict window** | `valid_from` / `valid_until` (existing), plus `valid_from_basis` / `valid_until_basis` (new, `NOT NULL DEFAULT 'unknown'`; values `world_time`, `verdict`, `source_removed`, `unknown`) | the adjudicator's single recorded verdict (D3/D41/D43): "over which span do we believe this fact held" | seeded **once** at insert from the triggering claim (§4.1); afterwards only by a recorded adjudication verdict: a supersede cap (§4.4), an `extend_start` verdict (§4.3), a D55 retraction | +| **occurrence window** | `occurs_from` / `occurs_until` / `occurs_precision` (new, nullable) | **non-authoritative** derived metadata: the union of the D41 windows of the fact's current-testimony evidence — the same aggregate D106 already computes at block time | recomputed whenever evidence attaches or is withdrawn (the existing recount path); it never writes to the verdict window | -`validity_basis` is a new nullable column on `relations` and `observations` -(`world_time` / `said_on` / `unknown`) so a reader can tell a window the -source dated from one the engine inferred. This is not a second validity -authority (D41 §"why this is not…"): the window is still one value per fact, -recorded by the adjudicator, and only the adjudicator changes it. The claim -window *seeds* it, exactly as D41 anticipated. +Why two: a measurement ("FY2023 revenue was $5M") is *about* FY2023 but is +*believed* from the day it was reported onward and is never capped (D43's +no-cap rule); a past event ("won the final on 2022-11-05") is about one day +but stays a believed fact forever; a state ("was CEO 2015–2018") is about the +same span it is believed to have held. Only the last kind has one window. The +occurrence window is what "when did it happen / what period is this figure +for" queries, dated labels, timelines and is-about filters read; the verdict +window is what `valid_at` / `facts_as_of` and supersession read. D41's +boundary is kept exactly: the verdict is single-valued and recorded; the +occurrence window is evidence-derived and cannot mutate it. -The previous re-occurrence rule — a relation reopened after an earlier closed -spell starts no earlier than that spell's end — remains as a monotonic floor -on the seeded start. +## 4. Fact windows: seeding, matching, extending, closing -### 4.2 Widening on evidence +### 4.1 Seeding at insert (once) -When a claim collapses as evidence onto an existing fact, the fact's start may -move **earlier** to the evidence's is-about start (or said-on start under -basis `said_on`), never later, and never past a neighbouring capped slice. -This replaces the current pull to the earliest *said-on* time. The end is -never changed by evidence. - -### 4.3 Closing (supersession, retraction) - -A supersede verdict caps the predecessor at the **successor's world-time -start**, chosen in this order: - -1. the successor's is-about start (`world_time`); -2. else the successor's said-on date — by the time the source said the new - state held, the old one had ended, so the said-on date is an honest upper - bound (`said_on`); -3. else **no cap**: the pair coexists and the adjudication row records - `reason = "successor undated -> coexist"`. This is D43's fail-safe applied - to time: a duplicate, never an invented instant. - -`now()` is never a boundary. The same order applies to the D55 retraction -cap on relations (basis: the withdrawing version's source time, else no cap). - -### 4.4 One ordering comparator - -Predecessor/successor orientation — in relation supersession, in the -observation staging order, and in the D90 re-split — uses one shared key: - -``` -(is-about start, else said-on start, NULLS LAST; claim_id) -``` - -with **undated never winning**: when one side is undated and the other is not, -the undated side is neither predecessor nor successor for capping purposes — -it coexists, recorded. The two adjudicators stop disagreeing about undated -testimony because they share the comparator. - -### 4.5 The observation statement carries its date - -E3's normaliser receives the claim's is-about window with the claim. When the -window is known, the observation `statement` must carry the absolute date in -its own words ("Nate won a video game tournament on 2022-09-29 (said 'last -week')"), because that statement is what P1 embeds, profiles list, K pages -print, and readers see. The claim text itself stays source-faithful (D32); the -date joins the *fact's* wording, not the *claim's*. - -## 5. Adjudication and retrieval - -### 5.1 Every temporal judgement sees both clocks +| Triggering claim (`claim_valid_kind`) | `valid_from` | `valid_until` | bases | +| --- | --- | --- | --- | +| `effective_period`, `proposition_validity` (a state held over a span) | `claim_valid_from` | `claim_valid_until` — a bounded span becomes a **closed historical slice**; open → `NULL` | `world_time` / `world_time` (or `unknown` for an open end) | +| `event_time` (something happened) | `claim_valid_from` (the fact "it happened" holds from then on) | `NULL` — a past event is never capped; it can only be contradicted | `world_time` / `unknown` | +| `measurement_period` (a figure for a span) | `claim_valid_from` (the period start; believed from then on) | `NULL` — D43's no-cap rule | `world_time` / `unknown` | +| no is-about window | `NULL` | `NULL` | `unknown` / `unknown` | + +The occurrence window is set from the same claim at the same time. The +previous re-occurrence floor (a reopened spell starts no earlier than the +prior closed spell's end) applies **only** when the incoming occurrence start +is provably later than that end — a proven chronological successor; an older +spell discovered late is inserted as its own historical slice (§4.2). + +### 4.2 Matching evidence to bounded slices + +A fact's identity is its key plus its verdict window (relations enforce this +with a GiST `EXCLUDE` on `(subject, predicate, object) && tstzrange(valid_from, +valid_until)`; observations have no constraint and rely on the D106 rung). +Evidence-target selection is therefore interval-aware, not open-only: + +1. **Overlapping** — the incoming claim's occurrence window overlaps a live + slice's verdict window → the claim attaches as evidence; the slice's + verdict is untouched; its occurrence window is recomputed. +2. **Disjoint** — no live slice's verdict window overlaps → a **new slice** + (a distinct historical spell), which the `EXCLUDE` permits. +3. **Unknown timing** on the incoming claim → attach to the single open slice + if exactly one exists; otherwise attach to the most recent slice and + record `attachment = "unknown_timing"` on the evidence row. An undated + claim never creates a second unbounded slice (which the `EXCLUDE` would + reject for relations and which would be a silent duplicate for + observations). +4. **Unknown timing on the existing slice** (its verdict window is + `NULL`/`NULL`) and a dated incoming claim → attach; the slice stays + undated (no mechanical seeding after the fact). A later explicit verdict + may date it (§4.3). + +Overlap uses the precision-aware predicate of §5. + +### 4.3 Revising a verdict: explicit, recorded, deterministic + +A verdict window changes only through a recorded adjudication row with a +rationale, exactly as a cap does today: + +- **`extend_start`** — when attached evidence for a *state* fact + (`effective_period` / `proposition_validity`) carries an occurrence start + earlier than the verdict start, the adjudicator records `extend_start` + (rationale: the claim id and its window) and moves `valid_from` earlier — + never later, never earlier than a capped predecessor's `valid_until`, and + never touching `valid_until`. The rule is deterministic over the evidence + set (the earliest evidenced start wins), so the outcome does not depend on + arrival order (D88's independence) or on rebuild (D7), and it is a verdict + with a transcript row, not a reduction over claim columns (D41). It does + not apply to events or measurements, whose verdict start is the occurrence + start of the seeding claim and whose occurrence window already widens. +- **`date_undated`** — a slice with an unknown verdict window may be dated by + an explicit verdict when dated evidence attaches and the slice is the only + one for its key; recorded the same way. +- No verdict ever reopens a closed end (D41's retrospective guard); a + retrospective that contradicts a closed end is a `contradict` verdict and + both stand. + +### 4.4 Closing: temporal succession, separate from processing order + +D90's deterministic **processing** order — `(asserted_at NULLS LAST, +claim_id, statement)` for observation staging and the re-split — is +unchanged; it exists so replay is total and reproducible, and it decides +nothing about the world. + +**Temporal succession** is a separate relation used only for capping: +*B succeeds A* iff both are state facts with verdict starts of basis +`world_time` and `B.valid_from > A.valid_from`. A supersede verdict caps A +at `B.valid_from` (basis `verdict`). When either side's start is not +`world_time`, there is no succession: the pair **coexists** and the +adjudication row records `reason = "no world-time boundary -> coexist"`. +Relation supersession and observation supersession share this one definition +(today they disagree about undated testimony; the audit's 4.11). `now()` is +never a boundary. + +D55's retraction boundary — the withdrawing document version's source time — +is a *source action*, not a temporal inference, and keeps its own basis +`source_removed`; when that time is unknown, a retracted state is closed on +belief-time (`invalidated_at`) rather than capped at `now()`. + +**Residual, measured rather than assumed:** undated restatements of a +changing state coexist as duplicates. Identical wording still collapses +(§4.2 step 3 attaches it), so growth comes only from *differently worded, +undated* restatements; the lever is extraction coverage of the D41 kinds +(§6), and the count of `unknown`-basis slices per key is a reported metric. + +### 4.5 Statements stay canonical; dated labels are derived + +The observation `statement` remains the canonical source-faithful wording +(D43; unchanged on collapse and supersession). The human-facing **label** — +`obs_label`, `FactResult.label`, the profile line, the K fact-sheet cell — is +derived deterministically from `statement` plus the occurrence window and +precision ("Nate won a video game tournament last week — on 2022-09-29"), +and is refreshed whenever the occurrence window is recomputed. Nothing +source-specific is baked into identity, and two claims of different +precision that collapse yield one label from the union window at the coarser +precision. + +## 5. Precision without changing storage + +Claim windows stay stored as they are (closed intervals; `instant` as a +point; `open` as a `NULL` end; the schema `CHECK`s unchanged). What changes is +**comparison**: every overlap or containment test derives an *effective +exclusive end* from the stored end and the precision — + +| `claim_valid_precision` | effective end | +| --- | --- | +| `day` / `month` / `quarter` / `year` | `claim_valid_until + one unit` (a day-precision 2023-05-07 covers `[05-07 00:00, 05-08 00:00)`) | +| `instant` | the point itself (closed; `from = until`) | +| `open` | +∞ | +| `unknown` | no window (never matches a window predicate; disclosed as excluded) | + +— and the predicate is `a.from < b.effective_end AND b.from < a.effective_end`, +with points compared inclusively. This one function is used by +`claims_as_of`, D106's `_windows_disjoint`, §4.2 matching, the §7 dedupe key, +and the is-about filters, so a day-precision claim is found by an intraday +query and two same-day events from different wordings overlap. No +re-extraction, no migration, and no ordering between this and §4. + +Extraction itself improves in vocabulary, not shape: the prompt defines and +exemplifies **all four kinds** and `open` ("has been CEO since 2019" → +`proposition_validity`, `open`; "FY2023 revenue was $5M" → +`measurement_period`, `year`; "worked at Acme from 2015 to 2018" → +`effective_period`, `year`), the structured-output model describes each +field, and the document header shown to the extractor carries the **full +source timestamp** so intraday expressions resolve and same-day sources are +distinct anchors. + +## 6. Every temporal judgement sees both clocks The two-clock block D106 introduced for the observation verdict — ``` EXISTING: … said on: - is about: + is about: NEW: … said on: … is about: … ``` with its definitions — is the contract for **every** prompt that compares, -merges, ranks, or summarises facts: relation supersession, the T4 identity -candidate list (each salient fact with its window), the K prose writer's -claim bundle (each claim with said-on and is-about), and the benchmark answer -agent (which additionally names the envelope fields: `asserted_at`, -`claim_valid_*`, `validity.valid_from/valid_until`, `validity_basis`). - -### 5.2 Deduplication keys include the window - -Grouping identical testimony for a response (`testimony_context`, -`answer_context`) keys on `(normalised text, claim_valid_kind, -claim_valid_from, claim_valid_until)`; two claims with the same words about -different windows are two rows. When the window is unknown on both sides the -key falls back to text alone, as today. - -### 5.3 The fact-grain envelope names the clocks - -`Validity` gains `validity_basis` beside `valid_from` / `valid_until`, and the -evidence grain keeps all five D41 fields (already the case). A reader can -therefore always tell an inferred window from a source-dated one. - -### 5.4 Filters and timelines use world-time - -- P1 claim search accepts `valid_from` / `valid_until` filters (half-open - overlap on the D41 columns, using the existing partial index) beside the - said-on `asserted_from` / `asserted_to`; fact search accepts the same on the - fact window. -- `aggregate(form="timeline")` buckets facts by `valid_from` and emits an - explicit `undated` bucket; it never substitutes `ingested_at`. -- Entity profiles rank salient facts by evidence then by the fact window's - recency, never by `updated_at`; each salient fact carries its window. - -## 6. Consumer surfaces label honestly - -The K fact sheet's columns are `valid from` / `valid until` **only** for -`world_time` rows; rows with basis `said_on` print under `said on` and rows -with basis `unknown` print `—`. "Observation history" sorts by the fact -window under the same rule. Until the fact layer is re-seeded, existing sheets -must not print a said-on date under a world-time heading. - -## 7. Generations, rebuild, protocol - -- The extractor generation rolls (half-open ends, full-timestamp header, all - kinds); the normaliser and both adjudicator generations roll; the - `adjudicate_observations` flush component rolls again with the D106 - stop-drain-rebuild contract. -- The schema adds `validity_basis` on `relations` and `observations` (a - migration; head rolls). -- Existing stores are rebuilt (D7): fact windows are re-seeded from claim - rows, which already hold the D41 fields — no re-extraction is needed for - 4.1–4.4, only for §3's half-open ends and additional kinds. -- The LoCoMo protocol rolls once for the whole change (ingestion provenance - and the answer prompt both change); scores before and after are - directional. - -## 8. Alternatives considered - -- **Patch each finding where it sits.** Seventeen local fixes would leave the - next stage free to read the wrong clock again; the audit shows the pattern - recurs wherever a new consumer is written. One contract with one comparator - and one prompt block is smaller and stays true. -- **Make the claim window the fact window (a view, no seeding).** Rejected by - D41's own boundary: the fact window must be the adjudicator's single, - recorded, monotonic verdict, not a reduction over many-valued claim columns. - Seeding-then-adjudicating keeps that property. -- **Keep `now()` as the undated cap.** It makes histories depend on ingest - wall-clock and breaks rebuild stability (D7); coexisting with a recorded - reason is the D43 fail-safe and costs at most a duplicate. -- **A typed period/value column on facts.** D43 §4 rejected typed value - schemas; the window plus `validity_basis` is the minimum that makes as-of - queries true, and it is already the schema's shape. -- **Stripping relative wording from claim text.** Violates D32's - source-faithfulness; the absolute date belongs on the *fact's* statement - (§4.5), where it is the engine's wording. - -## 9. Non-goals (scope boundaries) +merges, ranks, or summarises facts: relation supersession (its evidence +laterals select the D41 columns), the T4 identity candidate list (each +salient fact with its occurrence window), the K prose writer's claim bundle +(each claim with said-on and is-about), and the benchmark answer agent, which +additionally names the envelope fields (`asserted_at`, `claim_valid_*`, +`validity.valid_from/valid_until` with bases, `occurrence`). + +## 7. Retrieval, envelopes, filters, consumers + +- **Deduplication.** Grouping identical testimony keys on `(normalised + text, claim_valid_kind, claim_valid_from, claim_valid_until, + claim_valid_precision)` when the window is known and on `(normalised + text, asserted_at)` when it is not, and every grouped row carries each + member's `asserted_at` and window, so no temporal distinction is lost + before a reader sees it. +- **Envelopes (D49, additive).** The fact-grain `Validity` gains + `valid_from_basis`, `valid_until_basis`, and `occurrence` + (`from`/`until`/`precision`); the same fields are added to `GraphEdge`'s + flat validity, to the K-layer fact model, and to the `memory_v1` fact + views. The affected assured operations roll their versions + (`fact_context@3`, `answer_context@3`; `testimony_context` is unchanged in + shape), the surface manifest hash and generated OpenAPI/SDK artifacts roll + with them. +- **Filters.** P1 claim search gains `valid_from` / `valid_until` (is-about, + §5 overlap) beside the said-on `asserted_from` / `asserted_to`; P1 fact + search's existing `FactTime` selector gains an `occurs` mode over the + occurrence window beside its verdict-window modes. +- **Timeline.** `aggregate(form="timeline")` buckets facts by occurrence + start, then verdict start, and emits an explicit `undated` bucket; it never + substitutes `ingested_at`. +- **Profiles.** Salient facts rank by evidence, then by occurrence recency; + never by `updated_at`; each carries its occurrence window into the T4 + prompt. +- **Consumers.** The K fact sheet prints `valid from` / `valid until` from + the verdict window only where the basis is `world_time` or `verdict`, + prints `about` from the occurrence window, and `—` for `unknown`; + "Observation history" sorts by occurrence start. The consumption skill + states the three clocks and defines `claims_as_of` over source world-time + (D41), not system time. + +## 8. Generations, rebuild, protocol + +- Schema: one migration adds the four basis/occurrence columns to + `relations` and `observations`; the schema head rolls. +- Generations: the extractor (kinds, header), the normaliser (seeding), both + adjudicators (succession, `extend_start`, labels), the + `adjudicate_observations` flush component (with the D106 + stop-drain-rebuild contract), P1 labels, K page generation. +- Rebuild (D7): existing stores are re-seeded from the claim rows they hold + (§4.1 needs only `claim_valid_*`, already present); only §5's added kinds + benefit from re-extraction. +- Protocol: each landed work package that changes ingestion provenance or + the assured surface rolls the LoCoMo protocol; packages released together + roll it once. Scores across a roll are directional. + +## 9. Alternatives considered (including the withdrawn first revision) + +- **Seed `valid_from` from the said-on date when the window is unknown** + (first revision). Withdrawn: it writes provenance into a world-time column + and contradicts Rule 2; a source's modification date is not evidence that + a state began then. +- **Seed `valid_until` from a measurement's or event's claim end.** Withdrawn: + D43 says a fixed-period figure is never capped and a finite end would drop + it from current facts and profiles; the period belongs to the occurrence + window, which is why there are two. +- **Widen the verdict start mechanically on evidence.** Withdrawn: a + reduction over claim columns (D41). Replaced by the recorded, + deterministic `extend_start` verdict. +- **Store all precisions half-open.** Withdrawn: `instant` requires + `until = from` and would become empty; comparison-time effective ends + achieve the same result with no migration or re-extraction. +- **One coalesced ordering key for processing and succession.** Withdrawn: + D90 needs a total processing order; succession needs world-time bounds; + they are different questions. +- **Cap at the successor's said-on date as an upper bound.** Withdrawn: a + retrospective's publication date proves nothing about when the described + change happened. +- **Bake the resolved date into the observation statement.** Withdrawn: + makes identity depend on which claim arrived first (D43); labels are + derived instead. +- **Seventeen local patches.** The pattern recurs in every new consumer; one + contract with one overlap function, one succession rule, and one prompt + block is smaller and stays true. +- **Keep `now()` as the undated cap.** Breaks rebuild stability (D7). + +## 10. Non-goals (scope boundaries) - Recurrence ("every Q4") and anchor-relative time ("as of the merger") - remain outside the single-interval model, as D41 records. -- Belief-time (`ingested_at`/`invalidated_at`) semantics are unchanged. -- No new time authority: the claim window stays immutable evidence; the fact - window stays the one adjudicated home. + remain outside the single-interval model (D41). +- Belief-time semantics are unchanged. +- No new authority: the claim window stays immutable evidence; the verdict + window stays the one adjudicated home; the occurrence window is derived + metadata and is documented as such wherever it is shown. ## References Decisions: D107 (this design), D41, D3, D4, D43, D88, D90, D106, D7, D12, -D55. Analysis: `plan/analysis/time_handling_audit.md`. Sequencing: +D55, D49. Analysis: `plan/analysis/time_handling_audit.md`. Sequencing: `plan/plans/temporal_clocks.md`. Affected designs carry a D107 amendment banner: `e2_e3_claims_relations_design.md`, `observations_design.md`, `registries_design.md`, `retrieval_design.md`, `k_layers_design.md`, diff --git a/plan/plans/temporal_clocks.md b/plan/plans/temporal_clocks.md index ebbd42f6f..379d63ad9 100644 --- a/plan/plans/temporal_clocks.md +++ b/plan/plans/temporal_clocks.md @@ -8,20 +8,21 @@ Order follows answer impact and dependency: as-of correctness first (it makes the documented `valid_at` promise true), then the prompts that decide -supersession and identity, then retrieval deduplication, then extraction -precision and vocabulary. Each package rolls the generations it touches and -lands with tests that assert the *clock*, not only the outcome. +supersession and identity, then retrieval keys and envelopes, then extraction +vocabulary and consumer labels. Each package rolls the generations it touches +and lands with tests that assert the *clock*, not only the outcome. -| WP | Scope | Audit findings closed | Generations rolled | Acceptance | +| WP | Scope | Audit findings closed | Generations / surfaces rolled | Acceptance | | --- | --- | --- | --- | --- | -| **WP-T.1 — fact windows and closing** | seed relation/observation windows from the claim's is-about window by kind; add `validity_basis`; widen only earlier; cap at the successor's world-time start, else said-on as upper bound, else coexist — never `now()`; one shared ordering comparator with undated-never-wins; apply to D55 retraction | 4.2, 4.4, 4.10, 4.11, 4.17 | normaliser, both adjudicators, obs flush component; schema head (migration) | `lookup_relations(valid_at=2010)` returns the 2010 employer on a seeded corpus; the same ingest replayed on different days yields byte-identical windows; the two adjudicators orient one undated/dated pair identically; no `now()` appears in any cap boundary | -| **WP-T.2 — two clocks in every temporal prompt** | relation supersession prompt and evidence laterals select and show `said on` / `is about`; T4 candidate salient facts carry windows and rank by evidence then window recency; K writer claims carry `asserted_at` + D41 fields; answer-agent prompt names the envelope fields | 4.3, 4.6, 4.8, 4.16 | relation adjudicator, resolver, K writer; LoCoMo protocol | a 2024 retrospective spell does not supersede a 2023 current fact in the supersession proofs; T4 sees windows in its candidate JSON; the answer prompt fixture contains the two-clock paragraph | -| **WP-T.3 — retrieval keys and envelopes** | testimony grouping keys include the D41 window; `Validity` gains `validity_basis`; P1 gains `valid_from`/`valid_until` filters; `aggregate(form="timeline")` buckets by `valid_from` with an `undated` bucket | 4.1, 4.9, 4.12 | query-space manifest / surface manifest hash; LoCoMo protocol | identical text on two dates is two evidence rows in `testimony_context`; a 2015–2020 archive imported today produces 2015–2020 timeline buckets | -| **WP-T.4 — extraction precision and vocabulary** | half-open precision-derived ends; full-timestamp header; all four kinds and `open` taught with examples and field descriptions; E3 statement carries the absolute date when known | 4.5, 4.13, 4.14, 4.15 | extractor, normaliser; LoCoMo protocol | `claims_as_of` over an intraday window finds a day-precision claim; "has been CEO since 2019" extracts as `proposition_validity`/`open`; an observation minted from "last week" carries the resolved date in its statement | -| **WP-T.5 — consumer labels** | K fact sheet columns by `validity_basis`; observation history sorted by fact window | 4.7 | K page generation | a sheet never prints a said-on date under a world-time heading | +| **WP-T.0 — precision-aware comparison** | one shared overlap function with precision-derived effective ends (design §5), used by `claims_as_of`, D106's disjointness test, and later packages; no storage change | 4.13 | none (pure comparison) | an intraday `claims_as_of` window finds a day-precision claim; two same-day events from different wordings overlap; `instant` still matches its own point | +| **WP-T.1 — two windows, seeding, matching, closing** | migration for `valid_from_basis` / `valid_until_basis` / `occurs_*`; seed verdict windows once by kind; interval-aware evidence-target matching for bounded slices (incl. the `EXCLUDE` cases); recorded `extend_start` / `date_undated` verdicts; temporal succession separate from D90 processing order; caps only at world-time starts, else coexist; D55 keeps `source_removed`; no `now()` anywhere; occurrence window recomputed on recount | 4.2, 4.4, 4.10, 4.11, 4.17 | normaliser, both adjudicators, obs flush component (D106 stop-drain-rebuild); schema head | `lookup_relations(valid_at=2010)` returns the 2010 employer and excludes the 2024 one on a seeded corpus; the same ingest replayed on different days yields byte-identical windows; both adjudicators orient one undated/dated pair identically (coexist); a late-discovered older spell inserts as its own slice; no cap boundary equals a wall-clock instant | +| **WP-T.2 — two clocks in every temporal prompt** | relation supersession prompt and laterals show `said on` / `is about`; T4 candidate salient facts carry occurrence windows and rank by evidence then occurrence recency; K writer claims carry `asserted_at` + D41 fields; answer-agent prompt names the envelope fields | 4.3, 4.6, 4.8, 4.16 | relation adjudicator, resolver, K writer; LoCoMo protocol | a 2024 retrospective spell does not supersede a 2023 current fact in the supersession proofs; T4 sees windows in its candidate JSON; the answer prompt fixture contains the two-clock paragraph | +| **WP-T.3 — retrieval keys, envelopes, skill** | testimony grouping keys include the full D41 tuple (or `asserted_at` when unknown) and grouped rows carry every member's times; `Validity`, `GraphEdge`, the K fact model and `memory_v1` fact views gain bases + occurrence; `fact_context@3` / `answer_context@3`; P1 is-about claim filters and the `occurs` fact mode; timeline by occurrence with an `undated` bucket; consumption skill teaches the three clocks and defines `claims_as_of` over world-time | 4.1, 4.9, 4.12, 4.18 | assured operation versions, surface manifest hash, generated OpenAPI/SDK, query-space manifest; LoCoMo protocol | identical text on two dates is two evidence rows in `testimony_context`; a 2015–2020 archive imported today produces 2015–2020 timeline buckets; the regenerated skill text contains the corrected `claims_as_of` definition | +| **WP-T.4 — extraction vocabulary and header** | all four D41 kinds and `open` taught with examples and field descriptions; full-timestamp header | 4.14, 4.15 | extractor; LoCoMo protocol | "has been CEO since 2019" extracts as `proposition_validity` / `open`; a same-day second session resolves "this morning" to a different instant than the first | +| **WP-T.5 — dated labels and consumer surfaces** | labels derived from statement + occurrence window (obs label, `FactResult.label`, profile lines); K fact sheet columns by basis with an `about` column; observation history by occurrence start | 4.5, 4.7 | P1 labels, K page generation | an observation minted from "last week" carries the resolved date in its label but not its statement; a sheet never prints a said-on date under a world-time heading | -Dependencies: T.2 and T.3 depend on T.1's `validity_basis` column for the -envelope and labels; T.4 is independent of T.1–T.3 and can run in parallel; -T.5 depends on T.1. Every package updates the same-PR documentation the +Dependencies: T.0 first (T.1's matching and T.3's dedupe use it). T.2, T.3 +and T.5 depend on T.1's columns. T.4 is independent of all of them and may +run in parallel. Every package updates the same-PR documentation the CLAUDE.md rule requires (concepts and API pages for `valid_at`, the benchmark README when the protocol rolls) and the project-status page. From 436244d81fdc741c1859c9659ef34617daf89b61 Mon Sep 17 00:00:00 2001 From: Jiri Puc Date: Thu, 3 Sep 2026 15:03:27 +0200 Subject: [PATCH 3/8] design: temporal kind, occurrence-window identity, review-only revision, canonical bounds (D107 round 2) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codex's second review showed revision two still broke on its own terms: matching every fact by verdict-window overlap makes an occurrence's open window overlap every later occurrence (recreating the D106 collapse and colliding with the relations EXCLUDE); an automatic extend_start is min() over claim columns (D41); "+ one unit" over-expands normalised year ends and fact windows had no precision; the D90 re-split compared asserted_at to a world-time cap; succession between dated states only lost D106's dated-resignation-ends-undated-state case; and "current" was undefined for finite future ends. Give every fact a temporal kind (state / occurrence / undated): states are identified by verdict-window overlap under the existing EXCLUDE restricted to states; occurrences by occurrence-window overlap under their own exclusion, so recurring events are distinct rows on both planes; undated rows collapse by key (relations) or wording (observations). Seed once from the D90-first claim (recorded), never revise automatically — discrepancies become review items. Store fact windows canonical half-open from one canonical_bounds function (year 2022 -> [2022-01-01, 2023-01-01); instant a non-empty point) and canonicalise claim comparisons through the same function; claim storage unchanged. Succession caps at any world-time instant the successor supplies, including an ending occurrence. Re-split by occurrence start. One evaluated-at current predicate with an expiry sweep. Enumerate the shared-envelope version rolls (resolve_entity@2, testimony_context@2, fact_context@3, answer_context@3) and the stop-drain-migrate-rebuild-readiness cutover. Add the open-query confirmation surface as audit 4.19; narrow 4.5 and 4.15; banner the D90 design. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016p9xB9T7VYREuVmohDPKjR --- decisions.md | 176 +++--- plan/analysis/time_handling_audit.md | 25 +- plan/designs/e2_e3_claims_relations_design.md | 15 +- .../e3_entity_obs_flush_fanout_design.md | 9 + plan/designs/observations_design.md | 28 +- plan/designs/retrieval_design.md | 16 +- plan/designs/temporal_clocks_design.md | 578 ++++++++++-------- plan/plans/temporal_clocks.md | 34 +- 8 files changed, 518 insertions(+), 363 deletions(-) diff --git a/decisions.md b/decisions.md index 55a7d872d..50d6605ef 100644 --- a/decisions.md +++ b/decisions.md @@ -4995,62 +4995,78 @@ retrieval, D100/D102 identity, and D104/D105 answer-prompt contracts. **Decision (2026-09-03).** Every stage that reasons about *when* a fact held reads the claim's resolved D41 window (what the statement **is about**) and treats the source's own date (when it was **said**) as provenance shown -beside it — never as a window boundary. A missing time stays missing. -Concretely: - -1. A fact carries **two windows**: the adjudicated **verdict window** - (`valid_from`/`valid_until`, now with a basis per endpoint — - `world_time`, `verdict`, `source_removed`, `unknown`) and a derived, - non-authoritative **occurrence window** (`occurs_from`/`occurs_until`/ - `occurs_precision`: the union of its evidence's D41 windows). The verdict - is seeded **once** from the triggering claim by kind — a state's span - becomes its verdict window (a bounded past span is a closed historical - slice); an event or a measurement is believed from its occurrence start - onward and is never capped (D43's no-cap rule, extended to events); an - unknown window stays `NULL`/`unknown`. The said-on date is never written - into a window. -2. Evidence attaches to the slice whose verdict window overlaps its - occurrence window; a disjoint window is a new historical slice; undated - evidence attaches to the single open slice, else the most recent, and - never creates a second unbounded slice. Attaching evidence never changes - a verdict; it recomputes the occurrence window. -3. A verdict changes only by a recorded adjudication: a supersede cap, a - deterministic `extend_start` (a state's start moves earlier to the - earliest evidenced start, never later, never past a capped predecessor, - never touching the end), `date_undated`, or a D55 retraction. No verdict - reopens a closed end. -4. **Temporal succession** is separate from D90's processing order: B - succeeds A only when both are states with `world_time` starts and B's is - later; a cap lands at B's start with basis `verdict`. Otherwise the pair - coexists, recorded. `now()` is never a boundary; D55 keeps its - source-removal basis and closes on belief-time when that is unknown. -5. Precision is honoured at **comparison time** — one overlap function - derives each window's effective exclusive end from its precision (a day - covers the whole day; `instant` stays a point; `open` is +∞) — with - storage and schema `CHECK`s unchanged. +beside it and as the processing order — never as a window boundary. A +missing time stays missing. Concretely: + +1. Every fact carries a **temporal kind** seeded from its claim's D41 kind — + `state` (a span that held), `occurrence` (something happened, or a figure + for a period), `undated` — and **two windows**: the adjudicated **verdict + window** (`valid_from`/`valid_until`, with a basis per endpoint — + `world_time`, `verdict`, `source_removed`, `unknown` — and the recorded + `seed_claim_id`) and a derived, non-authoritative **occurrence window** + (`occurs_from`/`occurs_until`/`occurs_precision`: the union of its + evidence's canonical D41 windows). A state's verdict window is its span + and its identity; an occurrence is believed from its occurrence start + onward, never capped (D43's no-cap rule extended to events), and is + identified by its occurrence window, so a January and an October visit + are two facts (D106 at the fact layer); an unknown window stays + `NULL`/`unknown`. The said-on date is never written into a window. +2. The verdict is seeded **once** from the seed claim — the first claim in + D90 processing order, exactly as a fresh ingest would — and is never + revised automatically. Attaching evidence recomputes the occurrence window + only. A discrepancy between the two (evidence earlier than the verdict + start; dated evidence on an undated slice) is surfaced as a review item; + only a recorded review verdict, a supersede cap, or a D55 retraction + changes a verdict, and none reopens a closed end (D41). +3. **Temporal succession** is separate from D90's processing order, which is + unchanged: a state is capped only at a world-time instant supplied by its + successor — a successor state's verdict start or an ending occurrence's + start (D106's dated resignation may still end an undated "is CEO" state) + — else the pair coexists, recorded. `now()` is never a boundary; D55 keeps + its source-removal basis and closes on belief-time when unknown. The D90 + late-arrival re-split decides eligibility by the evidence's occurrence + start against the world-time cap, not by `asserted_at`. +4. Precision is honoured through one **canonical-bounds** function that + turns a stored claim window into a half-open interval by its precision (a + year stored 2022-01-01…12-31 is `[2022-01-01, 2023-01-01)`; an `instant` + is a non-empty point; `open` is unbounded). Fact windows are **stored** + canonical at seeding, so every fact predicate and the relations + exclusion constraints read consistent bounds; claim comparisons + canonicalise at query time; claim storage and its `CHECK`s are unchanged. +5. "Current" is one predicate evaluated at an explicit instant + (`invalidated_at IS NULL AND (valid_until IS NULL OR valid_until > E)`), + used by every consumer that today tests `valid_until IS NULL`; cached + profiles and K pages carry their earliest future end in their input hash + and are refreshed by an expiry sweep when it passes. 6. Every prompt that compares, merges, ranks, or summarises facts shows the D106 two-clock block (`said on` / `is about`, defined): relation supersession, T4 identity candidates, the K prose writer, the benchmark answer agent. 7. Testimony deduplication keys on the full D41 tuple (or `asserted_at` when - unknown) and grouped rows keep every member's times; the fact-grain - envelope, `GraphEdge`, the K fact model and the `memory_v1` fact views - gain bases and occurrence (additive, D49; `fact_context@3`, - `answer_context@3`); P1 gains is-about claim filters and an `occurs` fact - mode; the timeline aggregate buckets by occurrence with an explicit + unknown) and grouped rows list every member's times; the fact-grain + envelope, `GraphEdge`, the K fact model, the `memory_v1` fact views and + the open-query confirmation surface gain bases, kind and occurrence + (additive, D49) — and because the envelope schema is shared, + `resolve_entity@2`, `testimony_context@2`, `fact_context@3` and + `answer_context@3` roll; P1 gains is-about claim filters and an `occurs` + fact mode; the timeline aggregate buckets by occurrence with an explicit `undated` bucket; profiles rank by evidence then occurrence recency. 8. Extraction teaches all four D41 kinds and `open` with examples and shows the extractor the full source timestamp. Statements stay canonical (D43); dated labels are derived from the occurrence window. 9. Consumer surfaces print a date under a world-time heading only for - `world_time`/`verdict` bases and the consumption skill defines + `world_time`/`verdict` bases, and the consumption skill defines `claims_as_of` over source world-time (D41), not system time. +10. Cutover is stop → drain → migrate → rebuild the fact layer by replay in + D90 order → readiness reports the fact-layer generation and refuses to + serve an older one; a store never mixes pre- and post-D107 fact + semantics. **Context.** D106 fixed the observation adjudicator merging "won a tournament last week" across a nine-month gap because it never read the claims' resolved windows. The follow-up audit (`plan/analysis/time_handling_audit.md`, revision `02b79904`) found the same -confusion in seventeen more places: relations' `valid_from` is never seeded, +confusion in eighteen more places: relations' `valid_from` is never seeded, so a `valid_at` lookup cannot exclude a fact before its true beginning; the relation supersession prompt asks the model about "the same period" while showing only document dates; undated supersessions cap at the ingest @@ -5060,54 +5076,64 @@ dedupes identical text across dates exactly as the adjudicator did before D106; the K fact sheet sorts by a said-on date it does not show; the timeline aggregate falls back to ingest year; the answer agent is told to "use timestamps" without being told which; day-precision windows are compared as -zero-width points; and the consumption skill defines `claims_as_of` as a -system-time query. The docs (`/docs/concepts`, `fact_context`'s description) -promise world-time semantics the code does not keep. - -An independent Codex design review of the first revision withdrew four of -its mechanisms — said-on seeding, mechanical evidence widening, universal -half-open storage, and a merged ordering key — as violating Rule 2, D41, -the `instant` schema contract, and D90 respectively; the two-window model -above replaces them. +zero-width points; the consumption skill and the open-query confirmation +surface respectively misdefine and truncate the clocks. The docs +(`/docs/concepts`, `fact_context`'s description) promise world-time +semantics the code does not keep. + +Two independent Codex design reviews shaped the mechanics. The first +withdrew said-on seeding, mechanical evidence widening, universal half-open +storage, and a merged ordering key. The second showed that matching every +fact by verdict-window overlap recreates the D106 collapse for recurring +occurrences and collides with the relations `EXCLUDE`, that an automatic +`extend_start` is still the D41-forbidden reduction, that "+ one unit" +over-expands normalised ends, that the D90 re-split crossed clocks, and that +succession restricted to dated states lost D106's ending-event case — hence +the temporal kind, occurrence-window identity, review-only revision, +canonical bounds, and the succession and re-split rules above. **Consequences.** `valid_at` / `facts_as_of` become true on both fact planes; -histories are rebuild-stable (D7) because no boundary depends on ingest -time; the two fact planes agree on undated testimony; recurring events and -retrospectives order by the world, not by who spoke last; readers, profiles -and compiled pages see resolved dates as labels while statements keep source -wording. Costs: one migration (four columns on each fact table), generation -rolls for the extractor, normaliser, both adjudicators and the flush -component, assured-operation version rolls, a rebuild of existing stores -(re-seeding reads the claim rows already present), and LoCoMo protocol -rolls per landed package. Undated, differently worded restatements of a -changing state now coexist as duplicates instead of capping at `now()`; the -count of `unknown`-basis slices per key is a reported metric and the lever +recurring occurrences stay distinct facts on both planes; histories are +rebuild-stable (D7) because no boundary depends on ingest time and the seed +is the replay-first claim; the two fact planes agree on undated testimony; +readers, profiles and compiled pages see resolved dates as labels while +statements keep source wording. Costs: one migration (seven columns and +three constraints across the two fact tables), generation rolls for the +extractor, normaliser, both adjudicators and the flush component, four +assured-operation version rolls, a fact-layer rebuild of existing stores +(re-seeding reads the claim rows already present), an expiry sweep for +finite future ends, and LoCoMo protocol rolls per landed package. Undated, +differently worded restatements of a changing state coexist instead of +capping at `now()`; their count per key is a reported metric and the lever is extraction coverage of the D41 kinds. **Rejected.** Seeding windows from the said-on date (provenance is not validity); seeding a measurement's or event's end from its claim (D43 -no-cap; the period belongs to the occurrence window); mechanical widening of -the verdict on evidence (a reduction over claim columns, D41); half-open -storage (empties `instant`); one coalesced key for processing and succession -(D90 needs a total processing order); capping at a retrospective's said-on -date; baking the resolved date into the observation statement (identity would -depend on arrival order, D43); seventeen local patches (the pattern recurs -in every new consumer); keeping `now()` as the undated cap (D7). +no-cap); matching every fact by verdict-window overlap (recreates D106 for +occurrences; collides with the `EXCLUDE`); automatic earliest-evidence start +revision (D41 reduction); half-open claim storage (empties `instant`) and +"+ one unit" effective ends (over-expand normalised bounds); one coalesced +key for processing and succession (D90); succession only between dated +states (loses D106's ending event); capping at a retrospective's said-on +date; baking the resolved date into the observation statement (D43 +identity); nineteen local patches; keeping `now()` as the undated cap (D7). **Design.** `plan/designs/temporal_clocks_design.md`; amendment banners on `e2_e3_claims_relations_design.md`, `observations_design.md`, `registries_design.md`, `retrieval_design.md`, `k_layers_design.md`, -`locomo_benchmark_design.md`. +`locomo_benchmark_design.md`, `e3_entity_obs_flush_fanout_design.md`. **Analysis.** `plan/analysis/time_handling_audit.md`. **Sequencing.** `plan/plans/temporal_clocks.md`. **Amends.** D41's consequences become binding mechanics (claim windows seed -fact verdicts once; explicit recorded verdicts revise them; the retrospective -guard holds); the observations design §3 (cap boundary, succession, the -no-cap rule extended to events); D88/D90 (processing order unchanged; -succession now needs world-time bounds); D106 (its two-clock prompt block -becomes the engine-wide contract; its `valid_from` seeding gap is closed); -D55 (unknown source time closes on belief-time, never `now()`). Preserves D3, -D6, D32, D43's untyped statement, D49 (additive fields only), D98, D100–D105. +fact verdicts once; the retrospective guard holds; revisions are review +verdicts); the observations design §3 (matching by kind, the cap boundary, +succession, the no-cap rule extended to events); D88/D90 (processing order +unchanged; the §5.5.3 re-split decides by occurrence start against a +world-time cap); D106 (its two-clock prompt block becomes the engine-wide +contract; its ending-event supersession is preserved; its `valid_from` +seeding gap is closed); D55 (unknown source time closes on belief-time, never +`now()`); D49 (additive envelope fields; four operation versions roll). +Preserves D3, D6, D24, D32, D43's untyped statement, D98, D100–D105. diff --git a/plan/analysis/time_handling_audit.md b/plan/analysis/time_handling_audit.md index 17410dd8e..ac42f1bff 100644 --- a/plan/analysis/time_handling_audit.md +++ b/plan/analysis/time_handling_audit.md @@ -7,8 +7,9 @@ binding contract is `plan/designs/temporal_clocks_design.md`. **Revision audited:** `02b79904` (the merge of D106). Line numbers below are for that revision; function and statement names are the stable anchors. -Findings 4.2, 4.6, 4.12, 4.13 and 4.14 were narrowed after an independent -Codex review verified each against the code; 4.18 was added from that review. +Findings 4.2, 4.5, 4.6, 4.12, 4.13, 4.14 and 4.15 were narrowed after two +independent Codex reviews verified each against the code; 4.18 and 4.19 were +added from those reviews. ## 1. Question @@ -135,7 +136,7 @@ reports Alice still at Acme the day before an undated CV was ingested, and the same ingest replayed on another day yields a different history — the value is not rebuild-stable (D7). -### 4.5 E3 never sees the resolved window, so the fact statement keeps "last week" forever (P1, P6) +### 4.5 Normalisation and label construction do not propagate the resolved window, so the fact statement keeps "last week" forever (P1, P6) `src/rememberstack/workers/e3.py:98-120` (normaliser prompt: `CLAIM (attributed=…): {claim_text}`; no valid-time fields at `:436-441`). E2's prompt @@ -244,8 +245,10 @@ pairs the rung governs. `workers/e2.py:899-906`: `date {modified.date().isoformat()}` while `asserted_at` keeps the full timestamp (`:599`). LoCoMo sessions carry wall -times; "this morning" cannot resolve, and two same-day sessions are the same -anchor. +times; offset expressions ("three hours ago") cannot resolve to an instant, +and two same-day sessions are the same anchor. (Part-of-day expressions such +as "this morning" have no precision in the D41 enum and are an expressivity +boundary, not an anchor defect.) ### 4.16 Entity profiles and the T4 candidate list carry no dates and rank by row-touch time (P4, P5) @@ -279,6 +282,16 @@ is-about distinction. Under D60 the skill is part of the complete agent-facing surface, so agents are taught the wrong clock in the one place meant to teach clocks. +### 4.19 The open-query confirmation surface truncates the clocks (P1, P4) + +`src/rememberstack/surfaces/query_sandbox/nomination.py:323-327` +(`_CONFIRM_SQL["claims"]`) confirms claim search rows with `asserted_at`, +`claim_valid_from`, `claim_valid_until` — and omits `claim_valid_precision` +and `claim_valid_kind`; the fact-row confirmation carries no verdict or +occurrence time at all. An agent on this public path cannot tell a point from +a coarse period, an open interval, or an unknown, even after is-about filters +exist. + ## 5. Checked and sound Absence of a finding above is a result, not an omission: @@ -314,7 +327,7 @@ Absence of a finding above is a result, not an omission: every D106 coercion is recorded, so all of the above is diagnosable from the audit tables without a rerun. -## 6. Why this is one decision, not eighteen fixes +## 6. Why this is one decision, not nineteen fixes Every finding is the same confusion: the engine resolves world-time once, at extraction, and then reasons on the source's date. The fix that closes all of diff --git a/plan/designs/e2_e3_claims_relations_design.md b/plan/designs/e2_e3_claims_relations_design.md index 537a2a875..d8fac5ea8 100644 --- a/plan/designs/e2_e3_claims_relations_design.md +++ b/plan/designs/e2_e3_claims_relations_design.md @@ -1,13 +1,14 @@ # E2 / E3 — Claim Extraction and Relation Normalization (Design) > **Binding D107 amendment (2026-09-03).** E2 teaches all four D41 kinds and -> `open` with examples and sees the full source timestamp in the header; -> storage of windows is unchanged and precision is honoured at comparison -> time. E3 receives each claim's resolved window and seeds a new relation's -> or observation's verdict window from it once, by kind, with a basis per -> endpoint, and sets the derived occurrence window; statements stay -> source-faithful and canonical, and dated labels are derived from the -> occurrence window. Contract: `temporal_clocks_design.md` §3–§5. +> `open` with examples and sees the full source timestamp in the header; claim +> storage is unchanged and comparisons use canonical bounds. E3 seeds each new +> fact's temporal kind and verdict window once from the D90-first claim's +> canonical D41 window (bases per endpoint, seed claim recorded), matches +> later claims by kind — states by verdict-window overlap, occurrences by +> occurrence-window overlap under a separate exclusion — and never revises a +> verdict automatically; statements stay canonical and dated labels are +> derived. Contract: `temporal_clocks_design.md` §3–§5. How the system turns a chunk of source text into **claims** (atomic, standalone, verifiable assertions) and then into **relations** (the distinct facts those claims are evidence for). This is diff --git a/plan/designs/e3_entity_obs_flush_fanout_design.md b/plan/designs/e3_entity_obs_flush_fanout_design.md index 4f11ae00c..1f9f27e01 100644 --- a/plan/designs/e3_entity_obs_flush_fanout_design.md +++ b/plan/designs/e3_entity_obs_flush_fanout_design.md @@ -1,5 +1,14 @@ # Design: entity-grain observation flush fan-out +> **Binding D107 amendment (2026-09-03).** The total processing order of §5.5 +> (`asserted_at NULLS LAST, claim_id, statement`) is unchanged and remains a +> work order only. The §5.5.3 late-arrival re-split decides eligibility by the +> attached state claim's canonical occurrence start relative to the +> world-time cap `T`, not by `asserted_at`; undated attached evidence is never +> re-split. The staggered acceptance case gains a variant with said-on and +> is-about orders reversed whose final slices follow the world. Contract: +> `temporal_clocks_design.md` §4.5. + **Status:** revised through dual design r3 — Claude APPROVE_WITH_NITS (r3+r4); Codex r3 ordering gap closed in this revision — binding once landed on `main` **Date:** 2026-08-12 diff --git a/plan/designs/observations_design.md b/plan/designs/observations_design.md index 16ebbb901..bb9b42072 100644 --- a/plan/designs/observations_design.md +++ b/plan/designs/observations_design.md @@ -1,17 +1,21 @@ # The Observation Layer — Non-Graph Facts with Temporal Validity (Design) -> **Binding D107 amendment (2026-09-03).** An observation carries two windows: -> the adjudicated verdict window (`valid_from`/`valid_until` with a basis per -> endpoint), seeded once from the triggering claim's D41 window by kind — a -> state's span; an event or measurement believed from its occurrence start -> onward and never capped; `NULL`/`unknown` when the source tied nothing to a -> date — and a derived occurrence window (`occurs_*`) that widens as evidence -> attaches. The said-on date is never a window boundary. A verdict changes only -> by a recorded adjudication (a cap at a successor's `world_time` start, a -> deterministic `extend_start`, D55); an undated pair coexists, never caps and -> never `now()`. D90's staging order is unchanged; temporal succession is the -> separate rule of `temporal_clocks_design.md` §4.4. The D106 rung is unchanged -> and uses the precision-aware overlap of §5. +> **Binding D107 amendment (2026-09-03).** An observation carries a temporal +> kind (`state` / `occurrence` / `undated`) and two windows: the adjudicated +> verdict window (`valid_from`/`valid_until` with a basis per endpoint and the +> recorded seed claim), seeded once from the D90-first claim's canonical D41 +> window — a state's span; an occurrence believed from its start onward and +> never capped; `NULL`/`unknown` when undated — and a derived occurrence +> window (`occurs_*`) that widens as evidence attaches. Occurrences are +> identified by occurrence-window overlap, so recurring events stay distinct +> rows; the D106 rung is unchanged and compares canonical bounds. The said-on +> date is never a boundary. No verdict changes automatically (discrepancies +> become review items); a state is capped only at a world-time instant its +> successor supplies — a successor state's start or an ending occurrence's +> start, so a dated resignation still ends an undated "is CEO" state — else +> the pair coexists, never `now()`. D90's staging order is unchanged; its +> re-split decides by occurrence start. Contract: `temporal_clocks_design.md` +> §3–§5. > **Binding D98 amendment (2026-08-27).** Relations are the only fact kind > mapped as live graph edges over PostgreSQL views. Observations remain diff --git a/plan/designs/retrieval_design.md b/plan/designs/retrieval_design.md index f89a85232..9f3a10a5c 100644 --- a/plan/designs/retrieval_design.md +++ b/plan/designs/retrieval_design.md @@ -1,12 +1,16 @@ # Retrieval Design — the Query Machine > **Binding D107 amendment (2026-09-03).** Testimony grouping keys on the full -> D41 tuple (or `asserted_at` when unknown) and grouped rows keep every -> member's times; the fact-grain `Validity`, `GraphEdge` and the `memory_v1` -> fact views gain per-endpoint bases and the occurrence window (additive; -> `fact_context@3`, `answer_context@3`); P1 accepts is-about claim filters and -> an `occurs` fact mode; `aggregate(form="timeline")` buckets by occurrence -> with an explicit `undated` bucket. Contract: `temporal_clocks_design.md` §7. +> D41 tuple (or `asserted_at` when unknown) and `EvidenceResult` lists every +> grouped member's times; the fact-grain `Validity`, `GraphEdge`, the +> `memory_v1` fact views and the open-query confirmation rows gain +> per-endpoint bases, temporal kind and the occurrence window (additive), and +> because the envelope schema is shared, `resolve_entity@2`, +> `testimony_context@2`, `fact_context@3` and `answer_context@3` roll; P1 +> accepts is-about claim filters and an `occurs` fact mode; +> `aggregate(form="timeline")` buckets by occurrence with an explicit +> `undated` bucket; "current" is the single evaluated-at predicate of §7.1. +> Contract: `temporal_clocks_design.md` §7. > **Binding D98 amendment (2026-08-27).** The graph channel reads live > PostgreSQL authority views. Fixed one-hop server statements use SQL/PGQ; diff --git a/plan/designs/temporal_clocks_design.md b/plan/designs/temporal_clocks_design.md index 428c4b59a..746c001dc 100644 --- a/plan/designs/temporal_clocks_design.md +++ b/plan/designs/temporal_clocks_design.md @@ -2,20 +2,20 @@ **Status:** binding under D107 -**Date:** 2026-09-03 (revised the same day after an independent Codex design -review; the first revision's said-on seeding, mechanical widening, universal -half-open ends, and merged ordering key were withdrawn — see §9) +**Date:** 2026-09-03 (third revision the same day, after two independent +Codex design reviews; §10 records what each round withdrew) -**Analysis:** `plan/analysis/time_handling_audit.md` (eighteen findings at +**Analysis:** `plan/analysis/time_handling_audit.md` (nineteen findings at `02b79904`, each cited by file and function) **Builds on:** D41 (claims carry an immutable, source-asserted validity interval; a fact's window is the adjudicator's single recorded verdict, never -a reduction over claim columns), D3/D4 (supersession over verdicts; the -cheap-first cascade), D43 (observations; the no-cap rule for fixed-period -figures), D88/D90 (continuous-ingest processing order and the re-split), -D106 (temporal compatibility in observation adjudication), D7/D12 (rebuild -and generations), D55 (retraction), D49 (envelopes). +a reduction over claim columns, never reopened by a late retrospective), +D3/D4 (supersession over verdicts; the cheap-first cascade), D43 +(observations; the no-cap rule for fixed-period figures), D88/D90 +(continuous-ingest processing order and the late-arrival re-split), D106 +(temporal compatibility in observation adjudication), D24 (review verdicts), +D7/D12 (rebuild and generations), D55 (retraction), D49 (envelopes). > **Reading this cold.** RememberStack extracts **claims** (what a source > said, immutable) and adjudicates them into **facts** — relations between @@ -24,205 +24,267 @@ and generations), D55 (retraction), D49 (envelopes). > already resolves *when* a statement is about ("last week" said on > 2022-10-06 → 2022-09-29) and stores it on the claim as its **D41 window**. > This design says where that resolved time must flow, which clock each -> stage reasons on, and what happens when a time is unknown. +> stage reasons on, how facts about *things that happened* differ from facts +> about *states that held*, and what happens when a time is unknown. ## 1. The problem, in one sentence The engine resolves world-time once, at extraction, and then most later stages — fact windows, supersession, ordering, deduplication, prompts, summaries, filters, timelines — reason on the *source's own date* instead. -The audit lists eighteen instances; D106 fixed one. This design closes the +The audit lists nineteen instances; D106 fixed one. This design closes the class without creating a second validity authority. ## 2. The three clocks and the two rules | Clock | Where it lives | Meaning | Role | | --- | --- | --- | --- | -| **said-on** | `claims.asserted_at` | when the source said it | provenance, shown beside every statement a model or reader judges; never written into a fact window | -| **is-about** | `claims.claim_valid_kind` / `claim_valid_from` / `claim_valid_until` / `claim_valid_precision` (D41) | the world-time the statement refers to, resolved from the wording against the said-on date | the source of every fact window, every temporal succession decision, every dated label, and every temporal prompt line | +| **said-on** | `claims.asserted_at` | when the source said it | provenance, shown beside every statement a model or reader judges; the total *processing* order (D90); never a window boundary | +| **is-about** | `claims.claim_valid_kind` / `claim_valid_from` / `claim_valid_until` / `claim_valid_precision` (D41) | the world-time the statement refers to, resolved from the wording against the said-on date | the source of every fact window, every succession decision, every dated label, every temporal prompt line | | **believed** | `ingested_at` / `invalidated_at` | when the system held the belief | belief-time only; never a substitute for world-time | `claim_valid_kind` says what sort of interval the is-about window is: `event_time` (something happened), `effective_period` (a state held over a span), `measurement_period` (a figure for a reporting span), `proposition_validity` (the proposition held over a span). `NULL` means the -source tied nothing to a date. A resolved start with `claim_valid_until IS -NULL` is an **open** interval; `instant` is a point (`until = from`, enforced -by the schema). +source tied nothing to a date. `claim_valid_precision` says how coarse the +resolved bounds are; a start with `claim_valid_until IS NULL` is **open**; +`instant` is a point (`until = from`, enforced by the schema). - **Rule 1 — world-time comes from the is-about window.** Fact windows, temporal succession, dated labels, dedupe keys, and every temporal prompt read the is-about window. The said-on clock is displayed as provenance and - is never a window boundary. + orders processing; it is never a window boundary. - **Rule 2 — a missing time stays missing.** An unknown is-about window - leaves a fact window `NULL` with basis `unknown`. Nothing is ever filled - with `now()` or with the said-on date, and a fact whose timing is unknown - never caps another fact and is never capped by one; it coexists, recorded. + leaves a fact's windows `NULL` with basis `unknown`. Nothing is ever filled + with `now()` or with the said-on date; an undated fact never caps another + and is never capped; it coexists, recorded. -## 3. Two windows on every fact +## 3. Two kinds of fact, two windows -The audit's confusions come from asking one column to be two things. A fact -carries two windows with different authority: +The audit's confusions come from asking one column to be several things. +Every fact (relation or observation) carries a **temporal kind** and two +windows with different authority: + +| `temporal_kind` | seeded from claim kind | what the fact says | identity | +| --- | --- | --- | --- | +| `state` | `effective_period`, `proposition_validity` | something held over a span ("was CEO 2015–2018") | key + **verdict window** overlap | +| `occurrence` | `event_time`, `measurement_period` | something happened, or a figure for a span ("won the final on 2022-11-05"; "FY2023 revenue was $5M") | key + **occurrence window** overlap | +| `undated` | `NULL` | the source tied nothing to a date | key (+ statement wording for observations) | | Window | Columns | Authority | Changes when | | --- | --- | --- | --- | -| **verdict window** | `valid_from` / `valid_until` (existing), plus `valid_from_basis` / `valid_until_basis` (new, `NOT NULL DEFAULT 'unknown'`; values `world_time`, `verdict`, `source_removed`, `unknown`) | the adjudicator's single recorded verdict (D3/D41/D43): "over which span do we believe this fact held" | seeded **once** at insert from the triggering claim (§4.1); afterwards only by a recorded adjudication verdict: a supersede cap (§4.4), an `extend_start` verdict (§4.3), a D55 retraction | -| **occurrence window** | `occurs_from` / `occurs_until` / `occurs_precision` (new, nullable) | **non-authoritative** derived metadata: the union of the D41 windows of the fact's current-testimony evidence — the same aggregate D106 already computes at block time | recomputed whenever evidence attaches or is withdrawn (the existing recount path); it never writes to the verdict window | +| **verdict window** | `valid_from` / `valid_until` (existing), `valid_from_basis` / `valid_until_basis` (new, `NOT NULL DEFAULT 'unknown'`: `world_time`, `verdict`, `source_removed`, `unknown`), `seed_claim_id` (new) | the adjudicator's single recorded verdict (D3/D41/D43): over which span the fact is believed to have held | seeded **once** at insert from the seed claim (§4.1); afterwards only by a recorded verdict: a supersede cap (§4.4), a review verdict (§4.3), a D55 retraction — never automatically | +| **occurrence window** | `occurs_from` / `occurs_until` / `occurs_precision` (new, nullable) | **non-authoritative** derived metadata: the union of the canonical D41 windows of the fact's current-testimony evidence — the aggregate D106 already computes at block time | recomputed whenever evidence attaches or is withdrawn (the recount path); it never writes to the verdict window | -Why two: a measurement ("FY2023 revenue was $5M") is *about* FY2023 but is +Why two kinds and two windows: a measurement is *about* FY2023 but is *believed* from the day it was reported onward and is never capped (D43's -no-cap rule); a past event ("won the final on 2022-11-05") is about one day -but stays a believed fact forever; a state ("was CEO 2015–2018") is about the -same span it is believed to have held. Only the last kind has one window. The -occurrence window is what "when did it happen / what period is this figure -for" queries, dated labels, timelines and is-about filters read; the verdict -window is what `valid_at` / `facts_as_of` and supersession read. D41's -boundary is kept exactly: the verdict is single-valued and recorded; the -occurrence window is evidence-derived and cannot mutate it. - -## 4. Fact windows: seeding, matching, extending, closing - -### 4.1 Seeding at insert (once) - -| Triggering claim (`claim_valid_kind`) | `valid_from` | `valid_until` | bases | -| --- | --- | --- | --- | -| `effective_period`, `proposition_validity` (a state held over a span) | `claim_valid_from` | `claim_valid_until` — a bounded span becomes a **closed historical slice**; open → `NULL` | `world_time` / `world_time` (or `unknown` for an open end) | -| `event_time` (something happened) | `claim_valid_from` (the fact "it happened" holds from then on) | `NULL` — a past event is never capped; it can only be contradicted | `world_time` / `unknown` | -| `measurement_period` (a figure for a span) | `claim_valid_from` (the period start; believed from then on) | `NULL` — D43's no-cap rule | `world_time` / `unknown` | -| no is-about window | `NULL` | `NULL` | `unknown` / `unknown` | - -The occurrence window is set from the same claim at the same time. The -previous re-occurrence floor (a reopened spell starts no earlier than the -prior closed spell's end) applies **only** when the incoming occurrence start -is provably later than that end — a proven chronological successor; an older -spell discovered late is inserted as its own historical slice (§4.2). - -### 4.2 Matching evidence to bounded slices - -A fact's identity is its key plus its verdict window (relations enforce this -with a GiST `EXCLUDE` on `(subject, predicate, object) && tstzrange(valid_from, -valid_until)`; observations have no constraint and rely on the D106 rung). -Evidence-target selection is therefore interval-aware, not open-only: - -1. **Overlapping** — the incoming claim's occurrence window overlaps a live - slice's verdict window → the claim attaches as evidence; the slice's - verdict is untouched; its occurrence window is recomputed. -2. **Disjoint** — no live slice's verdict window overlaps → a **new slice** - (a distinct historical spell), which the `EXCLUDE` permits. -3. **Unknown timing** on the incoming claim → attach to the single open slice - if exactly one exists; otherwise attach to the most recent slice and - record `attachment = "unknown_timing"` on the evidence row. An undated - claim never creates a second unbounded slice (which the `EXCLUDE` would - reject for relations and which would be a silent duplicate for - observations). -4. **Unknown timing on the existing slice** (its verdict window is - `NULL`/`NULL`) and a dated incoming claim → attach; the slice stays - undated (no mechanical seeding after the fact). A later explicit verdict - may date it (§4.3). - -Overlap uses the precision-aware predicate of §5. - -### 4.3 Revising a verdict: explicit, recorded, deterministic - -A verdict window changes only through a recorded adjudication row with a -rationale, exactly as a cap does today: - -- **`extend_start`** — when attached evidence for a *state* fact - (`effective_period` / `proposition_validity`) carries an occurrence start - earlier than the verdict start, the adjudicator records `extend_start` - (rationale: the claim id and its window) and moves `valid_from` earlier — - never later, never earlier than a capped predecessor's `valid_until`, and - never touching `valid_until`. The rule is deterministic over the evidence - set (the earliest evidenced start wins), so the outcome does not depend on - arrival order (D88's independence) or on rebuild (D7), and it is a verdict - with a transcript row, not a reduction over claim columns (D41). It does - not apply to events or measurements, whose verdict start is the occurrence - start of the seeding claim and whose occurrence window already widens. -- **`date_undated`** — a slice with an unknown verdict window may be dated by - an explicit verdict when dated evidence attaches and the slice is the only - one for its key; recorded the same way. -- No verdict ever reopens a closed end (D41's retrospective guard); a - retrospective that contradicts a closed end is a `contradict` verdict and - both stand. +no-cap rule); a past event is about one day but stays a believed fact +forever — and a second, later occurrence of the same key is a **different +fact**, not corroboration (D106); a state is about the same span it is +believed to have held and is what supersession caps. Occurrences therefore +have an open verdict window `[occurs_from, ∞)` that is *not* their identity; +states have a verdict window that *is*. D41's boundary holds: the verdict is +single-valued and recorded; the occurrence window is evidence-derived and +cannot mutate it. + +## 4. Fact windows: seeding, matching, revising, closing + +### 4.1 Seeding at insert (once, from the seed claim) + +The **seed claim** is the first claim for the fact in D90 processing order — +exactly the claim that creates the row in a fresh ingest — and is recorded +in `seed_claim_id`, so a rebuild (§9) reproduces the same seed. Windows are +the claim's **canonical bounds** (§5): + +| seed claim kind | `temporal_kind` | `valid_from` | `valid_until` | bases | `occurs_*` | +| --- | --- | --- | --- | --- | --- | +| `effective_period`, `proposition_validity` | `state` | canonical start | canonical end (bounded span → a closed historical slice; open → `NULL`) | `world_time` / `world_time`, or `unknown` for an open end | same as the verdict window | +| `event_time`, `measurement_period` | `occurrence` | canonical start (believed from then on) | `NULL` — never capped (D43, extended to events) | `world_time` / `unknown` | the claim's canonical window | +| `NULL` | `undated` | `NULL` | `NULL` | `unknown` / `unknown` | `NULL` | + +The re-occurrence floor (a reopened state slice starts no earlier than the +prior closed slice's end) applies **only** when the seed's start is provably +later than that end — a chronological successor; an older spell discovered +late is inserted as its own closed slice (§4.2). + +### 4.2 Matching evidence to facts, by kind + +Matching runs in this order: the entity/key block (unchanged), then +temporal-kind identity (this section), then the D4/D106 ladder for the +verdict. Overlap is the canonical half-open predicate of §5. + +**State claims** (`effective_period` / `proposition_validity`): + +1. the claim's canonical window overlaps a live `state` slice's verdict + window → attach as evidence; the verdict is untouched; `occurs_*` + recomputes; +2. no overlap → a **new closed or open slice** (a distinct spell; the + relations `EXCLUDE` on state slices permits disjoint ranges); +3. an overlap with a *different value* of the same property is the + supersede/contradict question the ladder answers (§4.4), not a matching + question. + +**Occurrence claims** (`event_time` / `measurement_period`): + +1. the claim's canonical window overlaps a live `occurrence` fact's + `occurs_*` window → the ladder decides `evidence` (same occurrence + re-mentioned; `occurs_*` widens), `contradict` (same occurrence, disputed + detail), or `new`; +2. no overlap → a **new occurrence fact**. Two visits, two wins, two + quarterly figures are two rows; this is D106's rule applied to relations + as well as observations. + +**Undated claims** (`NULL` kind): + +- observations: D106's mixed rule — an undated statement never attaches to + a dated occurrence and a dated event never attaches to an undated + statement; identical wording collapses onto an existing `undated` row of + the same key, otherwise a new `undated` row; +- relations: the triple *is* the content, so an undated claim attaches to + the single open `state` slice if exactly one exists, else to the single + `undated` row for the key (creating it once); it never attaches to an + `occurrence` and never creates a second unbounded slice. + +**Relations schema.** The existing GiST `EXCLUDE` on +`(subject, predicate, object) && tstzrange(valid_from, valid_until)` applies +`WHERE temporal_kind = 'state'` only; occurrence relations get an `EXCLUDE` +on `(subject, predicate, object) && tstzrange(occurs_from, occurs_until)`, +and `undated` relations a unique key on the triple. Observations keep no +constraint (D43) and rely on this matching plus the D106 rung. + +### 4.3 Revising a verdict: review only + +No automatic path changes a verdict window after seeding. When attached +evidence's occurrence start precedes a `state` slice's verdict start (or a +slice with an unknown window gains dated evidence), the discrepancy is +visible in the envelope (`occurs_from < valid_from`, or bases `unknown` +beside a dated `occurs_*`) and is raised as a **review item** (D24). A +reviewer's verdict may move the start earlier or date the slice, recorded +with rationale and basis `verdict`, and may never reopen a closed end +(D41's retrospective guard). Rebuild replays review verdicts as it replays +caps (D7). ### 4.4 Closing: temporal succession, separate from processing order D90's deterministic **processing** order — `(asserted_at NULLS LAST, -claim_id, statement)` for observation staging and the re-split — is -unchanged; it exists so replay is total and reproducible, and it decides -nothing about the world. - -**Temporal succession** is a separate relation used only for capping: -*B succeeds A* iff both are state facts with verdict starts of basis -`world_time` and `B.valid_from > A.valid_from`. A supersede verdict caps A -at `B.valid_from` (basis `verdict`). When either side's start is not -`world_time`, there is no succession: the pair **coexists** and the -adjudication row records `reason = "no world-time boundary -> coexist"`. -Relation supersession and observation supersession share this one definition -(today they disagree about undated testimony; the audit's 4.11). `now()` is -never a boundary. +claim_id, statement)` — is unchanged; it makes replay total and reproducible +and decides nothing about the world. -D55's retraction boundary — the withdrawing document version's source time — -is a *source action*, not a temporal inference, and keeps its own basis -`source_removed`; when that time is unknown, a retracted state is closed on -belief-time (`invalidated_at`) rather than capped at `now()`. +**Temporal succession** is the rule for capping a `state` slice. A supersede +verdict caps the predecessor at a **world-time instant supplied by the +successor**: -**Residual, measured rather than assumed:** undated restatements of a -changing state coexist as duplicates. Identical wording still collapses -(§4.2 step 3 attaches it), so growth comes only from *differently worded, -undated* restatements; the lever is extraction coverage of the D41 kinds -(§6), and the count of `unknown`-basis slices per key is a reported metric. +- a successor `state`'s verdict start (basis `world_time` or `verdict`); or +- an **ending occurrence** the ladder matched as superseding (D106's dated + resignation ending an "is CEO" state, which may itself have an unknown + start), at the occurrence's canonical start. -### 4.5 Statements stay canonical; dated labels are derived +The predecessor's own start basis is irrelevant. When the successor supplies +no world-time instant (an undated successor), there is no succession: the +pair **coexists** and the adjudication row records `reason = "no world-time +boundary -> coexist"`. The cap's basis is `verdict`. Relation supersession +and observation supersession share this one rule (today they disagree about +undated testimony). `now()` is never a boundary. + +D55's retraction boundary — the withdrawing document version's source time — +is a *source action*, not a temporal inference; it keeps basis +`source_removed`, and when that time is unknown a retracted state closes on +belief-time (`invalidated_at`) rather than at `now()`. + +**Residual, measured rather than assumed:** undated, differently worded +restatements of a changing state coexist as `undated` rows instead of +capping. Identical wording collapses (§4.2), so growth comes only from +distinct undated wordings; the count of `undated` rows per key is a reported +metric and the lever is extraction coverage of the D41 kinds (§6). + +### 4.5 The D90 late-arrival re-split uses the world clock + +D90 §5.5.3 re-materialises evidence attached to a capped observation when +that evidence lies *after* the cap. Under this design the cap `T` is a +world-time instant, so eligibility compares the attached **state** claim's +canonical occurrence start to `T` — not its `asserted_at`, which stays the +total work order only. Undated attached evidence is never re-split (it +coexists on the slice it attached to). The staggered acceptance case gains a +variant in which said-on order and is-about order are deliberately reversed +and the final slices must follow the world. This amends the D90 design +(`e3_entity_obs_flush_fanout_design.md` §5.5.3). + +### 4.6 Statements stay canonical; dated labels are derived The observation `statement` remains the canonical source-faithful wording (D43; unchanged on collapse and supersession). The human-facing **label** — `obs_label`, `FactResult.label`, the profile line, the K fact-sheet cell — is -derived deterministically from `statement` plus the occurrence window and -precision ("Nate won a video game tournament last week — on 2022-09-29"), -and is refreshed whenever the occurrence window is recomputed. Nothing -source-specific is baked into identity, and two claims of different -precision that collapse yield one label from the union window at the coarser -precision. +derived deterministically from `statement` plus `occurs_*` and +`occurs_precision` ("Nate won a video game tournament last week — on +2022-09-29"), refreshed whenever the occurrence window recomputes. Nothing +source-specific enters identity; claims of different precision that collapse +yield one label from the union window at the coarser precision. -## 5. Precision without changing storage +## 5. Canonical bounds: precision honoured once, consistently -Claim windows stay stored as they are (closed intervals; `instant` as a -point; `open` as a `NULL` end; the schema `CHECK`s unchanged). What changes is -**comparison**: every overlap or containment test derives an *effective -exclusive end* from the stored end and the precision — +Claim storage is unchanged (inclusive bounds; `instant` as `until = from`; +`open` as a `NULL` end; the schema `CHECK`s as they are). One function, +`canonical_bounds(from, until, precision) → [start, end_exclusive)`, +converts a stored claim window to a **half-open** interval: -| `claim_valid_precision` | effective end | +| `claim_valid_precision` | canonical `[start, end)` | | --- | --- | -| `day` / `month` / `quarter` / `year` | `claim_valid_until + one unit` (a day-precision 2023-05-07 covers `[05-07 00:00, 05-08 00:00)`) | -| `instant` | the point itself (closed; `from = until`) | -| `open` | +∞ | -| `unknown` | no window (never matches a window predicate; disclosed as excluded) | - -— and the predicate is `a.from < b.effective_end AND b.from < a.effective_end`, -with points compared inclusively. This one function is used by -`claims_as_of`, D106's `_windows_disjoint`, §4.2 matching, the §7 dedupe key, -and the is-about filters, so a day-precision claim is found by an intraday -query and two same-day events from different wordings overlap. No -re-extraction, no migration, and no ordering between this and §4. - -Extraction itself improves in vocabulary, not shape: the prompt defines and -exemplifies **all four kinds** and `open` ("has been CEO since 2019" → -`proposition_validity`, `open`; "FY2023 revenue was $5M" → -`measurement_period`, `year`; "worked at Acme from 2015 to 2018" → -`effective_period`, `year`), the structured-output model describes each -field, and the document header shown to the extractor carries the **full -source timestamp** so intraday expressions resolve and same-day sources are -distinct anchors. - -## 6. Every temporal judgement sees both clocks - -The two-clock block D106 introduced for the observation verdict — +| `day` / `month` / `quarter` / `year` | `[from, date_trunc(unit, until) + unit)` — a year stored as 2022-01-01…2022-12-31 becomes `[2022-01-01, 2023-01-01)`; a day 2023-05-07 becomes `[05-07 00:00, 05-08 00:00)` | +| `instant` | `[t, t + 1 µs)` — a non-empty point | +| `open` | `[from, NULL)` (unbounded) | +| `unknown` | no interval; never matches a window predicate and is disclosed as excluded | + +**Fact windows are stored canonical.** `valid_from`/`valid_until` and +`occurs_from`/`occurs_until` are written from `canonical_bounds` at seeding, +so every fact predicate the engine already has — `valid_until > :as_of`, +`tstzrange(valid_from, valid_until)` in the `EXCLUDE`, the P1 `FactTime` +selectors — is correct without a precision column; `occurs_precision` is kept +for labels only. **Claim comparisons canonicalise at query time** — +`claims_as_of`, D106's `_windows_disjoint`, §4.2 matching, the §7 dedupe key +and filters all call the same function — so a day-precision claim is found +by an intraday query and two same-day events from different wordings +overlap. The overlap predicate is `a.start < b.end AND b.start < a.end` with +`NULL` ends as +∞; no second predicate for points is needed because an +instant is a non-empty interval. + +## 6. Extraction: vocabulary and anchor + +The extractor prompt defines and exemplifies **all four kinds** and `open` +("has been CEO since 2019" → `proposition_validity`, `open`; "FY2023 revenue +was $5M" → `measurement_period`, `year`; "worked at Acme from 2015 to 2018" +→ `effective_period`, `year`), and the structured-output model describes +each field. The document header shown to the extractor carries the **full +source timestamp**, so offset expressions ("three hours ago", "an hour +before this was written") resolve to instants and two same-day sources are +distinct anchors. Expressions the precision enum cannot represent ("this +morning" has no part-of-day precision) remain unresolved by design — a +documented expressivity boundary, not a defect of the anchor. + +## 7. Every temporal judgement sees both clocks; every surface names them + +### 7.1 The current-fact predicate + +"Current" is one predicate evaluated at an explicit instant `E`: +`invalidated_at IS NULL AND (valid_until IS NULL OR valid_until > E)`. +Occurrences and undated facts are always current (open verdict). A `state` +with a finite **future** end is current until it passes. Every consumer that +today tests `valid_until IS NULL` — entity profiles, source-removal +eligibility, K routing, `facts_current` — uses this predicate with `E` fixed +per evaluation, and cached artifacts (profiles, K pages) include the earliest +future `valid_until` among their inputs in their input hash and are queued +for refresh by an **expiry sweep** when that instant passes, so the hash +cannot go stale silently as wall time moves (the concern the profile code +records today). + +### 7.2 Prompts + +The two-clock block D106 introduced — ``` EXISTING: … said on: - is about: + is about: NEW: … said on: … is about: … @@ -231,93 +293,127 @@ NEW: … with its definitions — is the contract for **every** prompt that compares, merges, ranks, or summarises facts: relation supersession (its evidence laterals select the D41 columns), the T4 identity candidate list (each -salient fact with its occurrence window), the K prose writer's claim bundle -(each claim with said-on and is-about), and the benchmark answer agent, which -additionally names the envelope fields (`asserted_at`, `claim_valid_*`, -`validity.valid_from/valid_until` with bases, `occurrence`). - -## 7. Retrieval, envelopes, filters, consumers - -- **Deduplication.** Grouping identical testimony keys on `(normalised - text, claim_valid_kind, claim_valid_from, claim_valid_until, - claim_valid_precision)` when the window is known and on `(normalised - text, asserted_at)` when it is not, and every grouped row carries each - member's `asserted_at` and window, so no temporal distinction is lost - before a reader sees it. -- **Envelopes (D49, additive).** The fact-grain `Validity` gains - `valid_from_basis`, `valid_until_basis`, and `occurrence` - (`from`/`until`/`precision`); the same fields are added to `GraphEdge`'s - flat validity, to the K-layer fact model, and to the `memory_v1` fact - views. The affected assured operations roll their versions - (`fact_context@3`, `answer_context@3`; `testimony_context` is unchanged in - shape), the surface manifest hash and generated OpenAPI/SDK artifacts roll - with them. +salient fact with its occurrence window and kind), the K prose writer's +claim bundle (each claim with said-on and is-about), and the benchmark +answer agent, which additionally names the envelope fields (`asserted_at`, +`claim_valid_*`, `validity` with bases, `occurrence`, `temporal_kind`). + +### 7.3 Envelopes and versions (D49, additive fields; rolled versions) + +- `EvidenceResult` gains `grouped_members` — one `(claim_id, asserted_at, + claim_valid_kind, claim_valid_from, claim_valid_until, + claim_valid_precision)` record per grouped claim — so grouping never hides + a member's times. +- The fact-grain `Validity` gains `valid_from_basis`, `valid_until_basis`, + `temporal_kind`, and `occurrence` (`from`/`until`/`precision`); the same + fields are added to `GraphEdge`'s flat validity, the K-layer fact model, + and the `memory_v1` fact views. +- Because every envelope-returning operation derives its result schema from + the shared `Envelope` schema, all of them roll: `resolve_entity@2`, + `testimony_context@2`, `fact_context@3`, `answer_context@3`; the surface + manifest hash, the query-space manifest, the generated OpenAPI/SDK + artifacts, and the benchmark protocol roll with them. +- The open-query confirmation surface (`query_sandbox/nomination.py`) returns + the complete D41 tuple for claim rows and bases/occurrence/kind for fact + rows. + +### 7.4 Dedupe, filters, timeline, profiles + +- **Deduplication** keys on `(normalised text, claim_valid_kind, + canonical start, canonical end, claim_valid_precision)` when the window is + known and on `(normalised text, asserted_at)` when it is not. - **Filters.** P1 claim search gains `valid_from` / `valid_until` (is-about, - §5 overlap) beside the said-on `asserted_from` / `asserted_to`; P1 fact - search's existing `FactTime` selector gains an `occurs` mode over the - occurrence window beside its verdict-window modes. -- **Timeline.** `aggregate(form="timeline")` buckets facts by occurrence - start, then verdict start, and emits an explicit `undated` bucket; it never + canonical overlap) beside the said-on `asserted_from` / `asserted_to`; P1 + fact search's `FactTime` selector gains an `occurs` mode over `occurs_*`. +- **Timeline.** `aggregate(form="timeline")` buckets facts by `occurs_from`, + then `valid_from`, and emits an explicit `undated` bucket; it never substitutes `ingested_at`. - **Profiles.** Salient facts rank by evidence, then by occurrence recency; - never by `updated_at`; each carries its occurrence window into the T4 - prompt. -- **Consumers.** The K fact sheet prints `valid from` / `valid until` from - the verdict window only where the basis is `world_time` or `verdict`, - prints `about` from the occurrence window, and `—` for `unknown`; - "Observation history" sorts by occurrence start. The consumption skill - states the three clocks and defines `claims_as_of` over source world-time - (D41), not system time. - -## 8. Generations, rebuild, protocol - -- Schema: one migration adds the four basis/occurrence columns to - `relations` and `observations`; the schema head rolls. -- Generations: the extractor (kinds, header), the normaliser (seeding), both - adjudicators (succession, `extend_start`, labels), the - `adjudicate_observations` flush component (with the D106 - stop-drain-rebuild contract), P1 labels, K page generation. -- Rebuild (D7): existing stores are re-seeded from the claim rows they hold - (§4.1 needs only `claim_valid_*`, already present); only §5's added kinds - benefit from re-extraction. -- Protocol: each landed work package that changes ingestion provenance or - the assured surface rolls the LoCoMo protocol; packages released together - roll it once. Scores across a roll are directional. - -## 9. Alternatives considered (including the withdrawn first revision) + never by `updated_at`; each carries its occurrence window and kind into the + T4 prompt. + +### 7.5 Consumer surfaces + +The K fact sheet prints `valid from` / `valid until` from the verdict window +only where the basis is `world_time` or `verdict`, prints `about` from the +occurrence window, and `—` for `unknown`; "Observation history" sorts by +`occurs_from`. The consumption skill states the three clocks, the two fact +kinds, and defines `claims_as_of` over source world-time (D41), not system +time. + +## 8. Generations and protocol + +- Generations: the extractor (kinds, header), the normaliser (kind and + seeding), both adjudicators (matching by kind, succession, re-split), the + `adjudicate_observations` flush component, P1 labels, K page generation. +- Versions: the assured operations of §7.3, the surface and query-space + manifests, OpenAPI/SDK, and the LoCoMo protocol — each landed work package + that changes ingestion provenance or the assured surface rolls it; + packages released together roll it once. Scores across a roll are + directional. + +## 9. Cutover: stop, drain, migrate, rebuild, then serve + +A store never mixes pre- and post-D107 fact semantics: + +1. **stop** intake and **drain** in-flight units (the D106 contract lets + pre-roll observation units complete under their own generation); +2. **migrate** — add the new columns (`temporal_kind`, the two bases, + `occurs_from`/`occurs_until`/`occurs_precision`, `seed_claim_id`), the + state-only `EXCLUDE`, the occurrence `EXCLUDE`, the undated unique key; +3. **rebuild the fact layer** by replaying the current-testimony claims in + D90 processing order through the new normaliser and adjudicators (D7): + the first claim per fact seeds it, exactly as a fresh ingest would, so + the seed is reproducible; existing verdict rows are replaced, not + reinterpreted; recorded review verdicts and D55 retractions replay after + the caps; +4. **readiness** reports the fact-layer generation; consumers refuse to + serve a store whose fact generation predates D107; +5. **rollback** is restore of the pre-migration backup, as for any + generation roll. + +Only §6's added kinds benefit from re-extraction; steps 1–4 need none. + +## 10. Alternatives considered, including what the two reviews withdrew - **Seed `valid_from` from the said-on date when the window is unknown** - (first revision). Withdrawn: it writes provenance into a world-time column - and contradicts Rule 2; a source's modification date is not evidence that - a state began then. -- **Seed `valid_until` from a measurement's or event's claim end.** Withdrawn: - D43 says a fixed-period figure is never capped and a finite end would drop - it from current facts and profiles; the period belongs to the occurrence - window, which is why there are two. -- **Widen the verdict start mechanically on evidence.** Withdrawn: a - reduction over claim columns (D41). Replaced by the recorded, - deterministic `extend_start` verdict. -- **Store all precisions half-open.** Withdrawn: `instant` requires - `until = from` and would become empty; comparison-time effective ends - achieve the same result with no migration or re-extraction. -- **One coalesced ordering key for processing and succession.** Withdrawn: - D90 needs a total processing order; succession needs world-time bounds; - they are different questions. -- **Cap at the successor's said-on date as an upper bound.** Withdrawn: a - retrospective's publication date proves nothing about when the described - change happened. -- **Bake the resolved date into the observation statement.** Withdrawn: - makes identity depend on which claim arrived first (D43); labels are - derived instead. -- **Seventeen local patches.** The pattern recurs in every new consumer; one - contract with one overlap function, one succession rule, and one prompt - block is smaller and stays true. + (revision 1). Withdrawn: provenance is not validity (Rule 2). +- **Seed a measurement's or event's `valid_until` from its claim** + (revision 1). Withdrawn: D43 never caps a fixed-period figure; the period + belongs to the occurrence window. +- **Match every fact by verdict-window overlap** (revision 2). Withdrawn: an + occurrence's open verdict window overlaps every later occurrence, which + recreates the D106 collapse and collides with the relations `EXCLUDE`; + occurrences are matched by `occurs_*` and have their own exclusion. +- **Automatic `extend_start` to the earliest evidenced start** (revision 2). + Withdrawn: `min()` over claim columns is the reduction D41 forbids, and it + would let a late retrospective move an adjudicated window. Discrepancies + are surfaced for review instead. +- **Universal half-open claim storage** (revision 1) and **comparison-time + effective ends by "+ one unit"** (revision 2). Withdrawn: the first empties + `instant`; the second over-expands normalised year/quarter/month ends and + leaves fact predicates and the `EXCLUDE` reading raw bounds. Replaced by + `canonical_bounds` applied at fact seeding and at claim comparison. +- **One coalesced key for processing order and succession** (revision 1). + Withdrawn: D90 needs a total processing order; succession needs world-time + bounds. +- **Succession only between two dated states** (revision 2). Withdrawn: it + made D106's dated-resignation-ends-undated-state case impossible; any + world-time instant supplied by the successor may cap. +- **Cap at the successor's said-on date as an upper bound** (revision 1). + Withdrawn: a retrospective's publication date proves nothing about when + the change happened. +- **Bake the resolved date into the observation statement** (revision 1). + Withdrawn: identity would depend on arrival order (D43); labels are + derived. +- **Nineteen local patches.** The pattern recurs in every new consumer. - **Keep `now()` as the undated cap.** Breaks rebuild stability (D7). -## 10. Non-goals (scope boundaries) +## 11. Non-goals (scope boundaries) -- Recurrence ("every Q4") and anchor-relative time ("as of the merger") - remain outside the single-interval model (D41). +- Recurrence ("every Q4"), anchor-relative time ("as of the merger"), and + part-of-day expressions ("this morning") remain outside the single-interval + precision model (D41). - Belief-time semantics are unchanged. - No new authority: the claim window stays immutable evidence; the verdict window stays the one adjudicated home; the occurrence window is derived @@ -325,9 +421,9 @@ additionally names the envelope fields (`asserted_at`, `claim_valid_*`, ## References -Decisions: D107 (this design), D41, D3, D4, D43, D88, D90, D106, D7, D12, -D55, D49. Analysis: `plan/analysis/time_handling_audit.md`. Sequencing: +Decisions: D107 (this design), D41, D3, D4, D43, D88, D90, D106, D24, D7, +D12, D55, D49. Analysis: `plan/analysis/time_handling_audit.md`. Sequencing: `plan/plans/temporal_clocks.md`. Affected designs carry a D107 amendment banner: `e2_e3_claims_relations_design.md`, `observations_design.md`, `registries_design.md`, `retrieval_design.md`, `k_layers_design.md`, -`locomo_benchmark_design.md`. +`locomo_benchmark_design.md`, `e3_entity_obs_flush_fanout_design.md`. diff --git a/plan/plans/temporal_clocks.md b/plan/plans/temporal_clocks.md index 379d63ad9..d6b5082cd 100644 --- a/plan/plans/temporal_clocks.md +++ b/plan/plans/temporal_clocks.md @@ -6,23 +6,25 @@ **Analysis:** `plan/analysis/time_handling_audit.md` -Order follows answer impact and dependency: as-of correctness first (it makes -the documented `valid_at` promise true), then the prompts that decide -supersession and identity, then retrieval keys and envelopes, then extraction -vocabulary and consumer labels. Each package rolls the generations it touches -and lands with tests that assert the *clock*, not only the outcome. +Order follows dependency and answer impact: the shared canonical-bounds +function first (everything compares through it), then the fact model and +cutover (it makes the documented `valid_at` promise true), then the prompts +that decide supersession and identity, then retrieval keys and envelopes, +then extraction vocabulary and consumer labels. Each package rolls the +generations it touches and lands with tests that assert the *clock*, not +only the outcome. | WP | Scope | Audit findings closed | Generations / surfaces rolled | Acceptance | | --- | --- | --- | --- | --- | -| **WP-T.0 — precision-aware comparison** | one shared overlap function with precision-derived effective ends (design §5), used by `claims_as_of`, D106's disjointness test, and later packages; no storage change | 4.13 | none (pure comparison) | an intraday `claims_as_of` window finds a day-precision claim; two same-day events from different wordings overlap; `instant` still matches its own point | -| **WP-T.1 — two windows, seeding, matching, closing** | migration for `valid_from_basis` / `valid_until_basis` / `occurs_*`; seed verdict windows once by kind; interval-aware evidence-target matching for bounded slices (incl. the `EXCLUDE` cases); recorded `extend_start` / `date_undated` verdicts; temporal succession separate from D90 processing order; caps only at world-time starts, else coexist; D55 keeps `source_removed`; no `now()` anywhere; occurrence window recomputed on recount | 4.2, 4.4, 4.10, 4.11, 4.17 | normaliser, both adjudicators, obs flush component (D106 stop-drain-rebuild); schema head | `lookup_relations(valid_at=2010)` returns the 2010 employer and excludes the 2024 one on a seeded corpus; the same ingest replayed on different days yields byte-identical windows; both adjudicators orient one undated/dated pair identically (coexist); a late-discovered older spell inserts as its own slice; no cap boundary equals a wall-clock instant | -| **WP-T.2 — two clocks in every temporal prompt** | relation supersession prompt and laterals show `said on` / `is about`; T4 candidate salient facts carry occurrence windows and rank by evidence then occurrence recency; K writer claims carry `asserted_at` + D41 fields; answer-agent prompt names the envelope fields | 4.3, 4.6, 4.8, 4.16 | relation adjudicator, resolver, K writer; LoCoMo protocol | a 2024 retrospective spell does not supersede a 2023 current fact in the supersession proofs; T4 sees windows in its candidate JSON; the answer prompt fixture contains the two-clock paragraph | -| **WP-T.3 — retrieval keys, envelopes, skill** | testimony grouping keys include the full D41 tuple (or `asserted_at` when unknown) and grouped rows carry every member's times; `Validity`, `GraphEdge`, the K fact model and `memory_v1` fact views gain bases + occurrence; `fact_context@3` / `answer_context@3`; P1 is-about claim filters and the `occurs` fact mode; timeline by occurrence with an `undated` bucket; consumption skill teaches the three clocks and defines `claims_as_of` over world-time | 4.1, 4.9, 4.12, 4.18 | assured operation versions, surface manifest hash, generated OpenAPI/SDK, query-space manifest; LoCoMo protocol | identical text on two dates is two evidence rows in `testimony_context`; a 2015–2020 archive imported today produces 2015–2020 timeline buckets; the regenerated skill text contains the corrected `claims_as_of` definition | -| **WP-T.4 — extraction vocabulary and header** | all four D41 kinds and `open` taught with examples and field descriptions; full-timestamp header | 4.14, 4.15 | extractor; LoCoMo protocol | "has been CEO since 2019" extracts as `proposition_validity` / `open`; a same-day second session resolves "this morning" to a different instant than the first | -| **WP-T.5 — dated labels and consumer surfaces** | labels derived from statement + occurrence window (obs label, `FactResult.label`, profile lines); K fact sheet columns by basis with an `about` column; observation history by occurrence start | 4.5, 4.7 | P1 labels, K page generation | an observation minted from "last week" carries the resolved date in its label but not its statement; a sheet never prints a said-on date under a world-time heading | +| **WP-T.0 — canonical bounds** | `canonical_bounds(from, until, precision)` (design §5) used by `claims_as_of`, D106's disjointness test, and every later package; claim storage unchanged | 4.13 | none (pure comparison) | an intraday `claims_as_of` window finds a day-precision claim; a year stored as 2022-01-01…12-31 canonicalises to `[2022-01-01, 2023-01-01)`; an `instant` is a non-empty point that overlaps itself; two same-day events from different wordings overlap | +| **WP-T.1 — fact model and cutover** | migration: `temporal_kind`, `valid_from_basis`, `valid_until_basis`, `occurs_from`/`occurs_until`/`occurs_precision`, `seed_claim_id`; state-only verdict `EXCLUDE`, occurrence `EXCLUDE`, undated unique key; seed once by kind from the D90-first claim; matching by kind (§4.2); no automatic verdict revision, review items for discrepancies (§4.3); succession by any successor-supplied world-time instant incl. ending occurrences, else coexist (§4.4); D90 re-split by occurrence start (§4.5); D55 `source_removed`; no `now()`; the current-fact predicate with expiry sweep (§7.1); stop-drain-migrate-rebuild-readiness (§9) | 4.2, 4.4, 4.10, 4.11, 4.17 | normaliser, both adjudicators, obs flush component; schema head; fact-layer generation in readiness | `lookup_relations(valid_at=2010)` returns the 2010 employer and excludes the 2024 one; a January and an October visit are two occurrence relations under the new `EXCLUDE`; the same ingest replayed on different days yields byte-identical windows; both adjudicators orient one undated/dated pair identically (coexist); a dated resignation still caps an undated "is CEO" state (D106 preserved); the staggered D90 case with said-on and is-about orders reversed yields world-ordered slices; a state with a future end is current today and its profile refreshes when the end passes; a store whose fact generation predates D107 is refused by readiness | +| **WP-T.2 — two clocks in every temporal prompt** | relation supersession prompt and laterals show `said on` / `is about`; T4 candidate salient facts carry occurrence windows and kinds and rank by evidence then occurrence recency; K writer claims carry `asserted_at` + D41 fields; answer-agent prompt names the envelope fields | 4.3, 4.6, 4.8, 4.16 | relation adjudicator, resolver, K writer; LoCoMo protocol | a 2024 retrospective spell does not supersede a 2023 current fact in the supersession proofs; T4 sees windows and kinds in its candidate JSON; the answer prompt fixture contains the two-clock paragraph | +| **WP-T.3 — retrieval keys, envelopes, skill** | dedupe on the full D41 tuple (or `asserted_at` when unknown) with `grouped_members`; `Validity`, `GraphEdge`, the K fact model and `memory_v1` fact views gain bases, kind and occurrence; `resolve_entity@2`, `testimony_context@2`, `fact_context@3`, `answer_context@3`; open-query confirmation returns the full D41 tuple and fact bases/occurrence; P1 is-about claim filters and the `occurs` fact mode; timeline by occurrence with an `undated` bucket; consumption skill teaches the three clocks and two fact kinds and defines `claims_as_of` over world-time | 4.1, 4.9, 4.12, 4.18, 4.19 | assured operation versions, surface manifest hash, query-space manifest, generated OpenAPI/SDK; LoCoMo protocol | identical text on two dates is two evidence rows in `testimony_context`, and a grouped row lists every member's times; a 2015–2020 archive imported today produces 2015–2020 timeline buckets; the regenerated skill text contains the corrected `claims_as_of` definition; an open-query claim row carries precision and kind | +| **WP-T.4 — extraction vocabulary and anchor** | all four D41 kinds and `open` taught with examples and field descriptions; full-timestamp header | 4.14, 4.15 | extractor; LoCoMo protocol | "has been CEO since 2019" extracts as `proposition_validity` / `open`; "three hours ago" in a source stamped 19:30 resolves to an `instant` at 16:30 of that day, and the same words in a second same-day source stamped 22:00 resolve to a different instant | +| **WP-T.5 — dated labels and consumer surfaces** | labels derived from statement + occurrence window (obs label, `FactResult.label`, profile lines); K fact sheet columns by basis with an `about` column; observation history by `occurs_from` | 4.5, 4.7 | P1 labels, K page generation | an observation minted from "last week" carries the resolved date in its label but not its statement; a sheet never prints a said-on date under a world-time heading | -Dependencies: T.0 first (T.1's matching and T.3's dedupe use it). T.2, T.3 -and T.5 depend on T.1's columns. T.4 is independent of all of them and may -run in parallel. Every package updates the same-PR documentation the -CLAUDE.md rule requires (concepts and API pages for `valid_at`, the benchmark -README when the protocol rolls) and the project-status page. +Dependencies: T.0 first. T.1 depends on T.0. T.2, T.3 and T.5 depend on +T.1's columns and cutover. T.4 is independent and may run in parallel. Every +package updates the same-PR documentation the CLAUDE.md rule requires +(concepts and API pages for `valid_at`, the benchmark README when the +protocol rolls) and the project-status page. From 8d14d52380b0a9daefda12832fc4183ba74fb7eb Mon Sep 17 00:00:00 2001 From: Jiri Puc Date: Thu, 3 Sep 2026 15:19:04 +0200 Subject: [PATCH 4/8] design: adjudicated occurrence identity, temporal_window review, in-place conversion (D107 round 3) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codex's third review: an occurrence exclusion constraint contradicts adjudicated identity (two same-day visits, or a union that grows into a neighbour); kind-routed matching made D106's ending-event cap unreachable and had no chronological guard; "review item" named no verdict schema; a replay rebuild erases D55 history and can re-pick seeds; belief-time leaked into a world-time endpoint; aggregates and predicate absence never evaluate valid_until; canonical bounds kept raw starts and had no SQL form. Drop the occurrence exclusion — occurrence identity is adjudicated under the per-key lock with overlap as a candidate filter. Define two candidate sets (same-kind for evidence; state-ending occurrences for supersede/ contradict only) and a chronological guard. Amend D24 with a temporal_window review kind and its append-only, reversible verdict schema, invariants and replay order. Convert in place from the recorded add adjudication's triggering claim (fact ids and D55 history preserved, shadow-first, resumable). Retraction with unknown source time closes only the belief interval from the persisted reconciliation instant. Canonical bounds truncate both ends and ship as memory_v1.canonical_bounds with a claims_canonical view. One evaluated-at current predicate everywhere, including aggregate/absence, with a durable expiry schedule. Audit 4.20 (aggregates) and 4.21 (claims_as_of example) added; protocol rolls listed per package; the D90 §5.5.3 rule rewritten. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016p9xB9T7VYREuVmohDPKjR --- decisions.md | 135 ++++-- plan/analysis/time_handling_audit.md | 32 +- .../e3_entity_obs_flush_fanout_design.md | 12 +- plan/designs/observations_design.md | 11 +- plan/designs/registries_design.md | 4 +- plan/designs/temporal_clocks_design.md | 393 +++++++++++------- plan/plans/temporal_clocks.md | 20 +- 7 files changed, 379 insertions(+), 228 deletions(-) diff --git a/decisions.md b/decisions.md index 50d6605ef..ba2074a50 100644 --- a/decisions.md +++ b/decisions.md @@ -648,6 +648,16 @@ provenance-stamped, redirect-preserving record (D21). The design is the CLI queu Argilla is an optional addition if review volume ever justifies it, not part of the core design. (R10.) +**Amendment (2026-09-03, D107).** The queue gains a `temporal_window` item +kind for discrepancies between a fact's adjudicated verdict window and its +evidence-derived occurrence window. Its verdict is an append-only, reversible, +provenance-stamped record — target fact, seed claim, old and new canonical +bounds with bases, rationale, reviewer, reversal linkage — checked against +invariants (a start may move earlier, never later; no endpoint moves past a +neighbouring slice; a closed end is never reopened) and replayed +idempotently after caps and retractions. Full contract: +`plan/designs/temporal_clocks_design.md` §4.3. + ## D25. No pre-extraction value/salience gate — junk-control is in-call at E2 Selection + D2 **Decision.** There is **no E1.5 stage and no value/salience gate**. Plane E is `E0 → E1 → E2 → E3`; @@ -5007,37 +5017,58 @@ missing time stays missing. Concretely: (`occurs_from`/`occurs_until`/`occurs_precision`: the union of its evidence's canonical D41 windows). A state's verdict window is its span and its identity; an occurrence is believed from its occurrence start - onward, never capped (D43's no-cap rule extended to events), and is - identified by its occurrence window, so a January and an October visit - are two facts (D106 at the fact layer); an unknown window stays - `NULL`/`unknown`. The said-on date is never written into a window. -2. The verdict is seeded **once** from the seed claim — the first claim in - D90 processing order, exactly as a fresh ingest would — and is never - revised automatically. Attaching evidence recomputes the occurrence window - only. A discrepancy between the two (evidence earlier than the verdict - start; dated evidence on an undated slice) is surfaced as a review item; - only a recorded review verdict, a supersede cap, or a D55 retraction - changes a verdict, and none reopens a closed end (D41). -3. **Temporal succession** is separate from D90's processing order, which is - unchanged: a state is capped only at a world-time instant supplied by its - successor — a successor state's verdict start or an ending occurrence's - start (D106's dated resignation may still end an undated "is CEO" state) - — else the pair coexists, recorded. `now()` is never a boundary; D55 keeps - its source-removal basis and closes on belief-time when unknown. The D90 - late-arrival re-split decides eligibility by the evidence's occurrence - start against the world-time cap, not by `asserted_at`. -4. Precision is honoured through one **canonical-bounds** function that - turns a stored claim window into a half-open interval by its precision (a - year stored 2022-01-01…12-31 is `[2022-01-01, 2023-01-01)`; an `instant` - is a non-empty point; `open` is unbounded). Fact windows are **stored** - canonical at seeding, so every fact predicate and the relations - exclusion constraints read consistent bounds; claim comparisons - canonicalise at query time; claim storage and its `CHECK`s are unchanged. + onward, never capped (D43's no-cap rule extended to events), and has an + **adjudicated** identity under the per-key lock — overlapping occurrence + windows are a candidate filter the D4/D106 ladder judges, never identity + by themselves and never a database exclusion — so a January and an + October visit are two facts, and so are two same-day visits the ladder + judges distinct; an unknown window stays `NULL`/`unknown`. The said-on + date is never written into a window. +2. The verdict is seeded **once** from the seed claim — the claim whose + processing created the row, recorded in `seed_claim_id` and already in + the fact's `add` adjudication — and is never revised automatically. + Attaching evidence recomputes the occurrence window only. A discrepancy + between the two is surfaced as a **`temporal_window` review item** — a + new D24 kind whose append-only, reversible verdict records the target + fact, seed, old and new canonical bounds with bases, reviewer provenance, + reversal linkage and invariants (start earlier never later; no endpoint + past a neighbouring slice; a closed end never reopened, D41) and replays + idempotently after caps and retractions. Only such a verdict, a + supersede cap, or a D55 retraction changes a verdict window. +3. Matching compares an incoming claim against **two candidate sets**: + same-kind facts for evidence, contradiction or novelty, and — for an + incoming occurrence — the open states it may end, eligible for + supersede or contradict only. **Temporal succession** is separate from + D90's processing order, which is unchanged: a state is capped only at a + world-time instant supplied by its successor — a successor state's + verdict start or an ending occurrence's start (D106's dated resignation + still ends an undated "is CEO" state) — and only when that instant is + later than the predecessor's known start; otherwise the pair contradicts + or coexists and a review item is raised. `now()` is never a boundary. D55 + caps with basis `source_removed` when the source supplied the removal + time; when it did not, the world-time end stays `unknown` and only the + belief interval closes, from the persisted reconciliation instant. The + D90 late-arrival re-split decides eligibility by the evidence's + occurrence start against the world-time cap, not by `asserted_at`. +4. Precision is honoured through one **canonical-bounds** function — shipped + as `memory_v1.canonical_bounds` with a `claims_canonical` view and mirrored + in Python — that turns a stored claim window into a half-open interval + with both ends aligned to its precision unit (a year stored + 2022-01-01…12-31 is `[2022-01-01, 2023-01-01)`; a day is the calendar day + whatever the stored time; an `instant` is a non-empty point; `open` is + unbounded; an inclusive request `(t, t)` is a point query). Fact windows + are **stored** canonical at seeding, so every fact predicate and the + relations exclusion read consistent bounds; claim comparisons, saved + examples and open SQL canonicalise through the same function; claim + storage and its `CHECK`s are unchanged. 5. "Current" is one predicate evaluated at an explicit instant (`invalidated_at IS NULL AND (valid_until IS NULL OR valid_until > E)`), - used by every consumer that today tests `valid_until IS NULL`; cached - profiles and K pages carry their earliest future end in their input hash - and are refreshed by an expiry sweep when it passes. + used by every current fact read — the consumers that test + `valid_until IS NULL` today and the aggregate/absence queries that test + only `invalidated_at`; cached profiles and K pages carry their earliest + future end as an expiry instant in their input hash and a durable, + idempotent `fact_expiry_schedule` regenerates them when it passes, with + the read-time predicate as the correctness backstop. 6. Every prompt that compares, merges, ranks, or summarises facts shows the D106 two-clock block (`said on` / `is about`, defined): relation supersession, T4 identity candidates, the K prose writer, the benchmark @@ -5057,16 +5088,19 @@ missing time stays missing. Concretely: 9. Consumer surfaces print a date under a world-time heading only for `world_time`/`verdict` bases, and the consumption skill defines `claims_as_of` over source world-time (D41), not system time. -10. Cutover is stop → drain → migrate → rebuild the fact layer by replay in - D90 order → readiness reports the fact-layer generation and refuses to - serve an older one; a store never mixes pre- and post-D107 fact - semantics. +10. Cutover is stop → drain → migrate → **convert in place** (seed from the + recorded `add` adjudication, windows by kind, existing caps kept, + shadow-first, validated, resumable) → readiness reports the fact-layer + generation and refuses an older one. Fact ids and D55 historical facts + are preserved; a store never mixes pre- and post-D107 fact semantics; + re-adjudicating identities decided under old rules is a fresh rebuild + (D7), not a migration. **Context.** D106 fixed the observation adjudicator merging "won a tournament last week" across a nine-month gap because it never read the claims' resolved windows. The follow-up audit (`plan/analysis/time_handling_audit.md`, revision `02b79904`) found the same -confusion in eighteen more places: relations' `valid_from` is never seeded, +confusion in twenty more places: relations' `valid_from` is never seeded, so a `valid_at` lookup cannot exclude a fact before its true beginning; the relation supersession prompt asks the model about "the same period" while showing only document dates; undated supersessions cap at the ingest @@ -5077,7 +5111,9 @@ D106; the K fact sheet sorts by a said-on date it does not show; the timeline aggregate falls back to ingest year; the answer agent is told to "use timestamps" without being told which; day-precision windows are compared as zero-width points; the consumption skill and the open-query confirmation -surface respectively misdefine and truncate the clocks. The docs +surface respectively misdefine and truncate the clocks; the aggregate and +predicate-absence queries never evaluate `valid_until`; and the shipped +`claims_as_of` example's `unknown` count can never be non-zero. The docs (`/docs/concepts`, `fact_context`'s description) promise world-time semantics the code does not keep. @@ -5088,17 +5124,23 @@ fact by verdict-window overlap recreates the D106 collapse for recurring occurrences and collides with the relations `EXCLUDE`, that an automatic `extend_start` is still the D41-forbidden reduction, that "+ one unit" over-expands normalised ends, that the D90 re-split crossed clocks, and that -succession restricted to dated states lost D106's ending-event case — hence -the temporal kind, occurrence-window identity, review-only revision, -canonical bounds, and the succession and re-split rules above. +succession restricted to dated states lost D106's ending-event case. The +third showed that an occurrence exclusion constraint contradicts adjudicated +identity, that kind-routed matching made D106's cross-kind cap unreachable, +that "review item" named no verdict schema, that a replay rebuild erases +D55 history and re-picks seeds, and that belief-time was leaking into a +world-time endpoint — hence the temporal kind, adjudicated occurrence +identity, the two candidate sets and chronological guard, the +`temporal_window` verdict, canonical bounds in SQL and Python, and the +in-place conversion above. **Consequences.** `valid_at` / `facts_as_of` become true on both fact planes; recurring occurrences stay distinct facts on both planes; histories are rebuild-stable (D7) because no boundary depends on ingest time and the seed is the replay-first claim; the two fact planes agree on undated testimony; readers, profiles and compiled pages see resolved dates as labels while -statements keep source wording. Costs: one migration (seven columns and -three constraints across the two fact tables), generation rolls for the +statements keep source wording. Costs: one migration (seven columns, a partial exclusion, a unique key, +an expiry schedule, a review kind, and the query-space function and view), generation rolls for the extractor, normaliser, both adjudicators and the flush component, four assured-operation version rolls, a fact-layer rebuild of existing stores (re-seeding reads the claim rows already present), an expiry sweep for @@ -5110,9 +5152,11 @@ is extraction coverage of the D41 kinds. **Rejected.** Seeding windows from the said-on date (provenance is not validity); seeding a measurement's or event's end from its claim (D43 no-cap); matching every fact by verdict-window overlap (recreates D106 for -occurrences; collides with the `EXCLUDE`); automatic earliest-evidence start -revision (D41 reduction); half-open claim storage (empties `instant`) and -"+ one unit" effective ends (over-expand normalised bounds); one coalesced +occurrences); an occurrence exclusion constraint (contradicts adjudicated +identity); automatic earliest-evidence start revision (D41 reduction); a +replay rebuild (erases D55 history, replaces referenced fact ids); half-open +claim storage (empties `instant`) and "+ one unit" ends with raw starts +(over-expand and misalign); one coalesced key for processing and succession (D90); succession only between dated states (loses D106's ending event); capping at a retrospective's said-on date; baking the resolved date into the observation statement (D43 @@ -5127,7 +5171,8 @@ identity); nineteen local patches; keeping `now()` as the undated cap (D7). **Sequencing.** `plan/plans/temporal_clocks.md`. -**Amends.** D41's consequences become binding mechanics (claim windows seed +**Amends.** D24 (a `temporal_window` review kind with its verdict schema); +D41's consequences become binding mechanics (claim windows seed fact verdicts once; the retrospective guard holds; revisions are review verdicts); the observations design §3 (matching by kind, the cap boundary, succession, the no-cap rule extended to events); D88/D90 (processing order @@ -5136,4 +5181,4 @@ world-time cap); D106 (its two-clock prompt block becomes the engine-wide contract; its ending-event supersession is preserved; its `valid_from` seeding gap is closed); D55 (unknown source time closes on belief-time, never `now()`); D49 (additive envelope fields; four operation versions roll). -Preserves D3, D6, D24, D32, D43's untyped statement, D98, D100–D105. +Preserves D3, D6, D32, D43's untyped statement, D98, D100–D105. diff --git a/plan/analysis/time_handling_audit.md b/plan/analysis/time_handling_audit.md index ac42f1bff..5c80fa5ed 100644 --- a/plan/analysis/time_handling_audit.md +++ b/plan/analysis/time_handling_audit.md @@ -7,8 +7,8 @@ binding contract is `plan/designs/temporal_clocks_design.md`. **Revision audited:** `02b79904` (the merge of D106). Line numbers below are for that revision; function and statement names are the stable anchors. -Findings 4.2, 4.5, 4.6, 4.12, 4.13, 4.14 and 4.15 were narrowed after two -independent Codex reviews verified each against the code; 4.18 and 4.19 were +Findings 4.2, 4.5, 4.6, 4.12, 4.13, 4.14 and 4.15 were narrowed after three +independent Codex reviews verified each against the code; 4.18–4.21 were added from those reviews. ## 1. Question @@ -292,6 +292,24 @@ occurrence time at all. An agent on this public path cannot tell a point from a coarse period, an open interval, or an unknown, even after is-about filters exist. +### 4.20 Aggregates and predicate absence never evaluate `valid_until` (P1) + +`src/rememberstack/surfaces/query_engine.py` — `_AGG_COUNT` (`:4246`) and +its group variants, and `_AGG_PREDICATE_ABSENCE` (`:4335`) select "live" +relations by `invalidated_at IS NULL` alone. Today every relation is +open-ended (4.2), so the omission is invisible; once a state can carry a +finite end, an expired relation keeps counting and can block a true absence +answer, against D49's rule that current fact-grain answers are +validity-filtered. + +### 4.21 The shipped `claims_as_of` example cannot count what it excludes (P3) + +The saved `claims_as_of` example reports its `unknown`-precision exclusion +by combining `precision = 'unknown'` with a non-null bound comparison; D41's +`CHECK` makes an unknown-precision claim's bounds `NULL`, so the count is +permanently zero. (Reported by the third independent review; the fix rides +the query-space canonicalisation of design §5.) + ## 5. Checked and sound Absence of a finding above is a result, not an omission: @@ -311,9 +329,11 @@ Absence of a finding above is a result, not an omission: `claim_valid_from`, discloses `excluded_unstamped`; only 4.13's boundary semantics apply. - **The evidence-grain envelope** (`model/envelope.py:280-302`) — carries all - five D41 fields beside `asserted_at`; every confirmation query selects them. - D41's promise that evidence payloads surface `claim_valid_from/until` is - kept. The fact-grain `Validity` (`:171-179`) is where the conflation lives. + five D41 fields beside `asserted_at`, and the `EvidenceResult` hydration + queries select them (`query_engine.py:3881-3933`, `:3995-3996`). D41's + promise that evidence payloads surface `claim_valid_from/until` is kept + there; the open-query confirmation path is the exception (4.19). The + fact-grain `Validity` (`:171-179`) is where the conflation lives. - **Belief-time plumbing** (`query_engine.py:3463-3483`; migration `p9_03_0024_facts_as_of.py:92-95`) — the transaction-time axis is separate and sound. @@ -327,7 +347,7 @@ Absence of a finding above is a result, not an omission: every D106 coercion is recorded, so all of the above is diagnosable from the audit tables without a rerun. -## 6. Why this is one decision, not nineteen fixes +## 6. Why this is one decision, not twenty-one fixes Every finding is the same confusion: the engine resolves world-time once, at extraction, and then reasons on the source's date. The fix that closes all of diff --git a/plan/designs/e3_entity_obs_flush_fanout_design.md b/plan/designs/e3_entity_obs_flush_fanout_design.md index 1f9f27e01..12362f493 100644 --- a/plan/designs/e3_entity_obs_flush_fanout_design.md +++ b/plan/designs/e3_entity_obs_flush_fanout_design.md @@ -248,10 +248,14 @@ Entity-global merge only sees **unapplied** staging. If unit A fully applied materializes `{t2:B}`, a plain supersede of open A at t2 yields `A[t1,t2), B[t2,∞)` and loses A-at-t3. -**Required:** when an apply caps open observation O at boundary T, any **evidence -claims** (or reassertions) already attached to O with `asserted_at > T` (total -order) must be re-materialized as subsequent open slices after the cap — not left -only as evidence on a capped row. Concretely the staggered acceptance case: +**Required (as amended by D107):** when an apply caps open observation O at the +world-time boundary T, any **state evidence claims** (or reassertions) already +attached to O whose canonical occurrence start (`temporal_clocks_design.md` §5) +is later than T must be re-materialized as subsequent open slices after the +cap — not left only as evidence on a capped row. `asserted_at` remains the +total *work* order of §5.5 and plays no part in this eligibility test; undated +attached evidence is never re-split. (Before D107 this rule compared +`asserted_at > T`; that compared a said-on clock to a world-time boundary.) Concretely the staggered acceptance case: 1. Fully succeed unit A `{t1:A, t3:A}` alone. 2. Later materialize/apply unit B `{t2:B}`. diff --git a/plan/designs/observations_design.md b/plan/designs/observations_design.md index bb9b42072..b126b3689 100644 --- a/plan/designs/observations_design.md +++ b/plan/designs/observations_design.md @@ -6,12 +6,13 @@ > recorded seed claim), seeded once from the D90-first claim's canonical D41 > window — a state's span; an occurrence believed from its start onward and > never capped; `NULL`/`unknown` when undated — and a derived occurrence -> window (`occurs_*`) that widens as evidence attaches. Occurrences are -> identified by occurrence-window overlap, so recurring events stay distinct -> rows; the D106 rung is unchanged and compares canonical bounds. The said-on +> window (`occurs_*`) that widens as evidence attaches. Occurrence identity +> is adjudicated under the entity lock — overlapping windows are a candidate +> filter the D106 rung judges, never identity — so recurring events stay +> distinct rows; the rung compares canonical bounds. The said-on > date is never a boundary. No verdict changes automatically (discrepancies -> become review items); a state is capped only at a world-time instant its -> successor supplies — a successor state's start or an ending occurrence's +> become `temporal_window` review verdicts, D24); a state is capped only at a +> world-time instant its successor supplies, later than its own known start — a successor state's start or an ending occurrence's > start, so a dated resignation still ends an undated "is CEO" state — else > the pair coexists, never `now()`. D90's staging order is unchanged; its > re-split decides by occurrence start. Contract: `temporal_clocks_design.md` diff --git a/plan/designs/registries_design.md b/plan/designs/registries_design.md index 635d071d3..8578c8c83 100644 --- a/plan/designs/registries_design.md +++ b/plan/designs/registries_design.md @@ -4,8 +4,8 @@ > each salient fact's occurrence window and bases, ranked by evidence then > occurrence recency (never `updated_at`); the relation supersession prompt > and its evidence laterals show both clocks (`said on` / `is about`) as -> `temporal_clocks_design.md` §6 requires; evidence-target matching, verdict -> revision and temporal succession follow §4.2–§4.4. +> `temporal_clocks_design.md` §7.2 requires; matching, verdict revision and +> temporal succession follow §4.2–§4.4. > **Binding D102 amendment (2026-08-31).** T0 remains candidate-only globally. > One current `T4_small` match may establish a derived exact-name binding inside diff --git a/plan/designs/temporal_clocks_design.md b/plan/designs/temporal_clocks_design.md index 746c001dc..6e6de1f8c 100644 --- a/plan/designs/temporal_clocks_design.md +++ b/plan/designs/temporal_clocks_design.md @@ -2,10 +2,10 @@ **Status:** binding under D107 -**Date:** 2026-09-03 (third revision the same day, after two independent -Codex design reviews; §10 records what each round withdrew) +**Date:** 2026-09-03 (fourth revision the same day, after three independent +Codex design reviews; §11 records what each round withdrew) -**Analysis:** `plan/analysis/time_handling_audit.md` (nineteen findings at +**Analysis:** `plan/analysis/time_handling_audit.md` (twenty-one findings at `02b79904`, each cited by file and function) **Builds on:** D41 (claims carry an immutable, source-asserted validity @@ -14,8 +14,9 @@ a reduction over claim columns, never reopened by a late retrospective), D3/D4 (supersession over verdicts; the cheap-first cascade), D43 (observations; the no-cap rule for fixed-period figures), D88/D90 (continuous-ingest processing order and the late-arrival re-split), D106 -(temporal compatibility in observation adjudication), D24 (review verdicts), -D7/D12 (rebuild and generations), D55 (retraction), D49 (envelopes). +(temporal compatibility in observation adjudication), D24 (append-only, +reversible review verdicts — amended here), D7/D12 (rebuild, generations, +idempotency), D55 (retraction), D49 (envelopes). > **Reading this cold.** RememberStack extracts **claims** (what a source > said, immutable) and adjudicates them into **facts** — relations between @@ -31,9 +32,10 @@ D7/D12 (rebuild and generations), D55 (retraction), D49 (envelopes). The engine resolves world-time once, at extraction, and then most later stages — fact windows, supersession, ordering, deduplication, prompts, -summaries, filters, timelines — reason on the *source's own date* instead. -The audit lists nineteen instances; D106 fixed one. This design closes the -class without creating a second validity authority. +summaries, filters, timelines, aggregates — reason on the *source's own +date* instead, or on no date at all. The audit lists twenty-one instances; +D106 fixed one. This design closes the class without creating a second +validity authority. ## 2. The three clocks and the two rules @@ -57,45 +59,45 @@ resolved bounds are; a start with `claim_valid_until IS NULL` is **open**; orders processing; it is never a window boundary. - **Rule 2 — a missing time stays missing.** An unknown is-about window leaves a fact's windows `NULL` with basis `unknown`. Nothing is ever filled - with `now()` or with the said-on date; an undated fact never caps another - and is never capped; it coexists, recorded. + with `now()`, with the said-on date, or with belief-time; an undated fact + never caps another and is never capped; it coexists, recorded. ## 3. Two kinds of fact, two windows -The audit's confusions come from asking one column to be several things. Every fact (relation or observation) carries a **temporal kind** and two windows with different authority: | `temporal_kind` | seeded from claim kind | what the fact says | identity | | --- | --- | --- | --- | -| `state` | `effective_period`, `proposition_validity` | something held over a span ("was CEO 2015–2018") | key + **verdict window** overlap | -| `occurrence` | `event_time`, `measurement_period` | something happened, or a figure for a span ("won the final on 2022-11-05"; "FY2023 revenue was $5M") | key + **occurrence window** overlap | +| `state` | `effective_period`, `proposition_validity` | something held over a span ("was CEO 2015–2018") | key + **verdict window** (disjoint slices per key; the relations `EXCLUDE`) | +| `occurrence` | `event_time`, `measurement_period` | something happened, or a figure for a span ("won the final on 2022-11-05"; "FY2023 revenue was $5M") | key + an **adjudicated** occurrence identity (§4.2) — windows may overlap | | `undated` | `NULL` | the source tied nothing to a date | key (+ statement wording for observations) | | Window | Columns | Authority | Changes when | | --- | --- | --- | --- | -| **verdict window** | `valid_from` / `valid_until` (existing), `valid_from_basis` / `valid_until_basis` (new, `NOT NULL DEFAULT 'unknown'`: `world_time`, `verdict`, `source_removed`, `unknown`), `seed_claim_id` (new) | the adjudicator's single recorded verdict (D3/D41/D43): over which span the fact is believed to have held | seeded **once** at insert from the seed claim (§4.1); afterwards only by a recorded verdict: a supersede cap (§4.4), a review verdict (§4.3), a D55 retraction — never automatically | -| **occurrence window** | `occurs_from` / `occurs_until` / `occurs_precision` (new, nullable) | **non-authoritative** derived metadata: the union of the canonical D41 windows of the fact's current-testimony evidence — the aggregate D106 already computes at block time | recomputed whenever evidence attaches or is withdrawn (the recount path); it never writes to the verdict window | +| **verdict window** | `valid_from` / `valid_until` (existing), `valid_from_basis` / `valid_until_basis` (new, `NOT NULL DEFAULT 'unknown'`: `world_time`, `verdict`, `source_removed`, `unknown`), `seed_claim_id` (new) | the adjudicator's single recorded verdict (D3/D41/D43): over which span the fact is believed to have held | seeded **once** at insert from the seed claim (§4.1); afterwards only by a recorded verdict: a supersede cap (§4.4), a `temporal_window` review verdict (§4.3), a D55 retraction — never automatically | +| **occurrence window** | `occurs_from` / `occurs_until` / `occurs_precision` (new, nullable) | **non-authoritative** derived metadata: the union of the canonical D41 windows of the fact's current-testimony evidence — the aggregate D106 already computes at block time | recomputed whenever evidence attaches or is withdrawn (the recount path); a database check forbids it from writing the verdict window | Why two kinds and two windows: a measurement is *about* FY2023 but is *believed* from the day it was reported onward and is never capped (D43's no-cap rule); a past event is about one day but stays a believed fact -forever — and a second, later occurrence of the same key is a **different -fact**, not corroboration (D106); a state is about the same span it is -believed to have held and is what supersession caps. Occurrences therefore -have an open verdict window `[occurs_from, ∞)` that is *not* their identity; -states have a verdict window that *is*. D41's boundary holds: the verdict is -single-valued and recorded; the occurrence window is evidence-derived and -cannot mutate it. +forever — and a later occurrence of the same key is a **different fact**, +not corroboration (D106); a state is about the same span it is believed to +have held and is what supersession caps. Occurrences therefore have an open +verdict window `[occurs_from, ∞)` that is *not* their identity; states have a +verdict window that *is*. D41's boundary holds: the verdict is single-valued +and recorded; the occurrence window is evidence-derived and cannot mutate +it. ## 4. Fact windows: seeding, matching, revising, closing ### 4.1 Seeding at insert (once, from the seed claim) -The **seed claim** is the first claim for the fact in D90 processing order — -exactly the claim that creates the row in a fresh ingest — and is recorded -in `seed_claim_id`, so a rebuild (§9) reproduces the same seed. Windows are -the claim's **canonical bounds** (§5): +The **seed claim** is the claim whose processing created the fact row — the +first claim for it in D90 processing order in a fresh ingest — recorded in +`seed_claim_id` and in the fact's `add` adjudication row (its +`triggering_claim_id`, which both fact planes already write). Windows are +the seed claim's **canonical bounds** (§5): | seed claim kind | `temporal_kind` | `valid_from` | `valid_until` | bases | `occurs_*` | | --- | --- | --- | --- | --- | --- | @@ -108,62 +110,83 @@ prior closed slice's end) applies **only** when the seed's start is provably later than that end — a chronological successor; an older spell discovered late is inserted as its own closed slice (§4.2). -### 4.2 Matching evidence to facts, by kind - -Matching runs in this order: the entity/key block (unchanged), then -temporal-kind identity (this section), then the D4/D106 ladder for the -verdict. Overlap is the canonical half-open predicate of §5. - -**State claims** (`effective_period` / `proposition_validity`): - -1. the claim's canonical window overlaps a live `state` slice's verdict - window → attach as evidence; the verdict is untouched; `occurs_*` - recomputes; -2. no overlap → a **new closed or open slice** (a distinct spell; the - relations `EXCLUDE` on state slices permits disjoint ranges); -3. an overlap with a *different value* of the same property is the - supersede/contradict question the ladder answers (§4.4), not a matching - question. - -**Occurrence claims** (`event_time` / `measurement_period`): - -1. the claim's canonical window overlaps a live `occurrence` fact's - `occurs_*` window → the ladder decides `evidence` (same occurrence - re-mentioned; `occurs_*` widens), `contradict` (same occurrence, disputed - detail), or `new`; -2. no overlap → a **new occurrence fact**. Two visits, two wins, two - quarterly figures are two rows; this is D106's rule applied to relations - as well as observations. - -**Undated claims** (`NULL` kind): - -- observations: D106's mixed rule — an undated statement never attaches to - a dated occurrence and a dated event never attaches to an undated - statement; identical wording collapses onto an existing `undated` row of - the same key, otherwise a new `undated` row; -- relations: the triple *is* the content, so an undated claim attaches to - the single open `state` slice if exactly one exists, else to the single - `undated` row for the key (creating it once); it never attaches to an - `occurrence` and never creates a second unbounded slice. - -**Relations schema.** The existing GiST `EXCLUDE` on -`(subject, predicate, object) && tstzrange(valid_from, valid_until)` applies -`WHERE temporal_kind = 'state'` only; occurrence relations get an `EXCLUDE` -on `(subject, predicate, object) && tstzrange(occurs_from, occurs_until)`, -and `undated` relations a unique key on the triple. Observations keep no -constraint (D43) and rely on this matching plus the D106 rung. - -### 4.3 Revising a verdict: review only - -No automatic path changes a verdict window after seeding. When attached -evidence's occurrence start precedes a `state` slice's verdict start (or a -slice with an unknown window gains dated evidence), the discrepancy is -visible in the envelope (`occurs_from < valid_from`, or bases `unknown` -beside a dated `occurs_*`) and is raised as a **review item** (D24). A -reviewer's verdict may move the start earlier or date the slice, recorded -with rationale and basis `verdict`, and may never reopen a closed end -(D41's retrospective guard). Rebuild replays review verdicts as it replays -caps (D7). +### 4.2 Matching: two candidate sets, then the ladder + +All matching for one key runs under the per-key advisory lock the +observation path already takes, so identity decisions are serialised and no +database exclusion is needed to keep them consistent. After the entity/key +block (unchanged), an incoming claim is compared against **two candidate +sets**: + +- **same-kind candidates** — live facts of the same key and the same + `temporal_kind`, eligible for evidence attachment (`evidence`), for + `contradict`, or for `new`; +- **state-ending candidates** — for an incoming `occurrence` claim only: the + open `state` slices of the same key (or, for observations, the same + entity), eligible **only** for `supersede` or `contradict` (§4.4), never + for evidence. This is the cross-kind comparison D106's dated resignation + needs to end an "is CEO" state. + +Within the same-kind set, by kind: + +**States.** The incoming canonical window overlapping a live `state` slice's +verdict window → evidence attaches; the verdict is untouched; `occurs_*` +recomputes. No overlap → a **new slice** (a distinct spell; disjoint ranges +satisfy the relations `EXCLUDE`, which applies `WHERE temporal_kind = +'state'`). An overlap with a *different value* of the same property is the +supersede/contradict question the ladder answers (§4.4). + +**Occurrences.** Overlap of canonical windows is the *candidate filter*, not +identity: the D4/D106 ladder decides, with both clocks shown (§7.2), +`evidence` (the same occurrence re-mentioned; `occurs_*` widens), +`contradict` (the same occurrence, disputed detail; both stand, grouped), or +`new` (a different occurrence that merely overlaps — two visits on one day, +a day-precision and an instant-precision claim about different things). +Disjoint windows are always `new`. There is **no** occurrence exclusion +constraint: overlapping occurrence rows of one key are legal and expected, +a union expansion that comes to overlap a neighbouring occurrence never +merges rows, and the advisory lock plus the recorded verdict are what +prevent duplicates. Acceptance covers same-key recurring events, coarse and +fine precision overlap judged `new`, and a union expansion bridging two +existing occurrences. + +**Undated claims.** Observations follow D106's mixed rule — an undated +statement never attaches to a dated occurrence and a dated event never +attaches to an undated statement; identical wording collapses onto an +existing `undated` row of the same key, otherwise a new `undated` row. +Relations: the triple *is* the content, so an undated claim attaches to the +single open `state` slice if exactly one exists, else to the single `undated` +row for the key (creating it once); it never attaches to an `occurrence` and +never creates a second unbounded slice. + +**Relations schema.** The existing GiST `EXCLUDE` on `(subject, predicate, +object) && tstzrange(valid_from, valid_until)` becomes partial on +`temporal_kind = 'state'`; `undated` relations get a unique key on the +triple; occurrence relations have no constraint (adjudicated identity under +the lock, as observations always have). + +### 4.3 Revising a verdict: a `temporal_window` review verdict (amends D24) + +No automatic path changes a verdict window after seeding. A discrepancy — +attached evidence whose occurrence start precedes a `state` slice's verdict +start, or dated evidence attaching to a slice with an unknown window — is +surfaced in the envelope (`occurs_from < valid_from`; bases `unknown` beside +a dated `occurrence`) and raised as a review item of a new kind, +`temporal_window`, in the D24 queue. Its verdict record is append-only, +reversible, and provenance-stamped like every D24 action: + +| field | meaning | +| --- | --- | +| `target_fact_id`, `temporal_kind` | the fact whose verdict window is revised (stable identity) | +| `seed_claim_id` | the seed as recorded at the time of the verdict | +| `old_valid_from`/`old_valid_until` with bases; `new_valid_from`/`new_valid_until` with bases | canonical bounds before and after; a new endpoint's basis is `verdict` | +| `rationale`, `reviewer`, `decided_at` | provenance | +| `reverses_verdict_id` | set on a reversal; a reversal restores the prior bounds and bases | +| `invariants` | checked before apply: the start may move earlier, never later; no endpoint moves past a neighbouring slice's bound; a closed end is never reopened (D41); a `state`'s end, when set, is later than its start | + +Verdicts apply in `decided_at` order after caps and retractions on the +same fact, are idempotent by `verdict_id`, and are replayed in that order on +rebuild (D7). Anything the invariants refuse stays a review item. ### 4.4 Closing: temporal succession, separate from processing order @@ -176,21 +199,29 @@ verdict caps the predecessor at a **world-time instant supplied by the successor**: - a successor `state`'s verdict start (basis `world_time` or `verdict`); or -- an **ending occurrence** the ladder matched as superseding (D106's dated - resignation ending an "is CEO" state, which may itself have an unknown - start), at the occurrence's canonical start. - -The predecessor's own start basis is irrelevant. When the successor supplies -no world-time instant (an undated successor), there is no succession: the -pair **coexists** and the adjudication row records `reason = "no world-time +- an **ending occurrence** from the state-ending candidate set (§4.2) that + the ladder judged `supersede`, at the occurrence's canonical start — so a + dated resignation ends an "is CEO" state whose own start may be unknown. + +**Chronological guard:** the boundary must be later than the predecessor's +known verdict start; a boundary at or before a known start is not a cap — +the ladder's outcome is recorded and the pair routes to `contradict` +(both stand, grouped) when the values conflict, otherwise coexists, and in +either case a `temporal_window` review item is raised. The predecessor's own +start basis is otherwise irrelevant. When the successor supplies no +world-time instant (an undated successor), there is no succession: the pair +**coexists** and the adjudication row records `reason = "no world-time boundary -> coexist"`. The cap's basis is `verdict`. Relation supersession -and observation supersession share this one rule (today they disagree about -undated testimony). `now()` is never a boundary. +and observation supersession share this one rule. `now()` is never a +boundary. -D55's retraction boundary — the withdrawing document version's source time — -is a *source action*, not a temporal inference; it keeps basis -`source_removed`, and when that time is unknown a retracted state closes on -belief-time (`invalidated_at`) rather than at `now()`. +**Retraction (D55).** The withdrawing document version's source time is a +*source action*: when known, it caps the state with basis `source_removed`. +When it is unknown, the world-time end stays `unknown` and only the belief +interval closes — `invalidated_at` set from the **persisted reconciliation +event's timestamp**, never from the database clock — so a rebuild replays the +same instant and no world-time endpoint is ever labelled with a basis the +source did not supply. **Residual, measured rather than assumed:** undated, differently worded restatements of a changing state coexist as `undated` rows instead of @@ -207,8 +238,8 @@ canonical occurrence start to `T` — not its `asserted_at`, which stays the total work order only. Undated attached evidence is never re-split (it coexists on the slice it attached to). The staggered acceptance case gains a variant in which said-on order and is-about order are deliberately reversed -and the final slices must follow the world. This amends the D90 design -(`e3_entity_obs_flush_fanout_design.md` §5.5.3). +and the final slices must follow the world. The D90 design's §5.5.3 is +rewritten to this rule. ### 4.6 Statements stay canonical; dated labels are derived @@ -225,28 +256,38 @@ yield one label from the union window at the coarser precision. Claim storage is unchanged (inclusive bounds; `instant` as `until = from`; `open` as a `NULL` end; the schema `CHECK`s as they are). One function, -`canonical_bounds(from, until, precision) → [start, end_exclusive)`, -converts a stored claim window to a **half-open** interval: +`canonical_bounds(from, until, precision) → [start, end)`, converts a stored +claim window to a **half-open** interval, aligning **both** ends to the +precision unit in UTC (D41 bounds are timezone-aware; the calendar is the +proleptic Gregorian calendar PostgreSQL's `date_trunc` uses): | `claim_valid_precision` | canonical `[start, end)` | | --- | --- | -| `day` / `month` / `quarter` / `year` | `[from, date_trunc(unit, until) + unit)` — a year stored as 2022-01-01…2022-12-31 becomes `[2022-01-01, 2023-01-01)`; a day 2023-05-07 becomes `[05-07 00:00, 05-08 00:00)` | +| `day` / `month` / `quarter` / `year` | `[date_trunc(unit, from), date_trunc(unit, until) + unit)` — a year stored 2022-01-01…2022-12-31 becomes `[2022-01-01, 2023-01-01)`; a day whose stored start is noon on 2023-05-07 still becomes `[05-07 00:00, 05-08 00:00)` | | `instant` | `[t, t + 1 µs)` — a non-empty point | -| `open` | `[from, NULL)` (unbounded) | +| `open` | `[date_trunc(day, from), NULL)` when the source gave a date, `[from, NULL)` when it gave an instant; unbounded end | | `unknown` | no interval; never matches a window predicate and is disclosed as excluded | -**Fact windows are stored canonical.** `valid_from`/`valid_until` and -`occurs_from`/`occurs_until` are written from `canonical_bounds` at seeding, -so every fact predicate the engine already has — `valid_until > :as_of`, -`tstzrange(valid_from, valid_until)` in the `EXCLUDE`, the P1 `FactTime` -selectors — is correct without a precision column; `occurs_precision` is kept -for labels only. **Claim comparisons canonicalise at query time** — -`claims_as_of`, D106's `_windows_disjoint`, §4.2 matching, the §7 dedupe key -and filters all call the same function — so a day-precision claim is found -by an intraday query and two same-day events from different wordings -overlap. The overlap predicate is `a.start < b.end AND b.start < a.end` with -`NULL` ends as +∞; no second predicate for points is needed because an -instant is a non-empty interval. +The overlap predicate is `a.start < b.end AND b.start < a.end` with `NULL` +ends as +∞. A caller's inclusive request `claims_as_of(from, to)` converts +to `[from, to + 1 µs)`, so `from == to` is a point-in-time query, not an +empty one. + +**Where it runs.** The function ships as one immutable SQL function in the +`memory_v1` query space (`memory_v1.canonical_bounds`) with a companion +`claims_canonical` view exposing `canon_start`/`canon_end` beside the raw +columns, so saved examples, open SQL, the catalog metadata and the +open-query prose use the same canonicalisation as the engine; the Python +side calls the same definition. **Fact windows are stored canonical** — +`valid_from`/`valid_until` and `occurs_from`/`occurs_until` are written from +`canonical_bounds` at seeding, so every fact predicate the engine already +has (`valid_until > :as_of`, `tstzrange(valid_from, valid_until)` in the +`EXCLUDE`, the P1 `FactTime` selectors) is correct without a precision +column; `occurs_precision` is kept for labels only. **Claim comparisons +canonicalise at query time** — `claims_as_of`, D106's `_windows_disjoint`, +§4.2 matching, the §7 dedupe key and filters. Acceptance covers adjacent +boundaries, equality queries, non-aligned stored inputs, and existing claim +rows. ## 6. Extraction: vocabulary and anchor @@ -255,27 +296,36 @@ The extractor prompt defines and exemplifies **all four kinds** and `open` was $5M" → `measurement_period`, `year`; "worked at Acme from 2015 to 2018" → `effective_period`, `year`), and the structured-output model describes each field. The document header shown to the extractor carries the **full -source timestamp**, so offset expressions ("three hours ago", "an hour -before this was written") resolve to instants and two same-day sources are -distinct anchors. Expressions the precision enum cannot represent ("this -morning" has no part-of-day precision) remain unresolved by design — a -documented expressivity boundary, not a defect of the anchor. +source timestamp**, so offset expressions ("three hours ago") resolve to +instants and two same-day sources are distinct anchors. Expressions the +precision enum cannot represent ("this morning" has no part-of-day +precision) remain unresolved by design — a documented expressivity boundary, +not a defect of the anchor. ## 7. Every temporal judgement sees both clocks; every surface names them -### 7.1 The current-fact predicate +### 7.1 The current-fact predicate and expiry "Current" is one predicate evaluated at an explicit instant `E`: `invalidated_at IS NULL AND (valid_until IS NULL OR valid_until > E)`. Occurrences and undated facts are always current (open verdict). A `state` -with a finite **future** end is current until it passes. Every consumer that -today tests `valid_until IS NULL` — entity profiles, source-removal -eligibility, K routing, `facts_current` — uses this predicate with `E` fixed -per evaluation, and cached artifacts (profiles, K pages) include the earliest -future `valid_until` among their inputs in their input hash and are queued -for refresh by an **expiry sweep** when that instant passes, so the hash -cannot go stale silently as wall time moves (the concern the profile code -records today). +with a finite **future** end is current until it passes. **Every** current +fact read uses this predicate with `E` fixed per evaluation — the consumers +that today test `valid_until IS NULL` (entity profiles, source-removal +eligibility, K routing, `facts_current`) *and* the ones that today test +only `invalidated_at` (the `aggregate` count/group queries and the +predicate-absence query, which would otherwise keep counting an expired +relation and block a true absence answer; D49 requires fact-grain answers to +be validity-filtered). + +Cached artifacts (profiles, K pages) carry the earliest future +`valid_until` among their inputs as an explicit **expiry instant** in their +input hash, and a durable, indexed `fact_expiry_schedule` (keyed by the +artifact, the endpoint instant, and the generation; D12 idempotent) queues +regeneration when that instant passes, with the boundary instant as the +evaluation time `E`; restart catches up from the schedule. The read-time +predicate remains the correctness backstop, so a late sweep can delay a +refresh but never serve an expired fact as current. ### 7.2 Prompts @@ -315,7 +365,9 @@ answer agent, which additionally names the envelope fields (`asserted_at`, artifacts, and the benchmark protocol roll with them. - The open-query confirmation surface (`query_sandbox/nomination.py`) returns the complete D41 tuple for claim rows and bases/occurrence/kind for fact - rows. + rows; the shipped `claims_as_of` saved example counts `unknown` precision + by precision alone (its current bound-based count can never be non-zero + under D41's checks) and reads through `claims_canonical`. ### 7.4 Dedupe, filters, timeline, profiles @@ -345,36 +397,54 @@ time. - Generations: the extractor (kinds, header), the normaliser (kind and seeding), both adjudicators (matching by kind, succession, re-split), the - `adjudicate_observations` flush component, P1 labels, K page generation. + `adjudicate_observations` flush component, P1 labels and selection, K page + generation, and the query space (`canonical_bounds`, `claims_canonical`). - Versions: the assured operations of §7.3, the surface and query-space - manifests, OpenAPI/SDK, and the LoCoMo protocol — each landed work package - that changes ingestion provenance or the assured surface rolls it; + manifests, OpenAPI/SDK, and the LoCoMo protocol. **Any package whose + observable result semantics change rolls the protocol**, including ones + whose JSON shape does not (canonical comparison changes `claims_as_of` + results; labels, P1 selection and profile ranking change answer inputs); packages released together roll it once. Scores across a roll are directional. -## 9. Cutover: stop, drain, migrate, rebuild, then serve +## 9. Cutover: in-place conversion that preserves identity and history -A store never mixes pre- and post-D107 fact semantics: +A store never mixes pre- and post-D107 fact semantics, and conversion never +replaces a fact row — fact ids are provenance handles referenced by +evidence, review payloads and K citations, and D55 keeps historical facts +with no current support, which a replay from current testimony would erase. 1. **stop** intake and **drain** in-flight units (the D106 contract lets pre-roll observation units complete under their own generation); 2. **migrate** — add the new columns (`temporal_kind`, the two bases, - `occurs_from`/`occurs_until`/`occurs_precision`, `seed_claim_id`), the - state-only `EXCLUDE`, the occurrence `EXCLUDE`, the undated unique key; -3. **rebuild the fact layer** by replaying the current-testimony claims in - D90 processing order through the new normaliser and adjudicators (D7): - the first claim per fact seeds it, exactly as a fresh ingest would, so - the seed is reproducible; existing verdict rows are replaced, not - reinterpreted; recorded review verdicts and D55 retractions replay after - the caps; + `occurs_from`/`occurs_until`/`occurs_precision`, `seed_claim_id`), make + the relations `EXCLUDE` partial on `state`, add the `undated` unique key, + the `fact_expiry_schedule` table, the `temporal_window` review kind, and + the `memory_v1` canonicalisation function and view; +3. **convert in place**, per fact, idempotently and in batches: `seed_claim_id` + := the `triggering_claim_id` of the fact's recorded `add` adjudication + (present on both planes, so the seed is the claim that actually created + the row — history-preserving, not a re-pick); `temporal_kind` and the + verdict window := from that seed claim's kind and canonical bounds by + §4.1, keeping any existing cap end (an existing `valid_until` set by a + recorded supersede or retraction keeps basis `verdict` / `source_removed`, + and a cap that the chronological guard would refuse is flagged for + review rather than dropped); `occurs_*` := the union over current + evidence; bases as derived. Conversion runs shadow-first (computed into + staging columns, validated against the invariants of §4.3, then swapped in + one transaction per batch) and resumes after a crash from the last + validated batch; 4. **readiness** reports the fact-layer generation; consumers refuse to serve a store whose fact generation predates D107; 5. **rollback** is restore of the pre-migration backup, as for any generation roll. -Only §6's added kinds benefit from re-extraction; steps 1–4 need none. +Conversion does not re-adjudicate identity decisions made under the old +rules: two occurrences a pre-D106 adjudicator merged stay one row until an +operator chooses a full rebuild of a fresh store (D7), which is a re-ingest, +not a migration. Only §6's added kinds benefit from re-extraction. -## 10. Alternatives considered, including what the two reviews withdrew +## 10. Alternatives considered - **Seed `valid_from` from the said-on date when the window is unknown** (revision 1). Withdrawn: provenance is not validity (Rule 2). @@ -382,31 +452,40 @@ Only §6's added kinds benefit from re-extraction; steps 1–4 need none. (revision 1). Withdrawn: D43 never caps a fixed-period figure; the period belongs to the occurrence window. - **Match every fact by verdict-window overlap** (revision 2). Withdrawn: an - occurrence's open verdict window overlaps every later occurrence, which - recreates the D106 collapse and collides with the relations `EXCLUDE`; - occurrences are matched by `occurs_*` and have their own exclusion. + occurrence's open verdict window overlaps every later occurrence. +- **An occurrence exclusion constraint on `occurs_*`** (revision 3). + Withdrawn: two distinct occurrences can legitimately overlap after + canonicalisation, and a union expansion could make a legal row illegal; + occurrence identity is adjudicated under the per-key lock. - **Automatic `extend_start` to the earliest evidenced start** (revision 2). - Withdrawn: `min()` over claim columns is the reduction D41 forbids, and it - would let a late retrospective move an adjudicated window. Discrepancies - are surfaced for review instead. -- **Universal half-open claim storage** (revision 1) and **comparison-time - effective ends by "+ one unit"** (revision 2). Withdrawn: the first empties - `instant`; the second over-expands normalised year/quarter/month ends and - leaves fact predicates and the `EXCLUDE` reading raw bounds. Replaced by - `canonical_bounds` applied at fact seeding and at claim comparison. + Withdrawn: `min()` over claim columns is the reduction D41 forbids; + revisions are `temporal_window` review verdicts. +- **A replay-based rebuild from current testimony** (revision 3). + Withdrawn: it discards D55 history, replaces fact ids that other tables + reference, and can re-pick seeds; conversion is in place from the recorded + `add` adjudication. +- **Universal half-open claim storage** (revision 1) and **"+ one unit" + effective ends with raw starts** (revisions 2–3). Withdrawn: the first + empties `instant`; the second over-expands normalised ends and leaves + non-aligned starts; both ends are now truncated to the unit, in SQL and + Python alike. - **One coalesced key for processing order and succession** (revision 1). Withdrawn: D90 needs a total processing order; succession needs world-time bounds. - **Succession only between two dated states** (revision 2). Withdrawn: it - made D106's dated-resignation-ends-undated-state case impossible; any - world-time instant supplied by the successor may cap. + made D106's dated-resignation case impossible; the state-ending candidate + set restores it. +- **Closing a retracted state on belief-time and labelling the world-time + end `source_removed`** (revision 3). Withdrawn: belief-time is not + world-time; the end stays `unknown` and only the belief interval closes, + from the persisted reconciliation instant. - **Cap at the successor's said-on date as an upper bound** (revision 1). Withdrawn: a retrospective's publication date proves nothing about when the change happened. - **Bake the resolved date into the observation statement** (revision 1). Withdrawn: identity would depend on arrival order (D43); labels are derived. -- **Nineteen local patches.** The pattern recurs in every new consumer. +- **Twenty-one local patches.** The pattern recurs in every new consumer. - **Keep `now()` as the undated cap.** Breaks rebuild stability (D7). ## 11. Non-goals (scope boundaries) diff --git a/plan/plans/temporal_clocks.md b/plan/plans/temporal_clocks.md index d6b5082cd..3f885f62d 100644 --- a/plan/plans/temporal_clocks.md +++ b/plan/plans/temporal_clocks.md @@ -11,20 +11,22 @@ function first (everything compares through it), then the fact model and cutover (it makes the documented `valid_at` promise true), then the prompts that decide supersession and identity, then retrieval keys and envelopes, then extraction vocabulary and consumer labels. Each package rolls the -generations it touches and lands with tests that assert the *clock*, not -only the outcome. +generations it touches, rolls the LoCoMo protocol whenever its observable +result semantics change (even with an unchanged JSON shape), and lands with +tests that assert the *clock*, not only the outcome. | WP | Scope | Audit findings closed | Generations / surfaces rolled | Acceptance | | --- | --- | --- | --- | --- | -| **WP-T.0 — canonical bounds** | `canonical_bounds(from, until, precision)` (design §5) used by `claims_as_of`, D106's disjointness test, and every later package; claim storage unchanged | 4.13 | none (pure comparison) | an intraday `claims_as_of` window finds a day-precision claim; a year stored as 2022-01-01…12-31 canonicalises to `[2022-01-01, 2023-01-01)`; an `instant` is a non-empty point that overlaps itself; two same-day events from different wordings overlap | -| **WP-T.1 — fact model and cutover** | migration: `temporal_kind`, `valid_from_basis`, `valid_until_basis`, `occurs_from`/`occurs_until`/`occurs_precision`, `seed_claim_id`; state-only verdict `EXCLUDE`, occurrence `EXCLUDE`, undated unique key; seed once by kind from the D90-first claim; matching by kind (§4.2); no automatic verdict revision, review items for discrepancies (§4.3); succession by any successor-supplied world-time instant incl. ending occurrences, else coexist (§4.4); D90 re-split by occurrence start (§4.5); D55 `source_removed`; no `now()`; the current-fact predicate with expiry sweep (§7.1); stop-drain-migrate-rebuild-readiness (§9) | 4.2, 4.4, 4.10, 4.11, 4.17 | normaliser, both adjudicators, obs flush component; schema head; fact-layer generation in readiness | `lookup_relations(valid_at=2010)` returns the 2010 employer and excludes the 2024 one; a January and an October visit are two occurrence relations under the new `EXCLUDE`; the same ingest replayed on different days yields byte-identical windows; both adjudicators orient one undated/dated pair identically (coexist); a dated resignation still caps an undated "is CEO" state (D106 preserved); the staggered D90 case with said-on and is-about orders reversed yields world-ordered slices; a state with a future end is current today and its profile refreshes when the end passes; a store whose fact generation predates D107 is refused by readiness | +| **WP-T.0 — canonical bounds** | `canonical_bounds` in Python and as `memory_v1.canonical_bounds` + the `claims_canonical` view (design §5): both ends truncated to the unit; instants as non-empty points; inclusive request conversion; used by `claims_as_of`, D106's disjointness test, the shipped `claims_as_of` example (with its `unknown` count fixed), open-query prose and catalog metadata | 4.13, 4.21 | query-space manifest; LoCoMo protocol (result semantics change) | an intraday `claims_as_of` window finds a day-precision claim; `claims_as_of(t, t)` is a point query; a year stored 2022-01-01…12-31 canonicalises to `[2022-01-01, 2023-01-01)`; a day whose stored start is noon canonicalises to the calendar day; an `instant` overlaps itself; adjacent day windows do not overlap; the example's `unknown` count is non-zero on a corpus with unstamped claims | +| **WP-T.1 — fact model, matching, closing, cutover** | migration: `temporal_kind`, `valid_from_basis`, `valid_until_basis`, `occurs_from`/`occurs_until`/`occurs_precision`, `seed_claim_id`; `EXCLUDE` partial on states, `undated` unique key, `fact_expiry_schedule`, the `temporal_window` review kind; seed once by kind from the recorded `add` claim; two candidate sets and adjudicated occurrence identity under the per-key lock (§4.2); `temporal_window` review verdicts with invariants and replay (§4.3); succession by any successor-supplied world-time instant incl. ending occurrences, the chronological guard, else coexist (§4.4); D55 unknown source time closes belief-time only, from the persisted reconciliation instant; D90 re-split by occurrence start (§4.5); the evaluated-at current predicate on every current read incl. aggregate/absence (§7.1); the durable expiry schedule; in-place, shadow-first, resumable conversion and the readiness gate (§9) | 4.2, 4.4, 4.10, 4.11, 4.17, 4.20 | normaliser, both adjudicators, obs flush component; schema head; fact-layer generation in readiness; LoCoMo protocol | `lookup_relations(valid_at=2010)` returns the 2010 employer and excludes the 2024 one; a January and an October visit are two occurrence relations, two same-day visits judged `new` coexist, and a union expansion bridging two occurrences merges nothing; the same ingest replayed on different days yields byte-identical windows; both adjudicators orient one undated/dated pair identically (coexist); a dated resignation still caps an undated "is CEO" state; a purported cap at or before a known start routes to contradict/coexist plus a review item; a `temporal_window` verdict applies, reverses, and replays idempotently; the staggered D90 case with said-on and is-about reversed yields world-ordered slices; a retraction with unknown source time leaves `valid_until` unknown and sets `invalidated_at` to the recorded reconciliation instant; an expired relation no longer counts in `aggregate` nor blocks `predicate_absence`; a state with a future end is current today and its profile refreshes when the end passes, including after a restart; conversion of a store keeps every fact id and every D55 historical fact, and readiness refuses an unconverted store | | **WP-T.2 — two clocks in every temporal prompt** | relation supersession prompt and laterals show `said on` / `is about`; T4 candidate salient facts carry occurrence windows and kinds and rank by evidence then occurrence recency; K writer claims carry `asserted_at` + D41 fields; answer-agent prompt names the envelope fields | 4.3, 4.6, 4.8, 4.16 | relation adjudicator, resolver, K writer; LoCoMo protocol | a 2024 retrospective spell does not supersede a 2023 current fact in the supersession proofs; T4 sees windows and kinds in its candidate JSON; the answer prompt fixture contains the two-clock paragraph | | **WP-T.3 — retrieval keys, envelopes, skill** | dedupe on the full D41 tuple (or `asserted_at` when unknown) with `grouped_members`; `Validity`, `GraphEdge`, the K fact model and `memory_v1` fact views gain bases, kind and occurrence; `resolve_entity@2`, `testimony_context@2`, `fact_context@3`, `answer_context@3`; open-query confirmation returns the full D41 tuple and fact bases/occurrence; P1 is-about claim filters and the `occurs` fact mode; timeline by occurrence with an `undated` bucket; consumption skill teaches the three clocks and two fact kinds and defines `claims_as_of` over world-time | 4.1, 4.9, 4.12, 4.18, 4.19 | assured operation versions, surface manifest hash, query-space manifest, generated OpenAPI/SDK; LoCoMo protocol | identical text on two dates is two evidence rows in `testimony_context`, and a grouped row lists every member's times; a 2015–2020 archive imported today produces 2015–2020 timeline buckets; the regenerated skill text contains the corrected `claims_as_of` definition; an open-query claim row carries precision and kind | | **WP-T.4 — extraction vocabulary and anchor** | all four D41 kinds and `open` taught with examples and field descriptions; full-timestamp header | 4.14, 4.15 | extractor; LoCoMo protocol | "has been CEO since 2019" extracts as `proposition_validity` / `open`; "three hours ago" in a source stamped 19:30 resolves to an `instant` at 16:30 of that day, and the same words in a second same-day source stamped 22:00 resolve to a different instant | -| **WP-T.5 — dated labels and consumer surfaces** | labels derived from statement + occurrence window (obs label, `FactResult.label`, profile lines); K fact sheet columns by basis with an `about` column; observation history by `occurs_from` | 4.5, 4.7 | P1 labels, K page generation | an observation minted from "last week" carries the resolved date in its label but not its statement; a sheet never prints a said-on date under a world-time heading | +| **WP-T.5 — dated labels and consumer surfaces** | labels derived from statement + occurrence window (obs label, `FactResult.label`, profile lines); K fact sheet columns by basis with an `about` column; observation history by `occurs_from` | 4.5, 4.7 | P1 labels and selection, K page generation; LoCoMo protocol (answer inputs change) | an observation minted from "last week" carries the resolved date in its label but not its statement; a sheet never prints a said-on date under a world-time heading | Dependencies: T.0 first. T.1 depends on T.0. T.2, T.3 and T.5 depend on -T.1's columns and cutover. T.4 is independent and may run in parallel. Every -package updates the same-PR documentation the CLAUDE.md rule requires -(concepts and API pages for `valid_at`, the benchmark README when the -protocol rolls) and the project-status page. +T.1's columns and cutover. T.4 is independent and may run in parallel. +Packages released together roll the protocol once. Every package updates the +same-PR documentation the CLAUDE.md rule requires (concepts and API pages for +`valid_at`, the benchmark README when the protocol rolls) and the +project-status page. From 4e85a46eb0cd42b8d7c6182fe6244b3fa6bf883c Mon Sep 17 00:00:00 2001 From: Jiri Puc Date: Thu, 3 Sep 2026 15:41:24 +0200 Subject: [PATCH 5/8] design: legacy conversion policy, full current predicate, D106 disjoint contradiction restored (D107 round 4) Codex's fourth review: relation add adjudications never recorded a creator claim, so exact legacy seed recovery was false; keeping legacy caps preserved the said-on/now() ends D107 removes; the current predicate had no lower bound (a 2030 fact current in 2026) and no activation scheduling; an overlap-only candidate filter dropped D106's disjoint-date contradiction; state-ending candidates limited to open states could not shorten a finite-ended state; the relation write path attached evidence before any verdict; the review verdict schema lacked identity, idempotency key and a reconciled reversal rule; fact checks allowed empty half-open states; D55 withdrawal erased historical occurrence windows; D55's observation close is shape-blind; stale round-three mechanics remained in banners. Record the seed atomically on both planes going forward; convert legacy relations under a `legacy` basis with migration adjudications; recompute recoverable legacy caps, remove caps from converted occurrences, turn D55 fallback caps into belief-time closes, and route the rest to `legacy_unknown_boundary` review items readiness reports. Use the full containment current predicate everywhere with activation and expiry scheduling. Keep nomination as today and bound verdicts by temporal relation (disjoint: new or contradict). Include finite-ended states in the state-ending set with a guard on both bounds. Stage relation writes until an idempotent verdict. Define temporal_window_verdicts concretely with reversal as the documented exception. Require non-empty states; derive occurrence windows over all attached evidence; route D55 by temporal kind (audit 4.22). Align every banner. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016p9xB9T7VYREuVmohDPKjR --- decisions.md | 276 ++++++------ plan/analysis/time_handling_audit.md | 33 +- plan/designs/e2_e3_claims_relations_design.md | 12 +- .../e3_entity_obs_flush_fanout_design.md | 6 +- plan/designs/temporal_clocks_design.md | 404 ++++++++++-------- plan/plans/temporal_clocks.md | 4 +- 6 files changed, 419 insertions(+), 316 deletions(-) diff --git a/decisions.md b/decisions.md index ba2074a50..42c21ec85 100644 --- a/decisions.md +++ b/decisions.md @@ -5012,68 +5012,81 @@ missing time stays missing. Concretely: `state` (a span that held), `occurrence` (something happened, or a figure for a period), `undated` — and **two windows**: the adjudicated **verdict window** (`valid_from`/`valid_until`, with a basis per endpoint — - `world_time`, `verdict`, `source_removed`, `unknown` — and the recorded - `seed_claim_id`) and a derived, non-authoritative **occurrence window** - (`occurs_from`/`occurs_until`/`occurs_precision`: the union of its - evidence's canonical D41 windows). A state's verdict window is its span - and its identity; an occurrence is believed from its occurrence start - onward, never capped (D43's no-cap rule extended to events), and has an - **adjudicated** identity under the per-key lock — overlapping occurrence - windows are a candidate filter the D4/D106 ladder judges, never identity - by themselves and never a database exclusion — so a January and an - October visit are two facts, and so are two same-day visits the ladder - judges distinct; an unknown window stays `NULL`/`unknown`. The said-on - date is never written into a window. + `world_time`, `verdict`, `source_removed`, `legacy`, `unknown` — and the + recorded `seed_claim_id`) and a derived, non-authoritative **occurrence + window** (`occurs_from`/`occurs_until`/`occurs_precision`: the union of + all attached evidence's canonical D41 windows, current or withdrawn, so + D55 never erases a historical fact's world-time). A state's verdict + window is its span and its identity; an occurrence is believed from its + occurrence start onward, never capped (D43's no-cap rule extended to + events), and has an **adjudicated** identity under the per-key lock — + never a database exclusion — so a January and an October visit are two + facts, and so are two same-day visits the ladder judges distinct; an + unknown window stays `NULL`/`unknown`. The said-on date is never written + into a window. 2. The verdict is seeded **once** from the seed claim — the claim whose - processing created the row, recorded in `seed_claim_id` and already in - the fact's `add` adjudication — and is never revised automatically. - Attaching evidence recomputes the occurrence window only. A discrepancy - between the two is surfaced as a **`temporal_window` review item** — a - new D24 kind whose append-only, reversible verdict records the target - fact, seed, old and new canonical bounds with bases, reviewer provenance, - reversal linkage and invariants (start earlier never later; no endpoint - past a neighbouring slice; a closed end never reopened, D41) and replays - idempotently after caps and retractions. Only such a verdict, a - supersede cap, or a D55 retraction changes a verdict window. -3. Matching compares an incoming claim against **two candidate sets**: - same-kind facts for evidence, contradiction or novelty, and — for an - incoming occurrence — the open states it may end, eligible for - supersede or contradict only. **Temporal succession** is separate from - D90's processing order, which is unchanged: a state is capped only at a - world-time instant supplied by its successor — a successor state's - verdict start or an ending occurrence's start (D106's dated resignation - still ends an undated "is CEO" state) — and only when that instant is - later than the predecessor's known start; otherwise the pair contradicts - or coexists and a review item is raised. `now()` is never a boundary. D55 - caps with basis `source_removed` when the source supplied the removal - time; when it did not, the world-time end stays `unknown` and only the - belief interval closes, from the persisted reconciliation instant. The - D90 late-arrival re-split decides eligibility by the evidence's - occurrence start against the world-time cap, not by `asserted_at`. -4. Precision is honoured through one **canonical-bounds** function — shipped + processing created the row, recorded atomically in `seed_claim_id` and + as the `triggering_claim_id` of the fact's `add` adjudication on both + planes — and is never revised automatically. Attaching evidence + recomputes the occurrence window only. A discrepancy between the two is + surfaced as a **`temporal_window` review item** — a new D24 kind whose + append-only verdict relation records the D49 fact identity, seed, old and + new canonical bounds with bases, provenance and reversal linkage, checks + invariants (start earlier never later; no endpoint past a neighbouring + slice; a closed end never reopened, D41; a state never empty), allows a + reviewer's compensating reversal as the one documented exception, and + replays idempotently after caps and retractions. Only such a verdict, a + supersede cap, a D55 retraction, or a recorded migration adjudication + changes a verdict window. +3. Candidate **nomination is unchanged** (block, then similarity-ranked + residue), so a same-occurrence date dispute between disjoint dated claims + still reaches the ladder (D106); the **temporal relation bounds the + verdict** — disjoint dated pairs may only be `new` or `contradict`, mixed + pairs never `evidence`. Matching compares an incoming claim against two + candidate sets: same-kind facts, and — for an incoming occurrence — the + states it may end, open-ended or finite-ended, eligible for supersede or + contradict only. A normalised relation claim is held unattached until + its verdict, which is idempotent on the triggering claim and adjudicator + generation. +4. **Temporal succession** is separate from D90's processing order, which is + unchanged: a state is capped only at a world-time instant supplied by its + successor — a successor state's verdict start or an ending occurrence's + start (D106's dated resignation still ends an undated "is CEO" state; a + 2027 resignation shortens "CEO 2025–2030") — and only when that instant + lies strictly inside the predecessor's known window; otherwise the pair + contradicts or coexists and a review item is raised. `now()` is never a + boundary. D55 caps a withdrawn state under the same guard when the source + supplied the removal time (basis `source_removed`); otherwise, and for + every withdrawn occurrence or undated fact, only the belief interval + closes, from the persisted reconciliation instant. The D90 late-arrival + re-split decides eligibility by the evidence's occurrence start against + the world-time cap, not by `asserted_at`. +5. Precision is honoured through one **canonical-bounds** function — shipped as `memory_v1.canonical_bounds` with a `claims_canonical` view and mirrored in Python — that turns a stored claim window into a half-open interval with both ends aligned to its precision unit (a year stored 2022-01-01…12-31 is `[2022-01-01, 2023-01-01)`; a day is the calendar day whatever the stored time; an `instant` is a non-empty point; `open` is unbounded; an inclusive request `(t, t)` is a point query). Fact windows - are **stored** canonical at seeding, so every fact predicate and the - relations exclusion read consistent bounds; claim comparisons, saved - examples and open SQL canonicalise through the same function; claim - storage and its `CHECK`s are unchanged. -5. "Current" is one predicate evaluated at an explicit instant - (`invalidated_at IS NULL AND (valid_until IS NULL OR valid_until > E)`), - used by every current fact read — the consumers that test - `valid_until IS NULL` today and the aggregate/absence queries that test - only `invalidated_at`; cached profiles and K pages carry their earliest - future end as an expiry instant in their input hash and a durable, - idempotent `fact_expiry_schedule` regenerates them when it passes, with - the read-time predicate as the correctness backstop. -6. Every prompt that compares, merges, ranks, or summarises facts shows the + are **stored** canonical at seeding, a state with two known endpoints + must be non-empty, and every fact predicate and the relations exclusion + read consistent bounds; claim comparisons, saved examples and open SQL + canonicalise through the same function; claim storage and its `CHECK`s + are unchanged. +6. "Current" is the full interval-containment predicate `facts_current` + already uses, evaluated at an explicit instant (`ingested_at <= E`, not + invalidated, `valid_from` absent or `<= E`, `valid_until` absent or + `> E`), on every current fact read — including the aggregate and + predicate-absence queries that test only `invalidated_at` today; cached + profiles and K pages carry their earliest future activation and expiry + instants in their input hash and a durable, idempotent + `fact_expiry_schedule` regenerates them when either passes, with the + read-time predicate as the correctness backstop. +7. Every prompt that compares, merges, ranks, or summarises facts shows the D106 two-clock block (`said on` / `is about`, defined): relation supersession, T4 identity candidates, the K prose writer, the benchmark answer agent. -7. Testimony deduplication keys on the full D41 tuple (or `asserted_at` when +8. Testimony deduplication keys on the full D41 tuple (or `asserted_at` when unknown) and grouped rows list every member's times; the fact-grain envelope, `GraphEdge`, the K fact model, the `memory_v1` fact views and the open-query confirmation surface gain bases, kind and occurrence @@ -5082,16 +5095,22 @@ missing time stays missing. Concretely: `answer_context@3` roll; P1 gains is-about claim filters and an `occurs` fact mode; the timeline aggregate buckets by occurrence with an explicit `undated` bucket; profiles rank by evidence then occurrence recency. -8. Extraction teaches all four D41 kinds and `open` with examples and shows +9. Extraction teaches all four D41 kinds and `open` with examples and shows the extractor the full source timestamp. Statements stay canonical (D43); - dated labels are derived from the occurrence window. -9. Consumer surfaces print a date under a world-time heading only for - `world_time`/`verdict` bases, and the consumption skill defines - `claims_as_of` over source world-time (D41), not system time. -10. Cutover is stop → drain → migrate → **convert in place** (seed from the - recorded `add` adjudication, windows by kind, existing caps kept, - shadow-first, validated, resumable) → readiness reports the fact-layer - generation and refuses an older one. Fact ids and D55 historical facts + dated labels are derived from the occurrence window. Consumer surfaces + print a date under a world-time heading only for `world_time`/`verdict` + bases, and the consumption skill defines `claims_as_of` over source + world-time (D41), not system time. +10. Cutover is stop → drain → migrate → **convert in place** with a recorded + migration adjudication per fact → readiness. Observations recover their + seed from the recorded `add` adjudication; relations never recorded a + creator, so a legacy relation converts under basis `legacy` with its + kind derived from its evidence when unanimous, else `undated`. Legacy + caps are not kept as they are: a recoverable supersede cap is recomputed + at its successor's world-time start, a cap on a converted occurrence is + removed, a D55 fallback cap becomes a belief-time close at the persisted + reconciliation instant, and the rest become `legacy_unknown_boundary` + review items that readiness reports. Fact ids and D55 historical facts are preserved; a store never mixes pre- and post-D107 fact semantics; re-adjudicating identities decided under old rules is a fresh rebuild (D7), not a migration. @@ -5100,67 +5119,68 @@ missing time stays missing. Concretely: tournament last week" across a nine-month gap because it never read the claims' resolved windows. The follow-up audit (`plan/analysis/time_handling_audit.md`, revision `02b79904`) found the same -confusion in twenty more places: relations' `valid_from` is never seeded, -so a `valid_at` lookup cannot exclude a fact before its true beginning; the -relation supersession prompt asks the model about "the same period" while -showing only document dates; undated supersessions cap at the ingest -wall-clock, so a rebuild on another day yields a different history; the two -adjudicators orient undated testimony in opposite directions; retrieval -dedupes identical text across dates exactly as the adjudicator did before -D106; the K fact sheet sorts by a said-on date it does not show; the timeline -aggregate falls back to ingest year; the answer agent is told to "use -timestamps" without being told which; day-precision windows are compared as -zero-width points; the consumption skill and the open-query confirmation -surface respectively misdefine and truncate the clocks; the aggregate and -predicate-absence queries never evaluate `valid_until`; and the shipped -`claims_as_of` example's `unknown` count can never be non-zero. The docs -(`/docs/concepts`, `fact_context`'s description) promise world-time -semantics the code does not keep. - -Two independent Codex design reviews shaped the mechanics. The first -withdrew said-on seeding, mechanical evidence widening, universal half-open -storage, and a merged ordering key. The second showed that matching every -fact by verdict-window overlap recreates the D106 collapse for recurring -occurrences and collides with the relations `EXCLUDE`, that an automatic -`extend_start` is still the D41-forbidden reduction, that "+ one unit" -over-expands normalised ends, that the D90 re-split crossed clocks, and that -succession restricted to dated states lost D106's ending-event case. The -third showed that an occurrence exclusion constraint contradicts adjudicated -identity, that kind-routed matching made D106's cross-kind cap unreachable, -that "review item" named no verdict schema, that a replay rebuild erases -D55 history and re-picks seeds, and that belief-time was leaking into a -world-time endpoint — hence the temporal kind, adjudicated occurrence -identity, the two candidate sets and chronological guard, the -`temporal_window` verdict, canonical bounds in SQL and Python, and the -in-place conversion above. +confusion in twenty-one more places: relations' `valid_from` is never +seeded, so a `valid_at` lookup cannot exclude a fact before its true +beginning; the relation supersession prompt asks the model about "the same +period" while showing only document dates; undated supersessions cap at the +ingest wall-clock, so a rebuild on another day yields a different history; +the two adjudicators orient undated testimony in opposite directions; +retrieval dedupes identical text across dates exactly as the adjudicator did +before D106; the K fact sheet sorts by a said-on date it does not show; the +timeline aggregate falls back to ingest year; the answer agent is told to +"use timestamps" without being told which; day-precision windows are +compared as zero-width points; the consumption skill and the open-query +confirmation surface respectively misdefine and truncate the clocks; the +aggregate and predicate-absence queries never evaluate `valid_until`; the +shipped `claims_as_of` example's `unknown` count can never be non-zero; and +D55's observation close is shape-blind. The docs (`/docs/concepts`, +`fact_context`'s description) promise world-time semantics the code does +not keep. + +Four independent Codex design reviews shaped the mechanics, each withdrawing +part of the previous revision: said-on seeding, mechanical evidence +widening, universal half-open storage and a merged ordering key (round one); +verdict-window identity for occurrences, an automatic `extend_start`, +"+ one unit" ends, a clock-crossing D90 re-split and dated-states-only +succession (round two); an occurrence exclusion constraint, kind-routed +matching that lost D106's cross-kind cap, an unspecified review mechanism, +a replay rebuild and a belief-time end labelled `source_removed` (round +three); exact legacy seed recovery, preserved legacy caps, a current +predicate without a lower bound, an overlap-only candidate filter that lost +D106's disjoint-date contradiction, and open-states-only state-ending +candidates (round four). Design §10 records each. **Consequences.** `valid_at` / `facts_as_of` become true on both fact planes; recurring occurrences stay distinct facts on both planes; histories are -rebuild-stable (D7) because no boundary depends on ingest time and the seed -is the replay-first claim; the two fact planes agree on undated testimony; -readers, profiles and compiled pages see resolved dates as labels while -statements keep source wording. Costs: one migration (seven columns, a partial exclusion, a unique key, -an expiry schedule, a review kind, and the query-space function and view), generation rolls for the -extractor, normaliser, both adjudicators and the flush component, four -assured-operation version rolls, a fact-layer rebuild of existing stores -(re-seeding reads the claim rows already present), an expiry sweep for -finite future ends, and LoCoMo protocol rolls per landed package. Undated, -differently worded restatements of a changing state coexist instead of -capping at `now()`; their count per key is a reported metric and the lever -is extraction coverage of the D41 kinds. +rebuild-stable (D7) because no boundary depends on ingest time; the two fact +planes agree on undated testimony; readers, profiles and compiled pages see +resolved dates as labels while statements keep source wording. Costs: one +migration (the new columns, the non-empty state check, a partial exclusion, +a unique key, an expiry schedule, a review kind and verdict relation, and +the query-space function and view), generation rolls for the extractor, +normaliser, both adjudicators and the flush component, four +assured-operation version rolls, an in-place conversion of existing stores +with migration adjudications and possibly open `legacy_unknown_boundary` +items to resolve, activation/expiry sweeps, and LoCoMo protocol rolls per +landed package. Undated, differently worded restatements of a changing +state coexist instead of capping at `now()`; their count per key is a +reported metric and the lever is extraction coverage of the D41 kinds. **Rejected.** Seeding windows from the said-on date (provenance is not validity); seeding a measurement's or event's end from its claim (D43 -no-cap); matching every fact by verdict-window overlap (recreates D106 for -occurrences); an occurrence exclusion constraint (contradicts adjudicated -identity); automatic earliest-evidence start revision (D41 reduction); a -replay rebuild (erases D55 history, replaces referenced fact ids); half-open -claim storage (empties `instant`) and "+ one unit" ends with raw starts -(over-expand and misalign); one coalesced -key for processing and succession (D90); succession only between dated -states (loses D106's ending event); capping at a retrospective's said-on -date; baking the resolved date into the observation statement (D43 -identity); nineteen local patches; keeping `now()` as the undated cap (D7). +no-cap); matching every fact by verdict-window overlap or an occurrence +exclusion (recreates D106 for occurrences; distinct occurrences may +overlap); an overlap-only candidate filter (loses D106's disjoint-date +contradiction); automatic earliest-evidence start revision (D41 reduction); +a replay rebuild and exact legacy seed recovery (erases D55 history; +relation creators were never recorded); keeping legacy cap boundaries (they +are the said-on/`now()` values removed); a current predicate without a lower +bound; half-open claim storage (empties `instant`) and "+ one unit" ends +with raw starts; one coalesced key for processing and succession (D90); +succession only between dated states or only against open states; capping +at a retrospective's said-on date; baking the resolved date into the +observation statement (D43 identity); twenty-two local patches; keeping +`now()` as the undated cap (D7). **Design.** `plan/designs/temporal_clocks_design.md`; amendment banners on `e2_e3_claims_relations_design.md`, `observations_design.md`, @@ -5171,14 +5191,16 @@ identity); nineteen local patches; keeping `now()` as the undated cap (D7). **Sequencing.** `plan/plans/temporal_clocks.md`. -**Amends.** D24 (a `temporal_window` review kind with its verdict schema); -D41's consequences become binding mechanics (claim windows seed -fact verdicts once; the retrospective guard holds; revisions are review -verdicts); the observations design §3 (matching by kind, the cap boundary, -succession, the no-cap rule extended to events); D88/D90 (processing order -unchanged; the §5.5.3 re-split decides by occurrence start against a -world-time cap); D106 (its two-clock prompt block becomes the engine-wide -contract; its ending-event supersession is preserved; its `valid_from` -seeding gap is closed); D55 (unknown source time closes on belief-time, never -`now()`); D49 (additive envelope fields; four operation versions roll). -Preserves D3, D6, D32, D43's untyped statement, D98, D100–D105. +**Amends.** D24 (a `temporal_window` review kind with its verdict relation +and the documented reversal exception); D41's consequences become binding +mechanics (claim windows seed fact verdicts once; the retrospective guard +holds; revisions are review verdicts); the observations design §3 +(matching by kind, the cap boundary, succession, the no-cap rule extended to +events); D88/D90 (processing order unchanged; the §5.5.3 re-split decides by +occurrence start against a world-time cap); D106 (its two-clock prompt block +becomes the engine-wide contract; its disjoint-date contradiction and +ending-event supersession are preserved; its `valid_from` seeding gap is +closed); D55 (retraction by temporal kind; unknown source time closes on +belief-time from the persisted reconciliation instant, never `now()`); D49 +(additive envelope fields; four operation versions roll). Preserves D3, D6, +D32, D43's untyped statement, D98, D100–D105. diff --git a/plan/analysis/time_handling_audit.md b/plan/analysis/time_handling_audit.md index 5c80fa5ed..450af86d0 100644 --- a/plan/analysis/time_handling_audit.md +++ b/plan/analysis/time_handling_audit.md @@ -7,8 +7,8 @@ binding contract is `plan/designs/temporal_clocks_design.md`. **Revision audited:** `02b79904` (the merge of D106). Line numbers below are for that revision; function and statement names are the stable anchors. -Findings 4.2, 4.5, 4.6, 4.12, 4.13, 4.14 and 4.15 were narrowed after three -independent Codex reviews verified each against the code; 4.18–4.21 were +Findings 4.2, 4.5, 4.6, 4.12, 4.13, 4.14 and 4.15 were narrowed after four +independent Codex reviews verified each against the code; 4.18–4.22 were added from those reviews. ## 1. Question @@ -224,10 +224,11 @@ inputs. intervals. A day-precision May-7 claim is `[May 7 00:00, May 7 00:00]`, so "what held during May 7, 09:00–23:00" returns nothing; a year-precision 2022 claim ends at 2022-12-31 00:00. D106's `_windows_disjoint` compares with -strict `<`, so two *equal* points do overlap; but two same-day events whose -wordings resolve to different instants of that day, or a day-precision and an -instant-precision claim, are points that miss each other although the day -contains both. +strict `<`, so two *equal* points do overlap; but a day-precision claim and an +instant-precision claim about the same day miss each other, and two +day-precision claims about adjacent days touch at a point neither covers. +(Two genuinely instant-precision events at different times of one day *are* +disjoint, and correctly so.) ### 4.14 E2 teaches only `event_time` (P4) @@ -310,6 +311,18 @@ by combining `precision = 'unknown'` with a non-null bound comparison; D41's permanently zero. (Reported by the third independent review; the fix rides the query-space canonicalisation of design §5.) +### 4.22 D55's observation close is shape-blind (P6) + +`src/rememberstack/spine/lifecycle.py:438-468` (`close_observations`) +invalidates every withdrawn observation, by its own docstring because +"observations are untyped (state vs measurement is semantic)" and +`invalidated_at` is the exit safe for both shapes. D55 and +`evidence_lifecycle_design.md:153-165` ask for a per-shape judgement — a +withdrawn effective state caps its world-time, a withdrawn measurement keeps +its window and closes belief only. Without a temporal kind the code cannot +make that judgement, so a withdrawn state observation is recorded as *never +believed* rather than *ended*. + ## 5. Checked and sound Absence of a finding above is a result, not an omission: @@ -339,15 +352,15 @@ Absence of a finding above is a result, not an omission: and sound. - **Query-space catalog typing** (`spine/query_space/catalog.py:371-434, 447-509, 869-916`) — claim views expose all five D41 columns to open SQL. -- **D55 retraction shape discipline** (`spine/lifecycle.py:412-468`) — - relations cap at the withdrawing version's source time, observations use - `invalidated_at`; only the `now()` fallback (4.4) is wrong. +- **D55 retraction for relations** (`spine/lifecycle.py:412-437`) — caps at + the withdrawing version's source time; only the `now()` fallback (4.4) is + wrong. (The observation side is not sound — 4.22.) - **Adjudication transcripts** (`supersession.py:298-307`; `observation_adjudication.py:553-571, 741-751`) — every cap boundary and every D106 coercion is recorded, so all of the above is diagnosable from the audit tables without a rerun. -## 6. Why this is one decision, not twenty-one fixes +## 6. Why this is one decision, not twenty-two fixes Every finding is the same confusion: the engine resolves world-time once, at extraction, and then reasons on the source's date. The fix that closes all of diff --git a/plan/designs/e2_e3_claims_relations_design.md b/plan/designs/e2_e3_claims_relations_design.md index d8fac5ea8..fe253c969 100644 --- a/plan/designs/e2_e3_claims_relations_design.md +++ b/plan/designs/e2_e3_claims_relations_design.md @@ -4,11 +4,13 @@ > `open` with examples and sees the full source timestamp in the header; claim > storage is unchanged and comparisons use canonical bounds. E3 seeds each new > fact's temporal kind and verdict window once from the D90-first claim's -> canonical D41 window (bases per endpoint, seed claim recorded), matches -> later claims by kind — states by verdict-window overlap, occurrences by -> occurrence-window overlap under a separate exclusion — and never revises a -> verdict automatically; statements stay canonical and dated labels are -> derived. Contract: `temporal_clocks_design.md` §3–§5. +> canonical D41 window (bases per endpoint, seed claim recorded on both +> planes), matches later claims by kind — states by verdict-window overlap +> under the exclusion; occurrences by adjudicated identity under the per-key +> lock, with the temporal relation bounding the verdict — holds a relation +> claim unattached until its idempotent verdict, and never revises a verdict +> automatically; statements stay canonical and dated labels are derived. +> Contract: `temporal_clocks_design.md` §3–§5. How the system turns a chunk of source text into **claims** (atomic, standalone, verifiable assertions) and then into **relations** (the distinct facts those claims are evidence for). This is diff --git a/plan/designs/e3_entity_obs_flush_fanout_design.md b/plan/designs/e3_entity_obs_flush_fanout_design.md index 12362f493..fe3692a22 100644 --- a/plan/designs/e3_entity_obs_flush_fanout_design.md +++ b/plan/designs/e3_entity_obs_flush_fanout_design.md @@ -261,8 +261,10 @@ attached evidence is never re-split. (Before D107 this rule compared 2. Later materialize/apply unit B `{t2:B}`. 3. Final slices must still be `A[t1,t2), B[t2,t3), A[t3,∞)`. -Impl may walk evidence claim `asserted_at` on O after cap, or rebuild open -history for E from durable adjudications + claim times. This is a D43 co-requisite +Impl may walk the evidence claims attached to O after the cap, testing each +state claim's canonical occurrence start against T (never `asserted_at`, +D107), or rebuild open history for E from durable adjudications + claim +windows. This is a D43 co-requisite of multi-version continuous flush under D90. ### 5.6 LLM and locking (binding) diff --git a/plan/designs/temporal_clocks_design.md b/plan/designs/temporal_clocks_design.md index 6e6de1f8c..9a667baf0 100644 --- a/plan/designs/temporal_clocks_design.md +++ b/plan/designs/temporal_clocks_design.md @@ -2,10 +2,10 @@ **Status:** binding under D107 -**Date:** 2026-09-03 (fourth revision the same day, after three independent +**Date:** 2026-09-03 (fifth revision the same day, after four independent Codex design reviews; §11 records what each round withdrew) -**Analysis:** `plan/analysis/time_handling_audit.md` (twenty-one findings at +**Analysis:** `plan/analysis/time_handling_audit.md` (twenty-two findings at `02b79904`, each cited by file and function) **Builds on:** D41 (claims carry an immutable, source-asserted validity @@ -16,7 +16,7 @@ D3/D4 (supersession over verdicts; the cheap-first cascade), D43 (continuous-ingest processing order and the late-arrival re-split), D106 (temporal compatibility in observation adjudication), D24 (append-only, reversible review verdicts — amended here), D7/D12 (rebuild, generations, -idempotency), D55 (retraction), D49 (envelopes). +idempotency), D55 (retraction), D49 (envelopes and fact identity). > **Reading this cold.** RememberStack extracts **claims** (what a source > said, immutable) and adjudicates them into **facts** — relations between @@ -32,10 +32,10 @@ idempotency), D55 (retraction), D49 (envelopes). The engine resolves world-time once, at extraction, and then most later stages — fact windows, supersession, ordering, deduplication, prompts, -summaries, filters, timelines, aggregates — reason on the *source's own -date* instead, or on no date at all. The audit lists twenty-one instances; -D106 fixed one. This design closes the class without creating a second -validity authority. +summaries, filters, timelines, aggregates, retraction — reason on the +*source's own date* instead, or on no date at all. The audit lists +twenty-two instances; D106 fixed one. This design closes the class without +creating a second validity authority. ## 2. The three clocks and the two rules @@ -75,8 +75,8 @@ windows with different authority: | Window | Columns | Authority | Changes when | | --- | --- | --- | --- | -| **verdict window** | `valid_from` / `valid_until` (existing), `valid_from_basis` / `valid_until_basis` (new, `NOT NULL DEFAULT 'unknown'`: `world_time`, `verdict`, `source_removed`, `unknown`), `seed_claim_id` (new) | the adjudicator's single recorded verdict (D3/D41/D43): over which span the fact is believed to have held | seeded **once** at insert from the seed claim (§4.1); afterwards only by a recorded verdict: a supersede cap (§4.4), a `temporal_window` review verdict (§4.3), a D55 retraction — never automatically | -| **occurrence window** | `occurs_from` / `occurs_until` / `occurs_precision` (new, nullable) | **non-authoritative** derived metadata: the union of the canonical D41 windows of the fact's current-testimony evidence — the aggregate D106 already computes at block time | recomputed whenever evidence attaches or is withdrawn (the recount path); a database check forbids it from writing the verdict window | +| **verdict window** | `valid_from` / `valid_until` (existing), `valid_from_basis` / `valid_until_basis` (new, `NOT NULL DEFAULT 'unknown'`: `world_time`, `verdict`, `source_removed`, `legacy`, `unknown`), `seed_claim_id` (new, nullable — `NULL` only for legacy facts whose creator is unrecoverable and after hard forget scrubs it) | the adjudicator's single recorded verdict (D3/D41/D43): over which span the fact is believed to have held | seeded **once** at insert from the seed claim (§4.1); afterwards only by a recorded verdict: a supersede cap (§4.4), a `temporal_window` review verdict (§4.3), a D55 retraction (§4.4), or a migration verdict (§9) — never automatically from evidence | +| **occurrence window** | `occurs_from` / `occurs_until` / `occurs_precision` (new, nullable) | **non-authoritative** derived metadata: the union of the canonical D41 windows of the fact's **attached** evidence — current or withdrawn testimony alike, so a D55 withdrawal never erases a historical fact's world-time; hard forget recomputes from surviving evidence | recomputed whenever evidence attaches or is forgotten; a database check forbids it from writing the verdict window | Why two kinds and two windows: a measurement is *about* FY2023 but is *believed* from the day it was reported onward and is never capped (D43's @@ -94,10 +94,11 @@ it. ### 4.1 Seeding at insert (once, from the seed claim) The **seed claim** is the claim whose processing created the fact row — the -first claim for it in D90 processing order in a fresh ingest — recorded in -`seed_claim_id` and in the fact's `add` adjudication row (its -`triggering_claim_id`, which both fact planes already write). Windows are -the seed claim's **canonical bounds** (§5): +first claim for it in D90 processing order in a fresh ingest — recorded +atomically with the row in `seed_claim_id` **and** as the +`triggering_claim_id` of the fact's `add` adjudication on both planes (today +only observation `add` rows carry one; relation `add` rows gain it). Windows +are the seed claim's **canonical bounds** (§5): | seed claim kind | `temporal_kind` | `valid_from` | `valid_until` | bases | `occurs_*` | | --- | --- | --- | --- | --- | --- | @@ -108,62 +109,83 @@ the seed claim's **canonical bounds** (§5): The re-occurrence floor (a reopened state slice starts no earlier than the prior closed slice's end) applies **only** when the seed's start is provably later than that end — a chronological successor; an older spell discovered -late is inserted as its own closed slice (§4.2). +late is inserted as its own closed slice (§4.2). The schema requires a +`state` with two known endpoints to be non-empty (`valid_until > +valid_from`); the existing checks that allow `valid_until = valid_from` are +replaced, because in half-open form that is an empty fact that the +`EXCLUDE` cannot see. -### 4.2 Matching: two candidate sets, then the ladder +### 4.2 Matching: nomination as today, verdicts bounded by temporal relation All matching for one key runs under the per-key advisory lock the observation path already takes, so identity decisions are serialised and no -database exclusion is needed to keep them consistent. After the entity/key -block (unchanged), an incoming claim is compared against **two candidate -sets**: +database exclusion is needed to keep them consistent. + +**Candidate nomination is unchanged in mechanism**: the entity/key block, +then the similarity-ranked residue (D43 §3) — never an overlap filter, so a +same-occurrence date dispute between two disjoint dated claims still reaches +the ladder, as D106 requires. What changes is the **two candidate sets** and +the **verdicts a temporal relation permits**: - **same-kind candidates** — live facts of the same key and the same - `temporal_kind`, eligible for evidence attachment (`evidence`), for - `contradict`, or for `new`; + `temporal_kind`; eligible for `evidence`, `contradict`, or `new`; - **state-ending candidates** — for an incoming `occurrence` claim only: the - open `state` slices of the same key (or, for observations, the same - entity), eligible **only** for `supersede` or `contradict` (§4.4), never - for evidence. This is the cross-kind comparison D106's dated resignation - needs to end an "is CEO" state. - -Within the same-kind set, by kind: - -**States.** The incoming canonical window overlapping a live `state` slice's -verdict window → evidence attaches; the verdict is untouched; `occurs_*` -recomputes. No overlap → a **new slice** (a distinct spell; disjoint ranges -satisfy the relations `EXCLUDE`, which applies `WHERE temporal_kind = -'state'`). An overlap with a *different value* of the same property is the -supersede/contradict question the ladder answers (§4.4). - -**Occurrences.** Overlap of canonical windows is the *candidate filter*, not -identity: the D4/D106 ladder decides, with both clocks shown (§7.2), -`evidence` (the same occurrence re-mentioned; `occurs_*` widens), -`contradict` (the same occurrence, disputed detail; both stand, grouped), or -`new` (a different occurrence that merely overlaps — two visits on one day, -a day-precision and an instant-precision claim about different things). -Disjoint windows are always `new`. There is **no** occurrence exclusion -constraint: overlapping occurrence rows of one key are legal and expected, -a union expansion that comes to overlap a neighbouring occurrence never -merges rows, and the advisory lock plus the recorded verdict are what + non-invalidated `state` slices of the same key (for observations, the same + entity) whose interval extends beyond the occurrence's canonical start — + open-ended *or* finite-ended (a 2027 resignation must reach "CEO + 2025–2030") — eligible **only** for `supersede` or `contradict` (§4.4), + never for evidence. This is the cross-kind comparison D106's dated + resignation needs to end an "is CEO" state. + +Within the same-kind set, the temporal relation of the two canonical +windows bounds the verdict, as D106 does today: + +| relation | permitted verdicts | +| --- | --- | +| both dated, **disjoint** | `new`, or `contradict` when the ladder finds one occurrence with a disputed date (D106) — never `evidence`, never `supersede` | +| both dated, **overlapping** | `evidence` (the same occurrence or state re-mentioned; `occurs_*` widens), `contradict`, `new` (a different occurrence that merely overlaps: two visits on one day; a day-precision and an instant-precision claim about different things) | +| **mixed** (one dated, one undated) | `supersede` / `contradict` / `new` — never `evidence` | +| both undated | as today | + +Consequences by kind: + +**States.** An overlapping same-property claim with the same value attaches +as evidence; a disjoint one seeds a new slice (disjoint ranges satisfy the +relations `EXCLUDE`, which applies `WHERE temporal_kind = 'state'`); an +overlapping different value is the supersede/contradict question (§4.4). + +**Occurrences.** Identity is the ladder's verdict, not the window: there is +**no** occurrence exclusion constraint; overlapping occurrence rows of one +key are legal, a union expansion that comes to overlap a neighbouring +occurrence never merges rows, and the advisory lock plus the recorded verdict prevent duplicates. Acceptance covers same-key recurring events, coarse and -fine precision overlap judged `new`, and a union expansion bridging two -existing occurrences. +fine precision overlap judged `new`, a disjoint pair judged `contradict`, and +a union expansion bridging two existing occurrences. -**Undated claims.** Observations follow D106's mixed rule — an undated -statement never attaches to a dated occurrence and a dated event never -attaches to an undated statement; identical wording collapses onto an +**Undated claims.** Observations: identical wording collapses onto an existing `undated` row of the same key, otherwise a new `undated` row. Relations: the triple *is* the content, so an undated claim attaches to the single open `state` slice if exactly one exists, else to the single `undated` row for the key (creating it once); it never attaches to an `occurrence` and never creates a second unbounded slice. +**The relation write path becomes staged.** Today `upsert_relation` finds a +live triple and attaches evidence before the relation ladder runs, which +would collapse two same-triple occurrences before any verdict. Under this +design a normalised relation claim is **held unattached** (staged, as +observation claims already are) until, under the key's block lock, candidate +nomination and the verdict complete; `new` inserts the fact, its `add` +adjudication (with `triggering_claim_id`) and the evidence link in one +transaction; `evidence` attaches in one transaction; every identity verdict +is idempotent on `(triggering_claim_id, adjudicator generation)` so a retry +or a concurrent D88 normaliser replays the recorded verdict rather than +deciding again. The relation ladder's "same object after redirects → exact +no-op" short-circuit applies to `state` and `undated` triples only. + **Relations schema.** The existing GiST `EXCLUDE` on `(subject, predicate, object) && tstzrange(valid_from, valid_until)` becomes partial on `temporal_kind = 'state'`; `undated` relations get a unique key on the -triple; occurrence relations have no constraint (adjudicated identity under -the lock, as observations always have). +triple; occurrence relations have no constraint. ### 4.3 Revising a verdict: a `temporal_window` review verdict (amends D24) @@ -171,22 +193,33 @@ No automatic path changes a verdict window after seeding. A discrepancy — attached evidence whose occurrence start precedes a `state` slice's verdict start, or dated evidence attaching to a slice with an unknown window — is surfaced in the envelope (`occurs_from < valid_from`; bases `unknown` beside -a dated `occurrence`) and raised as a review item of a new kind, -`temporal_window`, in the D24 queue. Its verdict record is append-only, -reversible, and provenance-stamped like every D24 action: +a dated `occurrence`) and raised as a `review_queue` item of a new kind, +`temporal_window`. Its verdicts live in an append-only relation, +`temporal_window_verdicts`: -| field | meaning | +| column | meaning | | --- | --- | -| `target_fact_id`, `temporal_kind` | the fact whose verdict window is revised (stable identity) | +| `verdict_id` | primary key; the idempotency key for apply and replay | +| `review_id` | the `review_queue` item it answers | +| `target_fact_kind`, `target_fact_id` | D49 fact identity (`relation` / `observation` + id) | | `seed_claim_id` | the seed as recorded at the time of the verdict | -| `old_valid_from`/`old_valid_until` with bases; `new_valid_from`/`new_valid_until` with bases | canonical bounds before and after; a new endpoint's basis is `verdict` | -| `rationale`, `reviewer`, `decided_at` | provenance | -| `reverses_verdict_id` | set on a reversal; a reversal restores the prior bounds and bases | -| `invariants` | checked before apply: the start may move earlier, never later; no endpoint moves past a neighbouring slice's bound; a closed end is never reopened (D41); a `state`'s end, when set, is later than its start | - -Verdicts apply in `decided_at` order after caps and retractions on the -same fact, are idempotent by `verdict_id`, and are replayed in that order on -rebuild (D7). Anything the invariants refuse stays a review item. +| `old_valid_from`, `old_valid_until`, `old_from_basis`, `old_until_basis` | canonical bounds and bases before | +| `new_valid_from`, `new_valid_until`, `new_from_basis`, `new_until_basis` | canonical bounds and bases after; a changed endpoint's basis is `verdict` | +| `rationale`, `actor`, `decided_at` | provenance (D24) | +| `reverses_verdict_id` | set on a reversal | + +Invariants checked before apply, for verdicts that are not reversals: the +start may move earlier, never later; no endpoint moves past a neighbouring +slice's bound; a closed end is never reopened (D41); a `state` with two +known endpoints stays non-empty. **Reversal is the one documented +exception**: a reviewer may reverse a `temporal_window` verdict with a +compensating verdict that restores the prior bounds and bases exactly — +D24's reversibility applies to human verdicts over human verdicts, while +D41's retrospective guard governs evidence-driven change; the two do not +conflict because no evidence ever moves a window. Verdicts apply in +`decided_at` order after caps and retractions on the same fact and replay in +that order on rebuild (D7). Anything the invariants refuse stays a review +item. ### 4.4 Closing: temporal succession, separate from processing order @@ -201,27 +234,29 @@ successor**: - a successor `state`'s verdict start (basis `world_time` or `verdict`); or - an **ending occurrence** from the state-ending candidate set (§4.2) that the ladder judged `supersede`, at the occurrence's canonical start — so a - dated resignation ends an "is CEO" state whose own start may be unknown. - -**Chronological guard:** the boundary must be later than the predecessor's -known verdict start; a boundary at or before a known start is not a cap — -the ladder's outcome is recorded and the pair routes to `contradict` -(both stand, grouped) when the values conflict, otherwise coexists, and in -either case a `temporal_window` review item is raised. The predecessor's own -start basis is otherwise irrelevant. When the successor supplies no -world-time instant (an undated successor), there is no succession: the pair -**coexists** and the adjudication row records `reason = "no world-time -boundary -> coexist"`. The cap's basis is `verdict`. Relation supersession -and observation supersession share this one rule. `now()` is never a -boundary. - -**Retraction (D55).** The withdrawing document version's source time is a -*source action*: when known, it caps the state with basis `source_removed`. -When it is unknown, the world-time end stays `unknown` and only the belief -interval closes — `invalidated_at` set from the **persisted reconciliation -event's timestamp**, never from the database clock — so a rebuild replays the -same instant and no world-time endpoint is ever labelled with a basis the -source did not supply. + dated resignation ends an "is CEO" state whose own start may be unknown, + and a 2027 resignation shortens "CEO 2025–2030" to end in 2027. + +**Chronological guard, applied to every cap source including D55:** the +boundary must be later than the predecessor's known verdict start and +earlier than its known end; otherwise it is not a cap — the ladder's outcome +is recorded, the pair routes to `contradict` (both stand, grouped) when the +values conflict and coexists otherwise, and a `temporal_window` review item +is raised. When the successor supplies no world-time instant (an undated +successor), there is no succession: the pair **coexists** and the +adjudication row records `reason = "no world-time boundary -> coexist"`. +The cap's basis is `verdict`. Relation supersession and observation +supersession share this one rule. `now()` is never a boundary. + +**Retraction (D55) by temporal kind.** A withdrawn `state` whose withdrawing +document version has a known source time is capped there under the guard +(basis `source_removed`); when that time is unknown, the world-time end stays +`unknown` and only the belief interval closes — `invalidated_at` set from the +**persisted reconciliation event's timestamp**, never from the database +clock, so a rebuild replays the same instant. A withdrawn `occurrence` or +`undated` fact is never capped: it closes on belief-time the same way. This +is the per-shape judgement D55 asks for and `close_observations` could not +make while shape was semantic; `temporal_kind` makes it mechanical. **Residual, measured rather than assumed:** undated, differently worded restatements of a changing state coexist as `undated` rows instead of @@ -239,7 +274,7 @@ total work order only. Undated attached evidence is never re-split (it coexists on the slice it attached to). The staggered acceptance case gains a variant in which said-on order and is-about order are deliberately reversed and the final slices must follow the world. The D90 design's §5.5.3 is -rewritten to this rule. +rewritten to this rule, including its implementation note. ### 4.6 Statements stay canonical; dated labels are derived @@ -304,28 +339,37 @@ not a defect of the anchor. ## 7. Every temporal judgement sees both clocks; every surface names them -### 7.1 The current-fact predicate and expiry +### 7.1 The current-fact predicate and activation/expiry + +"Current" is one predicate — the interval containment `memory_v1.facts_current` +and `fact_context` already use — evaluated at an explicit instant `E`: + +``` +ingested_at <= E AND invalidated_at IS NULL +AND (valid_from IS NULL OR valid_from <= E) +AND (valid_until IS NULL OR valid_until > E) +``` -"Current" is one predicate evaluated at an explicit instant `E`: -`invalidated_at IS NULL AND (valid_until IS NULL OR valid_until > E)`. -Occurrences and undated facts are always current (open verdict). A `state` -with a finite **future** end is current until it passes. **Every** current -fact read uses this predicate with `E` fixed per evaluation — the consumers -that today test `valid_until IS NULL` (entity profiles, source-removal -eligibility, K routing, `facts_current`) *and* the ones that today test -only `invalidated_at` (the `aggregate` count/group queries and the +A fact whose verdict start lies in the future is not yet current; a `state` +with a finite future end is current until it passes; occurrences and undated +facts are current from their start (or always, when undated). **Every** +current fact read uses this predicate with `E` fixed per evaluation — the +consumers that today test `valid_until IS NULL` (entity profiles, +source-removal eligibility, K routing) *and* the ones that today test only +`invalidated_at` (the `aggregate` count/group queries and the predicate-absence query, which would otherwise keep counting an expired relation and block a true absence answer; D49 requires fact-grain answers to be validity-filtered). -Cached artifacts (profiles, K pages) carry the earliest future -`valid_until` among their inputs as an explicit **expiry instant** in their -input hash, and a durable, indexed `fact_expiry_schedule` (keyed by the -artifact, the endpoint instant, and the generation; D12 idempotent) queues -regeneration when that instant passes, with the boundary instant as the +Cached artifacts (profiles, K pages) carry, in their input hash, the earliest +future **activation** instant (`valid_from > E`) and the earliest future +**expiry** instant (`valid_until > E`) among their inputs, and a durable, +indexed `fact_expiry_schedule` (keyed by the artifact, the boundary instant, +its kind — activation or expiry — and the generation; D12 idempotent) queues +regeneration when either instant passes, with the boundary instant as the evaluation time `E`; restart catches up from the schedule. The read-time predicate remains the correctness backstop, so a late sweep can delay a -refresh but never serve an expired fact as current. +refresh but never serve a not-yet-current or expired fact as current. ### 7.2 Prompts @@ -388,105 +432,125 @@ answer agent, which additionally names the envelope fields (`asserted_at`, The K fact sheet prints `valid from` / `valid until` from the verdict window only where the basis is `world_time` or `verdict`, prints `about` from the -occurrence window, and `—` for `unknown`; "Observation history" sorts by -`occurs_from`. The consumption skill states the three clocks, the two fact -kinds, and defines `claims_as_of` over source world-time (D41), not system -time. +occurrence window, `legacy` rows under a `legacy` heading, and `—` for +`unknown`; "Observation history" sorts by `occurs_from`. The consumption +skill states the three clocks, the two fact kinds, and defines +`claims_as_of` over source world-time (D41), not system time. ## 8. Generations and protocol -- Generations: the extractor (kinds, header), the normaliser (kind and - seeding), both adjudicators (matching by kind, succession, re-split), the - `adjudicate_observations` flush component, P1 labels and selection, K page - generation, and the query space (`canonical_bounds`, `claims_canonical`). +- Generations: the extractor (kinds, header), the normaliser (kind, seeding, + the staged relation write), both adjudicators (matching by kind, + succession, re-split, D55 by kind), the `adjudicate_observations` flush + component, P1 labels and selection, K page generation, and the query space + (`canonical_bounds`, `claims_canonical`). - Versions: the assured operations of §7.3, the surface and query-space manifests, OpenAPI/SDK, and the LoCoMo protocol. **Any package whose observable result semantics change rolls the protocol**, including ones - whose JSON shape does not (canonical comparison changes `claims_as_of` - results; labels, P1 selection and profile ranking change answer inputs); - packages released together roll it once. Scores across a roll are - directional. + whose JSON shape does not; packages released together roll it once. Scores + across a roll are directional. -## 9. Cutover: in-place conversion that preserves identity and history +## 9. Cutover: in-place conversion with recorded migration verdicts A store never mixes pre- and post-D107 fact semantics, and conversion never replaces a fact row — fact ids are provenance handles referenced by evidence, review payloads and K citations, and D55 keeps historical facts with no current support, which a replay from current testimony would erase. +Conversion is a **recorded migration adjudication** per fact (outcome +`migrate`, with the legacy and converted bounds in its features), so what it +did is auditable like any verdict. 1. **stop** intake and **drain** in-flight units (the D106 contract lets pre-roll observation units complete under their own generation); 2. **migrate** — add the new columns (`temporal_kind`, the two bases, - `occurs_from`/`occurs_until`/`occurs_precision`, `seed_claim_id`), make - the relations `EXCLUDE` partial on `state`, add the `undated` unique key, - the `fact_expiry_schedule` table, the `temporal_window` review kind, and - the `memory_v1` canonicalisation function and view; -3. **convert in place**, per fact, idempotently and in batches: `seed_claim_id` - := the `triggering_claim_id` of the fact's recorded `add` adjudication - (present on both planes, so the seed is the claim that actually created - the row — history-preserving, not a re-pick); `temporal_kind` and the - verdict window := from that seed claim's kind and canonical bounds by - §4.1, keeping any existing cap end (an existing `valid_until` set by a - recorded supersede or retraction keeps basis `verdict` / `source_removed`, - and a cap that the chronological guard would refuse is flagged for - review rather than dropped); `occurs_*` := the union over current - evidence; bases as derived. Conversion runs shadow-first (computed into - staging columns, validated against the invariants of §4.3, then swapped in - one transaction per batch) and resumes after a crash from the last - validated batch; -4. **readiness** reports the fact-layer generation; consumers refuse to - serve a store whose fact generation predates D107; + `occurs_from`/`occurs_until`/`occurs_precision`, `seed_claim_id`), + `triggering_claim_id` on relation adjudications, the non-empty `state` + check, the partial `EXCLUDE`, the `undated` unique key, the + `fact_expiry_schedule` table, the `temporal_window` review kind and + `temporal_window_verdicts`, and the `memory_v1` canonicalisation function + and view; +3. **convert in place**, per fact, idempotently and in batches, shadow-first + (computed into staging columns, validated against §4.1 and §4.3 + invariants, swapped in one transaction per batch, resumable from the last + validated batch): + - **seed** — an observation's seed is the `triggering_claim_id` of its + recorded `add` adjudication (present today except where hard forget + scrubbed it); a **relation's creator was never recorded**, so its seed + is *not* recovered: `seed_claim_id` stays `NULL`, the verdict window's + bases become `legacy`, and the fact's `temporal_kind` is derived from + the kinds of its attached evidence when they agree (all state, all + occurrence, all undated) and set to `undated` otherwise — every such + choice recorded in the migration adjudication; the same `legacy` path + applies to any observation whose seed was scrubbed; + - **windows** — with a recovered seed, `temporal_kind` and the verdict + window follow §4.1 from that seed's canonical bounds; without one, the + legacy `valid_from` is kept with basis `legacy`; `occurs_*` is the union + over attached evidence in every case; + - **legacy caps are not kept as they are**, because they are the said-on + and `now()` boundaries this decision removes: a legacy supersede cap + whose successor fact is recorded (the adjudication's related fact) is + recomputed at that successor's canonical world-time start when it has + one, basis `verdict`; a legacy cap on a row converted to `occurrence` + is removed (no-cap rule) with the cap moved to the belief interval only + if the row was withdrawn; a D55 fallback cap (the withdrawing version's + time unknown) becomes belief-time invalidation at the persisted + reconciliation instant with `valid_until` set to `unknown`; a cap that + cannot be recomputed (successor unknown or undated) is set to + `unknown` with a `legacy_unknown_boundary` review item, and a cap the + chronological guard would refuse is likewise routed to review; +4. **readiness** reports the fact-layer generation and the count of open + `legacy_unknown_boundary` items; consumers refuse to serve a store whose + fact generation predates D107, and the operator resolves or accepts the + open items before promoting the store; 5. **rollback** is restore of the pre-migration backup, as for any generation roll. Conversion does not re-adjudicate identity decisions made under the old rules: two occurrences a pre-D106 adjudicator merged stay one row until an -operator chooses a full rebuild of a fresh store (D7), which is a re-ingest, -not a migration. Only §6's added kinds benefit from re-extraction. +operator chooses a fresh rebuild (D7), which is a re-ingest, not a migration. +Only §6's added kinds benefit from re-extraction. ## 10. Alternatives considered - **Seed `valid_from` from the said-on date when the window is unknown** (revision 1). Withdrawn: provenance is not validity (Rule 2). - **Seed a measurement's or event's `valid_until` from its claim** - (revision 1). Withdrawn: D43 never caps a fixed-period figure; the period - belongs to the occurrence window. -- **Match every fact by verdict-window overlap** (revision 2). Withdrawn: an - occurrence's open verdict window overlaps every later occurrence. -- **An occurrence exclusion constraint on `occurs_*`** (revision 3). - Withdrawn: two distinct occurrences can legitimately overlap after - canonicalisation, and a union expansion could make a legal row illegal; - occurrence identity is adjudicated under the per-key lock. + (revision 1). Withdrawn: D43 never caps a fixed-period figure. +- **Match every fact by verdict-window overlap** (revision 2) and **an + occurrence exclusion constraint** (revision 3). Withdrawn: an occurrence's + open verdict window overlaps every later occurrence; two distinct + occurrences can legitimately overlap. +- **Overlap as the occurrence candidate filter** (revision 4). Withdrawn: it + removed D106's disjoint-date `contradict` path; nomination stays as today + and the temporal relation bounds the verdict. - **Automatic `extend_start` to the earliest evidenced start** (revision 2). - Withdrawn: `min()` over claim columns is the reduction D41 forbids; - revisions are `temporal_window` review verdicts. -- **A replay-based rebuild from current testimony** (revision 3). - Withdrawn: it discards D55 history, replaces fact ids that other tables - reference, and can re-pick seeds; conversion is in place from the recorded - `add` adjudication. -- **Universal half-open claim storage** (revision 1) and **"+ one unit" - effective ends with raw starts** (revisions 2–3). Withdrawn: the first - empties `instant`; the second over-expands normalised ends and leaves - non-aligned starts; both ends are now truncated to the unit, in SQL and - Python alike. + Withdrawn: `min()` over claim columns is the reduction D41 forbids. +- **A replay-based rebuild from current testimony** (revision 3) and + **exact seed recovery for every legacy fact** (revision 4). Withdrawn: + replay erases D55 history and re-picks seeds; relation creators were never + recorded, so legacy relations convert under an explicit `legacy` basis + with migration verdicts. +- **Keeping legacy cap boundaries through conversion** (revision 4). + Withdrawn: they are the said-on/`now()` values D107 removes; recoverable + caps are recomputed, the rest become belief-time closes or review items. +- **A current predicate without a lower bound** (revision 4). Withdrawn: it + made a 2030 fact current in 2026 and regressed `facts_current`; the full + containment predicate is used and activation is scheduled too. +- **State-ending candidates limited to open states** (revision 4). + Withdrawn: an ending event could not shorten a finite-ended state. +- **Universal half-open claim storage** (revision 1) and **"+ one unit" ends + with raw starts** (revisions 2–3). Withdrawn: both ends are truncated to + the unit, in SQL and Python alike. - **One coalesced key for processing order and succession** (revision 1). - Withdrawn: D90 needs a total processing order; succession needs world-time - bounds. + Withdrawn: D90 needs a total processing order. - **Succession only between two dated states** (revision 2). Withdrawn: it - made D106's dated-resignation case impossible; the state-ending candidate - set restores it. -- **Closing a retracted state on belief-time and labelling the world-time - end `source_removed`** (revision 3). Withdrawn: belief-time is not - world-time; the end stays `unknown` and only the belief interval closes, - from the persisted reconciliation instant. -- **Cap at the successor's said-on date as an upper bound** (revision 1). - Withdrawn: a retrospective's publication date proves nothing about when - the change happened. -- **Bake the resolved date into the observation statement** (revision 1). - Withdrawn: identity would depend on arrival order (D43); labels are - derived. -- **Twenty-one local patches.** The pattern recurs in every new consumer. -- **Keep `now()` as the undated cap.** Breaks rebuild stability (D7). + lost D106's ending-event case. +- **Closing a retracted state on belief-time labelled `source_removed`** + (revision 3). Withdrawn: belief-time is not world-time. +- **Cap at the successor's said-on date** (revision 1); **bake the resolved + date into the observation statement** (revision 1); **twenty-two local + patches**; **keep `now()` as the undated cap**. Withdrawn for the reasons + above. ## 11. Non-goals (scope boundaries) diff --git a/plan/plans/temporal_clocks.md b/plan/plans/temporal_clocks.md index 3f885f62d..002d3211c 100644 --- a/plan/plans/temporal_clocks.md +++ b/plan/plans/temporal_clocks.md @@ -18,11 +18,11 @@ tests that assert the *clock*, not only the outcome. | WP | Scope | Audit findings closed | Generations / surfaces rolled | Acceptance | | --- | --- | --- | --- | --- | | **WP-T.0 — canonical bounds** | `canonical_bounds` in Python and as `memory_v1.canonical_bounds` + the `claims_canonical` view (design §5): both ends truncated to the unit; instants as non-empty points; inclusive request conversion; used by `claims_as_of`, D106's disjointness test, the shipped `claims_as_of` example (with its `unknown` count fixed), open-query prose and catalog metadata | 4.13, 4.21 | query-space manifest; LoCoMo protocol (result semantics change) | an intraday `claims_as_of` window finds a day-precision claim; `claims_as_of(t, t)` is a point query; a year stored 2022-01-01…12-31 canonicalises to `[2022-01-01, 2023-01-01)`; a day whose stored start is noon canonicalises to the calendar day; an `instant` overlaps itself; adjacent day windows do not overlap; the example's `unknown` count is non-zero on a corpus with unstamped claims | -| **WP-T.1 — fact model, matching, closing, cutover** | migration: `temporal_kind`, `valid_from_basis`, `valid_until_basis`, `occurs_from`/`occurs_until`/`occurs_precision`, `seed_claim_id`; `EXCLUDE` partial on states, `undated` unique key, `fact_expiry_schedule`, the `temporal_window` review kind; seed once by kind from the recorded `add` claim; two candidate sets and adjudicated occurrence identity under the per-key lock (§4.2); `temporal_window` review verdicts with invariants and replay (§4.3); succession by any successor-supplied world-time instant incl. ending occurrences, the chronological guard, else coexist (§4.4); D55 unknown source time closes belief-time only, from the persisted reconciliation instant; D90 re-split by occurrence start (§4.5); the evaluated-at current predicate on every current read incl. aggregate/absence (§7.1); the durable expiry schedule; in-place, shadow-first, resumable conversion and the readiness gate (§9) | 4.2, 4.4, 4.10, 4.11, 4.17, 4.20 | normaliser, both adjudicators, obs flush component; schema head; fact-layer generation in readiness; LoCoMo protocol | `lookup_relations(valid_at=2010)` returns the 2010 employer and excludes the 2024 one; a January and an October visit are two occurrence relations, two same-day visits judged `new` coexist, and a union expansion bridging two occurrences merges nothing; the same ingest replayed on different days yields byte-identical windows; both adjudicators orient one undated/dated pair identically (coexist); a dated resignation still caps an undated "is CEO" state; a purported cap at or before a known start routes to contradict/coexist plus a review item; a `temporal_window` verdict applies, reverses, and replays idempotently; the staggered D90 case with said-on and is-about reversed yields world-ordered slices; a retraction with unknown source time leaves `valid_until` unknown and sets `invalidated_at` to the recorded reconciliation instant; an expired relation no longer counts in `aggregate` nor blocks `predicate_absence`; a state with a future end is current today and its profile refreshes when the end passes, including after a restart; conversion of a store keeps every fact id and every D55 historical fact, and readiness refuses an unconverted store | +| **WP-T.1 — fact model, matching, closing, cutover** | migration: `temporal_kind`, `valid_from_basis`, `valid_until_basis`, `occurs_from`/`occurs_until`/`occurs_precision`, `seed_claim_id`, `triggering_claim_id` on relation adjudications, the non-empty state check, `EXCLUDE` partial on states, `undated` unique key, `fact_expiry_schedule`, the `temporal_window` review kind and `temporal_window_verdicts`; seed once by kind with the seed recorded atomically on both planes; nomination as today with verdicts bounded by temporal relation, two candidate sets (state-ending includes finite-ended states), and the staged, idempotent relation write (§4.2); `temporal_window` verdicts with invariants, the documented reversal exception, and replay (§4.3); succession by any successor-supplied world-time instant incl. ending occurrences, the chronological guard on every cap source incl. D55, else contradict/coexist + review (§4.4); D55 by temporal kind with belief-time closes from the persisted reconciliation instant; D90 re-split by occurrence start (§4.5); the full containment current predicate on every current read incl. aggregate/absence, with activation and expiry scheduling (§7.1); occurrence windows over all attached evidence (D55 history retained); in-place conversion with migration adjudications, the `legacy` basis for unrecoverable seeds, legacy-cap recomputation, `legacy_unknown_boundary` review items, and the readiness gate (§9) | 4.2, 4.4, 4.10, 4.11, 4.17, 4.20, 4.22 | normaliser, both adjudicators, obs flush component; schema head; fact-layer generation in readiness; LoCoMo protocol | `lookup_relations(valid_at=2010)` returns the 2010 employer and excludes the 2024 one; a fact starting in 2030 is not current in 2026 and its profile activates when it starts; a January and an October visit are two occurrence relations, two same-day visits judged `new` coexist, a disjoint pair the ladder judges one disputed occurrence contradicts, and a union expansion bridging two occurrences merges nothing; a same-triple occurrence claim is held unattached until its verdict and a retried claim replays it; the same ingest replayed on different days yields byte-identical windows; both adjudicators orient one undated/dated pair identically (coexist); a dated resignation caps an undated "is CEO" state and a 2027 resignation shortens "CEO 2025–2030"; a purported cap at or before a known start routes to contradict/coexist plus a review item; a `state` with `valid_until = valid_from` is rejected by the schema; a `temporal_window` verdict applies, is reversed by a compensating verdict, and replays idempotently; the staggered D90 case with said-on and is-about reversed yields world-ordered slices; a withdrawn state with unknown source time leaves `valid_until` unknown and sets `invalidated_at` to the recorded reconciliation instant, and a withdrawn occurrence keeps its `occurs_*`; an expired relation no longer counts in `aggregate` nor blocks `predicate_absence`; a state with a future end is current today and its profile refreshes when the end passes, including after a restart; conversion keeps every fact id and every D55 historical fact, converts a legacy relation under basis `legacy` with a migration adjudication, recomputes a recoverable legacy cap at its successor's world-time start, removes a cap from a converted occurrence, turns a D55 fallback cap into a belief-time close, raises `legacy_unknown_boundary` for the rest, and readiness refuses an unconverted store and reports the open item count | | **WP-T.2 — two clocks in every temporal prompt** | relation supersession prompt and laterals show `said on` / `is about`; T4 candidate salient facts carry occurrence windows and kinds and rank by evidence then occurrence recency; K writer claims carry `asserted_at` + D41 fields; answer-agent prompt names the envelope fields | 4.3, 4.6, 4.8, 4.16 | relation adjudicator, resolver, K writer; LoCoMo protocol | a 2024 retrospective spell does not supersede a 2023 current fact in the supersession proofs; T4 sees windows and kinds in its candidate JSON; the answer prompt fixture contains the two-clock paragraph | | **WP-T.3 — retrieval keys, envelopes, skill** | dedupe on the full D41 tuple (or `asserted_at` when unknown) with `grouped_members`; `Validity`, `GraphEdge`, the K fact model and `memory_v1` fact views gain bases, kind and occurrence; `resolve_entity@2`, `testimony_context@2`, `fact_context@3`, `answer_context@3`; open-query confirmation returns the full D41 tuple and fact bases/occurrence; P1 is-about claim filters and the `occurs` fact mode; timeline by occurrence with an `undated` bucket; consumption skill teaches the three clocks and two fact kinds and defines `claims_as_of` over world-time | 4.1, 4.9, 4.12, 4.18, 4.19 | assured operation versions, surface manifest hash, query-space manifest, generated OpenAPI/SDK; LoCoMo protocol | identical text on two dates is two evidence rows in `testimony_context`, and a grouped row lists every member's times; a 2015–2020 archive imported today produces 2015–2020 timeline buckets; the regenerated skill text contains the corrected `claims_as_of` definition; an open-query claim row carries precision and kind | | **WP-T.4 — extraction vocabulary and anchor** | all four D41 kinds and `open` taught with examples and field descriptions; full-timestamp header | 4.14, 4.15 | extractor; LoCoMo protocol | "has been CEO since 2019" extracts as `proposition_validity` / `open`; "three hours ago" in a source stamped 19:30 resolves to an `instant` at 16:30 of that day, and the same words in a second same-day source stamped 22:00 resolve to a different instant | -| **WP-T.5 — dated labels and consumer surfaces** | labels derived from statement + occurrence window (obs label, `FactResult.label`, profile lines); K fact sheet columns by basis with an `about` column; observation history by `occurs_from` | 4.5, 4.7 | P1 labels and selection, K page generation; LoCoMo protocol (answer inputs change) | an observation minted from "last week" carries the resolved date in its label but not its statement; a sheet never prints a said-on date under a world-time heading | +| **WP-T.5 — dated labels and consumer surfaces** | labels derived from statement + occurrence window (obs label, `FactResult.label`, profile lines); K fact sheet columns by basis with `about` and `legacy` handling; observation history by `occurs_from` | 4.5, 4.7 | P1 labels and selection, K page generation; LoCoMo protocol (answer inputs change) | an observation minted from "last week" carries the resolved date in its label but not its statement; a sheet never prints a said-on date under a world-time heading | Dependencies: T.0 first. T.1 depends on T.0. T.2, T.3 and T.5 depend on T.1's columns and cutover. T.4 is independent and may run in parallel. From 534cebcaedaa34e5dd81454bbbb3dfc44d9662f0 Mon Sep 17 00:00:00 2001 From: Jiri Puc Date: Thu, 3 Sep 2026 16:00:21 +0200 Subject: [PATCH 6/8] design: separate fact shape from datedness; fail-closed D55; record open items (D107 round 5) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codex's fifth review: mapping a NULL claim kind to an `undated` temporal kind conflated shape with datedness, so "is CEO" with no start was uncappable and D106's ending-event case was lost again; the verdict matrix omitted supersede for states; the observations banner still carried the withdrawn overlap-filter wording; relation_adjudications already has triggering_claim_id (populate, not add); adjudication_outcome has no `migrate` value; a D55 cap refused by the guard left a zombie fact; three audit sentences overstated; one section reference was wrong. It also named four contracts beyond this design's scope: deterministic relation seeding under D88 concurrency, locked compare-and-swap review application, cached-artifact staleness, and the D74 hard-forget inventory. Kinds are now shape only (state / occurrence / unknown) with bounds known or unknown independently; a state with unknown bounds can be ended; only an undated successor cannot supply a boundary; the guard is stated mechanically; states may supersede within the matrix; D55 closes belief time fail-closed whenever the world-time cap is unknown or refused; schema wording corrected and a postgres_schema_design amendment required; §4.3 gains the CAS precondition, order key and item uniqueness; a new §12 records the four open contracts and WP-T.1 is gated on them. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016p9xB9T7VYREuVmohDPKjR --- plan/analysis/time_handling_audit.md | 19 +-- plan/designs/observations_design.md | 10 +- plan/designs/temporal_clocks_design.md | 190 ++++++++++++++++++------- plan/plans/temporal_clocks.md | 2 +- 4 files changed, 153 insertions(+), 68 deletions(-) diff --git a/plan/analysis/time_handling_audit.md b/plan/analysis/time_handling_audit.md index 450af86d0..a13fe9ca8 100644 --- a/plan/analysis/time_handling_audit.md +++ b/plan/analysis/time_handling_audit.md @@ -167,9 +167,10 @@ spells the distinction out for the verdict model. ### 4.7 K fact sheets label the said-on date "valid since" and sort history by it (P2, P5) `src/rememberstack/core/knowledge_fact_sheet.py:55-63`, `:72-99`: the -"Current relations" column `valid since` is `fact.valid_from` (always empty -for relations, 4.2) and the observation table's `valid from` is the session -date; "Observation history" is sorted by that same value, so a back-dated +"Current relations" column `valid since` is `fact.valid_from` (empty for +every first spell of a relation, 4.2; a re-occurring spell shows the prior +spell's end) and the observation table's `valid from` is the session date; +"Observation history" is sorted by that same value, so a back-dated retrospective reads in the wrong order. ### 4.8 The K prose writer's claims carry no dates at all (P4) @@ -183,9 +184,10 @@ week". ### 4.9 `aggregate(form="timeline")` buckets by ingest year (P2, P6) `query_engine.py:4285-4307`: `coalesce(valid_from, ingested_at)` for both fact -kinds. With 4.2, the relation half is entirely ingest time; the observation -half is said-on time. A 2015–2020 archive imported today is one bar labelled -2026, under a docstring that says "an entity's facts by year" (`:2087-2088`). +kinds. With 4.2, most relation entries fall back to ingest time (only +re-occurring spells carry a start); the observation half is said-on time. A +2015–2020 archive imported today is one bar labelled 2026, under a docstring +that says "an entity's facts by year" (`:2087-2088`). ### 4.10 Observation batch order — who supersedes whom — follows the said-on clock (P5) @@ -320,8 +322,9 @@ invalidates every withdrawn observation, by its own docstring because `evidence_lifecycle_design.md:153-165` ask for a per-shape judgement — a withdrawn effective state caps its world-time, a withdrawn measurement keeps its window and closes belief only. Without a temporal kind the code cannot -make that judgement, so a withdrawn state observation is recorded as *never -believed* rather than *ended*. +make that judgement, so a withdrawn state observation gets a belief-time +invalidation where D55 requires a world-time close: its state end is never +recorded, and the removal is classified as invalidation. ## 5. Checked and sound diff --git a/plan/designs/observations_design.md b/plan/designs/observations_design.md index b126b3689..4ad1afbd9 100644 --- a/plan/designs/observations_design.md +++ b/plan/designs/observations_design.md @@ -6,10 +6,12 @@ > recorded seed claim), seeded once from the D90-first claim's canonical D41 > window — a state's span; an occurrence believed from its start onward and > never capped; `NULL`/`unknown` when undated — and a derived occurrence -> window (`occurs_*`) that widens as evidence attaches. Occurrence identity -> is adjudicated under the entity lock — overlapping windows are a candidate -> filter the D106 rung judges, never identity — so recurring events stay -> distinct rows; the rung compares canonical bounds. The said-on +> window (`occurs_*`) that widens as evidence attaches. Candidate nomination +> is unchanged (entity block, then similarity order, regardless of temporal +> overlap); the temporal relation of canonical bounds only bounds the verdict, +> so a disjoint pair may still contradict (D106) and recurring events stay +> distinct rows because occurrence identity is the ladder's verdict under +> the entity lock. The said-on > date is never a boundary. No verdict changes automatically (discrepancies > become `temporal_window` review verdicts, D24); a state is capped only at a > world-time instant its successor supplies, later than its own known start — a successor state's start or an ending occurrence's diff --git a/plan/designs/temporal_clocks_design.md b/plan/designs/temporal_clocks_design.md index 9a667baf0..7326065a5 100644 --- a/plan/designs/temporal_clocks_design.md +++ b/plan/designs/temporal_clocks_design.md @@ -3,11 +3,16 @@ **Status:** binding under D107 **Date:** 2026-09-03 (fifth revision the same day, after four independent -Codex design reviews; §11 records what each round withdrew) +Codex design reviews; §10 records what each round withdrew) **Analysis:** `plan/analysis/time_handling_audit.md` (twenty-two findings at `02b79904`, each cited by file and function) +**Open under D107 (decided in the sequencing, not here):** deterministic +relation seeding under D88 concurrency, the locked compare-and-swap +application of review verdicts, cached-artifact staleness, and the D74 +hard-forget inventory — see §12. + **Builds on:** D41 (claims carry an immutable, source-asserted validity interval; a fact's window is the adjudicator's single recorded verdict, never a reduction over claim columns, never reopened by a late retrospective), @@ -58,20 +63,32 @@ resolved bounds are; a start with `claim_valid_until IS NULL` is **open**; read the is-about window. The said-on clock is displayed as provenance and orders processing; it is never a window boundary. - **Rule 2 — a missing time stays missing.** An unknown is-about window - leaves a fact's windows `NULL` with basis `unknown`. Nothing is ever filled - with `now()`, with the said-on date, or with belief-time; an undated fact - never caps another and is never capped; it coexists, recorded. + leaves a fact's window endpoints `NULL` with basis `unknown`. Nothing is + ever filled with `now()`, with the said-on date, or with belief-time. A + fact whose bounds are unknown may still be *ended* by a successor that + supplies a world-time instant (a dated resignation ends "is CEO" even when + nobody said when the tenure began — D106); what an undated fact can never + do is *supply* a boundary to another. ## 3. Two kinds of fact, two windows -Every fact (relation or observation) carries a **temporal kind** and two +Every fact (relation or observation) carries a **temporal kind** — its +*shape*, which is independent of whether its bounds are known — and two windows with different authority: | `temporal_kind` | seeded from claim kind | what the fact says | identity | | --- | --- | --- | --- | -| `state` | `effective_period`, `proposition_validity` | something held over a span ("was CEO 2015–2018") | key + **verdict window** (disjoint slices per key; the relations `EXCLUDE`) | +| `state` | `effective_period`, `proposition_validity` | something held over a span ("was CEO 2015–2018"; "is CEO" with no start given) | key + **verdict window** (disjoint slices per key; the relations `EXCLUDE`) — bounds may be unknown | | `occurrence` | `event_time`, `measurement_period` | something happened, or a figure for a span ("won the final on 2022-11-05"; "FY2023 revenue was $5M") | key + an **adjudicated** occurrence identity (§4.2) — windows may overlap | -| `undated` | `NULL` | the source tied nothing to a date | key (+ statement wording for observations) | +| `unknown` | `NULL` kind, and the ladder cannot tell shape from wording | the source tied nothing to a date and the statement does not say whether it is a state or an occurrence | key (+ statement wording for observations) | + +Shape and datedness are different questions. A claim with no D41 window is +first classified by the normaliser's existing shape judgement (a state or +an occurrence, from the wording, the same call that routes a claim to a +relation or an observation); only when that judgement is itself unsure is +the fact's kind `unknown`. A `state` with unknown bounds is still a state: +it can be superseded and ended, and it is what most undated "X is Y" +testimony becomes. | Window | Columns | Authority | Changes when | | --- | --- | --- | --- | @@ -104,7 +121,9 @@ are the seed claim's **canonical bounds** (§5): | --- | --- | --- | --- | --- | --- | | `effective_period`, `proposition_validity` | `state` | canonical start | canonical end (bounded span → a closed historical slice; open → `NULL`) | `world_time` / `world_time`, or `unknown` for an open end | same as the verdict window | | `event_time`, `measurement_period` | `occurrence` | canonical start (believed from then on) | `NULL` — never capped (D43, extended to events) | `world_time` / `unknown` | the claim's canonical window | -| `NULL` | `undated` | `NULL` | `NULL` | `unknown` / `unknown` | `NULL` | +| `NULL`, shape judged `state` | `state` | `NULL` | `NULL` | `unknown` / `unknown` | `NULL` | +| `NULL`, shape judged `occurrence` | `occurrence` | `NULL` | `NULL` | `unknown` / `unknown` | `NULL` | +| `NULL`, shape unsure | `unknown` | `NULL` | `NULL` | `unknown` / `unknown` | `NULL` | The re-occurrence floor (a reopened state slice starts no earlier than the prior closed slice's end) applies **only** when the seed's start is provably @@ -128,24 +147,27 @@ the ladder, as D106 requires. What changes is the **two candidate sets** and the **verdicts a temporal relation permits**: - **same-kind candidates** — live facts of the same key and the same - `temporal_kind`; eligible for `evidence`, `contradict`, or `new`; + `temporal_kind`; eligible for `evidence`, `supersede` (states only), + `contradict`, or `new`; - **state-ending candidates** — for an incoming `occurrence` claim only: the non-invalidated `state` slices of the same key (for observations, the same - entity) whose interval extends beyond the occurrence's canonical start — - open-ended *or* finite-ended (a 2027 resignation must reach "CEO - 2025–2030") — eligible **only** for `supersede` or `contradict` (§4.4), - never for evidence. This is the cross-kind comparison D106's dated - resignation needs to end an "is CEO" state. + entity) whose known interval does not end before the occurrence's + canonical start — bounds unknown, open-ended, *or* finite-ended (a 2027 + resignation must reach "CEO 2025–2030", and a dated resignation must reach + "is CEO" with no start given) — eligible **only** for `supersede` or + `contradict` (§4.4), never for evidence. This is the cross-kind comparison + D106's dated resignation needs. Within the same-kind set, the temporal relation of the two canonical -windows bounds the verdict, as D106 does today: +windows bounds the verdict, as D106 does today (`supersede` rows apply to +states; occurrences are never superseded): | relation | permitted verdicts | | --- | --- | -| both dated, **disjoint** | `new`, or `contradict` when the ladder finds one occurrence with a disputed date (D106) — never `evidence`, never `supersede` | -| both dated, **overlapping** | `evidence` (the same occurrence or state re-mentioned; `occurs_*` widens), `contradict`, `new` (a different occurrence that merely overlaps: two visits on one day; a day-precision and an instant-precision claim about different things) | -| **mixed** (one dated, one undated) | `supersede` / `contradict` / `new` — never `evidence` | -| both undated | as today | +| both dated, **disjoint** | `new`, or `contradict` when the ladder finds one occurrence with a disputed date (D106); for states, `supersede` only when the incoming start is later than the existing start (a later disjoint spell that ends the earlier one at the incoming start) — never `evidence` | +| both dated, **overlapping** | `evidence` (the same occurrence or state re-mentioned; `occurs_*` widens), `supersede` (a state's value changed; cap at the incoming start under the guard), `contradict`, `new` (a different occurrence that merely overlaps: two visits on one day; a day-precision and an instant-precision claim about different things) | +| **mixed** (one dated, one undated) | `supersede` (only when the *incoming* side is dated — it supplies the boundary), `contradict`, `new` — never `evidence` | +| both undated | `evidence`, `contradict`, `new` — never `supersede` (no boundary exists) | Consequences by kind: @@ -162,12 +184,14 @@ prevent duplicates. Acceptance covers same-key recurring events, coarse and fine precision overlap judged `new`, a disjoint pair judged `contradict`, and a union expansion bridging two existing occurrences. -**Undated claims.** Observations: identical wording collapses onto an -existing `undated` row of the same key, otherwise a new `undated` row. -Relations: the triple *is* the content, so an undated claim attaches to the -single open `state` slice if exactly one exists, else to the single `undated` -row for the key (creating it once); it never attaches to an `occurrence` and -never creates a second unbounded slice. +**Undated claims.** A claim without a D41 window takes its shape from the +normaliser's judgement (§3) and then follows its kind's rules with unknown +bounds. Observations of kind `unknown`: identical wording collapses onto an +existing `unknown` row of the same key, otherwise a new row. Relations: the +triple *is* the content, so an undated relation claim attaches to the single +open `state` slice if exactly one exists, else seeds one `state` slice with +unknown bounds for the key (created once); it never attaches to an +`occurrence` and never creates a second unbounded slice. **The relation write path becomes staged.** Today `upsert_relation` finds a live triple and attaches evidence before the relation ladder runs, which @@ -184,8 +208,9 @@ no-op" short-circuit applies to `state` and `undated` triples only. **Relations schema.** The existing GiST `EXCLUDE` on `(subject, predicate, object) && tstzrange(valid_from, valid_until)` becomes partial on -`temporal_kind = 'state'`; `undated` relations get a unique key on the -triple; occurrence relations have no constraint. +`temporal_kind = 'state'` (an unbounded-bounds state slice is one range +`(,)` under it, so the "created once" rule above is what the constraint +enforces); occurrence relations have no constraint. ### 4.3 Revising a verdict: a `temporal_window` review verdict (amends D24) @@ -209,17 +234,26 @@ a dated `occurrence`) and raised as a `review_queue` item of a new kind, | `reverses_verdict_id` | set on a reversal | Invariants checked before apply, for verdicts that are not reversals: the -start may move earlier, never later; no endpoint moves past a neighbouring -slice's bound; a closed end is never reopened (D41); a `state` with two -known endpoints stays non-empty. **Reversal is the one documented +start may move earlier, never later, and an `unknown` start may become known +(the transition `NULL → known` is the one permitted "later" move, because +there was no start before); no endpoint moves past a neighbouring slice's +bound; a closed end is never reopened (D41); a `state` with two known +endpoints stays non-empty. A verdict applies only under the fact's lock and +only when the fact's current bounds and bases still equal its `old_*` +values (compare-and-swap); a stale verdict is not applied and returns to +review. Review items are unique per `(fact, discrepancy fingerprint)` so a +recurring recompute raises one item, not many. The full locked, ordered +application contract — including how a reversal compensates only the +endpoints its referenced verdict changed while preserving intervening caps +and retractions — is an open item of §12. **Reversal is the one documented exception**: a reviewer may reverse a `temporal_window` verdict with a compensating verdict that restores the prior bounds and bases exactly — D24's reversibility applies to human verdicts over human verdicts, while D41's retrospective guard governs evidence-driven change; the two do not conflict because no evidence ever moves a window. Verdicts apply in -`decided_at` order after caps and retractions on the same fact and replay in -that order on rebuild (D7). Anything the invariants refuse stays a review -item. +`(decided_at, verdict_id)` order after caps and retractions on the same +fact and replay in that order on rebuild (D7). Anything the invariants refuse +stays a review item. ### 4.4 Closing: temporal succession, separate from processing order @@ -237,9 +271,10 @@ successor**: dated resignation ends an "is CEO" state whose own start may be unknown, and a 2027 resignation shortens "CEO 2025–2030" to end in 2027. -**Chronological guard, applied to every cap source including D55:** the -boundary must be later than the predecessor's known verdict start and -earlier than its known end; otherwise it is not a cap — the ladder's outcome +**Chronological guard, applied to every cap source including D55**, stated +mechanically over the predecessor's verdict window: +`(valid_from IS NULL OR T > valid_from) AND (valid_until IS NULL OR T < +valid_until)`. A boundary that fails it is not a cap — the ladder's outcome is recorded, the pair routes to `contradict` (both stand, grouped) when the values conflict and coexists otherwise, and a `temporal_window` review item is raised. When the successor supplies no world-time instant (an undated @@ -248,21 +283,25 @@ adjudication row records `reason = "no world-time boundary -> coexist"`. The cap's basis is `verdict`. Relation supersession and observation supersession share this one rule. `now()` is never a boundary. -**Retraction (D55) by temporal kind.** A withdrawn `state` whose withdrawing -document version has a known source time is capped there under the guard -(basis `source_removed`); when that time is unknown, the world-time end stays -`unknown` and only the belief interval closes — `invalidated_at` set from the +**Retraction (D55) by temporal kind, fail-closed.** A withdrawn `state` +whose withdrawing document version has a known source time is capped there +under the guard (basis `source_removed`). When that time is unknown, **or +the guard refuses it**, the world-time end stays `NULL` with basis `unknown` +and the belief interval closes regardless — `invalidated_at` set from the **persisted reconciliation event's timestamp**, never from the database -clock, so a rebuild replays the same instant. A withdrawn `occurrence` or -`undated` fact is never capped: it closes on belief-time the same way. This -is the per-shape judgement D55 asks for and `close_observations` could not -make while shape was semantic; `temporal_kind` makes it mechanical. +clock, so a rebuild replays the same instant and a sole-support removal can +never leave a zombie fact that later activates; a refused boundary is +additionally sent to review as the disputed world-time endpoint. A withdrawn +`occurrence` or `unknown`-kind fact is never capped: it closes on belief-time +the same way. This is the per-shape judgement D55 asks for and +`close_observations` could not make while shape was semantic; +`temporal_kind` makes it mechanical. **Residual, measured rather than assumed:** undated, differently worded -restatements of a changing state coexist as `undated` rows instead of +restatements of a changing state coexist as unknown-bounds rows instead of capping. Identical wording collapses (§4.2), so growth comes only from -distinct undated wordings; the count of `undated` rows per key is a reported -metric and the lever is extraction coverage of the D41 kinds (§6). +distinct undated wordings; the count of unknown-bounds rows per key is a +reported metric and the lever is extraction coverage of the D41 kinds (§6). ### 4.5 The D90 late-arrival re-split uses the world clock @@ -464,11 +503,13 @@ did is auditable like any verdict. pre-roll observation units complete under their own generation); 2. **migrate** — add the new columns (`temporal_kind`, the two bases, `occurs_from`/`occurs_until`/`occurs_precision`, `seed_claim_id`), - `triggering_claim_id` on relation adjudications, the non-empty `state` - check, the partial `EXCLUDE`, the `undated` unique key, the + the non-empty `state` check, the partial `EXCLUDE`, the `fact_expiry_schedule` table, the `temporal_window` review kind and - `temporal_window_verdicts`, and the `memory_v1` canonicalisation function - and view; + `temporal_window_verdicts`, the `adjudication_outcome` value `migrate` + and `adjudication_method` value `migration`, and the `memory_v1` + canonicalisation function and view (`relation_adjudications.triggering_claim_id` + already exists and is populated from now on; `postgres_schema_design.md` + receives the matching D107 amendment with the full DDL); 3. **convert in place**, per fact, idempotently and in batches, shadow-first (computed into staging columns, validated against §4.1 and §4.3 invariants, swapped in one transaction per batch, resumable from the last @@ -494,9 +535,10 @@ did is auditable like any verdict. is removed (no-cap rule) with the cap moved to the belief interval only if the row was withdrawn; a D55 fallback cap (the withdrawing version's time unknown) becomes belief-time invalidation at the persisted - reconciliation instant with `valid_until` set to `unknown`; a cap that - cannot be recomputed (successor unknown or undated) is set to - `unknown` with a `legacy_unknown_boundary` review item, and a cap the + reconciliation instant with `valid_until` set to `NULL`, basis + `unknown`; a cap that + cannot be recomputed (successor unknown or undated) is set to `NULL`, + basis `unknown`, with a `legacy_unknown_boundary` review item, and a cap the chronological guard would refuse is likewise routed to review; 4. **readiness** reports the fact-layer generation and the count of open `legacy_unknown_boundary` items; consumers refuse to serve a store whose @@ -547,6 +589,10 @@ Only §6's added kinds benefit from re-extraction. lost D106's ending-event case. - **Closing a retracted state on belief-time labelled `source_removed`** (revision 3). Withdrawn: belief-time is not world-time. +- **An `undated` temporal kind that conflates shape with datedness** + (revisions 3–5). Withdrawn: it made "is CEO" with no start uncappable and + so lost D106's ending-event case again; shape and datedness are separate, + and only an undated *successor* is barred from supplying a boundary. - **Cap at the successor's said-on date** (revision 1); **bake the resolved date into the observation statement** (revision 1); **twenty-two local patches**; **keep `now()` as the undated cap**. Withdrawn for the reasons @@ -562,10 +608,44 @@ Only §6's added kinds benefit from re-extraction. window stays the one adjudicated home; the occurrence window is derived metadata and is documented as such wherever it is shown. +## 12. Open items this design does not yet decide + +Four contracts were identified by the fifth independent review as necessary +for implementation and as touching decisions beyond this design's current +scope. They are recorded here as open, are gated in `plan/plans/temporal_clocks.md` +WP-T.1, and each is a spike whose result amends the named design before that +package starts: + +1. **Deterministic relation seeding under D88 concurrency.** D88 lets + concurrent claim jobs upsert relations ("relation evidence attach is + commutative"); a per-key lock serialises arrival, not the D90 total + order, so which claim seeds a relation is a race. Required: a durable, + claim-idempotent relation staging relation and a post-barrier per-block + drain in the total order, analogous to D90 for observations — an + amendment to D88 and `e3_claim_level_normalize_fanout_design.md`. +2. **The locked application of `temporal_window` verdicts.** §4.3 fixes the + compare-and-swap precondition, the order key and item uniqueness; + remaining are the per-fact locking rule between review and + ingestion/retraction writes, dependency validation on replay, and the + compensating-reversal algorithm that preserves intervening caps. +3. **Cached-artifact staleness.** §7.1's schedule regenerates profiles and K + pages when their inputs' boundaries pass; remaining are how a future fact + that is not yet an input becomes a scheduled dependency, transactional + schedule maintenance on every boundary change, draining and coalescing + boundaries missed during downtime with the current instant as `E`, and a + checked stale state (or a D49-disclosed staleness) for an artifact whose + refresh is late, since the read-time predicate cannot protect + already-rendered text. +4. **Hard-forget inventory (D74).** `seed_claim_id`, `occurs_*`, the review + payloads, `temporal_window_verdicts` (seed, actor, rationale, bounds), + migration-adjudication features, the expiry schedule, derived labels and + their embeddings must each be classified as delete / null / recompute in + `hard_forget_design.md` §4 and the canary matrix. + ## References Decisions: D107 (this design), D41, D3, D4, D43, D88, D90, D106, D24, D7, -D12, D55, D49. Analysis: `plan/analysis/time_handling_audit.md`. Sequencing: +D12, D55, D49, D74. Analysis: `plan/analysis/time_handling_audit.md`. Sequencing: `plan/plans/temporal_clocks.md`. Affected designs carry a D107 amendment banner: `e2_e3_claims_relations_design.md`, `observations_design.md`, `registries_design.md`, `retrieval_design.md`, `k_layers_design.md`, diff --git a/plan/plans/temporal_clocks.md b/plan/plans/temporal_clocks.md index 002d3211c..872154ec2 100644 --- a/plan/plans/temporal_clocks.md +++ b/plan/plans/temporal_clocks.md @@ -18,7 +18,7 @@ tests that assert the *clock*, not only the outcome. | WP | Scope | Audit findings closed | Generations / surfaces rolled | Acceptance | | --- | --- | --- | --- | --- | | **WP-T.0 — canonical bounds** | `canonical_bounds` in Python and as `memory_v1.canonical_bounds` + the `claims_canonical` view (design §5): both ends truncated to the unit; instants as non-empty points; inclusive request conversion; used by `claims_as_of`, D106's disjointness test, the shipped `claims_as_of` example (with its `unknown` count fixed), open-query prose and catalog metadata | 4.13, 4.21 | query-space manifest; LoCoMo protocol (result semantics change) | an intraday `claims_as_of` window finds a day-precision claim; `claims_as_of(t, t)` is a point query; a year stored 2022-01-01…12-31 canonicalises to `[2022-01-01, 2023-01-01)`; a day whose stored start is noon canonicalises to the calendar day; an `instant` overlaps itself; adjacent day windows do not overlap; the example's `unknown` count is non-zero on a corpus with unstamped claims | -| **WP-T.1 — fact model, matching, closing, cutover** | migration: `temporal_kind`, `valid_from_basis`, `valid_until_basis`, `occurs_from`/`occurs_until`/`occurs_precision`, `seed_claim_id`, `triggering_claim_id` on relation adjudications, the non-empty state check, `EXCLUDE` partial on states, `undated` unique key, `fact_expiry_schedule`, the `temporal_window` review kind and `temporal_window_verdicts`; seed once by kind with the seed recorded atomically on both planes; nomination as today with verdicts bounded by temporal relation, two candidate sets (state-ending includes finite-ended states), and the staged, idempotent relation write (§4.2); `temporal_window` verdicts with invariants, the documented reversal exception, and replay (§4.3); succession by any successor-supplied world-time instant incl. ending occurrences, the chronological guard on every cap source incl. D55, else contradict/coexist + review (§4.4); D55 by temporal kind with belief-time closes from the persisted reconciliation instant; D90 re-split by occurrence start (§4.5); the full containment current predicate on every current read incl. aggregate/absence, with activation and expiry scheduling (§7.1); occurrence windows over all attached evidence (D55 history retained); in-place conversion with migration adjudications, the `legacy` basis for unrecoverable seeds, legacy-cap recomputation, `legacy_unknown_boundary` review items, and the readiness gate (§9) | 4.2, 4.4, 4.10, 4.11, 4.17, 4.20, 4.22 | normaliser, both adjudicators, obs flush component; schema head; fact-layer generation in readiness; LoCoMo protocol | `lookup_relations(valid_at=2010)` returns the 2010 employer and excludes the 2024 one; a fact starting in 2030 is not current in 2026 and its profile activates when it starts; a January and an October visit are two occurrence relations, two same-day visits judged `new` coexist, a disjoint pair the ladder judges one disputed occurrence contradicts, and a union expansion bridging two occurrences merges nothing; a same-triple occurrence claim is held unattached until its verdict and a retried claim replays it; the same ingest replayed on different days yields byte-identical windows; both adjudicators orient one undated/dated pair identically (coexist); a dated resignation caps an undated "is CEO" state and a 2027 resignation shortens "CEO 2025–2030"; a purported cap at or before a known start routes to contradict/coexist plus a review item; a `state` with `valid_until = valid_from` is rejected by the schema; a `temporal_window` verdict applies, is reversed by a compensating verdict, and replays idempotently; the staggered D90 case with said-on and is-about reversed yields world-ordered slices; a withdrawn state with unknown source time leaves `valid_until` unknown and sets `invalidated_at` to the recorded reconciliation instant, and a withdrawn occurrence keeps its `occurs_*`; an expired relation no longer counts in `aggregate` nor blocks `predicate_absence`; a state with a future end is current today and its profile refreshes when the end passes, including after a restart; conversion keeps every fact id and every D55 historical fact, converts a legacy relation under basis `legacy` with a migration adjudication, recomputes a recoverable legacy cap at its successor's world-time start, removes a cap from a converted occurrence, turns a D55 fallback cap into a belief-time close, raises `legacy_unknown_boundary` for the rest, and readiness refuses an unconverted store and reports the open item count | +| **WP-T.1 — fact model, matching, closing, cutover** | **gated on the four §12 spikes (D88 relation staging; locked review application; artifact staleness; D74 inventory), each landing as a design amendment first;** migration: `temporal_kind`, `valid_from_basis`, `valid_until_basis`, `occurs_from`/`occurs_until`/`occurs_precision`, `seed_claim_id`, populating the existing `relation_adjudications.triggering_claim_id` on `add`, the `migrate`/`migration` adjudication enum values, the non-empty state check, `EXCLUDE` partial on states, `undated` unique key, `fact_expiry_schedule`, the `temporal_window` review kind and `temporal_window_verdicts`; seed once by kind with the seed recorded atomically on both planes; nomination as today with verdicts bounded by temporal relation, two candidate sets (state-ending includes finite-ended states), and the staged, idempotent relation write (§4.2); `temporal_window` verdicts with invariants, the documented reversal exception, and replay (§4.3); succession by any successor-supplied world-time instant incl. ending occurrences, the chronological guard on every cap source incl. D55, else contradict/coexist + review (§4.4); D55 by temporal kind with belief-time closes from the persisted reconciliation instant; D90 re-split by occurrence start (§4.5); the full containment current predicate on every current read incl. aggregate/absence, with activation and expiry scheduling (§7.1); occurrence windows over all attached evidence (D55 history retained); in-place conversion with migration adjudications, the `legacy` basis for unrecoverable seeds, legacy-cap recomputation, `legacy_unknown_boundary` review items, and the readiness gate (§9) | 4.2, 4.4, 4.10, 4.11, 4.17, 4.20, 4.22 | normaliser, both adjudicators, obs flush component; schema head; fact-layer generation in readiness; LoCoMo protocol | `lookup_relations(valid_at=2010)` returns the 2010 employer and excludes the 2024 one; a fact starting in 2030 is not current in 2026 and its profile activates when it starts; a January and an October visit are two occurrence relations, two same-day visits judged `new` coexist, a disjoint pair the ladder judges one disputed occurrence contradicts, and a union expansion bridging two occurrences merges nothing; a same-triple occurrence claim is held unattached until its verdict and a retried claim replays it; the same ingest replayed on different days yields byte-identical windows; both adjudicators orient one undated/dated pair identically (coexist); a dated resignation caps an undated "is CEO" state and a 2027 resignation shortens "CEO 2025–2030"; a purported cap at or before a known start routes to contradict/coexist plus a review item; a `state` with `valid_until = valid_from` is rejected by the schema; a `temporal_window` verdict applies, is reversed by a compensating verdict, and replays idempotently; the staggered D90 case with said-on and is-about reversed yields world-ordered slices; a withdrawn state with unknown or guard-refused source time leaves `valid_until` `NULL`/`unknown` and always sets `invalidated_at` to the recorded reconciliation instant (no zombie fact), and a withdrawn occurrence keeps its `occurs_*`; an expired relation no longer counts in `aggregate` nor blocks `predicate_absence`; a state with a future end is current today and its profile refreshes when the end passes, including after a restart; conversion keeps every fact id and every D55 historical fact, converts a legacy relation under basis `legacy` with a migration adjudication, recomputes a recoverable legacy cap at its successor's world-time start, removes a cap from a converted occurrence, turns a D55 fallback cap into a belief-time close, raises `legacy_unknown_boundary` for the rest, and readiness refuses an unconverted store and reports the open item count | | **WP-T.2 — two clocks in every temporal prompt** | relation supersession prompt and laterals show `said on` / `is about`; T4 candidate salient facts carry occurrence windows and kinds and rank by evidence then occurrence recency; K writer claims carry `asserted_at` + D41 fields; answer-agent prompt names the envelope fields | 4.3, 4.6, 4.8, 4.16 | relation adjudicator, resolver, K writer; LoCoMo protocol | a 2024 retrospective spell does not supersede a 2023 current fact in the supersession proofs; T4 sees windows and kinds in its candidate JSON; the answer prompt fixture contains the two-clock paragraph | | **WP-T.3 — retrieval keys, envelopes, skill** | dedupe on the full D41 tuple (or `asserted_at` when unknown) with `grouped_members`; `Validity`, `GraphEdge`, the K fact model and `memory_v1` fact views gain bases, kind and occurrence; `resolve_entity@2`, `testimony_context@2`, `fact_context@3`, `answer_context@3`; open-query confirmation returns the full D41 tuple and fact bases/occurrence; P1 is-about claim filters and the `occurs` fact mode; timeline by occurrence with an `undated` bucket; consumption skill teaches the three clocks and two fact kinds and defines `claims_as_of` over world-time | 4.1, 4.9, 4.12, 4.18, 4.19 | assured operation versions, surface manifest hash, query-space manifest, generated OpenAPI/SDK; LoCoMo protocol | identical text on two dates is two evidence rows in `testimony_context`, and a grouped row lists every member's times; a 2015–2020 archive imported today produces 2015–2020 timeline buckets; the regenerated skill text contains the corrected `claims_as_of` definition; an open-query claim row carries precision and kind | | **WP-T.4 — extraction vocabulary and anchor** | all four D41 kinds and `open` taught with examples and field descriptions; full-timestamp header | 4.14, 4.15 | extractor; LoCoMo protocol | "has been CEO since 2019" extracts as `proposition_validity` / `open`; "three hours ago" in a source stamped 19:30 resolves to an `instant` at 16:30 of that day, and the same words in a second same-day source stamped 22:00 resolve to a different instant | From f220c82f2f95cdd3571f38da1a3e1ead4b6d495a Mon Sep 17 00:00:00 2001 From: Jiri Puc Date: Thu, 3 Sep 2026 16:01:58 +0200 Subject: [PATCH 7/8] design: header revision count and drop the stale undated unique key from WP-T.1 Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016p9xB9T7VYREuVmohDPKjR --- plan/designs/temporal_clocks_design.md | 5 +++-- plan/plans/temporal_clocks.md | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plan/designs/temporal_clocks_design.md b/plan/designs/temporal_clocks_design.md index 7326065a5..7a983793f 100644 --- a/plan/designs/temporal_clocks_design.md +++ b/plan/designs/temporal_clocks_design.md @@ -2,8 +2,9 @@ **Status:** binding under D107 -**Date:** 2026-09-03 (fifth revision the same day, after four independent -Codex design reviews; §10 records what each round withdrew) +**Date:** 2026-09-03 (sixth revision the same day, after five independent +Codex design reviews; §10 records what each round withdrew, §12 what is +still open) **Analysis:** `plan/analysis/time_handling_audit.md` (twenty-two findings at `02b79904`, each cited by file and function) diff --git a/plan/plans/temporal_clocks.md b/plan/plans/temporal_clocks.md index 872154ec2..b05f97865 100644 --- a/plan/plans/temporal_clocks.md +++ b/plan/plans/temporal_clocks.md @@ -18,7 +18,7 @@ tests that assert the *clock*, not only the outcome. | WP | Scope | Audit findings closed | Generations / surfaces rolled | Acceptance | | --- | --- | --- | --- | --- | | **WP-T.0 — canonical bounds** | `canonical_bounds` in Python and as `memory_v1.canonical_bounds` + the `claims_canonical` view (design §5): both ends truncated to the unit; instants as non-empty points; inclusive request conversion; used by `claims_as_of`, D106's disjointness test, the shipped `claims_as_of` example (with its `unknown` count fixed), open-query prose and catalog metadata | 4.13, 4.21 | query-space manifest; LoCoMo protocol (result semantics change) | an intraday `claims_as_of` window finds a day-precision claim; `claims_as_of(t, t)` is a point query; a year stored 2022-01-01…12-31 canonicalises to `[2022-01-01, 2023-01-01)`; a day whose stored start is noon canonicalises to the calendar day; an `instant` overlaps itself; adjacent day windows do not overlap; the example's `unknown` count is non-zero on a corpus with unstamped claims | -| **WP-T.1 — fact model, matching, closing, cutover** | **gated on the four §12 spikes (D88 relation staging; locked review application; artifact staleness; D74 inventory), each landing as a design amendment first;** migration: `temporal_kind`, `valid_from_basis`, `valid_until_basis`, `occurs_from`/`occurs_until`/`occurs_precision`, `seed_claim_id`, populating the existing `relation_adjudications.triggering_claim_id` on `add`, the `migrate`/`migration` adjudication enum values, the non-empty state check, `EXCLUDE` partial on states, `undated` unique key, `fact_expiry_schedule`, the `temporal_window` review kind and `temporal_window_verdicts`; seed once by kind with the seed recorded atomically on both planes; nomination as today with verdicts bounded by temporal relation, two candidate sets (state-ending includes finite-ended states), and the staged, idempotent relation write (§4.2); `temporal_window` verdicts with invariants, the documented reversal exception, and replay (§4.3); succession by any successor-supplied world-time instant incl. ending occurrences, the chronological guard on every cap source incl. D55, else contradict/coexist + review (§4.4); D55 by temporal kind with belief-time closes from the persisted reconciliation instant; D90 re-split by occurrence start (§4.5); the full containment current predicate on every current read incl. aggregate/absence, with activation and expiry scheduling (§7.1); occurrence windows over all attached evidence (D55 history retained); in-place conversion with migration adjudications, the `legacy` basis for unrecoverable seeds, legacy-cap recomputation, `legacy_unknown_boundary` review items, and the readiness gate (§9) | 4.2, 4.4, 4.10, 4.11, 4.17, 4.20, 4.22 | normaliser, both adjudicators, obs flush component; schema head; fact-layer generation in readiness; LoCoMo protocol | `lookup_relations(valid_at=2010)` returns the 2010 employer and excludes the 2024 one; a fact starting in 2030 is not current in 2026 and its profile activates when it starts; a January and an October visit are two occurrence relations, two same-day visits judged `new` coexist, a disjoint pair the ladder judges one disputed occurrence contradicts, and a union expansion bridging two occurrences merges nothing; a same-triple occurrence claim is held unattached until its verdict and a retried claim replays it; the same ingest replayed on different days yields byte-identical windows; both adjudicators orient one undated/dated pair identically (coexist); a dated resignation caps an undated "is CEO" state and a 2027 resignation shortens "CEO 2025–2030"; a purported cap at or before a known start routes to contradict/coexist plus a review item; a `state` with `valid_until = valid_from` is rejected by the schema; a `temporal_window` verdict applies, is reversed by a compensating verdict, and replays idempotently; the staggered D90 case with said-on and is-about reversed yields world-ordered slices; a withdrawn state with unknown or guard-refused source time leaves `valid_until` `NULL`/`unknown` and always sets `invalidated_at` to the recorded reconciliation instant (no zombie fact), and a withdrawn occurrence keeps its `occurs_*`; an expired relation no longer counts in `aggregate` nor blocks `predicate_absence`; a state with a future end is current today and its profile refreshes when the end passes, including after a restart; conversion keeps every fact id and every D55 historical fact, converts a legacy relation under basis `legacy` with a migration adjudication, recomputes a recoverable legacy cap at its successor's world-time start, removes a cap from a converted occurrence, turns a D55 fallback cap into a belief-time close, raises `legacy_unknown_boundary` for the rest, and readiness refuses an unconverted store and reports the open item count | +| **WP-T.1 — fact model, matching, closing, cutover** | **gated on the four §12 spikes (D88 relation staging; locked review application; artifact staleness; D74 inventory), each landing as a design amendment first;** migration: `temporal_kind`, `valid_from_basis`, `valid_until_basis`, `occurs_from`/`occurs_until`/`occurs_precision`, `seed_claim_id`, populating the existing `relation_adjudications.triggering_claim_id` on `add`, the `migrate`/`migration` adjudication enum values, the non-empty state check, `EXCLUDE` partial on states (an unknown-bounds state slice is one unbounded range under it), `fact_expiry_schedule`, the `temporal_window` review kind and `temporal_window_verdicts`; seed once by kind with the seed recorded atomically on both planes; nomination as today with verdicts bounded by temporal relation, two candidate sets (state-ending includes finite-ended states), and the staged, idempotent relation write (§4.2); `temporal_window` verdicts with invariants, the documented reversal exception, and replay (§4.3); succession by any successor-supplied world-time instant incl. ending occurrences, the chronological guard on every cap source incl. D55, else contradict/coexist + review (§4.4); D55 by temporal kind with belief-time closes from the persisted reconciliation instant; D90 re-split by occurrence start (§4.5); the full containment current predicate on every current read incl. aggregate/absence, with activation and expiry scheduling (§7.1); occurrence windows over all attached evidence (D55 history retained); in-place conversion with migration adjudications, the `legacy` basis for unrecoverable seeds, legacy-cap recomputation, `legacy_unknown_boundary` review items, and the readiness gate (§9) | 4.2, 4.4, 4.10, 4.11, 4.17, 4.20, 4.22 | normaliser, both adjudicators, obs flush component; schema head; fact-layer generation in readiness; LoCoMo protocol | `lookup_relations(valid_at=2010)` returns the 2010 employer and excludes the 2024 one; a fact starting in 2030 is not current in 2026 and its profile activates when it starts; a January and an October visit are two occurrence relations, two same-day visits judged `new` coexist, a disjoint pair the ladder judges one disputed occurrence contradicts, and a union expansion bridging two occurrences merges nothing; a same-triple occurrence claim is held unattached until its verdict and a retried claim replays it; the same ingest replayed on different days yields byte-identical windows; both adjudicators orient one undated/dated pair identically (coexist); a dated resignation caps an undated "is CEO" state and a 2027 resignation shortens "CEO 2025–2030"; a purported cap at or before a known start routes to contradict/coexist plus a review item; a `state` with `valid_until = valid_from` is rejected by the schema; a `temporal_window` verdict applies, is reversed by a compensating verdict, and replays idempotently; the staggered D90 case with said-on and is-about reversed yields world-ordered slices; a withdrawn state with unknown or guard-refused source time leaves `valid_until` `NULL`/`unknown` and always sets `invalidated_at` to the recorded reconciliation instant (no zombie fact), and a withdrawn occurrence keeps its `occurs_*`; an expired relation no longer counts in `aggregate` nor blocks `predicate_absence`; a state with a future end is current today and its profile refreshes when the end passes, including after a restart; conversion keeps every fact id and every D55 historical fact, converts a legacy relation under basis `legacy` with a migration adjudication, recomputes a recoverable legacy cap at its successor's world-time start, removes a cap from a converted occurrence, turns a D55 fallback cap into a belief-time close, raises `legacy_unknown_boundary` for the rest, and readiness refuses an unconverted store and reports the open item count | | **WP-T.2 — two clocks in every temporal prompt** | relation supersession prompt and laterals show `said on` / `is about`; T4 candidate salient facts carry occurrence windows and kinds and rank by evidence then occurrence recency; K writer claims carry `asserted_at` + D41 fields; answer-agent prompt names the envelope fields | 4.3, 4.6, 4.8, 4.16 | relation adjudicator, resolver, K writer; LoCoMo protocol | a 2024 retrospective spell does not supersede a 2023 current fact in the supersession proofs; T4 sees windows and kinds in its candidate JSON; the answer prompt fixture contains the two-clock paragraph | | **WP-T.3 — retrieval keys, envelopes, skill** | dedupe on the full D41 tuple (or `asserted_at` when unknown) with `grouped_members`; `Validity`, `GraphEdge`, the K fact model and `memory_v1` fact views gain bases, kind and occurrence; `resolve_entity@2`, `testimony_context@2`, `fact_context@3`, `answer_context@3`; open-query confirmation returns the full D41 tuple and fact bases/occurrence; P1 is-about claim filters and the `occurs` fact mode; timeline by occurrence with an `undated` bucket; consumption skill teaches the three clocks and two fact kinds and defines `claims_as_of` over world-time | 4.1, 4.9, 4.12, 4.18, 4.19 | assured operation versions, surface manifest hash, query-space manifest, generated OpenAPI/SDK; LoCoMo protocol | identical text on two dates is two evidence rows in `testimony_context`, and a grouped row lists every member's times; a 2015–2020 archive imported today produces 2015–2020 timeline buckets; the regenerated skill text contains the corrected `claims_as_of` definition; an open-query claim row carries precision and kind | | **WP-T.4 — extraction vocabulary and anchor** | all four D41 kinds and `open` taught with examples and field descriptions; full-timestamp header | 4.14, 4.15 | extractor; LoCoMo protocol | "has been CEO since 2019" extracts as `proposition_validity` / `open`; "three hours ago" in a source stamped 19:30 resolves to an `instant` at 16:30 of that day, and the same words in a second same-day source stamped 22:00 resolve to a different instant | From 8c3b0b20a350a65f3e8a80374d38212086e6d5a9 Mon Sep 17 00:00:00 2001 From: Jiri Puc Date: Thu, 3 Sep 2026 16:37:27 +0200 Subject: [PATCH 8/8] =?UTF-8?q?design:=20link=20the=20D107=20open=20items?= =?UTF-8?q?=20to=20their=20tracking=20issues=20(#364=E2=80=93#368)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016p9xB9T7VYREuVmohDPKjR --- plan/designs/temporal_clocks_design.md | 3 ++- plan/plans/temporal_clocks.md | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/plan/designs/temporal_clocks_design.md b/plan/designs/temporal_clocks_design.md index 7a983793f..1cdd335af 100644 --- a/plan/designs/temporal_clocks_design.md +++ b/plan/designs/temporal_clocks_design.md @@ -615,7 +615,8 @@ Four contracts were identified by the fifth independent review as necessary for implementation and as touching decisions beyond this design's current scope. They are recorded here as open, are gated in `plan/plans/temporal_clocks.md` WP-T.1, and each is a spike whose result amends the named design before that -package starts: +package starts. Tracking: program issue #364; spikes #365 (1), #366 (2), +#367 (3), #368 (4). 1. **Deterministic relation seeding under D88 concurrency.** D88 lets concurrent claim jobs upsert relations ("relation evidence attach is diff --git a/plan/plans/temporal_clocks.md b/plan/plans/temporal_clocks.md index b05f97865..35d3b574c 100644 --- a/plan/plans/temporal_clocks.md +++ b/plan/plans/temporal_clocks.md @@ -18,7 +18,7 @@ tests that assert the *clock*, not only the outcome. | WP | Scope | Audit findings closed | Generations / surfaces rolled | Acceptance | | --- | --- | --- | --- | --- | | **WP-T.0 — canonical bounds** | `canonical_bounds` in Python and as `memory_v1.canonical_bounds` + the `claims_canonical` view (design §5): both ends truncated to the unit; instants as non-empty points; inclusive request conversion; used by `claims_as_of`, D106's disjointness test, the shipped `claims_as_of` example (with its `unknown` count fixed), open-query prose and catalog metadata | 4.13, 4.21 | query-space manifest; LoCoMo protocol (result semantics change) | an intraday `claims_as_of` window finds a day-precision claim; `claims_as_of(t, t)` is a point query; a year stored 2022-01-01…12-31 canonicalises to `[2022-01-01, 2023-01-01)`; a day whose stored start is noon canonicalises to the calendar day; an `instant` overlaps itself; adjacent day windows do not overlap; the example's `unknown` count is non-zero on a corpus with unstamped claims | -| **WP-T.1 — fact model, matching, closing, cutover** | **gated on the four §12 spikes (D88 relation staging; locked review application; artifact staleness; D74 inventory), each landing as a design amendment first;** migration: `temporal_kind`, `valid_from_basis`, `valid_until_basis`, `occurs_from`/`occurs_until`/`occurs_precision`, `seed_claim_id`, populating the existing `relation_adjudications.triggering_claim_id` on `add`, the `migrate`/`migration` adjudication enum values, the non-empty state check, `EXCLUDE` partial on states (an unknown-bounds state slice is one unbounded range under it), `fact_expiry_schedule`, the `temporal_window` review kind and `temporal_window_verdicts`; seed once by kind with the seed recorded atomically on both planes; nomination as today with verdicts bounded by temporal relation, two candidate sets (state-ending includes finite-ended states), and the staged, idempotent relation write (§4.2); `temporal_window` verdicts with invariants, the documented reversal exception, and replay (§4.3); succession by any successor-supplied world-time instant incl. ending occurrences, the chronological guard on every cap source incl. D55, else contradict/coexist + review (§4.4); D55 by temporal kind with belief-time closes from the persisted reconciliation instant; D90 re-split by occurrence start (§4.5); the full containment current predicate on every current read incl. aggregate/absence, with activation and expiry scheduling (§7.1); occurrence windows over all attached evidence (D55 history retained); in-place conversion with migration adjudications, the `legacy` basis for unrecoverable seeds, legacy-cap recomputation, `legacy_unknown_boundary` review items, and the readiness gate (§9) | 4.2, 4.4, 4.10, 4.11, 4.17, 4.20, 4.22 | normaliser, both adjudicators, obs flush component; schema head; fact-layer generation in readiness; LoCoMo protocol | `lookup_relations(valid_at=2010)` returns the 2010 employer and excludes the 2024 one; a fact starting in 2030 is not current in 2026 and its profile activates when it starts; a January and an October visit are two occurrence relations, two same-day visits judged `new` coexist, a disjoint pair the ladder judges one disputed occurrence contradicts, and a union expansion bridging two occurrences merges nothing; a same-triple occurrence claim is held unattached until its verdict and a retried claim replays it; the same ingest replayed on different days yields byte-identical windows; both adjudicators orient one undated/dated pair identically (coexist); a dated resignation caps an undated "is CEO" state and a 2027 resignation shortens "CEO 2025–2030"; a purported cap at or before a known start routes to contradict/coexist plus a review item; a `state` with `valid_until = valid_from` is rejected by the schema; a `temporal_window` verdict applies, is reversed by a compensating verdict, and replays idempotently; the staggered D90 case with said-on and is-about reversed yields world-ordered slices; a withdrawn state with unknown or guard-refused source time leaves `valid_until` `NULL`/`unknown` and always sets `invalidated_at` to the recorded reconciliation instant (no zombie fact), and a withdrawn occurrence keeps its `occurs_*`; an expired relation no longer counts in `aggregate` nor blocks `predicate_absence`; a state with a future end is current today and its profile refreshes when the end passes, including after a restart; conversion keeps every fact id and every D55 historical fact, converts a legacy relation under basis `legacy` with a migration adjudication, recomputes a recoverable legacy cap at its successor's world-time start, removes a cap from a converted occurrence, turns a D55 fallback cap into a belief-time close, raises `legacy_unknown_boundary` for the rest, and readiness refuses an unconverted store and reports the open item count | +| **WP-T.1 — fact model, matching, closing, cutover** | **gated on the four §12 spikes — #365 D88 relation staging, #366 locked review application, #367 artifact staleness, #368 D74 inventory — each landing as a design amendment first (program: #364);** migration: `temporal_kind`, `valid_from_basis`, `valid_until_basis`, `occurs_from`/`occurs_until`/`occurs_precision`, `seed_claim_id`, populating the existing `relation_adjudications.triggering_claim_id` on `add`, the `migrate`/`migration` adjudication enum values, the non-empty state check, `EXCLUDE` partial on states (an unknown-bounds state slice is one unbounded range under it), `fact_expiry_schedule`, the `temporal_window` review kind and `temporal_window_verdicts`; seed once by kind with the seed recorded atomically on both planes; nomination as today with verdicts bounded by temporal relation, two candidate sets (state-ending includes finite-ended states), and the staged, idempotent relation write (§4.2); `temporal_window` verdicts with invariants, the documented reversal exception, and replay (§4.3); succession by any successor-supplied world-time instant incl. ending occurrences, the chronological guard on every cap source incl. D55, else contradict/coexist + review (§4.4); D55 by temporal kind with belief-time closes from the persisted reconciliation instant; D90 re-split by occurrence start (§4.5); the full containment current predicate on every current read incl. aggregate/absence, with activation and expiry scheduling (§7.1); occurrence windows over all attached evidence (D55 history retained); in-place conversion with migration adjudications, the `legacy` basis for unrecoverable seeds, legacy-cap recomputation, `legacy_unknown_boundary` review items, and the readiness gate (§9) | 4.2, 4.4, 4.10, 4.11, 4.17, 4.20, 4.22 | normaliser, both adjudicators, obs flush component; schema head; fact-layer generation in readiness; LoCoMo protocol | `lookup_relations(valid_at=2010)` returns the 2010 employer and excludes the 2024 one; a fact starting in 2030 is not current in 2026 and its profile activates when it starts; a January and an October visit are two occurrence relations, two same-day visits judged `new` coexist, a disjoint pair the ladder judges one disputed occurrence contradicts, and a union expansion bridging two occurrences merges nothing; a same-triple occurrence claim is held unattached until its verdict and a retried claim replays it; the same ingest replayed on different days yields byte-identical windows; both adjudicators orient one undated/dated pair identically (coexist); a dated resignation caps an undated "is CEO" state and a 2027 resignation shortens "CEO 2025–2030"; a purported cap at or before a known start routes to contradict/coexist plus a review item; a `state` with `valid_until = valid_from` is rejected by the schema; a `temporal_window` verdict applies, is reversed by a compensating verdict, and replays idempotently; the staggered D90 case with said-on and is-about reversed yields world-ordered slices; a withdrawn state with unknown or guard-refused source time leaves `valid_until` `NULL`/`unknown` and always sets `invalidated_at` to the recorded reconciliation instant (no zombie fact), and a withdrawn occurrence keeps its `occurs_*`; an expired relation no longer counts in `aggregate` nor blocks `predicate_absence`; a state with a future end is current today and its profile refreshes when the end passes, including after a restart; conversion keeps every fact id and every D55 historical fact, converts a legacy relation under basis `legacy` with a migration adjudication, recomputes a recoverable legacy cap at its successor's world-time start, removes a cap from a converted occurrence, turns a D55 fallback cap into a belief-time close, raises `legacy_unknown_boundary` for the rest, and readiness refuses an unconverted store and reports the open item count | | **WP-T.2 — two clocks in every temporal prompt** | relation supersession prompt and laterals show `said on` / `is about`; T4 candidate salient facts carry occurrence windows and kinds and rank by evidence then occurrence recency; K writer claims carry `asserted_at` + D41 fields; answer-agent prompt names the envelope fields | 4.3, 4.6, 4.8, 4.16 | relation adjudicator, resolver, K writer; LoCoMo protocol | a 2024 retrospective spell does not supersede a 2023 current fact in the supersession proofs; T4 sees windows and kinds in its candidate JSON; the answer prompt fixture contains the two-clock paragraph | | **WP-T.3 — retrieval keys, envelopes, skill** | dedupe on the full D41 tuple (or `asserted_at` when unknown) with `grouped_members`; `Validity`, `GraphEdge`, the K fact model and `memory_v1` fact views gain bases, kind and occurrence; `resolve_entity@2`, `testimony_context@2`, `fact_context@3`, `answer_context@3`; open-query confirmation returns the full D41 tuple and fact bases/occurrence; P1 is-about claim filters and the `occurs` fact mode; timeline by occurrence with an `undated` bucket; consumption skill teaches the three clocks and two fact kinds and defines `claims_as_of` over world-time | 4.1, 4.9, 4.12, 4.18, 4.19 | assured operation versions, surface manifest hash, query-space manifest, generated OpenAPI/SDK; LoCoMo protocol | identical text on two dates is two evidence rows in `testimony_context`, and a grouped row lists every member's times; a 2015–2020 archive imported today produces 2015–2020 timeline buckets; the regenerated skill text contains the corrected `claims_as_of` definition; an open-query claim row carries precision and kind | | **WP-T.4 — extraction vocabulary and anchor** | all four D41 kinds and `open` taught with examples and field descriptions; full-timestamp header | 4.14, 4.15 | extractor; LoCoMo protocol | "has been CEO since 2019" extracts as `proposition_validity` / `open`; "three hours ago" in a source stamped 19:30 resolves to an `instant` at 16:30 of that day, and the same words in a second same-day source stamped 22:00 resolve to a different instant |