codebase-search
codebase-search
Semantic local search powered by MorphLLM — an RL-trained subagent that runs ~15-30 internal grep+read operations to answer natural language questions about any project files (code, config, docs, markdown, YAML, JSON, and other text files). Unlike simple grep, it understands intent and traces cross-file flows.
Requires MORPH_API_KEY environment variable.
When to Use
- Understanding how a feature works across multiple files (e.g., "how does the auth middleware validate tokens?")
- Tracing data flow end-to-end (e.g., "what happens when a user clicks checkout?")
- Exploring unfamiliar projects where you don't know what to grep for
- Answering architectural questions (e.g., "how is the database layer organized?")
- Debugging cross-file interactions where the connection isn't obvious
- Finding information in non-code files — config, docs, markdown, YAML, JSON (e.g., "how are the plugin hooks configured?")
When NOT to Use
- Simple keyword or symbol searches (e.g., finding all uses of
handleSubmit) — use Grep - Finding files by name or pattern — use Glob
- Looking up library documentation — use context7
- Questions unrelated to the current codebase
Decision Rule
Can you write the grep pattern yourself? Use Grep — it's faster. Can't write the pattern because the question is conceptual? Use codebase-search.
| Task | Tool |
|---|---|
Find all imports of AuthService |
Grep |
| How does AuthService validate tokens? | codebase-search |
Find files named *.config.ts |
Glob |
| How is the config system structured? | codebase-search |
Find TODO comments |
Grep |
| What's left unfinished in the payment flow? | codebase-search |
Workflow
DO NOT read script source code. Run scripts directly and use --help for usage.
Run a Semantic Search
python3 scripts/codebase-search.py search "<natural language query>" [repo_path]
query— a natural language question about the coderepo_path— path to the repo root (defaults to current directory)
# Search the current repo
python3 scripts/codebase-search.py search "how does the authentication flow work"
# Search a specific repo
python3 scripts/codebase-search.py search "how are database migrations handled" /path/to/repo
# Search including node_modules
python3 scripts/codebase-search.py search "how does the router resolve paths" --search-type node_modules
# Increase timeout for large codebases
python3 scripts/codebase-search.py search "trace the payment processing pipeline" --timeout 180
Run python3 scripts/codebase-search.py --help for full usage.
Example Output
Morph Fast Context subagent performed search on repository:
Relevant context found:
- plugins/ora/agents/ariadne.md:*
- plugins/ora/agents/clio.md:*
- plugins/ora/agents/metis.md:*
Here is the content of files:
<file path="plugins/ora/agents/ariadne.md">
1| ---
2| name: Ariadne
3| description: |
4| Use this agent to explore and understand codebases...
...
35| tools: ["Read", "Glob", "Grep", "LSP", "Bash"]
36| skills:
37| - codebase-search
38| ---
</file>
<file path="plugins/ora/agents/clio.md">
1| ---
2| name: Clio
...
</file>
The output lists relevant files found and their full content. Use these results directly — do not re-search the same files with Grep/Read.
Rules
- Write queries as natural language questions —
"How does the auth middleware validate JWT tokens?"works far better than"auth JWT", because codebase search is an RL-trained agent that plans its own search strategy based on your question. - Be specific about what you want to know —
"What happens when a user submits the settings form?"beats"settings form". The more context you give, the better it can target its internal searches. - Use for understanding, not for finding — If you already know the symbol or keyword, Grep is faster. codebase-search shines when you don't know what to look for.
- Default timeout is 120s — codebase search runs many internal operations. For large codebases, increase with
--timeout 180or higher.
More from trancong12102/agentskills
deps-dev
Look up the latest stable version of any open-source package across npm, PyPI, Go, Cargo, Maven, and NuGet. Use when the user asks 'what's the latest version of X', 'what version should I use', 'is X deprecated', 'how outdated is my package.json/requirements.txt/Cargo.toml', or needs version numbers for adding or updating dependencies. Also covers pinning versions, checking if packages are maintained, or comparing installed vs latest versions. Do NOT use for private/internal packages or for looking up documentation (use context7).
151council-review
Multi-perspective code review that synthesizes findings from multiple reviewers into a unified report. Use when the user asks to review code changes, audit a diff, check code quality, review a PR, review commits, or review uncommitted changes. Also covers 'code review', 'review my changes', 'check this before I merge', or wanting multiple perspectives on code. Do not use for documentation/markdown review or trivial single-line changes.
95oracle
Deep analysis and expert reasoning. Use when the user asks for 'oracle', 'second opinion', architecture analysis, elusive bug debugging, impact assessment, security reasoning, refactoring strategy, or trade-off evaluation — problems that benefit from deep, independent reasoning. Do not use for simple factual questions, code generation, code review (use council-review), or tasks needing file modifications.
93context7
Fetch up-to-date documentation for any open-source library or framework. Use when the user asks to look up docs, check an API, find code examples, or verify how a feature works — especially with a specific library name, version migration, or phrases like 'what's the current way to...' or 'the API might have changed'. Also covers setup and configuration docs. Do NOT use for general programming concepts, internal project code, or version lookups (use deps-dev).
86react-web-advanced
Web-specific React patterns for type-safe file-based routing, route-level data loading, server-side rendering, search param validation, code splitting, and list virtualization. Use when building React web apps with route loaders, SSR streaming, validated search params, lazy route splitting, or virtualizing large DOM lists. Do not use for React Native apps — use react-native-advanced instead.
45react-advanced
Advanced React patterns and conventions for data fetching, tables, forms, state machines, client state management, schema validation, and testing. Use when tackling complex React problems — not simple component questions, but multi-concern tasks like server-driven tables with filtering, multi-step wizards, eliminating useEffect, Suspense architecture, choosing between state management approaches, or designing data flow across server/client/URL/form state. Do not use for web-specific routing/SSR or React Native-specific navigation/performance.
45