World's first open-source enterprise world model.
Rust agent-memorybitemporalgraphragknowledge-baseknowledge-graphllmontologypgvectorpostgresqlragrustself-hostedsemantic-searchtemporal-knowledge-graphworld-model
Record 0028 becomes 0031 (#489)
WaylandYang9f36f1f9dbb7
diff --git a/crates/utopia-extract/src/lib.rs b/crates/utopia-extract/src/lib.rsindex 0c452f66..de1fc859 100644--- a/crates/utopia-extract/src/lib.rs+++ b/crates/utopia-extract/src/lib.rs@@ -83,7 +83,7 @@ pub struct PromptRelation {/// **一律用 key**:模型要输出的就是 key,中文库里 person 的 label 是"人物",/// 写进签名等于教它输出一个不存在的类型(docs/decisions/0004)pub signature: String,- /// 时间语义(`relation_types.temporal`):`state` / `event` / `eternal`(0028)。+ /// 时间语义(`relation_types.temporal`):`state` / `event` / `eternal`(0031)。/// 只有 event 与 eternal 会在清单里带标记——状态是默认,写出来只多花 tokenpub temporal: String,}@@ -143,7 +143,7 @@ pub fn build_messages(} else {String::new()};- // 事件与恒常带方括号标记;状态是默认,不标(0028)+ // 事件与恒常带方括号标记;状态是默认,不标(0031)let mark = temporal_mark(&r.temporal).map(|m| format!(" [{m}]")).unwrap_or_default();@@ -832,7 +832,7 @@ mod prompt_shape_tests {}}- /// 事件与恒常在清单里带标记,说明只出现一次(0028)+ /// 事件与恒常在清单里带标记,说明只出现一次(0031)#[test]fn an_event_and_an_eternal_relation_are_marked() {let rels = vec![diff --git a/crates/utopia-server/src/rdf.rs b/crates/utopia-server/src/rdf.rsindex 16e0d3e8..3cbcc831 100644--- a/crates/utopia-server/src/rdf.rs+++ b/crates/utopia-server/src/rdf.rs@@ -378,7 +378,7 @@ pub fn emit_relation(sink.r(&iri, &nn(rdf::TYPE.as_str()), &owl(term))?;}}- // 时间语义也照抄(0028):一个 event 谓词的事实两端是同一刻,一个 eternal 谓词的+ // 时间语义也照抄(0031):一个 event 谓词的事实两端是同一刻,一个 eternal 谓词的// 事实没有日期——读的人不看这一条,会把前者读成一天的状态、后者读成从不知何时起。// 状态是默认,不写if r.temporal != "state" {diff --git a/crates/utopia-store/src/graph.rs b/crates/utopia-store/src/graph.rsindex 39af0d68..7b876971 100644--- a/crates/utopia-store/src/graph.rs+++ b/crates/utopia-store/src/graph.rs@@ -189,7 +189,7 @@ pub fn truncate_to(}/// 一个桶的尽头:值加一个精度单位。`2024-03-15`(day)→ `2024-03-16`;`2024-03`(month)-/// → `2024-04`。事件在它命名的那个桶里成立(0028),读出来的终点就是这个;没有精度+/// → `2024-04`。事件在它命名的那个桶里成立(0031),读出来的终点就是这个;没有精度/// (锚点)原样返回——锚点是一刻,不是一个桶pub fn bucket_end(t: chrono::DateTime<chrono::Utc>,@@ -207,10 +207,10 @@ pub fn bucket_end(}}-/// 关系的时间语义(`relation_types.temporal`,0028)。状态有区间;事件是一刻——两端写+/// 关系的时间语义(`relation_types.temporal`,0031)。状态有区间;事件是一刻——两端写/// 同一个值,在它命名的那个桶里成立;恒常没有日期,每一刻都成立。///-/// 从图谱层第一份迁移起这一列就在,界面也一直给选;但直到 0028 之前只有 state 驱动+/// 从图谱层第一份迁移起这一列就在,界面也一直给选;但直到 0031 之前只有 state 驱动/// 引擎,event 与 eternal 写进去、读出来都还是区间#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]pub enum Temporal {@@ -272,7 +272,7 @@ impl<'a> Validity<'a> {self}- /// 按谓词的时间语义归一(0028)。写入路径进库前都走一遍,与读出侧 `world_axis`+ /// 按谓词的时间语义归一(0031)。写入路径进库前都走一遍,与读出侧 `world_axis`/// 说同一句话。////// - 事件:那一刻写在**两端**。原文给了起点用起点;只给了终点,那就是它发生的@@ -336,7 +336,7 @@ async fn insert_fact_inner(validity: Validity<'_>,confidence: f32,) -> AppResult<(Uuid, bool)> {- // 按谓词的时间语义归一(0028):事件两端同一刻,恒常无日期。写在这里而不是各个+ // 按谓词的时间语义归一(0031):事件两端同一刻,恒常无日期。写在这里而不是各个// 写入者那儿——抽取、点头、人自己写的事实都经过这一个门let temporal = predicate_temporal(pool, predicate_id).await?;let validity = validity.under(temporal).truncated();@@ -400,7 +400,7 @@ async fn insert_fact_inner(}// 弱化陈述:新观察无时间,同断言已有开放行 → 并入(取起点最新的开放行)。// 事件没有「开放」一说——它的两端总是同一刻——所以没日期的再观察并进已有的- // 那一刻(0028):说过一次「三月收购了」,再听到一句没日期的「收购了」,不是第二次收购+ // 那一刻(0031):说过一次「三月收购了」,再听到一句没日期的「收购了」,不是第二次收购if validity.from.is_none() && !validity.has_ended() {if let Some((existing, _, _, _)) = same.iter()diff --git a/crates/utopia-store/src/reasoning.rs b/crates/utopia-store/src/reasoning.rsindex ecd76a9a..b30309cc 100644--- a/crates/utopia-store/src/reasoning.rs+++ b/crates/utopia-store/src/reasoning.rs@@ -860,11 +860,11 @@ fn read_span() -> (Option<i64>, Option<i64>, bool, bool) {use crate::graph::Temporal;match temporal {- // 恒常每一刻都成立,证据日期不闸它(0028)+ // 恒常每一刻都成立,证据日期不闸它(0031)Temporal::Eternal => return (None, None, false, false),// 事件在它命名的那个桶里成立;没日期的事件区间为空——`overlap` 对空交集不推,- // 所以一条经过「不知何时收购」的链推不出东西,与读出侧一致(0028)。- // 0028 之前写下的事件行终点是空的,按起点那个桶读+ // 所以一条经过「不知何时收购」的链推不出东西,与读出侧一致(0031)。+ // 0031 之前写下的事件行终点是空的,按起点那个桶读Temporal::Event => {return match from {None => {@@ -912,7 +912,7 @@ async fn timed_edges(pool: &PgPool, kb_id: Uuid) -> AppResult<TimedEdges> {.bind(kb_id).fetch_all(pool).await?;- // 谓词的时间语义(0028):事件按它的桶读,恒常两端开放。一次取全,按谓词查+ // 谓词的时间语义(0031):事件按它的桶读,恒常两端开放。一次取全,按谓词查let temporal_of: HashMap<Uuid, crate::graph::Temporal> = sqlx::query_as::<_, (Uuid, String)>("SELECT id, temporal FROM relation_types WHERE kb_id = $1",)diff --git a/crates/utopia-store/src/temporal.rs b/crates/utopia-store/src/temporal.rsindex 2b20de00..1e924356 100644--- a/crates/utopia-store/src/temporal.rs+++ b/crates/utopia-store/src/temporal.rs@@ -438,7 +438,7 @@ pub async fn correct_interval(fact_id: Uuid,validity: crate::graph::Validity<'_>,) -> AppResult<Option<Uuid>> {- // 人改区间也按谓词的时间语义归一(0028):给一个事件填了一段,落下的仍是它的那一刻+ // 人改区间也按谓词的时间语义归一(0031):给一个事件填了一段,落下的仍是它的那一刻let predicate: Option<Option<Uuid>> =sqlx::query_scalar("SELECT predicate_id FROM facts WHERE id = $1").bind(fact_id)diff --git a/crates/utopia-store/src/world_axis.rs b/crates/utopia-store/src/world_axis.rsindex 45c0b305..be640247 100644--- a/crates/utopia-store/src/world_axis.rs+++ b/crates/utopia-store/src/world_axis.rs@@ -21,7 +21,7 @@//! 的「NULL 即现在」不同:没有人持有一个晚于此刻的信念,而没有时刻的图是全部//! 时间的图。-/// 谓词的时间语义(0028)。一行自己说不出它是状态、事件还是恒常——它的谓词说;+/// 谓词的时间语义(0031)。一行自己说不出它是状态、事件还是恒常——它的谓词说;/// 没有谓词(0010)读作状态,与写入侧 `predicate_temporal` 同一判断fn temporal_of(alias: &str) -> String {format!("(SELECT r.temporal FROM relation_types r WHERE r.id = {alias}.predicate_id)")@@ -40,10 +40,10 @@ pub fn facts_holds_from(alias: &str) -> String {/// `facts`:读出来的上界——原文给了终点用终点;说结束了但不知哪天,到最早说出它/// 的那份文档为止;否则开放(NULL)。///-/// 事件(0028)在它命名的那个桶里成立:上界是那一刻加一个精度单位——`2024-03-15`+/// 事件(0031)在它命名的那个桶里成立:上界是那一刻加一个精度单位——`2024-03-15`/// 到 `2024-03-16` 为止,`2024-03` 到四月为止。没日期的事件上界与下界同为锚点,/// 区间为空:它发生过,但不知何时,任何时刻都不算成立(0022 对未知的收法)。-/// 0028 之前写下的事件行终点是空的,按起点那个桶读——不必回填。恒常没有上界+/// 0031 之前写下的事件行终点是空的,按起点那个桶读——不必回填。恒常没有上界pub fn facts_holds_to(alias: &str) -> String {format!("CASE WHEN {temporal} = 'eternal' THEN NULL \diff --git a/crates/utopia-store/tests/an_event_holds_at_the_moment_it_names.rs b/crates/utopia-store/tests/an_event_holds_at_the_moment_it_names.rsindex cbb83581..2fafef0e 100644--- a/crates/utopia-store/tests/an_event_holds_at_the_moment_it_names.rs+++ b/crates/utopia-store/tests/an_event_holds_at_the_moment_it_names.rs@@ -1,4 +1,4 @@-//! 事件在它命名的那一刻成立,恒常每一刻都成立(0028 / #486),打在真库上。+//! 事件在它命名的那一刻成立,恒常每一刻都成立(0031 / #486),打在真库上。//!//! 为什么非要连库:写入侧的归一(`Validity::under`)和读出侧的谓词(`world_axis`)//! 各在一处,两处必须说同一句话;而读出侧整个活在 SQL 字符串里——一个写反的 CASE、@@ -10,7 +10,7 @@//! - 没日期的事件任何时刻都不成立,但实体上仍列着它;之后来了日期就精化,再来一句//! 没日期的并进去//! - 恒常抹掉原文里的日期,证据日期也不闸它——1800 年和 2100 年都成立-//! - 0028 之前写下的事件行(终点空)按起点那个桶读,不必回填+//! - 0031 之前写下的事件行(终点空)按起点那个桶读,不必回填//! - 人改一个事件的区间,落下的仍是一刻//! - 派生经过事件取它的桶(两端带精度),经过恒常两端开放//!@@ -525,7 +525,7 @@ async fn a_row_written_before_the_rule_reads_as_its_start_bucket() -> anyhow::Relet f = seed(&pool).await?;let run = async {- // 0028 之前的形状:事件谓词、起点有、终点空——当年被读成「从那天起一直如此」+ // 0031 之前的形状:事件谓词、起点有、终点空——当年被读成「从那天起一直如此」let legacy = Uuid::now_v7();sqlx::query("INSERT INTO facts (id, kb_id, subject_id, predicate_id, object_id,diff --git a/docs/decisions/0028-an-event-holds-at-the-moment-it-names.md b/docs/decisions/0031-an-event-holds-at-the-moment-it-names.mdsimilarity index 99%rename from docs/decisions/0028-an-event-holds-at-the-moment-it-names.mdrename to docs/decisions/0031-an-event-holds-at-the-moment-it-names.mdindex e0cdd983..3586c912 100644--- a/docs/decisions/0028-an-event-holds-at-the-moment-it-names.md+++ b/docs/decisions/0031-an-event-holds-at-the-moment-it-names.md@@ -1,4 +1,4 @@-# 0028 · An event holds at the moment it names+# 0031 · An event holds at the moment it names- **Status**: implemented (#486) · `Validity::under` normalises every write by the predicate's `temporal` — in `insert_fact_inner`, so extraction, the nod and a person's own fact all pass through it, and in `correct_interval` · `world_axis` reads an event as the bucket it names and an eternal fact as open at both ends, and the evaluator's `read_span` says the same · the prompt marks `[event]` and `[eternal]` relations and tells the model what to write, for a base that has any · the export carries `utopia:temporal` on a property that is not a state · no schema change, and a row written before this reads correctly · the panel still prints an event as `T ~ T` and the ontology page still does not say what the three values do — that is the UI cut- **Written**: 2026-09-08 (conventions in the [README](README.md))diff --git a/docs/decisions/README.md b/docs/decisions/README.mdindex 78e0702a..1a0fce9c 100644--- a/docs/decisions/README.md+++ b/docs/decisions/README.md@@ -50,7 +50,7 @@ The test for writing one: if someone (including us) looks at a piece of code in| 0024 | [The world axis reaches the second](0024-the-world-axis-reaches-the-second.md) | Implemented · the precision ladder runs year → second (not below: no source states less), a stored value is truncated to its precision by CHECK on all three tables, a clock time without a zone is a date, one list spells the ladder in the extractor, the renderers, the export and the evaluator; a derived bound takes the precision of the premise that set it || 0026 | [A decision records why](0026-a-decision-records-why.md) | Implemented · `resolution_reviews.rationale` and `why` on the ledger event from every human decide path, precedents quote it into the prompt and the `ledger_search` tool, the batch adjudicator reads precedents and keys its cache on them, one confident pair in ten goes to a person anyway (`escalate_sample`), the model's own why is kept beside machine decisions · the impact gate (#357) and the investigating adjudicator (#358) follow || 0025 | [Governance reads the ledger before it decides](0025-governance-reads-the-ledger-before-it-decides.md) | Cut 1 implemented · a per-base `governance` switch, a `govern` job that works the duplicates queue first in, first out with each head's cluster, precedents pulled from the ledger into the prompt, a gate where the agent's own confidence decides and history lowers the bar or blocks (revised after the first big-file run), every look a row in `agent_decisions`, answers through the person's own decide path · the switch, the Agent queue, the proposal chip and the Overview section in the UI · a pair the batch cannot settle is looked at again with tools and then decided or asked about, within a daily budget · two reverts in a week turn the switch off and raise an alert · identity rules the model reads and two it cannot argue with (name shapes, type families), measured against a hand-labeled set of 411 name pairs by `scripts/bench/govern.mjs` |-| 0028 | [An event holds at the moment it names](0028-an-event-holds-at-the-moment-it-names.md) | Implemented (#486) · `Validity::under` normalises every write by the predicate's `temporal` (an event is one moment written at both ends, an eternal fact has no dates), `world_axis` and `read_span` read an event as the bucket it names and an undated event at no moment, an eternal fact at every moment · the prompt marks `[event]` / `[eternal]` and says what to write · no schema change, old rows read correctly · the panel's point rendering and the ontology hint are the UI cut |+| 0031 | [An event holds at the moment it names](0031-an-event-holds-at-the-moment-it-names.md) | Implemented (#486) · `Validity::under` normalises every write by the predicate's `temporal` (an event is one moment written at both ends, an eternal fact has no dates), `world_axis` and `read_span` read an event as the bucket it names and an undated event at no moment, an eternal fact at every moment · the prompt marks `[event]` / `[eternal]` and says what to write · no schema change, old rows read correctly · the panel's point rendering and the ontology hint are the UI cut |## Not a decision record