Skip to main content

Module facts

Module facts 

Source
Expand description

Memory Layer 2 — Semantic facts with search.

Extends the existing remember/recall/forget tools with structured facts storage, pure Rust full-text search, deduplication, and eviction.

Facts are stored in JSONL format at: /.recursive/memory/facts.jsonl (workspace scope) ~/.recursive/memory/facts.jsonl (global scope)

Each fact has:

  • id (monotonic “F1”, “F2”, …)
  • text (the fact content)
  • tags (optional categorisation)
  • source (optional provenance, e.g. “user”, “agent”)
  • created_at (RFC 3339 timestamp)
  • last_accessed (RFC 3339 timestamp, updated on recall)
  • access_count (how many times recalled)
  • superseded_by (optional fact ID that replaces this one — soft delete)

Structs§

Fact
A single semantic fact.
FactStore
The on-disk fact store (JSONL).
ForgetFact
RecallFact
RememberFact
ScoredFact
A search result with a relevance score.
UpdateFact

Functions§

facts_path
Determine the facts file path for a given scope.
facts_summary
Build a facts summary string for injection into the system prompt. Merges workspace-scoped and global-scoped facts, then returns the top N most recently accessed facts as a formatted block.
load_facts
Load the fact store for a given scope.
search_facts
Search facts by query text, returning scored results sorted by relevance.