Install
openclaw skills install @wei840222/cx-cliSemantic code navigation with `cx` CLI. Use when you need to understand code structure before reading files, find symbol definitions, trace references before refactoring, or explore large codebases efficiently. Triggers: 'cx overview', 'cx symbols', 'cx definition', 'cx references', 'code structure', 'find function', 'where is X defined', 'who calls X', 'semantic navigation'.
openclaw skills install @wei840222/cx-cliUse cx to navigate code semantically before reading full files. This saves tokens and focuses attention on relevant code.
Always follow this order: overview → symbols → definition / references → read
| Goal | Command | Token Cost |
|---|---|---|
| Understand file structure | cx overview <file> | ~200 tokens |
| Find symbols across project | cx symbols [--kind K] [--name GLOB] | ~300 tokens |
| Read specific function/type | cx definition --name <name> | ~500 tokens |
| Find all usages of symbol | cx references --name <name> | ~200 tokens |
| Full file context (last resort) | read <file> | ~2000+ tokens |
# File structure (all symbols + signatures)
cx overview PATH
# Symbol search across project
cx symbols [--kind K] [--name GLOB] [--file PATH]
# Symbol body (function/type definition)
cx definition --name NAME [--from PATH] [--kind K] [--max-lines N]
# Symbol usages (call sites, references)
cx references --name NAME [--file PATH]
# Language management
cx lang list # Show installed grammars
cx lang add LANG [LANG...] # Install grammars (rust, typescript, python, go, etc.)
# Cache management
cx cache path # Show cache location
cx cache clean # Delete cached index
Short aliases: cx o, cx s, cx d, cx r
Symbol kinds: fn, method, struct, enum, trait, type, const, class, interface, module, event
cx overview first to understand structurecx definition --name X to capture exact textcx references --name X to understand impactcx symbols first, then narrow with cx definitioncx overviewunsupported file typeSTOP and verify:
cx lang list to check)cx: unsupported file type: .mdCause: cx only parses source code, not markup/config files
Fix: Use read tool directly for .md/.yaml/.json files
cx: database locked, waiting...Cause: Another cx process holds the index lock Fix:
cx cache clean to resetcx: file not in index: <path>Cause: File not yet indexed (new file or outside project root) Fix: Ensure file is within git root; cx auto-indexes on first query
cx: missing grammar for <language>Cause: Language grammar not installed
Fix: cx lang add <language> (e.g., cx lang add rust typescript)
cx: symbol not found: <name>Cause: Symbol doesn't exist or name is misspelled Fix:
cx symbols --name "*partial*" with glob patterncx overview <file> to see available symbols| ❌ Wrong | ✅ Right | Why |
|---|---|---|
cx overview README.md | read README.md | cx doesn't parse Markdown |
cx definition --name main without context | cx definition --name main --from src/app.py | Ambiguous names need --from disambiguation |
| Reading full file before checking structure | cx overview file.py → then targeted cx definition | Saves 80%+ tokens |
cx symbols with exact name | cx symbols --name "*handler*" | Use glob patterns for discovery |
Ignoring cx lang list errors | Install missing grammars first | cx silently skips unsupported files |
| Using cx for YAML/JSON config | Use read or grep | cx only parses source code |
# Step 1: Find all functions
cx symbols --kind fn
# Step 2: Look at entry point
cx definition --name main --from src/main.py
# Step 3: Trace dependencies
cx references --name main
# Step 1: Find all usages before renaming
cx references --name old_function_name
# Step 2: Read the definition
cx definition --name old_function_name
# Step 3: Now edit with confidence
# Step 1: Find the error function
cx symbols --name "*error*" --kind fn
# Step 2: Get its definition
cx definition --name handle_error --from src/errors.py
# Step 3: Find who calls it
cx references --name handle_error
| Document | Purpose |
|---|---|
references/decision-tree.md | Visual decision tree for when/how to use cx |
references/output-examples.md | Real output samples from each command |
See references/output-examples.md for real output samples from each command. Key points:
--json flag for machine-parseable JSONInstall from crates.io package cx-cli:
cargo install cx-cli
If cx reports a missing grammar:
cx lang add rust typescript python go
Before running any cx command, verify:
cx lang list to verify language support*partial*) for discovery, not exact namesIf command fails:
--json flag for machine-parseable outputread tool if cx doesn't support the file type