[RAGE 001] Durable memory_remember + memory_get vertical slice #1

Closed
opened 2026-08-31 18:45:56 +00:00 by lost-rob0t · 2 comments
lost-rob0t commented 2026-08-31 18:45:56 +00:00 (Migrated from github.com)

Human gate

All research documents 001–012 are approved for implementation by the human operator. The durable gate is research/IMPLEMENTATION-APPROVAL-2026-08-31.org.

This is the only implementation slice to pick up right now. Do not widen into recall/search/forget/rule evolution yet.

Goal

Build the first executable end-to-end symbolic-memory path:

native memory_remember request
        ↓
resolve caller + namespace
        ↓
authorize write
        ↓
atomically persist exact source + metadata + audit event
        ↓
return stable memory ID
        ↓
memory_get(id) returns the exact stored source and metadata

Prolog owns memory semantics, scope, authority decisions, IDs/domain records, and storage abstraction. Any MCP/transport layer is a thin adapter.

Required research inputs

At minimum consume these approved docs:

  • research/SYMBOLIC-MEMORY-RESEARCH-001-tiered-symbolic-memory.org
  • research/SYMBOLIC-MEMORY-RESEARCH-005-mcp-contract-and-authority.org
  • research/SYMBOLIC-MEMORY-RESEARCH-006-persistence-and-concurrency.org
  • research/SYMBOLIC-MEMORY-RESEARCH-009-memory-poisoning-and-trust-boundaries.org
  • research/SYMBOLIC-MEMORY-RESEARCH-010-project-identity-and-namespace-model.org
  • research/SYMBOLIC-MEMORY-RESEARCH-012-explicit-remember-durability.org

Use the remaining approved research as invariant/background context where relevant.

Implementation requirements

1. Library-first SWI-Prolog core

Create a small, testable Prolog library before transport glue. Keep modules narrow; suggested responsibilities are domain/model, namespace resolution, authority policy, storage adapter, bootstrap persistent backend, audit, and public API.

Do not expose arbitrary assertz/1, retract/1, consult/1, shell, filesystem, or network execution as model tools.

2. memory_remember

Minimal model-facing input:

{"memory":"Use Prolog as the authority for this project."}

Host-bound context must carry principal/capabilities and project/session hints outside the natural-language memory text.

Default semantics:

  • explicit remember means durable source intent;
  • preserve the supplied UTF-8 source text byte-for-byte / codepoint-for-codepoint as the authoritative source value;
  • project scope when the host resolves a current project;
  • no silent project→global fallback;
  • stable opaque memory ID returned immediately after durable commit;
  • source persistence success is distinct from later symbolic-projection success;
  • untrusted/model-inferred content may be stored as evidence without becoming high-authority semantic truth.

Do not require symbolic extraction or an LLM for this slice. A memory with zero projections is valid.

3. memory_get

Implement ID-based retrieval sufficient to prove the write contract. It must return at least:

  • stable memory ID;
  • exact original source text;
  • resolved namespace/scope;
  • lifetime/retention;
  • source/provenance;
  • principal/actor metadata;
  • trust classification;
  • created timestamp;
  • record version;
  • current lifecycle state.

memory_get must enforce read authority; knowing an ID is not authorization.

4. Namespace identity

Implement the minimum correct namespace model, not path-as-identity.

Required:

  • stable opaque project ID;
  • explicit project ID wins;
  • canonical repository remote may resolve an existing project;
  • local path may be stored as an alias/hint only;
  • ambiguous or failed project resolution is explicit;
  • global is a distinct namespace and never a resolution fallback;
  • project resolution and authorization are separate operations.

It is okay to defer shared namespaces and sophisticated remote normalization as long as the interface does not preclude them.

5. Authority + trust

Make both explicit from v1.

At minimum support capabilities equivalent to:

  • memory read;
  • session write;
  • current-project write;
  • global write as a separate capability.

Tests must prove a principal with project-write authority cannot write global memory.

Trust/provenance is data carried by the record and policy; it is not inferred from the memory text.

6. Storage adapter

