DeepSeek Harness plugin

dsh-cybernetics

DeepSeek Harness (dsh) Cordis plugin: observer/feedforward/feedback control loop, stability valve, controllability check

Jump to install

Source facts

Repository
boomzikazita/dsh-cybernetics
Latest update
Aug 20, 2026
Category
Tools & Capabilities
GitHub stars
0
Format
plugin
Catalog evidence
Upstream dsh.bundle evidence
Evidence path
package.json#dsh.bundle
Checked against
0.1.0-rc.8
Upstream check date
2026-08-20

This evidence comes from the upstream catalog. This site has not installed, run, or security-reviewed the plugin.

Install

Start with a prompt that asks an agent to review the GitHub repository and source. Switch to the command if you want to install it yourself.

Copy this prompt into DSH, Codex, or another agent and ask it to review the GitHub repository and source first.

Do not install or run any commands yet. Read this plugin's GitHub repository, README, and relevant source code. Then answer the questions below clearly and directly so I can decide whether it fits my needs:

1. What is this plugin, and what problem does it solve?
2. Who is it for, and what are its typical use cases?
3. How is it used after installation? Include one minimal example.
4. What known limitations or privacy, security, compatibility, or maintenance risks does it have?
5. Give a clear recommendation: recommend, conditionally recommend, or do not recommend, with reasons.

Distinguish statements documented by the repository, inferences from source code, and unknowns. If evidence is insufficient, say so explicitly. Do not guess or simply repeat the README.

GitHub: https://github.com/boomzikazita/dsh-cybernetics
Plugin: dsh-cybernetics
Author: boomzikazita

Check the source files

Read the README and other files from this plugin directory before installing.

File explorer3 files
README.mdSource · read only

dsh-cybernetics

A cybernetic control kernel runtime for DeepSeek Harness (DSH). It wraps an agent session in a classical closed-loop control system — observer, feedforward controller, feedback correction, and actuators — so the harness can watch its own tool-call behavior, detect instability (divergence, oscillation, redundant calls, tool-stuck loops), and adapt its own operating mode in real time.

Implemented as a Cordis plugin (pure ESM) and informed by classical engineering cybernetics (Engineering Cybernetics, Tsien Hsue-shen & Song Jian, 3rd ed.).

> 中文简介:dsh-cybernetics 是一个面向 DeepSeek Harness 的「控制论内核」运行时插件,用经典控制回路(观测器 / 前馈控制 / 反馈校正 / 执行器)让智能体自我观测、自我诊断并自适应调节运行档位。源码注释含中文,功能文档以英文为准。

Features

  • Observer — per-session in-memory state plus JSONL persistence (~/.dsh/cybernetics/state_log.ndjson); pHat and the current mode survive restarts via boot-time log replay.
  • Feedforward controltools/pre-execute rule table with tool-name whitelists and argument regexes. Destructive commands are routed through an approval gate (dry-run+confirm); flaky network commands are logged and warned (retry+timeout).
  • Feedback correctiontools/result events feed a delta signal (0 = success, 1 = failure) through an EMA filter that estimates the failure rate pHat; a hysteresis control law then adapts the operating mode (fast → deep → conservative).
  • Instability detection — divergence (consecutive failures), oscillation (high 0/1 flip rate), redundant calls (parameter-text hash), low tool-distribution entropy (loop / tunnel-vision signal), slow-tool TOP3, and observation completeness.
  • Health score — 0–100 synthesized from success rate, observation completeness, redundancy, divergence, and oscillation.
  • Controllability self-check — given a goal and its required tools, compare against the available tool set (plugin tools ∪ observed host tools) and return controllable / not-controllable with advice.
  • Sandbox mode actuator — switch the session's file-sandbox mode at runtime (read-only / workspace-write / danger-full-access).

Provided tools

