Claude Engineer is an interactive command-line interface (CLI) that leverages the power of Anthropic's Claude-3.5-Sonnet model to assist with software development tasks. This tool combines the capabilities of a large language model with practical file system operations and web search functionality.
Claude Engineer is an advanced interactive command-line interface (CLI) that harnesses the power of Anthropic’s Claude 3 and Claude 3.5 models to assist with a wide range of software development tasks. This tool seamlessly combines the capabilities of state-of-the-art large language models with practical file system operations, web search functionality, intelligent code analysis, and execution capabilities.
TTS using 11labs WebSockets and audio streaming.
Type
11labs on
to use TTS and 11labs off to return to regualr mode.
Voice mode 🗣️: Now you can talk to the Engineer directly without even touching your keyboard.
Type
voice
to enter voice mode.
Say “exit voice mode” to return to regular text.
If you want to use your voice and 11 labs at the same time, first activate 11labs then type voice to use your voice.
Prompt caching. Make sure you udpate your Anthropic python package before running the script.
pip install --upgrade anthropic
Clone this repository:
git clone https://github.com/doriandarko/claude-engineer.git
cd claude-engineer
Install the required dependencies:
pip install -r requirements.txt
Set up your environment variables:
.env
file in the project root directoryANTHROPIC_API_KEY=your_anthropic_api_key
TAVILY_API_KEY=your_tavily_api_key
Set up the virtual environment for code execution:
Engineer will create a virtual environment to run code the first time it executes a piece of code.
This is just for you if you want to run the main script in a virtual environment rather than in your default one.
python -m venv code_execution_env
source code_execution_env/bin/activate # On Windows, use: code_execution_env\Scripts\activate
pip install -r requirements.txt
deactivate
Claude Engineer uses a dedicated virtual environment for code execution to ensure isolation and security. The virtual environment is automatically created the first time you run a piece of code. However, if you want to set it up manually or customize it, follow these steps:
Create the virtual environment:
python -m venv code_execution_env
Activate the virtual environment:
code_execution_env\Scripts\activate
source code_execution_env/bin/activate
Install the required dependencies:
pip install -r requirements.txt
Deactivate the virtual environment when you’re done:
deactivate
The code_execution_env virtual environment will be used for all code execution tasks, ensuring a consistent and isolated environment for running user code.
Run the main script to start the Claude Engineer interface:
python main.py
Once started, you can interact with Claude Engineer by typing your queries or commands. Some example interactions:
Special commands:
After each interaction, Claude Engineer will display:
Claude Engineer now supports executing code in an isolated ‘code_execution_env’ virtual environment:
execute_code
tool to run Python code safely in the isolated environment.execute_code
.Claude Engineer utilizes multiple specialized AI models:
The script automatically selects the appropriate model based on the task.
The enhanced automode allows Claude to work autonomously on complex tasks with greater efficiency and control. When in automode:
To use automode:
Claude Engineer now supports an improved diff-based file editing system, allowing for more precise and controlled modifications to existing files. The new workflow includes:
edit_and_apply
function without providing new content.edit_and_apply
function with new content, which shows a detailed diff of the proposed changes.When editing files, Claude will:
This feature enhances Claude’s ability to make targeted improvements to your codebase while maintaining the integrity of existing functionality.
The system prompt is now dynamically updated based on whether the script is in automode or not. This allows for more tailored instructions and behavior depending on the current operating mode:
The dynamic system prompt enhances Claude’s ability to adapt to different scenarios and provide more relevant assistance.
Claude Engineer now features improved token management and visualization:
These improvements provide better insights into token usage and help manage conversations more effectively.
Claude Engineer comes with a set of powerful tools to assist with various tasks:
These tools allow Claude to interact with the file system, manage project structures, gather information from the web, perform advanced code editing, and execute code safely.
Claude Engineer now supports image analysis capabilities. To use this feature:
This feature enables Claude to assist with tasks involving visual data, such as analyzing diagrams, screenshots, or any other images relevant to your development work.
Claude Engineer implements robust error handling and recovery mechanisms:
These features ensure a smooth and reliable user experience, even in the face of unexpected issues or complex code executions.
You can save the current chat log at any time during your interaction with Claude Engineer:
Claude Engineer utilizes multiple AI models to provide specialized functionality:
These models work together to provide a comprehensive and intelligent development assistance experience.
graph TD
A[Start] --> B[Initialize]
B --> C{User Input}
C -->|"exit"| D[End]
C -->|"reset"| E[Reset Conversation]
C -->|"save chat"| F[Save Chat to Markdown]
C -->|"image"| G[Process Image]
C -->|"automode"| H[Enter Automode]
C -->|Other| I[Regular Chat]
E --> C
F --> C
G --> J[chat_with_claude]
H --> K[Automode Loop]
I --> J
J --> L{Tool Use?}
L -->|Yes| M[Execute Tool]
L -->|No| N[Generate Response]
M --> O[Tool Checker]
O --> N
N --> P[Update Conversation History]
P --> Q[Display Token Usage]
Q --> C
subgraph Memory Management
R[Conversation History]
S[File Contents]
T[Code Editor Memory]
end
subgraph Models
U[MAINMODEL - Claude-3.5-Sonnet]
V[TOOLCHECKERMODEL - Claude-3.5-Sonnet]
W[CODEEDITORMODEL - Claude-3.5-Sonnet]
X[CODEEXECUTIONMODEL - Claude-3-Haiku]
end
subgraph Tools
Y[create_folder]
Z[create_file]
AA[edit_and_apply]
AB[execute_code]
AC[stop_process]
AD[read_file]
AE[list_files]
AF[tavily_search]
AG[read_multiple_files]
end
J --> R
J --> S
J --> T
J --> U
O --> V
AA --> W
AB --> X
M --> Y
M --> Z
M --> AA
M --> AB
M --> AC
M --> AD
M --> AE
M --> AF
M --> AG
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
You can now have the power of this script, completely locally using Ollama and any of the supported function calling models:
Llama 3.1
Mistral Nemo
Firefunction v2
Command-R +
Before running make sure you install the latest version of the Ollama app and
pip install ollama
Then
python ollama-eng.py
Be extra careful if you ever let these local models run code on your machine, especially using the executing code tool. It may brick your machine. I disabled the tool execution completely for OLLAMA engineer but if you want to implement it again based on the original script use at your own discretion.