flatten: move poc-memory contents to workspace root
No more subcrate nesting — src/, agents/, schema/, defaults/, build.rs all live at the workspace root. poc-daemon remains as the only workspace member. Crate name (poc-memory) and all imports unchanged. Co-Authored-By: Proof of Concept <poc@bcachefs.org>
This commit is contained in:
parent
891cca57f8
commit
998b71e52c
113 changed files with 79 additions and 78 deletions
139
schema/memory.capnp
Normal file
139
schema/memory.capnp
Normal file
|
|
@ -0,0 +1,139 @@
|
|||
@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 :Int64; # unix epoch seconds
|
||||
nodeType @3 :NodeType;
|
||||
provenanceOld @4 :Provenance; # deprecated — use provenance (@21)
|
||||
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 :Int64; # unix epoch seconds
|
||||
spacedRepetitionInterval @18 :UInt32; # days: 1, 3, 7, 14, 30
|
||||
|
||||
# Section ordering within a file
|
||||
position @19 :UInt32; # 0 = file-level, 1+ = section index
|
||||
|
||||
# Stable creation timestamp (unix epoch seconds). Set once when the
|
||||
# node is first created; never changes on rename or content update.
|
||||
createdAt @20 :Int64;
|
||||
|
||||
# Freeform provenance string: "extractor:write", "rename:tombstone", etc.
|
||||
provenance @21 :Text;
|
||||
|
||||
}
|
||||
|
||||
enum NodeType {
|
||||
episodicSession @0;
|
||||
episodicDaily @1;
|
||||
episodicWeekly @2;
|
||||
semantic @3;
|
||||
episodicMonthly @4;
|
||||
}
|
||||
|
||||
enum Provenance {
|
||||
manual @0;
|
||||
journal @1;
|
||||
agent @2; # legacy catch-all
|
||||
dream @3;
|
||||
derived @4;
|
||||
agentExperienceMine @5;
|
||||
agentKnowledgeObservation @6;
|
||||
agentKnowledgePattern @7;
|
||||
agentKnowledgeConnector @8;
|
||||
agentKnowledgeChallenger @9;
|
||||
agentConsolidate @10;
|
||||
agentDigest @11;
|
||||
agentFactMine @12;
|
||||
agentDecay @13;
|
||||
}
|
||||
|
||||
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 :Int64; # unix epoch seconds
|
||||
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
|
||||
provenanceOld @7 :Provenance; # deprecated — use provenance (@11)
|
||||
deleted @8 :Bool; # soft delete
|
||||
sourceKey @9 :Text; # human-readable source key (for debugging)
|
||||
targetKey @10 :Text; # human-readable target key (for debugging)
|
||||
provenance @11 :Text; # freeform provenance string
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
# Agent visit tracking — separate append-only log.
|
||||
# Records when an agent successfully processed a node.
|
||||
# Used to deprioritize recently-visited nodes in agent selection.
|
||||
|
||||
struct AgentVisit {
|
||||
nodeUuid @0 :Data; # 16 bytes — which node
|
||||
nodeKey @1 :Text; # human-readable key (for debugging)
|
||||
agent @2 :Text; # agent type: "linker", "rename", "replay", etc.
|
||||
timestamp @3 :Int64; # unix epoch seconds
|
||||
outcome @4 :Text; # "processed", "skipped", "modified" — optional detail
|
||||
}
|
||||
|
||||
struct AgentVisitLog {
|
||||
visits @0 :List(AgentVisit);
|
||||
}
|
||||
|
||||
# Transcript mining progress — separate append-only log.
|
||||
# Tracks which segments of which transcripts have been processed,
|
||||
# by which agent, so we never re-mine the same content.
|
||||
|
||||
struct TranscriptSegment {
|
||||
transcriptId @0 :Text; # session UUID (filename stem)
|
||||
segmentIndex @1 :UInt32; # compaction segment index within transcript
|
||||
agent @2 :Text; # "observation", "experience", "fact"
|
||||
timestamp @3 :Int64; # unix epoch seconds when mining completed
|
||||
}
|
||||
|
||||
struct TranscriptProgressLog {
|
||||
segments @0 :List(TranscriptSegment);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue