Skip to content

CLI Reference

Auto-generated from the registered Click command tree. CodexA provides 39 commands. All commands support --json for machine-readable output.

Core Commands

codexa init

Initialize a project for semantic code indexing. Creates a .codexa/ directory with default configuration.

bash
codexa init [PATH]
codexa init --index          # Init + build index
codexa init --vscode         # Init + VS Code MCP config
codexa init --index --vscode # Full setup in one command

codexa index

Index a codebase for semantic search. Scans files, extracts chunks, generates embeddings.

bash
codexa index .
codexa index . --force    # Full re-index
codexa index . --watch    # Index then watch for changes (live re-indexing)
FlagTypeDefaultDescription
--forcebooleanfalseForce full re-index, ignoring cache
--watchbooleanfalseAfter indexing, watch for file changes and re-index incrementally

codexa doctor

Check environment health, dependencies, and project status.

bash
codexa doctor
codexa doctor --json

codexa languages

List all supported tree-sitter languages with file extensions and grammar status.

bash
codexa languages
codexa languages --check   # Verify grammar loading for each language
codexa languages --json

Search & Discovery

Search the indexed codebase using a natural language query.

bash
codexa search "jwt verification"
codexa search "database connection" --mode hybrid
codexa search "def\s+authenticate" --mode regex -n
codexa search "error handling" --mode keyword --full-section
codexa search "TODO" --mode regex -l
codexa search "pattern" --jsonl | jq .file_path
FlagTypeDefaultDescription
--top-k, -kintegerNumber of results
--json-output, --jsonbooleanfalseJSON output
--jsonlbooleanfalseOne JSON object per line
--mode, -mchoicesemanticsemantic, keyword, regex, or hybrid
--full-section, --fullbooleanfalseShow full enclosing function/class
--no-auto-indexbooleanfalseDisable automatic indexing
--case-sensitive, -sbooleanfalseCase-sensitive (regex only)
--context-lines, -Cinteger0Context lines around matches
--files-only, -lbooleanfalsePrint only file paths (grep -l)
--files-without-match, -LbooleanfalsePrint paths without matches (grep -L)
--line-numbers, -nbooleanfalsePrefix with line numbers (grep -n)
--path, -pdirectory.Project root path

codexa explain

Explain a code symbol or all symbols in a file.

bash
codexa explain MyClass -f src/models.py
codexa explain --file src/main.py .
codexa explain search_codebase --json
FlagTypeDefaultDescription
--file, -fpathSource file containing the symbol
--json-output, --jsonbooleanfalseJSON output
--path, -pdirectory.Project root path

codexa context

Generate structured context for external AI pipelines.

bash
codexa context query "authentication"
codexa context symbol MyClass
codexa context file src/main.py
codexa context repo

Modes: query (semantic search), symbol (symbol context), file (file context), repo (repo summary).

FlagTypeDefaultDescription
--top-k, -kinteger5Results for query mode
--file-path, -ftextFile path hint (symbol mode)
--json-output, --jsonbooleanfalseJSON output
--path, -pdirectory.Project root path

codexa deps

Show the dependency/import map for a file or project.

bash
codexa deps src/main.py
codexa deps . --json

codexa summary

Generate a structured summary of the repository.

bash
codexa summary
codexa summary --json

AI-Powered Commands

codexa ask

Ask a natural-language question about the codebase.

bash
codexa ask "How does authentication work?"
codexa ask "What does search_codebase do?" --json
FlagTypeDefaultDescription
--top-k, -kinteger5Context snippets to retrieve
--json-output, --jsonbooleanfalseJSON output
--path, -pdirectory.Project root path

codexa chat

Multi-turn conversation about the codebase.

bash
codexa chat "How does auth work?"
codexa chat --session my-session "Follow up"
codexa chat --list-sessions
codexa chat --stream "Explain the flow"
FlagTypeDefaultDescription
--session, -stextSession ID to resume
--list-sessionsbooleanfalseList all sessions
--max-turns, -tinteger20Max conversation turns
--streambooleanfalseStream tokens
--json-output, --jsonbooleanfalseJSON output
--path, -pdirectory.Project root path

codexa investigate

Autonomous multi-step investigation to answer a question.

bash
codexa investigate "Find all security vulnerabilities"
codexa investigate "How is payment flow implemented?" --max-steps 10
FlagTypeDefaultDescription
--max-steps, -ninteger6Maximum steps before conclusion
--streambooleanfalseStream conclusion tokens
--json-output, --jsonbooleanfalseJSON output
--path, -pdirectory.Project root path

codexa review

AI-assisted code review.

bash
codexa review src/main.py
codexa review src/utils.py --json

codexa refactor

AI-powered refactoring suggestions.

bash
codexa refactor src/main.py
codexa refactor src/utils.py -i "Extract duplicated logic"
FlagTypeDefaultDescription
--instruction, -itextImprove qualityRefactoring instruction
--json-output, --jsonbooleanfalseJSON output

codexa suggest

Intelligent suggestions for a symbol, file, or topic.

bash
codexa suggest search_codebase
codexa suggest "error handling patterns" --json

codexa cross-refactor

Find duplicate logic across workspace repos.

bash
codexa cross-refactor --threshold 0.70

Quality & Metrics

codexa quality

Analyze code quality — complexity, dead code, duplicates, security.

bash
codexa quality
codexa quality --json
codexa quality --safety-only --pipe
codexa quality --complexity-threshold 15
FlagTypeDefaultDescription
--complexity-thresholdinteger10Min complexity to report
--safety-onlybooleanfalseSecurity-only fast mode
--json-output, --jsonbooleanfalseJSON output
--pipebooleanfalsePlain text for CI
--path, -pdirectory.Project root path

codexa metrics

Compute quality metrics, save snapshots, track trends.

bash
codexa metrics
codexa metrics --snapshot --json
codexa metrics --history 10
codexa metrics --trend
FlagTypeDefaultDescription
--snapshotbooleanfalseSave a quality snapshot
--historyinteger0Show last N snapshots
--trendbooleanfalseShow trend analysis
--json-output, --jsonbooleanfalseJSON output
--pipebooleanfalsePlain text for CI

codexa gate

Enforce quality gates for CI.

bash
codexa gate --strict
codexa gate --min-maintainability 60 --max-complexity 15
FlagTypeDefaultDescription
--min-maintainabilityfloat40.0Min MI score
--max-complexityinteger25Max complexity
--max-issuesinteger20Max total issues
--strictbooleanfalseExit code 1 on failure

codexa hotspots

Identify high-risk code hotspots.

bash
codexa hotspots
codexa hotspots --top-n 10 --json
codexa hotspots --no-git --pipe
FlagTypeDefaultDescription
--top-n, -ninteger20Number of hotspots
--include-git / --no-gitbooleantrueInclude git churn

codexa impact

Analyze blast radius of a change.

bash
codexa impact parse_file
codexa impact src/parser.py --json
codexa impact MyClass --max-depth 3 --pipe
FlagTypeDefaultDescription
--max-depth, -dinteger5BFS depth limit

codexa trace

Trace execution relationships for a symbol.

bash
codexa trace parse_file
codexa trace MyClass.process --json
FlagTypeDefaultDescription
--max-depth, -dinteger5Traversal depth

codexa pr-summary

Generate a Pull Request intelligence report.

bash
codexa pr-summary
codexa pr-summary --json
codexa pr-summary -f src/main.py -f src/utils.py

Servers & Integration

codexa serve

Start the HTTP bridge server for AI agents.

bash
codexa serve --port 24842
FlagTypeDefaultDescription
--host, -htext127.0.0.1Host to bind
--port, -pinteger24842Port to bind
--pathdirectory.Project root

