A sophisticated terminal-based coding agent that accepts natural language instructions, interprets them into structured code generation or execution commands, and manages an interactive development workflow.
- Natural Language Interface: Communicate with the agent using plain English
- Multi-Turn Conversations: Agent remembers context and previous actions
- Safe Code Execution: Sandboxed environment with AST validation and resource limits
- File Management: Create, edit, and version code files with rollback capability
- Interactive Workflow: Review changes before they're applied
- Real-Time Feedback: See the agent's reasoning and execution steps
The agent follows the ReAct (Reason-Act-Observe) pattern:
User Input → Agent Reasoning → Tool Execution → Observation → Response
- CLI Interface: Rich terminal UI for user interaction
- Agent Orchestrator: Central coordination hub implementing the ReAct loop
- LLM Provider: Claude API integration for natural language understanding
- Tool Registry: Extensible system for file operations, code execution, and search
- Execution Environment: Sandboxed code execution with security layers
- File System Management: Version control with snapshots and rollback
- Python 3.10 or higher
- Anthropic API key
- (Optional) E2B API key for cloud sandboxing
- Clone the repository:
git clone https://github.com/YOUR_USERNAME/terminal-coding-agent.git
cd terminal-coding-agent- Create a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txt- Set up environment variables:
cp .env.example .env
# Edit .env and add your API keys- Install the package in development mode:
pip install -e .python -m src.cliYou: Create a Python function for quicksort in sorts.py
You: Open utils.py and add logging to all functions
You: Modify the last function to handle empty lists
You: Run the tests in test_main.py
You: Show me what files have been changed
You: Rollback to the previous version
/help- Show available commands/history- View conversation history/rollback- Revert to a previous snapshot/clear- Clear conversation history/exitor/quit- Exit the agent
Edit config.yaml to customize:
- Model selection
- Token limits
- Sandbox settings
- Tool availability
- Safety settings
coding-agent/
├── src/
│ ├── agent.py # Core agent orchestrator
│ ├── cli.py # Terminal interface
│ ├── llm_provider.py # Claude API wrapper
│ ├── config.py # Configuration loader
│ ├── tools/ # Tool implementations
│ ├── execution/ # Sandboxed execution
│ └── utils/ # Utilities
├── tests/ # Unit tests
├── config.yaml # Configuration
└── requirements.txt # Dependencies
pytest tests/- Create a new tool in
src/tools/ - Inherit from
BaseTool - Implement
execute()method - Register in
src/tools/__init__.py
- AST parsing to detect dangerous patterns
- Blocks dangerous imports (os, subprocess, socket)
- Prevents file system access outside working directory
- CPU time: 5 seconds max
- Memory: 100MB limit
- Single process only
- No network access
- Automatic snapshots before destructive operations
- Easy rollback to previous states
- Full audit trail of changes
- Phase 1: Basic file operations and ReAct loop
- Phase 2: Safe code execution with sandboxing
- Phase 3: Advanced context management for large codebases
- Phase 4: Git integration
- Phase 5: Multi-file refactoring
- Phase 6: Test generation and execution
[Link to YouTube demo with captions enabled]
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
We welcome contributions! Please see our Contributing Guide for details.
MIT License - see LICENSE file for details
- Inspired by Claude Code, OpenAI Codex CLI, and other coding agents
- Built with Anthropic's Claude API
- Thanks to the E2B team for sandboxing infrastructure
Colin J. Emmanuel - c.j.emmanuel@columbia.edu
Project Link: https://github.com/Colin-J-Emmanuel/terminal-coding-agent