memory

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package memory is tomo's long-term store: MEMORY.md is a one-line-per-fact index that rides in the system prompt, and each fact's detail lives in its own markdown topic file. Plain files on purpose, so the user can read, edit, and grep their agent's memory like anything else on disk.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Memory

type Memory struct {
	Dir string
	// contains filtered or unexported fields
}

Memory roots the store at one directory. It is safe for concurrent use: the curator writes on its own goroutine while a live turn may be reading.

func (*Memory) Index

func (m *Memory) Index() (string, error)

Index returns MEMORY.md, or "" when there is no memory yet.

func (*Memory) Read

func (m *Memory) Read(slug string) (string, error)

Read returns one topic file's content.

func (*Memory) Save

func (m *Memory) Save(slug, title, body string) error

Save writes (or overwrites) a topic file and keeps the index line for it current: one line per slug, replaced in place when the fact changes.

func (*Memory) SaveNoted

func (m *Memory) SaveNoted(slug, title, body string, p Provenance) error

SaveNoted is Save with a provenance stamp appended to the body. The curator uses it so an inferred fact carries where it came from; a direct write from the user leaves the stamp empty and trusts the fact plainly.

func (*Memory) Tools

func (m *Memory) Tools() []tool.Tool

Tools returns the agent-facing surface of the memory store.

type Provenance

type Provenance struct {
	Source string // who recorded it, e.g. "curator"
	From   string // where it was learned, e.g. "telegram:12345"
	On     string // date, supplied by the caller so memory stays clockless
}

Provenance labels where a fact came from, so a later reader can weigh it: a fact the user stated outright is worth more than one the curator inferred while tidying up. It rides as a trailing line in the topic file, visible to the model when it reads the topic. The zero value adds no line.

Jump to

Keyboard shortcuts

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