yaad

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package yaad provides the public Go SDK for embedding Yaad memory into any Go application or coding agent.

Usage:

import "github.com/GrayCodeAI/yaad/sdk/go/yaad"

mem, _ := yaad.Open(".yaad/yaad.db")
defer mem.Close()

node, _ := mem.Remember("Use jose for JWT", yaad.Convention)
results, _ := mem.Recall("auth middleware")
context, _ := mem.Context("")
model, _ := mem.MentalModel("")

Index

Constants

View Source
const (
	Convention = "convention"
	Decision   = "decision"
	Bug        = "bug"
	Spec       = "spec"
	Task       = "task"
	Skill      = "skill"
	Preference = "preference"
)

Memory types.

Variables

This section is empty.

Functions

This section is empty.

Types

type Edge

type Edge = storage.Edge

Edge is a relationship between two nodes.

type Memory

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

Memory is the main Yaad SDK handle.

func Open

func Open(dbPath string) (*Memory, error)

Open opens a Yaad database at the given path. Creates the database and schema if it doesn't exist.

func (*Memory) Approve

func (m *Memory) Approve(id string) error

Feedback applies user feedback to a memory node.

func (*Memory) Close

func (m *Memory) Close() error

Close closes the database connection.

func (*Memory) Compact

func (m *Memory) Compact(project string) (int, error)

Compact merges low-confidence memories to keep the graph lean.

func (*Memory) Context

func (m *Memory) Context(project string) (*RecallResult, error)

Context returns the hot-tier subgraph for session start injection.

func (*Memory) Discard

func (m *Memory) Discard(id string) error

Discard archives a memory node via feedback.

func (*Memory) Edit

func (m *Memory) Edit(id string, newContent string) error

Edit updates a memory node's content.

func (*Memory) Forget

func (m *Memory) Forget(id string) error

Forget archives a memory node.

func (*Memory) MentalModel

func (m *Memory) MentalModel(project string) (*MentalModel, error)

MentalModel generates an auto-evolving project summary.

func (*Memory) Recall

func (m *Memory) Recall(query string, opts ...RecallOption) (*RecallResult, error)

Recall performs graph-aware search: BM25 + vector + graph + temporal.

func (*Memory) Remember

func (m *Memory) Remember(content string, nodeType string, opts ...RememberOption) (*Node, error)

Remember stores a memory node with auto entity extraction, dedup, temporal linking, and conflict resolution.

type MentalModel

type MentalModel = mental.Model

MentalModel is an auto-generated project summary.

type Node

type Node = storage.Node

Node is a memory node in the Yaad graph.

type RecallOption

type RecallOption func(*engine.RecallOpts)

RecallOption configures a Recall call.

func WithDepth

func WithDepth(depth int) RecallOption

WithDepth sets the graph expansion depth.

func WithLimit

func WithLimit(limit int) RecallOption

WithLimit sets the max results.

func WithType

func WithType(nodeType string) RecallOption

WithType filters by node type.

type RecallResult

type RecallResult = engine.RecallResult

RecallResult holds search results with nodes and edges.

type RememberOption

type RememberOption func(*engine.RememberInput)

RememberOption configures a Remember call.

func WithAgent

func WithAgent(agent string) RememberOption

WithAgent sets the agent name.

func WithProject

func WithProject(project string) RememberOption

WithProject sets the project scope.

func WithSession

func WithSession(session string) RememberOption

WithSession sets the session ID.

func WithSummary

func WithSummary(summary string) RememberOption

WithSummary sets a short summary.

func WithTags

func WithTags(tags string) RememberOption

WithTags sets tags on the memory.

Jump to

Keyboard shortcuts

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