Claude Code - An AI-powered code assistant with comprehensive tools
Project description
Claude Code
An AI-powered development assistant with comprehensive tools for code analysis, file operations, web research, and task management. Built with Ollama integration and inspired by Anthropic's Claude Code.
Features
🛠️ Comprehensive Tool Suite
- File Operations: Read, write, edit files with advanced string replacement
- Search & Discovery: Glob patterns, regex search, directory listing
- Code Execution: Bash command execution with safety checks
- Jupyter Support: Read and edit notebook cells
- Web Integration: Fetch and analyze web content
- Task Management: Built-in todo system for complex workflows
🤖 AI Agent Modes
- Autonomous Mode: Agent works step-by-step with full tool access
- Interactive Mode: Manual control over each tool execution
- Chat Mode: Direct conversation without tools
- Streaming Mode: Real-time response streaming
🎨 Rich Terminal UI
- Claude-inspired color scheme and branding
- Syntax highlighting for code blocks
- Interactive file and command completion
- Structured output with panels and tables
- Live context display
🔧 Model Integration
- Default Model: qwen2.5:7b-instruct (efficient and capable)
- Ollama Backend: Local model hosting for privacy
- Configurable Context: Adjustable context window sizes
- Tool Schema: Comprehensive function calling support
Installation
Prerequisites
- Python 3.11+
- Ollama server running locally or remotely
- qwen2.5:7b-instruct model (or configure alternative)
Install from Source
git clone https://github.com/openclaudecode/openclaudecode.git
cd openclaudecode
pip install -e .
Pull Required Model
ollama pull qwen2.5:7b-instruct
Quick Start
Basic Usage
# Start Claude Code in current directory
claude
# Specify workspace and model
claude --workspace /path/to/project --model qwen2.5:7b-instruct
# Run with custom Ollama host
claude --host http://192.168.1.100:11434
# Execute single query
claude --query "analyze the project structure"
Commands
| Command | Description |
|---|---|
/help |
Show available commands |
/read <file> |
Read file with syntax highlighting |
/write <file> |
Write content to file |
/edit <file> |
Interactive file editing |
/ls <path> |
List directory contents |
/grep <pattern> |
Search files with regex |
/bash <command> |
Execute shell command |
/todo |
View/manage todo list |
/chat <message> |
Chat without tools |
/stream <message> |
Stream response |
/interactive <message> |
Interactive mode |
@filename |
Add file to context |
Example Workflow
# Start Claude Code
claude
# Add files to context
@src/main.py
@tests/test_main.py
# Analyze and improve code
> analyze the code structure and suggest improvements
# Execute suggested changes
> implement the logging improvements you suggested
# Run tests
/bash python -m pytest tests/
# Create documentation
> create comprehensive README.md for this project
Configuration
Model Configuration
# List available models
ollama list
# Use different model
claude --model llama2:7b
# Adjust context size
claude --num-ctx 8192
Host Configuration
# Local Ollama (default)
claude --host http://localhost:11434
# Remote Ollama
claude --host http://192.168.1.100:11434
# Custom port
claude --host http://localhost:8080
Tool Reference
File Operations
- read: Read files with line numbers and syntax detection
- write: Create or overwrite files completely
- edit: Precise string replacement with conflict detection
- multiedit: Atomic multiple edits in single operation
Search & Discovery
- glob: Fast pattern-based file finding (
*.py,**/*.js) - grep: Content search with regex support
- ls: Directory listing with ignore patterns
Code Execution
- bash: Safe command execution with timeout and output limits
Specialized
- notebook_read/edit: Jupyter notebook cell manipulation
- web_fetch: Web content retrieval and analysis
- todo_read/write: Session task management
- task: Autonomous sub-agent deployment
Security
Command Safety
- Dangerous command patterns blocked
- Execution timeouts prevent hanging
- Output size limits prevent overflow
- Workspace isolation for file operations
Privacy
- Local model execution (no external API calls)
- Workspace-scoped file access
- No data transmission to external services
Development
Project Structure
claude_code/
├── src/
│ ├── app.py # Main CLI application
│ ├── agent.py # AI agent orchestrator
│ ├── llm.py # Ollama client
│ └── tools.py # Tool implementations
├── cli_entry.py # CLI entry point
└── __init__.py
Testing
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
# Run specific test
pytest tests/test_tools.py::test_read_file
Contributing
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
Troubleshooting
Common Issues
Model not found
# Pull the required model
ollama pull qwen2.5:7b-instruct
# Or use different model
claude --model llama2:7b
Connection refused
# Start Ollama service
ollama serve
# Check if running
curl http://localhost:11434/api/tags
Permission errors
# Ensure proper workspace permissions
chmod -R 755 /path/to/workspace
Performance Tuning
Memory optimization
# Reduce context size for lower memory usage
claude --num-ctx 2048
Response speed
# Use smaller, faster model
claude --model qwen2.5:1.5b
License
MIT License - see LICENSE file for details.
Acknowledgments
- Inspired by Anthropic's Claude Code
- Built with Ollama for local AI execution
- Powered by qwen2.5 model family
- Rich terminal UI with Python Rich library
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file openclaudecode-0.1.33.tar.gz.
File metadata
- Download URL: openclaudecode-0.1.33.tar.gz
- Upload date:
- Size: 27.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.11.0rc1 Linux/6.8.0-59-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
07a5695e9d78f961da839f459df50cc23c2e6eb130c6f7df440820d48cb28c17
|
|
| MD5 |
cc8d6b9ebd1aeed9dd2f81bb8d1b8b33
|
|
| BLAKE2b-256 |
a1207d136bdc9426eaa7b97e091a778bcc61cd3fe6d9b6c117c6bdbf1da73c9e
|
File details
Details for the file openclaudecode-0.1.33-py3-none-any.whl.
File metadata
- Download URL: openclaudecode-0.1.33-py3-none-any.whl
- Upload date:
- Size: 32.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.3 CPython/3.11.0rc1 Linux/6.8.0-59-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb55552322072a4b8d6d3491eeec6da74a0557fb44b10d0a58788e94895ecb7a
|
|
| MD5 |
48fb8c93780c6a92505e535c7d6ec94c
|
|
| BLAKE2b-256 |
311bb09fa07b89a1a6bc2be5fd48fef0d72b68ef3b5a60706b3a471e83621ed7
|