Skip to content

Overview

contox_search performs semantic search across all project memory using V2 embeddings. It searches across context names, descriptions, and content to find the most relevant matches. This is useful for finding specific code patterns, function signatures, API endpoints, component props, or any information stored in the project memory.

Unlike keyword search, semantic search understands meaning — searching for "authentication" will also find results about "login", "JWT tokens", and "session management".

Parameters

NameTypeRequiredDefaultDescription
querystringYesSearch query — searches across all context content, names, and descriptions

Return value

Returns up to 10 results with a minimum similarity threshold of 0.65. Each result includes:

FieldTypeDescription
titlestringTitle of the matching memory item
typestringItem type (e.g., memory, reference, system)
similaritynumberSemantic similarity score (0-1)
confidencenumberConfidence score of the memory item (0-1)
schemaKeystringBrain schema key of the matching item
filesstring[]Associated file paths (up to 5 shown)
factsstringExtracted factual content from the memory item

If no results meet the minimum similarity threshold, a message indicating zero results is returned along with the total number of candidates searched.

Usage examples

Searching for a specific pattern

User: How did we handle authentication?

Claude calls: contox_search({ query: "authentication" })

Response:
Found 3 result(s) for "authentication" (semantic, 45 candidates):

## JWT Authentication System
> memory | similarity: 0.912 | confidence: 0.95 | root/implementation
> files: src/lib/auth.ts, src/middleware.ts

Implemented JWT-based auth with access/refresh token rotation.
Protected routes use withAuth middleware.

## Auth Middleware Pattern
> memory | similarity: 0.856 | confidence: 0.90 | root/architecture
> files: src/middleware.ts, src/lib/auth-config.ts

All /dashboard/* routes are protected by Next.js middleware.
Public routes whitelisted in auth-config.ts.

Finding component usage

Claude calls: contox_search({ query: "Button component props" })

Notes

  • The search uses V2 semantic embeddings, which requires the HMAC secret to be configured.
  • Results are ranked by similarity score, with a minimum threshold of 0.65.
  • The search limit is 10 results per query.
  • Search examples from the tool description: "useAuth", "stripe", "password reset", "Button props", "GET /api/contexts".
  • For broader context retrieval, consider using contox_context_pack which assembles a token-budgeted pack based on semantic relevance.