Define the backend-neutral storage boundary now. The bootstrap backend may use SWI library(persistency) as approved research recommends.

The public/domain API must not depend on persistency-specific predicates.

Document the bootstrap as single-process if needed. Compound mutations must be serialized/atomic at the domain boundary.

A successful remember transaction must make the following visible together or not at all:

  • source record;
  • memory record/version;
  • namespace linkage;
  • append-only audit event.

Do not claim database-grade multi-process guarantees from library(persistency).

7. Audit

Every write records an append-only event including at least:

  • event ID;
  • timestamp;
  • actor/principal;
  • operation;
  • resolved namespace;
  • target memory ID;
  • provenance/source class;
  • authorization result or authorizing capability/policy;
  • previous/new version where applicable.

8. MCP/native-tool smoke path

Expose memory_remember and memory_get through the project's intended native MCP surface using a thin adapter over the Prolog API.

Do not put semantics in the transport layer. If dependency/library selection for MCP needs a tiny research spike, keep it bounded to this issue and record the choice in the PR; do not restart the whole research program.

9. Nix/dev ergonomics

Add a Nix flake/dev shell so a fresh checkout can run the implementation and tests with SWI-Prolog available reproducibly.

Do not add GitHub Actions as part of this slice.

Required tests

Use PlUnit for domain invariants. Add integration/smoke coverage for the external tool surface.

Must cover at least:

  1. explicit remember returns a stable opaque ID;
  2. exact source text round-trips unchanged through remember → get;
  3. memory remains readable after storage close/reopen/restart simulation;
  4. project A memory is not readable from project B without authority;
  5. unresolved project does not silently write global;
  6. project-write capability cannot write global;
  7. caller without read authority cannot memory_get a known ID;
  8. audit event is emitted for successful write;
  9. failed authorization does not leave a partial durable memory;
  10. two distinct explicit remembers receive distinct IDs;
  11. duplicate text is not silently conflated into one memory unless an explicit dedup policy is implemented and tested;
  12. model/external provenance does not automatically become user/system trust;
  13. MCP/native smoke test can remember and then get the same exact source.

Out of scope

Do not implement in this slice:

  • memory_search;
  • memory_recall;
  • prose adequacy/fallback compiler;
  • natural-language forgetting;
  • vector/embedding retrieval;
  • consolidation background workers;
  • temporal supersession beyond the lifecycle/version fields needed by the base record;
  • contradiction resolution;
  • rule proposal/activation/self-optimization;
  • SQLite/RocksDB migration;
  • unrestricted symbolic query tools.

Leave extension points, not half-built features.

