Files
noema/migrations/0018_assertions.up.sql
T
Andy Dixon 9b2521bffd feat(epistemics): record assertions between observations and beliefs
A statement made to a mind is now three things kept apart: the observation
that it arrived, an append-only assertion (attributed actor, stance,
certainty, modality, negation, reported or quoted speech, hypothetical
status, interpretation confidence and notes), and, only for factual
assertions, one piece of evidence for a proposition belief attributed to
whoever actually stands behind it. Reported speech is attributed to the
person reported and weighed as second-hand; hypotheticals, questions and
imperatives create no belief; expressed doubt counts against; a possibly
sarcastic remark is recorded with low interpretation confidence rather
than guessed at. Interpretation is deterministic code; a model may enrich
the claim list but never sets stance or confidence.

Association no longer treats conversational turns as world events:
hypotheticals, questions, requests and consecutive turns by one speaker
cannot seed causal hypotheses.

Adds internal/epistemics, migration 0018, the assertions API, assertions
on belief pages and in belief detail, a shared end-to-end test harness
(tests/harness), end-to-end tests for eight speech patterns, and updates
the milestone test to the new provenance.
2026-08-05 19:22:48 +01:00

35 lines
2.3 KiB
SQL

-- Assertions (review pass §7.2 item 1): the recorded fact that an actor
-- stated a proposition, kept apart from any belief about the proposition.
CREATE TABLE assertions (
id uuid PRIMARY KEY,
mind_id uuid NOT NULL REFERENCES minds(id),
actor text NOT NULL, -- who spoke to the mind
actor_kind text NOT NULL DEFAULT 'user',
attributed_to text NOT NULL, -- whose stance this is (speaker, or the person they report)
proposition text NOT NULL,
subject text NOT NULL DEFAULT '',
stance text NOT NULL CHECK (stance IN ('asserts','denies','doubts','questions','supposes','reports')),
certainty text NOT NULL CHECK (certainty IN ('asserted','hedged','uncertain','emphatic')),
modality text NOT NULL CHECK (modality IN ('factual','hypothetical','reported','quoted','imperative','question')),
negated boolean NOT NULL DEFAULT false,
reported boolean NOT NULL DEFAULT false,
reported_actor text NOT NULL DEFAULT '',
quoted boolean NOT NULL DEFAULT false,
hypothetical boolean NOT NULL DEFAULT false,
interpretation_confidence double precision NOT NULL CHECK (interpretation_confidence >= 0 AND interpretation_confidence <= 1),
interpretation_notes text[] NOT NULL DEFAULT '{}',
source_event uuid,
conversation_id uuid,
message_id uuid,
context text NOT NULL DEFAULT '',
trust text NOT NULL DEFAULT 'user',
belief_id uuid, -- the proposition belief this fed, if any
created_at timestamptz NOT NULL DEFAULT now()
);
CREATE INDEX assertions_mind_time_idx ON assertions (mind_id, created_at DESC);
CREATE INDEX assertions_mind_actor_idx ON assertions (mind_id, attributed_to);
CREATE INDEX assertions_belief_idx ON assertions (belief_id) WHERE belief_id IS NOT NULL;
CREATE INDEX assertions_source_idx ON assertions (source_event) WHERE source_event IS NOT NULL;
CREATE TRIGGER assertions_append_only BEFORE UPDATE OR DELETE ON assertions
FOR EACH ROW EXECUTE FUNCTION noema_forbid_change();