CLI Reference

All ChunkHound commands and their options.

chunkhound index

Index a directory for code search. Parses source files, generates embeddings, and stores chunks in the database.

chunkhound index [path] [options]
ArgumentDescription
pathDirectory to index (default: .)

Options:

FlagDescription
--config PATHPath to configuration file
--simulateDry-run: show which files would be indexed without making changes
--jsonOutput as JSON (with --simulate or --check-ignores)
--all-discoveredShow files before change-detection pruning
--show-sizesInclude file sizes in output
--sort {path,size,size_desc}Sort output
--check-ignoresCompare ignore decisions vs git
--vs {git}Sentinel for --check-ignores
--debug-ignoresPrint ignore context to stderr
--profile-startupEmit phase timings as JSON to stderr
--discovery-backend {auto,python,git,git_only}Override file discovery backend
--perf-diagnosticsCollect per-batch timing metrics
--perf-output PATHOutput path for performance JSON
--verboseVerbose output
--debugDebug output

Config-override flags (override values from .chunkhound.json):

Database, embedding, and indexing options can be set via CLI flags. These follow the pattern --database-provider, --embedding-model, --indexing-exclude, etc.

Examples:

# Index current directory
chunkhound index

# Index a specific project
chunkhound index /path/to/project

# Dry-run to see what would be indexed
chunkhound index --simulate

# Dry-run with JSON output
chunkhound index --simulate --json

# Compare ignore decisions against git
chunkhound index --check-ignores --vs git

Search an indexed codebase using semantic or regex search.

chunkhound search <query> [path] [options]
ArgumentDescription
querySearch query (required)
pathProject directory (default: .)

Options:

FlagDescription
--semanticSemantic search (default)
--single-hopForce single-hop semantic search
--multi-hopForce multi-hop semantic search
--regexRegex pattern search (no embeddings required)
--page-size NResults per page (default: 10)
--offset NPagination offset
--path-filter PATHFilter results by file path
--config PATHPath to configuration file
--verboseVerbose output
--debugDebug output

Examples:

# Semantic search
chunkhound search "authentication flow"

# Regex search (no API key needed)
chunkhound search --regex "def.*auth"

# Filter by path
chunkhound search "database connection" --path-filter src/db/

# Paginate results
chunkhound search "error handling" --page-size 5 --offset 10

chunkhound research

Deep code research. Generates a synthesized answer with citations by searching the codebase, reading relevant files, and using an LLM to analyze the results.

chunkhound research <query> [path] [options]
ArgumentDescription
queryResearch question (required)
pathProject directory (default: .)

Options:

FlagDescription
--path-filter PATHFilter results by file path
--config PATHPath to configuration file
--verboseVerbose output
--debugDebug output

Examples:

# Research a topic
chunkhound research "How does the auth system work?"

# Scoped to a subdirectory
chunkhound research "How are database migrations handled?" --path-filter src/db/

chunkhound mcp

Run ChunkHound as an MCP (Model Context Protocol) server for AI assistant integration.

chunkhound mcp [path] [options]
ArgumentDescription
pathProject directory (default: .)

Options:

FlagDescription
--no-daemonRun without daemon (single client mode)
--config PATHPath to configuration file
--verboseVerbose output
--debugDebug output

Examples:

# Start MCP server for current directory
chunkhound mcp

# Start MCP server for a specific project
chunkhound mcp /path/to/project

chunkhound map

Generate agent-facing documentation from your codebase using Code Mapper.

chunkhound map [path] [options]
ArgumentDescription
pathDirectory to document

Options:

FlagDescription
--out DIROutput directory (required)
--planOnly run the planning pass
--audience {technical,balanced,end-user}Target audience
--context PATHAuthoritative context file
--combined / --no-combinedWrite combined markdown output
-j, --jobs NConcurrent research jobs
--comprehensiveness {minimal,low,medium,high,ultra}Mapping depth
--minimalAlias for --comprehensiveness minimal
--lowAlias for --comprehensiveness low
--mediumAlias for --comprehensiveness medium
--highAlias for --comprehensiveness high
--ultraAlias for --comprehensiveness ultra
--config PATHPath to configuration file
--verboseVerbose output
--debugDebug output

Examples:

# Generate documentation
chunkhound map /path/to/project --out docs/

# Planning pass only
chunkhound map /path/to/project --out docs/ --plan

# High-detail documentation
chunkhound map /path/to/project --out docs/ --high -j 4

chunkhound autodoc

Generate an Astro documentation site from Code Mapper output.

chunkhound autodoc [map-in] [options]
ArgumentDescription
map-inDirectory with Code Mapper outputs

Options:

FlagDescription
--out-dir DIROutput directory (required)
--forceAllow deletion of existing topics
--assets-onlyUpdate only Astro assets
--site-title TEXTOverride site title
--site-tagline TEXTOverride site tagline
--cleanup-mode {llm}Cleanup pass mode
--cleanup-batch-size NSections per LLM batch
--cleanup-max-tokens NMax tokens per cleanup
--audience {technical,balanced,end-user}Target audience
--index-pattern GLOBOverride index globs
--map-out-dir DIROutput directory for auto-generated maps
--map-comprehensiveness {minimal,low,medium,high,ultra}Mapping depth
--map-audienceAudience for auto-generated maps
--map-context PATHContext file for mapper
--config PATHPath to configuration file
--verboseVerbose output
--debugDebug output

Examples:

# Generate docs site from existing map output
chunkhound autodoc map-output/ --out-dir docs-site/

# Update only the generated docs site assets
chunkhound autodoc --assets-only --out-dir docs-site/

# Full pipeline: map and generate docs
chunkhound autodoc --out-dir docs-site/ --map-out-dir map-output/ --map-comprehensiveness high

chunkhound calibrate

Calibrate embedding and reranking batch sizes for optimal performance.

chunkhound calibrate [options]

Options:

FlagDescription
--embedding-batch-sizes N [N ...]Embedding batch sizes to test
--reranking-batch-sizes N [N ...]Reranking batch sizes to test
--test-document-count NNumber of test documents (default: 500)
--num-test-runs NRuns per size (default: 5)
--output-format {text,json}Output format
--output-file PATHWrite results to file
--config PATHPath to configuration file
--verboseVerbose output
--debugDebug output

Examples:

# Run calibration with defaults
chunkhound calibrate

# Test specific batch sizes
chunkhound calibrate --embedding-batch-sizes 64 128 256 512

# Output as JSON
chunkhound calibrate --output-format json --output-file calibration.json

Common Flags

These flags are available on all commands:

FlagDescription
--config PATHPath to .chunkhound.json configuration file
--verboseEnable verbose output
--debugEnable debug output (implies verbose)
--versionShow version and exit
--helpShow help and exit