Definition of done

  • implementation is on a focused rage/ branch and submitted as a PR;
  • nix flake check (or the repo's equivalent flake test gate) passes locally;
  • all PlUnit tests pass locally;
  • external MCP/native smoke test passes locally;
  • restart durability test passes;
  • no project/global isolation regression;
  • no hidden dependence on an LLM/provider/API key;
  • README gains concise run/test/tool examples;
  • PR describes storage guarantees honestly and lists deferred work;
  • issue is not closed on code presence alone: tests and the end-to-end remember/get path must be green.

Auto-RAGE execution rule

Implement → run tests → inspect failures → repair → rerun until green. Keep the scope fixed. If a design ambiguity is not required for this vertical slice, defer it instead of widening the issue.

## Human gate All research documents 001–012 are approved for implementation by the human operator. The durable gate is `research/IMPLEMENTATION-APPROVAL-2026-08-31.org`. This is the **only implementation slice to pick up right now**. Do not widen into recall/search/forget/rule evolution yet. ## Goal Build the first executable end-to-end symbolic-memory path: ```text native memory_remember request ↓ resolve caller + namespace ↓ authorize write ↓ atomically persist exact source + metadata + audit event ↓ return stable memory ID ↓ memory_get(id) returns the exact stored source and metadata ``` Prolog owns memory semantics, scope, authority decisions, IDs/domain records, and storage abstraction. Any MCP/transport layer is a thin adapter. ## Required research inputs At minimum consume these approved docs: - `research/SYMBOLIC-MEMORY-RESEARCH-001-tiered-symbolic-memory.org` - `research/SYMBOLIC-MEMORY-RESEARCH-005-mcp-contract-and-authority.org` - `research/SYMBOLIC-MEMORY-RESEARCH-006-persistence-and-concurrency.org` - `research/SYMBOLIC-MEMORY-RESEARCH-009-memory-poisoning-and-trust-boundaries.org` - `research/SYMBOLIC-MEMORY-RESEARCH-010-project-identity-and-namespace-model.org` - `research/SYMBOLIC-MEMORY-RESEARCH-012-explicit-remember-durability.org` Use the remaining approved research as invariant/background context where relevant. ## Implementation requirements ### 1. Library-first SWI-Prolog core Create a small, testable Prolog library before transport glue. Keep modules narrow; suggested responsibilities are domain/model, namespace resolution, authority policy, storage adapter, bootstrap persistent backend, audit, and public API. Do **not** expose arbitrary `assertz/1`, `retract/1`, `consult/1`, shell, filesystem, or network execution as model tools. ### 2. `memory_remember` Minimal model-facing input: ```json {"memory":"Use Prolog as the authority for this project."} ``` Host-bound context must carry principal/capabilities and project/session hints outside the natural-language memory text. Default semantics: - explicit remember means durable source intent; - preserve the supplied UTF-8 source text byte-for-byte / codepoint-for-codepoint as the authoritative source value; - project scope when the host resolves a current project; - no silent project→global fallback; - stable opaque memory ID returned immediately after durable commit; - source persistence success is distinct from later symbolic-projection success; - untrusted/model-inferred content may be stored as evidence without becoming high-authority semantic truth. Do not require symbolic extraction or an LLM for this slice. A memory with zero projections is valid. ### 3. `memory_get` Implement ID-based retrieval sufficient to prove the write contract. It must return at least: - stable memory ID; - exact original source text; - resolved namespace/scope; - lifetime/retention; - source/provenance; - principal/actor metadata; - trust classification; - created timestamp; - record version; - current lifecycle state. `memory_get` must enforce read authority; knowing an ID is not authorization. ### 4. Namespace identity Implement the minimum correct namespace model, not path-as-identity. Required: - stable opaque project ID; - explicit project ID wins; - canonical repository remote may resolve an existing project; - local path may be stored as an alias/hint only; - ambiguous or failed project resolution is explicit; - global is a distinct namespace and never a resolution fallback; - project resolution and authorization are separate operations. It is okay to defer shared namespaces and sophisticated remote normalization as long as the interface does not preclude them. ### 5. Authority + trust Make both explicit from v1. At minimum support capabilities equivalent to: - memory read; - session write; - current-project write; - global write as a separate capability. Tests must prove a principal with project-write authority cannot write global memory. Trust/provenance is data carried by the record and policy; it is not inferred from the memory text. ### 6. Storage adapter Define the backend-neutral storage boundary now. The bootstrap backend may use SWI `library(persistency)` as approved research recommends. The public/domain API must not depend on persistency-specific predicates. Document the bootstrap as single-process if needed. Compound mutations must be serialized/atomic at the domain boundary. A successful remember transaction must make the following visible together or not at all: - source record; - memory record/version; - namespace linkage; - append-only audit event. Do not claim database-grade multi-process guarantees from `library(persistency)`. ### 7. Audit Every write records an append-only event including at least: - event ID; - timestamp; - actor/principal; - operation; - resolved namespace; - target memory ID; - provenance/source class; - authorization result or authorizing capability/policy; - previous/new version where applicable. ### 8. MCP/native-tool smoke path Expose `memory_remember` and `memory_get` through the project's intended native MCP surface using a thin adapter over the Prolog API. Do not put semantics in the transport layer. If dependency/library selection for MCP needs a tiny research spike, keep it bounded to this issue and record the choice in the PR; do not restart the whole research program. ### 9. Nix/dev ergonomics Add a Nix flake/dev shell so a fresh checkout can run the implementation and tests with SWI-Prolog available reproducibly. Do not add GitHub Actions as part of this slice. ## Required tests Use PlUnit for domain invariants. Add integration/smoke coverage for the external tool surface. Must cover at least: 1. explicit remember returns a stable opaque ID; 2. exact source text round-trips unchanged through remember → get; 3. memory remains readable after storage close/reopen/restart simulation; 4. project A memory is not readable from project B without authority; 5. unresolved project does not silently write global; 6. project-write capability cannot write global; 7. caller without read authority cannot `memory_get` a known ID; 8. audit event is emitted for successful write; 9. failed authorization does not leave a partial durable memory; 10. two distinct explicit remembers receive distinct IDs; 11. duplicate text is not silently conflated into one memory unless an explicit dedup policy is implemented and tested; 12. model/external provenance does not automatically become user/system trust; 13. MCP/native smoke test can remember and then get the same exact source. ## Out of scope Do **not** implement in this slice: - `memory_search`; - `memory_recall`; - prose adequacy/fallback compiler; - natural-language forgetting; - vector/embedding retrieval; - consolidation background workers; - temporal supersession beyond the lifecycle/version fields needed by the base record; - contradiction resolution; - rule proposal/activation/self-optimization; - SQLite/RocksDB migration; - unrestricted symbolic query tools. Leave extension points, not half-built features. ## Definition of done - implementation is on a focused `rage/` branch and submitted as a PR; - `nix flake check` (or the repo's equivalent flake test gate) passes locally; - all PlUnit tests pass locally; - external MCP/native smoke test passes locally; - restart durability test passes; - no project/global isolation regression; - no hidden dependence on an LLM/provider/API key; - README gains concise run/test/tool examples; - PR describes storage guarantees honestly and lists deferred work; - issue is not closed on code presence alone: tests and the end-to-end remember/get path must be green. ## Auto-RAGE execution rule Implement → run tests → inspect failures → repair → rerun until green. Keep the scope fixed. If a design ambiguity is not required for this vertical slice, defer it instead of widening the issue.
lost-rob0t commented 2026-08-31 19:10:32 +00:00 (Migrated from github.com)

Implementation is now on draft PR #2 from rage/001-remember-get.

The remember/get vertical slice, namespace/authority/trust boundaries, single-process durable storage adapter, audit path, modern + legacy MCP adapter, Nix flake, and regression tests are implemented.

Not closing this issue yet. The current ChatGPT execution environment does not provide swipl or nix, so the authored suite has not been executed here. PR #2 stays draft until nix flake check (or at minimum nix develop --command swipl -q -s test/run_tests.pl) is actually green.

Implementation is now on draft PR #2 from `rage/001-remember-get`. The remember/get vertical slice, namespace/authority/trust boundaries, single-process durable storage adapter, audit path, modern + legacy MCP adapter, Nix flake, and regression tests are implemented. **Not closing this issue yet.** The current ChatGPT execution environment does not provide `swipl` or `nix`, so the authored suite has not been executed here. PR #2 stays draft until `nix flake check` (or at minimum `nix develop --command swipl -q -s test/run_tests.pl`) is actually green.
Owner

Reconciled into library-first core graph

This remains Slice 01 / the first executable vertical under parent #11 and foundation epic #12.

Do not widen #1 to implement the later world-model program. The immediate continuation after #1 is:

#20 library facade/store/backend SPI
 -> #21 namespace/principal/authority/trust/audit hardening
 -> #22 semantic compiler adapter/projection lifecycle
 -> #23 append-only full semantic-IR commit protocol

#1's source durability invariant remains foundational: exact source success is independent of semantic projection success.

## Reconciled into library-first core graph This remains **Slice 01 / the first executable vertical** under parent #11 and foundation epic #12. Do not widen #1 to implement the later world-model program. The immediate continuation after #1 is: ```text #20 library facade/store/backend SPI -> #21 namespace/principal/authority/trust/audit hardening -> #22 semantic compiler adapter/projection lifecycle -> #23 append-only full semantic-IR commit protocol ``` #1's source durability invariant remains foundational: exact source success is independent of semantic projection success.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
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
nsaspy/symbolic-memory#1
No description provided.