Files
Claude-Code-Workflow/.claude/workflows/context-tools.md
catlog22 e1cac5dd50 Refactor search modes and optimize embedding generation
- Updated the dashboard template to hide the Code Graph Explorer feature.
- Enhanced the `executeCodexLens` function to use `exec` for better cross-platform compatibility and improved command execution.
- Changed the default `maxResults` and `limit` parameters in the smart search tool to 10 for better performance.
- Introduced a new `priority` search mode in the smart search tool, replacing the previous `parallel` mode, which now follows a fallback strategy: hybrid -> exact -> ripgrep.
- Optimized the embedding generation process in the embedding manager by batching operations and using a cached embedder instance to reduce model loading overhead.
- Implemented a thread-safe singleton pattern for the embedder to improve performance across multiple searches.
2025-12-20 11:08:34 +08:00

1.9 KiB

MCP Tools Usage

smart_search - Code Search (REQUIRED)

When: Find code, understand codebase structure, locate implementations

Workflow (search first, init if needed):

// Step 1: Try search directly (works if index exists or uses ripgrep fallback)
smart_search(query="authentication logic")

// Step 2: Only if search warns "No CodexLens index found", then init
smart_search(action="init", path=".")   // Creates FTS index only

// Note: For semantic/vector search, use "ccw view" dashboard to create vector index

Modes: auto (intelligent routing), hybrid (semantic, needs vector index), exact (FTS), ripgrep (no index)


read_file - Read File Contents

When: Read files found by smart_search

How:

read_file(path="/path/to/file.ts")                   // Single file
read_file(path="/src/**/*.config.ts")                // Pattern matching

edit_file - Modify Files

When: Built-in Edit tool fails or need advanced features

How:

edit_file(path="/file.ts", old_string="...", new_string="...", mode="update")
edit_file(path="/file.ts", line=10, content="...", mode="insert_after")

Modes: update (replace text), insert_after, insert_before, delete_line


write_file - Create/Overwrite Files

When: Create new files or completely replace content

How:

write_file(path="/new-file.ts", content="...")

When: Find documentation/examples outside codebase

How:

mcp__exa__search(query="React hooks 2025 documentation")
mcp__exa__search(query="FastAPI auth example", numResults=10)
mcp__exa__search(query="latest API docs", livecrawl="always")

Parameters:

  • query (required): Search query string
  • numResults (optional): Number of results to return (default: 5)
  • livecrawl (optional): "always" or "fallback" for live crawling