DSH's Claude Code Workspace Plugin

Introduction

DeepSeek Harness (DSH) embraces the “everything is a plugin” philosophy, extending its capabilities through plugins. When developing agents, we often need to manage Claude Code sessions on local or remote hosts while preserving their tool permission options, approval decisions, and audit logs. Existing approaches are either scattered across multiple terminals or unable to reuse session processes, making it difficult to integrate with DSH’s workspace system.

This article introduces wzz618/dsh-claude-workspace, a Claude Code workspace plugin for DSH that manages Claude Code sessions on local or SSH hosts through ACP (Agent Client Protocol) within DSH, while preserving their permission decisions and audit information.

What Is This

wzz618/dsh-claude-workspace is a DSH plugin maintained by wzz618. It implements four functional modules: the runtime core (P1), the right-panel session console (P2a), DSH-native session inlining (P2b), and the remote settings bridge (P3). The P4–P5 details (@ aligned with DSH file index, npm publishing) have not been implemented yet.

The plugin connects Claude Code sessions to DSH’s workspace registry via ACP, supporting both local and SSH hosts. Each workspace maintains a resident claude-agent-acp process with multi-session reuse. After a DSH restart, sessions and permission presets are restored, and all permission decisions are written to the audit log.

Two Claude Entry Points

The plugin provides two Claude entry points. Choose based on your use case:

Entry Point Path Best For
Right-panel Claude Code console The plugin’s own ACP client (CcwService), local or SSH Remote hosts, permission Dock, rule relaxation, auditing
Native session (New Claude Session) @zaimokuza/dsh-acp-adapter fork, DSH’s own session UI Local or SSH, native message stream/tool cards/Trajectory, parallel with regular DSH sessions

The native entry point is located in the Web UI’s right-panel Claude Code tab. After selecting a workspace, click “New Claude Session”: the plugin creates a DSH session using the acp-claude-code provider, attaches it to that workspace, writes the configured permission preset (default: Full access), and then opens it directly via uiWorkspace.openSession(). DSH’s default model remains opencode-go; only this entry point (or manually selecting Claude Code · ACP) routes to Claude.

The native entry for SSH workspaces launches the remote claude-agent-acp via local ssh: the plugin writes the remote directory into native.cwdMapFile, and the adapter cds into that directory when the session starts and uses it as the cwd for ACP session/new. The DSH-side session still uses a local placeholder directory, so workspace ownership, sidebar, and restart recovery all work as with regular sessions.

Workspace & Session Management

Workspaces

Create/register directories on local or SSH hosts. Directories are derived by per-workspace / per-session / per-conversation strategy; they are registered in DSH’s workspace registry (ctx.workspaceController).

Sessions

One DSH session binds to one Claude Code (ACP) session. Each workspace has a resident claude-agent-acp process with multi-session reuse. After a DSH restart, sessions are restored via session/load, and model/thinking intensity is re-applied (session/load resets the model to sonnet).

Permissions & Auditing

Permission Options

Options provided by Claude are passed through as-is: allow_once / allow-with-updates / reject…. The plugin additionally provides “Widen”: current command / command prefix / current tool. Default approvals never time out.

Auditing

Audit logs are written to <dataDir>/audit/YYYY-MM-DD.jsonl, recording only metadata: host, workspace, session, tool, argument summary, decision, and elapsed time. On service startup, expired files are cleaned up based on audit.retainDays.

Remote Support

stdio is carried directly via ssh -T -o BatchMode=yes -- <alias> claude-agent-acp — no ports exposed, no bridges written, and DSH does not need to be installed on the target machine.

Configuration & Data Layout

Configuration Example

The plugin is enabled via a YAML configuration file. Core fields include:

- insert:
    - id: claude-workspace
      name: dsh-claude-workspace
      config:
        hosts:
          local: { kind: local }
          devbox:
            kind: ssh
            alias: devbox
            executable: claude-agent-acp
            args: []
            connectTimeoutMs: 8000
            probeCwd: /home/ubuntu/project
        defaultHost: local
        workspaces:
          baseDir: '${DSH_HOME}/claude-code/workspaces'
          strategy: per-workspace
          prefix: 'cc-'
        acp:
          executable: claude-agent-acp
          handshakeTimeoutMs: 20000
          requestTimeoutMs: 30000
          promptTimeoutMs: 0
          idleRecycleMs: 600000
          maxLineBytes: 8388608
          minimumVersion: 0.99.0
          maximumVersionExclusive: 1.0.0
        approvals:
          timeoutMs: 0
          showSessionBadge: true
        permissions:
          forwardClaudeOptions: true
          widen:
            enabled: true
            defaultScope: command
          persist:
            target: project
            confirmUserScope: true
        audit:
          retainDays: 30
        logs:
          dir: '${DSH_HOME}/claude-code/logs'
          maxBytes: 10485760
          files: 3
        ssh:
          connectTimeoutMs: 8000
          serverAliveIntervalSec: 15
          serverAliveCountMax: 3
          strictHostKeyChecking: true
        native:
          provider: acp-claude-code
          model: default
          permissionPreset: danger-full-access
          attachToWorkspace: true
          agentsFile: '${DSH_HOME}/dsh-acp/agents.json'
          seedAgentsFile: true
          remoteSpawnCwd: /tmp
          cwdMapFile: '${DSH_HOME}/dsh-acp/native-cwd.json'

