poc-memory v0.4.0: graph-structured memory with consolidation pipeline
Rust core: - Cap'n Proto append-only storage (nodes + relations) - Graph algorithms: clustering coefficient, community detection, schema fit, small-world metrics, interference detection - BM25 text similarity with Porter stemming - Spaced repetition replay queue - Commands: search, init, health, status, graph, categorize, link-add, link-impact, decay, consolidate-session, etc. Python scripts: - Episodic digest pipeline: daily/weekly/monthly-digest.py - retroactive-digest.py for backfilling - consolidation-agents.py: 3 parallel Sonnet agents - apply-consolidation.py: structured action extraction + apply - digest-link-parser.py: extract ~400 explicit links from digests - content-promotion-agent.py: promote episodic obs to semantic files - bulk-categorize.py: categorize all nodes via single Sonnet call - consolidation-loop.py: multi-round automated consolidation Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
commit
23fac4e5fe
35 changed files with 9388 additions and 0 deletions
86
schema/memory.capnp
Normal file
86
schema/memory.capnp
Normal file
|
|
@ -0,0 +1,86 @@
|
|||
@0xb78d9e3a1c4f6e2d;
|
||||
|
||||
# poc-memory: append-only memory store with graph structure
|
||||
#
|
||||
# Two append-only logs (nodes + relations) are the source of truth.
|
||||
# A derived KV cache merges both, keeping latest version per UUID.
|
||||
# Update = append new version with same UUID + incremented version.
|
||||
# Delete = append with deleted=true. GC compacts monthly.
|
||||
|
||||
struct ContentNode {
|
||||
uuid @0 :Data; # 16 bytes, random
|
||||
version @1 :UInt32; # monotonic per UUID, latest wins
|
||||
timestamp @2 :Float64; # unix epoch
|
||||
nodeType @3 :NodeType;
|
||||
provenance @4 :Provenance;
|
||||
key @5 :Text; # "identity.md#boundaries" human-readable
|
||||
content @6 :Text; # markdown blob
|
||||
weight @7 :Float32;
|
||||
category @8 :Category;
|
||||
emotion @9 :Float32; # max intensity from tags, 0-10
|
||||
deleted @10 :Bool; # soft delete
|
||||
sourceRef @11 :Text; # link to raw experience: "transcript:SESSION_ID:BYTE_OFFSET"
|
||||
|
||||
# Migrated metadata from old system
|
||||
created @12 :Text; # YYYY-MM-DD from old system
|
||||
retrievals @13 :UInt32;
|
||||
uses @14 :UInt32;
|
||||
wrongs @15 :UInt32;
|
||||
stateTag @16 :Text; # cognitive state (warm/open, bright/alert, etc.)
|
||||
|
||||
# Spaced repetition
|
||||
lastReplayed @17 :Float64; # unix epoch
|
||||
spacedRepetitionInterval @18 :UInt32; # days: 1, 3, 7, 14, 30
|
||||
}
|
||||
|
||||
enum NodeType {
|
||||
episodicSession @0;
|
||||
episodicDaily @1;
|
||||
episodicWeekly @2;
|
||||
semantic @3;
|
||||
}
|
||||
|
||||
enum Provenance {
|
||||
manual @0;
|
||||
journal @1;
|
||||
agent @2;
|
||||
dream @3;
|
||||
derived @4;
|
||||
}
|
||||
|
||||
enum Category {
|
||||
general @0;
|
||||
core @1;
|
||||
technical @2;
|
||||
observation @3;
|
||||
task @4;
|
||||
}
|
||||
|
||||
struct Relation {
|
||||
uuid @0 :Data; # 16 bytes, random
|
||||
version @1 :UInt32;
|
||||
timestamp @2 :Float64; # unix epoch
|
||||
source @3 :Data; # content node UUID
|
||||
target @4 :Data; # content node UUID
|
||||
relType @5 :RelationType;
|
||||
strength @6 :Float32; # manual=1.0, auto=0.1-0.7
|
||||
provenance @7 :Provenance;
|
||||
deleted @8 :Bool; # soft delete
|
||||
sourceKey @9 :Text; # human-readable source key (for debugging)
|
||||
targetKey @10 :Text; # human-readable target key (for debugging)
|
||||
}
|
||||
|
||||
enum RelationType {
|
||||
link @0; # bidirectional association (from links= or md links)
|
||||
causal @1; # directed: source caused target
|
||||
auto @2; # auto-discovered
|
||||
}
|
||||
|
||||
# Wrapper for streaming multiple messages in one file
|
||||
struct NodeLog {
|
||||
nodes @0 :List(ContentNode);
|
||||
}
|
||||
|
||||
struct RelationLog {
|
||||
relations @0 :List(Relation);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue