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:
| Method | When Used | How It Works |
|---|---|---|
| Vectorize (semantic) | Vectorize index populated + match score ≥ 0.6 | Embeds query, finds nearest contexts by meaning |
| Keyword fallback | Vectorize unavailable, empty, or no high-confidence matches | Tokenizes 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
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Search keywords or phrase |
project | string | No | Limit search to specific project |
personality_mode | string | No | Temporal 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:
| Mode | Post-Search Ranking | Output Format |
|---|---|---|
historian | By recency (default) | Timestamp + tier + causality |
prophet | By prediction score | Score + propagation reasons |
archaeologist | By dormancy | Last-accessed + tier |
minimalist | By recency | Summaries only |
Example — minimalist mode for programmatic use:
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 practicesReturns
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, securityExamples
Global Search
search_context({
query: "OAuth authentication"
})Searches across all projects for OAuth-related contexts.
Project-Specific Search
search_context({
query: "performance optimization",
project: "api-service"
})Only searches within the "api-service" project.
Multi-Word Queries
search_context({
query: "database connection pool"
})Finds contexts mentioning databases, connections, and pooling.
Use Cases
1. Find Related Work
// Working on authentication
search_context({ query: "authentication" });
// Returns all auth-related contexts across projects2. Knowledge Discovery
// "How did we handle this before?"
search_context({ query: "rate limiting" });
// Find previous implementations3. Bug Investigation
// Similar bug happened before
search_context({ query: "timeout error database" });
// Find related incidentsBest Practices
Use Specific Terms
// ✅ Good: Specific
search_context({ query: "OAuth2 PKCE mobile" });
// ❌ Bad: Too vague
search_context({ query: "auth" });Combine with Project Filter
// ✅ Good: Narrow scope
search_context({
query: "performance",
project: "api-service"
});
// ❌ Less efficient: Too broad
search_context({ query: "performance" });See Also
- load_context - Get recent contexts
- save_context - Save new contexts