Data Layout

Data is organized with the following structure:

~/.dsh/claude-code/            # or config.dataDir
├── workspaces.json            # workspace records (atomic write)
├── sessions.json              # dshSessionId ↔ acpSessionId bindings
├── written-rules.json         # allow rules written only by this plugin
├── audit/YYYY-MM-DD.jsonl
└── logs/<workspaceId>.log     # ACP stderr, rolled by maxBytes (.1, .2)

<baseDir>/<prefix><readable-id>-<16-char-hash>/

The directory name hash is computed from “host identity + original identifier + base directory”. a:b and a-b will not collide, and total length ≤ 100. All JSON uses “temp file + fsync + rename”. Settings files additionally retain a .bak and are verified by reading back after writing.

UI & Features

A new Claude Code tab is added to DSH’s right panel, providing the following capabilities:

  • Session stream, tool cards, diffs, plan cards
  • Permission Dock, model/thinking intensity/mode selection
  • Stop button, disconnect & reconnect, history replay separator
  • Pending approval count
  • Composer supports / slash commands, @ file selection, and image attachments (auto-scaled and re-encoded above 2 MB)
  • Sub-agent tool cards are nested within the Agent/Task card that spawned them
  • Assistant text rendered as Markdown (headings, lists, tables, code blocks, inline formatting, and safe links)
  • Settings page retains host/workspace/rule management

Claude login/credentials are not handled: the claude on the target machine must already be logged in. The plugin does not read, cache, or forward any credentials.

Installation & Enablement

Prerequisites

Install and connect Claude Code on the target machine first:

# Target machine (local or ssh host)
claude            # complete login
command -v claude-agent-acp

Install the Plugin

Install the plugin (path depends on your actual repository location):

dsh plugin --profile web add /root/autodl-tmp/code/wangzhengzhuo512/dsh-claude-workspace

cordis.patch.yml only inserts the single line for this plugin and does not disable agent-loop / ui-model-selection; regular DSH sessions continue to use their own loop.

Native Session Entry (Optional)

The native entry depends on the forked ACP adapter; the repository only commits a reproducible migration patch, not the upstream source code:

node scripts/prepare-acp-adapter.mjs /opt/dsh-acp-adapter
dsh plugin --profile web add /opt/dsh-acp-adapter

For local hosts, there is no need to hand-write agents.json: on plugin load, hosts.<local>’s executable/args/env are written into native.agentsFile (default: $DSH_HOME/dsh-acp/agents.json), and existing agents with the same name are not overwritten. Therefore, you only need to specify the ACP executable in this plugin’s configuration.

SSH hosts also require probeCwd (a remote absolute directory, typically the project root with .claude configuration) for model directory probing; each SSH host automatically gets an acp-claude-code-<host> provider.

After installation, restart DSH. When a local workspace is selected in the right-panel console, “New Claude Session” will appear. If the adapter is not installed, the button will display the creation failure reason in the console.

Sharing Sessions with Claude CLI

Claude Code session logs are located at ~/.claude/projects/<encoded-project-path>/<session-id>.jsonl on the target machine. DSH and CLI simultaneously resuming the same session id is an unsupported usage: two processes each maintain their own in-memory context, and concurrent writes to the same log may interleave or lose messages.

Cooperation modes provided by the console:

  • On entry, check for external changes: when opening a session, compare the file’s mtime/size against the last write baseline; if changes are detected, re-run session/load with the latest history and display “Latest history loaded”
  • Refresh: the “Refresh” button in the top-right forces a replay of the current agent-side history
  • Closing the tab releases: closing the Claude Code tab in the right panel stops that workspace’s ACP process, yielding the session to the CLI; it reloads on next open
  • If a turn is currently running, reload/release will not proceed — stop it first before operating

Single-writer is still recommended: at any given time, only let DSH or the CLI hold the session.

Use Cases & Notes

Suitable for the following scenarios:

  • Managing Claude Code sessions on local or remote SSH hosts
  • Integrating Claude Code sessions with DSH’s workspace system
  • Auditing Claude’s permission decisions and tool invocations
  • Viewing session streams, tool cards, and plans in a unified DSH interface
  • Using Claude Code on remote hosts while maintaining auditing and permission control

Note: The plugin runs with the current dsh process’s permissions. Review the source code and license before installation. The plugin does not handle Claude login/credentials; claude on the target machine must already be logged in.

Summary

wzz618/dsh-claude-workspace provides Claude Code workspace management capabilities for DSH, unifying the management of Claude Code sessions on local or SSH hosts through ACP within DSH, while preserving their permission decisions and audit information. It supports two entry points: the right-panel console and native session inlining, making it well-suited for scenarios requiring auditing, remote access, and a unified interface.

Plugin directory: https://www.skillhub.cn/plugins/wzz618/dsh-claude-workspace
GitHub: https://github.com/wzz618/dsh-claude-workspace

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

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

Xiaoye