DeepSeek Harness Source Code Analysis: Prompt as a Runtime
dotey · x · 2026-08-14
The author deeply analyzed the DeepSeek Harness (DSH) source code, revealing that its core philosophy shifts away from static System Prompts towards a dynamic Prompt Runtime.
Core Architectural Designs:
- Modular Capabilities: Capabilities are split into Implementation + Interface + Model-facing Instructions. Each tool (like shell, filesystem) carries its own prompt instructing the model on its usage.
- Scoped Prompts: Divided into Global Prompt → Agent Scope → Agent-specific Override, acting like dependency injection for prompts.
- State/Instruction Separation: Explicitly separates stable Instructions, dynamic Runtime Context (e.g., cwd, git status), and Tools.
Comparison with Pi:
- Pi: Focuses on a minimal core where users assemble capabilities.
- DSH: Aims to pluginize almost everything, providing official, complete combinations.
Hardcore Session Mechanism:
- Built on the Cordis plugin loader, emphasizing reversible side effects (auto-cleanup on unmount) and spatial composability.
- Model adapters, tool registries, the agent loop, and even the UI are all plugins. There is no sacred, unmovable core.
- Sessions are append-only event streams. The model's final visible context must be entirely reconstructable from this log.
More from coding & agent
- Terminal Night 3 talk slides released, missing demo video to follow — 4310sy · 2026-10-16
- Agent developers are sitting on unused API credits that can exceed actual usage — EnvironmentalDay8864 · 2026-10-16
- Notion's bet on agents: abstract away deployment so users and agents just write code — simonguozirui · 2026-10-16
- Four Gemini 4 Argon agents beat Minecraft's Ender Dragon autonomously in 27 hours — Maxence Faldor · 2026-10-16
- Tencent's Terminal-RSI builds recursively self-improving terminal agents, hitting 19.84% on Terminal-Bench 4.0 — tencent · 2026-10-16
- Tsinghua's AutoSFT uses multi-agent collaboration to automate SFT data research — TsinghuaNLP · 2026-10-16