extract

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package extract distils conversation prose into durable, classified facts without an LLM — a port of mempalace's heuristic extractor. It pulls the decisions, preferences, and problems worth keeping out of an episodic exchange, as durable memories that earn trust on recall. Marker-driven and deliberately conservative: a miss just means no extra memory, never a wrong one. Both the backfill importer and write-time extraction share this logic.

Index

Constants

View Source
const MaxPerExchange = 5

MaxPerExchange caps extractions from a single exchange so one rambling turn can't flood the store.

View Source
const MinConfidence = 0.3

MinConfidence gates an extraction: confidence is min(1, score/5) where score is the count of distinct markers that match plus a length bonus, so a lone marker on a short segment (0.2) is dropped while two distinct markers, or one in a longer segment, pass.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kind

type Kind string

Kind labels an extracted memory; it doubles as the memory's first tag.

const (
	KindDecision   Kind = "decision"
	KindPreference Kind = "preference"
	KindProblem    Kind = "problem"
)

func (Kind) Tier

func (k Kind) Tier() memory.Tier

Tier maps an extracted kind to its memory tier: a preference is a how-to rule, so it's procedural; decisions and problems are durable facts, so semantic.

type Result

type Result struct {
	Kind    Kind
	Content string
}

Result is one classified segment ready to become a durable memory.

func Typed

func Typed(text string) []Result

Typed scans a block of conversation text and returns the decision/preference/problem segments that clear the confidence gate, capped at MaxPerExchange. Empty when nothing qualifies.

Jump to

Keyboard shortcuts

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