Documentation
¶
Index ¶
- Constants
- func Close() error
- func DefaultDBPath() (string, error)
- func DefaultModelPath() (string, error)
- func FormatRecallContext(hits []RecallHit, heading string) string
- func Index(ctx context.Context, cwd, text string) error
- func IsOpen() bool
- func MemoryIndexTool(cwd string, ...) fantasy.AgentTool
- func Open(opts Options) error
- func PromptContext(ctx context.Context, cwd, prompt string) string
- func SerializeVector(vec []float32) []byte
- func SetDefault(s *Service)
- func Sweep(ctx context.Context) error
- func SystemBlock(ctx context.Context, cwd string) string
- func WrapFileTools(tools []fantasy.AgentTool, cwd string) []fantasy.AgentTool
- type Embedder
- type EmbeddingModel
- type MemoryAwareTool
- type Options
- type RecallHit
- type Service
Constants ¶
const ( // DefaultRecallK is the default limit of memory nodes injected into prompts or tool responses. DefaultRecallK = 5 // DefaultHookTimeout caps how long recall operations can take. DefaultHookTimeout = 8 * time.Second )
Variables ¶
This section is empty.
Functions ¶
func DefaultDBPath ¶
DefaultDBPath returns the standard SQLite vector database file location.
func DefaultModelPath ¶
DefaultModelPath returns the standard local embedding model GGUF location.
func FormatRecallContext ¶
FormatRecallContext formats vector search hits into a numbered markdown list under heading.
func IsOpen ¶
func IsOpen() bool
IsOpen reports whether the default process-wide memory service is open.
func MemoryIndexTool ¶
func MemoryIndexTool(cwd string, requestApproval func(ctx context.Context, name string, params map[string]any) *fantasy.ToolResponse) fantasy.AgentTool
MemoryIndexTool returns the fantasy AgentTool for storing text in vector memory.
func PromptContext ¶
PromptContext returns the per-turn memory recall block matching the user prompt.
func SerializeVector ¶
SerializeVector converts a float32 slice to the byte representation expected by sqlite-vec.
func SetDefault ¶
func SetDefault(s *Service)
SetDefault replaces the default global Service instance.
func SystemBlock ¶
SystemBlock returns the session-start project context memory block.
Types ¶
type EmbeddingModel ¶
type EmbeddingModel struct {
// contains filtered or unexported fields
}
EmbeddingModel manages an in-memory llama.cpp embedding model instance.
func LoadEmbeddingModel ¶
func LoadEmbeddingModel(path string) (*EmbeddingModel, error)
LoadEmbeddingModel initializes the llama.cpp backend and loads the GGUF model from path.
func (*EmbeddingModel) Close ¶
func (m *EmbeddingModel) Close()
Close releases the llama context and model resources.
func (*EmbeddingModel) EmbdSize ¶
func (m *EmbeddingModel) EmbdSize() int
EmbdSize returns the embedding dimension of the model.
type MemoryAwareTool ¶
MemoryAwareTool decorates a file tool (read / edit / write) so the tool output carries relevant memory recall context for the touched file path.
func (*MemoryAwareTool) Run ¶
func (m *MemoryAwareTool) Run(ctx context.Context, call fantasy.ToolCall) (fantasy.ToolResponse, error)
Run executes the underlying tool and appends file-specific memory recall when available.
type RecallHit ¶
type RecallHit struct {
ID int64 `json:"id"`
ProjectID string `json:"project_id"`
Text string `json:"text"`
Distance float32 `json:"distance"`
LastRecall time.Time `json:"last_recall"`
}
RecallHit represents a matched memory entry from vector search.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service manages vector memory persistence and retrieval.
func NewService ¶
NewService initializes a SQLite-vec memory service with the specified options.
func (*Service) Index ¶
Index embeds and saves a text memory associated with the given working directory.