Yuebing LogoYUEBING

How I give AI a useful memory

ybAIMem · Context that survives the conversation.

The problem: decisions disappear between sessions

A useful conversation can establish preferences, constraints and decisions. In the next session, I often need that context again. I built ybAIMem to keep selected durable facts locally and retrieve them when they matter.

An example from the terminal

Suppose I want to retain a preference about presentations. This illustrative example uses the actual command interface; the sample fact is not a captured session log.

Example commands · run from the ybAIMem project
python memory_store.py remember \
  "For presentations, show the decision before implementation details." \
  --scope personal --tags presentation

python memory_store.py recall \
  "How should I structure a presentation?" \
  --scope personal

The recalled context can then be included in a prompt. Writing a fact is a deliberate action. The store is meant for settled decisions and reusable preferences, rather than a transcript of everything I do.

Two ways to remember

Explicit recall uses semantic search. In my Claude Code workflow, a separate prompt hook can surface relevant facts without a manual lookup. That hook uses lexical scoring with inverse document frequency: distinctive words matter more than common ones. It also applies a relevance threshold so a weak cue can produce no result.

The two paths serve different purposes. A deliberate query can afford to load a semantic model. A hook that runs with every prompt needs a much lighter retrieval path. Automatic recall depends on the installed integration; it is not a universal feature of every AI client.

Forgetting is part of retrieval

Facts that stop being used can be archived through a deterministic decay rule. Archiving does not erase the underlying history, and pinned facts are treated separately. I can inspect a sweep before applying it:

Inspect archiving candidates without applying the sweep
python memory_store.py forget-sweep --dry-run

Retrieving a fact is evidence of use, not evidence that it is still true. Time-sensitive facts need verification as well as recall.

What this demonstrates

Useful AI memory is a selection problem: what to retain, when to bring it back, which context it belongs to and when it should fade. This implementation is a local system for one person on one machine.

Want to use it? Join the waitlist.

See these tools in a working routine

Back to the lab