Documentation
¶
Overview ¶
Package layers holds LadyM's five memory layers (L0–L4).
Index ¶
- func PlaybookContent(name string, steps []string) string
- type AssociativeMemory
- func (a *AssociativeMemory) Link(srcID, dstID, relation string, weight *float64, metadata map[string]any, ...) (*schema.Edge, error)
- func (a *AssociativeMemory) NeighborCounts() (map[string]int, error)
- func (a *AssociativeMemory) Neighbors(memID, relation string) ([]*schema.Edge, error)
- func (a *AssociativeMemory) Retire(edgeID string, when *float64) error
- type EpisodicMemory
- type ProceduralMemory
- type SemanticMemory
- func (s *SemanticMemory) FindByHash(h string) (*schema.Memory, error)
- func (s *SemanticMemory) PutCodeFile(filePath, summary, language string) (*schema.Memory, error)
- func (s *SemanticMemory) PutFact(content, summary string, tags []string, metadata map[string]any, source string) (*schema.Memory, error)
- type WorkingMemory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PlaybookContent ¶
PlaybookContent is the canonical content string for a playbook — the single source of truth shared by PutPlaybook and proceduralize. Matches Python “name + "\n" + "\n".join(steps)“: empty steps keeps the trailing newline; non-empty steps end without one.
Types ¶
type AssociativeMemory ¶
type AssociativeMemory struct {
Store *storage.SQLiteStore
}
AssociativeMemory is L4 — the Zettelkasten graph.
func NewAssociativeMemory ¶
func NewAssociativeMemory(store *storage.SQLiteStore) *AssociativeMemory
NewAssociativeMemory builds an AssociativeMemory.
func (*AssociativeMemory) Link ¶
func (a *AssociativeMemory) Link(srcID, dstID, relation string, weight *float64, metadata map[string]any, validFrom, validTo *float64) (*schema.Edge, error)
Link creates an edge between two memories. A nil weight defaults to 1.0; an explicitly supplied weight (including 0) is stored verbatim.
func (*AssociativeMemory) NeighborCounts ¶
func (a *AssociativeMemory) NeighborCounts() (map[string]int, error)
NeighborCounts returns {memory_id: neighbour_count}.
type EpisodicMemory ¶
type EpisodicMemory struct {
Store *storage.SQLiteStore
Embedder storage.EmbeddingProvider
Workspace string
}
EpisodicMemory is L1 — time-stamped events.
func NewEpisodicMemory ¶
func NewEpisodicMemory(store *storage.SQLiteStore, embedder storage.EmbeddingProvider, workspace string) *EpisodicMemory
NewEpisodicMemory builds an EpisodicMemory.
type ProceduralMemory ¶
type ProceduralMemory struct {
Store *storage.SQLiteStore
Embedder storage.EmbeddingProvider
Workspace string
}
ProceduralMemory is L3 — reusable playbooks and verified snippets.
func NewProceduralMemory ¶
func NewProceduralMemory(store *storage.SQLiteStore, embedder storage.EmbeddingProvider, workspace string) *ProceduralMemory
NewProceduralMemory builds a ProceduralMemory.
func (*ProceduralMemory) PutPlaybook ¶
func (p *ProceduralMemory) PutPlaybook(name string, steps []string, preconditions []string, expectedOutcome string, tags []string) (*schema.Memory, error)
PutPlaybook writes a playbook.
func (*ProceduralMemory) PutSnippet ¶
func (p *ProceduralMemory) PutSnippet(title, code, language string, tags []string) (*schema.Memory, error)
PutSnippet writes a verified code snippet.
type SemanticMemory ¶
type SemanticMemory struct {
Store *storage.SQLiteStore
Embedder storage.EmbeddingProvider
Workspace string
}
SemanticMemory is L2 — consolidated facts and codebase analysis.
func NewSemanticMemory ¶
func NewSemanticMemory(store *storage.SQLiteStore, embedder storage.EmbeddingProvider, workspace string) *SemanticMemory
NewSemanticMemory builds a SemanticMemory.
func (*SemanticMemory) FindByHash ¶
func (s *SemanticMemory) FindByHash(h string) (*schema.Memory, error)
FindByHash returns the memory with the given content hash.
func (*SemanticMemory) PutCodeFile ¶
func (s *SemanticMemory) PutCodeFile(filePath, summary, language string) (*schema.Memory, error)
PutCodeFile writes a whole-file summary as L2 code memory.
type WorkingMemory ¶
type WorkingMemory struct {
// contains filtered or unexported fields
}
WorkingMemory is a thread-safe bounded buffer of L0 notes.
func NewWorkingMemory ¶
func NewWorkingMemory(capacity int, workspace string) *WorkingMemory
NewWorkingMemory returns a WorkingMemory of the given capacity.
func (*WorkingMemory) Drain ¶
func (w *WorkingMemory) Drain() []*schema.Memory
Drain pops and returns all items (used by consolidate to flush L0 → L1).
func (*WorkingMemory) Items ¶
func (w *WorkingMemory) Items() []*schema.Memory
Items returns a snapshot of the buffered items.
func (*WorkingMemory) Len ¶
func (w *WorkingMemory) Len() int
Len returns the number of buffered items.