Three patterns teams reach for first. Each uses the same five-method API: add, search, get, get_all, delete.

Support

Tailored replies

Before each turn, search memories for the customer’s plan tier, past issues, and tone preferences—inject the top facts into the system prompt.

hits = memory.search(
    message,
    filters={"user_id": customer_id},
    top_k=5,
)
context = "\n".join(h["memory"] for h in hits["results"])
Assistant

Continuity across sessions

After responding, append the exchange with memory.add so the next login still knows location, stack choices, and standing instructions.

memory.add(
    [{"role": "user", "content": msg},
     {"role": "assistant", "content": reply}],
    user_id=user_id,
)
Agents

Per-run isolation

Scope episodic tool outcomes with run_id while keeping stable user preferences under user_id for cross-run recall.

memory.add(
    tool_summary,
    user_id="team",
    run_id=run_id,
    infer=False,
)

Browser demo • zero backend • localStorage

Interactive showcase

Add facts, scope them, search with hybrid ranking, and run a full retrieve → respond → remember loop. The retrieval and scoring mirror Recollect's local embedder + hybrid search (semantic + keyword + entity).

Add memory

Facts are stored only in your browser for this demo.

Stored memories

No memories yet. Use “Seed samples” or add your own.

Hybrid search lab

Results will appear here. Try searching after adding or seeding data.

Chat simulation (scoped to user)

Retrieves top memories → shows what would be injected → simulated reply → writes the turn back via add().

This demo replicates the local-dev path (RecollectConfig.local_dev()) entirely in the browser using the same hybrid scoring approach.

End-to-end chat loop (code)

The same flow as examples/chat_with_memory.py: retrieve, answer, then write back new facts. The live demo above executes an equivalent loop using the real retrieval logic.

from openai import OpenAI
from recollect import Memory

memory = Memory()
client = OpenAI()
user_id = "demo_user"

def reply(message: str) -> str:
    retrieved = memory.search(message, filters={"user_id": user_id}, top_k=5)
    memories = "\n".join(f"- {r['memory']}" for r in retrieved["results"])
    system = f"You are helpful. User memories:\n{memories or '- (none)'}"
    answer = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[
            {"role": "system", "content": system},
            {"role": "user", "content": message},
        ],
    ).choices[0].message.content
    memory.add(
        [{"role": "user", "content": message},
         {"role": "assistant", "content": answer}],
        user_id=user_id,
    )
    return answer

Try it locally (full power)

No API key required for search/add smoke tests—use the local embedder and infer=False.