pavangupta352/stalegreen

dsh-plugin-stalegreen

为智能体的测试、类型检查、lint 与构建结论提供新鲜度检查:每次验证运行在 tools/post-execute 上记录为凭据,文件修改被跟踪;在 agent/turn-stopping 时,若结论对应的最新凭据已过期、失败或没有可读结果,则引导再走一步,并指出凭据与其后被修改的文件。

‍ 开发与运行时claude-codeclaude-code-plugincodex

dsh-plugin-stalegreen

English | 中文

The stalegreen freshness gate as a DeepSeek Harness plugin. Verification runs (pytest, pnpm test, tsc, eslint, cargo test, next build and about eighty others) become receipts, file edits become edit events, and when the agent ends a turn with "all tests pass", "tsc is clean" or "the build succeeds", the claim is checked against the latest receipt of that category:

EvidenceVerdictWhat happens
Passing run, no edits sinceFRESHthe turn ends
Passing run, files changed sinceSTALEone more step, with the receipt and the edited files
Failing runFAILEDone more step
Run whose result was hidden by a pipe or a suffixMASKEDone more step, asking for an unmasked rerun
No run at allNONEthe turn ends (strict mode: one more step)

DeepSeek Harness's own goal system says it has no independent evaluator. This plugin is one: deterministic, local, and citing a receipt for every verdict. Zero tokens, zero network, zero telemetry.

Install

dsh plugin add dsh-plugin-stalegreen

The package is on npm and listed in awesome-dsh-plugin. The bundle inserts one plugin row, stalegreen, into the profile. Options go on that row in the profile's cordis.patch.yml:

- id: stalegreen
  config:
    policy: advisory   # record verdicts, never steer
    mode: strict       # deny masked verification commands

The receipts, edit events and verdicts live under ~/.stalegreen/sessions/<session id>/, the same store the stalegreen CLI reads: npx stalegreen check shows the last session's claims and evidence, npx stalegreen receipt r-0017 a run's receipt and log tail.

How it hooks in

  • tools/pre-execute: a verification command gets a pending receipt; in strict mode a masked one (| tail -5, || true, 2>/dev/null) is denied with the instruction to run it without the pipe. The harness's pre-execute waterfall cannot rewrite a call, so unlike the Claude Code and Codex hooks nothing is rewritten here; the bash tool keeps the full output of a long run in a file, which limits what a pipe can hide.
  • tools/post-execute: the bash tool's output becomes a receipt, using the runner's own summary line and the [exit code: N] marker; edit, write and str_replace_editor calls become edit events.
  • agent/turn-stopping: the last assistant message is read for green claims. A stale, failed or masked claim steers one more step with a message such as:
stalegreen: "all tests pass" is stale. Receipt r-0017 (`pnpm test`, 41 passed, 14:02:11) predates 3 later edits:
  src/routes/pay.ts (14:05:40), src/lib/hold.ts (14:06:02), src/lib/hold.test.ts (14:06:31)
Rerun `pnpm test` and report the result, or state explicitly that the tests were not rerun after these edits.

A category is steered at most once per turn, so the agent can never be trapped.

What it is not

Not a judge of intent: it checks whether the evidence behind a claim is fresh and complete. Not a replacement for the runner's judgement: a pass is the runner's own summary, never an inference from silence alone.

License

MIT. Copyright (c) 2026 Pavan Gupta.