dsh-acw-plugin: One-Click Convert DSH's "Add Workspace" to an AI Context Workspace

Introduction

DeepSeek Harness (DSH) adopts an “everything is a plugin” architecture and extends its capabilities through the Cordis plugin system. In agent development scenarios, a common need is to turn a plain directory into a layout compliant with the AI Context Workspace (ACW) specification with a single click, and then guide the user through initialization in a new session. dsh-acw-plugin achieves this by intercepting workspaceRegistry.create, converting the selected directory into an ACW root and registering it, while also prompting the model to execute $an-init on the first turn of a new session.

What It Is

  • Positioning: A DSH plugin that automatically converts the “Add Workspace” action into an ACW layout.
  • Maintainer: kvker.
  • Problems it solves: Eliminates the need to manually create the ACW directory structure and skills; automatically prompts initialization in new sessions; prevents legacy ACWs from being converted a second time; fixes the historical inconsistency of “path foo--acw, title foo”.

Core Features

1. Convert on Add

The plugin intercepts workspaceRegistry.create, converts the selected directory into an ACW layout, and then registers it under the new path. The resulting directory structure is as follows:

~/work/foo/
                ↓   (auto convert + register)
Actual workspace:  ~/work/foo--acw/          ← ACW root, sidebar title also shows foo--acw
                 ├── AGENTS.md
                 ├── background/  conventions/  artifacts/  .agents/
                 ├── .acw-marker             ← content "1", marks as converted
                 └── projects/
                     └── foo/                ← original directory content moved in

The cwd of a new session is the ACW root, so it can work directly under ACW conventions. On the first turn of the conversation, if the workspace has not been initialized yet, the plugin will have the model use ask_user_question to ask once: “Initialize workspace now (recommended) / Skip for now”.

2. Legacy Workspace Compatibility

Old ACWs without a marker are identified by the presence of the four directories background/, conventions/, artifacts/, and .agents/, and will not be converted a second time.

3. First-Turn $an-init Prompt

When the workspace is an ACW and .agents/skills/an-init/SKILL.md still exists, the plugin prompts for initialization on the first turn. Once the skill disappears (i.e., initialization is complete), the prompt stops. It only asks once; if declined, the same session will not be prompted again.

4. Title Sync

The workspace title defaults to matching the directory name; the legacy inconsistency of “path foo--acw, title foo” is automatically corrected on load.

5. Safety Fallbacks

Since conversion involves moving real directories, the plugin follows the principle of “better to skip than to break data”:

  • .acw-marker already exists, or all four signature directories are present → register as-is (already converted).
  • Directory name already has the --acw suffix → register as-is.
  • Directory is inside an existing ACW → register as-is, avoiding nested ACWs.
  • Directory is in a protected zone (home directory, ~/Desktop, ~/Documents, ~/Downloads, ~/.dsh, /Users, /System, etc.) → register as-is.
  • Directory has existing sessions (active sessions or logs in ~/.dsh/sessions) → register as-is, to avoid orphaning session cwds.
  • Target foo--acw already exists → error and block creation, no overwrite.
  • Template clone fails and no local cache → error and block creation, original directory is not moved.
  • Moving the original directory or publishing fails → automatic rollback; if rollback fails, the error message indicates the actual data location.

Conversion is performed using “a temporary scaffold in the same parent directory + rename”: first lay down the template in .<name>--acw.partial-*, rename the original directory into projects/<name>/, and finally rename the whole thing to the final directory name.

Installation & Activation

Requires the DeepSeek Harness desktop app (which ships with the dsh CLI).

# Install from npm (recommended)
dsh plugin --profile desktop add dsh-acw-plugin

# Or use the GitHub source directly (latest commit, no need to wait for a release)
dsh plugin --profile desktop add github:kvker/dsh-acw-plugin

# Also available for the web profile
dsh plugin --profile web add dsh-acw-plugin

This package declares dsh.bundle.patch; the CLI appends it as a bundle layer to the profile and enables it. Configuration hot-reload is enabled by default, so the plugin typically takes effect within a few seconds after installation; if it doesn’t, quit and restart DSH.

To uninstall:

dsh plugin --profile desktop remove dsh-acw-plugin

Typical Usage

  1. Sidebar → Add workspace → select a directory.
  2. The directory is converted to <name>--acw; the original content is moved into projects/<name>/.
  3. Chat normally in the new session; if the ACW is not yet initialized, you will be asked whether to run $an-init on the first turn.

