Documentation
¶
Index ¶
- Variables
- func BoostNode(store *storage.Store, id string, boost float64) error
- func FormatContext(nodes []*storage.Node) string
- func GarbageCollect(store *storage.Store, cfg DecayConfig) (int, error)
- func RunDecay(store *storage.Store, cfg DecayConfig) error
- func TrimToTokenBudget(nodes []*storage.Node, budget int) []*storage.Node
- type DecayConfig
- type EdgeInput
- type Engine
- func (e *Engine) Compact(project string) (int, error)
- func (e *Engine) CompressSession(sessionID, project string) (*storage.Node, error)
- func (e *Engine) Context(project string) (*RecallResult, error)
- func (e *Engine) Feedback(id string, action FeedbackAction, newContent string) error
- func (e *Engine) Forget(id string) error
- func (e *Engine) Graph() *graph.Graph
- func (e *Engine) MentalModel(project string) (*mental.Model, error)
- func (e *Engine) PendingNodes(project string, threshold float64) ([]*storage.Node, error)
- func (e *Engine) Profile(project string) (*profile.Profile, error)
- func (e *Engine) Recall(opts RecallOpts) (*RecallResult, error)
- func (e *Engine) Remember(in RememberInput) (*storage.Node, error)
- func (e *Engine) Rollback(id string, version int) error
- func (e *Engine) StartSession(project, agent string) (string, error)
- func (e *Engine) Status(project string) (*Status, error)
- func (e *Engine) Store() *storage.Store
- type Entity
- type FeedbackAction
- type HybridSearch
- type LLMExtractor
- type ProactiveContext
- type RecallOpts
- type RecallResult
- type RememberInput
- type ScoredNode
- type Status
Constants ¶
This section is empty.
Variables ¶
var DefaultDecayConfig = DecayConfig{
HalfLifeDays: 30,
MinConfidence: 0.1,
BoostOnAccess: 0.2,
}
Functions ¶
func FormatContext ¶
FormatContext formats nodes as a markdown context block for injection.
func GarbageCollect ¶
func GarbageCollect(store *storage.Store, cfg DecayConfig) (int, error)
GarbageCollect removes nodes below min_confidence (except anchors: file/entity).
Types ¶
type DecayConfig ¶
type DecayConfig struct {
HalfLifeDays float64 // default 30
MinConfidence float64 // default 0.1 — below this, eligible for GC
BoostOnAccess float64 // default 0.2
}
DecayConfig controls decay behaviour.
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the core memory engine wrapping graph + storage.
func (*Engine) CompressSession ¶
CompressSession creates a session summary node linking all memories from the session.
func (*Engine) Context ¶
func (e *Engine) Context(project string) (*RecallResult, error)
Context returns the hot-tier subgraph for session start injection.
func (*Engine) Feedback ¶
func (e *Engine) Feedback(id string, action FeedbackAction, newContent string) error
Feedback applies user feedback to a memory node.
func (*Engine) MentalModel ¶
MentalModel generates an auto-evolving project summary.
func (*Engine) PendingNodes ¶
PendingNodes returns low-confidence nodes that may need review.
func (*Engine) Profile ¶
Profile returns an auto-maintained user/project profile (static facts + dynamic context).
func (*Engine) Recall ¶
func (e *Engine) Recall(opts RecallOpts) (*RecallResult, error)
Recall performs graph-aware hybrid search: BM25 seed → graph expand → rank.
func (*Engine) Remember ¶
func (e *Engine) Remember(in RememberInput) (*storage.Node, error)
Remember creates a memory node with privacy filtering, dedup, and entity extraction.
func (*Engine) StartSession ¶
StartSession creates a new session record and returns its ID.
type Entity ¶
Entity represents an auto-extracted entity from content.
func ExtractEntities ¶
ExtractEntities pulls file paths, packages, functions, and classes from content.
type FeedbackAction ¶
type FeedbackAction string
FeedbackAction represents what to do with a pending memory.
const ( FeedbackApprove FeedbackAction = "approve" FeedbackEdit FeedbackAction = "edit" FeedbackDiscard FeedbackAction = "discard" )
type HybridSearch ¶
type HybridSearch struct {
// contains filtered or unexported fields
}
HybridSearch performs 3-stage retrieval: BM25 → vector → graph expansion → RRF fusion.
func NewHybridSearch ¶
func NewHybridSearch(store *storage.Store, g *graph.Graph, provider embeddings.Provider) *HybridSearch
NewHybridSearch creates a hybrid search engine.
func (*HybridSearch) Search ¶
func (h *HybridSearch) Search(ctx context.Context, query string, opts RecallOpts) ([]*ScoredNode, error)
Search runs hybrid search and returns ranked nodes. 4-path retrieval: BM25 + vector + graph (intent-aware) + temporal recency Based on Hindsight's multi-strategy approach.
type LLMExtractor ¶
type LLMExtractor struct {
// contains filtered or unexported fields
}
LLMExtractor uses an LLM to extract entities from content. Falls back to regex extraction if LLM is unavailable.
func NewLLMExtractor ¶
func NewLLMExtractor(apiKey, baseURL, model string) *LLMExtractor
NewLLMExtractor creates an LLM-based entity extractor. baseURL: "https://api.openai.com" or any OpenAI-compatible endpoint.
type ProactiveContext ¶
type ProactiveContext struct {
// contains filtered or unexported fields
}
ProactiveContext predicts what context the agent will likely need next by analyzing recent access patterns and graph connectivity.
func NewProactiveContext ¶
func NewProactiveContext(eng *Engine, search *HybridSearch) *ProactiveContext
NewProactiveContext creates a proactive context predictor.
func (*ProactiveContext) Predict ¶
func (p *ProactiveContext) Predict(ctx context.Context, project string, budget int) ([]*storage.Node, error)
Predict returns nodes likely needed in the next session based on: 1. Recently accessed nodes and their neighbors 2. Active tasks and their dependencies 3. High-centrality nodes in the project subgraph
type RecallOpts ¶
RecallOpts configures a recall search.
type RecallResult ¶
RecallResult holds search results.
type RememberInput ¶
type RememberInput struct {
Type string // convention|decision|bug|spec|task|preference
Content string
Summary string
Scope string // global|project
Project string
Tier int
Tags string
Session string
Agent string
// Optional: explicit edges to create
Edges []EdgeInput
}
RememberInput is the input for creating a memory node.
type ScoredNode ¶
ScoredNode is a node with a combined relevance score.
func Rerank ¶
func Rerank(nodes []*ScoredNode, store *storage.Store) []*ScoredNode
Rerank re-scores nodes combining RRF score, graph centrality, recency, and confidence.