rea
morluto
Reverse engineer anything with agents, from app behavior down to native binaries.
PROJECT TOPICS
INSTALL REFERENCE
dsh plugin --profile web add github:chunqing286/dsh-guard-degen
该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。
PROJECT README
A degeneration guard for DeepSeek Harness: it contains runaway symbol streams at the model boundary and ships tooling to repair polluted artifacts and sessions.
Some models (in our measurements, concentrated in the MiniMax family) degenerate their reasoning into a single repeated character:
⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ ⇒ …
Degeneration is not always one character repeated: a multi-character unit can repeat as a whole block over and over:
⇒⇒§ ⇒⇒§ §
⇒⇒§ ⇒⇒§ §
… (the same block, again and again)
That output is persisted into session files and can even be written by the model into repository documents and source files. Once a session is polluted, "continue" only yields more of the same stream — the session is unusable, but the file pollution survives into the next session and accumulates.
This plugin does four things:
The stream guard has four policies, set separately for the reasoning channel and the text channel:
| Policy | What happens to the degenerate run |
|---|---|
off |
Nothing is detected or changed — the run goes through untouched. |
truncate (default) |
The channel is cut and the round ends with a "degeneration" error. |
sanitize |
The run is folded into a marker (〔退化符号流×N〕) and the round continues. |
remove |
The run is deleted outright — not one marker is left behind — and the round continues. |
remove is the quietest option: the model output reads as if the degenerate segment
had never been written. The removed text is still recorded in the verdict journal as
evidence, but unlike sanitize it cannot be reverted — there is nothing in the stream
to put back.
Artifact governance covers both shapes: a run of one symbol, and a multi-character unit repeated as a whole block. After ticking the entries you want, "preview repair" shows a red/green diff (red = before the repair, green = after it) right in the view, so you can confirm before anything is written to disk.
The multi-character unit shape is governed in four places, each with its own switch and its own repetition threshold:
| Place | Switch | Threshold | Default |
|---|---|---|---|
| Artifact repair | artifacts.unitRun |
artifacts.unitRepeats |
on / 4 |
| Stream guard | stream.unitRun |
stream.unitRepeats |
on / 4 |
| Tool guard | toolGuard.unitRun |
toolGuard.unitRepeats |
on / 4 |
| Session masking | sessions.unitRun |
sessions.unitRepeats |
on / 4 |
Turning a switch off leaves that place with the single-symbol run rule only; the other places keep their own setting, so the four guards never drag each other along. The thresholds are independent too: raise one to be more permissive, lower one to be more sensitive, without touching the others.
One command (the package is published on npm):
dsh plugin --profile <your profile> add dsh-guard-degen
Replace <your profile> with the profile the host actually uses (web for dsh web;
the desktop app uses its own profile, whose name is not necessarily the same).
Or install straight from the repository:
dsh plugin --profile <your profile> add github:chunqing286/dsh-guard-degen
Or do it in the UI: Plugins → Discover, add the index source
https://cdn.jsdelivr.net/npm/dsh-plugin-catalog/index.json, search for
"degeneration guard", and press Install.
Either way the package's own cordis.patch.yml is applied as a bundle layer, so the host
half and the browser half go in together; the Degeneration guard section shows up in
Settings as soon as the host reloads.
If you would rather not use a package manager, append one insert to
$DSH_HOME/profiles/<profile>/cordis.patch.yml:
- insert:
- id: guard-degen
name: <relative path to the plugin directory, or a package name>
Relative paths in name are anchored beside the patch file (documented host
semantics), so any local directory works; a bare package name must be resolvable from the
profile's node_modules or the installation's own packages.
With a relative-path install the plugin directory must resolve its own runtime
dependencies (@deepseek-ai/dsh-typert-protocol, @deepseek-ai/schemastery, plus
@deepseek-ai/cordis and @deepseek-ai/cosmokit that they pull in); an npm install
pulls those in for you.
The profile bundle mechanism works too: list "dsh": { "profile": { "bundles": ["dsh-guard-degen"] } } in the profile manifest and add the package to dependencies —
the package's own cordis.patch.yml is then applied as a bundle layer.
The host plugin exposes a native Schemastery Config schema, so the settings page
renders a form automatically. The plugin also registers its own Settings →
Degeneration guard section (a sibling of Plugins) with three tabs under it,
each on its own page (they never render on top of each other):
The session list shows both the session title and the session id. After "preview masking", the page renders the change inline as a red/green diff (red = original text, green = the marker that replaces it), so there is no need to open the generated file on disk.
Session masking has two content modes, selectable on both the artifacts page and the session view:
Collapse — fold the degenerate run into 〔退化内容已遮蔽×N〕.Remove — delete the run entirely (default). Nothing is written in its place: the
file ends up with the symbols gone, and the green diff line shows the text that
remains after the deletion (not a sentence standing in for the run). When the
whole content was degenerate, the green line says so explicitly.Switching the mode recomputes the preview immediately, so the change can be inspected before anything is written.
Masking also has two landing modes, selectable on both pages:
Write a separate copy — the masked content lands in a new file, the archive
stays untouched.Rewrite the session archive in place — the default on both pages: the
session you are looking at is masked itself (the original is backed up first),
no copy to hunt for.The session page's view row (next to Chat / Trajectory / Context / Squad) also carries a Degeneration guard view, scoped to the current session:
"Apply masking" rewrites the current session in place by default: the archive
is replaced atomically (temp file, then rename), the original is backed up to
~/.dsh/guard-degen/backups/, and the written file is read back and verified.
Three things are worth knowing:
| Command | Effect |
|---|---|
/degen-status |
Guard status, rule table, recent verdicts |
/degen-scan [paths…] |
Read-only artifact scan (defaults to the workspace) |
/degen-fix <file…> |
Repair the given files (backs up before rewriting) |
/degen-clean |
Mask degeneration in the current session (rewrites the archive in place by default) |
/degen-ack |
Record the latest verdict as a false positive and relax that rule one step |
| Key | Default | Meaning |
|---|---|---|
enabled |
true |
Master switch |
modelIncludes |
[] |
Guard only these models (empty = all) |
stream.reasoning |
truncate |
Reasoning policy: off/truncate/sanitize/remove |
stream.text |
truncate |
Text policy: off/truncate/sanitize/remove |
stream.holdbackChars |
256 |
Characters held back before a verdict |
stream.maxInterventionsPerCall |
1 |
Max interventions per call |
stream.unitRun |
true |
Also govern multi-character units repeated as a whole block |
stream.unitRepeats |
4 |
How many repeats of a unit count as degeneration (stream guard) |
toolGuard.mode |
warn |
Degeneration in tool arguments: off/warn/refuse |
toolGuard.scope |
all |
all/write-only/oversized-only |
toolGuard.unitRun |
true |
Also govern multi-character units in tool arguments |
toolGuard.unitRepeats |
4 |
How many repeats of a unit count as degeneration (tool guard) |
postExecute.enabled |
false |
Write-back verification (costs IO) |
postExecute.roots |
[] |
Restrict verification; empty = inside the workspace |
retry.policy |
same-model |
same-model/steer/no-retry |
retry.maxSameModelRetries |
1 |
Same-model retry count |
retry.switchModel.enabled |
false |
Allow an automatic model switch |
artifacts.mode |
remove |
collapse (marker) or remove (delete the run) |
artifacts.apply |
false |
Preview only by default |
artifacts.unitRun |
true |
Also govern multi-character units repeated as a whole block |
artifacts.unitRepeats |
4 |
How many repeats of a unit count as degeneration |
artifacts.maxFileBytes |
8388608 |
Per-file size limit; larger files are skipped (and listed) |
sessions.mode |
replace |
copy (new file) or replace (rewrite in place) |
sessions.maskMode |
remove |
collapse (marker) or remove (delete the run) |
sessions.unitRun |
true |
Also govern multi-character units in session content |
sessions.unitRepeats |
4 |
How many repeats of a unit count as degeneration |
logging.enabled |
true |
Persist the verdict journal |
Runtime edits are written to ~/.dsh/guard-degen/config.json, layered over the profile
configuration.
apply=false;
the preview phase writes nothing.<file>.degen-backup first; if the
backup fails, the original file is left untouched.★ exist in real repositories,
so only runs of a symbol count as degeneration.⇒⇒§ ⇒⇒§ §
repeated end to end is a separate degeneration shape (marked 〔退化单元×N〕). The unit
must contain at least one non-ASCII character, so code, tables and normal prose are not
misjudged; a run of one symbol stays the business of the run rule, so nothing is
reported twice.⇒⇒⇒⇒… ⇒⇒⇒⇒… **⇒⇒ **). Removing the runs makes the fragments touch, and
they can form a new multi-character unit repeat. The unit rule therefore judges the
fragments left after the runs are taken out, so one repair pass clears both — otherwise the
read-back verification would reject the result with "verification failed" and the user
would get nothing.assistant/message events (and compaction summaries); user prompts, system messages and
tool results are left byte-identical.artifacts.roots
(the working directory by default); an explicit file list cannot bypass the roots, and
symlink targets and non-UTF-8 files are skipped. /degen-fix binds each run to the
directories of the files you named, so pointing at a file outside the workspace still
works — but nothing else in that tree is touched.~/.dsh/guard-degen/{masked,backups,audit}/, never
into the session directory. Masking only accepts targets under ~/.dsh/sessions.〔退化符号流×N〕 marker is rewritten in it too — the count in the archive
equals the number of symbols actually removed.setConfig validates the merged result first and refuses
to persist invalid values.artifacts.maxFileBytes (8 MB by default) are
not inspected; they are listed in the report's skippedTooLarge and shown in the GUI —
"not scanned" must never read as "clean".node --test test/*.test.mjs
The suite does not require the host runtime (apart from a few integration checks that use the real cordis package).
Standalone checks live in verify/ (run them with the same node binary):
| Script | What it proves |
|---|---|
check-patch-config.mjs |
the bundled cordis.patch.yml matches the schema defaults |
check-host-load.mjs |
the host class instantiates in the real cordis and exposes all 13 remote methods |
check-host-entry.mjs |
the host half loads on real cordis and wires its listeners |
check-remote.mjs |
the remote-method markers are recognised by the real protocol package |
check-package-files.mjs |
the package manifest points at files that exist (npm pack --dry-run equivalent) |
check-mutations.mjs |
every fix is pinned: reverting it turns a test red |
check-remove-mode.mjs |
"remove" masking leaves no trace on disk |
CLASSIFICATION EVIDENCE
系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: deepseek。