dsh-sage-mode: Read-only "Sage Mode" in DSH Sessions

Introduction

The coding agents in DeepSeek Harness (DSH) are designed by default to “modify code, run commands, and write files hands-on.” When you only want to read an implementation, compare approaches, learn a concept, brainstorm, or analyze a stack trace—but don’t want to accidentally trigger writes or shell execution—you need a first-class toggle: preserve repository reading and web search, while removing every environment-modifying capability from the model’s visible tool set. dsh-sage-mode provides Sage mode within the session. Enter with /sage and exit with /sage off, collapsing the current session into a read-only advisory state.

What Is This

dsh-sage-mode is published by maintainer zero360-TYN and is categorized as a web tool in the SkillHub plugin directory. The plugin version is 1.0.0, licensed under MIT (see the package.json in the repository).

In one sentence: a read-only advisory session mode for DeepSeek Harness—while the mode is enabled, the session retains only read/search/web tools; an advisory-oriented system prompt is injected on the model side for answering, suggesting, evaluating, explaining, brainstorming, and diagnosing—not for modifying the workspace. The name comes from Sage: give advice, don’t do the work.

Core Mechanism

Commands

Input Effect
/sage Enter Sage mode: read-only tools only, with advisory prompt injected
/sage <question> Enter the mode and send the question as the next message (may include images/files)
/sage off Exit; the full tool set is restored immediately

Typical use cases include: understanding unfamiliar implementations, learning a codebase, comparing designs, brainstorming, and pasting stack traces. When you’re ready to actually change code, run /sage off first.

Tool Whitelist and Interception

After entering the mode, what changes is the tool catalog available to the model, not the sandbox permissions themselves: hidden tools do not appear in the requested tool catalog; if a call still slips through to dispatch, tools.guard() will reject it and prompt you to run /sage off first.

The default retained tools include:

read, read_image, glob, grep, web_search, web_fetch, ask_user_question, skill, cordis_inspect_list, cordis_inspect_query, load_workspace_dependencies.

Others such as write, edit, ops_replace, pwsh/bash and background tasks, subagent/send_message, plugin_manager, todo_write, present, and goal/team-task tools will be hidden; tool names that do not exist in the current composition will be ignored, and the same list can be used across different agent presets.

Optional Dependency dsh-ops

The faster read-only tools ops_glob, ops_grep, and ops_inspect_local_file come from the independent plugin dsh-ops. Sage mode declares it as an optional dependency via optionalTools in cordis.patch.yml:

  • If dsh-ops is installed → the above tools are included in the allow list;
  • If not installed → the names are ignored and the rest of the functionality works as normal; the absence of an optional provider does not cause an error.

If you want to include read-only tools from other bundles, you can extend the optionalTools mapping in the configuration without modifying the plugin source code.

State and Implementation Notes

  • The mode state is written in the session log, reusing the existing command/run + command/done from the commands service, without adding new custom event types, facilitating automatic restoration on resume/fork.
  • Applied per agent: agent.ctx.tools.restrict({ allow }) hides mutable tools, and agent.ctx.tools.guard() intercepts any stray calls; the disposer is attached to agent.ctx and the plugin effect, released when the agent is destroyed or the plugin is unloaded.
  • No @deepseek-ai/* package dependencies are used; the advisory prompt section is registered at the agent scope and returns an empty string when the mode is off, producing no extra tokens.

Installation and Activation

Open the Plugin Manager in Harness and enter the following repository URL as the install spec:

https://github.com/zero360-TYN/dsh-sage-mode

The manager will treat the GitHub URL as a git install spec, clone the package, add the sage-mode entry, and activate it. Subsequent updates can reinstall the same URL; if you need to regenerate the JavaScript modules, restart the application before loading.

For local development, you can also point the Plugin Manager to the absolute path of the repository and install via plugin_manager(action: "install_bundle", target: "<absolute path to this repo>") as a link, so that directly editing the repository files will affect the live plugin.

Runtime environment: package.json requires Node ^22.19 || >=24.

Configuration

Defaults are in the plugin’s cordis.patch.yml; user overrides are written in the profile user layer: $DSH_HOME/profiles/<name>/cordis.patch.yml. The patch replaces the entire config line, so when overriding you must write all keys you want to keep:

- id: sage-mode
  name: dsh-sage-mode
  config:
    command: sage          # Command name, defaults to sage
    sectionOrder: 3255     # Prompt section order
    allowedTools: [read, grep, web_search]   # Only retain the listed tools
    optionalTools:
      dsh-ops: [ops_glob, ops_grep, ops_inspect_local_file]
    section: |             # Full advisory prompt
      ...

Unknown keys will fail at load time, preventing typos from silently failing; missing keys fall back to defaults.

Typical Usage

  1. Enter /sage in an existing DSH session and confirm that the model can only use read-only and web-access tools.
  2. Or ask a one-off question: /sage How is the call chain of this module connected? (files/images may be attached).
  3. When you need the agent to modify files or run terminal commands, enter /sage off to restore the full tool set.

If you are in Plan mode, exit_plan_mode will also be hidden; you can leave by running /plan off or /sage off first.

Use Cases and Limitations

Suitable for: developers who only want to consult, review, learn, or look up information, while still wanting the agent to be able to read the repository, grep, and perform web_search/web_fetch.

Known limitations (from the upstream README):

  • Only affects the current session; other tabs/sessions are unaffected.
  • In PTC mode, the run_code transport layer is retained (otherwise the tool surface would be unavailable), but the generated SDK only exposes the allowed read-only tools.
  • Does not change sandbox or approval policies; the plugin governs which tools the model possesses, not filesystem permissions.

Security note: The plugin runs with the permissions of the current DSH process. Before installing, review the GitHub repository source code and MIT license yourself to confirm it meets your environment policy. The DSH community directory (SkillHub) is an independent site and has no official affiliation with DeepSeek / High-Flyer.

Repository self-test can be run with:

node test/self-test.mjs

Links

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

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

Xiaoye