AI Agent Hub
Back to plugins
⚙️

dsh-code-reuse-firewall

Workflow Updated 2026.08.25

Run the following command in DeepSeek Harness:

dsh plugin install keyiadiannao/dsh-code-reuse-firewall

Paste the following prompt into your AI chat to install this plugin:

Run dsh plugin install keyiadiannao/dsh-code-reuse-firewall in DeepSeek Harness to install; source code is available at https://github.com/keyiadiannao/dsh-code-reuse-firewall

About this plugin

The most expensive failure mode in AI-maintained codebases is not a syntax error but the same capability quietly implemented a second time. Two versions drift apart without any linter ever firing, because nothing looked broken when the copy was made. dsh-code-reuse-firewall moves the intervention point earlier: while the new code is still a plan on the agent canvas, not yet a file on disk.

Under the hood it runs a deterministic, LLM-free retrieval pass before the write tool is invoked. Three channels—callable-name overlap, docstring lexical match, and string-literal similarity—each carry IDF-weighted coverage scores. The agent receives top-K candidates with file paths, per-channel evidence, and an explicit LOCKED flag when a candidate sits in a frozen-JSON provenance manifest, steering it toward import rather than copy-and-modify. The entire engine is pure Python 3.10 stdlib; a mid-size project scan completes in roughly one second with no external model calls.

It is built for teams maintaining medium-scale Python repositories with DeepSeek Harness or similar agent workflows. You do not replace your existing checker pipeline; just insert one reuse_check step before each write decision, and the signal that this capability already exists in the repo arrives while duplication is still preventable.

Use Cases

  • Agent about to write a new helper, checks for existing equivalents first
  • Avoiding duplicate implementations in mid-size Python projects
  • Deterministic retrieval to find reusable code before the agent writes a file

Best For

  • Teams maintaining Python projects with DeepSeek Harness or similar agent workflows
  • Tech leads concerned about feature duplication and silent drift in AI codebases
  • Engineers who want a pre-write anti-duplication signal without replacing their existing checker pipeline