DeepSeek Harness Turns the Agent Loop Itself Into a Plugin
Most agent frameworks hardcode the main loop and force extensions to patch a privileged core. DeepSeek Harness demonstrates a production architecture where the loop, tools, and adapters are all swappable plugins, which means teams can replace any piece without forking the framework or risking merge conflicts on upgrade.
DeepSeek Harness treats the agent loop, model adapters, tool registries, and session logs as replaceable plugins. There is no privileged core to patch; extension means hanging another plugin on the tree. The architecture rests on Cordis, a five-concept plugin framework that uses dependency injection to determine loading order and reversible effects to enable hot module replacement.
Every replaceable capability follows a three-role seam model: an abstract service definition, one or more concrete providers, and consumers that depend only on the abstract key. Swapping a shell or filesystem provider moves Bash, PTY, and LSP to a remote sandbox without touching any tool code. The session log is an append-only event stream—the model's conversation history is derived from it on the fly, making fork, resume, replay, and compaction operate on a single source of truth.
Tool execution runs through a guarded pipeline of waterfall hooks for pre-execution approval, execution wrapping, and post-execution result inspection. Built-in tools cover shell, filesystem, search, web, LSP, subagent delegation, workflow orchestration, background jobs, and session state, all backed by their respective capability seams.
Making the agent loop itself a plugin is a genuine architectural inversion—most frameworks treat the loop as the fixed center and bolt capabilities onto it, but here the loop is just another service declaring its dependencies.
The 'model-visible means logged' invariant is a hard constraint that pays off across the system: it makes replay, fork, and compaction operate on a single event stream rather than reconciling separate state stores.
Waterfall middleware as the universal extension pattern avoids the common trap of having separate interception mechanisms for prompts, tool calls, and model requests, each with different APIs and ordering rules.
The three-role seam model formalizes what many frameworks do ad hoc—by requiring a definition, provider, and consumer for every replaceable capability, it prevents the silent coupling that happens when consumers import concrete implementations directly.
Vendoring Cordis and using YAML patches with JS expressions for assembly means the entire plugin tree is declaratively configurable and inspectable via --dump-config, which is rare in agent frameworks that typically hide their composition behind imperative code.