A command-line tool exactly like Claude Code, powered by DeepSeek's API. Everything happens in interactive chat mode - analyze code, search web, run commands, read files - all in one conversational interface.
Major Feature Release - Deep Code now includes enterprise-grade features matching Claude Code:
- π οΈ Structured Tool System - 8 dedicated tools: Read, Write, Edit, Glob, Grep, Bash, WebSearch, WebFetch
- π Advanced Security - Command validation, dangerous operation blocking, sensitive file protection
- π Context Management - Token counting, smart truncation, conversation optimization
- βοΈ Precise Edit Tool - Exact string matching for surgical code changes
- π Glob & Grep Tools - Find files by pattern, search code with regex
- β Comprehensive Tests - Full test suite with 50+ tests
- π Enhanced Documentation - See FEATURES.md and QUICK_REFERENCE.md
See CHANGELOG.md for full details.
- π¬ Interactive Chat Mode - Everything happens here! (Default mode)
- π€ Auto Tool Detection - Automatically reads files, executes commands, searches web when you ask
- π Automatic Directory Analysis - Current directory context loaded automatically
- π Smart File Reading - Just mention a file and it reads it
- π Web Search Integration - Search the web with
@webor naturally in conversation - π HTTP Requests - Make API calls with
@curlor mention URLs - π₯οΈ Bash Execution - Run commands naturally: "run git status" or "@bash git status"
- π Session Management - Conversations persist automatically
- π Pipe Support -
cat file | deepcode -pfor quick queries - β‘ Streaming Responses - Real-time AI responses
- π¨ Beautiful Terminal UI - Rich formatting and syntax highlighting
# 1. Install dependencies
pip install -r requirements.txt
# 2. Install the package (installs 'deepcode' command globally)
pip install -e .
# 3. Set your API key
export DEEPSEEK_API_KEY=your_api_key_here# Just install dependencies
pip install -r requirements.txt
# Set API key
export DEEPSEEK_API_KEY=your_api_key_here
# Run directly
python3 deepcode.pyIf you get "No module named 'setuptools'" error:
pip install setuptools wheelIf you get "deepcode: command not found":
- Make sure you ran
pip install -e . - Or use
python3 deepcode.pyinstead
Configuration via .env file:
Create a .env file in the project directory:
DEEPSEEK_API_KEY=your_api_key_here
DEEPSEEK_API_BASE=https://api.deepseek.com
DEEPSEEK_MODEL=deepseek-chat
See INSTALL.md for detailed installation instructions.
# Start interactive chat - automatically loads current directory context
deepcode
# Start chat with initial question
deepcode "explain this project"
# With additional directories
deepcode --add-dir ../app --add-dir ../lib
# Everything is accessible in chat:
# - "Read app.py" β Automatically reads the file
# - "What does this project do?" β Uses directory context
# - "Run git status" β Executes the command
# - "Search for Python async best practices" β Searches web
# - "@curl https://api.github.com/users/octocat" β Makes HTTP request# Query via SDK, then exit
deepcode -p "explain this function"
# Process piped content
cat file.txt | deepcode -p "explain"
cat log.txt | deepcode -p "analyze errors"
# JSON output
deepcode -p "query" --output-format json# Continue most recent conversation
deepcode -c
# Continue with new query (non-interactive)
deepcode -c -p "check for type errors"
# Resume specific session by ID
deepcode -r "session-id" "query"
# Resume in interactive mode
deepcode -r "session-id"# Automatically analyzes current directory
deepcode "what does this project do?"
# Add additional directories
deepcode --add-dir ../shared --add-dir ../utils "review codebase"
# Works in print mode too
deepcode -p --add-dir ../lib "analyze dependencies"# Replace entire system prompt
deepcode --system-prompt "You are a Python expert" "review code"
# Append to default prompt
deepcode --append-system-prompt "Always use TypeScript" "generate component"In interactive chat mode, you can ask naturally - tools are used automatically:
deepcode
> What does this project do?
> Read app.py
> Analyze the main function
> Run git status
> Search for latest Python async features
> Check https://api.github.com/repos/octocat/Hello-World
> Show me the README fileYou can also use explicit commands:
@web <query>or@search <query>- Perform web search@curl <url>- Make HTTP request@bash <command>or@exec <command>- Execute bash command
Examples in chat:
deepcode
> @web latest Python async features
> @bash git status
> @curl https://api.github.com/users/octocat# Use specific model (default is deepseek-chat)
deepcode --model deepseek-chat "query"
# Override to use chat model
deepcode --model deepseek-chat "query"# Interactive session
deepcode "explain this codebase"
# Quick query
deepcode -p "write a Python function to reverse a string"
# Analyze piped content
cat requirements.txt | deepcode -p "analyze dependencies"
# Continue previous conversation
deepcode -c
# Resume specific session
deepcode -r "abc123" "finish this PR"
# With custom prompt
deepcode --append-system-prompt "Use best practices" "review my code"| Command | Description |
|---|---|
deepcode |
Start interactive REPL |
deepcode "query" |
Start REPL with initial prompt |
deepcode -p "query" |
Query via SDK, then exit |
cat file | deepcode -p "query" |
Process piped content |
deepcode -c |
Continue most recent conversation |
deepcode -c -p "query" |
Continue via SDK |
deepcode -r "session-id" "query" |
Resume session by ID |
| Flag | Description |
|---|---|
-p, --print |
Print response without interactive mode |
-c, --continue |
Load most recent conversation |
-r, --resume SESSION_ID |
Resume specific session |
--add-dir DIR |
Add additional working directory (repeatable) |
--model MODEL |
Set model for current session |
--system-prompt TEXT |
Replace entire system prompt |
--append-system-prompt TEXT |
Append to default system prompt |
--output-format FORMAT |
Output format: text or json |
Sessions are automatically saved to ~/.deepcode/sessions.db. Each session is associated with a directory, allowing you to continue conversations contextually.
The tool uses DeepSeek API endpoints. Make sure you have a valid API key from DeepSeek.
Environment variables:
DEEPSEEK_API_KEY- Your API key (required)DEEPSEEK_API_BASE- API base URL (default: https://api.deepseek.com)DEEPSEEK_MODEL- Default model (default: deepseek-chat - conversational chat model)
Note: The default model is deepseek-chat which is optimized for conversational interactions. You can override this by setting DEEPSEEK_MODEL or using the --model flag.
- FEATURES.md - Comprehensive guide to all features, tools, and usage examples
- QUICK_REFERENCE.md - Quick reference for common commands and patterns
- CHANGELOG.md - Version history and what's new
- INSTALL.md - Detailed installation instructions
Deep Code includes 8 powerful tools:
- Read, Write, Edit - File operations with precision
- Glob, Grep - Find and search files
- Bash - Execute commands safely
- WebSearch, WebFetch - Access web content
See FEATURES.md for detailed documentation.
Built-in security features:
- Dangerous command blocking
- Sensitive file protection
- System directory safeguards
- Permission management
- Token counting and optimization
- Smart message truncation
- Conversation summarization
- Memory-efficient operation
Run the comprehensive test suite:
python test_tools.py
python -m unittest test_tools -v