DeepSeek Harness Task-Domain-Focused Plugin

Introduction

The plugin-based architecture of DeepSeek Harness (DSH) makes behavior extension flexible, but models tend to spontaneously cross task boundaries within a single conversation, invoking tools irrelevant to the current objective. This leads to context contamination, wasted computational resources, and even unintended side actions. Such behavior is particularly pronounced in long-running sessions and requires a runtime constraint mechanism to converge the model’s attention.

The Task Domain Focus plugin (dsh-focus-mode) described below is designed for DSH. It implements two-layer control—semantic guidance and tool invocation adjudication—to lock each session into a single task domain. This restricts the model from automatically crossing domains or autonomously triggering subsidiary capabilities, thereby improving focus on the primary task and output quality.

Plugin Overview

  • Name: dsh-focus-mode
  • Maintainer: mxxz11
  • Category: admin-security
  • Repository: https://github.com/mxxz11/dsh-focus-mode
  • Purpose: Binds DSH sessions to a task domain, converges reasoning resources and contextual attention, and suppresses spontaneous cross-domain behavior and unauthorized subsidiary tool invocations

Core Features

Task Domain Locking & Classification

The plugin ships with seven built-in task domains, each with a clearly defined primary domain and subsidiary whitelist:

  • General Default Mode: No task domain restriction, no limitations
  • Image Focus Mode: Image recognition, editing, generation; subsidiary—brief text descriptions
  • PPT Focus Mode: Outlines, slide copy, layout; subsidiary—slide notes
  • Video Focus Mode: Scripts, storyboard planning; subsidiary—accompanying dialogue
  • Code Focus Mode: Coding, debugging, troubleshooting, code interpretation; subsidiary—drawing flowcharts, generating files
  • Document Review Focus Mode: Close reading, annotation, summarization, comparison; subsidiary—outlining
  • Data Analysis Focus Mode: Calculation, validation, data processing; subsidiary—plotting, exporting/running scripts

The targeted guidance text for each mode is defined in the guidance field within lib/modes.js and can be reviewed or modified as needed. After the guidance words, action adjudication rules are appended: primary domain actions execute directly, subsidiary actions require explicit user request, and cross-domain actions are blocked outright.

Three-Tier Action Adjudication

The plugin performs a fallback adjudication on tool invocations on the Host side via tools/pre-execute, categorizing them into three tiers:

  1. Primary domain task: The invocation belongs to the current mode’s primary domain → execute directly, prioritizing compute for deep processing
  2. Subsidiary companion action: Matches the mode’s subsidiary capabilities → allowed only if the user explicitly states the need in their prompt; AI-triggered subsidiary actions mid-conversation are blocked directly without a confirmation dialog
  3. Fully cross-domain task: Belongs to another domain → blocked directly, no temporary override provided

Subsidiary confirmation toggle logic:

  • Off (default): User explicitly requests a subsidiary action → execute directly
  • On: User explicitly requests a subsidiary action → show a confirmation dialog with [Execute] / [Skip] options
  • User has not proactively requested a subsidiary action: Blocked regardless of toggle state

After a block, the model is guided back to the primary task. Circumventing via task splitting or constraint evasion is prohibited.

Focus Mode & Rigor Levels

In Focus Mode, the sandbox is disabled and only manual columnar arithmetic is supported; heavy computations prompt the user first, and unauthorized code execution is prohibited. Focus Mode includes three built-in rigor levels (session-persisted) that control only the depth of verification and output length. Sandbox disabling and subsidiary control rules are unaffected by the level:

Level Behavior Use Case
Quick Check Basic compliance verification only; no deep multi-round verification, no multi-method cross-validation; retains execution markers and error hints Quick verification, cross-checking; lowest token overhead
Rigorous Compact (default) Automatically detects task complexity: simple queries get conclusion + formula only; complex calculations trigger the full verification pipeline Daily default, balancing credibility, length, and cost
Maximum Rigor Enforces full verification: multi-method anomaly detection, cumulative value exclusion, contamination regression comparison, confidence intervals, complete reasoning chain High-risk tasks, formal reports, external delivery; highest reasoning overhead and length

Regardless of which level is selected, Focus Mode’s sandbox disabling and subsidiary control rules remain unchanged.

Four Independent Toggles

