Recollect.Knowledge (recollect v0.5.1)

Copy Markdown View Source

Lightweight knowledge API (Tier 2). Simple store-embed-search for entries and edges.

Summary

Functions

Check if new content contradicts existing knowledge.

Create an edge between two entries.

Delete a knowledge entry.

Get recent entries for a scope.

Store a knowledge entry with auto-embedding.

Apply supersession: demote old entries matching entity+relation pattern. New entry supersedes old ones by setting their confidence to 0.1.

Functions

check_contradiction(content, scope_id, owner_id)

Check if new content contradicts existing knowledge.

Extracts entity claims from the content and checks against existing entries in the scope. Returns:

  • :ok — no conflicts found
  • {:conflict, [conflicts]} — list of conflicts with details

Example

iex> Recollect.Knowledge.check_contradiction("Kai works on auth", scope_id, owner_id)
{:conflict, [%{existing: "Maya works on auth", type: :attribution_conflict}]}

connect(source_id, target_id, relation, opts \\ [])

Create an edge between two entries.

forget(entry_id)

Delete a knowledge entry.

recent(scope_id, opts \\ [])

Get recent entries for a scope.

remember(content, opts \\ [])

Store a knowledge entry with auto-embedding.

Automatically captures current context (git repo, path, OS) unless explicitly provided via :context_hints option.

Optionally auto-classifies content using LLM-free pattern matching via Recollect.Classification. Enable with :auto_classify option.

supersede(scope_id, entity, relation, new_value)

Apply supersession: demote old entries matching entity+relation pattern. New entry supersedes old ones by setting their confidence to 0.1.