ToolDescription
cybernetics_snapWrite the current kernel state (in-memory state + feedforward rule summary + mode) to the state log and return a summary. mode temporarily switches mode (fast/deep/conservative; auto-reverts to adaptive after 60 s).
cybernetics_statusRead the last N state-log entries and summarize: tool call counts, delta mean, pHat, mode, divergence/oscillation, redundant calls, entropy, observation rate, health score.
cybernetics_checkControllability self-check: goal + required tools vs currently available tools → missing / controllable / advice.
cybernetics_sandbox_modeSwitch the current session's file sandbox mode (read-only / workspace-write / danger-full-access); runs only after explicit user confirmation.

Installation

dsh plugin --profile web add github:boomzikazita/dsh-cybernetics

Or install from a local bundle directory:

dsh plugin --profile web add /path/to/dsh-cybernetics

> Important: the plugin's node_modules must be symlinked to the global DSH host (ln -s $DSH_NODE_MODULES node_modules). Do not install its dependencies yourself (e.g. with pnpm) — a second copy of @deepseek-ai/dsh-tools breaks the module-level TOOL_RUNTIME_SCHEDULER symbol and crashes all tool scheduling.

Configuration

The bundle ships its own default patch (cordis.patch.yml). To customize, override the plugin entry in your profile:

# append to ~/.dsh/profiles/web/cordis.patch.yml (or headless)
- insert:
    - id: cybernetics
      name: 'dsh-cybernetics'
      config:
        stateLog: '~/.dsh/cybernetics/state_log.ndjson'
        feedforward:
          - id: 'network-unstable'
            tools: ['bash']
            pattern: '\\b(git|npm|curl|wget|pnpm)\\b'
            action: { strategy: 'retry+timeout', retry: 2, timeout: 30000 }
          - id: 'irreversible-write'
            tools: ['bash']
            pattern: '\\b(rm|mv|rmdir|shred)\\b|git (push|reset --hard|clean)'
            action: { strategy: 'dry-run+confirm', dryRun: true, confirm: true }
        stability:
          maxToolCallsPerTurn: 5
        modes:
          fast: { label: '快速响应', zeta: 0.3 }
          deep: { label: '深度分析', zeta: 0.7 }
          conservative: { label: '保守稳定', zeta: 1.2 }

Control parameters (all configurable under control)

ParameterDefaultMeaning
alpha0.2EMA smoothing coefficient
escalateAt / deescalateAt0.6 / 0.15pHat thresholds for mode up-shift / down-shift
deescalateStreak5consecutive low-pHat runs required to down-shift (hysteresis)
divergenceStreak3consecutive failures to flag divergence
oscillationWindow / oscillationRatio10 / 0.7oscillation detection window / flip ratio
redundantWindow20redundancy / entropy window
entropyWarnAt / entropyRecoverAt1.0 / 1.5low-entropy warn / recover thresholds (hysteresis)

Mode → per-turn tool-call stability limits: fast: 5 / deep: 4 / conservative: 3 (higher mode = tighter).

How the control loop works

Classical negative-feedback loop:

1. Observe — every tool call is recorded per session. On boot, the JSONL log is replayed to restore pHat and the mode, so the kernel does not "forget" across restarts. 2. Feedforward — before a tool runs, rules can force an approval gate (destructive / irreversible ops) or attach a warning (flaky network commands), instead of reacting only after failure. 3. Feedback — each tools/result yields delta (0 success / 1 failure); EMA estimates pHat; the control law (with hysteresis + debounce) shifts modes; divergence and oscillation are flagged and warnings are queued. 4. Actuate — warnings are injected into the next agent request (agent/pre-step); the four cybernetics_* tools let the agent or a human inspect and steer the kernel; agent/disposed emits a per-session summary event for downstream review automations.

Development

node --check index.js && node --check core.mjs   # syntax check
node --test test/cybernetics.test.mjs            # unit tests (11 cases)

core.mjs contains the pure control-law functions (EMA, hysteresis, oscillation/entropy/health-score, error classification) with no Node side effects and no external dependencies, so they are directly unit-testable with node:test.

License

MIT © 2026 boomzikazita