feat(memory): Step 4 unified memory contract, Oxigraph client, and Boundary 1 state envelope #136

Merged
clawdie merged 1 commit from feat/step-4-memory-subsystem-scaffold into main 2026-10-08 13:19:47 +02:00
Owner

Summary

Step 4 of the Go migration: the unified internal/memory subsystem — the
logical memory contract, a standardized provenance envelope, the
state.oxigraph client, and the Boundary 1 state envelope builder that grounds
Jev System-1 preflight in deterministic capacity evidence.

Touched: internal/memory/{contract,provenance,envelope,oxigraph,store_memory}.go
(+ tests), docs/wiki/go-migration.md, docs/wiki/jev-transport.md.

Verification (local, on 5cab8d2)

  • go vet ./internal/memory/... — clean
  • go test ./internal/memory/... — ok
  • go test -race ./internal/memory/... — ok (10 tests, 20 incl. subtests)

-race requires CGO_ENABLED=1; a CGO_ENABLED=0 … -race run cannot pass.
Worth correcting the CI description.

How it maps to the architecture direction

Decision doc Realized as
shared-memory-architecture.md: "remember, recall, forget, improve" Store interface (Remember/Recall/Forget/Improve/Get)
Invariant: every fact carries source_ref + derived_at + derivation_method ProvenanceEnvelope (+ SHA-256 content_hash)
state.oxigraph = provenance-bearing projection OxigraphClient (read-only) + MockOxigraphClient
Boundary 1 envelope, HARD_EXHAUSTION BuildBoundary1Envelope — the doc's own 6 GB-vs-4 GB + Ollama prototype, materialized
"agents reach memory via Colibri, not Oxy directly" Store is the contract; Oxy is read-only

This is a faithful encoding of the memory contract, and the first real code
for the split-brain direction.

Review: the anti-split-brain guardrails are not yet enforced

The decision's spine is "separate roles and planes, but one canonical record;
projections never become truth."
This PR builds the separation and leaves
"one canonical record" as an in-memory mock — while making clobbering and
authority-downgrade the default:

  1. No canonical store — MemoryStore is volatile ("unit tests, local
    volatile caching, memory projection mocks").
  2. Remember blind-overwrites — no conflict record (contra
    LAYERED-MEMORY-AUTHORITY-LIFECYCLE.md's Conflict class and the
    "no auto-promotion" invariant).
  3. Improve silently sets DerivationMethod = DerivationAgentSummary on
    a content change.
  4. OperatorApproval is defined but never required.
  5. Freshness faked — ObservedAt = time.Now() instead of the graph's
    observation time.
  6. FormatSPARQLTurtle drops provenance.
  7. MemoryKind is a third taxonomy, unmapped to planes.
  8. Eligibility is RAM-only; ZFS/CPU/capabilities unused.

Verdict

Right shape around an unfilled center: it implements the contract half of
the decision and none of its guardrails. Mergeable as a scaffold if we are
explicit that the anti-split-brain guarantees are pending — otherwise it lets
two writers clobber each other and lets an agent edit silently downgrade
operator-asserted authority.

Follow-up

Tracked in #137: conflict records, the promotion/authority gate, and real
freshness.

## Summary Step 4 of the Go migration: the unified `internal/memory` subsystem — the logical memory contract, a standardized provenance envelope, the `state.oxigraph` client, and the Boundary 1 state envelope builder that grounds Jev System-1 preflight in deterministic capacity evidence. Touched: `internal/memory/{contract,provenance,envelope,oxigraph,store_memory}.go` (+ tests), `docs/wiki/go-migration.md`, `docs/wiki/jev-transport.md`. ## Verification (local, on `5cab8d2`) - `go vet ./internal/memory/...` — clean - `go test ./internal/memory/...` — ok - `go test -race ./internal/memory/...` — ok (10 tests, 20 incl. subtests) > `-race` requires `CGO_ENABLED=1`; a `CGO_ENABLED=0 … -race` run cannot pass. > Worth correcting the CI description. ## How it maps to the architecture direction | Decision doc | Realized as | | --- | --- | | `shared-memory-architecture.md`: "remember, recall, forget, improve" | `Store` interface (`Remember/Recall/Forget/Improve/Get`) | | Invariant: every fact carries `source_ref` + `derived_at` + `derivation_method` | `ProvenanceEnvelope` (+ SHA-256 `content_hash`) | | `state.oxigraph` = provenance-bearing projection | `OxigraphClient` (read-only) + `MockOxigraphClient` | | Boundary 1 envelope, `HARD_EXHAUSTION` | `BuildBoundary1Envelope` — the doc's own 6 GB-vs-4 GB + Ollama prototype, materialized | | "agents reach memory via Colibri, not Oxy directly" | Store is the contract; Oxy is read-only | This is a faithful encoding of the memory **contract**, and the first real code for the split-brain direction. ## Review: the anti-split-brain guardrails are not yet enforced The decision's spine is *"separate roles and planes, but one canonical record; projections never become truth."* This PR builds the separation and leaves "one canonical record" as an in-memory mock — while making clobbering and authority-downgrade the default: 1. **No canonical store** — `MemoryStore` is volatile ("unit tests, local volatile caching, memory projection mocks"). 2. **`Remember` blind-overwrites** — no conflict record (contra `LAYERED-MEMORY-AUTHORITY-LIFECYCLE.md`'s Conflict class and the "no auto-promotion" invariant). 3. **`Improve` silently sets `DerivationMethod = DerivationAgentSummary`** on a content change. 4. **`OperatorApproval` is defined but never required.** 5. **Freshness faked** — `ObservedAt = time.Now()` instead of the graph's observation time. 6. **`FormatSPARQLTurtle` drops provenance.** 7. **`MemoryKind`** is a third taxonomy, unmapped to planes. 8. **Eligibility is RAM-only**; ZFS/CPU/capabilities unused. ## Verdict Right shape around an unfilled center: it implements the **contract** half of the decision and none of its **guardrails**. Mergeable as a scaffold if we are explicit that the anti-split-brain guarantees are pending — otherwise it lets two writers clobber each other and lets an agent edit silently downgrade operator-asserted authority. ## Follow-up Tracked in #137: conflict records, the promotion/authority gate, and real freshness.
feat(memory): implement unified memory contract, oxigraph client, and boundary 1 state envelope
Some checks failed
CI / markdown (pull_request) Successful in 9s
CI / port (pull_request) Successful in 1s
CI / agent-jail-pkgs (pull_request) Successful in 1s
CI / python-tests (pull_request) Successful in 14s
CI / go (pull_request) Successful in 26s
format-check / prettier (pull_request) Successful in 5s
leak-guard / guard (pull_request) Successful in 17s
ci-gate / gate (pull_request) Has been cancelled
5cab8d25ad
- Implement Logical Memory Contract across cognitive kinds (Episodic, Semantic, Procedural, MeshState) with thread-safe in-memory store and tenant isolation
- Implement Standardized Provenance Envelope with SHA-256 verification and tamper detection
- Implement Oxigraph client interface with SPARQL 1.1 JSON parsing and deterministic MockOxigraphClient
- Implement Boundary 1 State Envelope builder compiling node capacity, active daemons, and fail-closed deterministic resource headroom
- Add unit tests across all memory components; verified clean with -race, pure Go (CGO_ENABLED=0), and FreeBSD cross-compilation
- Update go-migration.md and jev-transport.md formatting
clawdie deleted branch feat/step-4-memory-subsystem-scaffold 2026-10-08 13:19:47 +02:00
Sign in to join this conversation.
No reviewers
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!136
No description provided.