Mcd0LUO/dsh-guard-repeat-output

A host-side guard for DSH that watches the model's output stream and cuts off degenerate repetition the moment it starts, so a model that loops never bills a million characters into your context. It sanitizes blacklisted code points out of every delta, treats a dense burst as collapse evidence in its own right, then detects repetition statistically and stops the stream — none of the discarded text reaches session history. On a production server it caught 12 real collapses in about two days, all of which recovered.

dsh-guard-repeat-output stops a model's repetition collapse before it burns the context window. Sometimes a model gets stuck and emits the same phrase over and over; nothing in the loop notices, so the turn keeps generating and billing until the model stops by itself or a human cancels — and every one of those tokens then crowds the context window. The guard evaluates a sliding window of the stream as it arrives and acts on three levels. While the stream is live it sanitizes blacklisted code points (control characters, U+FFFD, zero-width filler, lone surrogates) out of every delta before forwarding, so they can never reach the log, and treats a dense burst — a long unbroken run or a high share of one delta — as collapse evidence in its own right. Repetition is then detected statistically, and on collapse the guard cuts the stream off; none of the discarded text ever reaches session history. The README reports two real production incidents (1,371,962 and 250,506 characters of pure repetition) and 12 real collapses caught in about two days, all of which recovered.

Tools & Capabilities ★ 6
View on GitHub ↗

Install

dsh plugin --profile web add dsh-guard-repeat-output

Copied verbatim from the README's install block.

Compatibility

A host-side guard that watches the model's output stream on DSH's extension points; it needs no client half and adds no UI.

Details

Alternatives

1624318455/dsh-plugin-tavily · 6Mikao9/dsh-wsl-workspace · 863683348/dsh-plugin-academic-writing

More plugins in Tools & Capabilities

Browse more in Tools & Capabilities

Guides for Tools & Capabilities plugins