A command-line coding agent powered by LangChain, LangGraph, and Anthropic Claude.
- Multi-agent system: specialized agents for code, planning, Q&A, and web search
- Auto-routing: automatically selects the best agent and model for each task
- Codebase indexing: semantic search over your codebase via Chroma + embeddings
- Context compression: auto-summarizes long conversations to save tokens
- Human-in-the-loop: asks for clarification when needed
- LLM-agnostic: built on LangChain abstractions, swap providers easily
- Persistent caching: SQLite cache for LLM responses
- Session history: full JSONL logs of all interactions
pip install cocoOr from source:
git clone <repo>
cd code-assistant
pip install -e .-
Copy
.env.exampleto.envand add your Anthropic API key:cp .env.example .env # Edit .env and set ANTHROPIC_API_KEY=... -
Run
cocoin any directory:coco
-
(Optional) Run
/setupinside coco to configure per-project settings.
coco> /help # Show all commands
coco> /index # Index current codebase for semantic search
coco> /setup # Configure models and settings
coco> /status # Show current config and index stats
# Direct agent commands
coco> /ask how does this codebase work?
coco> /code add a type hint to all functions in utils.py
coco> /plan build a REST API with authentication
coco> /search latest LangGraph documentation
# Auto-routed (coco picks the best agent)
coco> What does the authenticate() function do?
coco> Fix the bug in my parser
coco> /clear # Reset conversation
coco> /exit # Exit
coco stores project config in a .coco file (TOML) in the current directory.
Global settings live in ~/.coco/config.toml.
[model]
complex_model = "claude-sonnet-4-6"
simple_model = "claude-haiku-4-5-20251001"
temperature = 0.0
max_tokens = 4096
[index]
chunk_size = 1000
chunk_overlap = 200
[safety]
confirm_file_writes = true
confirm_shell_commands = truecoco/
├── config/ # TOML config management
├── memory/ # Context compression + JSONL history
├── tools/ # LangChain @tool definitions
├── indexer/ # Chroma codebase indexing
├── graph/ # LangGraph StateGraph workflow
├── agents/ # Specialized agent implementations
└── cli/ # Rich terminal UI + prompt_toolkit REPL
- API keys are read from environment variables only, never written to config files
- File writes require confirmation (configurable)
- Shell commands use argument lists (no shell injection)
- Add
.envto your.gitignore