Note: Conversion actually moves the directory, and the original path disappears. IDE windows, shell current directories, and absolute paths in scripts will not be updated.

Configuration

Defaults work out of the box. To override, add an entry with the same id (ai-context-workspace) in ~/.dsh/profiles/desktop/cordis.patch.yml:

- id: ai-context-workspace
  config:
    suffix: '.acw'
    title: 'original'
    initPrompt: 'off'
Field Default Description
enabled true Master switch; when off, create is not touched at all.
suffix --acw Suffix for the ACW root directory.
marker .acw-marker Marker file name; presence indicates the directory is already an ACW.
writeMarker true Whether to write the marker after conversion; when off, only directory signatures are used for detection.
signatureDirs ['background','conventions','artifacts','.agents'] Structural signature directories; if all exist, the directory is treated as an ACW (legacy compatibility).
title directory directory uses the directory name foo--acw as the title; original uses the original name foo.
syncTitles true Correct legacy “path foo--acw, title foo” records on load; only effective when title: 'directory'.
initPrompt first-turn Whether to prompt $an-init on the first turn; off disables it.
initSkill .agents/skills/an-init/SKILL.md Skill entry path used to determine “whether initialized”.
templateUrl https://github.com/kvker/ai-context-workspace.git ACW template repository.
templateBranch main Template branch.
templateCacheDir ~/.dsh/ai-context-workspace/template Local template cache (clone once, then local copy only).
refreshTemplate false Re-clone the template before every conversion.
prewarmTemplate true Prewarm the template cache in the background when the plugin loads.
keepTemplateHistory false Whether to keep the artifacts/_archived/* examples shipped with the template.
skipWhenSessionsExist true Skip conversion if the directory already has historical sessions.
cloneTimeoutMs 120000 Timeout for a single git clone.
protectedPaths [] Additional protected directories (absolute paths); if matched, register as-is.
sessionLogRoot ~/.dsh/sessions Log root directory used to detect historical sessions.

How the First-Turn $an-init Prompt Works

an-init is a “one-time” skill in the ACW template: after initialization is complete, it deletes itself, so “the skill still exists” is equivalent to “not yet initialized”.

The plugin attaches a system prompt paragraph to the agent at agent/created; the paragraph text is returned only once, after the first user message in the current session appears, and returns an empty string thereafter. Therefore:

  • No events are written to a blank session (doesn’t affect DSH’s blank session reuse);
  • Internal calls such as title generation won’t accidentally consume the prompt;
  • When the ask_user_question tool is unavailable, the prompt instructs the model to include a one-line nudge at the start of its reply, also only once.

Diagnostics

The result of each “Add Workspace” action is written to ~/.dsh/ai-context-workspace/last-run.json:

{
  "at": "2026-10-30T02:16:16.659Z",
  "picked": "/Users/you/work/foo",
  "converted": true,
  "reason": "converted",
  "workspace": { "id": "…", "path": "/Users/you/work/foo--acw", "title": "foo--acw" }
}

converted: false will include the skip reason (already-acw, inside-acw, has-sessions, protected, suffixed, etc.).

Development

node --test test/
  • lib/convert.js — directory conversion and ACW detection, independent of Cordis, testable in isolation.
  • lib/init.js — first-turn prompt logic and messaging.
  • lib/index.js — Cordis plugin: wraps workspaceRegistry.create, attaches the system prompt paragraph.

Use Cases & Caveats

  • Suited for developers who use the ACW template and want “Add Workspace” to be a one-step ACW setup.
  • Conversion moves real directories; review the source code and license before installing.
  • The plugin runs with the current dsh process privileges; be mindful of path and permission issues.
  • To adjust default behavior, override settings in ~/.dsh/profiles/desktop/cordis.patch.yml per the configuration table.

In Short

dsh-acw-plugin turns DSH’s “Add Workspace” into a one-click ACW setup flow and guides initialization in new sessions, making it ideal for agent development scenarios that require a standardized ACW layout.

  • Plugin directory: https://www.skillhub.cn/plugins/kvker/dsh-acw-plugin
  • GitHub: https://github.com/kvker/dsh-acw-plugin
羽毛球分组比赛记分
小程序二维码

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

Xiaoye