Skip to main content

dsh-clawrouter

19Stars1Forks2Issues0Watchers

Adds a "second brain" to the DeepSeek Harness agent: a stronger model reviews dangerous commands before execution, and connects 60+ models to DSH via wallet signing (x402/USDC) without API keys.

Evidence4/5methodologySourceInstallMaintenanceDSH versionSecurity scan
Machine-auditedInstall commandRepo verifieddsh-plugin topicLicenseREADMEAI wiki
Language
TypeScript
License
MIT
Branch
main
ai-agentsblockruncode-reviewdeepseek-harnessdshdsh-pluginllm-routerx402

Install

cmdweb profile
$ dsh plugin --profile web add dsh-clawrouter

Run the command above in your terminal to install this plugin via the dsh CLI. You can switch Profile in the top-right corner. New to dsh? Read the beginner tutorial

Install via your agent

Install the DeepSeek Harness plugin BlockRunAI/dsh-clawrouter for me: review the repository at https://github.com/BlockRunAI/dsh-clawrouter first, then run the install command and verify the plugin loads successfully.

Paste this instruction to the DSH Web GUI assistant — it will install and verify for you.

One-Line Positioning

Equip DeepSeek Harness agents with a "second brain": before an agent executes dangerous operations, have a stronger model review the command first before allowing it to proceed; meanwhile, connect BlockRun's 60+ models to DSH via wallet signature—no API Key, no account, pay-per-use in USDC.

Core Capabilities

  • Automatically review dangerous commands before tool execution: recursive deletion, raw disk writes, curl | sh, forced pushes, sudo, accessing ~/.ssh or /etc/passwd, and file writes that will be "executed later" (git hooks, CI workflows, postinstall, shell startup files)—a stronger model decides "allow / deny / escalate to human"
  • Register BlockRun as a model router: use EVM wallet signature instead of API Key, pay-per-use via x402 in USDC; one wallet gives access to Claude / GPT / Gemini / Grok / Kimi and 60+ models
  • Provide /spend command to query current session's request count, input/output tokens, and costs grouped by model
  • Provide /review command to submit any diff / plan / conclusion to the reviewer model for a one-time manual triggered review
  • Provide /gate command to see if the gate is actually enabled and what rules are loaded; /gate drill can run an end-to-end drill with the real reviewer model without executing any tools
  • Support visual input and reasoning effort (high / max) selection for in-pipeline models, with image capabilities only enabled for actually tested vision models by default

Technical Implementation

  • Language: TypeScript (tsup bundles ESM, main entry lib/index.js, type declarations lib/index.d.ts)
  • Key Dependencies: @blockrun/llm (x402 wallet signature client), @deepseek-ai/schemastery (runtime config schema), @deepseek-ai/cordis (DSH plugin runtime with inject: ['llm','tools','commands'] injection points)
  • Architecture Pattern: Dual bundle plugin—cordis.patch.yml synthesizes blockrun-llm (provider route registration) and blockrun-review (tools/pre-execute listener + /review /gate commands) in the profile; gate logic matches rules in pre-execution events, and on hit asynchronously calls a stronger model with safe / dangerous / uncertain three-tier verdict; the gate can only "tighten" not "release"
  • Entry Files: src/index.ts (provider route + /spend command), src/review.ts (gate + /review /gate commands), src/adapter.ts (BlockRun LLM adapter, wrapping wallet signature and streaming responses)

Use Cases

When you're stuck in DSH with the dilemma of "Full Access is too permissive, per-command approval is too tedious," this plugin provides a third option: allow everything by default for daily operations (read/edit/build/commit), only when the agent is about to execute destructive or privilege-escalating operations let a stronger model take a look first; if rejected, give the reason to the agent for correction. At the same time, if you want to leverage capabilities beyond DeepSeek—for example, using Claude for review, Gemini for image understanding, GPT for plan verification—this plugin provides a path without account registration, without API Key, pay-per-use.

Prerequisites & Compatibility

DependencyMin VersionNotes
DeepSeek Harness>=0.1.0-rc.6peerDependencies lists six host packages: dsh-attachment / dsh-commands / dsh-credentials / dsh-launch-environment / dsh-llm / dsh-tools, all require >=0.1.0-rc.6; dsh-attachment is marked optional in peerDependenciesMeta, only needed for visual capabilities
Node.js>=22.19 or >=24package.json#engines.node explicitly declares `^22.19
Cordis>=4.0.1peerDependencies."@deepseek-ai/cordis": ">=4.0.1", provided internally by DSH
Base Chain USDC≥ a few dollarsWallet key authorized via EIP-3009 signing charges per-use; typical gate review is ~$0.0057, $5 USDC is enough for ~2500 reviews or 5 Opus calls with 100K tokens
PlatformCross-platformNo os / cpu restrictions, no native module dependencies like node-pty, node:sqlite

