How doriandarko/deepseek-engineer works
Project Type & Purpose
• DeepSeek Engineer v2 is an open-source CLI tool (terminal interface) that acts as an AI-powered coding assistant.
• It connects a local CLI front-end to DeepSeek’s reasoning models, orchestrates function-calls for file operations, and streams real-time feedback to the user.
Break Down the Main Architectural Components
a. CLI Interface (deepseek-eng.py)
– Entry point, command parsing, and interactive shell.
b. Controller/Orchestrator
– Chains:
1. User Input
2. Chain-of-Thought Reasoning
3. Tool Invocation & Execution
4. AI Follow-up Response
– Manages the “triple-stream” (reasoning, content, tool_calls).
c. DeepSeek Reasoning Model
– External AI service (DeepSeek-Reasoner API).
– Receives natural language prompts and returns CoT outputs + suggested function calls.
d. Function-Calling Tools Module
– read_file(), read_multiple_files(), create_file(), create_multiple_files(), edit_file().
– Implements path normalization, traversal protection, size limits, error handling.
e. Local File System
– The actual project files (.py, .html, config files).
– .env for DEEPSEEK_API_KEY.
f. Configuration & Dependency Layer
– pyproject.toml, requirements.txt, .python-version, uv.lock.
– uv CLI runner integration.
g. Static Assets
– bouncing_ball_hexagon.html, solar_cube.html (demo artifacts/examples).
h. External Services
– DeepSeek Platform for the API key & reasoning model.
– Optional: pip registry, uv registry for dependencies.
Relationships & Data Flows
– CLI Interface → Controller: parse user commands → send to orchestrator.
– Controller ↔ DeepSeek API:
• Send user prompt → receive CoT + function call plan.
– Controller → Tools Module: invoke function calls as suggested.
– Tools Module → File System: perform read/write operations.
– Tools Module → Controller: return file contents or confirmation.
– Controller → CLI Interface: stream combined reasoning + content to user.
– Configuration Layer feeds into CLI/Controller at startup.
Patterns & Principles
• Separation of Concerns:
– CLI UI vs. Orchestration vs. File-IO.
• Function-Calling Architecture:
– Native function calls as the “API” between AI and host tool.
• Streaming + Chain-of-Thought:
– Real-time feedback loop with clearly demarcated streams.
• Security Best Practices:
– Path normalization, directory traversal guards, file size limits.