Skip to content

feat(ring-sr-mem-00): GOLD IV memory-types Β· closes #449 - #477

Merged
gHashTag merged 1 commit into
mainfrom
ring-446-sr-mem-00-memory-types
May 2, 2026
Merged

gHashTag merged 1 commit into
mainfrom
ring-446-sr-mem-00-memory-types

Conversation

@gHashTag

@gHashTag gHashTag commented May 2, 2026

Copy link
Copy Markdown
Collaborator

SR-MEM-00 β€” Memory Types (anti-amnesia foundation)

Closes #449 Β· Part of #446 Β· No blockers (independent GOLD IV thread)

Soul-name: Memory Mason Β· Codename: LEAD Β· Tier: πŸ₯‰ Bronze Β· Kingdom: Rust

What landed

Bottom of the GOLD IV dependency graph. Every backend (Neon lessons, trios-kg, zig-knowledge-graph, HDC episodic agents) speaks the same Triple/TripleId/Provenance/ForgetPolicy/AgentRole/MemoryKind shape.

Public types

Type Wire-format role
TripleId([u8; 32]) content-addressed SHA-256 of subject || predicate || object (lowercase-hex JSON, length 64)
AgentRole Scarab/Gardener/Trainer/Doctor/Claude/Lead (snake_case)
MemoryKind Working/Session/LongTerm/Episodic/Semantic
ForgetPolicy tagged: GdprByAgent{agent} / AgeOlderThan{duration} / PredicateMatches{predicate}
Provenance agent_id, task_id (UUID), source_sha (TripleId), ts
Triple id, subject, predicate, object, provenance

Content-addressed idempotent insert

TripleId::from_triple(s, p, o) = SHA-256(s || p || o) β€” two calls with identical inputs always produce the same id. Triple::new() derives id from SPO, so re-inserting the same triple with the same provenance is byte-equal. Proven by triple_id_is_content_addressed + triple_idempotent_insert tests.

Tests (15/15 GREEN)

TripleId (5), AgentRole + MemoryKind (3), ForgetPolicy (3), Provenance (1), Triple (3).

Compliance

L1 βœ“ Β· L3 βœ“ Β· L4 βœ“ Β· L6 βœ“ Β· L13 βœ“ Β· L14 βœ“ Β· R-RING-DEP-002 βœ“ (serde + serde_json + uuid + chrono + sha2) Β· R-RING-FACADE-001 βœ“ Β· I5 βœ“

Agent: Memory-Mason

Adds trios-agent-memory/SR-MEM-00 β€” anti-amnesia foundation. Pure
serde + SHA-256 content addressing, no I/O. Bottom of GOLD IV
dependency graph.

## Public types

- TripleId([u8; 32]) β€” SHA-256 of subject||predicate||object, hex64 JSON
- AgentRole β€” Scarab/Gardener/Trainer/Doctor/Claude/Lead (snake_case)
- MemoryKind β€” Working/Session/LongTerm/Episodic/Semantic
- ForgetPolicy β€” tagged: GdprByAgent{agent} / AgeOlderThan{duration} / PredicateMatches{predicate}
- Provenance { agent_id, task_id (UUID), source_sha (TripleId), ts }
- Triple { id, subject, predicate, object, provenance } + Triple::new() builder

## Content-addressed insert

TripleId::from_triple(s, p, o) = SHA-256(s || p || o).
Two calls with identical inputs always produce the same id β€” proven
idempotent. Every backend (Neon lessons, trios-kg, zig-knowledge-graph,
HDC) can use it as PK without coordination.

## Tests (15/15 GREEN)

- triple_id_is_content_addressed (same SPO β‡’ same id)
- triple_id_distinguishes_inputs (different SPO β‡’ different id)
- triple_id_serialises_as_hex64
- triple_id_rejects_wrong_length (31-byte hex fails)
- triple_id_display_lowercase_hex
- agent_role_serialises_snake_case
- memory_kind_roundtrip (every variant)
- memory_kind_long_term_is_snake_case
- forget_policy_gdpr_roundtrip (tagged kind)
- forget_policy_age_serializes_as_seconds
- forget_policy_predicate_roundtrip
- provenance_roundtrip
- triple_new_computes_id (builder derives correct id)
- triple_idempotent_insert (byte-equality on re-build)
- triple_full_roundtrip

## Compliance

- L1/L3/L4/L6/L13/L14 βœ“
- R-RING-DEP-002 βœ“ deps = serde + serde_json + uuid + chrono + sha2
- R-RING-FACADE-001 βœ“ outer src/lib.rs re-exports only
- I5 βœ“

🌻 phi^2 + phi^-2 = 3 · TRINITY · GOLD IV bottom · anti-amnesia

Soul-name: Memory Mason
Closes #449
Part of #446

Agent: Memory-Mason
@gHashTag
gHashTag merged commit 890f45b into main May 2, 2026
4 of 7 checks passed
@gHashTag
gHashTag deleted the ring-446-sr-mem-00-memory-types branch May 2, 2026 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

πŸ₯‰ [SR-MEM-00] memory-types β€” anti-amnesia foundation (GOLD IV bottom)

1 participant