load-shedding

load-shedding is a command for Claude Code from luanpdd/kit-mcp. It costs 43 tokens per session (1,156 once invoked), scanned A, original, MIT.

A command that adds load-shedding protections to an Edge Function or HTTP request handler. Load shedding limits or rejects work when a service is overloaded.

In plain words
What is it for?
Use it to add concurrency limits, bounded queues, deadlines, rate limits, or slow-start behavior to request handlers.
Why use it?
It helps prevent a busy service from accepting more requests than it can handle and failing in a wider cascade.

Command for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: positional $N argument.

Good fit Use it to add concurrency limits, bounded queues, deadlines, rate limits, or slow-start behavior to request handlers.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/luanpdd/kit-mcp/load-shedding
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/luanpdd/kit-mcp

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for load-shedding

README.md
[![agentmods](https://agentmods.dev/badge/commands/luanpdd/kit-mcp/load-shedding.svg)](https://agentmods.dev/commands/luanpdd/kit-mcp/load-shedding)
Your own site
<a href="https://agentmods.dev/commands/luanpdd/kit-mcp/load-shedding"><img src="https://agentmods.dev/badge/commands/luanpdd/kit-mcp/load-shedding.svg" alt="Measured on agentmods" height="20"></a>
Per session 43 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,156 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00043 $0.01156
Opus 5 $0.00022 $0.00578
Sonnet 5 $0.00009 $0.00231
Haiku 4.5 $0.00004 $0.00116

Measured 4d ago against content hash 4e339d5c6821, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

load-shedding scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

kit/commands/load-shedding.md · 118 lines

How it starts

The opening of the file, as written. The whole thing — 118 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Cria/Atualiza:

  • Patches no target_path
  • supabase/functions/_shared/load-shedder.ts (se não existe)
  • supabase/functions/_shared/token-bucket.ts (se rate-limit aplicado)

Após: handler retorna 503 + Retry-After quando saturated, em vez de aceitar e cair. Defesa central contra cascade.

Exemplos:

/load-shedding supabase/functions/process-orders/index.ts
/load-shedding src/handlers/webhook.ts --max-concurrent 500
/load-shedding supabase/functions/api/index.ts --patterns concurrency-limit,deadline-aware

1. Parsear argumentos

TARGET_PATH=$(echo "$ARGUMENTS" | awk '{print $1}')
MAX_CONCURRENT=$(echo "$ARGUMENTS" | grep -oE -- '--max-concurrent [0-9]+' | awk '{print $2}')
QUEUE_MAX_SIZE=$(echo "$ARGUMENTS" | grep -oE -- '--queue-max-size [0-9]+' | awk '{print $2}')
PATTERNS=$(echo "$ARGUMENTS" | grep -oE -- '--patterns [^ ]+' | awk '{print $2}')

[ -z "$MAX_CONCURRENT" ] && MAX_CONCURRENT=1000
[ -z "$QUEUE_MAX_SIZE" ] && QUEUE_MAX_SIZE=10000

if [ -z "$TARGET_PATH" ]; then
  echo "ERROR: target_path obrigatório"
  exit 1
fi
[ ! -f "$TARGET_PATH" ] && { echo "ERROR: arquivo não encontrado"; exit 1; }

2. Dispatch para load-shedding-instrumenter

Task(
  subagent_type="load-shedding-instrumenter",
  prompt="
target_path: ${TARGET_PATH}
max_concurrent: ${MAX_CONCURRENT}
queue_max_size: ${QUEUE_MAX_SIZE}
${PATTERNS:+patterns: ${PATTERNS}}

Aplicar skill load-shedding-graceful-degradation. Patches:
1. Concurrency limit + 503 graceful (LoadShedder em _shared)
2. Deadline-aware handler (x-deadline-ms header parsing)
3. Queue bound + drop oldest (FIFO drop)
4. Server-side rate limit (token bucket per-client)
5. Slow start state machine (5 min ramp em recovery)

Verify compilação verde após patches. Output curto com lista de patches aplicados.
"
)

Read the full file on GitHub · 118 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 4d ago First seen · 118 lines · 43 tokens per session scan A 4e339d5c6821

Subscribe to this mod's changes

load-shedding is a command published in the GitHub repository luanpdd/kit-mcp (1 stars, last pushed yesterday), licensed MIT. It adds 43 tokens to every session and 1,156 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.