# DeepSeek Harness (dsh) Hooks and Permissions Reference

How dsh's pre-execute and post-execute hooks work, how allow, ask and deny map to dsh's approval flow, and what the ACP plugin does not do yet: it doesn't stop a denied call, and it doesn't work with --local.

<div style="margin:8px 0 28px;padding:20px 22px;border:1px solid var(--line-2);border-radius:12px;background:var(--color-accent-light,#f0effe);">
  <p style="margin:0 0 12px;font-size:15px;line-height:1.6;color:var(--acp-text);"><strong>Just want the answer?</strong> dsh has no shell-hook config to write. The ACP plugin is a native Cordis plugin. Install it into a profile and every tool call is checked and recorded from the next boot. A deny is reported but not enforced on dsh yet, so read the limits below first.</p>
  <pre data-track="DSHHooks: Hero Config Copy" style="margin:0 0 12px;background:var(--color-surface,#faf9ff);border:1px solid var(--line-2);border-radius:8px;padding:12px 14px;overflow-x:auto;"><code>dsh plugin --profile &lt;your-profile&gt; add @agenticcontrolplane/dsh
export ACP_BEARER_TOKEN=gsk_...   # or keep it in ~/.acp/credentials
dsh --profile &lt;your-profile&gt;</code></pre>
  <p style="margin:0;font-size:13px;color:var(--acp-text-dim);"><a href="/integrations/dsh" data-track="DSHHooks: Install Guide" style="font-weight:600;">Full dsh install guide →</a> &nbsp;·&nbsp; <a href="/controls/dsh" data-track="DSHHooks: Controls Page">the controls reference →</a></p>
</div>

