Leitarkkk / dsh-research-nudge

已收录

DeepSeek Harness plugin that auto-nudges agents to consult docs or web search when local trial-and-error becomes costly. DeepSeek Harness 插件:当本地试错成本升高时,自动注入检索提示,引导 Agent 查阅文档或联网搜索。

master工具 查看源代码

安装

npx -y @deepseek-ai/dsh plugin --profile web add github:Leitarkkk/dsh-research-nudge

此安装命令根据 GitHub 仓库地址生成,是未经验证的安装起点。

README

维护者编写的文档快照。

在 GitHub 查看 ↗
提交版本 c6bc8ed同步于 2026年8月18日

dsh-research-nudge

CI version license DSH

English | 简体中文

An advisory research-debt guard for DeepSeek Harness. It notices when an agent spends a long stretch reading, editing, executing, and repeating failures without consulting external evidence, then adds a short reminder to the next model step.

It does not call an LLM, perform a search, block a tool, or force the agent to browse. The reminder explicitly allows self-contained work to continue normally.

The problem

Agents sometimes fall into a local trial-and-error loop:

read → guess an unfamiliar API → edit → run → fail → edit → run → same failure

A search of the official docs, an exact error message, or an existing GitHub issue may resolve that uncertainty faster. dsh-research-nudge turns the growing cost of the local loop into a deterministic score called Research Debt.

Research Debt: a calculated example

This is a hypothetical sequence calculated from the documented default weights, not production telemetry. It shows exactly how the score would cross the threshold:

StepSignalAdded debtTotal
Read local codeordinary tool+11
Edit a filemutation+23
Run and failexecution + failure+1 +48
Edit againmutation+210
Run and hit the equivalent failure againexecution + failure + repeated failure+1 +4 +621

The default threshold is 20, so the last result carries an additional model-visible context:

[Research Nudge]

You have accumulated significant research debt through local tool use without
consulting external information.

Before continuing, consider whether external research could resolve the current
uncertainty faster: search official documentation, GitHub, mature libraries, or
the exact repeated error.

Do not search merely to satisfy this reminder. If external research would not
help, continue normally.

Current signals: debt=21/20, tool_calls_since_research=5,
failures=2, repeated_failures=1.

Equivalent failures are fingerprinted after normalizing changing numbers and addresses, so TypeError at line 123 and TypeError at line 456 count as a repeat. A recognized research tool resets the accumulated state for that agent.

Install

Prerequisites:

  • DeepSeek Harness 0.1.0-rc.7 (the current next release line)
  • Node.js ^22.19.0 or >=24.0.0, matching the current DSH baseline

From GitHub:

dsh plugin --profile web add github:Leitarkkk/dsh-research-nudge

Git installs run this package's prepare build. pnpm may reject that build until you explicitly trust it. Follow the exact allowBuilds entry printed by DSH/pnpm, review the source first, and pin a tag or commit for reproducible installs:

dsh plugin --profile web add github:Leitarkkk/dsh-research-nudge#<tag-or-commit>

After the package is published to npm, the prebuilt install is:

dsh plugin --profile web add dsh-research-nudge

Verify the composed layer, then restart the profile:

dsh --profile web --dump-config
dsh web

Local development install

git clone https://github.com/Leitarkkk/dsh-research-nudge.git
cd dsh-research-nudge
npm install
npm run check
dsh plugin --profile web add .

Relative paths are resolved from the directory where dsh plugin is invoked.

Default policy

SignalDebt
Ordinary tool call+1
File mutation+2
Shell/build/test execution+1
Failed tool result+4
Repeated equivalent failure+6
Recognized external research toolreset to 0

A reminder is eligible when any condition is met:

  • Research Debt reaches 20;
  • 15 tool calls occur without recognized research; or
  • 15 minutes pass without recognized research.

After a reminder, the per-agent state continues accumulating but further reminders are suppressed for 10 minutes. Names are normalized before classification and research matching, so WebSearch, web_search, and web-search are treated consistently.

Configuration

The bundle inserts a row with the id research-nudge. Override that row in the profile's cordis.patch.yml:

- id: research-nudge
  config:
    enabled: true
    debtThreshold: 20
    maxToolCallsWithoutResearch: 15
    maxMinutesWithoutResearch: 15
    cooldownMinutes: 10
    ordinaryToolDebt: 1
    mutationDebt: 2
    executionDebt: 1
    failureDebt: 4
    repeatedFailureDebt: 6
    researchTools:
      - web_search
      - web_fetch
      - github_search
      - docs_search
      - fetch_url
    debug: false

DSH patch layers replace a row's entire config value rather than deep-merging it. Any omitted fields above fall back to this plugin's schema defaults. reminder may also be set to a custom string.

FieldDefaultMeaning
enabledtrueRegister the lifecycle listener
debtThreshold20Debt score that makes a reminder eligible
maxToolCallsWithoutResearch15Call-count fallback threshold
maxMinutesWithoutResearch15Elapsed-time fallback threshold
cooldownMinutes10Minimum time between reminders
ordinaryToolDebt1Weight for other local tools
mutationDebt2Weight for write/edit/delete-style tools
executionDebt1Weight for shell/build/test-style tools
failureDebt4Extra weight for a failed result
repeatedFailureDebt6Extra weight for an equivalent consecutive failure
researchToolscommon web/docs/GitHub namesSubstring patterns that reset state after normalization
reminderbuilt-in advisory textModel-visible reminder body
debugfalseLog resets and queued reminders to stderr

How it integrates with DSH

The plugin listens to the current tools/post-execute waterfall. It observes the typed ToolExecution and ToolExecutionResult, delegates to later listeners with next(), then prepends one official createUserMessage(...) notice through PostToolDecision.additionalContexts. Accept/block decisions and existing contexts are preserved.

No service is read from ctx, so no Cordis service injection is required. State is held in a WeakMap keyed by the calling agent and disappears with the agent/runtime.

Compatibility

The adapter is compiled and tested against the official @deepseek-ai/dsh-tools and @deepseek-ai/dsh-llm 0.1.0-rc.7 contracts. DSH is still a Developer Preview and explicitly allows compatibility-breaking changes. If a later DSH release changes the tool waterfall or message contract, update the small adapter in src/index.ts; the deterministic policy in src/policy.ts is independent.

Privacy and safety

  • No telemetry, network requests, API keys, or extra model calls.
  • No tool arguments are stored or copied.
  • The in-memory fingerprint uses only failed-result text; it is not persisted.
  • The reminder is advisory and never changes a tool result or permission decision.
  • Git installs execute a local build script; review and pin third-party code before allowing it.

Development

npm ci
npm run check
npm pack --dry-run

See CONTRIBUTING.md for contribution guidelines.

License

MIT

项目文件与信号

以下项目是目录快照中检测到的公开仓库信号。

测试已检测
贡献指南已检测

仓库信息

开发语言
JavaScript
许可证
MIT
最新发布
v0.1.0
最后更新
2026年8月18日 01:58

谨慎安装

请检查源代码、权限、生命周期脚本、依赖与网络访问;不受信任的插件应先在隔离环境中测试。