Recollect.Classification (recollect v0.5.1)

Copy Markdown View Source

LLM-free memory classification using regex-based pattern matching.

Classifies text into categories inspired by MemPalace's general_extractor:

  • :decision — "we went with X because Y", "decided to use"
  • :preference — "always use X", "never do Y", "I prefer Z"
  • :milestone — "it works", "breakthrough", "finally fixed"
  • :problem — "bug", "error", "doesn't work", "root cause"
  • :emotional — "love", "scared", "proud", "grateful"
  • :note — default for unclassified content

No LLM required — uses keyword and pattern matching.

Summary

Functions

Classify a text string into a memory type.

Classify with additional context for better accuracy.

Extract entity claims from text for contradiction detection.

Extract memory type from text (returns just the type atom).

Functions

classify(text)

Classify a text string into a memory type.

Returns {type, confidence} where:

  • type is one of [:decision, :preference, :milestone, :problem, :emotional, :note]
  • confidence is a float 0.0-1.0

Examples

iex> Recollect.Classification.classify("We decided to use PostgreSQL because it supports JSON")
{:decision, 0.8}

iex> Recollect.Classification.classify("I love working with this team")
{:emotional, 0.6}

classify(text, context_hints)

Classify with additional context for better accuracy.

Takes context_hints map with :git_repo, :file_path, :os keys.

extract_claims(text)

Extract entity claims from text for contradiction detection.

Returns list of claim maps: %{entity: "Kai", predicate: :works_on, object: "auth", temporal: :current}

memory_type(text)

Extract memory type from text (returns just the type atom).