output-flood
Her Bash komutunun context'inizden ne kadar harcadığını ölçen bir Claude Code Mod'u. Bir komutun çıktısı bir boyut limitini geçtiğinde mod, modele bunun ne kadara mal olduğunu ve aynı soruya hangi daha dar komutun cevap vereceğini söyler.
Ne yapar
Mod Bash tool'unu hook'lar. Başarılı bir çağrıdan sonra
stdoutvestderrkarakterlerini, yani modelin okuduğu iki stream'i toplar.Limitin üstündeki bir sonuç (varsayılan 20 KB, yaklaşık 5000 token) bir bulgudur. Model bu notu tool'un sonucundan sonra okur:
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).Tavsiye komutun türünü izler: bir test runner,
git log/diff/show, bir filesystem taraması (find,ls,du,tree), bir package install, bir dosya ya da JSON okuması, container log'ları. Bilinen bir türde olmayan bir komuta, çıktısını bir dosyaya göndermesi ve ihtiyacı olan aralığı okuması söylenir.Hiçbir tavsiye
tailya daheadiçine pipe önermez. Çıktısı sonundan kesilen uzun bir koşu, ekrandan geçmiş hatayı gizler; her öneri bunun yerine komutun ürettiğini daraltır.Aynı anda transcript'e bir satır yazılır, yalnız bulgu, modelin okuduğu talimat olmadan:
output-flood: 30 KB of output from "pytest tests/ -v", over 20 KBsidebar açıkken bu bulgu oraya gider, ilk satırda boyut ve altında soluk tavsiye ile, stream'inde bir entry halinde, ve transcript temiz kalır. Sidebar kapalıyken ya da o mod kurulu değilken transcript satırı yukarıdaki gibi yazılır.
Bir komut metni session başına bir kere bildirilir. Boyutu yine de
/output-floodçıktısındaki toplama sayılır.
Komut
/output-flood on ya da off, limit ve bu session'da neyin taştığı
/output-flood on | off varsayılan on
/output-flood limit 50 50 KB üstündeki bir sonuç bildirilir; 1 ile 1000 arası, varsayılan 20, session'lar arasında saklanır
Kurulum
claude plugin marketplace add KilimcininKorOglu/claude-code-mods
claude plugin install output-flood@kilimcininkoroglu-mods
Function hook'lar early access. Flag olmadan hiçbir şey yüklenmez. Flag'i kalıcı yapmak için ~/.claude/settings.json dosyasına ekleyin:
{ "env": { "CLAUDE_CODE_ENABLE_FUNCTION_HOOKS": "1" } }
Kurulumdan sonra
- Claude Code'u yeniden başlatın.
Nereye uzanır
Claude Code 2.1.278 üzerinde claude plugin validate ile doğrulandı:
❯ ./register.ts hooks: session.start, command.run{command=output-flood}, tool.call{tool=Bash}
❯ ./register.ts calls: $.command.register, $.sidebar.set (via toPerson), $.store.get, $.store.set (via runCommand, setLimit), $.ui.log (via toPerson)
Reach L1, session'ı okur.
1. Okur: her Bash komutunun metnini ve iki çıktı stream'inin uzunluğunu; çıktının kendisini hiçbir zaman parse etmez
2. Çalıştırır: hiçbir şey
3. Gönderir: tool'un sonucundan sonra modele bir not ve transcript'e bir satır; makineden hiçbir şey çıkmaz
4. Saklar: $.store içinde on/off ayarını ve limiti
5. Düşman girdi: yalnız çıktının uzunluğu ölçülür; komut metni nota 60 karaktere kesilerek ulaşır ve hiçbir zaman çalıştırılmaz
Sınırlar
- Not yazıldığında çıktı zaten context'tedir. Mod onu geri alamaz; not sonraki komut içindir.
- Başarısız bir komut (engine'in hata olarak bildirdiği sıfır olmayan bir exit) dokunulmadan bırakılır, çünkü çıktısı modelin olduğu gibi okuması gereken hatadır.
- Arka plana alınmış bir komut ölçülmez: sonucu çıktıyı değil bir task id taşır.
- Tavsiye komut metnine göre eşleştirilir. Bir script ya da bir
maketarget'ı arkasına gizlenmiş bir komut genel tavsiyeyi alır. - Boyut karakter olarak sayılır, token olarak değil. Bir ASCII satırı token başına yaklaşık dört karakterdir, diğer metinler daha fazla.
Geliştirme
make install # eslint, typescript-eslint, typescript
make lint # complexity limiti 10, üstünde build'i düşürür
make typecheck # /plugin-types ile üretilen .claude/types/ gerekir
make validate
make test # claude plugin test
output-flood
A Claude Code Mod that measures how much of your context each Bash command spent. When a command's output passes a size limit, the mod tells the model what it cost and which narrower command would have answered the same question.
What it does
The mod hooks the Bash tool. After a successful call it adds up the characters of
stdoutandstderr, the two streams the model read.A result over the limit (20 KB by default, about 5000 tokens) is a finding. The model reads this note after the tool's result:
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.The same moment writes one line to the transcript, the finding alone, without the instruction the model reads:
output-flood: 30 KB of output from "pytest tests/ -v", over 20 KBWhile the sidebar is open, that finding goes there instead, the size on the first line and the advice faint under it, as an entry in its stream, and the transcript stays clean. With the sidebar closed, or without that mod installed, the transcript line is written as above.
One command text is reported once per session. 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. Nothing loads without the flag. To keep it on, add this to ~/.claude/settings.json:
{ "env": { "CLAUDE_CODE_ENABLE_FUNCTION_HOOKS": "1" } }
After installing
- Restart Claude Code.
What it can reach
Validated with claude plugin validate on Claude Code 2.1.278:
❯ ./register.ts hooks: session.start, command.run{command=output-flood}, tool.call{tool=Bash}
❯ ./register.ts calls: $.command.register, $.sidebar.set (via toPerson), $.store.get, $.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 two output streams; it never parses the output itself
2. Runs: nothing
3. Sends: a note to the model after the tool's result, 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 left alone, because its output is the error the model must read as it stands.
- 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, fails the build above it
make typecheck # needs .claude/types/ from /plugin-types
make validate
make test # claude plugin test