Cordis Inside DeepSeek Harness: Making Everything a Plugin
Trace dsh-base, Context services, event domains, and the tool pipeline to see how Cordis organizes a replaceable Agent runtime.
The end state: DeepSeek Harness does not keep one giant agent loop and attach a few extensions beside it. Models, tools, sessions, Agents, and entry points all enter as Cordis plugins.
Once this is clear, cordis.patch.yml stops looking like a package list. It becomes a topology for how product capabilities enter the runtime.
01 / A profile boots a composition tree
A running dsh is a plugin tree assembled from configuration layers. Bundles insert base rows; profile patches and user overlays modify them by id.
dsh-base is the first layer of every profile. It contributes model adapters, tools, persistence, sandbox, approval policy, settings, credentials, and telemetry. Web and headless modes add their own compositions on top.
Print the tree that the machine will boot:
dsh --profile web --dump-config02 / Services connect capability seams
Common Context services in Harness include:
| Service | Capability | Typical extension |
|---|---|---|
ctx.tools | Tool registry and execution pipeline | Register tools; listen to tools/* |
ctx.llm | Messages, streams, and model adapters | Replace providers; listen to llm/* |
ctx.agents | Live Agents and agent events | Create Agents; attach to agent/* |
ctx.sessions | Durable session event log | Observe session/event; derive UI |
ctx.agentLoop | Default Agent driver | Replace it through composition |
Each capability seam needs a Service Definition, Provider, and Consumer. Keeping those roles separate is what lets one provider change without forking the product.
03 / How a tool plugin enters the real pipeline
import type { Context } from '@deepseek-ai/cordis'
import { defineTool } from '@deepseek-ai/dsh-tools'
export const name = 'greet-tool'
export const inject = ['tools']
export function apply(ctx: Context) {
ctx.tools.register(defineTool({
name: 'greet',
description: 'Greet the named person.',
parameters: {
name: { type: 'string', required: true },
},
output: {
schema: { type: 'string' },
render: (_args, value) => [{ type: 'text', text: String(value) }],
},
async execute(args) {
return 'Hello, ' + args.name + '!'
},
}))
}This plugin reuses every concept from the series: inject waits for the tool service, the registration disposer belongs to the Fiber, and result events let other plugins observe execution.
The tool is not a side channel called specially by the agent loop. It enters the same registration and execution service through ctx.tools.
04 / Events keep the runtime extensible
Harness organizes events by runtime domain:
session/eventrecords durable facts, allowing UI, projections, and telemetry to derive from one log.agent/*carries live Agent coordination and request interception.tools/*connects pre-execution, execution, and result stages.
When changing model-request or tool policy, attach to the owning event instead of editing the agent loop. A waterfall listener must call next() to delegate downstream.
05 / What “no privileged kernel” means
The agent loop itself is mounted by configuration. A model provider can change, tools can be added, session storage can use another provider, and HMR can reload plugins while the process runs.
This is not a promise that anything can change arbitrarily. Each extension still follows its service types, event mode, configuration schema, and lifecycle. Replaceability comes from explicit connection points, not hidden global state.
06 / The shortest path to a DSH plugin
- Choose the service or event you need; do not start by editing the loop.
- Write a function plugin exporting
name, requiredinject, optionalConfig, andapply. - Keep registrations and listeners in the current Fiber’s effect system.
- Insert a row or patch a stable
idin the profile’scordis.patch.yml. - Boot through Loader and observe real service output and teardown.
Conclusion
Cordis gives DSH four verbs: compose, connect, own, reverse. A profile selects plugins, Context connects capabilities, Fiber owns instances, and Effects reverse side effects.
“Everything is a plugin” is therefore not a slogan. It is a runtime organization that can be traced through configuration, services, events, and lifecycle.
Continue with Composition and HMR, Events, and waterfall.
Sources: Harness architecture, into-the-Harness tutorial, dsh-base composition, and tool execution pipeline.
More Posts
Composition and HMR: Import New Code, Dispose the Old Fiber, Then Activate
Understand stable ids, configuration groups, and Cordis HMR’s unload-reload cycle, including how to diagnose plugins stuck in PENDING.
Configuration: Give Plugins Validated Options and Defaults
Define Cordis plugin configuration with Schemastery and see how defaults, path-aware errors, and FAILED Fibers prevent a sick start.
Services and Context: Share Capabilities Without Binding Implementations
Use Service, Context, and declaration merging to understand how providers, consumers, and scopes connect DeepSeek Harness capabilities.
Newsletter
Join the community
Subscribe to our newsletter for the latest news and updates