Skip to content

search_context

Search contexts using semantic vector similarity or keyword matching across summaries and tags.

Overview

The search_context tool finds relevant contexts by searching through AI-generated summaries and tags. Unlike load_context which returns recent contexts chronologically, search_context returns the best matches for your query.

Layer: Core functionality

Purpose: Discover contexts by semantic or keyword matching

Search Routing (updated v3.6.0)

search_context automatically routes to the best available search method:

MethodWhen UsedHow It Works
Vectorize (semantic)Vectorize index populated + match score ≥ 0.6Embeds query, finds nearest contexts by meaning
Keyword fallbackVectorize unavailable, empty, or no high-confidence matchesTokenizes query, searches first meaningful word (3+ chars) via SQL LIKE

v3.6.0 improvements:

  • Results below 0.6 cosine similarity are discarded before falling back — prevents low-confidence Vectorize matches from polluting results
  • Keyword fallback tokenizes the query: "what did we discuss about board approval" searches "what", not the whole phrase verbatim (which would match nothing)
  • Single-character queries (e.g. "a") return nothing instead of matching every context

Semantic search finds conceptually similar contexts even when exact words don't match. Natural language queries like "board approval discussions with manufacturing clients" work correctly once Vectorize is populated.

If contexts were saved before Vectorize was configured, run admin_reindex_all to backfill all projects at once, or reindex_project for a single project.


Parameters

ParameterTypeRequiredDescription
querystringYesSearch keywords or phrase
projectstringNoLimit search to specific project
personality_modestringNoTemporal posture: historian (default), prophet, archaeologist, minimalist

Parameter Details

query

Keywords or phrases to search for. The search is case-insensitive and matches against:

  • AI-generated summaries
  • AI-generated tags
  • Project names

Examples:

  • "authentication OAuth"
  • "database performance"
  • "bug login"

project

Optional project filter. If provided, only searches within that project.

When to use:

  • Leave empty: Search across all projects
  • Specify project: Narrow results to one project

personality_mode (Layer 5)

Shapes how matching contexts are ranked and presented after the initial search:

ModePost-Search RankingOutput Format
historianBy recency (default)Timestamp + tier + causality
prophetBy prediction scoreScore + propagation reasons
archaeologistBy dormancyLast-accessed + tier
minimalistBy recencySummaries only

Example — minimalist mode for programmatic use:

typescript
search_context({
  query: "authentication",
  project: "mobile-app",
  personality_mode: "minimalist"
})

Result:

Decision to use OAuth2 with PKCE for mobile app authentication

Research findings on mobile authentication best practices

Returns

Formatted text with matching contexts, ordered by relevance:

Found 2 context(s) for "authentication":

**mobile-app-auth** (2025-10-17T15:30:00Z)
Decision to use OAuth2 with PKCE for mobile app authentication
Tags: oauth, security, mobile, authentication, pkce

**api-gateway** (2025-10-17T14:20:00Z)
Implemented JWT token validation in API gateway middleware
Tags: jwt, authentication, api-gateway, middleware, security

Examples

typescript
search_context({
  query: "OAuth authentication"
})

Searches across all projects for OAuth-related contexts.


typescript
search_context({
  query: "performance optimization",
  project: "api-service"
})

Only searches within the "api-service" project.


Multi-Word Queries

typescript
search_context({
  query: "database connection pool"
})

Finds contexts mentioning databases, connections, and pooling.


Use Cases

typescript
// Working on authentication
search_context({ query: "authentication" });

// Returns all auth-related contexts across projects

2. Knowledge Discovery

typescript
// "How did we handle this before?"
search_context({ query: "rate limiting" });

// Find previous implementations

3. Bug Investigation

typescript
// Similar bug happened before
search_context({ query: "timeout error database" });

// Find related incidents

Best Practices

Use Specific Terms

typescript
// ✅ Good: Specific
search_context({ query: "OAuth2 PKCE mobile" });

// ❌ Bad: Too vague
search_context({ query: "auth" });

Combine with Project Filter

typescript
// ✅ Good: Narrow scope
search_context({
  query: "performance",
  project: "api-service"
});

// ❌ Less efficient: Too broad
search_context({ query: "performance" });

See Also