Skip to content

Checking your reading list…

Retry

Stay curious. Build better.

Appearance

Choose how BestHub looks on this device.

Changes apply immediately.

Search articles

Open Discover with these filters

Suggested searches

DeepSeek Harness: 'Everything Is a Plugin' Architecture Rebuilds Agent Runtime

DeepSeek Harness redefines AI agent runtimes with a plugin-based architecture on the Cordis meta-framework, enabling hot-swappable components, reversible effects, replaceable agent loops, and model-agnostic design for composable, production-ready agents.

Since the Harness concept emerged, the industry has converged on a consensus: models determine an agent's capability ceiling, while the harness determines its floor. DeepSeek Harness adopts an "everything is a plugin" architecture, breaking every component — model adapters, tool registries, session logs, even the agent loop itself — into hot-swappable plugins.

Why Rethink Harness?

Over the past year, the AI industry learned a hard lesson: switching harnesses often yields a larger experience gap than switching models . The same flagship model performs mediocrely in a crude loop but excels in a well-designed harness with proper context management, tool-return handling, and retry strategies.

Agent = Model + Harness

Models handle reasoning and generation , while Harness connects the model to the real world — file systems, terminals, browsers, APIs, permissions, planning, and context. Together they form an agent that can act autonomously and complete tasks.

Traditional harnesses resemble fixed concrete buildings: users can add skills or MCP tools externally, but core mechanisms like tool invocation, session management, sandboxes, storage, and the agent loop are sealed inside the product. DeepSeek Harness tears down that building into a box of LEGO bricks.

Core Philosophy: Everything Is a Plugin

DeepSeek Harness (dsh) centers on "Everything is a Plugin" — model adapters, tool registries, session logs, and the agent loop itself all exist as plugins, each replaceable without modifying harness source code.

Plugin architecture diagram
Plugin architecture diagram
Replaceability extends from a single search tool or MCP server all the way to how the agent loops, schedules sub-agents, persists sessions, and chooses its interaction UI — all without patching the harness core.

GitHub docs state: "No privileged core requires patching" — extending the harness means mounting plugins alongside other plugins.

Foundation: Cordis Meta-Framework

The architecture rests on Cordis — a meta-framework for "Spatiotemporal Composability" . Cordis does only three things: plugin loading, unloading, and dependency management. Concrete agent capabilities come from plugins that collaborate via services and events.

Cordis composability diagram
Cordis composability diagram

3.1 Temporal Composability

When a component is unloaded, can its prior effects on the system be rolled back? If a plugin registered event listeners, held resources, or mutated runtime state, those side effects must be fully cleaned up so the system returns to its pre-installation state. Cordis achieves this through Reversible Effects — every plugin effect is recorded and atomically rolled back on uninstall.

3.2 Spatial Composability

How are inter-component dependencies handled? A component declares required capabilities (services); when providers appear, disappear, or are replaced, the runtime re-resolves dependencies and coordinates lifecycles. This mechanism has been battle-tested in Koishi, an open-source chatbot framework with thousands of community plugins.

Architecture Layers: From Config to Runtime

A running dsh instance is a plugin tree assembled from layers applied at startup.

4.1 Profile (Composition Packs) and Layering

A Profile is a named assembly stored in the Harness home directory, listing the packs it stacks. Layers apply in order:

Apply each pack in the profile's listed order.

Apply the profile's cordis.patch.yml.

Apply home-level patch files.

Apply command-line --patch overlays.

Each patch targets an entry by ID and replaces its entire config or inserts a new entry.

4.2 Seven Core Packs

The official architecture docs list seven core packs, all implemented as plugins and replaceable via configuration:

Session — Session logging and management

System Prompt — System prompt assembly

Tools — Tool system

Agent — Agent registration and interfaces

Agent Loop — Agent loop logic

Scope — Scope registration

LLM — Model adapter interface

4.3 Dual-Plane Architecture: Host vs Agent Preset

Two planes determine where a plugin belongs:

Host Plane : Registries (tools, systemPrompt, agents, agent-loop), cross-session persistence, sandbox & approval stack, model routing, sub-agent registry. Scope: process-level, globally unique.

Agent Preset Plane : Session-contributed tool plugins, personas, prompt segments, compression strategies. Scope: session-level, independent per session.

Dual-plane architecture diagram
Dual-plane architecture diagram

Iron rule: A service consumed externally cannot move into the preset plane. The sub-agent registry is a classic example — it must answer cross-session queries; placing it in the preset causes conflicts when a second session mounts.

Key addition: realm mechanism — a realm defines a service's visible runtime scope. Register a service in a realm, and it becomes discoverable only within that realm.

