context-guard
Skill5 starsChanged 19 days agoMITView on GitHub
Diagnose Claude Code sessions that saturate your uplink and add latency to the whole network. Claude Code re-uploads the entire context on every turn, so a long-lived session can sustain hundreds of KB/s upstream and fill the router's WAN queue. Scans running sessions, separates bufferbloat from real hardware faults, and installs a status line and warning hook. Use when the user reports slow internet, high ping, lag or an unstable connection while Claude Code is running, or asks which session is eating bandwidth. Triggers: 'slow internet', 'high latency', 'high ping', 'network is lagging', 'what is eating my bandwidth', 'why is my connection slow', 'bufferbloat', 'pomalý internet', 'vysoká latence', 'seká mi to', 'co mi žere linku', 'proč mi padá net'.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- Cand1ePower/codex-context-guard-skilltheir own version, first seen Nov 8, 2026
- CorvusWing/CorvusWingtheir own version, first seen Oct 25, 2026
- iAstroUnicorn/astro-skillstheir own version, first seen Jul 29, 2026
- littlebearapps/contextdocstheir own version, first seen May 6, 2026
- shivae372/claude-bootstraptheir own version, first seen Apr 8, 2026
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- littlebearapps/contextdocs★ 5same name
- Cand1ePower/codex-context-guard-skill★ 1same name
- CorvusWing/CorvusWing★ 1same name
- shivae372/claude-bootstrap★ 1same name
- iAstroUnicorn/astro-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository19 other files it gives its agents.
- code-reviewSkill
- graylog-searchSkill
- html-slide-deckSkill
- image-generationSkill
- implement-specSkill
- jiraSkill
- lighthouseSkill
- mac-maintenanceSkill
- mysql-schema-designSkill
- phaser-gamedevSkill
- pixelart-cleanupSkill
- pixellab-apiSkill
- pixellabSkill
- product-hunt-launchSkill
- promo-videoSkill
- publish-report-artifactSkill
- seo-blogSkill
- seo-optimizationSkill
- usage-statuslineSkill
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 3 are distinctive, and 0 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
3
Distinctive
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 60
start fresh for unrelated work instead of extending a days-old session
- Distinctive: line 98
Do not send the user to their ISP on the strength of a latency reading alone.
- Distinctive: line 99
If ping to their own router is healthy, the line and the router are working, and a support call will measure a clean line and close the …
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Context Guard
Claude Code re-sends the whole conversation — every prior message and every tool result — on each turn. Prompt caching cuts server-side compute and cost, but not bytes on the wire: the client still serialises the full message array into every request. Upload volume therefore scales with total context size, not with the length of what was just typed. A 50-character prompt can push half a megabyte upstream.
A session left running for days sustains hundreds of KB/s upstream. That fills a consumer router's WAN queue, and once it is full every device on the network pays the queuing delay — including devices on Ethernet, which is why the symptom looks like a broken router. There is no built-in bandwidth readout and no metered mode (claude-code#55411).
Diagnose
Scan the running sessions:
"${CLAUDE_PLUGIN_ROOT}/scripts/scan-sessions.sh"Flag any session uploading above ~200 KB/s or whose newest log is over ~5 MB. Note its PID, uptime, directory and the SESSION column — that value is the id
claude --resumetakes. Sessions sharing a directory share the NEWEST-LOG figure, so treat it as the directory's worst case, not the PID's.Confirm the mechanism before blaming a session. Compare latency to the router against latency past it:
GW=$(route -n get default 2>/dev/null | awk '/gateway/ {print $NF}') [ -n "$GW" ] || GW=$(ip route show default 2>/dev/null | awk '{print $3; exit}') [ -n "$GW" ] && ping -c 20 -i 0.3 "$GW" || echo "no default gateway found — skip the router comparison" ping -c 20 -i 0.3 1.1.1.1Result Meaning Router ~1 ms, beyond it high and erratic Saturated uplink — bufferbloat. A busy session is a plausible cause Router also slow or lossy Local fault: Wi-Fi, cabling, or the router. A busy session is not the explanation Both fine Look elsewhere; do not blame a session on transcript size alone The signature of bufferbloat is a low minimum with a huge spread — for example
min 66 ms / avg 363 ms / max 1364 ms. The minimum proves the line can be fast; the spread is queue time.- Report what was measured, then recommend in this order:
/compactin the offending session — collapses context, keeps the thread- end and resume —
kill <pid>, thenclaude --resume <session-id>, where the session id is the SESSION column from the scan (it is the transcript's filename). Use plainkill;kill -9can cost the tail of the transcript, which is exactly what the user wanted to keep - start fresh for unrelated work instead of extending a days-old session
Install the always-on parts
The warning hook ships with this skill and runs automatically once the plugin is
installed: it fires on each prompt and speaks up every time the content
accumulated since the session's last compaction crosses another 5 MB step —
measuring from the last compact marker, not raw file size, so /compact
actually silences it until the context regrows.
The status line needs one manual step — a plugin cannot set the top-level
statusLine key, because Claude Code accepts only agent and
subagentStatusLine from a plugin's settings.json. See
references/setup.md for the exact snippet, the installed
path, and the configuration variables.
Interpreting the numbers
- What is re-uploaded every turn is the live context, not the transcript
file. The
.jsonlon disk is an append-only log —/compactwrites a summary record and the file keeps growing — so its size is an upper bound that overstates a compacted session. The hook measures content since the last compact marker; the status line reads live token counts. - Upload/s is a short sample and is bursty. A session reading 0 B/s between turns can still spike to hundreds of KB/s during one. Never conclude a session is idle from a single sample.
- The per-turn estimate is
total_input_tokens × 4 bytes, approximating the serialised request body. It excludes TCP retransmits, which add roughly 10% on a clean link and more on a lossy one. Treat it as an order of magnitude.
Constraints
scan-sessions.shreads only. Never kill a session without explicit confirmation — the user may have work in progress.nettopandlsofare macOS-only. On Linux the scan printsn/ain the UPLOAD/S column and falls back to log sizes; report it that way rather than as zero. The gateway lookup in step 2 covers bothroute(macOS) andip route(Linux).- Do not send the user to their ISP on the strength of a latency reading alone. If ping to their own router is healthy, the line and the router are working, and a support call will measure a clean line and close the ticket.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

