Enforce the anti-split-brain guarantees in the Step 4 memory scaffold (conflict records, promotion gate, freshness) #137

Closed
opened 2026-10-08 13:00:41 +02:00 by clawdie · 1 comment
Owner

Follow-up from the Step 4 memory subsystem scaffold review (PR #136).

The scaffold encodes the memory contract (one logical Store, mandatory
provenance, read-only Oxigraph projection, deterministic Boundary 1 capacity).
It does not yet encode the decision's anti-split-brain guarantees. As
written, the code permits exactly the duplicate-writer / authority-drift
condition the architecture direction forbids.

1. Remember blind-overwrites — no conflict record (highest priority)

store_memory.go Remember does s.records[key] = &recCopy with no conflict
handling. But:

  • docs/plans/LAYERED-MEMORY-AUTHORITY-LIFECYCLE.md defines a Conflict
    record class: "both candidates are preserved with provenance until explicit
    operator resolution."
  • docs/wiki/shared-memory-architecture.md: "a derived fact is not
    automatically promoted into canonical memory."

Today any record (including derivation_method = agent_summary) is promoted
straight into the store, and a second writer clobbers the first.

Expected: when a write targets an existing (tenant, id) with a different
content_hash, preserve both candidates as a conflict record and require an
explicit operator disposition; do not overwrite.

2. Improve silently downgrades provenance

store_memory.go Improve, on a content change without NewProvenance:

clone.Provenance.DerivationMethod = DerivationAgentSummary

So an operator_assertion or direct_observation fact is silently rewritten
as an agent summary, re-hashed and re-timestamped. Authority is changed by an
agent edit with no operator gate.

Related: ProvenanceEnvelope.OperatorApproval exists but Validate() never
requires it for operator_assertion or for overrides.

Expected: authority changes require explicit NewProvenance (and operator
approval where the target was operator-asserted / canonical); keep an
append-only revision trail instead of mutating derivation in place.

3. Freshness is faked

oxigraph.go HTTPOxigraphClient.QueryNodeCapacity stamps:

ObservedAt: time.Now().UTC().Format(time.RFC3339)

That is query time, not the graph's observation time.
docs/wiki/shared-memory-architecture.md requires Colibri to
freshness-check hard factual constraints. A stale projection currently
looks live.

Expected: read observedAt from the graph; add a max-age gate in
BuildBoundary1Envelope that returns MISSING_CAPACITY_EVIDENCE (fail-closed)
when evidence is stale.

Also worth addressing (lower priority)

  • No canonical store. MemoryStore is volatile/in-memory by its own
    docstring. "One canonical system of record" is still unowned.
  • FormatSPARQLTurtle drops provenance (no source_ref /
    derivation_method / content_hash) — if used for ingest, it violates the
    "every projected triple carries provenance" invariant.
  • MemoryKind (episodic/semantic/procedural/mesh_state) is orthogonal to
    the planes (system_skills/system_brain/system_ops) and projections
    (OpenViking/Oxigraph); document the canonical↔projection mapping.
  • Eligibility is RAM-only; ZFSQuotasBytes / Capabilities are fetched
    but unused.

Acceptance

  • Conflict records preserved on divergent writes; explicit operator disposition required.
  • Improve cannot change derivation_method without explicit new provenance (plus operator approval where applicable).
  • Boundary 1 envelope carries real observation time and fails closed on stale evidence.
  • Tests cover each of the above.
Follow-up from the Step 4 memory subsystem scaffold review (PR #136). The scaffold encodes the memory **contract** (one logical `Store`, mandatory provenance, read-only Oxigraph projection, deterministic Boundary 1 capacity). It does **not** yet encode the decision's anti-split-brain *guarantees*. As written, the code permits exactly the duplicate-writer / authority-drift condition the architecture direction forbids. ## 1. `Remember` blind-overwrites — no conflict record (highest priority) `store_memory.go` `Remember` does `s.records[key] = &recCopy` with no conflict handling. But: - `docs/plans/LAYERED-MEMORY-AUTHORITY-LIFECYCLE.md` defines a **Conflict** record class: *"both candidates are preserved with provenance until explicit operator resolution."* - `docs/wiki/shared-memory-architecture.md`: *"a derived fact is not automatically promoted into canonical memory."* Today any record (including `derivation_method = agent_summary`) is promoted straight into the store, and a second writer clobbers the first. **Expected:** when a write targets an existing `(tenant, id)` with a different `content_hash`, preserve both candidates as a conflict record and require an explicit operator disposition; do not overwrite. ## 2. `Improve` silently downgrades provenance `store_memory.go` `Improve`, on a content change without `NewProvenance`: ```go clone.Provenance.DerivationMethod = DerivationAgentSummary ``` So an `operator_assertion` or `direct_observation` fact is silently rewritten as an agent summary, re-hashed and re-timestamped. Authority is changed by an agent edit with no operator gate. Related: `ProvenanceEnvelope.OperatorApproval` exists but `Validate()` never requires it for `operator_assertion` or for overrides. **Expected:** authority changes require explicit `NewProvenance` (and operator approval where the target was operator-asserted / canonical); keep an append-only revision trail instead of mutating derivation in place. ## 3. Freshness is faked `oxigraph.go` `HTTPOxigraphClient.QueryNodeCapacity` stamps: ```go ObservedAt: time.Now().UTC().Format(time.RFC3339) ``` That is *query* time, not the graph's observation time. `docs/wiki/shared-memory-architecture.md` requires Colibri to **freshness-check** hard factual constraints. A stale projection currently looks live. **Expected:** read `observedAt` from the graph; add a max-age gate in `BuildBoundary1Envelope` that returns `MISSING_CAPACITY_EVIDENCE` (fail-closed) when evidence is stale. ## Also worth addressing (lower priority) - **No canonical store.** `MemoryStore` is volatile/in-memory by its own docstring. "One canonical system of record" is still unowned. - **`FormatSPARQLTurtle` drops provenance** (no `source_ref` / `derivation_method` / `content_hash`) — if used for ingest, it violates the "every projected triple carries provenance" invariant. - **`MemoryKind`** (episodic/semantic/procedural/mesh_state) is orthogonal to the planes (`system_skills`/`system_brain`/`system_ops`) and projections (OpenViking/Oxigraph); document the canonical↔projection mapping. - **Eligibility is RAM-only**; `ZFSQuotasBytes` / `Capabilities` are fetched but unused. ## Acceptance - [ ] Conflict records preserved on divergent writes; explicit operator disposition required. - [ ] `Improve` cannot change `derivation_method` without explicit new provenance (plus operator approval where applicable). - [ ] Boundary 1 envelope carries real observation time and fails closed on stale evidence. - [ ] Tests cover each of the above.
Author
Owner

Root cause and terminology fixes tracked as companion items:

  • #138 — retire "split-brain" as a positive architecture name; adopt Tri-Tier Cognitive Gate + Dual-Plane Storage Fabric.
  • #139 — select the canonical store (proposal: SQLite memory.db), which turns the three acceptance criteria below into schema constraints rather than temporary Go mocks.

The guarantees in this issue are the Anti-Split-Brain Guards.

Root cause and terminology fixes tracked as companion items: - **#138** — retire "split-brain" as a positive architecture name; adopt *Tri-Tier Cognitive Gate* + *Dual-Plane Storage Fabric*. - **#139** — select the canonical store (proposal: SQLite `memory.db`), which turns the three acceptance criteria below into schema constraints rather than temporary Go mocks. The guarantees in this issue are the **Anti-Split-Brain Guards**.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
clawdie/colibri#137
No description provided.