{
  "markdown": "<p align=\"center\">\n  <img src=\"assets/logo.png\" width=\"260\" alt=\"frugal — the guy who just found a $0.30 charge he does not recognize\" />\n</p>\n\n<h1 align=\"center\">frugal</h1>\n\n<p align=\"center\"><b>Cloud cost awareness for coding agents.</b></p>\n\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/package/@yuanbopang/frugal\"><img src=\"https://img.shields.io/npm/v/%40yuanbopang%2Ffrugal?color=cb3837&label=npm\" alt=\"npm\" /></a>\n  <a href=\"LICENSE\"><img src=\"https://img.shields.io/badge/license-MIT-green\" alt=\"MIT\" /></a>\n  <a href=\"https://github.com/yuanboP/frugal/actions/workflows/test.yml\"><img src=\"https://github.com/yuanboP/frugal/actions/workflows/test.yml/badge.svg\" alt=\"CI\" /></a>\n  <img src=\"https://img.shields.io/badge/services-22%20groups-blue\" alt=\"22 service groups\" />\n  <img src=\"https://img.shields.io/badge/hosts-11%2B-8A2BE2\" alt=\"11+ hosts\" />\n</p>\n\n<p align=\"center\">English | <a href=\"README.zh.md\">简体中文</a></p>\n\n---\n\nAgents deploy to Vercel, spin up Neon databases, run E2B sandboxes, push\ncommits that trigger GitHub Actions — all metered — and non-technical users\nonly find out on the monthly bill. frugal makes the agent spend consciously:\nsurface free-tier numbers and fail-open vs hard-pause on first touch, optional\nusage digs, one-line notice before lasting paid resources, and tear down of\nwhat it left running. It never blocks the command.\n\nWorks across Claude Code, Codex, GitHub Copilot, Qoder, Gemini CLI, OpenCode,\npi, Cursor, Windsurf, Cline, and Kiro — one ruleset, one source of truth.\n\n### Why a plugin, not “just tell the model to be careful”?\n\nLLMs ship with **frozen training-cut knowledge** of free tiers, defaults, and\n“how this cloud bills.” Cloud pricing and fail-open traps move every quarter\n(Workflows per-step billing, Spend Management notify-only, free-tier cliffs).\nThe model still “remembers” last year’s story.\n\nfrugal keeps the numbers and tripwires **in the repo** — versioned, researched,\ntestable — and injects them into the agent loop on each session / pre-CLI hit.\nUpdate the package (or pull the repo) and the loop gets **current billing**,\nnot whatever the weights last memorized.\n\n## How it saves you money\n\nTwo layers, both context-cheap (~1.7 KB of rules per session + at most 5\nfull reminders per day — after that, new services still get a numbers-only\nline — never blocking), with intensity levels like a volume knob:\n\n| Level | Session + inject | When to use |\n|---|---|---|\n| **quiet** | Free-tier / key quota numbers only | Hate noise but still want numbers |\n| **normal** (default) | Numbers + one trap; dig optional | Most people |\n| **strict** | + real-bill context; confirm scary actions | Non-technical / vibe-coding |\n\n- **Session rules** (SessionStart): one short line on first touch, announce\n  lasting paid resources, kill ephemeral things, escalate only for scary spend.\n- **Just-in-time data** (PreToolUse): `vercel` → short Vercel line,\n  `wrangler r2` → R2, `git push` with workflows → Actions — once per provider\n  per session. Horror-dollar amounts stay in **strict** (and the skill), not\n  every deploy.\n\nThis is scoped to **normal usage that quietly runs up a bill** — wrong\ntier, a forgotten resource, a loop that hits a paid meter, a config default\nnobody checked. Not credential leaks or fraud; that's a security problem,\nnot a billing-awareness one. Real incidents from the 272-story X corpus\nthis plugin internalizes — and the tripwire that now fires first:\n\n| Real bill | What happened | frugal tripwire |\n|---|---|---|\n| **$36,000/mo** | Cloudflare queue re-enqueue loop (3.13B KV writes) | `wrangler` → \"NO hard cap anywhere on CF — guard recursion\" |\n| **$104,000** | Netlify viral-traffic bill (pre-reform) | `netlify` → credits system + hard-pause explained |\n| **$46,000** | viral traffic hit Vercel; Spend Management only emailed | `vercel` → Spend Management notifies at $200 — enable auto-pause |\n| **$25,672** | GCP spend blew past a $10 budget (alerts lag 24-48h) | rule: **alerts are not brakes** — pair with quota caps |\n| **~$700/mo** | agent push loop running full CI on macOS runners | `git push` with workflows → timeout-minutes + concurrency + macOS≈10x |\n| **$5,000/mo** | Firestore useEffect read loop at 100 users | `firebase` → per-READ billing + maxInstances + recursion check |\n| **$1,200** | Claude CLI silently billing API instead of subscription | `claude` with `ANTHROPIC_API_KEY` set → dual-rail warning |\n\n## What it does\n\n**1. Session rules** — injected at session start (mode-scaled).\n\n**2. In-the-moment reminders** — PreToolUse watches shell commands. Mode\npicks how loud each hit is — once per provider per session, never blocking:\n\n```\n# normal (default) — free-tier numbers + one trap; dig optional\nfrugal: Vercel — Hobby (non-commercial): 1M inv + 1M edge reqs, 360 GB-hr mem,\n100 GB transfer, 100 deploys/day — hard-pauses ~30d at quota. Pro fails open.\nSpend Management defaults to notify-only at $200 — enable its auto-pause for\na real stop. Optional: `vercel usage`.\n```\n\n`brief` always carries the decisive free-tier numbers (what agent needs to\nreason). Horror dollars stay in **strict**. Dig is optional (skip if no creds).\nDetection is sub-service aware: `wrangler r2`, `gh workflow run`, `git push`\nwith workflows, dual-rail agent CLI when an API key is in the env.\n\n**3. Researched quota data** — the reminders and the skill's cheat-sheet\ncarry real numbers (researched 2026-07, dual-engine: parallel Claude web\nresearch + grok CLI runs per provider, cross-checked against official\npricing pages). Full plan tables, overage prices, cost traps, and sources:\n[`skills/frugal/references/providers.md`](skills/frugal/references/providers.md).\nThe complete raw research — both engines' reports per provider plus the\nmerged machine-readable factsheets — is archived in\n[`research/`](research/).\n\nCovered: Vercel, Cloudflare (Workers/R2/KV/D1), Neon, Railway, Fly.io, E2B,\nBrowserbase, GitHub (Actions/Codespaces), Supabase, AWS/GCP/Azure,\nTerraform/Pulumi.\n\n**4. `/frugal`** — cheat-sheet + spend audit. Levels:\n`/frugal quiet|normal|strict|off`, persist with `/frugal default <level>`,\nor set `FRUGAL_MODE` / `~/.config/frugal/config.json`.\n\n## Install\n\nnpm package: [`@yuanbopang/frugal`](https://www.npmjs.com/package/@yuanbopang/frugal)\n\n### Claude Code\n\n```\n/plugin marketplace add yuanboP/frugal\n/plugin install frugal\n```\n\nStart a new session; you should see `FRUGAL MODE ACTIVE — level: normal`.\n\n### Codex\n\n```\ncodex plugin marketplace add yuanboP/frugal\ncodex plugin add frugal@frugal\n```\n\nSame hooks, Codex-shaped output (detected via `PLUGIN_DATA`). Covers the\nCodex desktop app too — restart it after installing.\n\n### GitHub Copilot CLI\n\n```\ncopilot plugin marketplace add yuanboP/frugal\ncopilot plugin install frugal@frugal\n```\n\nOr the slash equivalents inside a session (`/plugin marketplace add ...`).\nSession-start injection via `hooks/copilot-hooks.json`.\n\n### grok\n\n```\ngrok plugin install https://github.com/yuanboP/frugal.git --trust\n```\n\nThe skill (rules + cheat-sheet) activates on billing/deploy topics; grok\ndoes not execute Claude-style lifecycle hooks.\n\n### Gemini CLI\n\n```\ngemini extensions install https://github.com/yuanboP/frugal\n```\n\nLoads `AGENTS.md` as always-on context via `gemini-extension.json`.\n\n### OpenCode\n\n```json\n{ \"plugin\": [\"@yuanbopang/frugal\"] }\n```\n\nOr from a checkout: `{ \"plugin\": [\"./.opencode/plugins/frugal.mjs\"] }`.\nAppends the ruleset every turn and registers the skills directory.\n\n### pi\n\n```\npi install git:github.com/yuanboP/frugal\n```\n\nInjects the ruleset via `before_agent_start`.\n\n### Cursor / Windsurf / Cline / Kiro\n\nStatic rule copies ship in `.cursor/rules/`, `.windsurf/rules/`,\n`.clinerules/`, `.kiro/steering/` — picked up automatically from a checkout.\nCursor user-level install: copy `.cursor/rules/frugal.mdc` to\n`~/.cursor/rules/`.\n\n### Qoder / CodeWhale / Swival (AGENTS.md hosts)\n\nThese auto-load `AGENTS.md` from the repo root — zero setup from a checkout.\nQoder can additionally wire the per-command reminder via\n`hooks/qoder-hooks.json`.\n\n## How it works\n\n| Piece | Role |\n|---|---|\n| `skills/frugal/SKILL.md` | On-demand cheat-sheet + full rules for explicit `/frugal` asks. |\n| `skills/frugal/references/providers.md` | Full researched quota/plan/trap tables with sources. |\n| `hooks/frugal-config.js` | Mode resolution: env → session flag → config file → `normal`. |\n| `hooks/frugal-runtime.js` | Host detection (env vars) + per-host hook output shapes. |\n| `hooks/frugal-activate.js` | SessionStart: inject mode-scaled AGENTS.md. |\n| `hooks/frugal-mode-tracker.js` | UserPromptSubmit: `/frugal quiet\\|normal\\|strict\\|off`. |\n| `hooks/frugal-pretool.js` | PreToolUse(Bash): mode-scaled reminder via `providers.js`. |\n| `hooks/providers.js` | Provider table: `brief` / `trap` / `horror` / `dig` layers. |\n| `AGENTS.md` | Compact ruleset — canonical body for static rule copies. |\n| `scripts/check-rule-copies.js` | Drift guard: static copies must equal AGENTS.md. |\n| `scripts/check-versions.js` | All 8 manifests share one version. |\n\n### Static rule copies\n\nEdit `AGENTS.md`, then regenerate:\n\n```bash\nBODY=$(cat AGENTS.md)\nprintf -- '---\\ndescription: Cloud cost awareness — spend consciously on metered services\\nglobs:\\nalwaysApply: true\\n---\\n\\n%s\\n' \"$BODY\" > .cursor/rules/frugal.mdc\nprintf -- '---\\ntitle: Frugal\\ninclusion: always\\n---\\n\\n%s\\n' \"$BODY\" > .kiro/steering/frugal.md\nfor f in .windsurf/rules/frugal.md .clinerules/frugal.md .qoder/rules/frugal.md .github/copilot-instructions.md .agents/rules/frugal.md; do printf -- '%s\\n' \"$BODY\" > \"$f\"; done\n```\n\n`npm test` fails if they drift.\n\n## Development\n\n```bash\nnpm test   # detection tests + rule-copy drift guard + version consistency\n```\n\nPipe-test the hooks directly:\n\n```bash\nnode hooks/frugal-activate.js\necho '{\"session_id\":\"t1\",\"tool_input\":{\"command\":\"npx vercel deploy\"}}' | node hooks/frugal-pretool.js\n```\n\n## License\n\nMIT\n",
  "bytes": 9926,
  "sha": "513644359148e097cbef6202e4462d28d9839619a8e907c59595b85f655e49af",
  "repo_slug": "yuanbop/frugal",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/plg_yuanbop_frugal_8a368812/readme"
}