Most coding agents add control with a shell hook: a subprocess that gets JSON on stdin. DeepSeek Harness works differently. dsh is built on [Cordis](https://github.com/deepseek-ai/deepseek-harness), a plugin framework. Its built-in tools, its policy layer and anything you add are all plugins on the same typed pipeline. This post covers that pipeline: what each stage carries, what the ACP plugin does with it, how `ask`, `deny` and `allow` map to dsh's approval flow, and what the plugin can't do yet.

## The two interception points

Every tool call in dsh goes through one pipeline: `tool/call`, then `tools/pre-execute`, then `tools/execute`, then `tools/post-execute`, then `tool/result`. That covers `bash`, `pwsh`, `read`, `write`, `edit`, `glob`, `grep`, `web_fetch`, `web_search`, subagent spawns, and the sub-calls inside Code Mode. MCP tools use the same pipeline as `mcp__<server>__<name>`.

Two stages matter for control:

| Extension point | Fires | Can |
|---|---|---|
| `tools/pre-execute` | before every tool call | return a typed **allow**, **ask** or **deny**; a deny is meant to skip the call, with the reason recorded in dsh's session log |
| `tools/post-execute` | after every tool call | inspect the result and **replace its content** before the model reads it |

Both are ordinary Cordis registrations, the same kind dsh's own tools use. They run in-process, with no subprocess and no JSON format to keep in sync across dsh releases.

## What each stage can return

`tools/pre-execute` returns one of three decisions:

- `{ kind: 'allow' }` lets the call through.
- `{ kind: 'deny', reason }` is meant to skip the call and show the model the reason.
- `{ kind: 'ask', reason }` goes to dsh's own approval flow (`ctx.approval`) instead of a separate prompt.

`tools/post-execute` can accept the result, block it, or replace the content. That matters because most harnesses' post-hooks only observe. By the time you notice a leaked credential in a tool result, the model has read it. dsh's post-execute point can change the result first.

## What the ACP plugin does

[`@agenticcontrolplane/dsh`](https://github.com/agentic-control-plane/dsh-acp-plugin) registers on both points. `tools/pre-execute` posts to `/govern/tool-use` and gets back `allow`, `ask` or `deny`. `tools/post-execute` posts to `/govern/tool-output` to scan the result. A server-side block becomes corrective feedback to the model, and a redact replaces the content the model reads.

Override the settings in your profile's `cordis.patch.yml`:

```yaml
- id: acp
  name: "@agenticcontrolplane/dsh"
  config:
    governBase: https://govern.agenticcontrolplane.com  # or self-hosted
    agentTier: interactive   # default: interactive when an approval service is mounted, background otherwise
    timeoutMs: 4000
```

`ACP_GOVERN_BASE`, `ACP_BEARER_TOKEN`, `ACP_AGENT_TIER` and `ACP_SHADOW=off` work as environment variables.

Two dsh facts to know before installing. dsh needs **Node 22**. Under Node 20 it fails at boot with errors that don't say why. And a bare `npx dsh` can't find a plugin installed in a profile, because npx looks up bare package names in its own cache. A `--patch` overlay that loads the plugin by file path works everywhere, and a normal `dsh` install resolves fine.

## How allow, ask and deny behave

**Allow.** The call runs with no prompt.

**Ask.** If an approval service is mounted, the human gets dsh's own prompt, so they see one consistent prompt no matter who raised it. If none is mounted, dsh denies the ask itself. The hold then waits on the console Approvals page and in the approval email. Approve it there, then ask the agent to retry.

**Deny.** This one has a gap. The plugin reports the deny to the agent and records it, but dsh goes on to run the call. In one production workspace, dsh ran some tools after the plugin reported a deny, and we haven't found the cause. The fix is tracked. Until it ships, a deny on dsh is reported, not guaranteed. That includes the safety floor: on dsh it records and reports a risky call instead of stopping it. The [coverage matrix](/coverage) has the current status.

The ask behavior with nobody there is dsh's own, and it is a good default. A headless composition with no approval service resolves `ask` to deny, so an unattended agent can't approve itself.

On the output side, the `/govern/tool-output` response can also carry shadow-mode notices. These show what an enforcement decision would have done to a result before you turn blocking on for that rule.

## If ACP is unreachable

Interactive sessions fail open. Calls run, with a loud `[ACP] ⚠ UNGOVERNED` warning and an entry in `~/.acp/lapse.log`. Unattended tiers fail closed, which means the plugin returns a deny. Because deny isn't enforced on dsh yet, that deny is reported and recorded but may not stop the call.

## --local mode isn't supported

Unlike the plugins for Claude Code, Cursor, Codex and opencode, the dsh plugin has no on-device fallback. It needs a workspace credential. Run the installer with `--local` and dsh is detected and skipped, with this message: "DeepSeek Harness detected — skipped in `--local` mode (its ACP plugin needs a workspace; local decisions aren't wired there yet)." With no credential at all, the plugin doesn't block anything. It prints a `[ACP] ⚠ UNGOVERNED: no credential` warning at boot and stays out of the way.

## Known limits

- **A deny isn't enforced.** See above.
- **Model spend isn't metered.** There is no proxy path for dsh's model calls, so nothing prices tokens. What is recorded is each tool-call decision: name, input preview, decision, reason, latency, and session and workspace attribution. It shows in the console next to dsh's own trajectory log.
- **dsh core has no policy engine.** Presets such as `dsh-permission-presets` pair a sandbox mode with an approval setting. Rules come from plugins, and the ACP plugin is one of them.
- **The Claude Code hooks bridge is a compatibility path.** dsh's `hooks-claude-code` bridge runs an unmodified `hooks.json` and honors deny and ask, but not input rewriting. The native plugin covers both points and rewriting, so use it instead.
- **dsh is in developer preview and ships breaking changes.** After each upgrade, confirm the plugin mounted with `dsh --profile <name> --dump-config`.

## Related links

- [/controls/dsh](/controls/dsh): sandbox modes, the approval service, the session log
- [/integrations/dsh](/integrations/dsh): the install guide and troubleshooting
- [Claude Code hooks reference](/blog/claude-code-hooks-reference): the shell-hook shape, for comparison
- [Codex hooks reference](/blog/codex-cli-hooks-reference): a narrower hook surface that is still changing
- [opencode hooks and permissions reference](/blog/opencode-hooks-reference): the other in-process plugin model, with a real rule language

## Frequently asked questions



<!-- Sources: https://github.com/deepseek-ai/deepseek-harness (dsh repository); https://github.com/agentic-control-plane/dsh-acp-plugin (plugin source and README); agenticcontrolplane.com/controls/dsh and agenticcontrolplane.com/integrations/dsh (this site's own reference and install pages, cross-checked against the above) -->
