burnoff 1.2.0 → 1.4.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.
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "burnoff",
3
+ "version": "1.4.0",
4
+ "description": "Deterministic circuit breakers, bounded file-read guards, Turn-0 CI linters, and PR spend gates for Claude Code.",
5
+ "author": {
6
+ "name": "Gizzant"
7
+ },
8
+ "license": "MIT",
9
+ "repository": "https://github.com/Gizzant/burnoff",
10
+ "commands": "./commands/"
11
+ }
@@ -30,13 +30,13 @@ jobs:
30
30
  if [ -s .burnoff-ci/provider-usage.json ]; then
31
31
  USAGE_FLAG="--provider-usage .burnoff-ci/provider-usage.json"
32
32
  fi
33
- npx -y burnoff@1.2.0 pr-cost --base "origin/${{ github.base_ref }}" $USAGE_FLAG --json --out .burnoff-ci/pr-cost.json
34
- npx -y burnoff@1.2.0 pr-cost --base "origin/${{ github.base_ref }}" $USAGE_FLAG --markdown --out .burnoff-ci/pr-cost.md
33
+ npx -y burnoff@1.4.0 pr-cost --base "origin/${{ github.base_ref }}" $USAGE_FLAG --json --out .burnoff-ci/pr-cost.json
34
+ npx -y burnoff@1.4.0 pr-cost --base "origin/${{ github.base_ref }}" $USAGE_FLAG --markdown --out .burnoff-ci/pr-cost.md
35
35
 
36
36
  - name: Enforce CI Token-Budget Gate
37
37
  id: gate
38
38
  run: |
39
- npx -y burnoff@1.2.0 ci-gate --input .burnoff-ci/pr-cost.json --strict --github-annotations --out .burnoff-ci/ci-gate.md
39
+ npx -y burnoff@1.4.0 ci-gate --input .burnoff-ci/pr-cost.json --strict --github-annotations --out .burnoff-ci/ci-gate.md
40
40
  cat .burnoff-ci/pr-cost.md >> "$GITHUB_STEP_SUMMARY"
41
41
  cat .burnoff-ci/ci-gate.md >> "$GITHUB_STEP_SUMMARY"
42
42
  echo "summary_path=.burnoff-ci/pr-cost.md" >> "$GITHUB_OUTPUT"
@@ -0,0 +1,37 @@
1
+ name: Burnoff Turn-0 Config & Rules Lint
2
+
3
+ on:
4
+ pull_request:
5
+ paths:
6
+ - 'CLAUDE.md'
7
+ - 'GEMINI.md'
8
+ - '.claude/**'
9
+ - '.agents/**'
10
+ - '.mcp.json'
11
+ - '.burnoff.yaml'
12
+ workflow_dispatch:
13
+
14
+ permissions:
15
+ contents: read
16
+
17
+ jobs:
18
+ startup-lint:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - name: Checkout repository
22
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
23
+
24
+ - name: Setup Node.js
25
+ uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
26
+ with:
27
+ node-version: '22'
28
+
29
+ - name: Run Repo-Local Turn-0 Startup Audit
30
+ # External consumers copying this workflow can use npx -y burnoff@1.4.0 directly.
31
+ run: |
32
+ if [ -f bin/burnoff.mjs ]; then
33
+ node bin/burnoff.mjs audit --startup --ci --github-annotations --client auto | tee burnoff-startup-lint.txt
34
+ else
35
+ npx -y burnoff@1.4.0 audit --startup --ci --github-annotations --client auto | tee burnoff-startup-lint.txt
36
+ fi
37
+ cat burnoff-startup-lint.txt >> "$GITHUB_STEP_SUMMARY"
package/README.md CHANGED
@@ -26,6 +26,9 @@ Burnoff runs locally via `PreToolUse` and `PostToolUse` hooks to bound oversized
26
26
  | **DET-04** (Runaway loop breaker) | Yes (`PostToolUse` / `PostToolUseFailure`) | Yes (`PostToolUse.error`) |
27
27
  | **DET-05** (Subagent fan-out & prompt-bloat guard) | Yes (`Task` / `Agent`, advisory by default) | Yes (`invoke_subagent`, advisory by default) |
28
28
  | **DET-06** (Bounded file-read clamp & overlap trim) | Yes (`updatedInput`) | Yes (`overwrite: { StartLine, EndLine }`) |
29
+ | **DET-07** (Bash stdout-flood & `Read`-clamp bypass guard) | Yes (`ask` by default) | Yes (`decision: ask \| deny`) |
30
+ | **DET-08** (Edit-time test-weakening & empty-catch guard) | Yes (`ask` by default) | Yes (`decision: ask \| deny`) |
31
+ | **DET-09** (Same-file rapid edit-thrash breaker) | Yes (`ask` after 5 edits/300s) | Yes (`decision: ask \| deny`) |
29
32
  | **`PostToolUse` FTS5 log archive & MCP output replacement** | MCP replacement + local FTS5 archive (built-in tool output is not replaced in `auto` mode) | **No** (`PostToolUse` returns `{}`) |
30
33
  | **Turn-0 startup audit (`burnoff audit --startup`)** | Yes | Yes (`GEMINI.md`, `AGENTS.md`, `.agents/`) |
