Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ShouldCapture ¶ added in v0.4.0
func ShouldCapture(userMsg, assistantMsg string, cfg config.CaptureQualityConfig) bool
ShouldCapture returns true if the conversation turn passes quality filters and is worth sending to Claude for memory extraction. It checks minimum message lengths and blocklist patterns (case-insensitive substring match).
Types ¶
type Capturer ¶
type Capturer interface {
Extract(ctx context.Context, userMsg, assistantMsg string) ([]models.CapturedMemory, error)
// ExtractWithContext is like Extract but includes prior conversation turns
// for better context-aware extraction.
ExtractWithContext(ctx context.Context, userMsg, assistantMsg string, priorTurns []ConversationTurn) ([]models.CapturedMemory, error)
}
Capturer extracts structured memories from conversation text.
type ClaudeCapturer ¶
type ClaudeCapturer struct {
// contains filtered or unexported fields
}
ClaudeCapturer uses Claude Haiku to extract memories.
func NewCapturer ¶
NewCapturer creates a new Claude-based memory capturer.
func (*ClaudeCapturer) Extract ¶
func (c *ClaudeCapturer) Extract(ctx context.Context, userMsg, assistantMsg string) ([]models.CapturedMemory, error)
Extract analyzes a conversation turn and returns captured memories above the confidence threshold.
func (*ClaudeCapturer) ExtractWithContext ¶ added in v0.4.0
func (c *ClaudeCapturer) ExtractWithContext(ctx context.Context, userMsg, assistantMsg string, priorTurns []ConversationTurn) ([]models.CapturedMemory, error)
ExtractWithContext is like Extract but includes prior conversation turns for better extraction.
type ConflictDetector ¶ added in v0.4.0
type ConflictDetector struct {
// contains filtered or unexported fields
}
ConflictDetector uses Claude to detect when a new memory contradicts existing ones. On any API error or JSON parse failure the detector degrades gracefully and returns (false, "", "", nil) so that the caller can always proceed with storing the memory.
func NewConflictDetector ¶ added in v0.4.0
NewConflictDetector creates a ConflictDetector backed by the Anthropic Claude API.
func (*ConflictDetector) Detect ¶ added in v0.4.0
func (d *ConflictDetector) Detect(ctx context.Context, newContent string, candidates []models.Memory) (bool, string, string, error)
Detect returns (true, contradictedID, reason, nil) if newContent contradicts any candidate memory. On any API error or parse failure it logs a warning and returns (false, "", "", nil) — the safe default is to store the memory anyway.
type ConversationTurn ¶ added in v0.4.0
type ConversationTurn struct {
Role string `json:"role"` // "user" or "assistant"
Content string `json:"content"`
}
ConversationTurn is a single message in a conversation history.
type EntityExtractor ¶ added in v0.4.0
type EntityExtractor struct {
// contains filtered or unexported fields
}
EntityExtractor identifies named entities in memory content using Claude.
func NewEntityExtractor ¶ added in v0.4.0
NewEntityExtractor creates a new entity extractor backed by the Claude API.