If you have ever gone looking for the "core" of DeepSeek Harness, you will not find one. There is no privileged module that everything else patches into. What you find instead is a Cordis plugin tree, assembled at startup from a stack of configuration layers — and once you see the layering, most of the surprising behaviour around profiles, activation and replacement stops being surprising.
The architecture reference states it plainly: every product component is a plugin, including model adapters, the tool registry, Session logging and the agent loop. Plugins contribute services, typed events and reversible effects to a shared context. Extension means mounting a plugin alongside others, not patching a privileged centre.
That composition model is the subject here. It is a lifecycle and assembly story, and it is explicitly not a security guarantee about the code being mounted.
Layers apply to an empty list, and later ones win
A profile is a named assembly stored in Harness home. It lists bundles, stores out-of-tree plugins installed for that profile, and keeps its own cordis.patch.yml. Bundles ship Cordis configuration entries plus mounting code; their package.json declares dsh.profile to list a profile's bundles and dsh.bundle to identify a bundle's patch.
| Layer or concept | Role |
|---|---|
| Bundle patches | Ordered contributions named by the profile |
| Profile patch | User changes for that profile |
| Home patch | Machine-local layer shared across profiles |
--patch overlays |
Additional command-line layers applied in argument order |
| Runtime tree | Mounted plugins and their active services and effects |
The important detail is what these layers operate on: an initially empty entry list. A patch targets an entry by id and either replaces that entry's entire config or inserts a new one. A preset patch performs the same operations inside the target's config.plugins, with the same precedence rules. So a later layer can alter what a bundle contributed without editing the bundle — and replacing a row means the config is not deep-merged, so any value that should survive has to be restated. The config precedence guide goes through that consequence in more depth.
This is also why profiles are not interchangeable. The shipped web, headless, sdk and acp profiles share dsh-base as a common first layer, and their application bundles add different hosts. sdk-minimal is the documented exception: one bundle, an explicit SDK tree, and no dsh-base. Same framework, deliberately different products.
Deps decide activation order; effects decide cleanup
Services live at stable context keys — ctx.tools, ctx.llm, ctx.sessions. Consumers reference the key rather than importing a concrete implementation. A plugin declares what it needs through inject, and Cordis holds the dependent plugin until those services are ready. Ordering comes out of the dependency graph instead of a hand-maintained startup sequence.
Typed events are the second channel. The primer lists emit, waterfall, parallel, serial and bail for the different dispatch shapes, and recommends events for interception and policy while keeping direct capability calls on service methods.
Registration itself can be an effect rather than a static row. Per the primer, ctx.effect() and helpers such as ctx.on() register reversibly, so a reload or teardown removes the associated listeners and tool schemas. That is what makes replacement and reload viable at all — but it only covers what the plugin registered as an effect. Resources needing explicit cleanup are still the plugin's own responsibility, and a declared dependency never installs a service that is missing; it only says what must be available first.
Inspecting the tree you actually run
- Pin down the profile you actually start — its bundle list and patches determine the assembly.
- Dump the composition:
dsh --profile web --dump-config
- Trace the entry you care about and the layers that contributed or changed it.
- Check declared dependencies and available services before blaming a plugin that never activated — and read the real startup errors for your environment.
- Change one layer and verify the resulting behaviour.
Step 5 has a catch worth knowing before you rely on it: HMR is configuration-driven. The architecture says dsh-base enables configuration watching, while Headless, SDK and ACP disable it, and sdk-minimal does not include it at all. Profile patches can override those defaults, so do not assume every profile watches its files.
A concrete example makes the layering tangible. A profile includes a bundle, then changes one of that bundle's entries. The bundle supplies the initial row; the profile patch targets its id; the home patch and any command-line overlays apply later. If a late layer supplies a replacement config, omitted keys are not inherited from the earlier row — flexibility and the need to inspect the full effective config are the same fact seen from two sides.
Mounted is not the same as installed
The runtime tree and the list of installed packages are different objects. Installation can place code where the profile can resolve it, but activation also depends on the selected entries, their configuration and their required services. When a capability you expect is absent, check those four steps separately — source resolution, configuration composition, service readiness, the resulting registration — rather than inferring one from another's success. A printed composition is good evidence about which entries were selected; it is not proof that every plugin activated or behaves correctly.
The same caution applies to replacement. Two plugins with similar names are not interchangeable unless the actual service contract and dependencies line up. And because a targeted row takes a whole-config replacement, an edit can silently remove a value or expression another layer depended on.
Finally, the safety boundary: a plugin can execute code and register side effects. Inspect the precise code and dependency set you intend to load, and test with data and permissions you are willing to expose. A successful mount, a reversible registration, or a clean plugin listing does not make a plugin safe. If you are writing one, the first plugin tutorial covers the local development loop.
Terms worth keeping straight
- Cordis: the plugin framework underneath the Harness composition.
- Profile: a named assembly of bundles plus profile-specific changes.
- Bundle: a distribution of configuration entries and mounting code.
- Service: a capability exposed at a context key for other plugins.
- Effect and disposer: a registration and the cleanup that runs when it goes away.
Originally published at https://dsh-plugin.com/blog/cordis-plugin-tree

Top comments (0)