clioo/dsh-claude-agent: Run your own Claude login in DeepSeek Harness

Foreword

Developers building agent applications often encounter a problem: the harness interface, tools, and history are all ready, but the model channel needs to be set up manually. There are two ways to integrate Claude: one is to write a client to read subscription credentials, and the other is to not use a client at all, but instead directly drive the user’s already-logged-in claude binary. The dsh-claude-agent maintained by clioo chose the latter.

It adds a model provider named claude-agent to DeepSeek Harness (hereinafter referred to as DSH). The implementation follows opencode’s own claude-agent provider design: it calls the user’s locally installed claude program via Anthropic’s official Claude Agent SDK. Claude Code continues to use its own authentication, client, and request methods; the plugin simply wraps the harness’s UI, tools, and history around it.

The direct benefit of this approach is the prompt caching hit rate. According to the author’s measurements, under stable conditions, cache hits exceed 90%, and most steps in a single tool invocation range between 96% and 100%.

Below is an introduction to the plugin’s positioning, installation method, and configuration options.

Positioning: Why Not a Third-Party Client

The design premise of the plugin is only one sentence: do not become a third-party client for subscription credentials.

The specific constraints are as follows:

  1. The plugin does not read ~/.claude/.credentials.json, does not run the OAuth flow, and has no login interface.
  2. Every model request is initiated by the user’s installed and logged-in claude program on the user’s machine, under the user’s account.
  3. The plugin does not collect, store, proxy, or replay any content; it only passes through the options and environment variables recorded in the SDK documentation.
  4. The claude binary is not modified, nor are any authentication methods disabled; the plugin actually clears CLAUDE_CODE_SIMPLE, which would otherwise skip login.
  5. In naming, it follows the Agent SDK’s brand guidelines: the product name is Claude Agent, not Claude Code.

The basis is Anthropic’s current Legal and compliance page: OAuth tokens are only used for the normal use of Claude Code and other native Anthropic applications. Developers must not put the Claude.ai login into their own applications, nor must they forward requests using Free, Pro, Max, or Ultra plan credentials on behalf of users, nor collect, store, or cache credentials and session tokens. The same document explicitly allows end users to log in with their own subscription to an unmodified Claude Code binary. The plugin implements this latter case.

The payment path is therefore not forced: subscriptions, API keys, Bedrock, Vertex, Foundry, or enterprise gateways are all acceptable, because the plugin does not determine the billing routing. If one wants to create a hosted product providing Claude to third parties, one should use API key authentication or a commercial agreement; that is a different scenario.

Core Features

The following capabilities all come from the repository README.

  1. Use Claude models with your own login: Opus, Sonnet, Haiku, and explicit model IDs reported by Claude Code runtime, discovered and cached at runtime.
  2. Harness tools are exposed via MCP: Claude Code’s built-in tools are disabled, and harness tools are exposed via an in-process MCP server, with JSON Schema sent as-is.
  3. Tool invocations do not restart the process: A Claude turn stops at the tool boundary and resumes after harness returns the result, rather than restarting the process.
  4. History is recoverable: Harness history is the single source of truth, sending only messages Claude hasn’t seen yet; Claude’s session history is recovered after restart.
  5. Isolation: It does not use Claude Code’s config files, hooks, skills, CLAUDE.md, MCP server, auto-memory, auto-compaction, advisor, tool search, nor does it have non-streaming or refusal fallback paths.
  6. Accurate usage reporting: Reports token usage per invocation, including cache reads and cache writes, allowing harness to display the true cache hit rate.
  7. SDK lazy loading: The SDK is loaded on first use; it can also be replaced by the version in PATH or an executable file specified in the configuration.

Runtime Requirements

- DeepSeek Harness 0.2.1 or higher (this provider is a Host bundle)
- Installed and logged-in Claude Code 2.1.248 or higher:

First, confirm the local environment:

claude --version
claude auth login

The claude binary must be in PATH, or explicitly specified as executable in the plugin configuration. The plugin will not use the binary downloaded by the SDK; it runs the version you installed yourself. The CLI version and login status follow yours.

Installation and Activation

Open the Plugin Manager in DeepSeek Harness Desktop and install the bundle from the directory page. The bundle only inserts a single line claude-agent and does not disable anything else.

For Electron-unmanaged profiles, use the command line:

dsh plugin --profile <profile> add /path/to/dsh-claude-agent

After replacing the file, you need to reload the plugin or restart DSH for the Host to load the new module and generate results.

Then select Claude Agent in the model selector, or set it as the default model directly:

- id: agent-default-model
  config:
    provider: claude-agent
    model: opus          # or sonnet, haiku, claude-opus-5-5, etc.
    reasoningEffort: high

Configuration Options

