KilimcininKorOglu/claude-code-mods/tree/main/plugins/output-flood
output-flood
一個 Claude Code 外掛,會測量每條 Bash 命令消耗多少內容視窗;超過大小限制後,告訴模型用哪條更窄的命令就能回答同一個問題。
關於這個 mod
output-flood 會在模型讀取每個 Bash 結果時,以字元數測量大小,時機是在工具呼叫完成、下一次模型要求發出之前。超過限制的結果(預設 20 KB,約 5000 個 token)會連同成本,以及針對該命令縮小範圍的建議回報給模型(例如 pytest -x -q、go test -run、cargo test <name>、jest -t)。如果可以使用,也會將一行精簡記錄寫入 transcript,或在可用時轉送到側邊欄外掛的串流。每條命令在每個工作階段只回報一次,以前 60 個字元作為追蹤依據。透過 /output-flood 管理:切換功能、設定限制(1-1000 KB,跨工作階段保存),以及查看工作階段的洪水總量。函式勾點需要 Claude Code 2.1.288+;透過 KilimcininKorOglu 市集安裝。已知限制包括:CANNOT reclaim output already in context;背景命令不會測量;建議依命令文字比對;大小以字元而非 token 計算。
安裝
請先查看作者 README,確認 marketplace 與外掛名稱;指令可能隨儲存庫結構而變動。
claude plugin marketplace add KilimcininKorOglu/claude-code-mods claude plugin install output-flood
原文 / README
output-flood
The model runs pytest tests/ -v or find . for one answer, and tens of KB of output land in the context and stay there for the rest of the session. The next requests carry that weight, and the model does not know what it cost. This mod measures how much of your context each Bash command spent. When a command's output passes a size limit, it tells the model what it cost and which narrower command would have answered the same question.
What it does
-
After each batch of tool calls resolves, and before the next model request, the mod measures every Bash result in characters, as the model reads it. The measure comes after every mod that rewrote a result, so a result another mod shrank (such as bash-diet) counts at its shrunk size, whichever order the plugins load in. Subagent calls are measured the same way.
-
A result over the limit (20 KB by default, about 5000 tokens) is a finding. The model reads this note before its next request:
output-flood: "pytest tests/ -v" returned 30 KB of output, over the 20 KB limit, and all of it is now in the context. Next time run the one test or file this turn needs, and let the runner report only failures (pytest -x -q, go test -run, cargo test <name>, jest -t).The advice follows the kind of command: a test runner,
git log/diff/show, a filesystem walk (find,ls,du,tree), a package install, a file or JSON read, container logs. A command of no known kind is told to send its output to a file and read the range it needs. -
No advice is ever a pipe into
tailorhead. A long run whose output is cut at the end hides the failure that scrolled past; every suggestion narrows what the command produces instead. -
At the same moment one line reaches the transcript, the finding alone, without the instruction the model reads:
output-flood: 30 KB of output from "pytest tests/ -v", over 20 KB -
While the sidebar is open, that finding goes there instead, as an entry in its stream: the size on the first line (yellow under twice the limit, red at or above it, with
over N KBfaint) and the advice faint under it. The transcript stays clean. With the sidebar closed, or without that mod installed, the transcript line is written as above. -
One command is reported once per session, known by its first 60 characters. Its size still counts towards the total
/output-floodprints.
Command
/output-flood on or off, the limit, and what this session flooded
/output-flood on | off on by default
/output-flood limit 50 a result over 50 KB is reported; 1 to 1000, 20 by default, stored across sessions
Install
claude plugin marketplace add KilimcininKorOglu/claude-code-mods
claude plugin install output-flood@kilimcininkoroglu-mods
Function hooks are early access. Claude Code 2.1.288 and later load them by default, so there is nothing to switch on.
After installing
- Restart Claude Code.
What it can reach
Validated with claude plugin validate on Claude Code 2.1.283:
❯ ./register.ts hooks: session.start, command.run{command=output-flood}, classic.PostToolBatch
❯ ./register.ts calls: $.command.register, $.sidebar.set (via toPerson), $.store.get (via readLimit, readSettings), $.store.set (via runCommand, setLimit), $.ui.log (via toPerson)
Reach L1, reads the session.
1. Reads: each Bash command's text, and the length of its result as the model reads it; it never parses the output itself
2. Runs: nothing
3. Sends: a note to the model before its next request, and one line to the transcript; nothing leaves the machine
4. Persists: in $.store, the on/off setting and the limit
5. Hostile input: only the length of the output is measured; the command text reaches the note cut to 60 characters and is never run
Limits
- The output is already in the context when the note is written. The mod cannot take it back; the note is for the next command.
- A failed command (a non-zero exit the engine reports as an error) is measured from its error text, because a failing test run is the largest output of all. The error text stays as it is. Claude Code cuts that text at 10,000 characters, so a failed command passes a limit of 20 KB only when you set a lower one.
- A backgrounded command is not measured: its result carries a task id, not the output.
- The advice is matched on the command text. A command hidden behind a script or a
maketarget gets the general advice. - The size is counted in characters, not tokens. A line of ASCII is about four characters per token, and other text more.
Development
make install # eslint, typescript-eslint, typescript
make lint # complexity limit 10, the build fails above it
make typecheck # needs .claude/types/ from /plugin-types
make validate
make test # claude plugin test