The plugin provides four independent toggles that do not override each other:

  • Lock Mode toggle: When enabled, sustained targeted constraint + cross-domain blocking remains active and does not auto-revert to general mode during casual chat; when disabled, only guidance text is injected (no hard blocking), and after N consecutive off-topic deviations it auto-reverts to general mode with an undo prompt
  • Subsidiary Action Confirmation toggle: Off by default; when enabled, a confirmation dialog appears when the user explicitly requests a subsidiary action
  • Focus Mode toggle: Enables sandbox disabling and subsidiary control rules
  • Execution Marker Display toggle: Controls whether execution markers and error hints are shown in the output

The status bar provides real-time indicators. All settings are session-persisted.

Fallback Adjudication Scope

tools/pre-execute only identifies invocations with clearly distinguishable characteristics:

  • Tool name patterns (generation-type): images / videos, e.g., generate_image, stable_diffusion
  • Output file extensions: PPT / documents / data / video / images, e.g., .pptx, .xlsx, .pdf
  • Command signatures: data analysis, e.g., matplotlib / plotly / plt. in scripts

Generic tools (source file read/write, test commands, file search) are excluded from domain adjudication to avoid blocking normal operations.

Relationship with AutoConsent

dsh-autoconsent has higher approval priority than this plugin; the two are complementary, not substitutable:

  • This plugin: Operates after AutoConsent, performs narrowing only; invocations blocked by focus mode never reach the approval pipeline; does not listen to approval requests or make pass/fail decisions on behalf of the user
  • AutoConsent: Handles approval dialogs and auto-pass logic, with higher priority

Focus constraints do not bypass or override DSH’s native security approval workflow.

Panel Interaction

The frontend provides a persistent status capsule (displayed at the bottom-left of the input box, showing the current mode; locked state highlighted with a glowing ring). Clicking the capsule expands the panel (above the input box):

  • Tab layout: 7 mode tabs arranged horizontally; in narrow windows, excess tabs collapse into a [More Modes] dropdown, with the selected mode always visible and no line-wrapping overflow
  • Sub-text below tabs: Brief description of the current mode’s primary domain + subsidiary whitelist
  • Lock Mode toggle
  • Subsidiary Action Confirmation toggle (default off)
  • Reset to General Mode button
  • Block statistics: Blocked N times · Subsidiary passed M times

All tabs and dropdown items support hover tooltips.

Default Configuration

The plugin defines its default configuration in cordis.patch.yml:

enabled: true          # Master toggle: when off, no guidance injection and no blocking
enforce: true          # Block toggle: when off, only soft guidance, no hard blocking
confirmSubsidiary: false  # Initial value for subsidiary confirmation dialog; can be changed per session
defaultMode: general   # Default mode for new sessions
lockByDefault: true    # Lock Mode enabled by default
offTopicRevertAfter: 3   # Consecutive off-topic count before auto-revert (when unlocked); 0 = disable
idleRevertMinutes: 0     # Idle timeout for auto-revert; 0 = disable
sectionOrder: 520       # Guidance section sort position
pollMs: 15000           # Panel polling interval (ms)
sweepSeconds: 30        # Host sweep interval
persist: true           # Session state persistence
storageFile: ~/.dsh/storages/focus-mode/state.json
retentionDays: 30       # Local state retention (days)
defaultPanelOpen: false # Panel collapsed by default

HTTP API

The plugin provides the following HTTP endpoints for secondary development and diagnostics:

Method Path Purpose
GET /dsh-focus-mode/state?session= Session state, mode info, diagnostic fields
POST /dsh-focus-mode/mode Switch task domain
POST /dsh-focus-mode/lock Lock / unlock
POST /dsh-focus-mode/confirm Toggle subsidiary confirmation dialog
POST /dsh-focus-mode/reset Reset to General Mode
POST /dsh-focus-mode/dismiss Dismiss auto-revert notification

Diagnostic response example:

{
  "section": { "name": "focus-mode:policy", "order": 520, "registered": true },
  "lastRender": { "result": "injected", "sessionId": "…", "mode": "data", "chars": 1100 },
  "lastGate": { "verdict": "cross-domain", "tool": "write", "domain": "ppt" },
  "stateEntries": 3
}

Installation & Activation

The plugin offers three installation methods:

