A minimal, interactive CLI coding agent powered by Anthropic's Claude API. It can read, write, edit, and glob files — and run bash commands — all within your project directory.
- Python 3.14+
- An Anthropic API key (or a compatible proxy)
cd my-coding-agent
uv sync
cp .env.example .env # then edit .env with your API keyYour .env file should contain:
ANTHROPIC_API_KEY=sk-ant-...
ANTHROPIC_API_URL=https://api.anthropic.com
ANTHROPIC_MODEL=claude-sonnet-4-20250514| Variable | Required | Default |
|---|---|---|
| ANTHROPIC_API_KEY | Yes | – |
| ANTHROPIC_API_URL | No | https://api.anthropic.com |
| ANTHROPIC_MODEL | No | claude-sonnet-4-20250514 |
uv run python -m src.entry- Type your question across multiple lines, press Enter twice (empty line) to send.
- Type q, exit, or press Ctrl+C to quit.
- Type
/clear contextto reset conversation history.
| Tool | Description |
|---|---|
| bash | Execute a shell command (dangerous commands blocked) |
| read_file | Read a file with optional start/limit |
| write_file | Create or overwrite a file |
| edit_file | Find-and-replace inside a file |
| glob | Find files by pattern (supports **) |
All file operations are sandboxed to the current working directory.
- Hook system — extensible lifecycle hooks (
UserPromptSubmit,PreToolUse,PostToolUse,Stop) insrc/hooks/hooks.py - Permission gate — dangerous bash commands and out-of-workspace writes are blocked via
src/gate/permission_check.py - Thinking display — Claude's chain-of-thought reasoning is shown inline as
🧠(Thinking): ... - Context clearing — type
/clear contextto reset conversation history
| Hook Point | Behavior |
|---|---|
UserPromptSubmit |
Logs the working directory for context |
PreToolUse |
Logs each tool invocation with arguments |
PostToolUse |
Warns if a tool output exceeds 100,000 characters |
Stop |
Prints a summary of total tool calls for the session |
To add custom hooks, use register_hook(hook_name, callback) in hooks/hooks.py.
my-coding-agent/
├── pyproject.toml
├── uv.lock
├── .env.example
├── .env
└── src/
├── __init__.py
├── entry.py
├── config.py
├── tools.py
├── hooks/
│ └── hooks.py
└── gate/
└── permission_check.py
MIT