burnwatch 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +342 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +1151 -0
- package/dist/cli.js.map +1 -0
- package/dist/hooks/on-file-change.d.ts +1 -0
- package/dist/hooks/on-file-change.js +226 -0
- package/dist/hooks/on-file-change.js.map +1 -0
- package/dist/hooks/on-prompt.d.ts +1 -0
- package/dist/hooks/on-prompt.js +211 -0
- package/dist/hooks/on-prompt.js.map +1 -0
- package/dist/hooks/on-session-start.d.ts +1 -0
- package/dist/hooks/on-session-start.js +766 -0
- package/dist/hooks/on-session-start.js.map +1 -0
- package/dist/hooks/on-stop.d.ts +1 -0
- package/dist/hooks/on-stop.js +561 -0
- package/dist/hooks/on-stop.js.map +1 -0
- package/dist/index.d.ts +246 -0
- package/dist/index.js +573 -0
- package/dist/index.js.map +1 -0
- package/package.json +54 -0
- package/registry.json +330 -0
- package/skills/setup-burnwatch/SKILL.md +95 -0
- package/skills/spend/SKILL.md +25 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 burnwatch contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
# burnwatch
|
|
2
|
+
|
|
3
|
+
**Passive cost memory for vibe coding.**
|
|
4
|
+
|
|
5
|
+
burnwatch detects every paid service in your project, tracks what you're spending, and injects budget context directly into your AI coding sessions — so the agent knows what things cost before it recommends burning more money.
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
9
|
+
║ BURNWATCH — hullscore-app — March 2026 ║
|
|
10
|
+
╠══════════════════════════════════════════════════════════════╣
|
|
11
|
+
║ Service Spend Conf Budget Left ║
|
|
12
|
+
║ ────────────────────────────────────────────────────────── ║
|
|
13
|
+
║ Anthropic $47.20 ✅ LIVE $100 53% ║
|
|
14
|
+
║ Vercel $23.00 ✅ LIVE $50 54% ║
|
|
15
|
+
║ Scrapfly $127.00 ✅ LIVE $50 ⚠️ OVR ║
|
|
16
|
+
║ Browserbase ~$63.00 🟠 EST $75 16% ║
|
|
17
|
+
║ Supabase $25.00 ✅ LIVE $100 75% ║
|
|
18
|
+
║ PostHog ~$49.00 🟡 CALC $49 0% ║
|
|
19
|
+
╠══════════════════════════════════════════════════════════════╣
|
|
20
|
+
║ TOTAL: ~$334.20 Untracked: 0 ✅ Est margin: ±$20 ║
|
|
21
|
+
║ 🚨 SCRAPFLY 254% OVER BUDGET — review before use ║
|
|
22
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
This brief appears automatically at the start of every Claude Code session. You don't open a dashboard. You don't remember to check anything. You just see what you're spending.
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## Why
|
|
30
|
+
|
|
31
|
+
Agentic development lets you ship 10x faster. It also lets you burn through $400 in Scrapfly credits, rack up unexpected Browserbase bills, and discover PostHog overages three weeks after the code that caused them was written — by an agent, in a session you barely remember.
|
|
32
|
+
|
|
33
|
+
**78% of IT leaders experienced unexpected charges** tied to consumption-based or AI pricing in the past 12 months ([Zylo 2026 SaaS Management Index](https://zylo.com/research/saas-management-index/)).
|
|
34
|
+
|
|
35
|
+
Existing tools either cover one service (ccusage tracks Claude tokens), require enterprise pricing (CloudZero, Vantage), or demand you already know what you're spending on. Nobody watches how services enter your stack and tracks them from the moment of introduction.
|
|
36
|
+
|
|
37
|
+
burnwatch does.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# In any project
|
|
45
|
+
npx burnwatch init
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
That's it. burnwatch scans your project, detects paid services, creates a `.burnwatch/` directory, and registers Claude Code hooks. Next time you start a session, you see your spend.
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Quick Start
|
|
53
|
+
|
|
54
|
+
### 1. Initialize
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
cd your-project
|
|
58
|
+
npx burnwatch init
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
🔍 Scanning project for paid services...
|
|
63
|
+
|
|
64
|
+
Found 11 paid services:
|
|
65
|
+
|
|
66
|
+
• Anthropic (Claude) (✅ LIVE API available)
|
|
67
|
+
Detected via: package.json: @anthropic-ai/sdk, env vars: ANTHROPIC_API_KEY
|
|
68
|
+
• Vercel (✅ LIVE API available)
|
|
69
|
+
Detected via: package.json: @vercel/analytics, @vercel/functions
|
|
70
|
+
• Scrapfly (✅ LIVE API available)
|
|
71
|
+
Detected via: env vars: SCRAPFLY_KEY
|
|
72
|
+
• Supabase (✅ LIVE API available)
|
|
73
|
+
Detected via: package.json: @supabase/supabase-js
|
|
74
|
+
...
|
|
75
|
+
|
|
76
|
+
🔗 Registering Claude Code hooks...
|
|
77
|
+
✅ burnwatch initialized!
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### 2. Add API keys and budgets
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
# LIVE tracking — real billing API data
|
|
84
|
+
burnwatch add anthropic --key $ANTHROPIC_ADMIN_KEY --budget 100
|
|
85
|
+
burnwatch add scrapfly --key $SCRAPFLY_KEY --budget 50
|
|
86
|
+
burnwatch add vercel --token $VERCEL_TOKEN --budget 50
|
|
87
|
+
|
|
88
|
+
# CALC tracking — flat-rate services
|
|
89
|
+
burnwatch add posthog --plan-cost 0 --budget 0
|
|
90
|
+
burnwatch add inngest --plan-cost 25 --budget 25
|
|
91
|
+
|
|
92
|
+
# Just set a budget (tracking stays at detected tier)
|
|
93
|
+
burnwatch add browserbase --budget 75
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
API keys are stored in `~/.config/burnwatch/` (global, chmod 600). They never touch your project directory. They never end up in git.
|
|
97
|
+
|
|
98
|
+
### 3. Check your spend
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
burnwatch status
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
📊 Polling services...
|
|
106
|
+
|
|
107
|
+
╔══════════════════════════════════════════════════════════════╗
|
|
108
|
+
║ BURNWATCH — hullscore-app — March 2026 ║
|
|
109
|
+
╠══════════════════════════════════════════════════════════════╣
|
|
110
|
+
║ Service Spend Conf Budget Left ║
|
|
111
|
+
║ ────────────────────────────────────────────────────────── ║
|
|
112
|
+
║ Anthropic $47.20 ✅ LIVE $100 53% ║
|
|
113
|
+
║ Scrapfly $127.00 ✅ LIVE $50 ⚠️ OVR ║
|
|
114
|
+
║ Vercel $23.00 ✅ LIVE $50 54% ║
|
|
115
|
+
║ Supabase $25.00 ✅ LIVE $100 75% ║
|
|
116
|
+
║ PostHog ~$12.50 🟡 CALC $49 flat — on plan ║
|
|
117
|
+
║ Browserbase ~$63.00 🟠 EST $75 16% — caution ║
|
|
118
|
+
╠══════════════════════════════════════════════════════════════╣
|
|
119
|
+
║ TOTAL: ~$297.70 Untracked: 0 ✅ Est margin: ±$11 ║
|
|
120
|
+
║ 🚨 SCRAPFLY 254% OVER BUDGET — review before use ║
|
|
121
|
+
╚══════════════════════════════════════════════════════════════╝
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### 4. Start coding
|
|
125
|
+
|
|
126
|
+
Start a Claude Code session. The spend brief appears automatically. When you mention a tracked service in a prompt, a spend card is injected:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
You: "Use Scrapfly to scrape the competitor pricing pages"
|
|
130
|
+
|
|
131
|
+
[BURNWATCH] scrapfly — current period
|
|
132
|
+
Spend: $127.00 | Budget: $50 | ⚠️ 254% over
|
|
133
|
+
Confidence: ✅ LIVE
|
|
134
|
+
⚠️ 254% of budget consumed
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Claude now factors this into its response. It might suggest using Cheerio instead, or warn you about the cost before proceeding.
|
|
138
|
+
|
|
139
|
+
When a new paid service enters your project (new dependency, new env var, new import), burnwatch alerts immediately:
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
[BURNWATCH] 🆕 New paid service detected: resend
|
|
143
|
+
Run 'burnwatch add resend' to configure budget and tracking.
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
## How It Works
|
|
149
|
+
|
|
150
|
+
burnwatch runs as Claude Code hooks — background scripts that fire on session events. It never proxies your traffic. It never intercepts API calls. It watches the exhaust of your sessions the same way a court reporter watches a deposition: silently, completely, and without interrupting the work.
|
|
151
|
+
|
|
152
|
+
### Four Detection Surfaces
|
|
153
|
+
|
|
154
|
+
| Surface | What it catches | When it runs |
|
|
155
|
+
|---------|----------------|-------------|
|
|
156
|
+
| **Package manifest** | `@anthropic-ai/sdk` in dependencies | `init`, `reconcile`, file change |
|
|
157
|
+
| **Environment variables** | `SCRAPFLY_KEY` in process.env | Every session start |
|
|
158
|
+
| **Import statements** | `import { Resend } from "resend"` | `init`, file change |
|
|
159
|
+
| **Prompt mentions** | "use Browserbase to..." | Every prompt |
|
|
160
|
+
|
|
161
|
+
### Confidence Badges
|
|
162
|
+
|
|
163
|
+
Every spend figure carries an honest confidence badge:
|
|
164
|
+
|
|
165
|
+
| Badge | Meaning | How it works |
|
|
166
|
+
|-------|---------|-------------|
|
|
167
|
+
| ✅ **LIVE** | Real billing API data | Polls service API with your key |
|
|
168
|
+
| 🟡 **CALC** | Fixed monthly cost | You tell burnwatch your plan cost, it projects daily burn |
|
|
169
|
+
| 🟠 **EST** | Instrumented estimate | Usage signals + pricing formula from registry |
|
|
170
|
+
| 🔴 **BLIND** | Detected, not tracked | Service is in your project but no key or cost configured |
|
|
171
|
+
|
|
172
|
+
If burnwatch can't track a service accurately, it says so. The ledger always shows untracked count. You never get a clean dashboard hiding a surprise bill.
|
|
173
|
+
|
|
174
|
+
### Three Outputs
|
|
175
|
+
|
|
176
|
+
1. **Session brief** — injected at every session start. Full spend table, alerts, untracked count.
|
|
177
|
+
2. **Spend cards** — injected when you mention a tracked service. Current spend, budget status, confidence.
|
|
178
|
+
3. **New service alerts** — injected when a file change introduces a paid service you haven't configured.
|
|
179
|
+
|
|
180
|
+
### The Ledger
|
|
181
|
+
|
|
182
|
+
burnwatch writes `.burnwatch/spend-ledger.md` at the end of every session — human-readable, git-committable, designed to be read in 10 seconds:
|
|
183
|
+
|
|
184
|
+
```markdown
|
|
185
|
+
# Burnwatch Ledger — hullscore-app
|
|
186
|
+
Last updated: 2026-03-24T14:32:11Z
|
|
187
|
+
|
|
188
|
+
## This Month (March 2026)
|
|
189
|
+
| Service | Spend | Conf | Budget | Status |
|
|
190
|
+
|---------|-------|------|--------|--------|
|
|
191
|
+
| Anthropic | $47.20 | ✅ LIVE | $100 | 53% — healthy |
|
|
192
|
+
| Scrapfly | $127.00 | ✅ LIVE | $50 | ⚠️ 254% over |
|
|
193
|
+
| Vercel | $23.00 | ✅ LIVE | $50 | 54% — healthy |
|
|
194
|
+
| PostHog | ~$12.50 | 🟡 CALC | $49 | flat — on plan |
|
|
195
|
+
|
|
196
|
+
## TOTAL: ~$209.70 (±$2 estimated margin)
|
|
197
|
+
## Untracked services: 0
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Supported Services (v0.1)
|
|
203
|
+
|
|
204
|
+
| Service | Tier | Billing Model | Notes |
|
|
205
|
+
|---------|------|--------------|-------|
|
|
206
|
+
| Anthropic | ✅ LIVE | Per-token | Requires admin API key |
|
|
207
|
+
| OpenAI | ✅ LIVE | Per-token | Requires org API key |
|
|
208
|
+
| Vercel | ✅ LIVE | Compute + overages | Requires Vercel token |
|
|
209
|
+
| Scrapfly | ✅ LIVE | Credit pool | Standard API key works |
|
|
210
|
+
| Stripe | ✅ LIVE | % of transaction | Tracks processing fees |
|
|
211
|
+
| Supabase | ✅ LIVE | Tiered + overages | Management API |
|
|
212
|
+
| Browserbase | 🟠 EST | Per-session | Estimated from usage |
|
|
213
|
+
| Upstash | 🟠 EST | Per-command | Estimated from usage |
|
|
214
|
+
| Resend | 🟠 EST | Per-email | Estimated from sends |
|
|
215
|
+
| Inngest | 🟡 CALC | Tiered | User-entered plan cost |
|
|
216
|
+
| PostHog | 🟡 CALC | Tiered | User-entered plan cost |
|
|
217
|
+
| Google Gemini | 🟡 CALC | Per-token | User-entered budget |
|
|
218
|
+
| Voyage AI | 🟡 CALC | Per-token | User-entered budget |
|
|
219
|
+
| AWS | 🔴 BLIND | Varies | Detected, complex billing |
|
|
220
|
+
|
|
221
|
+
**Adding a new service?** Edit `registry.json` and open a PR. No release cycle required.
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Config Model
|
|
226
|
+
|
|
227
|
+
burnwatch uses a hybrid config model. Sensitive credentials never live in your project directory.
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
~/.config/burnwatch/
|
|
231
|
+
config.json ← API keys, tokens (chmod 600, never in git)
|
|
232
|
+
|
|
233
|
+
your-project/.burnwatch/
|
|
234
|
+
config.json ← Tracked services, budgets, detection history
|
|
235
|
+
spend-ledger.md ← Human-readable spend report (git-committable)
|
|
236
|
+
.gitignore ← Ignores cache/snapshots, keeps ledger and config
|
|
237
|
+
data/
|
|
238
|
+
events.jsonl ← Append-only event log
|
|
239
|
+
cache/ ← Billing API response cache
|
|
240
|
+
snapshots/ ← Point-in-time spend snapshots (for delta computation)
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## CLI Reference
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
burnwatch init # Initialize in current project
|
|
249
|
+
burnwatch add <service> [options] # Register a service
|
|
250
|
+
burnwatch status # Show current spend brief
|
|
251
|
+
burnwatch services # List all services in registry
|
|
252
|
+
burnwatch reconcile # Scan for untracked services
|
|
253
|
+
burnwatch help # Show help
|
|
254
|
+
burnwatch version # Show version
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### `burnwatch add` options
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
--key <API_KEY> # API key for LIVE tracking
|
|
261
|
+
--token <TOKEN> # Alias for --key
|
|
262
|
+
--budget <AMOUNT> # Monthly budget in USD
|
|
263
|
+
--plan-cost <AMOUNT> # Monthly plan cost (for CALC tracking)
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## How the Agent Changes Behavior
|
|
269
|
+
|
|
270
|
+
The real power isn't showing you what you spent — it's telling the agent what everything costs, in context, so cost becomes a factor in every recommendation.
|
|
271
|
+
|
|
272
|
+
When Claude sees `Scrapfly: $127 / $50 budget, 254% over` in its context, it:
|
|
273
|
+
|
|
274
|
+
- Suggests free alternatives (Cheerio, Playwright) before reaching for Scrapfly
|
|
275
|
+
- Warns before generating code that would make more Scrapfly API calls
|
|
276
|
+
- Factors cost into architecture decisions ("this approach would require ~200 more scrape calls")
|
|
277
|
+
- Acknowledges the budget constraint without you having to mention it
|
|
278
|
+
|
|
279
|
+
This feedback loop doesn't exist anywhere else today. The agent has cost memory.
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
283
|
+
## Reconciliation (Sessions Without burnwatch)
|
|
284
|
+
|
|
285
|
+
burnwatch doesn't need to be running in every session. It takes snapshots when it runs and computes deltas between them.
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
burnwatch reconcile
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
This re-scans your project for services that may have been introduced in sessions where burnwatch wasn't active (via git diffs, new packages, new env vars). Services get flagged and added to tracking.
|
|
292
|
+
|
|
293
|
+
For billing APIs that expose cumulative usage (like Scrapfly's credit counter), burnwatch computes the delta between its last snapshot and the current state — attributing spend across the gap even if it wasn't present for those sessions.
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## The Registry
|
|
298
|
+
|
|
299
|
+
`registry.json` is the community knowledge base. Each service entry includes:
|
|
300
|
+
|
|
301
|
+
```json
|
|
302
|
+
{
|
|
303
|
+
"scrapfly": {
|
|
304
|
+
"id": "scrapfly",
|
|
305
|
+
"name": "Scrapfly",
|
|
306
|
+
"packageNames": ["scrapfly-sdk", "scrapfly"],
|
|
307
|
+
"envPatterns": ["SCRAPFLY_KEY", "SCRAPFLY_API_KEY"],
|
|
308
|
+
"importPatterns": ["scrapfly"],
|
|
309
|
+
"mentionKeywords": ["scrapfly"],
|
|
310
|
+
"billingModel": "credit_pool",
|
|
311
|
+
"scalingShape": "linear_burndown",
|
|
312
|
+
"apiTier": "live",
|
|
313
|
+
"pricing": {
|
|
314
|
+
"formula": "credits_used * credit_usd_rate",
|
|
315
|
+
"unitRate": 0.00015,
|
|
316
|
+
"unitName": "credit"
|
|
317
|
+
},
|
|
318
|
+
"gotchas": [
|
|
319
|
+
"Anti-bot bypass options consume 5-25x base credits per request"
|
|
320
|
+
],
|
|
321
|
+
"alternatives": ["cheerio", "playwright", "firecrawl"],
|
|
322
|
+
"docsUrl": "https://scrapfly.io/docs/scrape-api/billing",
|
|
323
|
+
"lastVerified": "2026-03-24"
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
The `gotchas`, `alternatives`, and `scalingShape` fields aren't just metadata — the agent reads them and uses them to make better recommendations. Every PR that adds a service makes burnwatch smarter for every user.
|
|
329
|
+
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
## Requirements
|
|
333
|
+
|
|
334
|
+
- Node.js 18+
|
|
335
|
+
- Claude Code (for hooks integration)
|
|
336
|
+
- Works without Claude Code too — `burnwatch status` is a standalone CLI
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## License
|
|
341
|
+
|
|
342
|
+
MIT
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|