The plugin configuration block is as follows; unwritten items have default values:

- id: claude-agent
  name: 'dsh-claude-agent'
  config:
    # Optional. Defaults to the claude in PATH.
    executable: /usr/local/bin/claude
    # Optional. Working directory for the Claude process.
    cwd: /home/you/project
    # Optional. Output limit, corresponding to CLAUDE_CODE_MAX_OUTPUT_TOKENS.
    maxOutputTokens: 32000
    # How many minutes of inactivity before the process stops (default 5).
    idleMinutes: 5
    # How many minutes to keep a parked tool invocation (default 30).
    parkedMinutes: 30
    # Connection settings, mapped exactly like opencode.
    baseURL: https://api.anthropic.com
    apiKey: sk-ant-...
    # authToken, headerTimeout, chunkTimeout, headers, body

Correspondence between connection configuration items and Claude Code environment variables:

Plugin config Claude Code setting
baseURL ANTHROPIC_BASE_URL
apiKey ANTHROPIC_API_KEY
authToken ANTHROPIC_AUTH_TOKEN
headerTimeout API_TIMEOUT_MS
chunkTimeout CLAUDE_STREAM_IDLE_TIMEOUT_MS
headers ANTHROPIC_CUSTOM_HEADERS
body CLAUDE_CODE_EXTRA_BODY
maxOutputTokens CLAUDE_CODE_MAX_OUTPUT_TOKENS

When connection items are not explicitly configured, the plugin follows the current environment and leaves the decision to the claude login status. Configuration takes precedence over the shell environment.

Actual Performance of Prompt Caching

High cache hit rates are not achieved by tuning parameters, but by keeping the prefix stable. The README lists four mechanisms:

  1. Each harness session uses only one persistent claude process; tool invocations pause inside the process to wait, rather than restarting.
  2. System prompts, tool lists, and connection settings are hashed; the process is restarted only when one of them actually changes.
  3. Harness history is fingerprinted. It only appends messages that Claude hasn’t seen yet; if the history itself changes (edited, undone, or model switched), it sends a <conversation-checkpoint> to rebuild, rather than pretending the old prefix is still valid.
  4. Usage is reported per API message, not using the SDK’s round summary value, ensuring hit rate statistics are not distorted.

The README records step-by-step data for a real turn, with the model as claude-haiku and Claude Code 2.1.317. The total for the full 28 steps is 3,348,680 cached input, 161,101 cache writes, and 110 uncached inputs, with an overall hit rate of 95.4%, stabilizing between 97% and 99.8% from step 6 onwards. These numbers are the author’s measurement results from a single session; they may differ under different loads, but the mechanism itself is verifiable.

By the way, the cached input recorded in the session logs is larger than the summary per message, because the final step carries the aggregated value for the whole round. This is also why reporting is per message rather than by SDK summary.

Applicable Scenarios and Considerations

Suitable scenarios: You have already logged into the local claude using your own Claude subscription (or API key, Bedrock, Vertex, Foundry, or enterprise gateway) and want to do development under the DSH interface, toolchain, and history management, while not wanting to expose credentials to any third-party client. For a complete analysis, see docs/opencode-approach.md in the repository.

Unsuitable scenarios: If you want to create a hosted product providing Claude capabilities to third parties. In that case, API key authentication or a commercial agreement should be used; the plugin’s local login approach is not applicable.

Things to note:

  1. The plugin runs with the permissions of the current DSH process and can read files and environments that the process can access. Before installing, check the source code and license; the repository root has LICENSE and SECURITY.md.
  2. The README states that the plugin has no affiliation, endorsement, or sponsorship relationship with Anthropic, opencode, or DeepSeek.
  3. The repository is a community personal project, package name is dsh-claude-agent, current package.json version is 1.0.0, depends on @anthropic-ai/claude-agent-sdk 0.3.318 and @modelcontextprotocol/sdk 1.32.2, and requires Node.js 18.14.0 or higher. The directory page shows 0 stars, making it a very new project; it is worth running smoke tests yourself before integrating.
  4. idleMinutes and parkedMinutes in the configuration determine when the process is reclaimed; pay attention to the default values in long-running task scenarios.

Summary

The value of this plugin lies not in providing an additional model, but in changing the way Claude is connected: without touching credentials, without restarting the process, and keeping the prefix stable, thereby achieving a stable and significant cache hit rate, while making the harness toolchain and history the single source of truth. If you are already using Claude Code and want to continue using the same login in DSH, this is currently the easiest path to implement.

  • Directory page: https://www.skillhub.cn/plugins/clioo/dsh-claude-agent
  • Source code: https://github.com/clioo/dsh-claude-agent

(The community directory is an independent site and has no official affiliation with DeepSeek.)

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye