dsh-critique-loop
开发工具 活跃维护

dsh-critique-loop

Milbaxter/dsh-critique-loop

轻量级对话增强插件,每轮对话完成后自动触发一轮批评改进流程,无需手动操作即可优化回复质量,提升内容准确性与逻辑性,安装配置简单,即装即用。

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
JavaScript
主要语言
Apache-2.0
开源协议
15 KB
仓库大小
20 天前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:Milbaxter/dsh-critique-loop
git clone https://github.com/Milbaxter/dsh-critique-loop.git
git clone git@github.com:Milbaxter/dsh-critique-loop.git
README.md main

dsh-critique-loop

English | 中文说明

A DeepSeek Harness (dsh) plugin that intercepts turn completion and triggers an automatic self-critique and improvement round.

Ported from the Grok Build harness experiment Milbaxter/grok-harness.


Why

Standard agent loops stop immediately when the model finishes its tool calls or responds with final text. By intercepting the terminal stopping boundary (agent/turn-stopping) and steering the agent before the turn closes, this plugin forces the model to review its own actions:

"Critique what you just did. Be specific about mistakes, gaps, and weaker choices. If the critique finds something worth changing, apply the improvement now. If nothing material needs changing, say so briefly and stop."

The next stop is permitted through without looping (or up to maxRounds), preventing runaway continuation while ensuring thorough verification.

Features

  • 🔄 Automatic Self-Review: Intercepts agent/turn-stopping to prompt the model for immediate self-reflection.
  • 🛡️ Loop Safe: Tracks per-turn critique counts with WeakMap isolation per agent; defaults to 1 round of critique per turn.
  • ⚙️ Configurable: Customize the critique prompt, maximum review rounds, or toggle enabled/disabled.
  • Zero Runtime Dependencies: Pure ES module built on Cordis lifecycle hooks and native Node.js APIs.

Installation

Add directly to your DeepSeek Harness profile from GitHub:

dsh plugin --profile web add github:Milbaxter/dsh-critique-loop

Or clone and add locally:

git clone https://github.com/Milbaxter/dsh-critique-loop.git
dsh plugin --profile web add ./dsh-critique-loop

Restart dsh web (or your headless session) after adding the plugin.

Configuration

In your cordis.yml or bundle configuration:

- id: dsh-critique-loop
  name: dsh-critique-loop
  config:
    enabled: true
    maxRounds: 1
    prompt: "Critique what you just did. Be specific about mistakes, gaps, and weaker choices. If the critique finds something worth changing, apply the improvement now. If nothing material needs changing, say so briefly and stop."

Options

Option Type Default Description
enabled boolean true Master switch to enable/disable the critique loop.
maxRounds number 1 Maximum self-critique rounds per turn before stopping.
prompt string (standard prompt) Custom critique instruction steered into the agent.

Running Tests

npm test

Architecture

This plugin hooks into DeepSeek Harness's Cordis-based event system:

  1. Listens on agent/turn-stopping (serial terminal checkpoint).
  2. If shouldCritique(agent, turn) returns true, steers a user message with the critique prompt via agent.steer(...).
  3. Agent driver processes the steered input and executes another step in the open turn.
  4. Subsequent stop events in the same turn are allowed through to avoid recursion.
  5. On agent/pre-step, when genuine user messages arrive, per-turn counters are reset.

License

Apache 2.0 © Maximilian Rehn (Milbaxter)