codexa web

Start the web interface and REST API.

bash
codexa web
codexa web --port 9000 --host 0.0.0.0
FlagTypeDefaultDescription
--host, -htext127.0.0.1Host to bind
--port, -pinteger8080Port to bind
--pathdirectory.Project root

codexa mcp

Start the MCP server for Claude/Cursor. Exposes 13 tools.

bash
codexa mcp --path /your/project

Performance & Diagnostics

codexa grep

Search raw files using regex — no index required.

bash
codexa grep "TODO|FIXME"
codexa grep "def authenticate" -g "*.py"
codexa grep "password" --case-sensitive
codexa grep "import re" --json
codexa grep "class.*Service" -l
FlagTypeDefaultDescription
--path, -pdirectory.Root directory to search
--case-sensitive, -sflagfalseCase-sensitive matching
--max-results, -ninteger100Max matches
--glob, -gtext(none)File glob filter (e.g. *.py)
--no-ripgrepflagfalseForce pure-Python search
--jsonflagfalseJSON output
--files-only, -lflagfalsePrint only file paths

codexa benchmark

Performance benchmarking — indexing speed, search latency, memory usage.

bash
codexa benchmark
codexa benchmark --json
FlagTypeDefaultDescription
--path, -pdirectory.Project root
--jsonflagfalseJSON output

### `codexa lsp`

Start the Language Server Protocol server (stdio).

```bash
codexa lsp --path /your/project

codexa tui

Interactive terminal search interface.

bash
codexa tui
codexa tui --mode hybrid -k 20
FlagTypeDefaultDescription
--mode, -mchoicehybridDefault search mode
--top-k, -kinteger10Results per query

Code Generation & Automation

codexa evolve

Run the self-improving development loop.

bash
codexa evolve
codexa evolve --iterations 5 --budget 50000
codexa evolve --timeout 300
FlagTypeDefaultDescription
--iterations, -ninteger3Max improvement iterations
--budget, -binteger20000Max total tokens
--timeout, -tinteger600Max wall-clock seconds

codexa ci-gen

Generate CI/CD workflow templates.

bash
codexa ci-gen analysis       # Full analysis workflow
codexa ci-gen safety         # Lightweight safety-only
codexa ci-gen precommit      # Pre-commit hook config

codexa docs

Generate documentation for CodexA components.

bash
codexa docs
codexa docs --section plugins -o reference/

codexa viz

Generate Mermaid diagrams from codebase analysis.

bash
codexa viz callgraph
codexa viz deps --target src/main.py
codexa viz symbols --target auth.py
codexa viz workspace
FlagTypeDefaultDescription
--target, -ttextSymbol or file to visualize
--output, -ofileWrite to file instead of stdout

codexa watch

Watch for changes and re-index automatically.

bash
codexa watch
codexa watch --interval 5

Model Management

codexa models list

List available embedding models.

codexa models info <name>

Show detailed model information.

codexa models download <name>

Pre-download a model for offline use.

codexa models switch <name>

Switch active embedding model (requires re-index).

Plugin Management

codexa plugin list

List discovered plugins.

codexa plugin info <name>

Show plugin details.

codexa plugin new <name>

Scaffold a new plugin from template.

bash
codexa plugin new my-formatter
codexa plugin new lint-checker --hooks CUSTOM_VALIDATION,POST_AI
codexa plugin new metrics -o ./plugins/ -a "Your Name"

Workspace Management

codexa workspace init

Initialize a new workspace.

codexa workspace add <name> <path>

Register a repository in the workspace.

codexa workspace list

List all registered repositories.

codexa workspace remove <name>

Unregister a repository.

codexa workspace index

Index workspace repositories.

codexa workspace search <query>

Search across all workspace repos.

bash
codexa workspace search "authentication" --top-k 10 --json
codexa workspace search "auth" --repo backend --repo frontend