Open the DSH plugin panel, add the community index source, search for dsh-focus-mode, and install directly.

Method 2: Command-Line Install

dsh plugin --profile web add github:mxxz11/dsh-focus-mode
  1. Add the dependency to the profile’s package.json:
{
  "dependencies": {
    "dsh-focus-mode": "link:D:/deep seek workplace/plugins/dsh-focus-mode"
  },
  "dsh": {
    "profile": {
      "bundles": ["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-web-app", "dsh-focus-mode"]
    }
  }
}
  1. Run pnpm install in the profile directory, then restart DSH Host
  • Host code changes: Restart DSH
  • Frontend panel changes: Simply refresh the page

File Structure

The plugin file structure is as follows:

dsh-focus-mode/
├── lib/
│   ├── index.js      Host side: guidance injection, action adjudication, state persistence, HTTP API
│   └── modes.js      Mode configuration: guidance text, primary domain, subsidiary whitelist, tool signatures
├── client.js         Frontend panel: capsule, tab panel, interaction reporting
├── cordis.patch.yml  Plugin bundle configuration
├── icon.svg
├── package.json
├── README.md
└── test/
    ├── sim.mjs         Host simulation tests
    └── client-sim.mjs  Frontend rendering tests

Self-Test Scripts

The following commands can be used for development verification:

node --check lib/index.js && node --check lib/modes.js && node --check client.js
node test/sim.mjs          # Host side: guidance text, action adjudication, permissions, persistence, API
node test/client-sim.mjs   # Frontend panel: rendering, narrow-window adaptivity, interaction reporting

Applicable Scenarios & Notes

  • Suitable for developers and users who need extended single-domain focus and want to reduce the model’s spontaneous cross-domain behavior and subsidiary invocations
  • The plugin runs with the current DSH process privileges; review the source code and license before installation
  • The plugin implements semantic-level intent constraints + artifact-level fallback adjudication. It is not a system-level permission sandbox and cannot guarantee 100% precision; for mixed complex requests, consider switching back to General Mode

Security Notes

  • File read/write: The plugin uses fs.writeFile solely for persisting its own task domain configuration and session state. The storage directory is strictly based on the DSH_HOME environment variable. It does not read, write, or modify any unrelated files outside that directory
  • Network requests: Fetch requests initiated by the plugin are used exclusively for internal DSH session state API communication; no requests are made to unknown third-party addresses
  • Environment variable access: Only reads platform-provided official environment variables such as DSH_HOME and NODE_ENV; does not collect or exfiltrate user privacy data
  • This plugin contains no hardcoded secrets and no logic for sending data to third-party services

Known Limitations

  • Cannot guarantee 100% precision in detecting covert cross-domain behavior; for mixed complex requests, switching to General Mode is recommended
  • Switching modes mid-conversation does not rewrite chat history; constraints take effect from the next model invocation
  • Sub-agents are independent sessions and do not automatically inherit the parent session’s focus mode
  • Subsidiary actions are adjudicated per invocation; multiple subsidiary artifacts are verified one by one. When the confirmation toggle is on, each triggers a separate dialog

Uninstallation

After uninstallation, the plugin is immediately removed from the Loader. Restarting DSH will not auto-load it, and no exceptions will be thrown. The state file is not automatically deleted:

<DSH_HOME>/storages/dsh-focus-mode/state.json

This file only stores each session’s domain, four toggles, rigor level, and statistics counters. It can be manually deleted; after deletion, the next activation starts with a fresh state.

Ecosystem Context

DSH’s philosophy is “everything is a plugin.” The community directory is an independent site with no official affiliation to DeepSeek / High-Flyer.

Summary

The Task Domain Focus plugin provides runtime constraints for DSH sessions through task domain locking, subsidiary action control, Focus Mode, and rigor levels. It helps converge model attention, suppress spontaneous cross-domain behavior and unauthorized subsidiary invocations, and improve focus on the primary task and output quality. If you need to maintain domain focus during extended conversations, this plugin serves as a practical addition for admin-security scenarios.

  • Directory page: https://www.skillhub.cn/plugins/mxxz11/dsh-focus-mode
  • GitHub: https://github.com/mxxz11/dsh-focus-mode
羽毛球分组比赛记分
小程序二维码

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

Xiaoye