Tutorial 4 of 757% complete
All tutorials
5 minBeginner

Semantic Search

Find past decisions by meaning, not just keywords

Semantic Search & RAG

Find exactly what your AI assistant needs from the project's synthetic memory.

The Problem

A traditional keyword search is often too literal. If you search for "database reliability" but your project's memory contains a decision about "PostgreSQL for ACID transactions," a standard search might miss it because the words don't match.

Continuity's RAG-based synthetic memory uses Semantic Search to understand the meaning behind your queries, allowing your AI assistant to find relevant context even when you use different terminology.

How to Query Memory

When your AI is connected to Continuity's memory system (e.g., via MCP), it uses Retrieval-Augmented Generation (RAG) to find the most relevant prior decisions:

You: "Search our project memory for decisions about database reliability."

AI: Queries the synthetic memory using RAG

"I found 3 highly relevant decisions in our project memory:

  1. decision-23: PostgreSQL for ACID transactions (relevance: 0.82)
  2. decision-45: Database connection pooling (relevance: 0.65)
  3. decision-67: Daily backups to S3 (relevance: 0.58)"

Even though you asked about "reliability," the RAG system correctly identified "ACID transactions" and "backups" as the most important context for your question.

RAG Usage Examples

Searching by concept

You: "Find any decisions in memory about making the app faster."

The RAG system retrieves context about:

  • Redis caching strategies
  • CDN implementation details
  • Database indexing optimizations
  • Frontend lazy loading patterns

Searching by problem

You: "What does our memory say about handling slow page loads?"

Finds the most relevant solutions, even if they don't explicitly mention "slow":

  • Caching decisions
  • Query optimization
  • Asset compression strategies

Searching by area

You: "Retrieve all security-related decisions from memory."

Finds decisions tagged or conceptually related to security:

  • Password hashing approach
  • Token expiry settings
  • Rate limiting implementation

Understanding RAG Results

When your AI assistant queries the synthetic memory, it receives relevance scores that guide its responses:

  • 0.8+ — Extremely relevant context
  • 0.5–0.8 — Structurally related information
  • 0.3–0.5 — Loose thematic connections
  • Below 0.3 — Likely noise (usually ignored by the RAG system)

You: "Show me the full context for decision-23."

AI: "Decision-23: Choosing PostgreSQL over MongoDB

  • Rationale: ACID transactions are mandatory for payment reliability. MongoDB's eventual consistency model was rejected for financial data integrity.
  • Tags: database, postgresql, payments
  • Created: 3 months ago"

Tips for Better RAG Queries

Be specific about the context

Less effective: "Database decisions"

More effective: "What have we decided about database performance and horizontal scaling?"

Describe the underlying problem

Less effective: "Redis decisions"

More effective: "How are we currently handling high-concurrency traffic?"

Use natural language

Less effective: "auth jwt session"

More effective: "Why did we choose JWT instead of traditional sessions?"

How the RAG System Works

Continuity's RAG system uses highly optimized MiniLM embeddings — a local AI model that maps meaning into a vector space.

  1. Embedding: Decisions are converted into 384-dimensional vectors.
  2. Indexing: These vectors form the project's long-term synthetic memory.
  3. Retrieval: Your search query is converted into a vector.
  4. Ranking: The system finds the "nearest neighbors" in the vector space (the most similar meanings).

100% Local & Private: All RAG processing happens on your machine. No data is sent to external APIs for embedding or search.

When to Consult Memory

Before committing to a new direction

You: "Before we implement a state management library, search our memory for any prior related decisions."

AI: "I found decision-12 which recommends avoiding global state. We haven't committed to a specific library yet."

During developer onboarding

You: "Search for the most important architectural decisions that define this project's structure."

While troubleshooting

You: "Search the synthetic memory for decisions related to our error handling strategy."

When verifying assumptions

You: "We're seeing authentication issues. What did we decide about token refresh logic?"

Key Takeaways

  1. RAG is the core — It allows your AI to find context by meaning, not just keywords.
  2. Ask your AI to search — "Search our memory for X" or "What did we decide about Y?"
  3. Check relevance — Higher scores indicate more critical project context.
  4. Describe the problem — RAG excels at finding solutions for described problems.
  5. Private by design — All synthetic memory operations are performed locally.
  6. Local fallback — When native tool mounting is unavailable, consult the .continuity/decisions.json file directly for history.

← Decision Logging | Session Notes →