Documentation
¶
Overview ¶
Package memory provides the memory_manage and memory_capture MCP tools. Recall (reading memory back) is served by the unified search tool.
Index ¶
- type AutoCaptureInput
- type CaptureResult
- type RecallChecker
- type RecallMatch
- type RecallQuery
- type ThreadLinker
- type Toolkit
- func (t *Toolkit) AutoCapture(ctx context.Context, in AutoCaptureInput) (*CaptureResult, error)
- func (*Toolkit) Close() error
- func (*Toolkit) Connection() string
- func (*Toolkit) Kind() string
- func (t *Toolkit) Name() string
- func (t *Toolkit) RegisterTools(s *mcp.Server)
- func (*Toolkit) SetQueryProvider(_ query.Provider)
- func (t *Toolkit) SetRecallChecker(rc RecallChecker)
- func (*Toolkit) SetSemanticProvider(_ semantic.Provider)
- func (t *Toolkit) SetThreadLinker(tl ThreadLinker)
- func (*Toolkit) Tools() []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AutoCaptureInput ¶ added in v1.95.0
type AutoCaptureInput struct {
SinkClass string
Content string
Category string
Source string
Confidence string
EntityURNs []string
Metadata map[string]any
// CreatedBy is the owner email the record is scoped to (required). Persona,
// UserID, and SessionID mirror the tool path's PlatformContext fields.
CreatedBy string
Persona string
UserID string
SessionID string
}
AutoCaptureInput is a server-initiated (non-agent) capture. Unlike the memory_capture tool, there is no incoming request to read identity from, so the caller supplies it explicitly. Source defaults to automation so audits and reads can distinguish platform-minted records from agent- and user- authored ones.
type CaptureResult ¶ added in v1.95.0
CaptureResult is the outcome of a server-initiated capture.
type RecallChecker ¶ added in v1.87.0
type RecallChecker interface {
// Matches returns the caller's active records with cosine similarity at or
// above q.MinScore, best first. When the candidate carries entity URNs,
// matches must share at least one (knowledge about table A never matches
// knowledge about table B).
Matches(ctx context.Context, q RecallQuery) ([]RecallMatch, error)
}
RecallChecker finds the caller's active records a new capture restates, so the write path can supersede instead of appending (recall-first, #633) and surface near-matches for the agent to consolidate (#762). Implemented by the platform over the memory store; declared here so this package does not import pkg/knowledge.
type RecallMatch ¶ added in v1.96.0
RecallMatch is one existing record similar to a new capture, with its raw cosine score. The capture path splits matches by score: at or above recallSupersedeThreshold the record is superseded; below it the match is returned to the agent as a similar_existing candidate.
type RecallQuery ¶ added in v1.87.0
type RecallQuery struct {
Embedding []float32
EntityURNs []string
CallerEmail string
MinScore float64
}
RecallQuery is the recall-first lookup: the precomputed embedding of the candidate content, the entities it concerns, and the caller's email, plus the cosine threshold above which a prior record counts as similar. Embedding is empty when no embedder is configured; in that case recall is skipped (no reliable similarity, so the capture simply appends).
type ThreadLinker ¶ added in v1.87.0
type ThreadLinker interface {
LinkInsight(ctx context.Context, threadIDs []string, insightID, actorID, actorEmail string) ([]string, error)
}
ThreadLinker bridges a reviewed capture back to the feedback thread(s) it resolves (#602). Satisfied by the portal thread store; a minimal interface so the memory toolkit does not depend on the portal package.
type Toolkit ¶
type Toolkit struct {
// contains filtered or unexported fields
}
Toolkit implements the memory management toolkit. Recall is handled by the unified search tool (#632); this toolkit owns only the memory_manage write path.
func (*Toolkit) AutoCapture ¶ added in v1.95.0
func (t *Toolkit) AutoCapture(ctx context.Context, in AutoCaptureInput) (*CaptureResult, error)
AutoCapture persists a server-initiated capture, reusing the full memory_capture pipeline: sink-class routing (live vs reviewed), embedding, recall-first supersede, and the pending-insight overlay for reviewed classes. It is the single entry point for platform-minted memory (e.g. reflexive capture of a query error and its later fix), so such records go through the same review and dedup path as agent captures rather than a parallel writer.
func (*Toolkit) Connection ¶
Connection returns the connection name for audit logging.
func (*Toolkit) RegisterTools ¶
RegisterTools registers memory_manage with the MCP server. Recall moved to the unified search tool (#632).
func (*Toolkit) SetQueryProvider ¶
SetQueryProvider is a no-op; memory toolkit does not use query execution.
func (*Toolkit) SetRecallChecker ¶ added in v1.87.0
func (t *Toolkit) SetRecallChecker(rc RecallChecker)
SetRecallChecker wires the recall-first checker.
func (*Toolkit) SetSemanticProvider ¶
SetSemanticProvider is a no-op: recall (which used lineage) moved to search, so the memory toolkit no longer needs the semantic provider.
func (*Toolkit) SetThreadLinker ¶ added in v1.87.0
func (t *Toolkit) SetThreadLinker(tl ThreadLinker)
SetThreadLinker wires the feedback-thread bridge.