memory

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package memory implements RiskKernel's git-native memory layer: a user-owned directory of markdown/YAML/text files the agent reads. The files are yours — version them in git, edit them in your editor; RiskKernel only reads them.

Retrieval is deterministic: list, read, and keyword search. There is NO embedding index / vector DB in v0.1 (CLAUDE.md §9) — semantic search is a future opt-in. Reads are path-traversal-safe: a request can never escape the root.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("memory: not found")

ErrNotFound is returned when a memory entry does not exist.

View Source
var ErrUnsafePath = errors.New("memory: unsafe path")

ErrUnsafePath is returned when a name would escape the memory root.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Namespace   string    `json:"namespace"`
	Name        string    `json:"name"` // path relative to the namespace
	Title       string    `json:"title"`
	Description string    `json:"description,omitempty"`
	Format      string    `json:"format"` // markdown | yaml | text
	Size        int64     `json:"size"`
	ModTime     time.Time `json:"modTime"`
}

Entry is a memory file's metadata.

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

Reader reads a configured memory root directory.

func NewReader

func NewReader(dir string) *Reader

NewReader returns a Reader rooted at dir.

func (*Reader) List

func (r *Reader) List(namespace string) ([]Entry, error)

List returns the memory entries under namespace (recursively). A missing directory yields an empty list, not an error.

func (*Reader) Read

func (r *Reader) Read(namespace, name string) (string, Entry, error)

Read returns the content and metadata of a memory entry. The name may omit the file extension (e.g. "runbook" resolves to "runbook.md").

func (*Reader) Root

func (r *Reader) Root() string

Root returns the configured memory root.

func (*Reader) Search

func (r *Reader) Search(namespace, query string) ([]Entry, error)

Search returns entries in a namespace whose title, name, or content contains the (case-insensitive) query. Deterministic keyword search — no embeddings.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL