Preface¶
When building Agent presets in DeepSeek Harness (DSH), permissions and tool combinations often require fine-grained control. Presets enable file read/write, terminal, and web search by default, which can easily introduce unintended side effects during conversations. The Chat Mode plugin introduces a conversation-focused preset that constrains permission and tool usage to the scope of user-explicit requests, thereby reducing the risk of accidental operations.
Plugin Overview¶
- Name: hluica/dsh-chat-mode
- Maintainer: hluica
- Category: admin-security
- Purpose: Adds a pure conversation-oriented Agent preset Chat (preset id:
chat) in DSH. By default it only performs text-based dialogue; file reading requires an explicit user request; the persistent terminal, web search, and Wolfram MCP tools are hidden by default and must be explicitly enabled by the user via the “Tools” menu on the left side of the input box; permissions are restricted to “Read-only” and “Workspace write only,” and “Full access” is not selectable.
Core Features¶
New Chat Preset¶
When creating a new session, select Chat (order: 5) from the preset selector. The default behavior of this preset is as follows:
- Does not proactively read or write workspace files, nor proactively execute commands.
- General Q&A, explanations, analysis, writing, translation, and brainstorming are answered directly without reading files or searching the web “just to verify.”
- Files manually attached to the conversation, or files explicitly referenced in a message, can be read directly.
write,edit, andapply_patchare not provided; if file modification is needed, enable “Persistent Terminal” and switch permission to “Workspace write only,” or switch to a mode that supports file editing.web_fetchcan directly read links provided by the user;web_searchis disabled by default.
Permission Locking¶
Two compact dropdowns appear on the left side of the input box in Chat sessions:
| Control | Options | Effect |
|---|---|---|
| Permission | Read-only / Workspace write only | Submits /permission read-only or /permission workspace-write; full access is not offered. |
| Tools | Persistent terminal / Web search / Custom tool packs (including Wolfram; multi-select, based on availability) | Checking any item submits /chat-tools shell on, search on, or <pack-id> on; clicking again unchecks. Unchecking all turns everything off. |
The Tools dropdown is a multi-select menu: the menu stays open, allowing consecutive selections; each item has an icon and a check mark, and the trigger displays the current combination (Off / Persistent terminal / Web search / Custom tool packs, with multiple enabled items joined by +). Persistent terminal and Web search are always displayed; custom tool packs are only rendered when the Host status interface reports that the pack has at least one registered tool. Hidden packs do not appear in the menu and are not included in the model’s tool list.
Default state:
- Permission: A new Chat session is pinned to Read-only at creation time (before the first request; even the blank new-session UI displays the correct value); a resumed Chat session retains its saved
read-only/workspace-writevalue, and if a broader permission is detected it is corrected toread-only. - Tools: All advanced packs are unchecked by default, meaning
bash/pwsh,web_search,mcp__WolframLanguage__*, and tools from any newly added packs do not appear in the model’s tool list; unavailable packs are not displayed. read,read_image,glob,grep,web_fetch, andask_user_questionare always available, but the system prompt constrains them to not be used proactively by default: they are only invoked on demand when the user explicitly requests or when the task genuinely depends on that tool’s capability.
The appearance of both dropdowns uses host theme tokens: with permission/terminal/web/custom tool icons, capsule-style triggers, hover / focus-visible / active / disabled states, and a rotating chevron when expanded; light/dark themes are adapted automatically. Both the Tools menu and the Permission menu reuse the shipped Menu’s portal, keyboard, and focus behaviors.
Permission locking details:
- The Host half pins
read-onlyin the next microtask aftersession/createdfor new sessions whereheader.agentPreset === 'chat'and not yet seeded (during synchronous dispatch ofsession/created, the Session is read-only and cannot be directly appended); this happens before the Agent/first request, so both the blank new-session UI and the first request see the correct permission. When a blank session is switched to Chat,agent-preset/selectedalso triggers the same pin. - The preset plugin reads
ctx.permissionPresets.current(session)atagent/created(prepend: true): source === 'startup'(new session) → pinned toread-only;resume/clear/compact→ onlyread-only/workspace-writeare retained;- If the global default is set to full access, a new Chat session is still corrected to
read-only. - A same-named
/permissioncommand is registered within the preset scope, shadowing the global command, and accepts only the two allowed values; this command is released/re-registered with the preset lifecycle and does not accumulate Agent-scope registrations when switching chat→other→chat. - The client only displays the permission dropdown in Chat sessions; the shipped permission seat is hidden via
body[data-dsh-chat-mode="1"] [data-slot="conversation.input.permission"].
On-Demand Tool Activation¶
What Chat mode mounts is the persistent terminal (@deepseek-ai/dsh-tool-bash-persistent / @deepseek-ai/dsh-tool-pwsh-persistent), whose schema only has command, with no sandbox_permissions / justification; write / edit / apply_patch are also not mounted. Therefore Chat does not support requesting one-time broader permission for an individual command.
When workspace write access is needed, enable “Persistent Terminal” in the “Tools” menu and switch to “Workspace write only” in the “Permission” menu; write operations under read-only will be rejected by the sandbox. danger-full-access is rejected by the preset-scoped /permission command; /permission danger-full-access will return an error and not change the session permission.
In Chat sessions, the client’s shipped permission controls are hidden, replaced by this plugin’s two-option dropdown. The slash command /permission is still available, but its picker still displays the full process directory; selecting full access will be rejected by the Host. It is recommended to use the permission dropdown on the left side of the input box.
Dynamic Tool Packs¶
Tool packs beyond built-in tools are dynamic tool packs: Wolfram is the default pack, and its menu item only appears when mcp__WolframLanguage__* tools exist; other tool packs are added via Settings → Chat Mode Tool Configuration. Tool pack configuration is stored in ~/.dsh/dsh-chat-mode/tools.json, and the menu, model tool list, and system prompt are automatically updated alongside configuration file changes and MCP registration/removal, without needing to restart the session.
Settings Page: Chat Mode Tool Configuration¶
A new Chat Mode Tool Configuration page is added in Settings, fixed between “Agent Preset Text” and “Wolfram MCP Settings” (settings.section order 21.5). It manages tool packs beyond built-in tools:
- Display: Each pack shows its menu name, actual tool names (
prefix*or exact name list), availability, hidden status, and thechat_tool_guidanceprompt. - Add: Multi-select from the Host’s currently registered non-built-in tools, fill in the menu name and optional prompt; saving immediately writes to the configuration file and takes effect. New packs are off by default and need to be enabled in the “Tools” menu.
- Hide/Show: Hiding only removes the menu item from the “Tools” menu and suspends its tools and prompt; the configuration is retained and can be shown again at any time. The page does not provide a delete option.
- Edit Prompt: Each menu item has an independent guidance editor with “Submit” and “Discard changes”; after submitting, the next system prompt uses the new text; if left empty, nothing is injected.
The configuration file is $DSH_HOME/dsh-chat-mode/tools.json (default ~/.dsh/dsh-chat-mode/tools.json) and can also be edited directly; if the file is invalid, the page displays an error and the plugin falls back to the default Wolfram pack. Menu names and tool lists cannot be edited within the page after creation; to make changes, edit the configuration file directly.
Among the configurable candidates, the five tools that the Host always injects are permanently excluded: list_mcp_resource_templates, list_mcp_resources, load_workspace_dependencies, read_mcp_resource, working_directory. They are fixed-injected by the Host’s composition and the plugin cannot gate them; they are not shown in the candidate list, and configuration validation will reject manual additions.
How It Works¶
Preset composition
cordis.patch.yml inserts an empty Host line and a @deepseek-ai/dsh-agent-preset declaration:
preset-chat (id: chat, name: Chat, order: 5)
persona (complete: true, includeRuntimeContext: true)
time-context
tool-fs (read/readImage on, write/edit/applyPatch off)
tool-fs-search
tool-ask-user
tool-web (search + fetch both registered, web_search hidden by default via restrict)
compaction (basic + command-compact + tool-result-pruner)
persistent-shell (terminal + bash/pwsh persistent, hidden by default via restrict)
chat-mode preset plugin
Wolfram tools are not registered within the preset: they are registered as global MCP tools by @local/dsh-wolfram-mcp via mcpManager. The preset dynamically discovers them by the mcp__WolframLanguage__ prefix, gates the entire pack, and injects guidance into the system prompt on demand. Other custom packs follow the same pattern: they are registered as global tools by other plugins/MCP, and this plugin only reads configuration, discovers tools, and enforces restrict; it does not handle tool registration itself.
persona.complete: true allows Chat to use its own system prompt, but includeRuntimeContext: true preserves runtime context such as file policy, cwd, and time; the {{chat_tool_guidance}} within the persona prefix is evaluated per-step by the preset plugin’s prompt variable, without relying on additional sections.
Installation & Activation¶
Install via the DSH plugin repository:
dsh plugin add hluica/dsh-chat-mode
After installation, simply select the Chat preset (order: 5) when creating a new session.
Typical Usage¶
- Create a new session and select the Chat preset.
- Choose “Read-only” or “Workspace write only” from the “Permission” dropdown on the left side of the input box.
- If you need to execute commands or search, check “Persistent Terminal” or “Web Search” in the “Tools” dropdown, or check a configured custom tool pack.
- If you need to use Wolfram or other MCP tools, first add the corresponding pack in the “Chat Mode Tool Configuration” settings page, then enable it in the Tools dropdown.
Use Cases & Notes¶
Chat Mode is suitable for scenarios requiring conversation-first interaction with fine-grained control over permissions and tool usage, such as code review, documentation explanation, and data analysis. The plugin runs with the current DSH process permissions; review the source code and license before installing.
Closing¶
The Chat Mode plugin converges the conversational experience and security boundaries to the scope of explicit user requests through preset-level permission and tool gating, making it well-suited for Agent builds that require fine-grained control. For more details, see: https://www.skillhub.cn/plugins/hluica/dsh-chat-mode, https://github.com/hluica/dsh-chat-mode