feat(beliefs): temporal scope and validity; state changes supersede rather than contradict

Beliefs gain a temporal scope (persistent, transient or unknown, classified
deterministically from the proposition), an observation time and, for
transient states, a validity interval. When a newer belief conflicts with
an older transient one observed at least a minute earlier, the older belief
is closed (valid_until set, status superseded, a supersedes link, a version
and an event saying 'state changed') with its score untouched: 'the door
was open at 10:00' stays true of 10:00 when it is closed at 10:05.
Simultaneous conflicting reports and persistent propositions contradict as
before. Introspection lists superseded states with their validity.
Migration 0020 is additive.
This commit is contained in:
Andy Dixon
2026-08-09 21:42:19 +01:00
parent b661496128
commit 7821d89cf5
9 changed files with 256 additions and 8 deletions
@@ -0,0 +1,6 @@
DROP INDEX IF EXISTS beliefs_mind_subject_validity_idx;
ALTER TABLE beliefs
DROP COLUMN IF EXISTS valid_until,
DROP COLUMN IF EXISTS valid_from,
DROP COLUMN IF EXISTS observed_at,
DROP COLUMN IF EXISTS temporal_scope;
+11
View File
@@ -0,0 +1,11 @@
-- Temporal scope (review pass §7.2 item 12). A belief may describe a
-- persistent fact or a transient state. Transient states have a validity
-- interval: a later observation that the state changed closes the interval
-- and supersedes the belief instead of contesting it, so what was true at
-- 10:00 stays true of 10:00 when 10:05 differs.
ALTER TABLE beliefs
ADD COLUMN IF NOT EXISTS temporal_scope text NOT NULL DEFAULT 'unknown' CHECK (temporal_scope IN ('persistent','transient','unknown')),
ADD COLUMN IF NOT EXISTS observed_at timestamptz,
ADD COLUMN IF NOT EXISTS valid_from timestamptz,
ADD COLUMN IF NOT EXISTS valid_until timestamptz;
CREATE INDEX IF NOT EXISTS beliefs_mind_subject_validity_idx ON beliefs (mind_id, subject, valid_until);