Memory namespace: memory
Every project's memory. memory is the default name; an instance may choose another with TAISCE_SCHEMA. Projects are rows and partitions inside it, not namespaces of their own.
Tables at a glance
agent_artifact
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
artifact_id | uuid | not null | ||
source_observation_id | uuid | not null | ||
data_subject_id | text | not null | ||
kind | text | not null | ||
name | text | not null | ||
content | bytea | not null | ||
version | uuid | not null | ||
previous_version | uuid | |||
last_digest | bytea | not null | ||
authored_by | uuid | not null | ||
created_at | timestamp with time zone | not null | clock_timestamp() | |
updated_at | timestamp with time zone | not null | clock_timestamp() | |
registration_kind | text | generated: 'agent_artifact'::text | ||
registration_id | text | generated: (artifact_id)::text |
Constraints
agent_artifact_content_check:CHECK ((octet_length(content) <= 524288))agent_artifact_data_subject_id_check:CHECK (((octet_length(data_subject_id) >= 1) AND (octet_length(data_subject_id) <= 1024)))agent_artifact_kind_check:CHECK ((kind = ANY (ARRAY['state'::text, 'file'::text])))agent_artifact_last_digest_check:CHECK ((octet_length(last_digest) = 32))agent_artifact_name_check:CHECK ((octet_length(name) <= 256))agent_artifact_scope_fkey:FOREIGN KEY (scope) REFERENCES memory.agent_storage_policy(scope)agent_artifact_scope_source_observation_id_fkey:FOREIGN KEY (scope, source_observation_id) REFERENCES memory.observation(scope, observation_id) ON DELETE CASCADEagent_artifact_source_observation_id_registration_kind_reg_fkey:FOREIGN KEY (source_observation_id, registration_kind, registration_id) REFERENCES memory.projection_dependency(source_observation_id, projection_kind, projection_id) DEFERRABLE INITIALLY DEFERREDagent_artifact_artifact_id_not_null:NOT NULL artifact_idagent_artifact_authored_by_not_null:NOT NULL authored_byagent_artifact_content_not_null:NOT NULL contentagent_artifact_created_at_not_null:NOT NULL created_atagent_artifact_data_subject_id_not_null:NOT NULL data_subject_idagent_artifact_kind_not_null:NOT NULL kindagent_artifact_last_digest_not_null:NOT NULL last_digestagent_artifact_name_not_null:NOT NULL nameagent_artifact_scope_not_null:NOT NULL scopeagent_artifact_source_observation_id_not_null:NOT NULL source_observation_idagent_artifact_updated_at_not_null:NOT NULL updated_atagent_artifact_version_not_null:NOT NULL versionagent_artifact_pkey:PRIMARY KEY (scope, artifact_id)agent_artifact_scope_source_observation_id_artifact_id_data_key:UNIQUE (scope, source_observation_id, artifact_id, data_subject_id)agent_artifact_source_observation_id_key:UNIQUE (source_observation_id)
Indexes
agent_artifact_kind_page_idx:CREATE INDEX agent_artifact_kind_page_idx ON memory.agent_artifact USING btree (scope, kind, artifact_id)agent_artifact_name_prefix_idx:CREATE INDEX agent_artifact_name_prefix_idx ON memory.agent_artifact USING btree (scope, name text_pattern_ops)agent_artifact_pkey:CREATE UNIQUE INDEX agent_artifact_pkey ON memory.agent_artifact USING btree (scope, artifact_id)agent_artifact_scope_source_observation_id_artifact_id_data_key:CREATE UNIQUE INDEX agent_artifact_scope_source_observation_id_artifact_id_data_key ON memory.agent_artifact USING btree (scope, source_observation_id, artifact_id, data_subject_id)agent_artifact_source_observation_id_key:CREATE UNIQUE INDEX agent_artifact_source_observation_id_key ON memory.agent_artifact USING btree (source_observation_id)agent_artifact_subject_page_idx:CREATE INDEX agent_artifact_subject_page_idx ON memory.agent_artifact USING btree (scope, data_subject_id, artifact_id)
Triggers
agent_artifact_accounting:CREATE TRIGGER agent_artifact_accounting BEFORE INSERT OR DELETE OR UPDATE ON memory.agent_artifact FOR EACH ROW EXECUTE FUNCTION memory.account_agent_artifact()
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- projection_dependency through
dependency_artifact_owner_fk
agent_storage_policy
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
max_object_bytes | bigint | not null | 262144 | |
max_bytes | bigint | not null | 16777216 | |
max_objects | bigint | not null | 128 | |
max_age_hours | integer | not null | 720 | |
used_bytes | bigint | not null | 0 | |
used_objects | bigint | not null | 0 |
Constraints
agent_storage_policy_check:CHECK ((max_object_bytes <= max_bytes))agent_storage_policy_max_age_hours_check:CHECK (((max_age_hours >= 1) AND (max_age_hours <= 8760)))agent_storage_policy_max_bytes_check:CHECK (((max_bytes >= 1) AND (max_bytes <= 1073741824)))agent_storage_policy_max_object_bytes_check:CHECK (((max_object_bytes >= 1) AND (max_object_bytes <= 524288)))agent_storage_policy_max_objects_check:CHECK (((max_objects >= 1) AND (max_objects <= 100000)))agent_storage_policy_used_bytes_check:CHECK ((used_bytes >= 0))agent_storage_policy_used_objects_check:CHECK ((used_objects >= 0))agent_storage_policy_scope_fkey:FOREIGN KEY (scope) REFERENCES memory.project(scope) ON DELETE CASCADEagent_storage_policy_max_age_hours_not_null:NOT NULL max_age_hoursagent_storage_policy_max_bytes_not_null:NOT NULL max_bytesagent_storage_policy_max_object_bytes_not_null:NOT NULL max_object_bytesagent_storage_policy_max_objects_not_null:NOT NULL max_objectsagent_storage_policy_scope_not_null:NOT NULL scopeagent_storage_policy_used_bytes_not_null:NOT NULL used_bytesagent_storage_policy_used_objects_not_null:NOT NULL used_objectsagent_storage_policy_pkey:PRIMARY KEY (scope)
Indexes
agent_storage_policy_pkey:CREATE UNIQUE INDEX agent_storage_policy_pkey ON memory.agent_storage_policy USING btree (scope)
Privileges
taisce_data:SELECT
Referenced by
- agent_artifact through
agent_artifact_scope_fkey
audit_entry
What happened and who did it. Holds no data subject, no question, no quote and no content — so append-only is unconditional rather than a conflict with erasure. The cost is that a person can be told a recall happened and not which of their memories it read.
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
entry_id | bigint | not null | nextval('memory.audit_entry_entry_id_seq'::regclass) | |
operation | text | not null | ||
principal | text | not null | ||
principal_kind | text | not null | ||
project | text | not null | ''::text | |
magnitude | integer | not null | 0 | |
outcome | text | not null | ||
occurred_at | timestamp with time zone | not null | now() |
Constraints
audit_magnitude_chk:CHECK ((magnitude >= 0))audit_operation_chk:CHECK ((operation = ANY (ARRAY['observe'::text, 'recall'::text, 'erase'::text, 'freshness'::text, 'export'::text, 'authenticate'::text, 'project.create'::text, 'project.suspend'::text, 'project.resume'::text, 'project.retention'::text, 'credential.issue'::text, 'credential.revoke'::text, 'formation.unpark'::text, 'formation.recover'::text, 'formation.rebuild'::text, 'formation.rebuild.start'::text, 'formation.rebuild.cancel'::text, 'citation.resolve'::text, 'message.get'::text, 'record.list'::text, 'record.history'::text, 'record.retract'::text, 'record.correct'::text, 'record.assert'::text, 'feedback.record'::text, 'feedback.list'::text, 'feedback.promote'::text, 'artifact.put'::text, 'artifact.get'::text, 'artifact.list'::text, 'artifact.delete'::text, 'artifact.configure'::text, 'subject.register'::text, 'subject.get'::text, 'subject.list'::text, 'subject.update'::text, 'entity.list'::text, 'entity.get'::text, 'entity.purge'::text, 'notification.register'::text, 'notification.list'::text, 'notification.disable'::text, 'notification.deliveries'::text, 'embedding.start'::text, 'embedding.build'::text, 'embedding.activate'::text, 'embedding.cancel'::text, 'embedding.prune'::text, 'embedding.repair'::text, 'embedding.search'::text, 'entity_embedding.start'::text, 'entity_embedding.build'::text, 'entity_embedding.activate'::text, 'entity_embedding.cancel'::text, 'entity_embedding.prune'::text, 'entity_embedding.repair'::text, 'entity_embedding.search'::text, 'report_embedding.start'::text, 'report_embedding.build'::text, 'report_embedding.activate'::text, 'report_embedding.cancel'::text, 'report_embedding.prune'::text, 'report_embedding.repair'::text, 'report_embedding.search'::text, 'context.assemble'::text, 'retention.sweep'::text, 'project.list'::text, 'credential.list'::text, 'refusal.summary'::text, 'erasure.list'::text, 'formation.status'::text, 'formation.parked'::text, 'audit.seal'::text, 'audit.verify'::text, 'audit.activity'::text])))audit_outcome_chk:CHECK ((outcome = ANY (ARRAY['allowed'::text, 'refused'::text])))audit_principal_chk:CHECK ((length(principal) > 0))audit_principal_kind_chk:CHECK ((principal_kind = ANY (ARRAY['credential'::text, 'operator'::text, 'system'::text])))audit_entry_entry_id_not_null:NOT NULL entry_idaudit_entry_magnitude_not_null:NOT NULL magnitudeaudit_entry_occurred_at_not_null:NOT NULL occurred_ataudit_entry_operation_not_null:NOT NULL operationaudit_entry_outcome_not_null:NOT NULL outcomeaudit_entry_principal_kind_not_null:NOT NULL principal_kindaudit_entry_principal_not_null:NOT NULL principalaudit_entry_project_not_null:NOT NULL projectaudit_entry_pkey:PRIMARY KEY (entry_id)
Indexes
audit_entry_pkey:CREATE UNIQUE INDEX audit_entry_pkey ON memory.audit_entry USING btree (entry_id)audit_principal_idx:CREATE INDEX audit_principal_idx ON memory.audit_entry USING btree (principal, occurred_at DESC)audit_refused_idx:CREATE INDEX audit_refused_idx ON memory.audit_entry USING btree (occurred_at DESC) WHERE (outcome = 'refused'::text)audit_time_idx:CREATE INDEX audit_time_idx ON memory.audit_entry USING btree (occurred_at DESC)
Triggers
audit_no_delete:CREATE TRIGGER audit_no_delete BEFORE DELETE ON memory.audit_entry FOR EACH ROW EXECUTE FUNCTION memory.audit_is_append_only()audit_no_truncate:CREATE TRIGGER audit_no_truncate BEFORE TRUNCATE ON memory.audit_entry FOR EACH STATEMENT EXECUTE FUNCTION memory.audit_is_append_only()audit_no_update:CREATE TRIGGER audit_no_update BEFORE UPDATE ON memory.audit_entry FOR EACH ROW EXECUTE FUNCTION memory.audit_is_append_only()
Privileges
taisce_data:INSERT, SELECT
audit_seal
Chained digests over ranges of audit entries. Rewriting a sealed entry changes its seal and every seal after it, so a rewrite must redo the whole chain rather than one row. It does not stop somebody who can rebuild everything — for that, the head digest is emitted to the process log, where whatever collects logs holds values a rebuilt chain cannot agree with.
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
seal_id | bigint | not null | nextval('memory.audit_seal_seal_id_seq'::regclass) | |
from_entry | bigint | not null | ||
to_entry | bigint | not null | ||
entry_count | integer | not null | ||
entries_digest | bytea | not null | ||
previous_digest | bytea | not null | ||
digest | bytea | not null | ||
sealed_at | timestamp with time zone | not null | now() |
Constraints
audit_seal_count_chk:CHECK ((entry_count > 0))audit_seal_range_chk:CHECK ((to_entry >= from_entry))audit_seal_digest_not_null:NOT NULL digestaudit_seal_entries_digest_not_null:NOT NULL entries_digestaudit_seal_entry_count_not_null:NOT NULL entry_countaudit_seal_from_entry_not_null:NOT NULL from_entryaudit_seal_previous_digest_not_null:NOT NULL previous_digestaudit_seal_seal_id_not_null:NOT NULL seal_idaudit_seal_sealed_at_not_null:NOT NULL sealed_ataudit_seal_to_entry_not_null:NOT NULL to_entryaudit_seal_pkey:PRIMARY KEY (seal_id)
Indexes
audit_seal_pkey:CREATE UNIQUE INDEX audit_seal_pkey ON memory.audit_seal USING btree (seal_id)audit_seal_range_idx:CREATE INDEX audit_seal_range_idx ON memory.audit_seal USING btree (to_entry DESC)
Triggers
audit_seal_no_delete:CREATE TRIGGER audit_seal_no_delete BEFORE DELETE ON memory.audit_seal FOR EACH ROW EXECUTE FUNCTION memory.audit_is_append_only()audit_seal_no_truncate:CREATE TRIGGER audit_seal_no_truncate BEFORE TRUNCATE ON memory.audit_seal FOR EACH STATEMENT EXECUTE FUNCTION memory.audit_is_append_only()audit_seal_no_update:CREATE TRIGGER audit_seal_no_update BEFORE UPDATE ON memory.audit_seal FOR EACH ROW EXECUTE FUNCTION memory.audit_is_append_only()
Privileges
taisce_data:SELECT
chunk
owner postgres · partitioned by LIST (scope)
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
chunk_id | uuid | not null | ||
scope | text | not null | ||
source_observation_id | uuid | not null | ||
text | text | not null | ||
lang | text | not null | 'en'::text | |
occurred_at | timestamp with time zone | not null | ||
source_role | text | not null | ||
data_subject_id | text | |||
source_message_ordinal | integer | Ordinal of the turn_message this chunk was cut from. NULL for chunks with no message — a document, say. Evidence byte spans index into THAT message, never into the turn. |
Constraints
chunk_message_identity_fk:FOREIGN KEY (source_observation_id, source_message_ordinal, chunk_id) REFERENCES memory.turn_message(observation_id, ordinal, chunk_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDchunk_source_project_fk:FOREIGN KEY (scope, source_observation_id) REFERENCES memory.observation(scope, observation_id) DEFERRABLE INITIALLY DEFERREDchunk_chunk_id_not_null:NOT NULL chunk_idchunk_lang_not_null:NOT NULL langchunk_occurred_at_not_null:NOT NULL occurred_atchunk_scope_not_null:NOT NULL scopechunk_source_observation_id_not_null:NOT NULL source_observation_idchunk_source_role_not_null:NOT NULL source_rolechunk_text_not_null:NOT NULL textchunk_pkey:PRIMARY KEY (scope, chunk_id)chunk_source_identity_uniq:UNIQUE (scope, source_observation_id, chunk_id)
Indexes
chunk_pkey:CREATE UNIQUE INDEX chunk_pkey ON ONLY memory.chunk USING btree (scope, chunk_id)chunk_source_identity_uniq:CREATE UNIQUE INDEX chunk_source_identity_uniq ON ONLY memory.chunk USING btree (scope, source_observation_id, chunk_id)chunk_source_idx:CREATE INDEX chunk_source_idx ON ONLY memory.chunk USING btree (scope, source_observation_id)
Partitions
chunk_example:FOR VALUES IN ('example')chunk_unpartitioned:DEFAULT
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- message_embedding through
message_embedding_scope_source_observation_id_chunk_id_fkey - projection_dependency through
dependency_chunk_project_fk
community
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
community_id | uuid | not null | ||
level | integer | not null | ||
parent_id | uuid | |||
formed_at | timestamp with time zone | not null | now() |
Constraints
community_level_chk:CHECK ((level >= 0))community_parent_chk:CHECK (((level = 0) = (parent_id IS NULL)))community_parent_project_fk:FOREIGN KEY (scope, parent_id) REFERENCES memory.community(scope, community_id) DEFERRABLE INITIALLY DEFERREDcommunity_community_id_not_null:NOT NULL community_idcommunity_formed_at_not_null:NOT NULL formed_atcommunity_level_not_null:NOT NULL levelcommunity_scope_not_null:NOT NULL scopecommunity_pkey:PRIMARY KEY (scope, community_id)
Indexes
community_pkey:CREATE UNIQUE INDEX community_pkey ON memory.community USING btree (scope, community_id)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- community through
community_parent_project_fk - community_member through
community_member_scope_community_id_fkey - community_report through
community_report_scope_community_id_fkey
community_member
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
community_id | uuid | not null | ||
entity_id | uuid | not null |
Constraints
community_member_scope_community_id_fkey:FOREIGN KEY (scope, community_id) REFERENCES memory.community(scope, community_id) ON DELETE CASCADEmember_entity_project_fk:FOREIGN KEY (scope, entity_id) REFERENCES memory.entity(scope, entity_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDcommunity_member_community_id_not_null:NOT NULL community_idcommunity_member_entity_id_not_null:NOT NULL entity_idcommunity_member_scope_not_null:NOT NULL scopecommunity_member_pkey:PRIMARY KEY (scope, community_id, entity_id)
Indexes
community_member_entity_idx:CREATE INDEX community_member_entity_idx ON memory.community_member USING btree (scope, entity_id)community_member_pkey:CREATE UNIQUE INDEX community_member_pkey ON memory.community_member USING btree (scope, community_id, entity_id)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
community_report
Prose written from what several people said about one subject. Registered to every observation that contributed and deleted when any contributor erases — without the exemption that keeps a shared entity, because an entity is a shared identity and this is shared text.
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
report_id | uuid | not null | ||
community_id | uuid | not null | ||
title | text | not null | ||
summary | text | not null | ||
importance | real | not null | 0 | |
importance_reason | text | not null | ''::text | |
findings | jsonb | not null | '[]'::jsonb | |
substituted | integer | not null | 0 | |
dropped | integer | not null | 0 | |
written_at | timestamp with time zone | not null | now() | |
written_by | text | not null | ''::text |
Constraints
community_report_counted_chk:CHECK (((substituted >= 0) AND (dropped >= 0)))community_report_importance_chk:CHECK (((importance >= (0)::double precision) AND (importance <= (10)::double precision)))community_report_summary_chk:CHECK ((btrim(summary) <> ''::text))community_report_title_chk:CHECK ((btrim(title) <> ''::text))community_report_written_by_check:CHECK ((octet_length(written_by) <= 128))community_report_scope_community_id_fkey:FOREIGN KEY (scope, community_id) REFERENCES memory.community(scope, community_id) ON DELETE CASCADEcommunity_report_community_id_not_null:NOT NULL community_idcommunity_report_dropped_not_null:NOT NULL droppedcommunity_report_findings_not_null:NOT NULL findingscommunity_report_importance_not_null:NOT NULL importancecommunity_report_importance_reason_not_null:NOT NULL importance_reasoncommunity_report_report_id_not_null:NOT NULL report_idcommunity_report_scope_not_null:NOT NULL scopecommunity_report_substituted_not_null:NOT NULL substitutedcommunity_report_summary_not_null:NOT NULL summarycommunity_report_title_not_null:NOT NULL titlecommunity_report_written_at_not_null:NOT NULL written_atcommunity_report_written_by_not_null:NOT NULL written_bycommunity_report_pkey:PRIMARY KEY (scope, report_id)community_report_scope_community_id_key:UNIQUE (scope, community_id)
Indexes
community_report_pkey:CREATE UNIQUE INDEX community_report_pkey ON memory.community_report USING btree (scope, report_id)community_report_scope_community_id_key:CREATE UNIQUE INDEX community_report_scope_community_id_key ON memory.community_report USING btree (scope, community_id)community_report_writer_idx:CREATE INDEX community_report_writer_idx ON memory.community_report USING btree (scope, written_by)
Triggers
report_embedding_change_lock:CREATE TRIGGER report_embedding_change_lock BEFORE DELETE OR UPDATE ON memory.community_report FOR EACH ROW EXECUTE FUNCTION memory.lock_report_embedding_change()report_embedding_report_changed:CREATE TRIGGER report_embedding_report_changed AFTER INSERT OR DELETE OR UPDATE ON memory.community_report FOR EACH ROW EXECUTE FUNCTION memory.stale_report_embedding_snapshots()
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- projection_dependency through
dependency_report_project_fk - report_embedding_target through
report_embedding_target_scope_report_id_fkey
curated_claim
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
source_observation_id | uuid | not null | ||
fact_id | uuid | not null | ||
principal_id | uuid | not null | ||
claim | jsonb | not null |
Constraints
curated_claim_claim_check:CHECK ((jsonb_typeof(claim) = 'object'::text))curated_claim_scope_source_observation_id_fkey:FOREIGN KEY (scope, source_observation_id) REFERENCES memory.observation(scope, observation_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDcurated_claim_claim_not_null:NOT NULL claimcurated_claim_fact_id_not_null:NOT NULL fact_idcurated_claim_principal_id_not_null:NOT NULL principal_idcurated_claim_scope_not_null:NOT NULL scopecurated_claim_source_observation_id_not_null:NOT NULL source_observation_idcurated_claim_pkey:PRIMARY KEY (scope, source_observation_id)curated_claim_scope_fact_id_key:UNIQUE (scope, fact_id)
Indexes
curated_claim_pkey:CREATE UNIQUE INDEX curated_claim_pkey ON memory.curated_claim USING btree (scope, source_observation_id)curated_claim_scope_fact_id_key:CREATE UNIQUE INDEX curated_claim_scope_fact_id_key ON memory.curated_claim USING btree (scope, fact_id)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- record_retraction through
retraction_replacement_source
data_subject
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
subject_id | text | not null | ||
external_reference | text | |||
label | text | not null | ||
version | uuid | not null | ||
previous_version | uuid | |||
last_digest | bytea | not null | ||
updated_by | uuid | not null | ||
created_at | timestamp with time zone | not null | clock_timestamp() | |
updated_at | timestamp with time zone | not null | clock_timestamp() | |
inactive_after | timestamp with time zone |
Constraints
data_subject_external_reference_check:CHECK (((external_reference IS NULL) OR (((octet_length(external_reference) >= 1) AND (octet_length(external_reference) <= 1024)) AND (length(btrim(external_reference)) > 0))))data_subject_label_check:CHECK ((octet_length(label) <= 256))data_subject_last_digest_check:CHECK ((octet_length(last_digest) = 32))data_subject_subject_id_check:CHECK ((subject_id ~ '^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$'::text))data_subject_scope_fkey:FOREIGN KEY (scope) REFERENCES memory.project(scope) ON DELETE CASCADEdata_subject_created_at_not_null:NOT NULL created_atdata_subject_label_not_null:NOT NULL labeldata_subject_last_digest_not_null:NOT NULL last_digestdata_subject_scope_not_null:NOT NULL scopedata_subject_subject_id_not_null:NOT NULL subject_iddata_subject_updated_at_not_null:NOT NULL updated_atdata_subject_updated_by_not_null:NOT NULL updated_bydata_subject_version_not_null:NOT NULL versiondata_subject_pkey:PRIMARY KEY (scope, subject_id)subject_external_reference_unique:UNIQUE (scope, external_reference)
Indexes
data_subject_pkey:CREATE UNIQUE INDEX data_subject_pkey ON memory.data_subject USING btree (scope, subject_id)subject_external_reference_unique:CREATE UNIQUE INDEX subject_external_reference_unique ON memory.data_subject USING btree (scope, external_reference)subject_inactive_idx:CREATE INDEX subject_inactive_idx ON memory.data_subject USING btree (scope, inactive_after, subject_id) WHERE (inactive_after IS NOT NULL)
Triggers
subject_identity_immutable:CREATE TRIGGER subject_identity_immutable BEFORE UPDATE ON memory.data_subject FOR EACH ROW EXECUTE FUNCTION memory.protect_subject_identity()subject_retry_forgets_payload:CREATE TRIGGER subject_retry_forgets_payload BEFORE DELETE ON memory.data_subject FOR EACH ROW EXECUTE FUNCTION memory.clear_subject_retry_payload()
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- subject_retry through
subject_retry_scope_subject_id_fkey
embedding_active
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
generation_id | uuid | not null | ||
activated_at | timestamp with time zone | not null | clock_timestamp() |
Constraints
embedding_active_scope_fkey:FOREIGN KEY (scope) REFERENCES memory.project(scope) ON DELETE CASCADEembedding_active_scope_generation_id_fkey:FOREIGN KEY (scope, generation_id) REFERENCES memory.embedding_generation(scope, generation_id)embedding_active_activated_at_not_null:NOT NULL activated_atembedding_active_generation_id_not_null:NOT NULL generation_idembedding_active_scope_not_null:NOT NULL scopeembedding_active_pkey:PRIMARY KEY (scope)
Indexes
embedding_active_pkey:CREATE UNIQUE INDEX embedding_active_pkey ON memory.embedding_active USING btree (scope)
Privileges
taisce_data:SELECT
embedding_build
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
generation_id | uuid | not null | ||
state | text | not null | 'building'::text | |
after_offset | bigint | not null | '-1'::integer | |
after_ordinal | integer | not null | '-1'::integer | |
examined | bigint | not null | 0 | |
stored | bigint | not null | 0 | |
lease_id | uuid | |||
updated_at | timestamp with time zone | not null | clock_timestamp() | |
through_offset | bigint | not null | '-1'::integer | |
covered_through_offset | bigint | not null | '-1'::integer |
Constraints
embedding_build_after_offset_check:CHECK ((after_offset >= '-1'::integer))embedding_build_after_ordinal_check:CHECK ((after_ordinal >= '-1'::integer))embedding_build_check:CHECK (((after_offset = '-1'::integer) = (after_ordinal = '-1'::integer)))embedding_build_covered_through_offset_check:CHECK ((covered_through_offset >= '-1'::integer))embedding_build_examined_check:CHECK ((examined >= 0))embedding_build_state_check:CHECK ((state = ANY (ARRAY['building'::text, 'ready'::text, 'cancelled'::text, 'discarded'::text])))embedding_build_stored_check:CHECK ((stored >= 0))embedding_build_through_offset_check:CHECK ((through_offset >= '-1'::integer))embedding_coverage_within_target:CHECK ((covered_through_offset <= through_offset))embedding_build_scope_generation_id_fkey:FOREIGN KEY (scope, generation_id) REFERENCES memory.embedding_generation(scope, generation_id) ON DELETE CASCADEembedding_build_after_offset_not_null:NOT NULL after_offsetembedding_build_after_ordinal_not_null:NOT NULL after_ordinalembedding_build_covered_through_offset_not_null:NOT NULL covered_through_offsetembedding_build_examined_not_null:NOT NULL examinedembedding_build_generation_id_not_null:NOT NULL generation_idembedding_build_scope_not_null:NOT NULL scopeembedding_build_state_not_null:NOT NULL stateembedding_build_stored_not_null:NOT NULL storedembedding_build_through_offset_not_null:NOT NULL through_offsetembedding_build_updated_at_not_null:NOT NULL updated_atembedding_build_pkey:PRIMARY KEY (scope, generation_id)
Indexes
embedding_build_pkey:CREATE UNIQUE INDEX embedding_build_pkey ON memory.embedding_build USING btree (scope, generation_id)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
embedding_generation
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
generation_id | uuid | not null | ||
scope | text | not null | ||
operation_key | uuid | not null | ||
model_name | text | not null | ||
model_revision | text | not null | ||
endpoint_hash | text | not null | ||
identity_hash | text | not null | ||
dimensions | integer | not null | ||
metric | text | not null | 'cosine'::text | |
input_version | text | not null | 'message-text/v1'::text | |
through_offset | bigint | not null | ||
created_at | timestamp with time zone | not null | clock_timestamp() |
Constraints
embedding_generation_dimensions_check:CHECK (((dimensions >= 1) AND (dimensions <= 4000)))embedding_generation_endpoint_hash_check:CHECK ((endpoint_hash ~ '^[0-9a-f]{64}$'::text))embedding_generation_identity_hash_check:CHECK ((identity_hash ~ '^[0-9a-f]{64}$'::text))embedding_generation_input_version_check:CHECK ((input_version = 'message-text/v1'::text))embedding_generation_metric_check:CHECK ((metric = 'cosine'::text))embedding_generation_model_name_check:CHECK (((octet_length(model_name) >= 1) AND (octet_length(model_name) <= 256)))embedding_generation_model_revision_check:CHECK (((octet_length(model_revision) >= 1) AND (octet_length(model_revision) <= 128)))embedding_generation_through_offset_check:CHECK ((through_offset >= '-1'::integer))embedding_generation_scope_fkey:FOREIGN KEY (scope) REFERENCES memory.project(scope) ON DELETE CASCADEembedding_generation_created_at_not_null:NOT NULL created_atembedding_generation_dimensions_not_null:NOT NULL dimensionsembedding_generation_endpoint_hash_not_null:NOT NULL endpoint_hashembedding_generation_generation_id_not_null:NOT NULL generation_idembedding_generation_identity_hash_not_null:NOT NULL identity_hashembedding_generation_input_version_not_null:NOT NULL input_versionembedding_generation_metric_not_null:NOT NULL metricembedding_generation_model_name_not_null:NOT NULL model_nameembedding_generation_model_revision_not_null:NOT NULL model_revisionembedding_generation_operation_key_not_null:NOT NULL operation_keyembedding_generation_scope_not_null:NOT NULL scopeembedding_generation_through_offset_not_null:NOT NULL through_offsetembedding_generation_pkey:PRIMARY KEY (generation_id)embedding_generation_scope_generation_id_dimensions_key:UNIQUE (scope, generation_id, dimensions)embedding_generation_scope_generation_id_key:UNIQUE (scope, generation_id)embedding_generation_scope_operation_key_key:UNIQUE (scope, operation_key)
Indexes
embedding_generation_pkey:CREATE UNIQUE INDEX embedding_generation_pkey ON memory.embedding_generation USING btree (generation_id)embedding_generation_scope_generation_id_dimensions_key:CREATE UNIQUE INDEX embedding_generation_scope_generation_id_dimensions_key ON memory.embedding_generation USING btree (scope, generation_id, dimensions)embedding_generation_scope_generation_id_key:CREATE UNIQUE INDEX embedding_generation_scope_generation_id_key ON memory.embedding_generation USING btree (scope, generation_id)embedding_generation_scope_operation_key_key:CREATE UNIQUE INDEX embedding_generation_scope_operation_key_key ON memory.embedding_generation USING btree (scope, operation_key)
Triggers
embedding_identity_immutable:CREATE TRIGGER embedding_identity_immutable BEFORE UPDATE ON memory.embedding_generation FOR EACH ROW EXECUTE FUNCTION memory.immutable_embedding_identity()
Privileges
taisce_data:SELECT
Referenced by
- embedding_active through
embedding_active_scope_generation_id_fkey - embedding_build through
embedding_build_scope_generation_id_fkey - message_embedding through
message_embedding_scope_generation_id_dimensions_fkey
entity
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
entity_id | uuid | not null | ||
scope | text | not null | ||
canonical_name | text | not null | ||
normalized_name | text | not null | ||
entity_type | text | not null | 'thing'::text | |
aliases | text[] | not null | '{}'::text[] | |
resolution_version | text | not null | 'entity/v1'::text | |
first_seen_at | timestamp with time zone | not null | now() | |
identity_kind | text | not null | 'named'::text | |
speaker_subject_id | text |
Constraints
entity_identity_kind_chk:CHECK ((((identity_kind = 'named'::text) AND (speaker_subject_id IS NULL)) OR ((identity_kind = 'speaker'::text) AND (speaker_subject_id IS NOT NULL) AND (speaker_subject_id <> ''::text) AND (canonical_name = 'speaker'::text) AND (normalized_name = 'speaker'::text) AND (entity_type = 'person'::text) AND (aliases = '{}'::text[]))))entity_aliases_not_null:NOT NULL aliasesentity_canonical_name_not_null:NOT NULL canonical_nameentity_entity_id_not_null:NOT NULL entity_identity_entity_type_not_null:NOT NULL entity_typeentity_first_seen_at_not_null:NOT NULL first_seen_atentity_identity_kind_not_null:NOT NULL identity_kindentity_normalized_name_not_null:NOT NULL normalized_nameentity_resolution_version_not_null:NOT NULL resolution_versionentity_scope_not_null:NOT NULL scopeentity_pkey:PRIMARY KEY (entity_id)entity_scope_id_uniq:UNIQUE (scope, entity_id)
Indexes
entity_named_identity_uniq:CREATE UNIQUE INDEX entity_named_identity_uniq ON memory.entity USING btree (scope, normalized_name) WHERE (identity_kind = 'named'::text)entity_pkey:CREATE UNIQUE INDEX entity_pkey ON memory.entity USING btree (entity_id)entity_scope_id_uniq:CREATE UNIQUE INDEX entity_scope_id_uniq ON memory.entity USING btree (scope, entity_id)entity_speaker_identity_uniq:CREATE UNIQUE INDEX entity_speaker_identity_uniq ON memory.entity USING btree (scope, speaker_subject_id) WHERE (identity_kind = 'speaker'::text)
Triggers
entity_embedding_entity_changed:CREATE TRIGGER entity_embedding_entity_changed AFTER DELETE OR UPDATE ON memory.entity FOR EACH ROW EXECUTE FUNCTION memory.invalidate_entity_embeddings()entity_embedding_entity_created:CREATE TRIGGER entity_embedding_entity_created AFTER INSERT ON memory.entity FOR EACH ROW EXECUTE FUNCTION memory.stale_entity_embedding_snapshots()
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- community_member through
member_entity_project_fk - entity_embedding_target through
entity_embedding_target_scope_entity_id_fkey - fact through
fact_object_project_fk - fact through
fact_subject_project_fk - projection_dependency through
dependency_entity_project_fk
entity_embedding
owner postgres · partitioned by LIST (generation_id)
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
generation_id | uuid | not null | ||
entity_id | uuid | not null | ||
embedding_key | text | generated: (((generation_id)::text || '/'::text) || (entity_id)::text) | ||
input_digest | bytea | not null | ||
source_digest | bytea | not null | ||
source_count | integer | not null | ||
embedding | vector | not null | ||
dimensions | integer | generated: vector_dims(embedding) |
Constraints
entity_embedding_embedding_check:CHECK ((vector_norm(embedding) > (0)::double precision))entity_embedding_input_digest_check:CHECK ((octet_length(input_digest) = 32))entity_embedding_source_count_check:CHECK (((source_count >= 1) AND (source_count <= 4096)))entity_embedding_source_digest_check:CHECK ((octet_length(source_digest) = 32))entity_embedding_scope_generation_id_dimensions_fkey:FOREIGN KEY (scope, generation_id, dimensions) REFERENCES memory.entity_embedding_generation(scope, generation_id, dimensions)entity_embedding_scope_generation_id_entity_id_fkey:FOREIGN KEY (scope, generation_id, entity_id) REFERENCES memory.entity_embedding_target(scope, generation_id, entity_id) ON DELETE CASCADEentity_embedding_embedding_not_null:NOT NULL embeddingentity_embedding_entity_id_not_null:NOT NULL entity_identity_embedding_generation_id_not_null:NOT NULL generation_identity_embedding_input_digest_not_null:NOT NULL input_digestentity_embedding_scope_not_null:NOT NULL scopeentity_embedding_source_count_not_null:NOT NULL source_countentity_embedding_source_digest_not_null:NOT NULL source_digestentity_embedding_pkey:PRIMARY KEY (scope, generation_id, entity_id)entity_embedding_scope_generation_id_embedding_key_key:UNIQUE (scope, generation_id, embedding_key)
Indexes
entity_embedding_pkey:CREATE UNIQUE INDEX entity_embedding_pkey ON ONLY memory.entity_embedding USING btree (scope, generation_id, entity_id)entity_embedding_scope_generation_id_embedding_key_key:CREATE UNIQUE INDEX entity_embedding_scope_generation_id_embedding_key_key ON ONLY memory.entity_embedding USING btree (scope, generation_id, embedding_key)
Triggers
entity_embedding_removed:CREATE TRIGGER entity_embedding_removed AFTER DELETE ON memory.entity_embedding FOR EACH ROW EXECUTE FUNCTION memory.mark_entity_embedding_incomplete()
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- entity_embedding_source through
entity_embedding_source_scope_generation_id_entity_id_fkey
entity_embedding_active
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
generation_id | uuid | not null | ||
activated_at | timestamp with time zone | not null | clock_timestamp() |
Constraints
entity_embedding_active_scope_fkey:FOREIGN KEY (scope) REFERENCES memory.project(scope) ON DELETE CASCADEentity_embedding_active_scope_generation_id_fkey:FOREIGN KEY (scope, generation_id) REFERENCES memory.entity_embedding_generation(scope, generation_id)entity_embedding_active_activated_at_not_null:NOT NULL activated_atentity_embedding_active_generation_id_not_null:NOT NULL generation_identity_embedding_active_scope_not_null:NOT NULL scopeentity_embedding_active_pkey:PRIMARY KEY (scope)
Indexes
entity_embedding_active_pkey:CREATE UNIQUE INDEX entity_embedding_active_pkey ON memory.entity_embedding_active USING btree (scope)
Privileges
taisce_data:SELECT
entity_embedding_build
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
generation_id | uuid | not null | ||
state | text | not null | 'building'::text | |
after_entity_id | uuid | |||
examined | bigint | not null | 0 | |
stored | bigint | not null | 0 | |
lease_id | uuid | |||
updated_at | timestamp with time zone | not null | clock_timestamp() |
Constraints
entity_embedding_build_examined_check:CHECK ((examined >= 0))entity_embedding_build_state_check:CHECK ((state = ANY (ARRAY['building'::text, 'ready'::text, 'stale'::text, 'cancelled'::text, 'discarded'::text])))entity_embedding_build_stored_check:CHECK ((stored >= 0))entity_embedding_build_scope_generation_id_fkey:FOREIGN KEY (scope, generation_id) REFERENCES memory.entity_embedding_generation(scope, generation_id) ON DELETE CASCADEentity_embedding_build_examined_not_null:NOT NULL examinedentity_embedding_build_generation_id_not_null:NOT NULL generation_identity_embedding_build_scope_not_null:NOT NULL scopeentity_embedding_build_state_not_null:NOT NULL stateentity_embedding_build_stored_not_null:NOT NULL storedentity_embedding_build_updated_at_not_null:NOT NULL updated_atentity_embedding_build_pkey:PRIMARY KEY (scope, generation_id)
Indexes
entity_embedding_build_pkey:CREATE UNIQUE INDEX entity_embedding_build_pkey ON memory.entity_embedding_build USING btree (scope, generation_id)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
entity_embedding_generation
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
generation_id | uuid | not null | ||
scope | text | not null | ||
operation_key | uuid | not null | ||
model_name | text | not null | ||
model_revision | text | not null | ||
endpoint_hash | text | not null | ||
identity_hash | text | not null | ||
dimensions | integer | not null | ||
metric | text | not null | 'cosine'::text | |
input_version | text | not null | 'entity-evidence/v1'::text | |
target_count | bigint | not null | 0 | |
created_at | timestamp with time zone | not null | clock_timestamp() |
Constraints
entity_embedding_generation_dimensions_check:CHECK (((dimensions >= 1) AND (dimensions <= 4000)))entity_embedding_generation_endpoint_hash_check:CHECK ((endpoint_hash ~ '^[0-9a-f]{64}$'::text))entity_embedding_generation_identity_hash_check:CHECK ((identity_hash ~ '^[0-9a-f]{64}$'::text))entity_embedding_generation_input_version_check:CHECK ((input_version = 'entity-evidence/v1'::text))entity_embedding_generation_metric_check:CHECK ((metric = 'cosine'::text))entity_embedding_generation_model_name_check:CHECK (((octet_length(model_name) >= 1) AND (octet_length(model_name) <= 256)))entity_embedding_generation_model_revision_check:CHECK (((octet_length(model_revision) >= 1) AND (octet_length(model_revision) <= 128)))entity_embedding_generation_target_count_check:CHECK ((target_count >= 0))entity_embedding_generation_scope_fkey:FOREIGN KEY (scope) REFERENCES memory.project(scope) ON DELETE CASCADEentity_embedding_generation_created_at_not_null:NOT NULL created_atentity_embedding_generation_dimensions_not_null:NOT NULL dimensionsentity_embedding_generation_endpoint_hash_not_null:NOT NULL endpoint_hashentity_embedding_generation_generation_id_not_null:NOT NULL generation_identity_embedding_generation_identity_hash_not_null:NOT NULL identity_hashentity_embedding_generation_input_version_not_null:NOT NULL input_versionentity_embedding_generation_metric_not_null:NOT NULL metricentity_embedding_generation_model_name_not_null:NOT NULL model_nameentity_embedding_generation_model_revision_not_null:NOT NULL model_revisionentity_embedding_generation_operation_key_not_null:NOT NULL operation_keyentity_embedding_generation_scope_not_null:NOT NULL scopeentity_embedding_generation_target_count_not_null:NOT NULL target_countentity_embedding_generation_pkey:PRIMARY KEY (generation_id)entity_embedding_generation_scope_generation_id_dimensions_key:UNIQUE (scope, generation_id, dimensions)entity_embedding_generation_scope_generation_id_key:UNIQUE (scope, generation_id)entity_embedding_generation_scope_operation_key_key:UNIQUE (scope, operation_key)
Indexes
entity_embedding_generation_pkey:CREATE UNIQUE INDEX entity_embedding_generation_pkey ON memory.entity_embedding_generation USING btree (generation_id)entity_embedding_generation_scope_generation_id_dimensions_key:CREATE UNIQUE INDEX entity_embedding_generation_scope_generation_id_dimensions_key ON memory.entity_embedding_generation USING btree (scope, generation_id, dimensions)entity_embedding_generation_scope_generation_id_key:CREATE UNIQUE INDEX entity_embedding_generation_scope_generation_id_key ON memory.entity_embedding_generation USING btree (scope, generation_id)entity_embedding_generation_scope_operation_key_key:CREATE UNIQUE INDEX entity_embedding_generation_scope_operation_key_key ON memory.entity_embedding_generation USING btree (scope, operation_key)
Triggers
entity_embedding_identity_immutable:CREATE TRIGGER entity_embedding_identity_immutable BEFORE UPDATE ON memory.entity_embedding_generation FOR EACH ROW EXECUTE FUNCTION memory.immutable_entity_embedding_identity()
Privileges
taisce_data:SELECT
Referenced by
- entity_embedding through
entity_embedding_scope_generation_id_dimensions_fkey - entity_embedding_active through
entity_embedding_active_scope_generation_id_fkey - entity_embedding_build through
entity_embedding_build_scope_generation_id_fkey - entity_embedding_target through
entity_embedding_target_scope_generation_id_fkey
entity_embedding_source
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
generation_id | uuid | not null | ||
entity_id | uuid | not null | ||
source_observation_id | uuid | not null | ||
embedding_key | text | generated: (((generation_id)::text || '/'::text) || (entity_id)::text) | ||
registration_kind | text | generated: 'entity_embedding'::text |
Constraints
entity_embedding_source_scope_generation_id_entity_id_fkey:FOREIGN KEY (scope, generation_id, entity_id) REFERENCES memory.entity_embedding(scope, generation_id, entity_id) ON DELETE CASCADEentity_embedding_source_scope_source_observation_id_fkey:FOREIGN KEY (scope, source_observation_id) REFERENCES memory.observation(scope, observation_id) ON DELETE CASCADEentity_embedding_source_source_observation_id_registration_fkey:FOREIGN KEY (source_observation_id, registration_kind, embedding_key) REFERENCES memory.projection_dependency(source_observation_id, projection_kind, projection_id) DEFERRABLE INITIALLY DEFERREDentity_embedding_source_entity_id_not_null:NOT NULL entity_identity_embedding_source_generation_id_not_null:NOT NULL generation_identity_embedding_source_scope_not_null:NOT NULL scopeentity_embedding_source_source_observation_id_not_null:NOT NULL source_observation_identity_embedding_source_pkey:PRIMARY KEY (scope, generation_id, entity_id, source_observation_id)
Indexes
entity_embedding_source_observation_idx:CREATE INDEX entity_embedding_source_observation_idx ON memory.entity_embedding_source USING btree (scope, source_observation_id)entity_embedding_source_pkey:CREATE UNIQUE INDEX entity_embedding_source_pkey ON memory.entity_embedding_source USING btree (scope, generation_id, entity_id, source_observation_id)
Triggers
entity_embedding_source_removed:CREATE TRIGGER entity_embedding_source_removed AFTER DELETE ON memory.entity_embedding_source FOR EACH ROW EXECUTE FUNCTION memory.invalidate_entity_embedding_source()
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- projection_dependency through
dependency_entity_embedding_source_fk
entity_embedding_target
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
generation_id | uuid | not null | ||
entity_id | uuid | not null |
Constraints
entity_embedding_target_scope_entity_id_fkey:FOREIGN KEY (scope, entity_id) REFERENCES memory.entity(scope, entity_id) ON DELETE CASCADEentity_embedding_target_scope_generation_id_fkey:FOREIGN KEY (scope, generation_id) REFERENCES memory.entity_embedding_generation(scope, generation_id) ON DELETE CASCADEentity_embedding_target_entity_id_not_null:NOT NULL entity_identity_embedding_target_generation_id_not_null:NOT NULL generation_identity_embedding_target_scope_not_null:NOT NULL scopeentity_embedding_target_pkey:PRIMARY KEY (scope, generation_id, entity_id)
Indexes
entity_embedding_target_pkey:CREATE UNIQUE INDEX entity_embedding_target_pkey ON memory.entity_embedding_target USING btree (scope, generation_id, entity_id)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- entity_embedding through
entity_embedding_scope_generation_id_entity_id_fkey
entity_name_receipt
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
source_observation_id | uuid | not null | ||
entity_id | uuid | not null | ||
name | text | not null | ||
normalized_name | text | not null | ||
name_hash | bytea | not null |
Constraints
entity_name_receipt_name_check:CHECK (((octet_length(name) >= 1) AND (octet_length(name) <= 4096)))entity_name_receipt_normalized_name_check:CHECK (((octet_length(normalized_name) >= 1) AND (octet_length(normalized_name) <= 4096)))entity_name_receipt_scope_source_observation_id_fkey:FOREIGN KEY (scope, source_observation_id) REFERENCES memory.observation(scope, observation_id) ON DELETE CASCADEentity_name_receipt_entity_id_not_null:NOT NULL entity_identity_name_receipt_name_hash_not_null:NOT NULL name_hashentity_name_receipt_name_not_null:NOT NULL nameentity_name_receipt_normalized_name_not_null:NOT NULL normalized_nameentity_name_receipt_scope_not_null:NOT NULL scopeentity_name_receipt_source_observation_id_not_null:NOT NULL source_observation_identity_name_receipt_pkey:PRIMARY KEY (scope, source_observation_id, entity_id, name_hash)
Indexes
entity_name_receipt_entity_idx:CREATE INDEX entity_name_receipt_entity_idx ON memory.entity_name_receipt USING btree (scope, entity_id)entity_name_receipt_pkey:CREATE UNIQUE INDEX entity_name_receipt_pkey ON memory.entity_name_receipt USING btree (scope, source_observation_id, entity_id, name_hash)
Triggers
entity_embedding_name_changed:CREATE TRIGGER entity_embedding_name_changed AFTER INSERT OR DELETE OR UPDATE ON memory.entity_name_receipt FOR EACH ROW EXECUTE FUNCTION memory.invalidate_entity_embeddings()entity_name_receipt_identity:CREATE TRIGGER entity_name_receipt_identity BEFORE INSERT OR UPDATE ON memory.entity_name_receipt FOR EACH ROW EXECUTE FUNCTION memory.validate_entity_name_receipt()
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
erasure_request
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
request_id | uuid | not null | ||
scope | text | not null | ||
selector | jsonb | not null | ||
reason | text | not null | ||
requested_at | timestamp with time zone | not null | now() | |
completed_at | timestamp with time zone | |||
residual | jsonb |
Constraints
erasure_residual_with_completion_chk:CHECK (((completed_at IS NULL) = (residual IS NULL)))erasure_request_reason_not_null:NOT NULL reasonerasure_request_request_id_not_null:NOT NULL request_iderasure_request_requested_at_not_null:NOT NULL requested_aterasure_request_scope_not_null:NOT NULL scopeerasure_request_selector_not_null:NOT NULL selectorerasure_request_pkey:PRIMARY KEY (request_id)
Indexes
erasure_request_open_idx:CREATE INDEX erasure_request_open_idx ON memory.erasure_request USING btree (scope, requested_at) WHERE (completed_at IS NULL)erasure_request_pkey:CREATE UNIQUE INDEX erasure_request_pkey ON memory.erasure_request USING btree (request_id)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
fact
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
fact_id | uuid | not null | ||
scope | text | not null | ||
subject_entity_id | uuid | |||
object_entity_id | uuid | |||
predicate | text | not null | ||
statement | text | not null | ||
valid | tstzrange | not null | ||
known | tstzrange | not null | tstzrange(now(), NULL::timestamp with time zone) | |
confidence | real | not null | 0 | |
lang | text | not null | 'en'::text | |
recorded_at | timestamp with time zone | not null | now() | |
data_subject_id | text | |||
retention_until | timestamp with time zone | When this fact stops answering, taken from the latest deadline of the observations supporting it, or null when one of them is kept indefinitely. The sweep deletes it afterwards; this is what makes it unreachable in between. | ||
cardinality | text | not null | Copied from the vocabulary so that the exclusion constraint can read it — a constraint cannot consult another table. A composite foreign key on (predicate, cardinality) makes the copy unable to disagree, so this is a denormalisation the database refuses to let go wrong. | |
source_role | text | not null | The role of the message this fact was extracted from. Recoverable by joining evidence to the message, and kept here because every filter that wanted it would pay a join and the one that forgot would silently include everything — on the read path, where a planted fact looks exactly like a stated one. | |
superseded_by | uuid | |||
supersession_source | uuid | |||
version | uuid | not null | gen_random_uuid() |
Constraints
fact_known_not_empty_chk:CHECK ((NOT isempty(known)))fact_source_role_chk:CHECK ((source_role = ANY (ARRAY['user'::text, 'assistant'::text, 'system'::text, 'tool'::text, 'unknown'::text])))fact_valid_not_empty_chk:CHECK ((NOT isempty(valid)))fact_cardinality_matches_vocabulary:FOREIGN KEY (predicate, cardinality) REFERENCES memory.predicate(predicate, cardinality) ON UPDATE CASCADEfact_object_project_fk:FOREIGN KEY (scope, object_entity_id) REFERENCES memory.entity(scope, entity_id) DEFERRABLE INITIALLY DEFERREDfact_predicate_fk:FOREIGN KEY (predicate) REFERENCES memory.predicate(predicate)fact_subject_project_fk:FOREIGN KEY (scope, subject_entity_id) REFERENCES memory.entity(scope, entity_id) DEFERRABLE INITIALLY DEFERREDfact_successor_project_fk:FOREIGN KEY (scope, superseded_by) REFERENCES memory.fact(scope, fact_id) ON DELETE SET NULL (superseded_by) DEFERRABLE INITIALLY DEFERREDfact_supersession_source_fk:FOREIGN KEY (scope, supersession_source) REFERENCES memory.observation(scope, observation_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDfact_cardinality_not_null:NOT NULL cardinalityfact_confidence_not_null:NOT NULL confidencefact_fact_id_not_null:NOT NULL fact_idfact_known_not_null:NOT NULL knownfact_lang_not_null:NOT NULL langfact_predicate_not_null:NOT NULL predicatefact_recorded_at_not_null:NOT NULL recorded_atfact_scope_not_null:NOT NULL scopefact_source_role_not_null:NOT NULL source_rolefact_statement_not_null:NOT NULL statementfact_valid_not_null:NOT NULL validfact_version_not_null:NOT NULL versionfact_pkey:PRIMARY KEY (fact_id)fact_scope_id_uniq:UNIQUE (scope, fact_id)fact_single_cardinality_excl:EXCLUDE USING gist (scope WITH =, subject_entity_id WITH =, predicate WITH =, valid WITH &&, known WITH &&) WHERE (((cardinality = 'one'::text) AND (subject_entity_id IS NOT NULL)))
Indexes
fact_bitemporal_idx:CREATE INDEX fact_bitemporal_idx ON memory.fact USING gist (scope, valid, known)fact_object_idx:CREATE INDEX fact_object_idx ON memory.fact USING gist (scope, object_entity_id, valid) WHERE (object_entity_id IS NOT NULL)fact_object_walk_idx:CREATE INDEX fact_object_walk_idx ON memory.fact USING btree (object_entity_id, fact_id) WHERE (upper_inf(valid) AND upper_inf(known) AND (object_entity_id IS NOT NULL))fact_pkey:CREATE UNIQUE INDEX fact_pkey ON memory.fact USING btree (fact_id)fact_principal_idx:CREATE INDEX fact_principal_idx ON memory.fact USING btree (scope, subject_entity_id) WHERE ((source_role = 'user'::text) AND (subject_entity_id IS NOT NULL))fact_reconcile_idx:CREATE INDEX fact_reconcile_idx ON memory.fact USING btree (scope, subject_entity_id, predicate) WHERE (upper_inf(valid) AND (subject_entity_id IS NOT NULL))fact_retention_idx:CREATE INDEX fact_retention_idx ON memory.fact USING btree (scope, retention_until) WHERE (retention_until IS NOT NULL)fact_scope_id_uniq:CREATE UNIQUE INDEX fact_scope_id_uniq ON memory.fact USING btree (scope, fact_id)fact_single_cardinality_excl:CREATE INDEX fact_single_cardinality_excl ON memory.fact USING gist (scope, subject_entity_id, predicate, valid, known) WHERE ((cardinality = 'one'::text) AND (subject_entity_id IS NOT NULL))fact_subject_idx:CREATE INDEX fact_subject_idx ON memory.fact USING gist (scope, subject_entity_id, valid) WHERE (subject_entity_id IS NOT NULL)fact_subject_ref_idx:CREATE INDEX fact_subject_ref_idx ON memory.fact USING btree (scope, data_subject_id) WHERE (data_subject_id IS NOT NULL)fact_subject_walk_idx:CREATE INDEX fact_subject_walk_idx ON memory.fact USING btree (subject_entity_id, fact_id) WHERE (upper_inf(valid) AND upper_inf(known) AND (subject_entity_id IS NOT NULL))fact_successor_idx:CREATE INDEX fact_successor_idx ON memory.fact USING btree (scope, superseded_by) WHERE (superseded_by IS NOT NULL)fact_supersession_source_idx:CREATE INDEX fact_supersession_source_idx ON memory.fact USING btree (scope, supersession_source) WHERE (supersession_source IS NOT NULL)
Triggers
entity_embedding_fact_changed:CREATE TRIGGER entity_embedding_fact_changed AFTER INSERT OR DELETE OR UPDATE ON memory.fact FOR EACH ROW EXECUTE FUNCTION memory.invalidate_entity_embeddings()fact_record_version:CREATE TRIGGER fact_record_version BEFORE UPDATE ON memory.fact FOR EACH ROW EXECUTE FUNCTION memory.advance_record_version()fact_report_revision:CREATE TRIGGER fact_report_revision BEFORE DELETE OR UPDATE ON memory.fact FOR EACH ROW EXECUTE FUNCTION memory.invalidate_fact_reports()fact_transition_receipt:CREATE TRIGGER fact_transition_receipt AFTER UPDATE ON memory.fact FOR EACH ROW EXECUTE FUNCTION memory.retain_fact_transition()
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- fact through
fact_successor_project_fk - fact_evidence through
evidence_fact_project_fk - fact_history through
fact_history_scope_fact_id_fkey - memory_feedback through
feedback_target_fk - projection_dependency through
dependency_fact_project_fk
fact_evidence
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
fact_id | uuid | not null | ||
source_observation_id | uuid | not null | ||
quote | text | not null | ||
byte_start | integer | not null | ||
byte_end | integer | not null | ||
extractor_version | text | not null | ||
source_ordinal | integer | not null | Ordinal of the turn_message this span indexes. Byte offsets are meaningless without it: taken against another message of the same turn they resolve to a plausible fragment of the wrong sentence rather than to nothing. | |
scope | text | not null |
Constraints
fact_evidence_ordinal_chk:CHECK ((source_ordinal >= 0))fact_evidence_span_chk:CHECK ((byte_end > byte_start))evidence_fact_project_fk:FOREIGN KEY (scope, fact_id) REFERENCES memory.fact(scope, fact_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDevidence_message_fk:FOREIGN KEY (source_observation_id, source_ordinal) REFERENCES memory.turn_message(observation_id, ordinal) DEFERRABLE INITIALLY DEFERREDevidence_source_project_fk:FOREIGN KEY (scope, source_observation_id) REFERENCES memory.observation(scope, observation_id) DEFERRABLE INITIALLY DEFERREDfact_evidence_byte_end_not_null:NOT NULL byte_endfact_evidence_byte_start_not_null:NOT NULL byte_startfact_evidence_extractor_version_not_null:NOT NULL extractor_versionfact_evidence_fact_id_not_null:NOT NULL fact_idfact_evidence_quote_not_null:NOT NULL quotefact_evidence_scope_not_null:NOT NULL scopefact_evidence_source_observation_id_not_null:NOT NULL source_observation_idfact_evidence_source_ordinal_not_null:NOT NULL source_ordinalfact_evidence_pkey:PRIMARY KEY (fact_id, source_observation_id, source_ordinal, byte_start)
Indexes
evidence_source_message_idx:CREATE INDEX evidence_source_message_idx ON memory.fact_evidence USING btree (source_observation_id, source_ordinal)fact_evidence_pkey:CREATE UNIQUE INDEX fact_evidence_pkey ON memory.fact_evidence USING btree (fact_id, source_observation_id, source_ordinal, byte_start)
Triggers
entity_embedding_evidence_changed:CREATE TRIGGER entity_embedding_evidence_changed AFTER INSERT OR DELETE OR UPDATE ON memory.fact_evidence FOR EACH ROW EXECUTE FUNCTION memory.invalidate_entity_embeddings()evidence_report_revision:CREATE TRIGGER evidence_report_revision AFTER INSERT OR DELETE OR UPDATE ON memory.fact_evidence FOR EACH ROW EXECUTE FUNCTION memory.invalidate_fact_reports()
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
fact_generation
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
generation_id | uuid | not null | ||
source_observation_id | uuid | not null | ||
operation_key | uuid | not null | ||
extractor_version | text | not null | ||
previous_extractor_version | text | |||
previous_generation_id | uuid | |||
applied_at | timestamp with time zone | not null | ||
messages_read | integer | not null | ||
facts_asserted | integer | not null | ||
facts_retired | integer | not null | ||
claims_rejected | integer | not null | ||
claims_retracted | integer | not null | ||
claims_refused_by_role | integer | not null | ||
principal_id | uuid | not null |
Constraints
fact_generation_claims_refused_by_role_check:CHECK (((claims_refused_by_role >= 0) AND (claims_refused_by_role <= 100)))fact_generation_claims_rejected_check:CHECK (((claims_rejected >= 0) AND (claims_rejected <= 100)))fact_generation_claims_retracted_check:CHECK (((claims_retracted >= 0) AND (claims_retracted <= 100)))fact_generation_extractor_version_check:CHECK ((extractor_version ~ '^extract/v2:[a-f0-9]{64}$'::text))fact_generation_facts_asserted_check:CHECK (((facts_asserted >= 0) AND (facts_asserted <= 100)))fact_generation_facts_retired_check:CHECK (((facts_retired >= 0) AND (facts_retired <= 100)))fact_generation_messages_read_check:CHECK (((messages_read >= 1) AND (messages_read <= 256)))fact_generation_scope_source_observation_id_fkey:FOREIGN KEY (scope, source_observation_id) REFERENCES memory.observation(scope, observation_id) ON DELETE CASCADEfact_generation_applied_at_not_null:NOT NULL applied_atfact_generation_claims_refused_by_role_not_null:NOT NULL claims_refused_by_rolefact_generation_claims_rejected_not_null:NOT NULL claims_rejectedfact_generation_claims_retracted_not_null:NOT NULL claims_retractedfact_generation_extractor_version_not_null:NOT NULL extractor_versionfact_generation_facts_asserted_not_null:NOT NULL facts_assertedfact_generation_facts_retired_not_null:NOT NULL facts_retiredfact_generation_generation_id_not_null:NOT NULL generation_idfact_generation_messages_read_not_null:NOT NULL messages_readfact_generation_operation_key_not_null:NOT NULL operation_keyfact_generation_principal_id_not_null:NOT NULL principal_idfact_generation_scope_not_null:NOT NULL scopefact_generation_source_observation_id_not_null:NOT NULL source_observation_idfact_generation_pkey:PRIMARY KEY (scope, generation_id)fact_generation_scope_source_observation_id_generation_id_key:UNIQUE (scope, source_observation_id, generation_id)fact_generation_scope_source_observation_id_operation_key_key:UNIQUE (scope, source_observation_id, operation_key)
Indexes
fact_generation_pkey:CREATE UNIQUE INDEX fact_generation_pkey ON memory.fact_generation USING btree (scope, generation_id)fact_generation_scope_source_observation_id_generation_id_key:CREATE UNIQUE INDEX fact_generation_scope_source_observation_id_generation_id_key ON memory.fact_generation USING btree (scope, source_observation_id, generation_id)fact_generation_scope_source_observation_id_operation_key_key:CREATE UNIQUE INDEX fact_generation_scope_source_observation_id_operation_key_key ON memory.fact_generation USING btree (scope, source_observation_id, operation_key)generation_source_time_idx:CREATE INDEX generation_source_time_idx ON memory.fact_generation USING btree (scope, source_observation_id, applied_at DESC)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- fact_generation_record through
fact_generation_record_scope_source_observation_id_generat_fkey - source_extraction through
source_extraction_generation_fk
fact_generation_record
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
source_observation_id | uuid | not null | ||
generation_id | uuid | not null | ||
fact_id | uuid | not null | ||
disposition | text | not null |
Constraints
fact_generation_record_disposition_check:CHECK ((disposition = ANY (ARRAY['admitted'::text, 'retired'::text])))fact_generation_record_scope_fact_id_source_observation_id_fkey:FOREIGN KEY (scope, fact_id, source_observation_id) REFERENCES memory.fact_receipt(scope, fact_id, source_observation_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDfact_generation_record_scope_source_observation_id_generat_fkey:FOREIGN KEY (scope, source_observation_id, generation_id) REFERENCES memory.fact_generation(scope, source_observation_id, generation_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDfact_generation_record_disposition_not_null:NOT NULL dispositionfact_generation_record_fact_id_not_null:NOT NULL fact_idfact_generation_record_generation_id_not_null:NOT NULL generation_idfact_generation_record_scope_not_null:NOT NULL scopefact_generation_record_source_observation_id_not_null:NOT NULL source_observation_idfact_generation_record_pkey:PRIMARY KEY (scope, generation_id, disposition, fact_id)
Indexes
fact_generation_record_pkey:CREATE UNIQUE INDEX fact_generation_record_pkey ON memory.fact_generation_record USING btree (scope, generation_id, disposition, fact_id)generation_record_fact_idx:CREATE UNIQUE INDEX generation_record_fact_idx ON memory.fact_generation_record USING btree (scope, fact_id, disposition)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
fact_history
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
history_id | uuid | not null | ||
scope | text | not null | ||
fact_id | uuid | not null | ||
valid | tstzrange | not null | ||
known | tstzrange | not null | ||
source_observation_id | uuid | not null |
Constraints
fact_history_known_check:CHECK (((NOT isempty(known)) AND (NOT upper_inf(known))))fact_history_valid_check:CHECK ((NOT isempty(valid)))fact_history_scope_fact_id_fkey:FOREIGN KEY (scope, fact_id) REFERENCES memory.fact(scope, fact_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDfact_history_scope_source_observation_id_fkey:FOREIGN KEY (scope, source_observation_id) REFERENCES memory.observation(scope, observation_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDfact_history_fact_id_not_null:NOT NULL fact_idfact_history_history_id_not_null:NOT NULL history_idfact_history_known_not_null:NOT NULL knownfact_history_scope_not_null:NOT NULL scopefact_history_source_observation_id_not_null:NOT NULL source_observation_idfact_history_valid_not_null:NOT NULL validfact_history_pkey:PRIMARY KEY (history_id)fact_history_scope_id_uniq:UNIQUE (scope, history_id)fact_history_fact_id_known_excl:EXCLUDE USING gist (fact_id WITH =, known WITH &&)
Indexes
fact_history_fact_id_known_excl:CREATE INDEX fact_history_fact_id_known_excl ON memory.fact_history USING gist (fact_id, known)fact_history_page_idx:CREATE INDEX fact_history_page_idx ON memory.fact_history USING btree (scope, fact_id, upper(known) DESC, history_id DESC)fact_history_pkey:CREATE UNIQUE INDEX fact_history_pkey ON memory.fact_history USING btree (history_id)fact_history_scope_id_uniq:CREATE UNIQUE INDEX fact_history_scope_id_uniq ON memory.fact_history USING btree (scope, history_id)fact_history_source_idx:CREATE INDEX fact_history_source_idx ON memory.fact_history USING btree (scope, source_observation_id)
Triggers
fact_history_receipt:CREATE TRIGGER fact_history_receipt AFTER INSERT ON memory.fact_history FOR EACH ROW EXECUTE FUNCTION memory.retain_fact_history()
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- projection_dependency through
dependency_history_project_fk
fact_rebuild_job
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
job_id | uuid | not null | ||
extractor_version | text | not null | ||
through_offset | bigint | not null | ||
after_offset | bigint | not null | '-1'::integer | |
pending_offset | bigint | |||
sources_rebuilt | bigint | not null | 0 | |
sources_skipped | bigint | not null | 0 | |
status | text | not null | 'active'::text | |
cancel_requested | boolean | not null | false | |
lease_id | uuid | not null | ||
created_at | timestamp with time zone | not null | clock_timestamp() | |
updated_at | timestamp with time zone | not null | clock_timestamp() |
Constraints
fact_rebuild_job_after_offset_check:CHECK ((after_offset >= '-1'::integer))fact_rebuild_job_check:CHECK ((after_offset <= through_offset))fact_rebuild_job_check1:CHECK (((pending_offset IS NULL) OR ((pending_offset > after_offset) AND (pending_offset <= through_offset))))fact_rebuild_job_check2:CHECK (((status = 'active'::text) OR (pending_offset IS NULL)))fact_rebuild_job_extractor_version_check:CHECK ((extractor_version ~ '^extract/v2:[a-f0-9]{64}$'::text))fact_rebuild_job_sources_rebuilt_check:CHECK ((sources_rebuilt >= 0))fact_rebuild_job_sources_skipped_check:CHECK ((sources_skipped >= 0))fact_rebuild_job_status_check:CHECK ((status = ANY (ARRAY['active'::text, 'completed'::text, 'cancelled'::text])))fact_rebuild_job_through_offset_check:CHECK ((through_offset >= '-1'::integer))fact_rebuild_job_after_offset_not_null:NOT NULL after_offsetfact_rebuild_job_cancel_requested_not_null:NOT NULL cancel_requestedfact_rebuild_job_created_at_not_null:NOT NULL created_atfact_rebuild_job_extractor_version_not_null:NOT NULL extractor_versionfact_rebuild_job_job_id_not_null:NOT NULL job_idfact_rebuild_job_lease_id_not_null:NOT NULL lease_idfact_rebuild_job_scope_not_null:NOT NULL scopefact_rebuild_job_sources_rebuilt_not_null:NOT NULL sources_rebuiltfact_rebuild_job_sources_skipped_not_null:NOT NULL sources_skippedfact_rebuild_job_status_not_null:NOT NULL statusfact_rebuild_job_through_offset_not_null:NOT NULL through_offsetfact_rebuild_job_updated_at_not_null:NOT NULL updated_atfact_rebuild_job_pkey:PRIMARY KEY (scope, job_id)
Indexes
fact_rebuild_job_pkey:CREATE UNIQUE INDEX fact_rebuild_job_pkey ON memory.fact_rebuild_job USING btree (scope, job_id)one_active_fact_rebuild:CREATE UNIQUE INDEX one_active_fact_rebuild ON memory.fact_rebuild_job USING btree (scope) WHERE (status = 'active'::text)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
fact_receipt
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
fact_id | uuid | not null | ||
source_observation_id | uuid | not null | ||
source_ordinal | integer | not null | ||
state | jsonb | not null | ||
evidence | jsonb | not null | ||
subject_identity | jsonb | |||
object_identity | jsonb | |||
pipeline_version | text | not null | ||
supersession_source | uuid | |||
superseded_by | uuid |
Constraints
fact_receipt_check:CHECK ((((state ->> 'scope'::text) = scope) AND (((state ->> 'fact_id'::text))::uuid = fact_id)))fact_receipt_evidence_check:CHECK ((jsonb_typeof(evidence) = 'object'::text))fact_receipt_state_check:CHECK ((jsonb_typeof(state) = 'object'::text))fact_receipt_scope_source_observation_id_fkey:FOREIGN KEY (scope, source_observation_id) REFERENCES memory.observation(scope, observation_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDfact_receipt_scope_supersession_source_fkey:FOREIGN KEY (scope, supersession_source) REFERENCES memory.observation(scope, observation_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDfact_receipt_source_observation_id_source_ordinal_fkey:FOREIGN KEY (source_observation_id, source_ordinal) REFERENCES memory.turn_message(observation_id, ordinal) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDfact_receipt_evidence_not_null:NOT NULL evidencefact_receipt_fact_id_not_null:NOT NULL fact_idfact_receipt_pipeline_version_not_null:NOT NULL pipeline_versionfact_receipt_scope_not_null:NOT NULL scopefact_receipt_source_observation_id_not_null:NOT NULL source_observation_idfact_receipt_source_ordinal_not_null:NOT NULL source_ordinalfact_receipt_state_not_null:NOT NULL statefact_receipt_pkey:PRIMARY KEY (scope, fact_id)receipt_generation_source_uniq:UNIQUE (scope, fact_id, source_observation_id)
Indexes
fact_receipt_cause_idx:CREATE INDEX fact_receipt_cause_idx ON memory.fact_receipt USING btree (scope, supersession_source) WHERE (supersession_source IS NOT NULL)fact_receipt_pkey:CREATE UNIQUE INDEX fact_receipt_pkey ON memory.fact_receipt USING btree (scope, fact_id)fact_receipt_source_idx:CREATE INDEX fact_receipt_source_idx ON memory.fact_receipt USING btree (scope, source_observation_id, fact_id)fact_receipt_successor_idx:CREATE INDEX fact_receipt_successor_idx ON memory.fact_receipt USING btree (scope, superseded_by) WHERE (superseded_by IS NOT NULL)receipt_generation_source_uniq:CREATE UNIQUE INDEX receipt_generation_source_uniq ON memory.fact_receipt USING btree (scope, fact_id, source_observation_id)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- fact_generation_record through
fact_generation_record_scope_fact_id_source_observation_id_fkey - fact_receipt_history through
fact_receipt_history_scope_fact_id_fkey
fact_receipt_history
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
history_id | uuid | not null | ||
fact_id | uuid | not null | ||
valid | tstzrange | not null | ||
known | tstzrange | not null | ||
source_observation_id | uuid | not null |
Constraints
fact_receipt_history_known_check:CHECK (((NOT isempty(known)) AND (NOT upper_inf(known))))fact_receipt_history_valid_check:CHECK ((NOT isempty(valid)))fact_receipt_history_scope_fact_id_fkey:FOREIGN KEY (scope, fact_id) REFERENCES memory.fact_receipt(scope, fact_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDfact_receipt_history_scope_source_observation_id_fkey:FOREIGN KEY (scope, source_observation_id) REFERENCES memory.observation(scope, observation_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDfact_receipt_history_fact_id_not_null:NOT NULL fact_idfact_receipt_history_history_id_not_null:NOT NULL history_idfact_receipt_history_known_not_null:NOT NULL knownfact_receipt_history_scope_not_null:NOT NULL scopefact_receipt_history_source_observation_id_not_null:NOT NULL source_observation_idfact_receipt_history_valid_not_null:NOT NULL validfact_receipt_history_pkey:PRIMARY KEY (scope, history_id)
Indexes
fact_receipt_history_pkey:CREATE UNIQUE INDEX fact_receipt_history_pkey ON memory.fact_receipt_history USING btree (scope, history_id)receipt_history_fact_idx:CREATE INDEX receipt_history_fact_idx ON memory.fact_receipt_history USING btree (scope, fact_id)receipt_history_source_idx:CREATE INDEX receipt_history_source_idx ON memory.fact_receipt_history USING btree (scope, source_observation_id)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
formation_health
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
singleton | boolean | not null | true | |
heartbeat_at | timestamp with time zone | |||
last_progress_at | timestamp with time zone | |||
last_failure_at | timestamp with time zone | |||
formed_count | bigint | not null | 0 | |
failed_attempts | bigint | not null | 0 |
Constraints
formation_health_failed_attempts_check:CHECK ((failed_attempts >= 0))formation_health_formed_count_check:CHECK ((formed_count >= 0))formation_health_singleton_check:CHECK (singleton)formation_health_failed_attempts_not_null:NOT NULL failed_attemptsformation_health_formed_count_not_null:NOT NULL formed_countformation_health_singleton_not_null:NOT NULL singletonformation_health_pkey:PRIMARY KEY (singleton)
Indexes
formation_health_pkey:CREATE UNIQUE INDEX formation_health_pkey ON memory.formation_health USING btree (singleton)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
ingestion_budget
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
singleton | boolean | not null | true | |
max_pending | bigint | not null | 4096 | |
max_pending_per_project | bigint | not null | 512 | |
pending | bigint | not null | 0 |
Constraints
ingestion_budget_check:CHECK (((max_pending_per_project >= 1) AND (max_pending_per_project <= max_pending)))ingestion_budget_max_pending_check:CHECK (((max_pending >= 1) AND (max_pending <= 1000000)))ingestion_budget_pending_check:CHECK ((pending >= 0))ingestion_budget_singleton_check:CHECK (singleton)ingestion_budget_max_pending_not_null:NOT NULL max_pendingingestion_budget_max_pending_per_project_not_null:NOT NULL max_pending_per_projectingestion_budget_pending_not_null:NOT NULL pendingingestion_budget_singleton_not_null:NOT NULL singletoningestion_budget_pkey:PRIMARY KEY (singleton)
Indexes
ingestion_budget_pkey:CREATE UNIQUE INDEX ingestion_budget_pkey ON memory.ingestion_budget USING btree (singleton)
Privileges
taisce_data:SELECT
ingestion_project_usage
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
pending | bigint | not null |
Constraints
ingestion_project_usage_pending_check:CHECK ((pending >= 0))ingestion_project_usage_pending_not_null:NOT NULL pendingingestion_project_usage_scope_not_null:NOT NULL scopeingestion_project_usage_pkey:PRIMARY KEY (scope)
Indexes
ingestion_project_usage_pkey:CREATE UNIQUE INDEX ingestion_project_usage_pkey ON memory.ingestion_project_usage USING btree (scope)
Privileges
taisce_data:SELECT
ingestion_reservation
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
observation_id | uuid | not null | ||
scope | text | not null |
Constraints
ingestion_reservation_scope_observation_id_fkey:FOREIGN KEY (scope, observation_id) REFERENCES memory.observation(scope, observation_id) ON DELETE CASCADEingestion_reservation_observation_id_not_null:NOT NULL observation_idingestion_reservation_scope_not_null:NOT NULL scopeingestion_reservation_pkey:PRIMARY KEY (observation_id)ingestion_reservation_release:TRIGGER DEFERRABLE INITIALLY DEFERRED
Indexes
ingestion_reservation_pkey:CREATE UNIQUE INDEX ingestion_reservation_pkey ON memory.ingestion_reservation USING btree (observation_id)
Triggers
ingestion_reservation_release:CREATE CONSTRAINT TRIGGER ingestion_reservation_release AFTER DELETE ON memory.ingestion_reservation DEFERRABLE INITIALLY DEFERRED FOR EACH ROW EXECUTE FUNCTION memory.release_ingestion_reservation()
Privileges
taisce_data:SELECT
memory_feedback
A report about a record that asserts nothing. Never read by recall: promoting it produces an ordinary correction or retraction, and that is what changes what the system believes.
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
feedback_id | uuid | not null | gen_random_uuid() | |
target_fact_id | uuid | not null | ||
note | text | not null | ||
proposed_object | text | |||
recorded_by | uuid | not null | ||
recorded_at | timestamp with time zone | not null | now() | |
promoted_by | uuid | |||
promoted_at | timestamp with time zone | |||
promotion_fact_id | uuid |
Constraints
feedback_note_chk:CHECK (((octet_length(note) >= 1) AND (octet_length(note) <= 16384)))feedback_object_chk:CHECK (((proposed_object IS NULL) OR ((octet_length(proposed_object) >= 1) AND (octet_length(proposed_object) <= 1024))))feedback_promotion_chk:CHECK ((num_nonnulls(promoted_by, promoted_at) = ANY (ARRAY[0, 2])))feedback_promotion_record_chk:CHECK (((promotion_fact_id IS NULL) OR (promoted_at IS NOT NULL)))feedback_target_fk:FOREIGN KEY (scope, target_fact_id) REFERENCES memory.fact(scope, fact_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDmemory_feedback_feedback_id_not_null:NOT NULL feedback_idmemory_feedback_note_not_null:NOT NULL notememory_feedback_recorded_at_not_null:NOT NULL recorded_atmemory_feedback_recorded_by_not_null:NOT NULL recorded_bymemory_feedback_scope_not_null:NOT NULL scopememory_feedback_target_fact_id_not_null:NOT NULL target_fact_idmemory_feedback_pkey:PRIMARY KEY (scope, feedback_id)
Indexes
memory_feedback_open_idx:CREATE INDEX memory_feedback_open_idx ON memory.memory_feedback USING btree (scope, recorded_at DESC, feedback_id DESC) WHERE (promoted_at IS NULL)memory_feedback_pkey:CREATE UNIQUE INDEX memory_feedback_pkey ON memory.memory_feedback USING btree (scope, feedback_id)memory_feedback_target_idx:CREATE INDEX memory_feedback_target_idx ON memory.memory_feedback USING btree (scope, target_fact_id, recorded_at DESC, feedback_id DESC)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- projection_dependency through
dependency_feedback_project_fk
message_embedding
owner postgres · partitioned by LIST (generation_id)
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
generation_id | uuid | not null | ||
chunk_id | uuid | not null | ||
source_observation_id | uuid | not null | ||
embedding_key | text | not null | ||
input_digest | bytea | not null | ||
embedding | vector | not null | ||
dimensions | integer | generated: vector_dims(embedding) | ||
registration_kind | text | generated: 'message_embedding'::text |
Constraints
message_embedding_check:CHECK ((embedding_key = (((generation_id)::text \|\| '/'::text) \|\| (chunk_id)::text)))message_embedding_embedding_check:CHECK ((vector_norm(embedding) > (0)::double precision))message_embedding_input_digest_check:CHECK ((octet_length(input_digest) = 32))message_embedding_scope_generation_id_dimensions_fkey:FOREIGN KEY (scope, generation_id, dimensions) REFERENCES memory.embedding_generation(scope, generation_id, dimensions)message_embedding_scope_source_observation_id_chunk_id_fkey:FOREIGN KEY (scope, source_observation_id, chunk_id) REFERENCES memory.chunk(scope, source_observation_id, chunk_id) DEFERRABLE INITIALLY DEFERREDmessage_embedding_scope_source_observation_id_chunk_id_fkey_1:FOREIGN KEY (scope, source_observation_id, chunk_id) REFERENCES memory.chunk_unpartitioned(scope, source_observation_id, chunk_id) DEFERRABLE INITIALLY DEFERREDmessage_embedding_scope_source_observation_id_chunk_id_fkey_2:FOREIGN KEY (scope, source_observation_id, chunk_id) REFERENCES memory.chunk_example(scope, source_observation_id, chunk_id) DEFERRABLE INITIALLY DEFERREDmessage_embedding_scope_source_observation_id_fkey:FOREIGN KEY (scope, source_observation_id) REFERENCES memory.observation(scope, observation_id) ON DELETE CASCADEmessage_embedding_source_observation_id_registration_kind__fkey:FOREIGN KEY (source_observation_id, registration_kind, embedding_key) REFERENCES memory.projection_dependency(source_observation_id, projection_kind, projection_id) DEFERRABLE INITIALLY DEFERREDmessage_embedding_chunk_id_not_null:NOT NULL chunk_idmessage_embedding_embedding_key_not_null:NOT NULL embedding_keymessage_embedding_embedding_not_null:NOT NULL embeddingmessage_embedding_generation_id_not_null:NOT NULL generation_idmessage_embedding_input_digest_not_null:NOT NULL input_digestmessage_embedding_scope_not_null:NOT NULL scopemessage_embedding_source_observation_id_not_null:NOT NULL source_observation_idmessage_embedding_pkey:PRIMARY KEY (scope, generation_id, chunk_id)message_embedding_scope_generation_id_source_observation_id_key:UNIQUE (scope, generation_id, source_observation_id, chunk_id)
Indexes
message_embedding_pkey:CREATE UNIQUE INDEX message_embedding_pkey ON ONLY memory.message_embedding USING btree (scope, generation_id, chunk_id)message_embedding_scope_generation_id_source_observation_id_key:CREATE UNIQUE INDEX message_embedding_scope_generation_id_source_observation_id_key ON ONLY memory.message_embedding USING btree (scope, generation_id, source_observation_id, chunk_id)message_embedding_source_idx:CREATE INDEX message_embedding_source_idx ON ONLY memory.message_embedding USING btree (scope, source_observation_id)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- projection_dependency through
dependency_message_embedding_fk
notification_delivery
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
delivery_id | uuid | not null | ||
scope | text | not null | ||
endpoint_id | uuid | not null | ||
formed_through | bigint | not null | ||
stored_through | bigint | not null | ||
formed_turns | integer | not null | 0 | |
parked_turns | integer | not null | 0 | |
attempts | integer | not null | 0 | |
next_attempt_at | timestamp with time zone | not null | now() | |
delivered_at | timestamp with time zone | |||
parked_at | timestamp with time zone | |||
last_status | integer | |||
last_error | text | |||
created_at | timestamp with time zone | not null | now() |
Constraints
notification_delivery_last_error_category_chk:CHECK (((last_error IS NULL) OR (last_error = ANY (ARRAY['destination not permitted'::text, 'address not permitted'::text, 'redirect not followed'::text, 'timeout'::text, 'connection refused'::text, 'tls failure'::text, 'network error'::text, 'unrecorded'::text])) OR (last_error ~ '^destination (answered\|refused with) [0-9]{3}$'::text)))notification_delivery_last_error_check:CHECK (((last_error IS NULL) OR (octet_length(last_error) <= 512)))notification_delivery_endpoint_id_fkey:FOREIGN KEY (endpoint_id) REFERENCES memory.notification_endpoint(endpoint_id) ON DELETE CASCADEnotification_delivery_attempts_not_null:NOT NULL attemptsnotification_delivery_created_at_not_null:NOT NULL created_atnotification_delivery_delivery_id_not_null:NOT NULL delivery_idnotification_delivery_endpoint_id_not_null:NOT NULL endpoint_idnotification_delivery_formed_through_not_null:NOT NULL formed_throughnotification_delivery_formed_turns_not_null:NOT NULL formed_turnsnotification_delivery_next_attempt_at_not_null:NOT NULL next_attempt_atnotification_delivery_parked_turns_not_null:NOT NULL parked_turnsnotification_delivery_scope_not_null:NOT NULL scopenotification_delivery_stored_through_not_null:NOT NULL stored_throughnotification_delivery_pkey:PRIMARY KEY (delivery_id)notification_delivery_endpoint_id_formed_through_key:UNIQUE (endpoint_id, formed_through)
Indexes
notification_delivery_due_idx:CREATE INDEX notification_delivery_due_idx ON memory.notification_delivery USING btree (next_attempt_at, delivery_id) WHERE ((delivered_at IS NULL) AND (parked_at IS NULL))notification_delivery_endpoint_id_formed_through_key:CREATE UNIQUE INDEX notification_delivery_endpoint_id_formed_through_key ON memory.notification_delivery USING btree (endpoint_id, formed_through)notification_delivery_pkey:CREATE UNIQUE INDEX notification_delivery_pkey ON memory.notification_delivery USING btree (delivery_id)notification_delivery_scope_idx:CREATE INDEX notification_delivery_scope_idx ON memory.notification_delivery USING btree (scope, created_at DESC)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
notification_endpoint
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
endpoint_id | uuid | not null | ||
scope | text | not null | ||
url | text | not null | ||
secret | bytea | not null | ||
created_at | timestamp with time zone | not null | now() | |
disabled_at | timestamp with time zone |
Constraints
notification_endpoint_secret_check:CHECK ((octet_length(secret) = 32))notification_endpoint_url_check:CHECK (((octet_length(url) >= 8) AND (octet_length(url) <= 2048)))notification_endpoint_scope_fkey:FOREIGN KEY (scope) REFERENCES memory.project(scope) ON DELETE CASCADEnotification_endpoint_created_at_not_null:NOT NULL created_atnotification_endpoint_endpoint_id_not_null:NOT NULL endpoint_idnotification_endpoint_scope_not_null:NOT NULL scopenotification_endpoint_secret_not_null:NOT NULL secretnotification_endpoint_url_not_null:NOT NULL urlnotification_endpoint_pkey:PRIMARY KEY (endpoint_id)notification_endpoint_scope_url_key:UNIQUE (scope, url)
Indexes
notification_endpoint_pkey:CREATE UNIQUE INDEX notification_endpoint_pkey ON memory.notification_endpoint USING btree (endpoint_id)notification_endpoint_scope_idx:CREATE INDEX notification_endpoint_scope_idx ON memory.notification_endpoint USING btree (scope) WHERE (disabled_at IS NULL)notification_endpoint_scope_url_key:CREATE UNIQUE INDEX notification_endpoint_scope_url_key ON memory.notification_endpoint USING btree (scope, url)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- notification_delivery through
notification_delivery_endpoint_id_fkey
observation
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
observation_id | uuid | not null | ||
scope | text | not null | ||
log_offset | bigint | not null | ||
kind | text | not null | ||
occurred_at | timestamp with time zone | not null | ||
ingested_at | timestamp with time zone | not null | now() | |
source_role | text | not null | ||
data_subject_id | text | |||
lawful_basis | text | |||
retention_until | timestamp with time zone | |||
formed_at | timestamp with time zone | When extraction ran over this turn's messages. NULL means the turn is stored and its facts do not exist yet. Set once, and never cleared: re-forming is a rebuild, which derives from the log rather than repairing rows in place. | ||
formation_attempts | integer | not null | 0 | |
formation_failed_at | timestamp with time zone | |||
formation_error | text | Why the last attempt failed, truncated. Kept on the observation rather than in a log because a provider error can contain the message that was sent to it: here it inherits the observation's governance and an erasure takes it, and in a log file it would be personal data no sweep can reach. | ||
parked_at | timestamp with time zone | When the driver stopped trying to form this turn. The observation and its messages are untouched, so re-forming it is a rebuild rather than a repair. A parked turn does not hold the formed watermark back, and the count of parked turns travels with freshness so that the exception to that number is visible rather than hidden. | ||
fact_revision | bigint | not null | 1 |
Constraints
observation_attempts_chk:CHECK ((formation_attempts >= 0))observation_error_length_chk:CHECK (((formation_error IS NULL) OR (length(formation_error) <= 2000)))observation_fact_revision_check:CHECK ((fact_revision >= 1))observation_parked_chk:CHECK (((parked_at IS NULL) OR (formation_attempts > 0)))observation_parked_not_formed_chk:CHECK (((parked_at IS NULL) OR (formed_at IS NULL)))observation_source_role_chk:CHECK ((source_role = ANY (ARRAY['user'::text, 'assistant'::text, 'system'::text, 'tool'::text, 'document'::text])))observation_fact_revision_not_null:NOT NULL fact_revisionobservation_formation_attempts_not_null:NOT NULL formation_attemptsobservation_ingested_at_not_null:NOT NULL ingested_atobservation_kind_not_null:NOT NULL kindobservation_log_offset_not_null:NOT NULL log_offsetobservation_observation_id_not_null:NOT NULL observation_idobservation_occurred_at_not_null:NOT NULL occurred_atobservation_scope_not_null:NOT NULL scopeobservation_source_role_not_null:NOT NULL source_roleobservation_pkey:PRIMARY KEY (observation_id)observation_ingestion_reservation:TRIGGER DEFERRABLE INITIALLY DEFERREDobservation_fact_revision_uniq:UNIQUE (scope, observation_id, fact_revision)observation_scope_id_uniq:UNIQUE (scope, observation_id)observation_scope_offset_uniq:UNIQUE (scope, log_offset)
Indexes
observation_backlog_idx:CREATE INDEX observation_backlog_idx ON memory.observation USING btree (scope, log_offset) WHERE ((formed_at IS NULL) AND (parked_at IS NULL))observation_fact_revision_uniq:CREATE UNIQUE INDEX observation_fact_revision_uniq ON memory.observation USING btree (scope, observation_id, fact_revision)observation_parked_idx:CREATE INDEX observation_parked_idx ON memory.observation USING btree (scope, log_offset) WHERE (parked_at IS NOT NULL)observation_pending_age_idx:CREATE INDEX observation_pending_age_idx ON memory.observation USING btree (ingested_at) WHERE ((kind = 'turn'::text) AND (formed_at IS NULL))observation_pkey:CREATE UNIQUE INDEX observation_pkey ON memory.observation USING btree (observation_id)observation_scope_expiry_idx:CREATE INDEX observation_scope_expiry_idx ON memory.observation USING btree (scope, retention_until, log_offset) WHERE (retention_until IS NOT NULL)observation_scope_id_uniq:CREATE UNIQUE INDEX observation_scope_id_uniq ON memory.observation USING btree (scope, observation_id)observation_scope_offset_uniq:CREATE UNIQUE INDEX observation_scope_offset_uniq ON memory.observation USING btree (scope, log_offset)observation_subject_idx:CREATE INDEX observation_subject_idx ON memory.observation USING btree (scope, data_subject_id) WHERE (data_subject_id IS NOT NULL)
Triggers
observation_artifact_source:CREATE TRIGGER observation_artifact_source BEFORE UPDATE ON memory.observation FOR EACH ROW EXECUTE FUNCTION memory.protect_artifact_source()observation_ingestion_reservation:CREATE CONSTRAINT TRIGGER observation_ingestion_reservation AFTER INSERT OR UPDATE OF formed_at, scope, kind ON memory.observation DEFERRABLE INITIALLY DEFERRED FOR EACH ROW EXECUTE FUNCTION memory.sync_ingestion_reservation()observation_registered_subject:CREATE TRIGGER observation_registered_subject BEFORE INSERT OR UPDATE OF scope, data_subject_id ON memory.observation FOR EACH ROW EXECUTE FUNCTION memory.lock_registered_subject()observation_retry_forgets_payload:CREATE TRIGGER observation_retry_forgets_payload BEFORE DELETE ON memory.observation FOR EACH ROW EXECUTE FUNCTION memory.clear_observation_retry_payload()
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- agent_artifact through
agent_artifact_scope_source_observation_id_fkey - chunk through
chunk_source_project_fk - curated_claim through
curated_claim_scope_source_observation_id_fkey - entity_embedding_source through
entity_embedding_source_scope_source_observation_id_fkey - entity_name_receipt through
entity_name_receipt_scope_source_observation_id_fkey - fact through
fact_supersession_source_fk - fact_evidence through
evidence_source_project_fk - fact_generation through
fact_generation_scope_source_observation_id_fkey - fact_history through
fact_history_scope_source_observation_id_fkey - fact_receipt through
fact_receipt_scope_source_observation_id_fkey - fact_receipt through
fact_receipt_scope_supersession_source_fkey - fact_receipt_history through
fact_receipt_history_scope_source_observation_id_fkey - ingestion_reservation through
ingestion_reservation_scope_observation_id_fkey - message_embedding through
message_embedding_scope_source_observation_id_fkey - observation_retry through
observation_retry_scope_observation_id_fkey - projection_dependency through
dependency_report_revision_fk - projection_dependency through
dependency_source_project_fk - record_retraction through
record_retraction_scope_source_observation_id_fkey - rejected_claim through
rejected_source_project_fk - report_embedding_source through
report_embedding_source_scope_source_observation_id_fkey - source_extraction through
source_extraction_scope_source_observation_id_fkey - turn_message through
turn_message_observation_id_fkey
observation_retry
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
key_digest | bytea | not null | ||
request_digest | bytea | |||
observation_id | uuid |
Constraints
observation_retry_check:CHECK (((observation_id IS NULL) = (request_digest IS NULL)))observation_retry_key_digest_check:CHECK ((octet_length(key_digest) = 32))observation_retry_request_digest_check:CHECK ((octet_length(request_digest) = 32))observation_retry_scope_observation_id_fkey:FOREIGN KEY (scope, observation_id) REFERENCES memory.observation(scope, observation_id)observation_retry_key_digest_not_null:NOT NULL key_digestobservation_retry_scope_not_null:NOT NULL scopeobservation_retry_pkey:PRIMARY KEY (scope, key_digest)
Indexes
observation_retry_pkey:CREATE UNIQUE INDEX observation_retry_pkey ON memory.observation_retry USING btree (scope, key_digest)observation_retry_source_idx:CREATE INDEX observation_retry_source_idx ON memory.observation_retry USING btree (observation_id) WHERE (observation_id IS NOT NULL)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
predicate
The closed relation vocabulary. fact.predicate references it, so an unknown relation cannot be stored by any path. A claim outside this set is recorded as unmapped and never admitted as an edge — the message it came from is already stored, so what is refused is the typed edge, not the memory.
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
predicate | text | not null | ||
semantic_type | text | not null | ||
cardinality | text | not null | ||
object_kind | text | not null | ||
description | text | not null | ||
event | boolean | not null | false | True for a relation that reports a completed occurrence and stays true afterwards, so its past tense is admitted. False for a state, whose past tense means it ended and is refused as not current. |
Constraints
predicate_cardinality_chk:CHECK ((cardinality = ANY (ARRAY['one'::text, 'many'::text])))predicate_name_chk:CHECK ((predicate ~ '^[a-z][a-z_]*[a-z]$'::text))predicate_object_kind_chk:CHECK ((object_kind = ANY (ARRAY['person'::text, 'organisation'::text, 'place'::text, 'time'::text, 'value'::text, 'thing'::text])))predicate_semantic_type_chk:CHECK ((semantic_type = ANY (ARRAY['identity'::text, 'preference'::text, 'capability'::text, 'intent'::text, 'social'::text, 'possession'::text, 'structure'::text, 'authorship'::text, 'temporal'::text, 'state'::text, 'constraint'::text])))predicate_cardinality_not_null:NOT NULL cardinalitypredicate_description_not_null:NOT NULL descriptionpredicate_event_not_null:NOT NULL eventpredicate_object_kind_not_null:NOT NULL object_kindpredicate_predicate_not_null:NOT NULL predicatepredicate_semantic_type_not_null:NOT NULL semantic_typepredicate_pkey:PRIMARY KEY (predicate)predicate_cardinality_uniq:UNIQUE (predicate, cardinality)
Indexes
predicate_cardinality_uniq:CREATE UNIQUE INDEX predicate_cardinality_uniq ON memory.predicate USING btree (predicate, cardinality)predicate_pkey:CREATE UNIQUE INDEX predicate_pkey ON memory.predicate USING btree (predicate)
Privileges
taisce_data:SELECT
Referenced by
project
A project: where data belongs, what a token is attached to, which kinds of memory it keeps and how long it keeps them. Before this, a project was a string appearing on rows — which meant a project nobody had written to did not exist, and there was nowhere for a setting to live.
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
label | text | not null | ||
surfaces | text[] | not null | '{}'::text[] | Chosen at creation, added to afterwards, never removed — enforced by a trigger. Turning a surface off would either strand the data it stored or destroy it from a settings change; stopping one is an erasure and produces a receipt like any other. |
retention | interval | |||
created_at | timestamp with time zone | not null | now() | |
suspended_at | timestamp with time zone |
Constraints
project_label_chk:CHECK ((length(label) > 0))project_retention_chk:CHECK (((retention IS NULL) OR (retention > '00:00:00'::interval)))project_scope_chk:CHECK ((scope ~ '^[a-z][a-z0-9_]{0,62}$'::text))project_created_at_not_null:NOT NULL created_atproject_label_not_null:NOT NULL labelproject_scope_not_null:NOT NULL scopeproject_surfaces_not_null:NOT NULL surfacesproject_pkey:PRIMARY KEY (scope)
Indexes
project_pkey:CREATE UNIQUE INDEX project_pkey ON memory.project USING btree (scope)
Triggers
project_agent_storage_policy:CREATE TRIGGER project_agent_storage_policy AFTER INSERT ON memory.project FOR EACH ROW EXECUTE FUNCTION memory.initialize_agent_storage_policy()project_surfaces_only_grow:CREATE TRIGGER project_surfaces_only_grow BEFORE UPDATE ON memory.project FOR EACH ROW EXECUTE FUNCTION memory.project_surfaces_only_grow()
Privileges
taisce_data:SELECT
Referenced by
- agent_storage_policy through
agent_storage_policy_scope_fkey - data_subject through
data_subject_scope_fkey - embedding_active through
embedding_active_scope_fkey - embedding_generation through
embedding_generation_scope_fkey - entity_embedding_active through
entity_embedding_active_scope_fkey - entity_embedding_generation through
entity_embedding_generation_scope_fkey - notification_endpoint through
notification_endpoint_scope_fkey - report_embedding_active through
report_embedding_active_scope_fkey - report_embedding_generation through
report_embedding_generation_scope_fkey - subject_retry through
subject_retry_scope_fkey
projection_dependency
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
source_observation_id | uuid | not null | ||
scope | text | not null | ||
projection_kind | text | not null | ||
projection_id | text | not null | ||
data_subject_id | text | |||
retention_until | timestamp with time zone | |||
pipeline_version | text | not null | 'v1'::text | |
registered_at | timestamp with time zone | not null | now() | |
entity_ref | uuid | generated: CASE WHEN (projection_kind = 'entity'::text) THEN (projection_id)::uuid ELSE NULL::uuid END | ||
fact_ref | uuid | generated: CASE WHEN (projection_kind = 'fact'::text) THEN (projection_id)::uuid ELSE NULL::uuid END | ||
chunk_ref | uuid | generated: CASE WHEN (projection_kind = 'chunk'::text) THEN (projection_id)::uuid ELSE NULL::uuid END | ||
rejected_ref | uuid | generated: CASE WHEN (projection_kind = 'rejected_claim'::text) THEN (projection_id)::uuid ELSE NULL::uuid END | ||
report_ref | uuid | generated: CASE WHEN (projection_kind = 'community_report'::text) THEN (projection_id)::uuid ELSE NULL::uuid END | ||
history_ref | uuid | generated: CASE WHEN (projection_kind = 'fact_history'::text) THEN (projection_id)::uuid ELSE NULL::uuid END | ||
report_source_revision | bigint | |||
artifact_ref | uuid | generated: CASE WHEN (projection_kind = 'agent_artifact'::text) THEN (projection_id)::uuid ELSE NULL::uuid END | ||
embedding_generation_ref | uuid | generated: CASE WHEN (projection_kind = 'message_embedding'::text) THEN (split_part(projection_id, '/'::text, 1))::uuid ELSE NULL::uuid END | ||
embedding_chunk_ref | uuid | generated: CASE WHEN (projection_kind = 'message_embedding'::text) THEN (split_part(projection_id, '/'::text, 2))::uuid ELSE NULL::uuid END | ||
entity_embedding_generation_ref | uuid | generated: CASE WHEN (projection_kind = 'entity_embedding'::text) THEN (split_part(projection_id, '/'::text, 1))::uuid ELSE NULL::uuid END | ||
entity_embedding_entity_ref | uuid | generated: CASE WHEN (projection_kind = 'entity_embedding'::text) THEN (split_part(projection_id, '/'::text, 2))::uuid ELSE NULL::uuid END | ||
report_embedding_generation_ref | uuid | generated: CASE WHEN (projection_kind = 'report_embedding'::text) THEN (split_part(projection_id, '/'::text, 1))::uuid ELSE NULL::uuid END | ||
report_embedding_report_ref | uuid | generated: CASE WHEN (projection_kind = 'report_embedding'::text) THEN (split_part(projection_id, '/'::text, 2))::uuid ELSE NULL::uuid END | ||
segment_ref | uuid | generated: CASE WHEN (projection_kind = 'segment'::text) THEN (projection_id)::uuid ELSE NULL::uuid END | ||
feedback_ref | uuid | generated: CASE WHEN (projection_kind = 'feedback'::text) THEN (projection_id)::uuid ELSE NULL::uuid END |
Constraints
artifact_dependency_owner_chk:CHECK (((artifact_ref IS NULL) OR (data_subject_id IS NOT NULL)))dependency_one_target_chk:CHECK ((num_nonnulls(entity_ref, fact_ref, chunk_ref, rejected_ref, report_ref, history_ref, artifact_ref, embedding_generation_ref, entity_embedding_generation_ref, report_embedding_generation_ref, segment_ref, feedback_ref) = 1))dependency_report_revision_chk:CHECK ((((projection_kind = 'community_report'::text) AND (report_source_revision IS NOT NULL) AND (report_source_revision > 0)) OR ((projection_kind <> 'community_report'::text) AND (report_source_revision IS NULL))))dependency_artifact_owner_fk:FOREIGN KEY (scope, source_observation_id, artifact_ref, data_subject_id) REFERENCES memory.agent_artifact(scope, source_observation_id, artifact_id, data_subject_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDdependency_chunk_project_fk:FOREIGN KEY (scope, chunk_ref) REFERENCES memory.chunk(scope, chunk_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDdependency_chunk_project_fk_1:FOREIGN KEY (scope, chunk_ref) REFERENCES memory.chunk_unpartitioned(scope, chunk_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDdependency_chunk_project_fk_2:FOREIGN KEY (scope, chunk_ref) REFERENCES memory.chunk_example(scope, chunk_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDdependency_entity_embedding_source_fk:FOREIGN KEY (scope, entity_embedding_generation_ref, entity_embedding_entity_ref, source_observation_id) REFERENCES memory.entity_embedding_source(scope, generation_id, entity_id, source_observation_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDdependency_entity_project_fk:FOREIGN KEY (scope, entity_ref) REFERENCES memory.entity(scope, entity_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDdependency_fact_project_fk:FOREIGN KEY (scope, fact_ref) REFERENCES memory.fact(scope, fact_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDdependency_feedback_project_fk:FOREIGN KEY (scope, feedback_ref) REFERENCES memory.memory_feedback(scope, feedback_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDdependency_history_project_fk:FOREIGN KEY (scope, history_ref) REFERENCES memory.fact_history(scope, history_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDdependency_message_embedding_fk:FOREIGN KEY (scope, embedding_generation_ref, source_observation_id, embedding_chunk_ref) REFERENCES memory.message_embedding(scope, generation_id, source_observation_id, chunk_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDdependency_rejected_project_fk:FOREIGN KEY (scope, rejected_ref) REFERENCES memory.rejected_claim(scope, rejected_claim_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDdependency_report_embedding_source_fk:FOREIGN KEY (scope, report_embedding_generation_ref, report_embedding_report_ref, source_observation_id) REFERENCES memory.report_embedding_source(scope, generation_id, report_id, source_observation_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDdependency_report_project_fk:FOREIGN KEY (scope, report_ref) REFERENCES memory.community_report(scope, report_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDdependency_report_revision_fk:FOREIGN KEY (scope, source_observation_id, report_source_revision) REFERENCES memory.observation(scope, observation_id, fact_revision) DEFERRABLE INITIALLY DEFERREDdependency_segment_fk:FOREIGN KEY (scope, segment_ref) REFERENCES memory.segment(scope, segment_id) ON DELETE CASCADEdependency_source_project_fk:FOREIGN KEY (scope, source_observation_id) REFERENCES memory.observation(scope, observation_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDprojection_dependency_kind_fk:FOREIGN KEY (projection_kind) REFERENCES memory.projection_kind(kind)projection_dependency_pipeline_version_not_null:NOT NULL pipeline_versionprojection_dependency_projection_id_not_null:NOT NULL projection_idprojection_dependency_projection_kind_not_null:NOT NULL projection_kindprojection_dependency_registered_at_not_null:NOT NULL registered_atprojection_dependency_scope_not_null:NOT NULL scopeprojection_dependency_source_observation_id_not_null:NOT NULL source_observation_idprojection_dependency_pkey:PRIMARY KEY (source_observation_id, projection_kind, projection_id)
Indexes
dependency_artifact_ref_idx:CREATE INDEX dependency_artifact_ref_idx ON memory.projection_dependency USING btree (scope, artifact_ref) WHERE (artifact_ref IS NOT NULL)dependency_chunk_ref_idx:CREATE INDEX dependency_chunk_ref_idx ON memory.projection_dependency USING btree (scope, chunk_ref) WHERE (chunk_ref IS NOT NULL)dependency_embedding_ref_idx:CREATE INDEX dependency_embedding_ref_idx ON memory.projection_dependency USING btree (scope, embedding_generation_ref, embedding_chunk_ref) WHERE (embedding_generation_ref IS NOT NULL)dependency_entity_embedding_ref_idx:CREATE INDEX dependency_entity_embedding_ref_idx ON memory.projection_dependency USING btree (scope, entity_embedding_generation_ref, entity_embedding_entity_ref) WHERE (entity_embedding_generation_ref IS NOT NULL)dependency_entity_ref_idx:CREATE INDEX dependency_entity_ref_idx ON memory.projection_dependency USING btree (scope, entity_ref) WHERE (entity_ref IS NOT NULL)dependency_fact_ref_idx:CREATE INDEX dependency_fact_ref_idx ON memory.projection_dependency USING btree (scope, fact_ref) WHERE (fact_ref IS NOT NULL)dependency_feedback_ref_idx:CREATE INDEX dependency_feedback_ref_idx ON memory.projection_dependency USING btree (scope, feedback_ref) WHERE (feedback_ref IS NOT NULL)dependency_history_ref_idx:CREATE INDEX dependency_history_ref_idx ON memory.projection_dependency USING btree (scope, history_ref) WHERE (history_ref IS NOT NULL)dependency_rejected_ref_idx:CREATE INDEX dependency_rejected_ref_idx ON memory.projection_dependency USING btree (scope, rejected_ref) WHERE (rejected_ref IS NOT NULL)dependency_report_embedding_ref_idx:CREATE INDEX dependency_report_embedding_ref_idx ON memory.projection_dependency USING btree (scope, report_embedding_generation_ref, report_embedding_report_ref) WHERE (report_embedding_generation_ref IS NOT NULL)dependency_report_ref_idx:CREATE INDEX dependency_report_ref_idx ON memory.projection_dependency USING btree (scope, report_ref) WHERE (report_ref IS NOT NULL)dependency_segment_ref_idx:CREATE INDEX dependency_segment_ref_idx ON memory.projection_dependency USING btree (scope, segment_ref) WHERE (segment_ref IS NOT NULL)dependency_subject_fact_page_idx:CREATE INDEX dependency_subject_fact_page_idx ON memory.projection_dependency USING btree (scope, data_subject_id, fact_ref) WHERE (projection_kind = 'fact'::text)projection_dependency_kind_idx:CREATE INDEX projection_dependency_kind_idx ON memory.projection_dependency USING btree (scope, projection_kind, projection_id)projection_dependency_pkey:CREATE UNIQUE INDEX projection_dependency_pkey ON memory.projection_dependency USING btree (source_observation_id, projection_kind, projection_id)projection_dependency_subject_idx:CREATE INDEX projection_dependency_subject_idx ON memory.projection_dependency USING btree (scope, data_subject_id) WHERE (data_subject_id IS NOT NULL)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- agent_artifact through
agent_artifact_source_observation_id_registration_kind_reg_fkey - entity_embedding_source through
entity_embedding_source_source_observation_id_registration_fkey - message_embedding through
message_embedding_source_observation_id_registration_kind__fkey - report_embedding_source through
report_embedding_source_source_observation_id_registration_fkey
projection_kind
Every kind of derived row, and the table it lives in. projection_dependency references it, so a projection kind that is not declared here cannot be registered — which is what makes erasure's residual count cover everything rather than everything somebody remembered.
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
kind | text | not null | ||
projection_table | text | not null | ||
id_column | text | not null | ||
description | text | not null | ||
survives_sharing | boolean | not null | false | Whether a projection of this kind is KEPT when another data subject also registered it. True for a shared identity, whose row means the same thing to everybody who registered it. False for anything holding text drawn from several people, where keeping it because somebody else also contributed leaves the departing subject's words in a row the erasure counted as retained. Defaults to false: a kind added by somebody who did not read this deletes too much rather than leaking, because over-deletion is visible to the person who lost data and a leak is visible to nobody. |
Constraints
projection_kind_column_chk:CHECK ((id_column ~ '^[a-z][a-z0-9_]*$'::text))projection_kind_name_chk:CHECK ((kind ~ '^[a-z][a-z0-9_]*$'::text))projection_kind_table_chk:CHECK ((projection_table ~ '^[a-z][a-z0-9_]*$'::text))projection_kind_description_not_null:NOT NULL descriptionprojection_kind_id_column_not_null:NOT NULL id_columnprojection_kind_kind_not_null:NOT NULL kindprojection_kind_projection_table_not_null:NOT NULL projection_tableprojection_kind_survives_sharing_not_null:NOT NULL survives_sharingprojection_kind_pkey:PRIMARY KEY (kind)
Indexes
projection_kind_pkey:CREATE UNIQUE INDEX projection_kind_pkey ON memory.projection_kind USING btree (kind)
Privileges
taisce_data:SELECT
Referenced by
- projection_dependency through
projection_dependency_kind_fk
record_retraction
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
target_fact_id | uuid | not null | ||
source_observation_id | uuid | not null | ||
source_ordinal | integer | not null | ||
claim_signature | bytea | not null | ||
operation_id | uuid | not null | ||
target_version | uuid | not null | ||
principal_id | uuid | not null | ||
retracted_at | timestamp with time zone | not null | ||
replacement_observation_id | uuid | |||
replacement_fact_id | uuid |
Constraints
record_retraction_claim_signature_check:CHECK ((octet_length(claim_signature) = 32))record_retraction_source_ordinal_check:CHECK ((source_ordinal >= 0))retraction_replacement_pair:CHECK (((replacement_observation_id IS NULL) = (replacement_fact_id IS NULL)))record_retraction_scope_source_observation_id_fkey:FOREIGN KEY (scope, source_observation_id) REFERENCES memory.observation(scope, observation_id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDrecord_retraction_source_observation_id_source_ordinal_fkey:FOREIGN KEY (source_observation_id, source_ordinal) REFERENCES memory.turn_message(observation_id, ordinal) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERREDretraction_replacement_source:FOREIGN KEY (scope, replacement_observation_id) REFERENCES memory.curated_claim(scope, source_observation_id) ON DELETE SET NULL (replacement_observation_id) DEFERRABLE INITIALLY DEFERREDrecord_retraction_claim_signature_not_null:NOT NULL claim_signaturerecord_retraction_operation_id_not_null:NOT NULL operation_idrecord_retraction_principal_id_not_null:NOT NULL principal_idrecord_retraction_retracted_at_not_null:NOT NULL retracted_atrecord_retraction_scope_not_null:NOT NULL scoperecord_retraction_source_observation_id_not_null:NOT NULL source_observation_idrecord_retraction_source_ordinal_not_null:NOT NULL source_ordinalrecord_retraction_target_fact_id_not_null:NOT NULL target_fact_idrecord_retraction_target_version_not_null:NOT NULL target_versionrecord_retraction_pkey:PRIMARY KEY (scope, target_fact_id, source_observation_id, source_ordinal)
Indexes
record_retraction_pkey:CREATE UNIQUE INDEX record_retraction_pkey ON memory.record_retraction USING btree (scope, target_fact_id, source_observation_id, source_ordinal)retraction_source_claim_idx:CREATE INDEX retraction_source_claim_idx ON memory.record_retraction USING btree (scope, source_observation_id, source_ordinal, claim_signature)
Triggers
retraction_replacement_deletion:CREATE TRIGGER retraction_replacement_deletion BEFORE UPDATE OF replacement_observation_id ON memory.record_retraction FOR EACH ROW EXECUTE FUNCTION memory.clear_replacement_identifier()
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
rejected_claim
Proposals that did not become facts, with the model's own wording. A relation outside the vocabulary and a quote that is not in the message are both ordinary outcomes, so neither is an error — but a rate that cannot be read is a claim that cannot be checked. Registers for erasure: a refused claim still carries somebody's words.
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
rejected_claim_id | uuid | not null | ||
scope | text | not null | ||
source_observation_id | uuid | not null | ||
source_ordinal | integer | not null | ||
predicate | text | not null | ||
statement | text | not null | ||
quote | text | not null | ||
reason | text | not null | ||
extractor_version | text | not null | ||
data_subject_id | text | |||
recorded_at | timestamp with time zone | not null | now() |
Constraints
rejected_claim_ordinal_chk:CHECK ((source_ordinal >= 0))rejected_claim_reason_chk:CHECK ((reason = ANY (ARRAY['unmapped_relation'::text, 'unlocatable_quote'::text, 'duplicate_claim'::text, 'not_asserted'::text, 'unresolvable_subject'::text, 'not_current'::text, 'conflicting_value'::text, 'not_spoken_by_principal'::text, 'entity_name_limit'::text])))rejected_source_message_fk:FOREIGN KEY (source_observation_id, source_ordinal) REFERENCES memory.turn_message(observation_id, ordinal) DEFERRABLE INITIALLY DEFERREDrejected_source_project_fk:FOREIGN KEY (scope, source_observation_id) REFERENCES memory.observation(scope, observation_id) DEFERRABLE INITIALLY DEFERREDrejected_claim_extractor_version_not_null:NOT NULL extractor_versionrejected_claim_predicate_not_null:NOT NULL predicaterejected_claim_quote_not_null:NOT NULL quoterejected_claim_reason_not_null:NOT NULL reasonrejected_claim_recorded_at_not_null:NOT NULL recorded_atrejected_claim_rejected_claim_id_not_null:NOT NULL rejected_claim_idrejected_claim_scope_not_null:NOT NULL scoperejected_claim_source_observation_id_not_null:NOT NULL source_observation_idrejected_claim_source_ordinal_not_null:NOT NULL source_ordinalrejected_claim_statement_not_null:NOT NULL statementrejected_claim_pkey:PRIMARY KEY (rejected_claim_id)rejected_scope_id_uniq:UNIQUE (scope, rejected_claim_id)
Indexes
rejected_claim_pkey:CREATE UNIQUE INDEX rejected_claim_pkey ON memory.rejected_claim USING btree (rejected_claim_id)rejected_claim_subject_idx:CREATE INDEX rejected_claim_subject_idx ON memory.rejected_claim USING btree (scope, data_subject_id) WHERE (data_subject_id IS NOT NULL)rejected_scope_id_uniq:CREATE UNIQUE INDEX rejected_scope_id_uniq ON memory.rejected_claim USING btree (scope, rejected_claim_id)rejected_source_message_idx:CREATE INDEX rejected_source_message_idx ON memory.rejected_claim USING btree (source_observation_id, source_ordinal)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- projection_dependency through
dependency_rejected_project_fk
report_embedding
owner postgres · partitioned by LIST (generation_id)
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
generation_id | uuid | not null | ||
report_id | uuid | not null | ||
embedding_key | text | generated: (((generation_id)::text || '/'::text) || (report_id)::text) | ||
input_digest | bytea | not null | ||
source_digest | bytea | not null | ||
source_count | integer | not null | ||
embedding | vector | not null | ||
dimensions | integer | generated: vector_dims(embedding) |
Constraints
report_embedding_embedding_check:CHECK ((vector_norm(embedding) > (0)::double precision))report_embedding_input_digest_check:CHECK ((octet_length(input_digest) = 32))report_embedding_source_count_check:CHECK (((source_count >= 1) AND (source_count <= 4096)))report_embedding_source_digest_check:CHECK ((octet_length(source_digest) = 32))report_embedding_scope_generation_id_dimensions_fkey:FOREIGN KEY (scope, generation_id, dimensions) REFERENCES memory.report_embedding_generation(scope, generation_id, dimensions)report_embedding_scope_generation_id_report_id_fkey:FOREIGN KEY (scope, generation_id, report_id) REFERENCES memory.report_embedding_target(scope, generation_id, report_id) ON DELETE CASCADEreport_embedding_embedding_not_null:NOT NULL embeddingreport_embedding_generation_id_not_null:NOT NULL generation_idreport_embedding_input_digest_not_null:NOT NULL input_digestreport_embedding_report_id_not_null:NOT NULL report_idreport_embedding_scope_not_null:NOT NULL scopereport_embedding_source_count_not_null:NOT NULL source_countreport_embedding_source_digest_not_null:NOT NULL source_digestreport_embedding_pkey:PRIMARY KEY (scope, generation_id, report_id)report_embedding_scope_generation_id_embedding_key_key:UNIQUE (scope, generation_id, embedding_key)
Indexes
report_embedding_pkey:CREATE UNIQUE INDEX report_embedding_pkey ON ONLY memory.report_embedding USING btree (scope, generation_id, report_id)report_embedding_scope_generation_id_embedding_key_key:CREATE UNIQUE INDEX report_embedding_scope_generation_id_embedding_key_key ON ONLY memory.report_embedding USING btree (scope, generation_id, embedding_key)
Triggers
report_embedding_removed:CREATE TRIGGER report_embedding_removed AFTER DELETE ON memory.report_embedding FOR EACH ROW EXECUTE FUNCTION memory.mark_report_embedding_incomplete()
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- report_embedding_source through
report_embedding_source_scope_generation_id_report_id_fkey
report_embedding_active
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
generation_id | uuid | not null | ||
activated_at | timestamp with time zone | not null | clock_timestamp() |
Constraints
report_embedding_active_scope_fkey:FOREIGN KEY (scope) REFERENCES memory.project(scope) ON DELETE CASCADEreport_embedding_active_scope_generation_id_fkey:FOREIGN KEY (scope, generation_id) REFERENCES memory.report_embedding_generation(scope, generation_id)report_embedding_active_activated_at_not_null:NOT NULL activated_atreport_embedding_active_generation_id_not_null:NOT NULL generation_idreport_embedding_active_scope_not_null:NOT NULL scopereport_embedding_active_pkey:PRIMARY KEY (scope)
Indexes
report_embedding_active_pkey:CREATE UNIQUE INDEX report_embedding_active_pkey ON memory.report_embedding_active USING btree (scope)
Privileges
taisce_data:SELECT
report_embedding_build
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
generation_id | uuid | not null | ||
state | text | not null | 'building'::text | |
after_report_id | uuid | |||
examined | bigint | not null | 0 | |
stored | bigint | not null | 0 | |
lease_id | uuid | |||
updated_at | timestamp with time zone | not null | clock_timestamp() |
Constraints
report_embedding_build_examined_check:CHECK ((examined >= 0))report_embedding_build_state_check:CHECK ((state = ANY (ARRAY['building'::text, 'ready'::text, 'stale'::text, 'cancelled'::text, 'discarded'::text])))report_embedding_build_stored_check:CHECK ((stored >= 0))report_embedding_build_scope_generation_id_fkey:FOREIGN KEY (scope, generation_id) REFERENCES memory.report_embedding_generation(scope, generation_id) ON DELETE CASCADEreport_embedding_build_examined_not_null:NOT NULL examinedreport_embedding_build_generation_id_not_null:NOT NULL generation_idreport_embedding_build_scope_not_null:NOT NULL scopereport_embedding_build_state_not_null:NOT NULL statereport_embedding_build_stored_not_null:NOT NULL storedreport_embedding_build_updated_at_not_null:NOT NULL updated_atreport_embedding_build_pkey:PRIMARY KEY (scope, generation_id)
Indexes
report_embedding_build_pkey:CREATE UNIQUE INDEX report_embedding_build_pkey ON memory.report_embedding_build USING btree (scope, generation_id)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
report_embedding_generation
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
generation_id | uuid | not null | ||
scope | text | not null | ||
operation_key | uuid | not null | ||
model_name | text | not null | ||
model_revision | text | not null | ||
endpoint_hash | text | not null | ||
identity_hash | text | not null | ||
dimensions | integer | not null | ||
metric | text | not null | 'cosine'::text | |
input_version | text | not null | 'community-report/v1'::text | |
target_count | bigint | not null | 0 | |
created_at | timestamp with time zone | not null | clock_timestamp() |
Constraints
report_embedding_generation_dimensions_check:CHECK (((dimensions >= 1) AND (dimensions <= 4000)))report_embedding_generation_endpoint_hash_check:CHECK ((endpoint_hash ~ '^[0-9a-f]{64}$'::text))report_embedding_generation_identity_hash_check:CHECK ((identity_hash ~ '^[0-9a-f]{64}$'::text))report_embedding_generation_input_version_check:CHECK ((input_version = 'community-report/v1'::text))report_embedding_generation_metric_check:CHECK ((metric = 'cosine'::text))report_embedding_generation_model_name_check:CHECK (((octet_length(model_name) >= 1) AND (octet_length(model_name) <= 256)))report_embedding_generation_model_revision_check:CHECK (((octet_length(model_revision) >= 1) AND (octet_length(model_revision) <= 128)))report_embedding_generation_target_count_check:CHECK ((target_count >= 0))report_embedding_generation_scope_fkey:FOREIGN KEY (scope) REFERENCES memory.project(scope) ON DELETE CASCADEreport_embedding_generation_created_at_not_null:NOT NULL created_atreport_embedding_generation_dimensions_not_null:NOT NULL dimensionsreport_embedding_generation_endpoint_hash_not_null:NOT NULL endpoint_hashreport_embedding_generation_generation_id_not_null:NOT NULL generation_idreport_embedding_generation_identity_hash_not_null:NOT NULL identity_hashreport_embedding_generation_input_version_not_null:NOT NULL input_versionreport_embedding_generation_metric_not_null:NOT NULL metricreport_embedding_generation_model_name_not_null:NOT NULL model_namereport_embedding_generation_model_revision_not_null:NOT NULL model_revisionreport_embedding_generation_operation_key_not_null:NOT NULL operation_keyreport_embedding_generation_scope_not_null:NOT NULL scopereport_embedding_generation_target_count_not_null:NOT NULL target_countreport_embedding_generation_pkey:PRIMARY KEY (generation_id)report_embedding_generation_scope_generation_id_dimensions_key:UNIQUE (scope, generation_id, dimensions)report_embedding_generation_scope_generation_id_key:UNIQUE (scope, generation_id)report_embedding_generation_scope_operation_key_key:UNIQUE (scope, operation_key)
Indexes
report_embedding_generation_pkey:CREATE UNIQUE INDEX report_embedding_generation_pkey ON memory.report_embedding_generation USING btree (generation_id)report_embedding_generation_scope_generation_id_dimensions_key:CREATE UNIQUE INDEX report_embedding_generation_scope_generation_id_dimensions_key ON memory.report_embedding_generation USING btree (scope, generation_id, dimensions)report_embedding_generation_scope_generation_id_key:CREATE UNIQUE INDEX report_embedding_generation_scope_generation_id_key ON memory.report_embedding_generation USING btree (scope, generation_id)report_embedding_generation_scope_operation_key_key:CREATE UNIQUE INDEX report_embedding_generation_scope_operation_key_key ON memory.report_embedding_generation USING btree (scope, operation_key)
Triggers
report_embedding_identity_immutable:CREATE TRIGGER report_embedding_identity_immutable BEFORE UPDATE ON memory.report_embedding_generation FOR EACH ROW EXECUTE FUNCTION memory.immutable_report_embedding_identity()
Privileges
taisce_data:SELECT
Referenced by
- report_embedding through
report_embedding_scope_generation_id_dimensions_fkey - report_embedding_active through
report_embedding_active_scope_generation_id_fkey - report_embedding_build through
report_embedding_build_scope_generation_id_fkey - report_embedding_target through
report_embedding_target_scope_generation_id_fkey
report_embedding_source
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
generation_id | uuid | not null | ||
report_id | uuid | not null | ||
source_observation_id | uuid | not null | ||
embedding_key | text | generated: (((generation_id)::text || '/'::text) || (report_id)::text) | ||
registration_kind | text | generated: 'report_embedding'::text |
Constraints
report_embedding_source_scope_generation_id_report_id_fkey:FOREIGN KEY (scope, generation_id, report_id) REFERENCES memory.report_embedding(scope, generation_id, report_id) ON DELETE CASCADEreport_embedding_source_scope_source_observation_id_fkey:FOREIGN KEY (scope, source_observation_id) REFERENCES memory.observation(scope, observation_id) ON DELETE CASCADEreport_embedding_source_source_observation_id_registration_fkey:FOREIGN KEY (source_observation_id, registration_kind, embedding_key) REFERENCES memory.projection_dependency(source_observation_id, projection_kind, projection_id) DEFERRABLE INITIALLY DEFERREDreport_embedding_source_generation_id_not_null:NOT NULL generation_idreport_embedding_source_report_id_not_null:NOT NULL report_idreport_embedding_source_scope_not_null:NOT NULL scopereport_embedding_source_source_observation_id_not_null:NOT NULL source_observation_idreport_embedding_source_pkey:PRIMARY KEY (scope, generation_id, report_id, source_observation_id)
Indexes
report_embedding_source_observation_idx:CREATE INDEX report_embedding_source_observation_idx ON memory.report_embedding_source USING btree (scope, source_observation_id)report_embedding_source_pkey:CREATE UNIQUE INDEX report_embedding_source_pkey ON memory.report_embedding_source USING btree (scope, generation_id, report_id, source_observation_id)
Triggers
report_embedding_source_removed:CREATE TRIGGER report_embedding_source_removed AFTER DELETE ON memory.report_embedding_source FOR EACH ROW EXECUTE FUNCTION memory.invalidate_report_embedding_source()
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- projection_dependency through
dependency_report_embedding_source_fk
report_embedding_target
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
generation_id | uuid | not null | ||
report_id | uuid | not null |
Constraints
report_embedding_target_scope_generation_id_fkey:FOREIGN KEY (scope, generation_id) REFERENCES memory.report_embedding_generation(scope, generation_id) ON DELETE CASCADEreport_embedding_target_scope_report_id_fkey:FOREIGN KEY (scope, report_id) REFERENCES memory.community_report(scope, report_id) ON DELETE CASCADEreport_embedding_target_generation_id_not_null:NOT NULL generation_idreport_embedding_target_report_id_not_null:NOT NULL report_idreport_embedding_target_scope_not_null:NOT NULL scopereport_embedding_target_pkey:PRIMARY KEY (scope, generation_id, report_id)
Indexes
report_embedding_target_pkey:CREATE UNIQUE INDEX report_embedding_target_pkey ON memory.report_embedding_target USING btree (scope, generation_id, report_id)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- report_embedding through
report_embedding_scope_generation_id_report_id_fkey
retention_sweep
What each retention sweep deleted, written in the transaction that deleted it. Counts only: no identifiers of what expired, because the point of expiry is that it is gone.
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
sweep_id | uuid | not null | gen_random_uuid() | |
scope | text | not null | ||
swept_at | timestamp with time zone | not null | now() | |
observations | integer | not null | ||
deleted | jsonb | not null |
Constraints
retention_sweep_observations_check:CHECK ((observations >= 0))retention_sweep_deleted_not_null:NOT NULL deletedretention_sweep_observations_not_null:NOT NULL observationsretention_sweep_scope_not_null:NOT NULL scoperetention_sweep_sweep_id_not_null:NOT NULL sweep_idretention_sweep_swept_at_not_null:NOT NULL swept_atretention_sweep_pkey:PRIMARY KEY (sweep_id)
Indexes
retention_sweep_pkey:CREATE UNIQUE INDEX retention_sweep_pkey ON memory.retention_sweep USING btree (sweep_id)retention_sweep_scope_idx:CREATE INDEX retention_sweep_scope_idx ON memory.retention_sweep USING btree (scope, swept_at DESC)
Privileges
taisce_data:INSERT, SELECT
schema_migration
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
version | integer | not null | ||
name | text | not null | ||
applied_at | timestamp with time zone | not null | now() |
Constraints
schema_migration_applied_at_not_null:NOT NULL applied_atschema_migration_name_not_null:NOT NULL nameschema_migration_version_not_null:NOT NULL versionschema_migration_pkey:PRIMARY KEY (version)
Indexes
schema_migration_pkey:CREATE UNIQUE INDEX schema_migration_pkey ON memory.schema_migration USING btree (version)
Privileges
taisce_data:SELECT
segment
A summary standing in for a contiguous range of one subject's turns at one level of the roll-up. Registered to every observation it covers and deleted when any of them erases; what replaces it is written from what survived.
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
segment_id | uuid | not null | ||
data_subject_id | text | not null | ||
level | integer | not null | ||
from_offset | bigint | not null | ||
to_offset | bigint | not null | ||
covered | integer | not null | ||
summary | text | not null | ||
written_at | timestamp with time zone | not null | now() |
Constraints
segment_covered_chk:CHECK ((covered >= 1))segment_level_chk:CHECK (((level >= 1) AND (level <= 6)))segment_range_chk:CHECK ((from_offset <= to_offset))segment_summary_chk:CHECK ((btrim(summary) <> ''::text))segment_covered_not_null:NOT NULL coveredsegment_data_subject_id_not_null:NOT NULL data_subject_idsegment_from_offset_not_null:NOT NULL from_offsetsegment_level_not_null:NOT NULL levelsegment_scope_not_null:NOT NULL scopesegment_segment_id_not_null:NOT NULL segment_idsegment_summary_not_null:NOT NULL summarysegment_to_offset_not_null:NOT NULL to_offsetsegment_written_at_not_null:NOT NULL written_atsegment_pkey:PRIMARY KEY (scope, segment_id)segment_scope_data_subject_id_level_from_offset_key:UNIQUE (scope, data_subject_id, level, from_offset)
Indexes
segment_pkey:CREATE UNIQUE INDEX segment_pkey ON memory.segment USING btree (scope, segment_id)segment_scope_data_subject_id_level_from_offset_key:CREATE UNIQUE INDEX segment_scope_data_subject_id_level_from_offset_key ON memory.segment USING btree (scope, data_subject_id, level, from_offset)segment_subject_idx:CREATE INDEX segment_subject_idx ON memory.segment USING btree (scope, data_subject_id, level, from_offset)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- projection_dependency through
dependency_segment_fk
source_extraction
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
source_observation_id | uuid | not null | ||
extractor_version | text | not null | ||
pinned_at | timestamp with time zone | not null | clock_timestamp() | |
generation_id | uuid |
Constraints
source_extraction_extractor_version_check:CHECK (((extractor_version = ANY (ARRAY['extract/v1'::text, 'curated/v1'::text])) OR (extractor_version ~ '^extract/v2:[a-f0-9]{64}$'::text)))source_extraction_generation_fk:FOREIGN KEY (scope, source_observation_id, generation_id) REFERENCES memory.fact_generation(scope, source_observation_id, generation_id) DEFERRABLE INITIALLY DEFERREDsource_extraction_scope_source_observation_id_fkey:FOREIGN KEY (scope, source_observation_id) REFERENCES memory.observation(scope, observation_id) ON DELETE CASCADEsource_extraction_extractor_version_not_null:NOT NULL extractor_versionsource_extraction_pinned_at_not_null:NOT NULL pinned_atsource_extraction_scope_not_null:NOT NULL scopesource_extraction_source_observation_id_not_null:NOT NULL source_observation_idsource_extraction_pkey:PRIMARY KEY (scope, source_observation_id)
Indexes
source_extraction_pkey:CREATE UNIQUE INDEX source_extraction_pkey ON memory.source_extraction USING btree (scope, source_observation_id)
Triggers
source_extraction_immutable:CREATE TRIGGER source_extraction_immutable BEFORE UPDATE ON memory.source_extraction FOR EACH ROW EXECUTE FUNCTION memory.extraction_pin_is_immutable()
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
speaker_term
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
term | text | not null |
Constraints
speaker_term_term_check:CHECK (((term = lower(btrim(term))) AND (term <> ''::text)))speaker_term_term_not_null:NOT NULL termspeaker_term_pkey:PRIMARY KEY (term)
Indexes
speaker_term_pkey:CREATE UNIQUE INDEX speaker_term_pkey ON memory.speaker_term USING btree (term)
Privileges
taisce_data:SELECT
subject_retry
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
key_digest | bytea | not null | ||
subject_id | text | |||
request_digest | bytea |
Constraints
subject_retry_check:CHECK (((subject_id IS NULL) = (request_digest IS NULL)))subject_retry_key_digest_check:CHECK ((octet_length(key_digest) = 32))subject_retry_request_digest_check:CHECK ((octet_length(request_digest) = 32))subject_retry_scope_fkey:FOREIGN KEY (scope) REFERENCES memory.project(scope) ON DELETE CASCADEsubject_retry_scope_subject_id_fkey:FOREIGN KEY (scope, subject_id) REFERENCES memory.data_subject(scope, subject_id)subject_retry_key_digest_not_null:NOT NULL key_digestsubject_retry_scope_not_null:NOT NULL scopesubject_retry_pkey:PRIMARY KEY (scope, key_digest)
Indexes
subject_retry_owner_idx:CREATE INDEX subject_retry_owner_idx ON memory.subject_retry USING btree (scope, subject_id) WHERE (subject_id IS NOT NULL)subject_retry_pkey:CREATE UNIQUE INDEX subject_retry_pkey ON memory.subject_retry USING btree (scope, key_digest)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
turn_message
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
observation_id | uuid | not null | ||
ordinal | integer | not null | ||
role | text | not null | ||
content | text | not null | ||
group_ordinal | integer | not null | ||
occurred_at | timestamp with time zone | not null | ||
chunk_id | uuid | not null | gen_random_uuid() |
Constraints
turn_message_group_ordinal_chk:CHECK ((group_ordinal >= 0))turn_message_ordinal_chk:CHECK ((ordinal >= 0))turn_message_role_chk:CHECK ((role = ANY (ARRAY['user'::text, 'assistant'::text, 'system'::text, 'tool'::text])))turn_message_observation_id_fkey:FOREIGN KEY (observation_id) REFERENCES memory.observation(observation_id) ON DELETE CASCADEturn_message_chunk_id_not_null:NOT NULL chunk_idturn_message_content_not_null:NOT NULL contentturn_message_group_ordinal_not_null:NOT NULL group_ordinalturn_message_observation_id_not_null:NOT NULL observation_idturn_message_occurred_at_not_null:NOT NULL occurred_atturn_message_ordinal_not_null:NOT NULL ordinalturn_message_role_not_null:NOT NULL roleturn_message_pkey:PRIMARY KEY (observation_id, ordinal)message_chunk_identity_unique:UNIQUE (observation_id, ordinal, chunk_id)message_chunk_lookup_unique:UNIQUE (chunk_id)
Indexes
message_chunk_identity_unique:CREATE UNIQUE INDEX message_chunk_identity_unique ON memory.turn_message USING btree (observation_id, ordinal, chunk_id)message_chunk_lookup_unique:CREATE UNIQUE INDEX message_chunk_lookup_unique ON memory.turn_message USING btree (chunk_id)turn_message_pkey:CREATE UNIQUE INDEX turn_message_pkey ON memory.turn_message USING btree (observation_id, ordinal)turn_message_turn_idx:CREATE INDEX turn_message_turn_idx ON memory.turn_message USING btree (observation_id, ordinal) INCLUDE (group_ordinal, role)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Referenced by
- chunk through
chunk_message_identity_fk - fact_evidence through
evidence_message_fk - fact_receipt through
fact_receipt_source_observation_id_source_ordinal_fkey - record_retraction through
record_retraction_source_observation_id_source_ordinal_fkey - rejected_claim through
rejected_source_message_fk
unresolvable_term
Terms that cannot be the subject of a fact because they name nothing the message establishes. A table rather than a list in code, for the reason the predicate vocabulary is a table: a closed set belongs where it is enforced. Pronouns and demonstratives are genuinely closed, unlike stopwords, which are a frequency judgement.
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
term | text | not null | ||
lang | text | not null | 'en'::text | |
reason | text | not null |
Constraints
unresolvable_term_chk:CHECK (((term = lower(btrim(term))) AND (length(term) > 0)))unresolvable_term_lang_not_null:NOT NULL langunresolvable_term_reason_not_null:NOT NULL reasonunresolvable_term_term_not_null:NOT NULL termunresolvable_term_pkey:PRIMARY KEY (lang, term)
Indexes
unresolvable_term_pkey:CREATE UNIQUE INDEX unresolvable_term_pkey ON memory.unresolvable_term USING btree (lang, term)
Privileges
taisce_data:SELECT
watermark
owner postgres
| Column | Type | Null | Default | Comment |
|---|---|---|---|---|
scope | text | not null | ||
log_offset | bigint | not null | ||
watermark_at | timestamp with time zone | not null | ||
updated_at | timestamp with time zone | not null | now() | |
formed_offset | bigint | Highest log offset in this scope whose turn is formed, with nothing unformed below it. NULL until the scope's first turn forms. This is the number a caller checks to know whether a recall would see what they just wrote; log_offset only says it was stored. |
Constraints
watermark_log_offset_not_null:NOT NULL log_offsetwatermark_scope_not_null:NOT NULL scopewatermark_updated_at_not_null:NOT NULL updated_atwatermark_watermark_at_not_null:NOT NULL watermark_atwatermark_pkey:PRIMARY KEY (scope)
Indexes
watermark_pkey:CREATE UNIQUE INDEX watermark_pkey ON memory.watermark USING btree (scope)
Privileges
taisce_data:DELETE, INSERT, SELECT, UPDATE
Functions
account_agent_artifact
account_agent_artifact() returns trigger · plpgsql · security definer · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.account_agent_artifact()
RETURNS trigger
LANGUAGE plpgsql
SECURITY DEFINER
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
DECLARE
delta_bytes bigint;
delta_objects bigint;
project_scope text;
BEGIN
IF TG_TABLE_SCHEMA<>'memory' OR TG_TABLE_NAME<>'agent_artifact' OR TG_OP NOT IN ('INSERT','UPDATE','DELETE') THEN
RAISE EXCEPTION 'invalid agent artifact accounting target';
END IF;
IF TG_OP='UPDATE' AND (NEW.scope,NEW.artifact_id,NEW.source_observation_id,NEW.data_subject_id,NEW.kind,NEW.created_at)
IS DISTINCT FROM (OLD.scope,OLD.artifact_id,OLD.source_observation_id,OLD.data_subject_id,OLD.kind,OLD.created_at) THEN
RAISE EXCEPTION 'artifact identity and ownership are immutable' USING ERRCODE='23514';
END IF;
IF TG_OP='DELETE' THEN
project_scope:=OLD.scope; delta_bytes:=-octet_length(OLD.content); delta_objects:=-1;
ELSE
project_scope:=NEW.scope;
delta_bytes:=octet_length(NEW.content); delta_objects:=1;
IF TG_OP='UPDATE' THEN
delta_bytes:=delta_bytes-octet_length(OLD.content); delta_objects:=0;
END IF;
IF NOT EXISTS(SELECT 1 FROM memory.observation o WHERE o.scope=NEW.scope
AND o.observation_id=NEW.source_observation_id AND o.kind='artifact'
AND o.data_subject_id=NEW.data_subject_id AND o.formed_at IS NOT NULL AND o.retention_until IS NOT NULL) THEN
RAISE EXCEPTION 'artifact requires a completed owned source with bounded retention' USING ERRCODE='23514';
END IF;
END IF;
UPDATE memory.agent_storage_policy SET used_bytes=used_bytes+delta_bytes,used_objects=used_objects+delta_objects
WHERE scope=project_scope AND (TG_OP='DELETE' OR
((delta_bytes<=0 OR used_bytes+delta_bytes<=max_bytes)
AND (delta_objects<=0 OR used_objects+delta_objects<=max_objects)
AND (TG_OP='UPDATE' AND delta_bytes<=0 OR octet_length(NEW.content)<=max_object_bytes)));
IF NOT FOUND THEN
RAISE EXCEPTION 'agent storage capacity is full' USING ERRCODE='P0001',CONSTRAINT='agent_storage_capacity';
END IF;
IF TG_OP='DELETE' THEN RETURN OLD; END IF;
RETURN NEW;
END;
$function$
advance_record_version
advance_record_version() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.advance_record_version()
RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
BEGIN
NEW.version := gen_random_uuid();
RETURN NEW;
END;
$function$
audit_entries_digest
audit_entries_digest(lo bigint, hi bigint) returns bytea · sql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.audit_entries_digest(lo bigint, hi bigint)
RETURNS bytea
LANGUAGE sql
STABLE
AS $function$
SELECT sha256(coalesce(string_agg(
e.entry_id::text || '|' || e.operation || '|' || e.principal || '|' ||
e.principal_kind || '|' || e.project || '|' || e.magnitude::text || '|' ||
e.outcome || '|' || extract(epoch from e.occurred_at)::text,
E'\n' ORDER BY e.entry_id), '')::bytea)
FROM memory.audit_entry e
WHERE e.entry_id BETWEEN lo AND hi;
$function$
audit_is_append_only
audit_is_append_only() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.audit_is_append_only()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
RAISE EXCEPTION 'the audit ledger is append-only: % is not permitted', TG_OP
USING HINT = 'a record that can be changed is not a record';
END;
$function$
audit_seal_now
audit_seal_now() returns TABLE(from_entry bigint, to_entry bigint, entry_count integer, digest bytea) · plpgsql · security definer · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.audit_seal_now()
RETURNS TABLE(from_entry bigint, to_entry bigint, entry_count integer, digest bytea)
LANGUAGE plpgsql
SECURITY DEFINER
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
DECLARE
lo bigint;
hi bigint;
n integer;
previous bytea;
entries bytea;
chained bytea;
BEGIN
LOCK TABLE memory.audit_entry IN SHARE ROW EXCLUSIVE MODE;
SELECT s.to_entry + 1, s.digest INTO lo, previous
FROM memory.audit_seal s ORDER BY s.seal_id DESC LIMIT 1;
IF NOT FOUND THEN
-- The first seal chains to a fixed zero rather than to nothing, so verification has one rule.
lo := 0;
previous := decode(repeat('00', 32), 'hex');
END IF;
SELECT e.entry_id INTO hi FROM memory.audit_entry e
WHERE e.entry_id >= lo ORDER BY e.entry_id OFFSET 99999 LIMIT 1;
IF hi IS NULL THEN
SELECT max(e.entry_id) INTO hi FROM memory.audit_entry e WHERE e.entry_id >= lo;
END IF;
IF hi IS NULL THEN
RETURN;
END IF;
SELECT count(*) INTO n FROM memory.audit_entry e WHERE e.entry_id BETWEEN lo AND hi;
entries := memory.audit_entries_digest(lo, hi);
chained := sha256(previous || entries);
INSERT INTO memory.audit_seal (from_entry, to_entry, entry_count, entries_digest, previous_digest, digest)
VALUES (lo, hi, n, entries, previous, chained);
RETURN QUERY SELECT lo, hi, n, chained;
END;
$function$
clear_observation_retry_payload
clear_observation_retry_payload() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.clear_observation_retry_payload()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
UPDATE memory.observation_retry
SET observation_id = NULL, request_digest = NULL
WHERE observation_id = OLD.observation_id AND scope = OLD.scope;
RETURN OLD;
END
$function$
clear_replacement_identifier
clear_replacement_identifier() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.clear_replacement_identifier()
RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
BEGIN
IF NEW.replacement_observation_id IS NULL THEN NEW.replacement_fact_id := NULL; END IF;
RETURN NEW;
END;
$function$
clear_subject_retry_payload
clear_subject_retry_payload() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.clear_subject_retry_payload()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
UPDATE memory.subject_retry SET subject_id=NULL,request_digest=NULL
WHERE scope=OLD.scope AND subject_id=OLD.subject_id;
RETURN OLD;
END
$function$
extraction_pin_is_immutable
extraction_pin_is_immutable() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.extraction_pin_is_immutable()
RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
BEGIN
IF NEW IS DISTINCT FROM OLD THEN
RAISE EXCEPTION 'source extraction identity is immutable' USING ERRCODE='23514';
END IF;
RETURN NEW;
END;
$function$
immutable_embedding_identity
immutable_embedding_identity() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.immutable_embedding_identity()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN RAISE EXCEPTION 'embedding generation identity is immutable'; END $function$
immutable_entity_embedding_identity
immutable_entity_embedding_identity() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.immutable_entity_embedding_identity()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN RAISE EXCEPTION 'entity embedding generation identity is immutable'; END $function$
immutable_report_embedding_identity
immutable_report_embedding_identity() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.immutable_report_embedding_identity()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN RAISE EXCEPTION 'report embedding generation identity is immutable'; END $function$
initialize_agent_storage_policy
initialize_agent_storage_policy() returns trigger · plpgsql · security definer · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.initialize_agent_storage_policy()
RETURNS trigger
LANGUAGE plpgsql
SECURITY DEFINER
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
BEGIN
IF TG_TABLE_SCHEMA<>'memory' OR TG_TABLE_NAME<>'project' OR TG_OP<>'INSERT' THEN
RAISE EXCEPTION 'invalid agent storage policy trigger target';
END IF;
INSERT INTO memory.agent_storage_policy(scope) VALUES(NEW.scope);
RETURN NULL;
END;
$function$
invalidate_entity_embedding_source
invalidate_entity_embedding_source() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.invalidate_entity_embedding_source()
RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
BEGIN
DELETE FROM memory.entity_embedding
WHERE scope=OLD.scope AND generation_id=OLD.generation_id AND entity_id=OLD.entity_id;
RETURN OLD;
END $function$
invalidate_entity_embeddings
invalidate_entity_embeddings() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.invalidate_entity_embeddings()
RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
DECLARE target_scope text; target_id uuid; other_scope text; other_id uuid;
BEGIN
IF TG_TABLE_NAME='entity' THEN
IF TG_OP='DELETE' THEN target_scope := OLD.scope; target_id := OLD.entity_id;
ELSE target_scope := NEW.scope; target_id := NEW.entity_id; END IF;
ELSIF TG_TABLE_NAME='entity_name_receipt' THEN
IF TG_OP='DELETE' THEN target_scope := OLD.scope; target_id := OLD.entity_id;
ELSE target_scope := NEW.scope; target_id := NEW.entity_id; END IF;
ELSIF TG_TABLE_NAME='fact' THEN
IF TG_OP='DELETE' THEN target_scope := OLD.scope; target_id := OLD.subject_entity_id; other_id := OLD.object_entity_id;
ELSE target_scope := NEW.scope; target_id := NEW.subject_entity_id; other_id := NEW.object_entity_id; END IF;
other_scope := target_scope;
ELSIF TG_TABLE_NAME='fact_evidence' THEN
IF TG_OP='DELETE' THEN
SELECT scope,subject_entity_id,object_entity_id INTO target_scope,target_id,other_id
FROM memory.fact WHERE fact_id=OLD.fact_id;
ELSE
SELECT scope,subject_entity_id,object_entity_id INTO target_scope,target_id,other_id
FROM memory.fact WHERE fact_id=NEW.fact_id;
END IF;
other_scope := target_scope;
ELSE
RAISE EXCEPTION 'invalid entity embedding invalidation target';
END IF;
IF target_id IS NOT NULL THEN
PERFORM pg_advisory_xact_lock(hashtextextended(target_scope||':entity-embedding:'||target_id::text,0));
DELETE FROM memory.entity_embedding WHERE scope=target_scope AND entity_id=target_id;
END IF;
IF other_id IS NOT NULL AND other_id IS DISTINCT FROM target_id THEN
PERFORM pg_advisory_xact_lock(hashtextextended(other_scope||':entity-embedding:'||other_id::text,0));
DELETE FROM memory.entity_embedding WHERE scope=other_scope AND entity_id=other_id;
END IF;
IF TG_OP='DELETE' THEN RETURN OLD; END IF;
RETURN NEW;
END $function$
invalidate_fact_reports
invalidate_fact_reports() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.invalidate_fact_reports()
RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
DECLARE
source_ids uuid[];
source_id uuid;
BEGIN
IF TG_TABLE_SCHEMA <> 'memory' THEN
RAISE EXCEPTION 'invalid report invalidation trigger target';
END IF;
IF TG_TABLE_NAME='fact' AND TG_OP IN ('UPDATE','DELETE') THEN
SELECT array_agg(DISTINCT source_observation_id) INTO source_ids
FROM memory.fact_evidence WHERE scope=OLD.scope AND fact_id=OLD.fact_id;
ELSIF TG_TABLE_NAME='fact_evidence' THEN
IF TG_OP='INSERT' THEN
source_ids := ARRAY[NEW.source_observation_id];
ELSIF TG_OP='DELETE' THEN
source_ids := ARRAY[OLD.source_observation_id];
ELSE
source_ids := ARRAY[OLD.source_observation_id,NEW.source_observation_id];
END IF;
ELSE
RAISE EXCEPTION 'invalid report invalidation trigger target';
END IF;
-- Sorted observation locks precede report deletion. Report writers take the same locks before
-- insertion, so either their snapshot is refused or this transaction deletes their report.
FOR source_id IN SELECT DISTINCT unnest(source_ids) ORDER BY 1 LOOP
UPDATE memory.observation SET fact_revision=fact_revision+1 WHERE observation_id=source_id;
END LOOP;
DELETE FROM memory.community_report r USING memory.projection_dependency d
WHERE d.scope=r.scope AND d.report_ref=r.report_id
AND d.projection_kind='community_report' AND d.source_observation_id=ANY(source_ids);
IF TG_OP='DELETE' THEN RETURN OLD; END IF;
RETURN NEW;
END;
$function$
invalidate_report_embedding_source
invalidate_report_embedding_source() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.invalidate_report_embedding_source()
RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
BEGIN
DELETE FROM memory.report_embedding
WHERE scope=OLD.scope AND generation_id=OLD.generation_id AND report_id=OLD.report_id;
RETURN OLD;
END $function$
lock_registered_subject
lock_registered_subject() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.lock_registered_subject()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
IF NEW.data_subject_id IS NOT NULL THEN
PERFORM 1 FROM memory.data_subject WHERE scope=NEW.scope AND subject_id=NEW.data_subject_id FOR KEY SHARE;
END IF;
RETURN NEW;
END
$function$
lock_report_embedding_change
lock_report_embedding_change() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.lock_report_embedding_change()
RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
BEGIN
PERFORM pg_advisory_xact_lock(hashtextextended(OLD.scope||':report-embedding:'||OLD.report_id::text,0));
IF TG_OP='DELETE' THEN RETURN OLD; END IF;
RETURN NEW;
END $function$
mark_entity_embedding_incomplete
mark_entity_embedding_incomplete() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.mark_entity_embedding_incomplete()
RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
BEGIN
UPDATE memory.entity_embedding_build
SET state='building',after_entity_id=NULL,lease_id=NULL,updated_at=clock_timestamp()
WHERE scope=OLD.scope AND generation_id=OLD.generation_id AND state='ready';
RETURN OLD;
END $function$
mark_report_embedding_incomplete
mark_report_embedding_incomplete() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.mark_report_embedding_incomplete()
RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
BEGIN
UPDATE memory.report_embedding_build
SET state='building',after_report_id=NULL,lease_id=NULL,updated_at=clock_timestamp()
WHERE scope=OLD.scope AND generation_id=OLD.generation_id AND state='ready';
RETURN OLD;
END $function$
project_surfaces_only_grow
project_surfaces_only_grow() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.project_surfaces_only_grow()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
IF NOT (OLD.surfaces <@ NEW.surfaces) THEN
RAISE EXCEPTION
'a memory surface cannot be turned off: % would remove %',
NEW.scope, (SELECT array_agg(s) FROM unnest(OLD.surfaces) s WHERE s <> ALL(NEW.surfaces))
USING HINT = 'stopping a surface means erasing what it stored, which is an erasure with a receipt';
END IF;
RETURN NEW;
END;
$function$
protect_artifact_source
protect_artifact_source() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.protect_artifact_source()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
IF (OLD.kind='artifact' OR NEW.kind='artifact') AND
((OLD.kind,OLD.scope,OLD.observation_id,OLD.data_subject_id,OLD.source_role)
IS DISTINCT FROM (NEW.kind,NEW.scope,NEW.observation_id,NEW.data_subject_id,NEW.source_role)
OR NEW.formed_at IS NULL OR NEW.retention_until IS NULL) THEN
RAISE EXCEPTION 'artifact source ownership and formation exclusion are immutable' USING ERRCODE='23514';
END IF;
RETURN NEW;
END;
$function$
protect_subject_identity
protect_subject_identity() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.protect_subject_identity()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
IF (NEW.scope,NEW.subject_id,NEW.created_at,NEW.inactive_after)
IS DISTINCT FROM (OLD.scope,OLD.subject_id,OLD.created_at,OLD.inactive_after) THEN
RAISE EXCEPTION 'subject identity and lifetime are immutable' USING ERRCODE='23514';
END IF;
RETURN NEW;
END
$function$
release_ingestion_reservation
release_ingestion_reservation() returns trigger · plpgsql · security definer · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.release_ingestion_reservation()
RETURNS trigger
LANGUAGE plpgsql
SECURITY DEFINER
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
BEGIN
IF TG_TABLE_SCHEMA <> 'memory' OR TG_TABLE_NAME <> 'ingestion_reservation' OR TG_OP <> 'DELETE' THEN
RAISE EXCEPTION 'invalid ingestion release trigger target';
END IF;
UPDATE memory.ingestion_budget SET pending=pending-1 WHERE singleton AND pending>0;
IF NOT FOUND THEN
RAISE EXCEPTION 'ingestion counter is inconsistent' USING ERRCODE='23514';
END IF;
UPDATE memory.ingestion_project_usage SET pending=pending-1 WHERE scope=OLD.scope AND pending>0;
IF NOT FOUND THEN
RAISE EXCEPTION 'project ingestion counter is inconsistent' USING ERRCODE='23514';
END IF;
DELETE FROM memory.ingestion_project_usage WHERE scope=OLD.scope AND pending=0;
RETURN NULL;
END;
$function$
retain_fact_history
retain_fact_history() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.retain_fact_history()
RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
BEGIN
INSERT INTO memory.fact_receipt_history(scope,history_id,fact_id,valid,known,source_observation_id)
SELECT NEW.scope,NEW.history_id,NEW.fact_id,NEW.valid,NEW.known,NEW.source_observation_id
WHERE EXISTS(SELECT 1 FROM memory.fact_receipt r WHERE r.scope=NEW.scope AND r.fact_id=NEW.fact_id)
ON CONFLICT(scope,history_id) DO NOTHING;
RETURN NEW;
END;
$function$
retain_fact_transition
retain_fact_transition() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.retain_fact_transition()
RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
BEGIN
-- Deleting a successor projection clears its live FK. Its receipt still names the successor
-- for recovery; deleting the causal observation instead cascades the entire receipt away.
UPDATE memory.fact_receipt r SET
state=CASE WHEN NEW.superseded_by IS NULL AND r.superseded_by IS NOT NULL
THEN to_jsonb(NEW)||jsonb_build_object('superseded_by',r.superseded_by)
ELSE to_jsonb(NEW) END,
superseded_by=coalesce(NEW.superseded_by,r.superseded_by),
supersession_source=NEW.supersession_source
WHERE r.scope=NEW.scope AND r.fact_id=NEW.fact_id;
RETURN NEW;
END;
$function$
stale_entity_embedding_snapshots
stale_entity_embedding_snapshots() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.stale_entity_embedding_snapshots()
RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
BEGIN
IF NEW.identity_kind='named' THEN
PERFORM 1 FROM memory.project WHERE scope=NEW.scope FOR UPDATE;
UPDATE memory.entity_embedding_build SET state='stale',lease_id=NULL,updated_at=clock_timestamp()
WHERE scope=NEW.scope AND state<>'discarded';
END IF;
RETURN NEW;
END $function$
stale_report_embedding_snapshots
stale_report_embedding_snapshots() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.stale_report_embedding_snapshots()
RETURNS trigger
LANGUAGE plpgsql
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
DECLARE target_scope text; target_id uuid;
BEGIN
IF TG_OP='DELETE' THEN
target_scope := OLD.scope; target_id := OLD.report_id;
ELSE
target_scope := NEW.scope; target_id := NEW.report_id;
END IF;
PERFORM 1 FROM memory.project WHERE scope=target_scope FOR UPDATE;
UPDATE memory.report_embedding_build SET state='stale',lease_id=NULL,updated_at=clock_timestamp()
WHERE scope=target_scope AND state<>'discarded';
IF TG_OP='UPDATE' THEN
DELETE FROM memory.report_embedding WHERE scope=target_scope AND report_id=target_id;
END IF;
IF TG_OP='DELETE' THEN RETURN OLD; END IF;
RETURN NEW;
END $function$
sync_ingestion_reservation
sync_ingestion_reservation() returns trigger · plpgsql · security definer · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.sync_ingestion_reservation()
RETURNS trigger
LANGUAGE plpgsql
SECURITY DEFINER
SET search_path TO 'pg_catalog', 'pg_temp'
AS $function$
DECLARE
project_scope text;
project_limit bigint;
BEGIN
IF TG_TABLE_SCHEMA <> 'memory' OR TG_TABLE_NAME <> 'observation'
OR TG_OP NOT IN ('INSERT','UPDATE') THEN
RAISE EXCEPTION 'invalid ingestion reservation trigger target';
END IF;
SELECT o.scope INTO project_scope FROM memory.observation o
WHERE o.observation_id=NEW.observation_id AND o.kind='turn' AND o.formed_at IS NULL;
IF NOT FOUND THEN
DELETE FROM memory.ingestion_reservation WHERE observation_id=NEW.observation_id;
RETURN NULL;
END IF;
IF EXISTS(SELECT 1 FROM memory.ingestion_reservation WHERE observation_id=NEW.observation_id) THEN
RETURN NULL;
END IF;
UPDATE memory.ingestion_budget SET pending=pending+1
WHERE singleton AND pending<max_pending RETURNING max_pending_per_project INTO project_limit;
IF NOT FOUND THEN
RAISE EXCEPTION 'unfinished observation capacity is full'
USING ERRCODE='P0001',CONSTRAINT='ingestion_backlog_capacity';
END IF;
INSERT INTO memory.ingestion_project_usage(scope,pending) VALUES(project_scope,1)
ON CONFLICT(scope) DO UPDATE SET pending=memory.ingestion_project_usage.pending+1
WHERE memory.ingestion_project_usage.pending<project_limit;
IF NOT FOUND THEN
RAISE EXCEPTION 'unfinished observation capacity is full'
USING ERRCODE='P0001',CONSTRAINT='ingestion_backlog_capacity';
END IF;
INSERT INTO memory.ingestion_reservation(observation_id,scope) VALUES(NEW.observation_id,project_scope);
RETURN NULL;
END;
$function$
validate_entity_name_receipt
validate_entity_name_receipt() returns trigger · plpgsql · security invoker · execute: owner only (no ACL: PUBLIC may execute)
definition
CREATE OR REPLACE FUNCTION memory.validate_entity_name_receipt()
RETURNS trigger
LANGUAGE plpgsql
AS $function$
BEGIN
NEW.name_hash := sha256(convert_to(NEW.name,'UTF8'));
PERFORM 1 FROM memory.entity WHERE scope=NEW.scope AND entity_id=NEW.entity_id
AND identity_kind='named' AND normalized_name=NEW.normalized_name FOR KEY SHARE;
IF NOT FOUND THEN RAISE EXCEPTION 'name receipt must match a live named identity' USING ERRCODE='23514'; END IF;
RETURN NEW;
END $function$
Sequences
audit_entry_entry_id_seqaudit_seal_seal_id_seq