DeepSeek Harness capability three roles: Definition / Provider / Consumer
The official docs often use the three terms Service Definition, Service Provider, and Consumer; together they form the seam of a capability, that is, the replaceable capability interface.
This chapter will clarify what each of the three is and why a capability is split into three roles.
The complete capability constitutes its seam; no single role is the seam.
What each of the three roles is
When a capability is general enough to need replaceable providers (such as Bash execution), the harness splits the capability into three roles.
| Role | What it is responsible for | Taking Bash as an example |
|---|---|---|
| Service Definition Interface + types | Defines the Cordis service, plus the types of the request Request and result Result | dsh-shell (registered as ctx.shell) |
| Service Provider Create a class that implements | Actually implements the capability, usually targeting one runtime environment | dsh-bash-local (local execution) |
| Consumer Model-facing tool | Exposes the capability as a tool the model can call | dsh-tool-bash (bash tool) |
Service Definition only declares "what capability there is and what it looks like", and does not care how it is implemented.
Service Provider inherits the abstract class from Definition and fills in the concrete behavior.
Consumer faces the model, wrapping the capability into a tool schema so the model can call it.
The three roles can be placed in the same package or split into different packages.
There is only one criterion: whether these roles need to evolve or be replaced independently.
Understanding the three seam roles in one diagram
All three roles depend on Definition, while Provider and Consumer do not depend on each other.
The dashed box in the diagram is the complete capability, that is, the seam.
Definition is in the middle; Provider and Consumer both depend only on it.
Provider inherits and implements Definition; Consumer depends on it via inject: ['shell'].
There is no dependency at all between Provider and Consumer.
Therefore, when swapping the Provider, not a single line of Definition or Consumer needs to change.
Taking Bash as an example: the three roles of ctx.shell
Bash execution is the most typical seam in dsh, with one package for each of the three roles.
The Service Definition is the dsh-shell package, registered as the ctx.shell service.
It defines Bash's request type ShellExecRequest and result type ShellRunResult.
The Service Provider is dsh-bash-local, which executes commands on the local machine.
The same Definition has other Providers too, for example dsh-bash-sandbox executes in a sandbox and dsh-pwsh-local executes PowerShell.
The Consumer is dsh-tool-bash, which wraps the capability into a bash tool the model can call.
tool-bash declares its dependency on ctx.shell via inject, then calls ctx.shell.run(...) in execute.
The official "Capability Seam and Core Services" reference doc uses a table to maintain the three-role attribution of ctx.shell.
| ctx key | Role | Owning package (Definition) | Implementation (Provider) | Direct consumer (Consumer) |
|---|---|---|---|---|
| ctx.shell | seam | shell | bash-local / bash-sandbox / pwsh-local | tool-bash / tool-pwsh / hooks-claude-code / hooks-codex |
Consumers also include the two hook bridge plugins hooks-claude-code and hooks-codex.
Like tool-bash, they recognize only the ctx.shell interface and do not care which executor is behind it.
In the Bash seam, the model-facing request ShellExecRequest (workdir and timeoutMs optional) is separated from the fully resolved spec actually used by the executor, ShellExecSpec (all fields required).
The tool layer calls ctx.shell.resolve(request) between the two, which is "explicit is better than implicit at the package boundary".
Why split into three roles
The first benefit of splitting is that the provider is replaceable.
The same Service Definition can have multiple providers, selected via cordis.yml.
Example
File path: cordis.yml
Local execution
- name
:
'@deepseek-ai/dsh-bash-local'
To change the provider, just replace the line above.
Replace it with the line below to switch to the sandbox executor:
- name: '@deepseek-ai/dsh-bash-sandbox'
When changing the provider, both Service Definition and Consumer remain unchanged.
The second benefit of splitting is that the three roles can evolve independently.
| Role | Freedom to evolve independently |
|---|---|
| Service Definition | Once callers start relying on its contract, it rarely changes |
| Service Provider | Performance and security can be optimized independently |
| Consumer | The way the capability is presented to the model can be adjusted |
The third benefit of splitting is dependency decoupling.
Service Provider depends on Service Definition.
Consumer depends on Service Definition.
Service Provider and Consumer do not depend on each other.
| Dependency Relationship | Whether it holds |
|---|---|
| Provider → Definition | Is |
| Consumer → Definition | Is |
| Provider → Consumer | No |
| Consumer → Provider | No |
Hands-on: find the three roles of a seam you are using
The official "Capability Seam and Core Services" reference doc maintains a complete service list.
Pick a seam you are familiar with, such as ctx.fs or ctx.llm, and sort it out in three steps.
Step 1, find its Definition package, that is, the "Owning package" column in the table.
Step 2, find its Provider package, that is, the "Implementation" column in the table.
Step 3, find its Consumer, that is, the "Direct consumer" column in the table.
For example, ctx.llm's Definition is the llm package, the implementations are llm-deepseek and llm-pi-ai, and the direct consumers are agent-loop and compaction-basic.
Another example: ctx.fs's Definition is the fs package, the implementations are fs-local, fs-sandbox and fs-e2b, and the direct consumer is tool-fs.
Once you are used to this way of thinking, you can tell at a glance which role any built-in service belongs to.
Summary and self-test
In one sentence: a capability is split into three roles - Definition (interface and types), Provider (implementation), and Consumer (model-facing tool) - and only the three together form the seam.
Self-test question 1: Which packages correspond to the Definition, Provider, and Consumer of the Bash capability?
Self-test question 2: When changing Bash's Provider, which packages can remain unchanged?
Self-test question 3: Why is it said that "no single role is the seam"?