Files
noema/migrations/0020_temporal_beliefs.up.sql
Andy Dixon 7821d89cf5 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.
2026-08-09 21:42:19 +01:00

12 lines
763 B
SQL

-- 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);