You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The search command is Probe's primary tool for semantic code search. It combines ripgrep's speed with tree-sitter's AST parsing and intelligent ranking algorithms to find relevant code across your codebase.
probe search "\"exact phrase\""# Must match exactly
probe search "'user login'"# Alternative quoting
Search Hints (Filters)
Filter results using special hint syntax within your query:
Hint
Example
Description
ext:<ext>
"function AND ext:rs"
Filter by file extension
file:<pattern>
"class AND file:src/**/*.py"
Filter by file path pattern
path:<pattern>
"error AND path:tests"
Alias for file pattern
dir:<pattern>
"config AND dir:settings"
Filter by directory
type:<type>
"struct AND type:rust"
Filter by ripgrep file type
lang:<language>
"component AND lang:javascript"
Filter by programming language
filename:<name>
"main AND filename:app.ts"
Exact filename match
Examples
# Search only in Rust files
probe search "impl AND ext:rs" ./src
# Search in test directories
probe search "assert AND dir:tests" ./
# Search TypeScript React components
probe search "useState AND lang:typescript AND file:**/*.tsx" ./src
Probe can search inside your project's dependencies (node_modules, Go modules, Rust crates). This is useful for understanding how libraries work or finding usage patterns.
Dependency Path Syntax
Use language-specific prefixes to search within dependencies:
Prefix
Language
Example
go:
Go
go:github.com/gin-gonic/gin
js:
JavaScript/Node.js
js:express or js:@ai-sdk/anthropic
rust:
Rust
rust:serde
Examples
# Search in a Go dependency
probe search "Context" go:github.com/gin-gonic/gin
# Search in an npm package
probe search "createClient" js:redis
# Search in a scoped npm package
probe search "createAnthropic" js:@ai-sdk/anthropic
# Search in a Rust crate
probe search "Serialize" rust:serde
# Search in a subdirectory of a dependency
probe search "Router" go:github.com/gin-gonic/gin/examples
Probe resolves dependency paths to their actual filesystem locations:
Language
Resolution Path
Go
$GOPATH/pkg/mod/ or Go module cache
JavaScript
node_modules/ in project or global
Rust
~/.cargo/registry/src/
Use Cases
Understanding library internals: Search how a library implements a feature
Finding examples: Search for usage patterns within library code
Debugging: Locate where an error originates in a dependency
Learning: Study well-written open source code
# How does gin handle middleware?
probe search "middleware AND handler" go:github.com/gin-gonic/gin
# How does express parse JSON?
probe search "json AND parse" js:express
# How does serde handle optional fields?
probe search "Option AND deserialize" rust:serde
src/auth/login.ts
├─ login (function) [15-42]
│ Handles user authentication with email/password
└─ validateCredentials (function) [44-58]
Validates user credentials against database
Common Patterns
AI Context Optimization
# Search with token limit for Claude
probe search "authentication flow" ./ --max-tokens 8000 --format json
# Include test examples
probe search "user service" ./ --allow-tests --max-tokens 10000
Codebase Exploration
# Find all API endpoints
probe search "router OR endpoint OR handler" ./ --files-only
# Find error handling patterns
probe search "(catch OR error OR exception) AND handle" ./src
Code Review
# Find TODOs and FIXMEs
probe search "TODO OR FIXME OR HACK" ./ --format markdown
# Find deprecated code
probe search "deprecated OR obsolete" ./src
Integration with AI Tools
# Pipe to clipboard for ChatGPT
probe search "database connection" ./ --format markdown | pbcopy
# Use with LLM CLI tools
probe search "api handler" ./ --format json | llm "explain this code"
Performance Tips
Use language filters when you know the target language
Set max-results to avoid processing unnecessary matches