This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a Python-based coding agent project using UV for dependency management. The project requires Python >=3.13.
uv run python main.py- Run the interactive coding agentuv sync- Install/sync dependenciesuv add <package>- Add new dependencyuv run ruff check- Run linting (ruff is included in dependencies)uv run ruff format- Format code
Copy .env.example to .env and set:
ANTHROPIC_API_KEY- Required for the agent to function
This is a conversational coding agent that interacts with Claude's API to provide file manipulation capabilities through a chat interface.
Agent Class (main.py:178-296)
- Main conversation loop with tool execution
- Handles continuous chat interaction until Ctrl+C
- Uses Claude Sonnet 3.7 model for inference
- Manages conversation history and tool results
Tool System (main.py:21-176)
ToolDefinitionclass wraps tools with schemas- Three core tools:
read_file,list_files,edit_file - Tools use JSON schemas for input validation
edit_filesupports both editing existing files and creating new ones
- Interactive CLI with colored output (blue for user, yellow for Claude, green for tools)
- Tool execution is logged with function name and parameters
- File operations are relative to working directory
- Error handling for file operations and API calls
- Conversation continues until manual interrupt
- File Reading: Read any file in the working directory tree
- Directory Listing: Recursive file/directory listing with JSON output
- File Editing: String replacement editing, creates files if they don't exist