dsh-clear-debug
high-landway/dsh-clear-debug
要求 agent 在修改源码前先声明改动范围,并拒绝范围外的编辑;核验验证输出是否真的存在于会话记录中;每次修复沉淀一条可执行的不变量。它只拦 agent 的 edit 与 write 调用,你自己的编辑器不受影响。
安装
dsh plugin --profile web add github:high-landway/dsh-clear-debugREADME
dsh-clear-debug
An agent's only verifiable signal is that the reported error stopped. A local patch restores that signal cheaply, so it wins by default over a change whose correctness has no oracle. This plugin replaces "did the error go away" with "is the change inside a boundary you can state, and does the evidence you cite actually exist".
It is a process constraint, not a diagnostician. It makes shallow work visible and expensive. It does not tell a correct diagnosis from a plausible one.
What it gates: only the agent's
editandwritetool calls. Your own editor is outside DSH and is never blocked. A file you change there during an open scope is reported at close as a warning — "this changed outside DSH, if it was you the change stands" — not refused.
What it enforces
| Requirement | How it is checked |
|---|---|
| No source edit without a declaration | edit and write are refused |
| Edits stay inside the declared targets | path match against targets |
| A deep fix names where state departs from intent | observation.command, expected ≠ actual, site exists and lies inside targets |
| The expectation is frozen before the fix | revise cannot change it |
| A deep fix names the broken contract, the defect class, and a sweep | cause.contract, cause.class, cause.sweep |
| A deep rewrite says what must disappear, and it does | identifiers in discard are searched in the touched files |
| Close proves the same step now produces the frozen value | verification must match command and value |
| The verification output really exists in the session | a real tool/call with the command plus its tool/result containing the value |
| A rewrite with an unchanged public surface is not a rewrite | fingerprint comparison |
| A fix that only added conditionals is not a root fix | branch-count comparison |
| One invariant per change, keyed and executable | docs/invariants.json, rendered to docs/INVARIANTS.md |
| Every recorded invariant can actually fail | action: "verify" runs each check via the host subprocess service |
What it does not do
- It cannot tell whether the observation crosses the actual cause. The command is chosen by the agent.
- It cannot verify a sweep is complete; the entries are statements, not results.
- A shell command that writes files is not gated.
- An invariant with no check is a claim nothing defends;
verifyreports it asuncheckedrather than passing.
Install
Bring the package into the profile as a bundle (a local directory works during
development). The bundle inserts one row, clear-debug.
Files it creates in your workspace
| Path | Purpose |
|---|---|
docs/invariants.json | source of truth for invariants |
docs/INVARIANTS.md | generated view; a hand-written file is copied to INVARIANTS.manual.md once |
.dsh/change-scope/ | per-session scope records, survive reload |
.dsh/site-history.json | per-file attribution history surfaced on declare |
.dsh/ledger.json | finding counts, aged out after 180 days |
Add .dsh/ to your ignore file if the records should not be committed.
Environment
- A check starting with
noderuns on the host's own executable, so it works without node onPATH. - The git history in a declaration briefing is optional: it needs
gitin the provider's execution world and a workspace that is a repository. Otherwise the briefing says so.