Skip to main content

How it works

Every memory is automatically classified into a category when it is stored. Instead of calling an LLM to categorize, MemWire uses cosine similarity to anchor embeddings:
  1. Each category has one or more example sentences (anchors) that define its meaning
  2. At startup, anchor embeddings are computed as the centroid of all examples for that category
  3. When a new memory arrives, its embedding is compared to every anchor centroid
  4. The category with the highest cosine similarity wins — as long as it clears classification_threshold
This is fully local, runs in microseconds, and requires no API key.

Default categories


Code example


Filtering search by category


Adding custom categories

Define domain-specific categories for your application:
Multiple calls to add_anchor with the same name accumulate examples — the centroid is recomputed each time, sharpening the category boundary.

Customising anchors at config level

Setting default_anchors replaces the built-in set entirely. Include any categories you want to keep from the defaults.

Configuration reference