31
34
  | **Local FinOps (`audit`, `pr-cost`, `ci-gate`)** | Yes | Yes (Gemini rate cards & `transcript.jsonl`) |
@@ -80,8 +83,10 @@ Measured directly on **Windows (`win32`, Node `v25.6.0`)** (reproduce locally wi
80
83
 
81
84
  Example measured `Read`-clamp (`DET-06`) run on an 800-line, `72,000`-byte (`~18,000` est. tokens) log file (`APP_SERVER.log`):
82
85
 
86
+ ![Burnoff DET-06 Read-clamp demo](docs/assets/read-clamp-demo.gif)
87
+
83
88
  - **Before clamp:** `800` lines / `72,000` bytes (`~18,000` est. tokens).
84
- - **After `PreToolUse` `updatedInput` (`offset: 1, limit: 182`):** `182` lines / `16,379` bytes (`~4,095` est. tokens) — **`~13,906` est. tokens (`77.3%`) saved** in a single intercepted `Read` while respecting the `16 KB` (`16,384` B) ceiling.
89
+ - **After `PreToolUse` `updatedInput` (`offset: 1, limit: 182`):** `182` lines / `16,379` bytes (`~4,095` est. tokens) — **`~13,905` est. tokens (`77.3%`) saved** in a single intercepted `Read` while respecting the `16 KB` (`16,384` B) ceiling.
85
90
 
86
91
  ## Local-Only Trust & Privacy
87
92
 
@@ -102,8 +107,8 @@ Burnoff runs 100% locally via hook subprocesses and local CLI commands:
102
107
  | `burnoff init [--dry-run]` | Wire `PreToolUse`, `PostToolUse`, and `PostToolUseFailure` hooks and update `.git/info/exclude`. |
103
108
  | `burnoff uninstall [--dry-run]` | Remove Burnoff hooks and `.git/info/exclude` block. |
104
109
  | `burnoff doctor [--gc] [--json]` | Inspect Node/SQLite FTS5, `.burnoff.yaml`, hook wiring, warm daemon, ledger, and prune >14d caches with `--gc`. |
105
- | `burnoff audit --startup [--json]` | Run the Turn-0 startup config linter across `.mcp.json`, Claude Code settings, and rule files. |
106
- | `burnoff audit [--session <file>] [--json]` | Parse local JSONL transcripts (`~/.claude/projects/`) and report per-session cost, cache hit %, and >200k-cliff turns. |
110
+ | `burnoff audit --startup [--json]` | Run the Turn-0 startup config linter across `.mcp.json`, Claude Code settings, rule files, and `BO-MCP-10` proxy/meta-tool checks. |
111
+ | `burnoff audit [--session <file>] [--otel <path>] [--json]` | Parse local JSONL transcripts, Antigravity conversation DBs, and `gen_ai.usage.*` OTel spans (`TTFT`, `tok/s`, cost, cache hit %). |
107
112
  | `burnoff pr-cost [--base main] [--provider-usage file.json]` | Correlate `git log <base>..HEAD` commits with session spend and output Markdown or `burnoff-pr-attribution/v1` JSON. |
108
113
  | `burnoff ci-gate --input pr-cost.json [--strict] [--github-annotations]` | Enforce `.burnoff.yaml` `ciBudgetGate` thresholds (`MAX_PR_COST_USD`, `MAX_PR_TOKENS`, `MIN_CACHE_HIT_PCT`, `MAX_WASTE_RATIO_PCT`, `MAX_RING0_VIOLATIONS`). |
109
114
  | `burnoff team-digest [--days 7]` | Output a 5-line weekly summary of local spend, cache efficiency, top cost driver, and guard savings. |
@@ -125,6 +130,14 @@ guards:
125
130
  subagentMaxBurstCount: 4
126
131
  subagentBurstWindowSec: 60
127
132
  subagentMaxPromptChars: 8000
133
+ det07Enabled: true
134
+ det07Action: ask
135
+ det08Enabled: true
136
+ det08Action: ask
137
+ det09Enabled: true
138
+ det09Action: ask
139
+ det09MaxEditsPerFile: 5
140
+ det09WindowSec: 300
128
141
 
129
142
  readClamp:
130
143
  enabled: true
@@ -147,14 +160,42 @@ ciBudgetGate:
147
160
  failOnMissingTranscripts: false
148
161
  ```
149
162
 
150
- See [`.github/workflows/burnoff-pr-gate.yml`](.github/workflows/burnoff-pr-gate.yml) for a SHA-pinned, least-privilege (`permissions: contents: read`) workflow built for `burnoff@1.2.0`:
163
+ See [`.github/workflows/burnoff-pr-gate.yml`](.github/workflows/burnoff-pr-gate.yml) for a SHA-pinned, least-privilege (`permissions: contents: read`) workflow built for `burnoff@1.4.0`:
151
164
 
152
- - Runs `npx -y burnoff@1.2.0 pr-cost` (automatically passing `--provider-usage .burnoff-ci/provider-usage.json` when present) to produce `.burnoff-ci/pr-cost.json` and `.burnoff-ci/pr-cost.md`.
153
- - Runs `npx -y burnoff@1.2.0 ci-gate --input .burnoff-ci/pr-cost.json --strict --github-annotations`.
165
+ - Runs `npx -y burnoff@1.4.0 pr-cost` (automatically passing `--provider-usage .burnoff-ci/provider-usage.json` when present) to produce `.burnoff-ci/pr-cost.json` and `.burnoff-ci/pr-cost.md`.
166
+ - Runs `npx -y burnoff@1.4.0 ci-gate --input .burnoff-ci/pr-cost.json --strict --github-annotations`.
154
167
  - Appends the Markdown breakdown to `$GITHUB_STEP_SUMMARY` and posts non-fork PR summary comments.
155
168
 
156
169
  > **Note on CI runners:** Ephemeral GitHub Actions runners do not have access to developers' local `~/.claude/projects/` transcripts. `failOnMissingTranscripts` automatically defaults to `true` when `CI` or `GITHUB_ACTIONS` is set (unless explicitly overridden in `.burnoff.yaml`), so upload `.burnoff-ci/provider-usage.json` or session transcripts before running `pr-cost` to enforce budgets cleanly.
157
170
 
171
+ ## Turn-0 CI Config Linting (`audit --startup --ci`)
172
+
173
+ See [`.github/workflows/burnoff-startup-lint.yml`](.github/workflows/burnoff-startup-lint.yml) for a SHA-pinned, repo-local workflow that lints `CLAUDE.md`, `GEMINI.md`, `.claude/**`, `.agents/**`, `.mcp.json`, and `.burnoff.yaml` on PRs without touching runner home directories:
174
+
175
+ ```bash
176
+ npx -y burnoff@1.4.0 audit --startup --ci --github-annotations --client auto
177
+ ```
178
+
179
+ Pass `--strict` to fail the workflow on warn-level lints as well as error-level secret/deprecated-model findings.
180
+
181
+ ## Temporary `ask` Overrides (`allow-once` & `snooze`)
182
+
183
+ When an interactive `ask` prompt (`DET-01` soft discard, `DET-02` public-cert/arg check, `DET-03` lockfile/workflow edit, `DET-04` loop pause, `DET-07` stdout-flood guard, `DET-08` edit-integrity guard, or `DET-09` edit-thrash breaker) blocks an intentional action:
184
+
185
+ ```bash
186
+ npx -y burnoff@1.4.0 allow-once DET-03 --scope deploy.yml
187
+ npx -y burnoff@1.4.0 allow-once DET-07 --scope "git log"
188
+ npx -y burnoff@1.4.0 snooze DET-04 --minutes 15
189
+ npx -y burnoff@1.4.0 allow-once --list
190
+ npx -y burnoff@1.4.0 allow-once --clear
191
+ ```
192
+
193
+ `allow-once` and `snooze` apply strictly to `ask` verdicts — Ring-0 `deny` / `exitCode: 2` hard blocks (`git push --force`, `.env`/credential reads, `strict`-mode blocks) are never bypassed.
194
+
195
+ ## Claude Code Plugin & Status Line
196
+
197
+ Burnoff includes `.claude-plugin/plugin.json`, the `/burnoff` slash command (`commands/burnoff.md`), and a fail-silent terminal status-line script (`scripts/burnoff-statusline.mjs`). See [`docs/CLAUDE_CODE_PLUGIN.md`](docs/CLAUDE_CODE_PLUGIN.md) for setup and [`docs/DESIGN_PARTNER_INTAKE.md`](docs/DESIGN_PARTNER_INTAKE.md) for the private MIT design-partner intake form.
198
+
158
199
  ## Environment Variables
159
200
 
160
201
  - `BURNOFF_HOME`: Override `~/.burnoff/` state directory.
package/bin/burnoff.mjs CHANGED
@@ -27,7 +27,7 @@ function getPackageVersion() {
27
27
  } catch (err) {
28
28
  void err; // ignore: package.json read fallback
29
29
  }
30
- return '1.2.0';
30
+ return '1.4.0';
31
31
  }
32
32
 
33
33
  const BOOLEAN_FLAGS = new Set([
@@ -38,6 +38,9 @@ const BOOLEAN_FLAGS = new Set([
38
38
  'github-annotations',
39
39
  'markdown',
40
40
  'startup',
41
+ 'ci',
42
+ 'list',
43
+ 'clear',
41
44
  'foreground',
42
45
  'skip-daemon',
43
46
  'global',
@@ -101,7 +104,9 @@ function formatHelp() {
101
104
  ' init [--client claude|antigravity|both|auto] [--global] [--dry-run] [--cwd <dir>] Install Burnoff hooks',
102
105
  ' uninstall [--client claude|antigravity|both|auto] [--global] [--dry-run] [--cwd <dir>] Remove Burnoff hooks',
103
106
  ' doctor [--gc] [--json] Run Node/SQLite/hooks/daemon/FTS5/ledger diagnostics',
104
- ' audit [--startup] [--client auto|claude|antigravity] [--session <file>] [--json] Audit transcripts or Turn-0 config',
107
+ ' audit [--startup [--ci] [--strict] [--github-annotations]] [--client auto|claude|antigravity|both] [--session <file>] [--otel <path>] [--json] Audit transcripts or Turn-0 config',
108
+ ' allow-once [DET-01..DET-04,DET-07..DET-09|*] [--scope <substr>] [--minutes <N>] [--session <id>] [--list|--clear] Temporary ask-gate override',
109
+ ' snooze [DET-01..DET-04,DET-07..DET-09|*] [--minutes 15] [--scope <substr>] [--session <id>] [--list|--clear] Timed ask-gate snooze',
105
110
  ' pr-cost [--base main] [--client auto|claude|antigravity|both] [--json|--markdown] Attribute branch commits to AI cost',
106
111
  ' export [--since <sha>] [--out <file>] Export PR attribution JSON for CI budget gate',
107
112
  ' ci-gate [--strict] [--github-annotations] Enforce .burnoff.yaml ciBudgetGate thresholds',
@@ -184,13 +189,36 @@ async function handleDoctor(flags, io) {
184
189
  async function handleAudit(flags, io) {
185
190
  const clientOpt = typeof flags.client === 'string' ? flags.client : 'auto';
186
191
  if (flags.startup) {
187
- const { runStartupAudit, formatStartupAuditReport } = await import('../src/cli/startup-audit.mjs');
192
+ const { runStartupAudit, formatStartupAuditReport, evaluateStartupAuditCi } = await import(
193
+ '../src/cli/startup-audit.mjs'
194
+ );
195
+ const cwd = flags.cwd || process.cwd();
196
+ const isCi = Boolean(flags.ci);
188
197
  const report = runStartupAudit({
189
- cwd: flags.cwd || process.cwd(),
198
+ cwd,
190
199
  homeDir: flags.home || undefined,
191
200
  days: flags.days ? Number(flags.days) : 7,
192
- client: clientOpt
201
+ client: clientOpt,
202
+ ci: isCi,
203
+ repoOnly: isCi
193
204
  });
205
+ if (isCi) {
206
+ const ciResult = evaluateStartupAuditCi(report, {
207
+ strict: Boolean(flags.strict),
208
+ cwd
209
+ });
210
+ report.ci = ciResult;
211
+ if (flags['github-annotations'] && Array.isArray(ciResult.annotations)) {
212
+ for (const line of ciResult.annotations) {
213
+ io.stdout.write(`${line}\n`);
214
+ }
215
+ }
216
+ const text = flags.json
217
+ ? JSON.stringify(report, null, 2) + '\n'
218
+ : `${formatStartupAuditReport(report)}CI Verdict: ${ciResult.verdict} (errors=${ciResult.errorCount}, warnings=${ciResult.warnCount}, strict=${ciResult.strict})\n`;
219
+ writeOut(text, flags.out, io.stdout);
220
+ return ciResult.exitCode;
221
+ }
194
222
  const text = flags.json ? JSON.stringify(report, null, 2) + '\n' : formatStartupAuditReport(report);
195
223
  writeOut(text, flags.out, io.stdout);
196
224
  return 0;
@@ -201,6 +229,7 @@ async function handleAudit(flags, io) {
201
229
  homeDir: flags.home || undefined,
202
230
  client: clientOpt,
203
231
  sessionPath: typeof flags.session === 'string' ? flags.session : undefined,
232
+ otelPath: typeof flags.otel === 'string' ? flags.otel : undefined,
204
233
  limit: flags.limit ? Number(flags.limit) : undefined
205
234
  });
206
235
  const text = flags.json ? JSON.stringify(report, null, 2) + '\n' : formatAuditReport(report);
@@ -437,6 +466,92 @@ async function handleDaemon(positionals, flags, io) {
437
466
  return 1;
438
467
  }
439
468
 
469
+ async function handleAllowOnce(cmd, positionals, flags, io) {
470
+ const {
471
+ normalizeSnoozeDetectorId,
472
+ grantAskSnoozeAtomicSync,
473
+ listActiveSnoozes,
474
+ clearAskSnoozesAtomicSync,
475
+ DEFAULT_ALLOW_ONCE_TTL_MS,
476
+ DEFAULT_SNOOZE_TTL_MS
477
+ } = await import('../src/guards/snooze.mjs');
478
+
479
+ const cwd = path.resolve(flags.cwd || process.cwd());
480
+ const homeDir = flags.home || undefined;
481
+ const sessionId = typeof flags.session === 'string' && flags.session.trim() ? flags.session.trim() : null;
482
+ const rawClient = typeof flags.client === 'string' ? flags.client.trim().toLowerCase() : 'claude';
483
+ const client = rawClient === 'antigravity' || rawClient === 'ag' ? 'antigravity' : 'claude-code';
484
+ const storeOpts = { cwd, homeDir, client };
485
+
486
+ const rawDetArg = positionals[1];
487
+ const detectorId = normalizeSnoozeDetectorId(rawDetArg === undefined ? '*' : rawDetArg);
488
+ if (!detectorId) {
489
+ io.stderr.write(`Invalid detector ID "${rawDetArg}". Expected DET-01..DET-04, DET-07..DET-09, all, or *.\n`);
490
+ return 1;
491
+ }
492
+
493
+ if (flags.list) {
494
+ const entries = listActiveSnoozes({ sessionId }, storeOpts);
495
+ if (flags.json) {
496
+ io.stdout.write(JSON.stringify({ ok: true, count: entries.length, snoozes: entries }, null, 2) + '\n');
497
+ } else if (entries.length === 0) {
498
+ io.stdout.write('No active Burnoff ask-gate snoozes.\n');
499
+ } else {
500
+ for (const e of entries) {
501
+ const remLabel = e.remaining === null ? 'timed' : `uses=${e.remaining}`;
502
+ io.stdout.write(
503
+ `[${e.source}] id=${e.id} detector=${e.detectorId} scope=${e.scope} ${remLabel} expires=${new Date(e.expiresAtMs).toISOString()}\n`
504
+ );
505
+ }
506
+ }
507
+ return 0;
508
+ }
509
+
510
+ if (flags.clear) {
511
+ const res = clearAskSnoozesAtomicSync(
512
+ { sessionId, detectorId: rawDetArg !== undefined ? detectorId : null },
513
+ storeOpts
514
+ );
515
+ if (flags.json) {
516
+ io.stdout.write(JSON.stringify(res, null, 2) + '\n');
517
+ } else {
518
+ io.stdout.write(`Cleared ${res.clearedCount} active Burnoff ask-gate snooze(s).\n`);
519
+ }
520
+ return 0;
521
+ }
522
+
523
+ const defaultTtlMin = cmd === 'snooze' ? DEFAULT_SNOOZE_TTL_MS / 60000 : DEFAULT_ALLOW_ONCE_TTL_MS / 60000;
524
+ const parsedMinutes = flags.minutes !== undefined ? Number(flags.minutes) : defaultTtlMin;
525
+ const ttlMs =
526
+ Number.isFinite(parsedMinutes) && parsedMinutes > 0
527
+ ? Math.round(parsedMinutes * 60 * 1000)
528
+ : cmd === 'snooze'
529
+ ? DEFAULT_SNOOZE_TTL_MS
530
+ : DEFAULT_ALLOW_ONCE_TTL_MS;
531
+ const count =
532
+ flags.count !== undefined
533
+ ? Math.max(1, Math.floor(Number(flags.count) || 1))
534
+ : cmd === 'snooze'
535
+ ? null
536
+ : 1;
537
+ const scope = typeof flags.scope === 'string' && flags.scope.trim() ? flags.scope.trim() : '*';
538
+ const reason = typeof flags.reason === 'string' ? flags.reason : '';
539
+
540
+ const res = grantAskSnoozeAtomicSync(
541
+ { sessionId, detectorId, scope, count, ttlMs, reason },
542
+ storeOpts
543
+ );
544
+ if (flags.json) {
545
+ io.stdout.write(JSON.stringify(res, null, 2) + '\n');
546
+ } else {
547
+ const modeLabel = res.grant.remaining === null ? 'timed snooze' : `allow-once (uses=${res.grant.remaining})`;
548
+ io.stdout.write(
549
+ `Granted ${modeLabel} for ${res.grant.detectorId} (scope=${res.grant.scope}, target=${res.target}, expires=${new Date(res.grant.expiresAtMs).toISOString()})\n`
550
+ );
551
+ }
552
+ return 0;
553
+ }
554
+
440
555
  /**
441
556
  * Dispatches Burnoff CLI commands and returns an exit code.
442
557
  */
@@ -471,6 +586,9 @@ export async function runCli(argv = process.argv.slice(2), io = { stdout: proces
471
586
  return handleDoctor(flags, io);
472
587
  case 'audit':
473
588
  return handleAudit(flags, io);
589
+ case 'allow-once':
590
+ case 'snooze':
591
+ return handleAllowOnce(cmd, positionals, flags, io);
474
592
  case 'pr-cost':
475
593
  return handlePrCost(flags, io);
476
594
  case 'export':
@@ -0,0 +1,16 @@
1
+ ---
2
+ description: Run Burnoff diagnostics, Turn-0 startup audits, ask-gate overrides, or PR spend digests
3
+ argument-hint: "[doctor|audit|startup|allow-once <DET-xx>|snooze <DET-xx>|pr-cost|team-digest|init]"
4
+ ---
5
+
6
+ Run Burnoff (`npx -y burnoff@1.4.0` or local `node bin/burnoff.mjs` when developing in the Burnoff repo) according to `$ARGUMENTS`:
7
+
8
+ - Empty arguments: run `burnoff doctor` and `burnoff team-digest --days 7` and summarize findings clearly.
9
+ - `doctor`: run `burnoff doctor` to verify Node/SQLite FTS5, hooks, and warm daemon health.
10
+ - `startup` or `audit --startup`: run `burnoff audit --startup --ci` for repo-local Turn-0 rule, secret, and MCP linting (or drop `--ci` to include local machine config).
11
+ - `audit`: run `burnoff audit --limit 10` across recent local transcripts.
12
+ - `allow-once ...` or `snooze ...`: run `burnoff $ARGUMENTS` to grant/list/clear temporary overrides for interactive `ask` gates (`DET-01`..`DET-04`, `DET-07`..`DET-09`; never bypasses `deny` hard blocks).
13
+ - `pr-cost` or `team-digest`: run `burnoff $ARGUMENTS` to inspect AI branch cost attribution or 7-day savings telemetry.
14
+ - `init`: run `burnoff init --client claude` to install/refresh `.claude/settings.local.json` hooks deterministically.
15
+
16
+ Keep the response concise and show exact command output numbers without guessing or extrapolating.
@@ -0,0 +1,67 @@
1
+ # Burnoff Claude Code Plugin & Status Line
2
+
3
+ Burnoff ships a lightweight Claude Code plugin manifest (`.claude-plugin/plugin.json`), the `/burnoff` slash command (`commands/burnoff.md`), and a zero-dependency status-line snippet (`scripts/burnoff-statusline.mjs`).
4
+
5
+ ## 1. Install Deterministic Hooks
6
+
7
+ Run the CLI installer in your repository (or pass `--global` for user-wide defaults):
8
+
9
+ ```bash
10
+ npx -y burnoff@1.4.0 init --client claude
11
+ ```
12
+
13
+ Why hooks are installed via `burnoff init` instead of a static hook file:
14
+
15
+ - `burnoff init` resolves node paths cleanly across Windows, macOS, and Linux and configures `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `SessionStart`, and `PreCompact`.
16
+ - Verify installation anytime with:
17
+
18
+ ```bash
19
+ npx -y burnoff@1.4.0 doctor
20
+ ```
21
+
22
+ ## 2. Enable `/burnoff` Slash Command
23
+
24
+ Load the plugin directory when testing locally:
25
+
26
+ ```bash
27
+ claude --plugin-dir /path/to/burnoff
28
+ ```
29
+
30
+ Or copy `commands/burnoff.md` into your project's `.claude/commands/` folder so team members get `/burnoff` automatically:
31
+
32
+ - `/burnoff` — run `doctor` + `team-digest --days 7`
33
+ - `/burnoff startup` — run Turn-0 repo-local linter (`audit --startup --ci`)
34
+ - `/burnoff allow-once DET-03 --scope deploy.yml` — grant a single-use `ask` override
35
+ - `/burnoff pr-cost` — inspect branch spend attribution
36
+
37
+ ## 3. Add Status-Line Telemetry Snippet
38
+
39
+ Add a `"statusLine"` entry to `.claude/settings.local.json` or `~/.claude/settings.json`:
40
+
41
+ ```json
42
+ {
43
+ "statusLine": {
44
+ "type": "command",
45
+ "command": "node /abs/path/to/burnoff/scripts/burnoff-statusline.mjs"
46
+ }
47
+ }
48
+ ```
49
+
50
+ Example terminal output (`<50 ms`, zero network calls, fail-silent):
51
+
52
+ ```text
53
+ burnoff | saved: 14.2k tok ($0.04) | guards: 2 | ctx: 38%
54
+ ```
55
+
56
+ ## 4. Temporary Overrides for `ask` Prompts
57
+
58
+ When interactive `ask` gates pause an intentional edit or command (`DET-01`, `DET-02`, `DET-03`, or `DET-04`), grant a scoped single-use or timed snooze from your terminal:
59
+
60
+ ```bash
61
+ npx -y burnoff@1.4.0 allow-once DET-03 --scope deploy.yml
62
+ npx -y burnoff@1.4.0 snooze DET-04 --minutes 15
63
+ npx -y burnoff@1.4.0 allow-once --list
64
+ npx -y burnoff@1.4.0 allow-once --clear
65
+ ```
66
+
67
+ Security invariant: `allow-once` and `snooze` apply **only** to `ask` decisions. Ring-0 `deny` / `exitCode: 2` hard blocks (`git push --force`, `.env`/credential reads, strict-mode blocks) are never bypassed.
@@ -0,0 +1,44 @@
1
+ # Burnoff Private Design-Partner Intake
2
+
3
+ Burnoff (`MIT`, zero runtime dependencies, 100% local execution) is onboarding a small cohort of engineering teams using Claude Code and/or Google Antigravity to validate Turn-0 CI config linting, bounded file-read savings, and PR cost gates on real repositories.
4
+
5
+ - **Cost & Terms:** Free open-source MIT CLI during design partnership — no public SaaS tier, no seat license keys, and zero external telemetry uploads without explicit export.
6
+ - **How to Submit:** Open a private discussion/issue on `https://github.com/Gizzant/burnoff/issues` marked `[Design Partner]` (sanitized — do **not** paste secrets or `.env` values), or email maintainers with the template below.
7
+
8
+ ---
9
+
10
+ ## Intake Questionnaire
11
+
12
+ ### 1. Team & Repository Profile
13
+ - **Organization / Team Name:**
14
+ - **GitHub Org / Repo Count:**
15
+ - **Primary Languages & Monorepo Layout:**
16
+ - **Active Coding Harnesses (check all):**
17
+ - [ ] Claude Code CLI / IDE
18
+ - [ ] Google Antigravity CLI / IDE
19
+ - [ ] GitHub Actions PR Workflows
20
+
21
+ ### 2. Current Failure Modes & Spend Hotspots (rank top 3)
22
+ - [ ] Oversized file reads blowing context (`Read` / `read_file`)
23
+ - [ ] Retry loops burning turns (`DET-04` repeated test/build failures)
24
+ - [ ] Turn-0 startup token tax (`CLAUDE.md` / `GEMINI.md` / eager MCP schemas / `BO-CFG-*`)
25
+ - [ ] Subagent fan-out or prompt bloat (`DET-05` / `BO-MCP-09`)
26
+ - [ ] PR cost visibility & CI budget enforcement (`pr-cost` / `ci-gate`)
27
+ - [ ] Destructive command / credential boundary incidents (`DET-01` / `DET-02`)
28
+
29
+ ### 3. Baseline Snapshot (optional, local-only commands)
30
+ Run inside a representative repo and paste sanitized summary lines only:
31
+
32
+ ```bash
33
+ npx -y burnoff@1.4.0 doctor
34
+ npx -y burnoff@1.4.0 audit --startup --ci
35
+ npx -y burnoff@1.4.0 team-digest --days 7
36
+ ```
37
+
38
+ ### 4. Security & Privacy Requirements
39
+ - **Strict air-gap / offline CI runner?** (Yes / No)
40
+ - **Strict JSON-only config requirement?** (`BO-CFG-01`) (Yes / No)
41
+ - **Custom `.burnoff.yaml` thresholds needed?**
42
+
43
+ ### 5. Success Criteria (30-Day Pilot)
44
+ What measurable outcome would make Burnoff a permanent default in your repos? (e.g., Turn-0 prefix tokens reduced, CI catches unignored secrets in `.claude/settings.local.json`, or zero runaway retry loops.)
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "burnoff",
3
- "version": "1.2.0",
3
+ "version": "1.4.0",
4
4
  "description": "Deterministic circuit breakers, bounded file-read guards, and CI spend gates for Claude Code and Google Antigravity.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "Gizzant",
8
8
  "repository": {
9
9
  "type": "git",
10
- "url": "https://github.com/Gizzant/burnoff.git"
10
+ "url": "git+https://github.com/Gizzant/burnoff.git"
11
11
  },
12
12
  "homepage": "https://github.com/Gizzant/burnoff#readme",
13
13
  "bugs": {
@@ -24,7 +24,7 @@
24
24
  "guardrails"
25
25
  ],
26
26
  "bin": {
27
- "burnoff": "./bin/burnoff.mjs"
27
+ "burnoff": "bin/burnoff.mjs"
28
28
  },
29
29
  "engines": {
30
30
  "node": ">=20.19.0"
@@ -33,7 +33,13 @@
33
33
  "bin/",
34
34
  "hooks/*.mjs",
35
35
  "src/",
36
+ ".claude-plugin/",
37
+ "commands/",
38
+ "scripts/",
36
39
  ".github/workflows/burnoff-pr-gate.yml",
40
+ ".github/workflows/burnoff-startup-lint.yml",
41
+ "docs/CLAUDE_CODE_PLUGIN.md",
42
+ "docs/DESIGN_PARTNER_INTAKE.md",
37
43
  "LICENSE",
38
44
  "README.md"
39
45
  ],
@@ -42,6 +48,6 @@
42
48
  "test": "node --test --test-concurrency=1",
43
49
  "test:bench": "node --test test/ipc-daemon-bench.test.mjs",
44
50
  "doctor": "node bin/burnoff.mjs doctor",
45
- "check:brands": "node -e \"import('node:fs').then(async fs=>{const p=await import('node:path');const bad=new RegExp(['ctx'+'top','high'+'beam','attention[-_]'+'horizon','ga-visual'+'izer-v2','pro_'+'license','ah-status'+'line','\\\\bHB'+'-(?:CFG|MCP|SEC)-','\\\\ba'+'gy','default'+'_api:','phase0'+'_' ].join('|'),'i');const dirs=['bin','hooks','src','.github'];let hits=[];const walk=(d)=>{if(!fs.existsSync(d))return;for(const e of fs.readdirSync(d,{withFileTypes:true})){const f=p.join(d,e.name);if(e.isDirectory())walk(f);else if(/\\.(mjs|json|ya?ml|md)$/.test(e.name)){const t=fs.readFileSync(f,'utf8');if(bad.test(t))hits.push(f);}}};dirs.forEach(walk);['package.json','README.md'].forEach(f=>{if(fs.existsSync(f)&&bad.test(fs.readFileSync(f,'utf8')))hits.push(f);});if(hits.length){console.error('Brand leaks:',hits);process.exit(1);}console.log('Zero legacy brand strings found.');})\""
51
+ "check:brands": "node -e \"import('node:fs').then(async fs=>{const p=await import('node:path');const bad=new RegExp(['ctx'+'top','high'+'beam','attention[-_]'+'horizon','ga-visual'+'izer-v2','pro_'+'license','ah-status'+'line','\\\\bHB'+'-(?:CFG|MCP|SEC)-','\\\\ba'+'gy','default'+'_api:','phase0'+'_' ].join('|'),'i');const dirs=['bin','hooks','src','.github','.claude-plugin','commands','scripts'];let hits=[];const walk=(d)=>{if(!fs.existsSync(d))return;for(const e of fs.readdirSync(d,{withFileTypes:true})){const f=p.join(d,e.name);if(e.isDirectory())walk(f);else if(/\\.(mjs|json|ya?ml|md)$/.test(e.name)){const t=fs.readFileSync(f,'utf8');if(bad.test(t))hits.push(f);}}};dirs.forEach(walk);['package.json','README.md','docs/CLAUDE_CODE_PLUGIN.md','docs/DESIGN_PARTNER_INTAKE.md'].forEach(f=>{if(fs.existsSync(f)&&bad.test(fs.readFileSync(f,'utf8')))hits.push(f);});if(hits.length){console.error('Brand leaks:',hits);process.exit(1);}console.log('Zero legacy brand strings found.');})\""
46
52
  }
47
53
  }
@@ -0,0 +1,104 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * @file scripts/burnoff-statusline.mjs
4
+ * Zero-dependency, fail-silent status-line renderer for Claude Code `settings.json` `"statusLine"`.
5
+ * Summarizes Burnoff ledger savings + guard interventions alongside live stdin context metrics.
6
+ */
7
+
8
+ import fs from 'node:fs';
9
+ import { readLedgerSummary } from '../src/storage/ledger.mjs';
10
+ import { isCliEntrypoint } from '../hooks/hook-io.mjs';
11
+
12
+ function formatCompactTokens(tokens = 0) {
13
+ const n = Math.max(0, Number(tokens || 0));
14
+ if (n >= 1_000_000) return `${(n / 1_000_000).toFixed(1)}M`;
15
+ if (n >= 1_000) return `${(n / 1_000).toFixed(1)}k`;
16
+ return String(Math.round(n));
17
+ }
18
+
19
+ function formatUsd(usd = 0) {
20
+ const n = Math.max(0, Number(usd || 0));
21
+ return `$${n.toFixed(2)}`;
22
+ }
23
+
24
+ /**
25
+ * Renders a single compact terminal status line from Claude Code stdin JSON + Burnoff ledger.
26
+ */
27
+ export function renderBurnoffStatusLine(inputJson = {}, options = {}) {
28
+ const payload = inputJson && typeof inputJson === 'object' ? inputJson : {};
29
+ const cwd = options.cwd || payload.workspace?.current_dir || payload.cwd || process.cwd();
30
+ const homeDir = options.homeDir;
31
+
32
+ let summary = null;
33
+ try {
34
+ summary = readLedgerSummary({
35
+ cwd,
36
+ homeDir,
37
+ windowDays: options.windowDays ?? 7,
38
+ nowMs: options.nowMs
39
+ });
40
+ } catch {
41
+ summary = null; // ignore: unreadable ledger fails silent on statusLine
42
+ }
43
+
44
+ const savedTokens = Number(summary?.totalSavedTokens || 0);
45
+ const savedUsd = Number(summary?.totalSavedUSD || 0);
46
+ const guardCount = Number(summary?.categories?.loopAndReadGuarded?.count || 0);
47
+
48
+ const parts = [
49
+ `burnoff`,
50
+ `saved: ${formatCompactTokens(savedTokens)} tok (${formatUsd(savedUsd)})`,
51
+ `guards: ${guardCount}`
52
+ ];
53
+
54
+ const usedPct = Number(payload.context_window?.used_percentage);
55
+ if (Number.isFinite(usedPct) && usedPct >= 0) {
56
+ parts.push(`ctx: ${Math.round(usedPct)}%`);
57
+ }
58
+
59
+ const sessionCost = Number(payload.cost?.total_cost_usd);
60
+ if (Number.isFinite(sessionCost) && sessionCost > 0) {
61
+ parts.push(`sess: ${formatUsd(sessionCost)}`);
62
+ }
63
+
64
+ const telemetryOpt = options.telemetry || payload.telemetry || payload.metrics || {};
65
+ const ttftMs = Number(
66
+ telemetryOpt.medianTtftMs ?? telemetryOpt.ttftMs ?? telemetryOpt.ttft_ms ?? payload.ttft_ms ?? payload.ttftMs
67
+ );
68
+ if (Number.isFinite(ttftMs) && ttftMs > 0) {
69
+ const ttftLabel = ttftMs >= 1000 ? `${(ttftMs / 1000).toFixed(1)}s` : `${Math.round(ttftMs)}ms`;
70
+ parts.push(`ttft: ${ttftLabel}`);
71
+ }
72
+
73
+ const tokensPerSec = Number(
74
+ telemetryOpt.medianTokensPerSec ??
75
+ telemetryOpt.tokensPerSec ??
76
+ telemetryOpt.tokens_per_sec ??
77
+ payload.tokens_per_sec ??
78
+ payload.tokensPerSec
79
+ );
80
+ if (Number.isFinite(tokensPerSec) && tokensPerSec > 0) {
81
+ parts.push(`${tokensPerSec.toFixed(1)} tok/s`);
82
+ }
83
+
84
+ return parts.join(' | ');
85
+ }
86
+
87
+ function readStdinSyncSafe() {
88
+ try {
89
+ const raw = fs.readFileSync(0, 'utf8').trim();
90
+ if (!raw) return {};
91
+ return JSON.parse(raw);
92
+ } catch {
93
+ return {}; // ignore: malformed or empty stdin falls back cleanly
94
+ }
95
+ }
96
+
97
+ if (isCliEntrypoint(import.meta.url)) {
98
+ const stdinPayload = readStdinSyncSafe();
99
+ process.stdout.write(`${renderBurnoffStatusLine(stdinPayload)}\n`);
100
+ }
101
+
102
+ export default {
103
+ renderBurnoffStatusLine
104
+ };