rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:clioo/dsh-claude-agent
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
A claude-agent model provider for DeepSeek Harness that follows the design opencode shipped in its own claude-agent provider: it runs the user's installed claude binary through Anthropic's official Claude Agent SDK. Claude Code keeps its own authentication, its own client and its own request; the plugin adds the harness's UI, tools and history around it.
In steady state this provider gets >90% prompt-cache hits (96–100% per tool round in our measurements on Claude Code 2.1.317). See Prompt caching.
Not affiliated with, endorsed by, or sponsored by Anthropic, opencode, or DeepSeek. "Claude" and "Claude Agent" are used descriptively under Anthropic's branding guidelines; the product name of this plugin is Claude Agent, not Claude Code.
The short version: do not become a third-party client for subscription credentials. Let the unmodified Claude Code binary make the request.
~/.claude/.credentials.json, never runs an OAuth flow, and has no login screen.claude program the user installed and signed in with, on the user's machine, under the user's own account.CLAUDE_CODE_SIMPLE, which would skip the login.Anthropic's current Legal and compliance page says OAuth tokens are for "ordinary use of Claude Code and other native Anthropic applications", and that developers may not "offer Claude.ai login into their own applications, or route requests through Free, Pro, Max, or Ultra plan credentials on behalf of their users", nor "collect, store, or intermediate Claude.ai credentials or session tokens". The same page expressly allows an end user to sign in to the unmodified Claude Code binary with their own subscription.
That is the case this plugin implements: the user signs in with claude, and the plugin drives that binary. It works with a subscription, an API key, Bedrock, Vertex, Foundry or an enterprise gateway because it does not force any billing route.
For a hosted product that offers Claude to third parties, use API key authentication (or a commercial agreement), as the Agent SDK overview recommends. A local plugin running the user's own Claude Code is a different case. The full analysis, with references to opencode's specification and source, is in docs/opencode-approach.md.
CLAUDE.md, MCP servers, auto-memory, auto-compaction, advisor, tool search, or non-streaming/refusal fallbacks.PATH or a configured executable.DeepSeek Harness 0.2.1 or later (the provider is a Host bundle).
Claude Code 2.1.248 or later installed and signed in:
claude --version
claude auth login
The claude binary must be on PATH, or set executable in the plugin config.
The plugin does not use the binary that the SDK downloads; it runs yours, so your CLI version and your login are the ones in charge.
In DeepSeek Harness Desktop, open the Plugin Manager and install a bundle from this directory. The bundle inserts one row, claude-agent, and disables nothing else.
On a profile that Electron does not manage:
dsh plugin --profile <profile> add /path/to/dsh-claude-agent
Reload the plugin (or restart DSH) after replacing the files, so the Host loads the new module generation.
Then pick Claude Agent in the model selector, or set it as the default:
- id: agent-default-model
config:
provider: claude-agent
model: opus # or sonnet, haiku, claude-opus-5-5, ...
reasoningEffort: high
- id: claude-agent
name: 'dsh-claude-agent'
config:
# Optional. Defaults to `claude` on PATH.
executable: /usr/local/bin/claude
# Optional. Working directory for the Claude process.
cwd: /home/you/project
# Optional. Output cap, passed as CLAUDE_CODE_MAX_OUTPUT_TOKENS.
maxOutputTokens: 32000
# Minutes of inactivity before the process is stopped (default 5).
idleMinutes: 5
# Minutes a parked tool round is kept (default 30).
parkedMinutes: 30
# Connection settings, mapped exactly like opencode.
baseURL: https://api.anthropic.com
apiKey: sk-ant-...
# authToken, headerTimeout, chunkTimeout, headers, body
| 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 |
Without explicit connection settings the plugin inherits the environment and lets the claude login decide. Config wins over the shell.
Prompt caching is the difference between a usable agent and an expensive one. The adapter is built to keep Claude's prefix stable:
claude process per harness session; tool rounds park it instead of restarting it.<conversation-checkpoint> rebuild is sent instead of pretending the old prefix still applies.Measured on one real turn with claude-haiku (Claude Code 2.1.317), per harness step:
| Step | Cached input | New cache write | Hit |
|---|---|---|---|
| 1 (first call of the prefix) | 0 | 24,401 | 0% |
| 2 | 24,401 | 952 | 96.2% |
| 3 | 25,353 | 1,422 | 94.7% |
| 4 (after a 69k-token thinking block) | 24,401 | 71,814 | 25.4% |
| 5 | 96,215 | 23,337 | 80.5% |
| 6 | 119,552 | 2,260 | 98.1% |
| 7 | 121,812 | 683 | 99.4% |
| 8 | 122,495 | 656 | 99.5% |
| 9 | 123,151 | 1,011 | 99.2% |
| 10 | 124,162 | 198 | 99.8% |
| 11 | 124,360 | 1,312 | 99.0% |
Across the complete 28-step turn on that session, the real totals are 3,348,680 cached input, 161,101 cache writes and 110 uncached input — 95.4% overall, and 97–99.8% from step 6 onwards. The session log recorded 6,539,797 cached input for the same turn because the last step carried the whole-turn aggregate; that is exactly the inflation the second fix removes.
Two details matter:
Two bugs were found and fixed while measuring this, and the fixes are in this repository:
totalTokens. DSH's turn panel computes cache hit as cacheRead / (totalTokens - outputTokens), so the panel showed a broken or very low percentage even when the real hit was 99%. The snapshot now reports totalTokens = input + cacheRead + cacheWrite + output.SDKResultMessage.usage on top of the per-message usage. That field is the whole Claude turn's aggregate, so a multi-step turn reported its cache reads twice. The result usage is now a fallback only when no per-message usage arrived.DeepSeek Harness ──MCP tools──► `claude` (your login) ──► Anthropic
history, UI official Agent SDK
harness. A PreToolUse hook carries the tool_use id (with the MCP _meta id as a fallback), the adapter emits a normal tool-call chunk, the harness executes the tool, and the result is fed back into the parked process.idleMinutes of inactivity, with a separate parkedMinutes window while a tool round waits. Cancellation interrupts the child and keeps what Claude already wrote.initializationResult().models provides the catalog, aliases, context windows and effort levels; it is cached in $DSH_HOME/state/claude-agent/models.json so the picker works before a process starts.forkSession on an edited history: the plugin starts a new Claude transcript and sends a checkpoint. Correct, but it loses the cached prefix.cwd is a provider setting; DSH does not pass the session directory in GenerateOptions.With Claude Code 2.1.317 and a subscription login:
bash tool call produces tool_call → tool_result → a second model call → the final answer;41 → 42) with a high cache-read count;The repository contains no credentials and no machine-specific state. The stores live under $DSH_HOME/state/claude-agent/ at runtime and are not committed.
MIT. Anthropic's Claude Agent SDK is a dependency under its own license.
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: anthropic、llm-provider、deepseek-harness。