plan-llm-cost-guardrails — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited plan-llm-cost-guardrails (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Degree of freedom: HIGH — inventory call sites, score unbounded paths, plan. Stay plan-only. No limits or routing changes until approved.
| Skill | Owns |
|---|---|
| plan-llm-cost-guardrails (this) | Token / quota / runaway-loop plan |
audit-langfuse-llm | Quality and cost traces |
audit-infra-cost | Hosting / egress bill |
audit-llm-security | Unbounded consumption as an attack |
Propose: per-user daily token cap + hard daily-spend kill switch onlib/ai.ts. Risk: public/api/chatcan replay a 50K context until the bill dies; RPM-only does not count. Keep-working: summarizer path already setsmax_tokens. Phase: Phase 1 — caps & kill switch.
Role: Senior platform engineer (LLM spend + abuse resistance).
Task: Inventory every LLM call site, test against the 3-layer guardrail model, score unbounded paths, phase remediations, emit plan-llm-cost-guardrails.md. Audit & plan only — no limits or routing changes until approved.
Find every path to a runaway bill. Cap it. Change nothing until approved.
Token cost scales with input + output tokens, not request count — a single 50K-token context replayed three times can exhaust a budget while staying under any RPM cap. Vibe-coded AI features ship with no spend cap, no per-user quota, no output-token cap, no circuit breaker — compounded by prompt-injection cost amplification and forged-webhook quota fraud (the empty-signing-secret bypass class).
This is the prevention counterpart to Langfuse observability: Langfuse tells you what spend happened; this audits what's capped.
Trigger phrases: "cap my AI costs", "my LLM bill could explode", "rate limit my AI", "token budget", "someone could drain my quota", "runaway agent loop", "per-user AI limits", "pre-launch cost hardening".
Do not fire for: output quality/evals (audit-langfuse-llm), generic API performance, or trace visibility (plan-error-handling). This owns bounded spend.
max_tokens (Anthropic),max_completion_tokens or max_output_tokens (OpenAI); bound worst-case cost; truncate RAG context.
expensive model tier.
invisible: OpenAI Chat Completions sends it only with stream_options.include_usage; Anthropic sends it in message_start and cumulative message_delta events.
plan-input-validation.
plan-input-validation.audit-langfuse-llm; unauth AI input → plan-input-validationplan-llm-cost-guardrails.md# LLM Cost-Guardrail Audit — <repo>
_Audit-only. No limits or routing change until each phase is approved._
## Scope
- LLM call sites: n | Public AI endpoints: n | Langfuse present: ☐
## Verdict
| Layer | Present? | Worst gap |
|-------|----------|-----------|
| 1 Limits (token-aware) | partial | unbounded max_tokens |
| 2 Circuit breakers | ❌ | no daily kill switch |
| 3 Fallback chain | ❌ | limit = hard error |
## Findings
| # | Call site | Unbounded path | Worst-case | Missing layer | Sev | Direction |
|---|-----------|----------------|------------|---------------|-----|-----------|
## Phased burndown
- **Phase 1 — Caps & kill switch** → `backend-patterns`
- **Phase 2 — Circuit breakers** → `backend-patterns`
- **Phase 3 — Fallback chain** → `backend-patterns`
- **Phase 4 — Visibility** → `audit-langfuse-llm` / `backend-observability`
- **Cross-hand** → `plan-input-validation`
## Execution handoff
Simulate a runaway in test env after Phase 1; confirm cap holds before bill moves.plan-error-handling (visibility) andaudit-langfuse-llm (quality); this owns bounded spend.
backend-patterns, audit-langfuse-llm, backend-observability.Plan at high effort. Execute after approval at the default effort under approved-plan-execution.mdc (no reward hacking, no feature deletion).~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.