Engineered for Minimal Token Overhead
Standard coding assistants waste thousands of tokens dumping entire raw files into model context. CACode uses 5 specialized, token-efficient tools.
1. Targeted File Reader (read_file)
Reads exact line windows with 1-indexed numbering and continuation tokens:
read_file(path="src/main.rs", offset=120, limit=40)
- Enforces a 100KB budget to prevent context window pollution.
- Automatically extracts text layers from PDF, docx, and tabular files.
2. Fuzzy AST Patcher (patch_file)
Applies surgical find-and-replace unified diffs without rewriting entire files:
patch_file(path="src/server.go", old_string="port := 8080", new_string="port := envPort()")
- Features 9 fuzzy whitespace matching strategies to avoid whitespace drift failures.
- Runs syntax linter automatically post-edit to verify code integrity.
3. High-Speed Workspace Search (search_files)
Powered by an embedded native Ripgrep engine:
target="content": Ultra-fast regex search inside project source code.target="files": Glob-pattern file finder honoring.gitignorerules.
4. Sandboxed Terminal Execution (execute_command)
Executes compilers, linters, package managers, and test suites:
- Supports foreground synchronous execution and background daemons.
- Auto-truncates excessive stdout (saving full logs to scratch files) to prevent prompt bloat.
5. Symbol & Codebase Outline (inspect_symbols)
Uses tree-sitter parsers to extract functions, structs, interfaces, and methods without loading entire file bodies into LLM context.