跪拜 Guibai
← All articles
Artificial Intelligence · Agent

DeepSeeker-Code: A Coding Agent That Admits Models Lie, So It Doesn't Trust Them

By 樊小肆 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Most coding-agent frameworks treat tool execution as fire-and-forget and leave model honesty to chance. DeepSeeker-Code bakes distrust of the model into the tool protocol itself — independent success/failure verdicts, forced failure notices, and circuit breakers — which is the kind of engineering governance that turns a demo into something you can leave running while you get coffee.

Summary

DeepSeeker-Code bundles a single engine directly into three entry points — VS Code extension, terminal CLI, and local HTTP service — so every fix reaches all surfaces instantly and sessions continue across them. Instead of chasing model-agnostic abstractions, its context compression and token estimation are calibrated specifically to DeepSeek's real-world behavior: local token estimates are corrected against actual API usage, and compression timing defers to the model's implicit prefix-cache hit rate to avoid wasting cached computation. Every tool in the protocol carries a verifyResult field that independently judges execution success or failure; when a tool fails, the system forcibly injects a failure notice into the model's context, backed by circuit breakers and hard round limits that stop infinite loops before they burn through a token budget. Tool output is split into two streams — a rich, streaming feed for the human and a terse, conclusion-only feed for the model — so neither audience gets drowned in noise or starved of detail. Data leaving the machine for DeepSeek's cloud API passes through a sanitization layer that redacts secrets, and the product deliberately stays single-user, local-only, with no multi-tenancy or SaaS ambitions, trading team collaboration for a lower security surface and a sharper focus on letting a single developer actually trust the agent to run unattended.

Takeaways
One engine is compiled directly into the VS Code, CLI, and HTTP entry points via esbuild bundling and tsconfig path aliases, so all three always run identical code and share a local data directory for seamless session handoff.
Context compression is tuned to DeepSeek's actual token behavior: local estimates are calibrated against real API-reported token counts, and compression is delayed when the prefix-cache hit rate is high to avoid invalidating cached computation.
Every tool implements a verifyResult field that independently judges execution success or failure; on failure, the system forcibly prepends a failure notice into the context fed to the model.
Infinite-loop protection uses circuit breakers, round self-convergence checks, and a hard upper limit on rounds to stop the model from burning tokens in repetitive call patterns.
Tool output is split into two explicit streams: a rich, streaming, animated feed for the human user and a clean, short, conclusion-only feed for the model's context window.
Data sent to DeepSeek's cloud API passes through a sanitization layer that replaces detected secrets with asterisks before transmission.
The HTTP service binds only to 127.0.0.1; the product is deliberately single-user and local-only, with no multi-tenancy, no SaaS, and no OS-level sandboxing.
Conclusions

Frameworks that advertise model-agnosticism often paper over model-specific behaviors — like DeepSeek's prefix caching and token-estimation bias — that materially change when and how you should compress context. Tuning for one model can yield better token economics than a generic strategy that works equally poorly for all models.

Elevating model-distrust to the tool-protocol level — where every tool must self-report a hard success/failure verdict — shifts the reliability burden from the model's honesty to deterministic code, which is a more predictable place to carry it.

Splitting tool output into human and model streams acknowledges a tension most agents ignore: rich terminal output is hostile to limited context windows, but terse summaries starve the user of feedback. Solving this at the tool-output layer is cheaper than trying to teach the model to ignore noise.

Choosing tight coupling (inlining the engine) over loose coupling (a shared npm package) is a pragmatic bet during rapid iteration: it sacrifices reusability now to avoid version-skew bugs that erode user trust across surfaces.

Concepts & terms
verifyResult
A field in DeepSeeker-Code's tool protocol where the tool's own execution layer independently judges whether the operation succeeded or failed, rather than relying on the model's self-reported assessment. On failure, a system notice is forcibly injected into the model's context.
prefix caching
An optimization in some LLM APIs (including DeepSeek) where the model reuses computed key-value caches for prompt prefixes that haven't changed between requests, reducing latency and token cost. Compression that alters the prefix can invalidate this cache and waste the savings.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