Installation

dsh plugin --profile web add dsh-clawrouter

Configuration

The plugin injects two lines into profile's cordis.patch.yml, respectively blockrun-llm (model route) and blockrun-review (gate). The "Purpose" column in the table below is in plain language.

blockrun-llm Route Configuration

ConfigTypePurposeDefault
providerstringRegistration name for this route in DSHblockrun
walletKeyEnvstringEnvironment variable name holding the EVM wallet private key; the plugin only reads variables you explicitly specify, never scans the diskBASE_CHAIN_WALLET_KEY
apiUrlstringBlockRun API entry pointhttps://blockrun.ai/api
timeoutMsintegerSingle request timeout300000 (5 minutes)
requestFeeUsdnumberFixed fee per request (used for /spend estimation)0.002
visionModelsstring arrayList of models allowed to receive images; only includes actually tested working models by defaultgoogle/gemini-2.5-flash, google/gemini-3.5-flash, google/gemini-3.6-flash, moonshot/kimi-k3
maxOutputCeilingintegerDefault output token ceiling; the gateway settles by "requested max_tokens", so limiting the ceiling avoids being charged full flagship model output by default8192
auxiliaryModelstringCheap model for "maintenance" calls like compressing context, generating session titles; main conversation body won't be reroutedoff

blockrun-review Gate Configuration

ConfigTypePurposeDefault
enabledbooleanWhether to actually intercept tool execution; when off, /review and /gate are still usablefalse
reviewerProviderstringWhich provider route the reviewer model usesblockrun
reviewerModelstringReviewer model id, deliberately chosen to be stronger than the agent itselfanthropic/claude-opus-5
timeoutMsintegerMaximum wait time for a single review30000
reviewerMaxTokensintegerMax output tokens for a single review request; the gateway settles by "requested max_tokens", so setting a limit avoids a single review being charged at flagship model's 128K output ceiling512
onReviewerFailureask | denyWhen the reviewer model is unreachable, ask for human approval or deny directlyask
extraRulesarrayAppend custom rules {name, pattern, tools?}; pattern is JS regex source string, wrong patterns throw errors at load time rather than silently skipping[]

FAQ

Q: After installation it shows "✕ missing peer"—did it fail?

A: Not a failure. The 6 host packages listed in package.json's peerDependencies are injected by Harness at runtime—this is the common practice for all official Bundles; explicit dependencies would cause a second copy of cordis in the profile, which would make instanceof LlmError fail across copies and all error codes become UNKNOWN. To verify, run dsh --profile web --dump-config, you should see both blockrun-llm and blockrun-review synthesized.

Q: Where does the wallet key come from? I don't have an API Key.

A: BlockRun uses wallet signature instead of API Key. Existing BlockRun wallet: export from ~/.blockrun/.session or ~/.openclaw/blockrun/wallet.key; brand new users run npx -y @blockrun/clawrouter to generate a new wallet, fund the address with some Base chain USDC, then export BASE_CHAIN_WALLET_KEY=.... The plugin only reads the environment variable you explicitly specify via walletKeyEnv, never auto-scans the disk—avoiding your configured key being "secretly overwritten" by another key.

Q: After installation, did my default model change?

A: No change. Mounting the blockrun route doesn't change dsh-base's default deepseek-official; that route is either explicitly selected by you or invoked by the review gate. The reviewer model defaults to anthropic/claude-opus-5, charged per-use in USDC.

Q: What operations does the review gate intercept? Will ordinary git commit be asked?

A: No. The rules are deliberately narrow—only intercept truly irreversible or privilege-escalating operations: recursive deletion, raw disk writes, curl … | sh, force push, git reset --hard, chmod 777, sudo, accessing ~/.ssh / ~/.aws / /etc/passwd, and "will be auto-executed later" file writes (git hooks, CI workflows, shell startup files, .gitconfig, postinstall). Daily read/edit/build/commit all pass through; just "mentioning" dangerous commands in command line (grep -rn "rm -rf" docs/) won't trigger false positives because rules anchor to command start position.

