Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

17.3 Architecture: Cordis Microkernel & Plugin Topology

🐋 "No privileged components — this is the fundamental difference from every other Agent framework."


What Cordis Is

Cordis (by the Koishi team) is a plugin meta-framework that does exactly one thing: let plugins be loaded, unloaded, depended on, and communicate with each other. It carries no business logic.

import { Context } from 'cordis';

function greetPlugin(ctx: Context, config: { greeting: string }) {
  ctx.on('ready', () => console.log(config.greeting));
}
ctx.plugin(greetPlugin, { greeting: 'Hello, DeepSeek Harness' });

Key abstractions

AbstractionRole
Context (ctx)plugin runtime; ctx.plugin / ctx.on / ctx.service
Servicecallable interface exposed to other plugins
Eventasync message bus
Effectone-time side effect on load
Schematyped plugin config + defaults

The dependency graph is explicit — a plugin declares what it needs before/after.


DeepSeek Harness' Plugin Topology (standard profile)

DeepSeek Harness plugin topology

core.agent.loop being a plugin means you can swap it, run multiple loops, or remove it entirely — something no other harness allows (Claude Code / OpenClaw / Hermes all hard-code the loop in a privileged core).


Communication: Services & Events

// service
ctx.service('shell', {
  async run(command, opts = {}) { /* spawn child process */ }
});

// event
ctx.emit('tool.after', { name: 'shell', result });
ctx.on('tool.after', (e) => logger.log(...));

Stable context keys (ctx.llm, ctx.tools, ctx.session, ctx.agentLoop) are the contract third-party plugins rely on.

Trajectory: git-style Replay & Fork

The event stream powers "trajectory replay": replay a whole session, fork at a step, audit what the Agent saw/did. A framework-level abstraction, more robust than hand-written logging.

Paradigm Comparison

ParadigmOpenClawHermesClaude CodeDeepSeek Harness
Event streaminternalinternal + Hooksinternalplugin (trajectory)
Sandboxbuilt-in + Docker6 impls6-stage permsplugin (sandbox.*)
State graphimplicitimplicitexplicitplugin (context.*)
Toolsinternalinternalinternalplugin (tool.*)
Agent loopinternalinternalinternalplugin (agent.loop)

DeepSeek Harness is the only industrial harness that plugin-izes all of these paradigms.


Section Summary

TopicKey point
Cordis rolemicrokernel: load/unload/communicate only
AbstractionsService / Event / Effect / Schema
TopologyLLM / Tool / Context / Skill / Sub-agent / Session / Sandbox / UI all plugins
Context keysctx.llm / ctx.tools / ctx.session stable
Trajectorygit-style replay / fork
Differenceonly harness with a plugin-ized loop

Next section: 17.4 Plugin Development