Realm mechanism diagram
Realm mechanism diagram

Four Technical Highlights

5.1 Highlight 1: Hot-Swappable (Hot Module Replacement)

Cordis plugins are hot-replaceable black boxes. DSH supports HMR — edit and save config, and the framework dynamically unloads old components and loads new ones at runtime without restarting, leaving other user sessions uninterrupted.

Hot-swapping relies on two mechanisms:

Service-key discovery : dynamic lookup and binding by service name.

Reversible effect rollback : full cleanup of all impacts on uninstall.

In agent scenarios, this means an agent can dynamically mount missing tools during execution and discard them afterward, without affecting other sessions.

5.2 Highlight 2: Replaceable Agent Loop

The basic agent loop is simple: submit task + context to model → model returns tool calls → harness executes tools → feed results back to context → model decides next step. DeepSeek Harness makes the loop itself a replaceable plugin, enabling:

Failover loops (auto-switch to backup model on primary failure).

Retry loops (auto-retry failed tool calls).

Budget-controlled loops (auto-stop at token limit).

At the execution layer, the process divides into Rounds and Steps : a step = one model request + triggered tool calls; a round may contain multiple steps, driven by the default agent-loop.

5.3 Highlight 3: Reversible Effects — True "Undo Button"

This is Cordis's hardest technical contribution. Traditional plugin systems suffer from unclean uninstalls: listeners, timers, global state mutations linger, causing memory leaks and state pollution. Cordis solves this via Effect Tracking — every side effect during install is recorded and atomically rolled back on uninstall.

This makes agent self-modification safe — agents can experimentally change their own runtime config and instantly roll back if results are poor.

5.4 Highlight 4: Four Presets = Four Plugin Combinations

From the same foundation, DeepSeek Harness provides four run modes:

Standard — Full-featured coding agent. Core features: file system, shell, web search, sub-agents, planning mode.

PTC — Programmatic tool calling. Core features: model generates TypeScript SDK; multi-turn calls compressed to one.

Minimal — Minimal test environment. Core features: only bash and str_replace_editor tools.

Creative — Custom preset authoring. Core features: inherits Standard + runtime checks + plugin experimentation.

They share the same base; differences come from default plugin sets. Most notable is Creative Mode — it lets the agent inspect the running runtime, experiment with Cordis plugins in memory, and compose new run modes. In other words, the harness configuration itself becomes an object the agent can manipulate .

Capability Seam: Three-Role Model for Replaceable Capabilities

DeepSeek Harness introduces Capability Seam . A replaceable capability comprises three roles:

Interface : defines the capability contract.

Implementation : provides concrete functionality.

Consumer : other components that use the capability.

This ensures swapping implementations leaves the interface unchanged, so consumers need no modification — the engineering bedrock of "everything is a plugin."

Model-Agnostic: Not Bound to DeepSeek

Harness is designed without vendor lock-in. Supported providers include:

Anthropic (Claude)

OpenAI (GPT)

AWS Bedrock

Microsoft Azure

Google Gemini

DeepSeek native API

Any custom inference gateway compatible with OpenAI's interface standard

It also bundles two sub-agent providers that delegate tasks directly to Anthropic's Claude Code and OpenAI's Codex.

Summary: Why Design Philosophy Matters

DeepSeek Harness's significance isn't just another coding agent — it redefines how agent runtimes are built .

Old harnesses were like fully-furnished apartments: tools, skills, session management, sandboxes, scheduling, workflows all sealed in a shell by the vendor — walls unmovable, layout fixed. DeepSeek Harness open-sources the blueprints and all prefabricated parts, saying "tear down any wall, swap any component."

For agent developers this means:

No more reinventing the wheel : teams don't each build loop, tool dispatch, context management from scratch.

True composability : models, tools, loops, UIs snap together like LEGO.

Safe self-modification : via reversible effects, agents can experimentally mutate their own runtime with controlled risk.

Production-ready : MIT-licensed, validated in Koishi's 4000+ plugin ecosystem.

Model capabilities are converging; harness engineering is diverging. Competition is shifting from "how big is the model" to "how strong is the harness." DeepSeek Harness answers clearly: break the harness into plugins, return all choice and control to developers.

Project URL: https://github.com/deepseek-ai/deepseek-harness

About this article

For questions about attribution, corrections or content rights, please contactadmin@besthub.devand we will review it promptly.

plugin architectureagent loopagent runtimemodel-agnosticCordisreversible effectsDeepSeek Harnesshot-swappable

Discussion 0

Questions, practical examples and thoughtful responses.

Open full discussion