Q: What if the reviewer model goes down? Will it be silently allowed through?

A: No. Default onReviewerFailure: ask—when unreachable, escalate to human approval; users needing unattended automation can change to deny, letting the gate reject directly. deny makes the gate "fail closed" (don't let through), ask makes the gate "fail open" (let humans decide), both ensure dangerous commands don't slip through during network jitter.

Q: What does /gate drill do? Can I run it without enabling the gate?

A: /gate drill sends rm -rf / --no-preserve-root through the risk matcher and real reviewer model, but never hands it to any tool for execution. It's used to prove the gate is actually working—/review command registers successfully even when the gate is closed, so just seeing /review work can't prove the gate is active; when gate is disabled, /gate drill directly errors ("nothing to drill").

Q: How do I add custom review rules?

A: In profile's cordis.patch.yml, append {name, pattern, tools?} to blockrun-review's config.extraRules, pattern is JS regex source string, matched against the tool's rendered parameters; tools being empty means applies to all tools. Rules are validated at compile time during load, wrong patterns throw immediately without silent skip.

Q: Will this make DeepSeek cheaper for me?

A: No, this plugin doesn't replace DeepSeek's official billing. BlockRun doesn't support DeepSeek's cache hit discount: cache-hit turns cost ~$0.000056 with official direct connection, ~$0.007 through this plugin with 22K input. It's recommended to keep the main loop using DeepSeek official, this plugin is for things DeepSeek can't do (stronger model review, calling Claude / GPT / Gemini / Grok, x402 micropayments).

Learning Curve

Beginner—installation immediately gives you /spend and 60+ model entry points; the gate is closed by default, you need to manually set enabled: true in cordis.patch.yml to intervene in the execution flow, and you need to have BASE_CHAIN_WALLET_KEY configured beforehand or go through the credential service.

Known Issues & Limitations

  • Image requests are rejected rather than silently dropped: When dsh-attachment isn't configured, sending images through this route returns UNSUPPORTED, explicitly pointing to "compose @deepseek-ai/dsh-attachment" (src/serialize.ts:128-133 / README.md:288)
  • Setting reasoning effort for non-reasoning models is rejected locally: Under the premise of per-request settlement by gateway, the reasoning_effort field is first judged locally by directory, models not declaring reasoning capability directly get UNSUPPORTED rather than being rejected after payment (src/adapter.ts:156-164 / README.md:213)
  • In-flight requests that haven't finished cannot be interrupted by AbortSignal: @blockrun/llm currently doesn't support passing the signal through to socket, local abort only stops reading; underlying connection remains occupied until SDK's own timeout (src/adapter.ts:218-225 / README.md:290-291)
  • This plugin doesn't persist spending to disk: Harness session log rejects unknown event types, external repo plugins can't declare their events ignorable; /spend only gives in-memory stats, lost across processes, ledger is based on wallet balance (src/spend.ts:8-21 / README.md:292)
  • "Smart routing" virtual model not enabled: Gateway has blockrun/auto router but this plugin doesn't wire it up, because virtual models must declare a context window, declaring max candidate causes smaller models to be incorrectly assigned long context, declaring min candidate causes premature context compression each session (README.md:293)
  • Compression may trigger earlier than model's actual capability: This route reports capacity based on gateway directory declared windows, no实测 expansion to avoid silent overflow; some models' actual windows are larger than directory values (README.md:294)
  • Context overflow judged by request size rather than error text: Gateway rewrites all upstream errors to {"message":"API request failed"}, regular text matching all fails, so this plugin forcibly judges requests returning 400 with body exceeding declared window as overflow to trigger compression (src/adapter.ts:51-54 / README.md:295)
  • Previous round reasoning content not passed back: DeepSeek's think mode recommends passing reasoning_content back in tool-call cycles, but this route serves multiple vendor models simultaneously, a vendor's mandatory field may be another vendor's rejection field, so multi-step tool calls may slightly degrade on reasoning models (README.md:296)

Read the usage guide →

Install steps, key points, FAQ and compatibility for this plugin — auto-derived from indexed fields.

Listing badge

Listed on deepseek-plugin.org
[![Listed on deepseek-plugin.org](https://img.shields.io/badge/listed_on-deepseek--plugin.org-007EC6)](https://deepseek-plugin.org/plugins/BlockRunAI/dsh-clawrouter)

Paste this markdown into your GitHub README to link back to this listing. The badge only states the listing — not a security endorsement.

← Back to plugin directory