The Memory System

Yanai's memory system is designed to work like human memory — it learns, reinforces what's important, and lets irrelevant details fade naturally. This is what makes your context feel alive rather than like a static database. And because it's yours, it travels with you to every AI tool you connect.


How Memories Work

Every piece of knowledge in Yanai is a memory (also called a context entry). Each memory has:

  • Key — A descriptive title (e.g., preferred_testing_framework, project_alpha_architecture)
  • Content — The actual knowledge, written as a self-contained statement
  • Tags — Keywords for searchability
  • Cognitive Sector — How the knowledge is classified (see below)
  • Salience — A score representing how important/accessible this memory is right now
  • Embeddings — Vector representations for semantic search

Cognitive Sectors

Every memory is classified into one of five cognitive sectors, inspired by how human memory works:

Episodic

Memories of specific events, conversations, and experiences.

"On Jan 15, we decided to migrate from REST to GraphQL because of the N+1 query problems in the dashboard."

Semantic

General knowledge, facts, and conceptual understanding.

"PostgreSQL 18 supports native UUIDv7 generation without extensions."

Procedural

How-to knowledge — processes, workflows, and step-by-step procedures.

"To deploy the backend: commit to main, run railway service link api, then railway up --detach."

Emotional

Preferences, opinions, frustrations, and feelings about tools, processes, or decisions.

"User strongly prefers Go over Java for backend services, citing simplicity and deployment speed."

Reflective

Meta-knowledge — insights about patterns, lessons learned, and higher-order observations.

"Every time we skip writing migrations as idempotent, we hit issues in staging. Always use IF NOT EXISTS patterns."

Salience and Decay

Not all memories are equally important. Yanai uses salience — a dynamic score that determines how readily available a memory is.

How salience increases

  • Reinforcement — When an AI tool retrieves a memory and finds it useful, its salience is automatically boosted. This happens during normal search_context calls.
  • Recency — Newly stored memories start with a baseline salience.

How salience decreases

  • Natural decay — Memories that aren't used gradually lose salience over time. This prevents your context from becoming cluttered with outdated information.
  • Displacement — As new, more relevant memories are added, older memories with low salience may be archived.

Why this matters

Salience ensures your AI tools always see the most relevant, actively-used knowledge first. A project you worked on last week has high salience. A project you haven't touched in six months fades to the background — but it's still there if you search for it.

This is deliberate. It mirrors how your own memory works and prevents information overload.

Waypoints

Waypoints are associative links between related memories, even across different aspects. They create a web of connected knowledge.

For example, a memory about "choosing PostgreSQL for Project Alpha" might have waypoints linking to:

  • A memory about "PostgreSQL performance tuning tips" in your technical knowledge aspect
  • A memory about "Project Alpha's deployment architecture" in your work aspect
  • A memory about "why we moved away from MongoDB" in your decisions aspect

When an AI tool retrieves one memory, waypoints help it discover related context it might not have found through search alone.

How It All Fits Together

Here's the lifecycle of knowledge in Yanai:

  1. Capture — You chat with an AI tool. It stores a new memory via store_memory.
  2. Classify — The memory is automatically classified into a cognitive sector and routed to 1-3 relevant aspects.
  3. Embed — Vector embeddings are generated for semantic search.
  4. Link — Waypoints connect the new memory to related existing memories.
  5. Retrieve — In future conversations, AI tools search for and find this memory via search_context.
  6. Reinforce — When the memory is retrieved and relevant, its salience is automatically boosted.
  7. Decay — If the memory isn't used over time, its salience gradually decreases.
  8. Summarize — Aspect memory summaries are periodically regenerated to reflect the current state of knowledge.

The result is a living, breathing knowledge base that stays current, relevant, and useful — without you ever having to manually manage it. And because it's independent of any one AI platform, it works everywhere you do.

Key Takeaways

  • You don't need to manage your memories manually. AI tools do the storing, reinforcing, and organizing.
  • Important things stay strong. Frequent use keeps salience high.
  • Old things fade but aren't lost. Decayed memories can still be found through direct search.
  • Everything is connected. Waypoints and cross-aspect search surface knowledge you didn't know was related.
  • It's yours. Your memory system is independent of any AI platform — switch tools freely without losing context.