burnoff 1.4.1 → 2.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.
Files changed (62) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.github/workflows/burnoff-pr-gate.yml +5 -3
  3. package/.github/workflows/burnoff-startup-lint.yml +2 -2
  4. package/CHANGELOG.md +74 -0
  5. package/README.md +187 -213
  6. package/SECURITY.md +38 -0
  7. package/bin/burnoff.mjs +307 -32
  8. package/commands/burnoff.md +6 -4
  9. package/docs/CLAUDE_CODE_PLUGIN.md +29 -28
  10. package/docs/DESIGN_PARTNER_INTAKE.md +3 -3
  11. package/hooks/hook-io.mjs +216 -11
  12. package/hooks/hooks.json +44 -0
  13. package/hooks/post-tool-use.mjs +3 -1
  14. package/hooks/pre-tool-use.mjs +47 -8
  15. package/hooks/session-lifecycle.mjs +24 -3
  16. package/hooks/user-prompt-submit.mjs +98 -0
  17. package/package.json +6 -4
  18. package/scripts/bench-hooks.mjs +34 -3
  19. package/scripts/bench-savings.mjs +318 -0
  20. package/scripts/burnoff-statusline.mjs +138 -6
  21. package/src/ci/ci-gate.mjs +199 -13
  22. package/src/ci/pr-cost.mjs +417 -45
  23. package/src/ci/pr-summary.mjs +467 -0
  24. package/src/cli/audit.mjs +179 -28
  25. package/src/cli/doctor.mjs +32 -6
  26. package/src/cli/hook-health.mjs +9 -1
  27. package/src/cli/init.mjs +226 -39
  28. package/src/cli/preview.mjs +299 -0
  29. package/src/cli/startup-audit/formatter.mjs +248 -0
  30. package/src/cli/startup-audit/jsonc.mjs +601 -0
  31. package/src/cli/startup-audit/mcp-audit.mjs +735 -0
  32. package/src/cli/startup-audit/rules-hygiene.mjs +645 -0
  33. package/src/cli/startup-audit/telemetry-scan.mjs +975 -0
  34. package/src/cli/startup-audit.mjs +451 -2471
  35. package/src/clients/claude-code.mjs +41 -4
  36. package/src/config/catalog.json +295 -0
  37. package/src/config/effort.mjs +145 -0
  38. package/src/config/harness-quirks.mjs +340 -0
  39. package/src/config/loader.mjs +27 -2
  40. package/src/config/policy.mjs +81 -9
  41. package/src/config/pricing.mjs +247 -19
  42. package/src/config/semver.mjs +25 -0
  43. package/src/config/uncached-attribution.mjs +280 -41
  44. package/src/guards/compaction-baton.mjs +248 -0
  45. package/src/guards/loop-breaker.mjs +328 -47
  46. package/src/guards/model-switch-hook.mjs +126 -0
  47. package/src/guards/phase5-detectors.mjs +275 -21
  48. package/src/guards/post-tool-engine.mjs +333 -11
  49. package/src/guards/pre-tool-engine.mjs +607 -45
  50. package/src/guards/prefix-guard.mjs +609 -0
  51. package/src/guards/prompt-guard.mjs +309 -0
  52. package/src/guards/read-clamp.mjs +192 -8
  53. package/src/guards/session-hook.mjs +149 -7
  54. package/src/guards/shell-guard.mjs +56 -5
  55. package/src/guards/snooze.mjs +169 -5
  56. package/src/ipc/daemon.mjs +76 -0
  57. package/src/ipc/fast-client.mjs +165 -4
  58. package/src/ipc/protocol.mjs +16 -3
  59. package/src/storage/antigravity-parser.mjs +16 -2
  60. package/src/storage/file-lock.mjs +16 -3
  61. package/src/storage/jsonl-parser.mjs +133 -22
  62. package/src/storage/telemetry-metrics.mjs +254 -4
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "burnoff",
3
- "version": "1.4.1",
3
+ "version": "2.1.0",
4
4
  "description": "Deterministic circuit breakers, bounded file-read guards, Turn-0 CI linters, and PR spend gates for Claude Code.",
5
5
  "author": {
6
6
  "name": "Gizzant"
@@ -23,6 +23,8 @@ jobs:
23
23
  with:
24
24
  node-version: '22'
25
25
 
26
+ # If .burnoff-ci/pr-summary.json (exported locally via `burnoff pr-cost --write-summary`)
27
+ # is committed in the PR branch, `pr-cost` automatically hydrates and verifies it with zero secrets.
26
28
  - name: Compute PR Cost Attribution
27
29
  run: |
28
30
  mkdir -p .burnoff-ci
@@ -30,13 +32,13 @@ jobs:
30
32
  if [ -s .burnoff-ci/provider-usage.json ]; then
31
33
  USAGE_FLAG="--provider-usage .burnoff-ci/provider-usage.json"
32
34
  fi
33
- npx -y burnoff@1.4.1 pr-cost --base "origin/${{ github.base_ref }}" $USAGE_FLAG --json --out .burnoff-ci/pr-cost.json
34
- npx -y burnoff@1.4.1 pr-cost --base "origin/${{ github.base_ref }}" $USAGE_FLAG --markdown --out .burnoff-ci/pr-cost.md
35
+ npx -y burnoff@2.1.0 pr-cost --base "origin/${{ github.base_ref }}" $USAGE_FLAG --json --out .burnoff-ci/pr-cost.json
36
+ npx -y burnoff@2.1.0 pr-cost --base "origin/${{ github.base_ref }}" $USAGE_FLAG --markdown --out .burnoff-ci/pr-cost.md
35
37
 
36
38
  - name: Enforce CI Token-Budget Gate
37
39
  id: gate
38
40
  run: |
39
- npx -y burnoff@1.4.1 ci-gate --input .burnoff-ci/pr-cost.json --strict --github-annotations --out .burnoff-ci/ci-gate.md
41
+ npx -y burnoff@2.1.0 ci-gate --input .burnoff-ci/pr-cost.json --strict --github-annotations --out .burnoff-ci/ci-gate.md
40
42
  cat .burnoff-ci/pr-cost.md >> "$GITHUB_STEP_SUMMARY"
41
43
  cat .burnoff-ci/ci-gate.md >> "$GITHUB_STEP_SUMMARY"
42
44
  echo "summary_path=.burnoff-ci/pr-cost.md" >> "$GITHUB_OUTPUT"
@@ -27,11 +27,11 @@ jobs:
27
27
  node-version: '22'
28
28
 
29
29
  - name: Run Repo-Local Turn-0 Startup Audit
30
- # External consumers copying this workflow can use npx -y burnoff@1.4.1 directly.
30
+ # External consumers copying this workflow can use npx -y burnoff@2.1.0 directly.
31
31
  run: |
32
32
  if [ -f bin/burnoff.mjs ]; then
33
33
  node bin/burnoff.mjs audit --startup --ci --github-annotations --client auto | tee burnoff-startup-lint.txt
34
34
  else
35
- npx -y burnoff@1.4.1 audit --startup --ci --github-annotations --client auto | tee burnoff-startup-lint.txt
35
+ npx -y burnoff@2.1.0 audit --startup --ci --github-annotations --client auto | tee burnoff-startup-lint.txt
36
36
  fi
37
37
  cat burnoff-startup-lint.txt >> "$GITHUB_STEP_SUMMARY"
package/CHANGELOG.md ADDED
@@ -0,0 +1,74 @@
1
+ # Changelog
2
+
3
+ ## [2.1.0] - 2026-11-28
4
+
5
+ ### Added
6
+ - **Zero-Secret PR Usage Summary Export & Ephemeral CI Runner Hydration (`burnoff-pr-summary/v1`)** (`src/ci/pr-summary.mjs`, `src/ci/pr-cost.mjs`, `src/ci/ci-gate.mjs`, `bin/burnoff.mjs`, `test/pr-summary-sync.test.mjs`):
7
+ - Added `burnoff pr-cost --write-summary [file]` (default `.burnoff-ci/pr-summary.json`) to export a zero-prompt, zero-secret PR usage summary with allowlisted metrics, stripped OS home paths, `.claude/settings.local.json` and `author`/`sessionId` removal, credential redaction via `redactSecretsPure`, and a canonical SHA-256 `integrity.digest`.
8
+ - Wired automatic `.burnoff-ci/pr-summary.json` hydration into `buildPrCostAttribution` when ephemeral CI runners have zero local transcripts, alongside explicit `--summary <file>` on `pr-cost` and `ci-gate`, `burnoff-pr-summary/v1` verification inside `ci-gate --input`, fail-closed `SUMMARY_INTEGRITY_MISMATCH` tamper rejection, `STALE_PR_SUMMARY` `HEAD`-drift notice, `wasteRatioBasis` override support, and `--provider-usage` reconciliation on hydrated summaries.
9
+
10
+ ## [2.0.0] - 2026-11-28
11
+
12
+ ### Summary
13
+ Major `v2.0.0` release delivering zero-commitment 3-second onboarding (`npx burnoff`), sub-15 ms auto-managed warm daemon IPC, quiet Friction defaults with `pause`/`bypass` escape hatches, cross-OS `npm pack` E2E verification, Turn-0 startup linting, modularized audit architecture, and automated PR cost gates.
14
+
15
+ ### Added
16
+ - **Zero-Commitment 3-Second Preview (`npx burnoff` / `burnoff preview`)** (`src/cli/preview.mjs`, `src/storage/jsonl-parser.mjs`, `bin/burnoff.mjs`): running bare `npx burnoff` scans recent local Claude Code and Antigravity sessions strictly read-only (zero disk writes, cache writes bypassed via `readOnly: true`) and prints a <=72-col savings & top-waste receipt in under 3 seconds.
17
+ - **Auto-Managed Warm IPC Daemon (`<15 ms` hot path)** (`src/ipc/daemon.mjs`, `src/ipc/fast-client.mjs`, `hooks/session-lifecycle.mjs`, `src/guards/loop-breaker.mjs`): `SessionStart` lazily spawns a workspace-scoped background daemon (`15m` idle auto-reap, `30s` lock cooldown, `BURNOFF_NO_AUTO_DAEMON=1` opt-out) and removes redundant `fsyncSync` on ephemeral read/breaker snapshots (`skipFsync: true`).
18
+ - **Workspace Escape Hatches (`burnoff pause` & `burnoff bypass`)** (`src/guards/snooze.mjs`, `src/guards/pre-tool-engine.mjs`, `bin/burnoff.mjs`): `burnoff pause [15m|1h|status|off]` soft-pauses interactive `ask` gates, read clamps, and non-Ring-0 advisories while keeping Ring-0 `deny` / `exitCode: 2` hard blocks (`DET-01`, `DET-02`, `DET-20`) enforced; `burnoff bypass [--grant <substr> | -- <cmd...>]` grants 1-use `DET-07` overrides or runs commands directly outside hook clamps.
19
+ - **Auto-Wired Status Line & PAUSED / Compact USD Display** (`scripts/burnoff-statusline.mjs`, `src/cli/init.mjs`): `burnoff init` automatically wires `statusLine` when no custom user footer exists (`--no-statusline` to skip; cleanly removed on `uninstall`); displays `7d saved: X tok`, suppresses `<$0.10` USD clutter, and appends `PAUSED Nm` during workspace pause windows.
20
+ - **Modularized Turn-0 Auditor & Security Disclosure** (`src/cli/startup-audit.mjs`, `src/cli/startup-audit/*.mjs`, `SECURITY.md`): split `startup-audit` into 5 focused acyclic submodules (`jsonc.mjs`, `rules-hygiene.mjs`, `mcp-audit.mjs`, `telemetry-scan.mjs`, `formatter.mjs`) preserving 100% public exports, and added `SECURITY.md` documenting local-only execution, secret/path scrubbing, and fail-closed Ring-0 guarantees.
21
+ - **Cross-OS `npm pack` E2E & Pricing Regression Locks** (`test/e2e-pack-npx.test.mjs`, `.github/workflows/ci.yml`, `test/prelaunch-bugfixes.test.mjs`): added `macos-latest` to the CI matrix and packed-tarball E2E tests covering Windows/macOS/Linux space-containing paths, real hook execution, global isolation, and zero `TODO(verify)` pricing entries.
22
+ - **Reproducible Benchmarks & Launch Kit** (`scripts/bench-savings.mjs`, `docs/BENCHMARKS.md`, `SPONSORS.md`, `.github/FUNDING.yml`): added reproducible 4-workload savings & latency benchmarks alongside MIT Core pledge and sponsorship docs.
23
+ - **Phase 11 (`omitClaudeMd`, trigger-hijack, GPT-6.x pricing, `#1890` split, `BO-CMP-01` laundering & `DET-01` worktree/`trash`)**:
24
+ - **Subagent `omitClaudeMd: true` coaching (`BO-CFG-18`)** (`src/cli/startup-audit.mjs`): `scanClaudeCustomAgentSpecs` parses `omitClaudeMd` and role hints, emitting an `info` advisory when lookup/search/log-reading custom subagents spawn on Claude Code `>= v2.1.271` with large root `CLAUDE.md` (`>= 1,500` tokens), excluding `Explore`/`Plan` and code reviewers/writers.
25
+ - **`SKILL.md` frontmatter trigger-hijack detection (`BO-CFG-16`)** (`src/cli/startup-audit.mjs`): warns on global over-trigger routing imperatives (`MUST be used BEFORE`, `for ANY request`, `ALWAYS invoke ... first`, `BEFORE web search / model memory / any other skill`) without matching generic `overrides the default ...` phrases.
26
+ - **OpenAI GPT-6.x pricing cards (`gpt-6.1-terra`, `gpt-6-astra`, `gpt-6-luna`)** (`src/config/pricing.mjs`, `src/config/catalog.json`): added rate cards, aliases, family detection, and 272K long-context cliff schedules alongside Antigravity `1.5.18` `#1890` support.
27
+ - **Antigravity `#1890` rule split (`BO-CFG-19`)** (`src/cli/startup-audit.mjs`, `test/startup-audit-rank2.test.mjs`): separated `#1890` (`acp --agent` 4x quota multiplier) from `BO-CFG-12` (Always/NEVER contradictions).
28
+ - **Compaction-laundering hardening (`BO-CMP-01`)** (`src/guards/compaction-baton.mjs`): `sanitizeBatonText` neutralizes forged `[User]:`/`[Assistant]:`/`[System]:` markers and approval-laundering phrases across baton inputs/rendering and adds an explicit untrusted-state provenance line.
29
+ - **Worktree force-remove & protected `trash` guards (`DET-01`)** (`src/guards/shell-guard.mjs`): guards `git worktree remove --force` / `-f` (`GIT_WORKTREE_FORCE_REMOVE`) and `trash` targeting `.git` or `.claude/worktrees` (`TRASH_PROTECTED_GIT_TARGET`).
30
+ - **Matcher-level hook parity enforcement** (`test/brand-and-surface.test.mjs`, `test/phase9-brief-updates.test.mjs`): extends hook manifest parity checks beyond event names to verify per-event `matcher` equality against `buildClaudeHooksConfig()` (ensuring `PostToolUse` / `PostToolUseFailure` exclude `Grep|Glob`).
31
+ - **`claude-opus-4-5` deprecation tracking & pricing card** (`src/cli/startup-audit.mjs`, `src/config/pricing.mjs`): adds `claude-opus-4-5` / `claude-opus-4-5-20251101` to `RETIRED_MODELS_SPEC` (deprecated Nov 23, 2026; retiring Jan 22, 2027 -> `claude-opus-5-5`) and explicit `$5/$0.50/$25` rate card/aliases with `minCacheableTokens: 4096`.
32
+ - **Gemini `thoughtsTokenCount` parser support** (`src/storage/jsonl-parser.mjs`, `src/storage/antigravity-parser.mjs`): reads `thoughtsTokenCount`, `thoughts_token_count`, and `usageMetadata.thoughtsTokenCount` as reported thinking tokens for `BO-THK-01` and audit attribution.
33
+ - **`BO-CFG-16` lean `SKILL.md` lint & `< 2.1.331` upgrade note (`BO-CFG-17`)** (`src/cli/startup-audit.mjs`): checks `.claude/skills/` and `.agents/skills/` `SKILL.md` frontmatter for missing `name`/`description` or descriptions exceeding `1,024` chars, notes `.agents/skills`-only placement (`info`), and adds a consolidated `< 2.1.331` `--resume` cache/compaction upgrade notice (`info`, merged into `BO-CFG-13` when `.claude/worktrees` is present).
34
+ - **`BO-CMP-01` recent command ring buffer** (`src/guards/loop-breaker.mjs`, `src/guards/compaction-baton.mjs`, `src/guards/session-hook.mjs`, `src/config/policy.mjs`): persists up to 8 secret-scrubbed `[passed]` / `[failed]` shell commands through `PreCompact` -> post-compaction `SessionStart` (`compactionBatonMaxBytes` raised `2048` -> `3584`, context cap `1500` -> `2400`).
35
+ - **Claude Code `v2.1.332` `PreSkillShellCommand` & worktree parity** (`hooks/hooks.json`, `src/cli/init.mjs`, `src/clients/claude-code.mjs`, `src/guards/pre-tool-engine.mjs`, `src/cli/startup-audit.mjs`): routes inline skill shell commands through Burnoff's shell/secret guards using the non-interactive exit-2 / empty-stdout contract, and adds version-gated `< 2.1.332` `.claude/worktrees` duplicate-`CLAUDE.md` lint `BO-CFG-13`.
36
+ - **OpenAI `GPT-6.2 Astra` & `GPT-6.2 Sol` rate cards** (`src/config/catalog.json`, `src/config/pricing.mjs`): added standard (`<=272k`) and above-cliff (`>272k`) rate schedules, `0.05x` cached read weight, and `openai/` / hyphenated aliases.
37
+ - **`DET-08` `ASSERTION_COUNT_DROP` & `BO-CFG-14`/`15` hardening** (`src/guards/phase5-detectors.mjs`, `src/cli/startup-audit.mjs`, `src/config/policy.mjs`): emits an advisory notice when a test edit halves assertion count (`>=4 -> <=50%`) without escalating non-test files, and adds `info`-only `cleanupPeriodDays` (`BO-CFG-14`) and `typescript-lsp` plugin + edit-hook validation (`BO-CFG-15`) startup notes.
38
+ - **Per-model `minCacheableTokens` coverage** (`src/config/catalog.json`, `src/config/pricing.mjs`): populated documented Anthropic minimum cacheable prompt lengths (512 / 1024 / 2048 / 4096) with `minCacheableSourceUrl` and `minCacheableCheckedOn: '2026-11-28'` metadata across catalog entries and rate cards, and wired `resolveModelRateCard` to read catalog thresholds (keeping 4096 as the unmapped default).
39
+ - **`likely_lookback_miss` uncached attribution sub-bucket** (`src/storage/jsonl-parser.mjs`, `src/config/uncached-attribution.mjs`, `src/cli/audit.mjs`): tracks `appendedPositionsSincePrevCall` on main-thread API calls (deduped by `message.id`, collapsing consecutive `tool_use` and `tool_result` runs to 1 position each) and surfaces heuristic `likely_lookback_miss` resets (`>=20` positions on Anthropic models, still inside `actionableWasteTokens`) in `formatAuditReport`.
40
+ - **Mid-session subagent definition guards** (`src/guards/pre-tool-engine.mjs`, `src/cli/startup-audit.mjs`): added `BO-MOD-02` `SUBAGENT_DEFINITION_EDIT` advisory when editing `.claude/agents/*.md` or `~/.claude/agents/*.md` after turn 1, and extended `BO-CFG-11` to flag `SessionStart` hook commands that write into `.claude/agents/`.
41
+ - **`PreModelSwitch` / `PostModelSwitch` hooks**: routed through `hooks/session-lifecycle.mjs` to `src/guards/model-switch-hook.mjs`. Pre warns on warm-prefix model switches and A->B->A ping-pong; `guards.modelSwitchAction: 'deny'` (default `'allow'`) blocks via exit 2. Post is observational and records `lastModel` / `recentModels`. Read snapshots are not cleared on a model switch. New policy keys: `guards.modelSwitchAction`, `guards.modelSwitchWarmMinTokens` (default `10000`).
42
+ - **`resolveEffortLevel` / `effortChangePreservesCache`** (`src/config/effort.mjs`): shared effort normalization (object `{ level }` payloads, `$CLAUDE_EFFORT` fallback on `UserPromptSubmit`, prior-state and transcript fallback) and a model/provider cache-safety check (5.5-generation and Fable 5.1+ on first-party API; Bedrock/Vertex/Foundry excluded).
43
+ - **`resolveHostShellOutputCap`**: honors `bashOutputMaxChars` (clamped to 4,000-128,000; precedence local -> project -> user settings) before `BASH_MAX_OUTPUT_LENGTH`.
44
+ - **`isFetchLikeTool`**: `WebFetch` budgeting now also covers raw MCP fetch/scrape/get_page/read_url tools.
45
+
46
+ ### Changed
47
+ - **Quiet Friction Defaults (`DET-09` & Prompt Coaching)** (`src/config/policy.mjs`, `src/guards/phase5-detectors.mjs`, `src/guards/prompt-guard.mjs`): lowered `guards.det09Action` to `'advisory'`, set `guards.promptCoachEnabled` to `false` by default (gating `DET-13`/`14`/`17` prompt coaching cleanly as opt-in), and moved `guards.det13Enabled`/`det14Enabled`/`det17Enabled` to tri-state `null` auto-inheritance while preserving explicit overrides.
48
+ - `BO-MOD-01`, `BO-MOD-02` and `BO-THK-01` guidance is model/provider-aware; effort-only switches on cache-safe models no longer raise `BO-MOD-02`.
49
+ - The root `CLAUDE.md` / `.mcp.json` mid-session edit message no longer claims the cache is rebuilt; edits stay inert until `/clear`, `/compact`, or restart.
50
+ - `postTool.webFetchMaxTokens` default raised `1800` -> `4000`; the digest keeps heading outlines plus code-fence signatures.
51
+ - Read-dedup entries now also expire after a 15-turn gap (`DEFAULT_READ_INTERVAL_MAX_TURN_GAP`) in addition to the existing 30-minute age limit.
52
+ - `DET-17` is unchanged: `ask` only fires for vague refactor prompts with no discovery calls when prompt coaching is enabled; otherwise advisory.
53
+
54
+ ### Fixed
55
+ - **Thinking-token fallback estimation** (`src/storage/jsonl-parser.mjs`, `src/guards/prefix-guard.mjs`, `src/config/loader.mjs`, `src/cli/audit.mjs`): read provider-reported `usage.output_tokens_details.thinking_tokens` / `reasoning_tokens` when present, and replaced the `thinkingText.length / 4` fallback (which undercounted or zeroed out summarized/omitted reasoning blocks) with a labeled `output_tokens - visible_output` upper-bound estimate (`thinkingTokensEstimated: true`, `thinkingTokensSource: 'output_minus_visible_upper_bound'`) surfaced in `BO-THK-01` and `formatAuditReport`.
56
+ - Claude Code's `{ level: "max" }` effort payload no longer coerces to `"[object Object]"`, which had silently disabled `BO-MOD-01` and `BO-MOD-02`.
57
+ - `isHostTruncatedShellOutput` no longer skips compression of complete 30K-128K inline Bash output on modern hosts. The legacy length-based skip applies only when `claudeCodeVersion` is below `2.1.2` (`LEGACY_INLINE_TRUNC_CUTOFF`) or `legacyInlineTruncation: true`.
58
+
59
+ ### Breaking Changes (v2.0.0)
60
+ - **CI Budget Gate (`ciBudgetGate.wasteRatioBasis`)**: `ciBudgetGate` and `burnoff pr-cost` now default to `wasteRatioBasis: 'actionable'` instead of gross uncached waste. Heuristic upstream Gemini 4 eviction patterns (`<=60s`, `150-260s`, `701+/-25`, `prefix_shard_cut`) and the `2,050`-token append floor are labeled as `"attributed to upstream"` and excluded from `actionableWasteTokens`, while `grossWasteTokens` and `actionableWasteTokens` are reported side-by-side in PR and CI gate Markdown. Pure Claude Code sessions remain identical (`grossWasteTokens === actionableWasteTokens`). Set `ciBudgetGate.wasteRatioBasis: gross` in `.burnoff.yaml` (or pass `--waste-basis gross`) to restore the legacy gross waste ratio threshold.
61
+
62
+ ### Earlier [2.0.0] Additions & Fixes (2026-11-27)
63
+ - **Source-Backed Platform-Scoped Lifecycles (`BO-CFG-09`)**: Added per-harness lifecycle specs with `sourceUrl` and `checkedOn` metadata (`antigravity.sunsetUtc: '2026-11-30T00:00:00Z'`; Anthropic API `claude-opus-4-6` and `claude-sonnet-4-6` active `info` advisories with `notSoonerThanUtc: '2027-02-05T00:00:00Z'`).
64
+ - **Antigravity Turn-0 Parity**: Added `BO-MCP-07` (`#1530` ACP `--stdio` eager >16KB MCP manifest & skill eviction check), `BO-CFG-12` (`#1890` Antigravity `1.5.17` `acp --agent` 4.0x est. quota alert), and Antigravity `BO-CFG-01`, `BO-MCP-05`, and `BO-MCP-06` checks.
65
+ - **Safe `<uuid>.db` + `transcript.jsonl` Merge**: Added `validateAntigravityDbCounters` and `mergeAntigravitySessionSources` with warm-cache sanity guardrails (`SQLITE_SANITY_FALLBACK`) and `counterSource` provenance wired into `audit` and `pr-cost`.
66
+ - **Rank 5 Harness Quirks & Statusline (`BO-HAB-01..06`)**: Added `src/config/harness-quirks.mjs` covering `THINKING_LEVEL_XHIGH` HTTP 400, `1.5.18` Orchestrator misroutes, `/btw` (`trajectory_type = 22`) and `#1646` loops, `0x3e800` `256K` clamp vs flat 1M pricing, `#1442` hook `/compact` fallacy, and `#1876` bloated `GEMINI.md` 429s; added normalized `hit: X%` and Antigravity Gemini 4 `clamp: Xk/256k` indicators to `scripts/burnoff-statusline.mjs`.
67
+ - **Optional Warn-Only Quota Gate (`maxPrQuotaUnits` / `quotaGateMode`)**: Added `ciBudgetGate.maxPrQuotaUnits` (default `null`) and `quotaGateMode` (`'warn'` default, `'fail'` opt-in) with `"est."` weight disclosure (`Q-units` reported strictly separate from USD) and `MISSING_TRANSCRIPTS` protection so `0` usage never passes silently.
68
+
69
+ ### Fixed
70
+ - **Model Retirement False Errors**: Removed incorrect `2026-11-18` sunset dates and Claude Code mis-tagging in `BO-CFG-09`.
71
+ - **Antigravity IDE Lazy-MCP False Positives (`BO-MCP-10`)**: Scoped eager schema warnings to explicit `eager: true`, `loading: 'eager'`, or ACP `--stdio` mode.
72
+ - **Historical Dec 1 Pricing (`audit.mjs`)**: Passed `eventTimestampUtc: step.createdAt` so pre-Dec-1 Carbon/Argon turns remain valued at `$2/$10` after `2026-12-01`, and synced `src/config/catalog.json`.
73
+ - **SQLite `genMetadataIdx` Misjoin & `4x` Duplication (`telemetry-metrics.mjs`)**: Removed the `Number(row.idx)` fallback and deduplicated tool sub-steps (`step_type = 132`) from primary model generations (`step_type = 15`).
74
+ - **Claude 5.5 `#99624` Attribution**: Exempted `CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS=1` sessions and aligned `pr-cost` with `attributeUncachedTokens()` (`HIGH_UPSTREAM_EXCLUSION_SHARE` notice when `>50%` of uncached input is excluded).
package/README.md CHANGED
@@ -1,213 +1,187 @@
1
- # Burnoff
2
-
3
- **Burnoff** — Deterministic circuit breakers, bounded file-read guards, and Turn-0 config linting for Claude Code (with experimental Google Antigravity CLI support).
4
-
5
- Burnoff runs locally via `PreToolUse` and `PostToolUse` hooks to bound oversized file reads (`updatedInput`), stop runaway command failure loops, block destructive shell/git operations and credential reads, and statically lint Turn-0 repository config bloat (`CLAUDE.md`/`AGENTS.md`, `.mcp.json`, volatile prompt-prefix instructions `BO-CFG-11`). Zero runtime dependencies, MIT licensed, 100% local, and no proxy or daemon required.
6
-
7
- ## Why Burnoff?
8
-
9
- - **Bounded File-Read Guards (`DET-06`):** Clamps oversized non-code reads (`250 lines / 16 KB`) via `updatedInput`, skips overlapping re-reads, and leaves active source files unclamped.
10
- - **Deterministic Runaway Loop Breaker (`DET-04`):** Halts repeating tool or command failure loops after 3 consecutive failures using cross-process state locking, exempting read-only recovery steps and resetting cleanly on success or `git stash`.
11
- - **Destructive Shell & Credential Guards (`DET-01` / `DET-02` / `DET-03`):** Blocks high-risk shell/git commands (`git push --force`, `--no-verify`, `rm -rf`) and sensitive credential/env paths (allowing `.env.example`/`.env.sample` templates), while routing reversible git resets and lockfile/workflow edits through interactive confirmation.
12
- - **Turn-0 Startup Config Linter (`audit --startup`):** Audits `.mcp.json`, Claude Code settings, `.agents/mcp_config.json`, `GEMINI.md`/`AGENTS.md`/`.agents/rules/*.md`, volatile prompt-prefix instructions (`BO-CFG-11`), and tool bloat before a session starts.
13
- - **Repo Policy & Local FinOps (`pr-cost` / `ci-gate`):** Correlates branch commits with local Claude Code and Google Antigravity CLI session transcripts, optionally reconciles against `.burnoff-ci/provider-usage.json`, and evaluates `.burnoff.yaml` thresholds via `ci-gate`.
14
-
15
- ## Requirements & Scope
16
-
17
- - **Supported Agents:** **Claude Code** and **Google Antigravity CLI (experimental)**.
18
- - **Runtime:** **Node.js `>=20.19.0`** (`Node.js >=22.13.0` recommended for built-in `node:sqlite` FTS5 indexing; older supported Node.js versions automatically run in local JSON fallback mode).
19
- - **Dependencies:** **Zero runtime npm dependencies.**
20
-
21
- ### Client Capability Matrix
22
-
23
- | Capability | Claude Code | Google Antigravity CLI (experimental) |
24
- | :--- | :---: | :---: |
25
- | **DET-01 / 02 / 03** (Shell, secret & protected-file guards) | Yes | Yes (`decision: deny \| ask`) |
26
- | **DET-04** (Runaway loop breaker) | Yes (`PostToolUse` / `PostToolUseFailure`) | Yes (`PostToolUse.error`) |
27
- | **DET-05** (Subagent fan-out & prompt-bloat guard) | Yes (`Task` / `Agent`, advisory by default) | Yes (`invoke_subagent`, advisory by default) |
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`) |
32
- | **`PostToolUse` FTS5 log archive & MCP output replacement** | MCP & built-in tool output replacement (default `replace` mode) + local FTS5 archive | **No** (`PostToolUse` returns `{}`) |
33
- | **Turn-0 startup audit (`burnoff audit --startup`)** | Yes | Yes (`GEMINI.md`, `AGENTS.md`, `.agents/`) |
34
- | **Local FinOps (`audit`, `pr-cost`, `ci-gate`)** | Yes | Yes (Gemini rate cards & `transcript.jsonl`) |
35
-
36
- ## Quickstart
37
-
38
- Install Burnoff in your project, preview changes, wire hooks, and run your Turn-0 health & startup audit:
39
-
40
- ```bash
41
- npm i -D burnoff
42
- npx burnoff init --dry-run
43
- npx burnoff init # Claude Code (.claude/settings.local.json)
44
- npx burnoff init --client antigravity # Google Antigravity CLI (.agents/hooks.json)
45
- npx burnoff init --client antigravity --global # Global (~/.gemini/config/hooks.json)
46
- npx burnoff init --client both # Wire both clients
47
- npx burnoff audit --startup
48
- npx burnoff doctor
49
- npx burnoff doctor --gc # Prune >14d caches & rotate prior-month ledger
50
- ```
51
-
52
- Remove hooks cleanly at any time:
53
-
54
- ```bash
55
- npx burnoff uninstall
56
- npx burnoff uninstall --client antigravity [--global]
57
- ```
58
-
59
- ## Smoke Test (`PreToolUse` exit `2`)
60
-
61
- Verify that the `PreToolUse` guard blocks secret reads before execution:
62
-
63
- ```bash
64
- echo '{"session_id":"smoke-1","tool_name":"Bash","tool_input":{"command":"cat .env;echo ok"}}' | node node_modules/burnoff/hooks/pre-tool-use.mjs; echo "exit=$?"
65
- ```
66
-
67
- Expected output:
68
-
69
- ```text
70
- [Burnoff DET-02 Secret & Credential Boundary] Access to sensitive credential path ".env" is blocked. (.env.example / .env.sample are permitted.)
71
- exit=2
72
- ```
73
-
74
- ## Measured Hook Latency & `Read`-Clamp Savings
75
-
76
- Measured directly on **Windows (`win32 10.0.26300`, x64)**, CPU **AMD Ryzen 5 7535U with Radeon Graphics**, **Node `v25.6.0`** (cold-spawn CLI hook runs `n=7` after 1 warmup; reproduce locally with `node scripts/bench-hooks.mjs --runs 7`, or run `npm run test:bench` for warm daemon RPC benchmarks):
77
-
78
- | Hook / Path | Median (`p50`) | `p95` | Min | Max |
79
- | :--- | :---: | :---: | :---: | :---: |
80
- | `PreToolUse` (Claude `Bash`) | `105.8 ms` | `108.3 ms` | `100.1 ms` | `108.3 ms` |
81
- | `PreToolUse` (Claude `Read` bounded) | `90.9 ms` | `92.8 ms` | `87.2 ms` | `92.8 ms` |
82
- | `PreToolUse` (Claude `Grep` Tier-1 fast allow) | `95.9 ms` | `130.5 ms` | `87.7 ms` | `130.5 ms` |
83
- | `PreToolUse` (Antigravity `run_command`) | `109.6 ms` | `110.8 ms` | `107.5 ms` | `110.8 ms` |
84
- | `PostToolUse` (Claude `Bash`) | `119.7 ms` | `138.5 ms` | `107.5 ms` | `138.5 ms` |
85
- | `SessionStart` (Claude) | `90.7 ms` | `93.4 ms` | `88.8 ms` | `93.4 ms` |
86
-
87
- Example measured `Read`-clamp (`DET-06`) run on an 800-line, `72,000`-byte (`~18,000` est. tokens) log file (`APP_SERVER.log`):
88
-
89
- ![Burnoff DET-06 Read-clamp demo](docs/assets/read-clamp-demo.gif)
90
-
91
- - **Before clamp:** `800` lines / `72,000` bytes (`~18,000` est. tokens).
92
- - **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.
93
-
94
- ## Local-Only Trust & Privacy
95
-
96
- Burnoff runs 100% locally via hook subprocesses and local CLI commands:
97
-
98
- - **Zero outbound network calls & zero proxy/MITM:** Your prompts, source code, and credentials never leave your machine.
99
- - **Exact paths touched:**
100
- - `~/.burnoff/` (or `$BURNOFF_HOME`): savings ledger, FTS5/JSON CLI log archive, and optional local warm daemon socket/pipe.
101
- - `.claude/settings.local.json`: repo-local Claude Code hook wiring only (never modifies shared `.claude/settings.json`).
102
- - `.claude/cache/` and `.claude/locks/`: session loop-breaker state, read-interval snapshots, lockfiles, and offloaded `>=4k`-token tool output artifacts (`.claude/cache/artifacts/burnoff_<sha256>.txt`, pruned via `npx burnoff doctor --gc`).
103
- - `.agents/hooks.json` (project) or `~/.gemini/config/hooks.json` (global): written only when `--client antigravity` or `--client both` is passed.
104
- - `.git/info/exclude`: privately ignores Burnoff's local files so `git status` stays spotless without touching `.gitignore`.
105
-
106
- ## CLI Commands
107
-
108
- | Command | Purpose |
109
- | :--- | :--- |
110
- | `burnoff init [--dry-run]` | Wire `PreToolUse`, `PostToolUse`, and `PostToolUseFailure` hooks and update `.git/info/exclude`. |
111
- | `burnoff uninstall [--dry-run]` | Remove Burnoff hooks and `.git/info/exclude` block. |
112
- | `burnoff doctor [--gc] [--json]` | Inspect Node/SQLite FTS5, `.burnoff.yaml`, hook wiring, warm daemon, ledger, and prune >14d caches with `--gc`. |
113
- | `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. |
114
- | `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 %). |
115
- | `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. |
116
- | `burnoff export --since <iso\|duration> [--out file.json]` | Export clean `burnoff-pr-attribution/v1` spend & violation JSON for `ci-gate` from local transcripts. |
117
- | `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`). |
118
- | `burnoff team-digest [--days 7]` | Output a 5-line weekly summary of local spend, cache efficiency, top cost driver, and guard savings. |
119
- | `burnoff search <turnId> [keyword]` | Search archived FTS5 CLI output without re-running expensive test or build commands. |
120
- | `burnoff daemon <start\|stop\|status>` | Manage the workspace-scoped warm IPC daemon (`~/.burnoff/run/` or Windows named pipe). |
121
-
122
- ## For Teams: Repo Policy & GitHub Actions
123
-
124
- Commit an optional `.burnoff.yaml` in your repository root so every developer shares the same deterministic guardrails, read bounds, and CI gate thresholds:
125
-
126
- ```yaml
127
- guards:
128
- mode: guard
129
- det04Threshold: 3
130
- strictTestIntegrity: false
131
- scopeLockEnabled: true
132
- subagentFanoutEnabled: true
133
- subagentFanoutAction: advisory
134
- subagentMaxBurstCount: 4
135
- subagentBurstWindowSec: 60
136
- subagentMaxPromptChars: 8000
137
- det07Enabled: true
138
- det07Action: ask
139
- det08Enabled: true
140
- det08Action: ask
141
- det09Enabled: true
142
- det09Action: ask
143
- det09MaxEditsPerFile: 5
144
- det09WindowSec: 300
145
-
146
- readClamp:
147
- enabled: true
148
- maxLines: 250
149
- maxBytes: 16384
150
- neverClampCodeOffCliff: true
151
-
152
- postTool:
153
- fts5Enabled: true
154
- minBytesToCompress: 6144
155
- retentionDays: 30
156
-
157
- ciBudgetGate:
158
- maxPrCostUsd: 15
159
- maxPrTokens: 1500000
160
- minCacheHitPct: 50
161
- maxWasteRatioPct: 35
162
- maxRing0Violations: 0
163
- mode: enforce
164
- failOnMissingTranscripts: false
165
- ```
166
-
167
- 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.1`:
168
-
169
- - Runs `npx -y burnoff@1.4.1 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`.
170
- - Runs `npx -y burnoff@1.4.1 ci-gate --input .burnoff-ci/pr-cost.json --strict --github-annotations`.
171
- - Appends the Markdown breakdown to `$GITHUB_STEP_SUMMARY` and posts non-fork PR summary comments.
172
-
173
- > **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.
174
-
175
- ## Turn-0 CI Config Linting (`audit --startup --ci`)
176
-
177
- 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:
178
-
179
- ```bash
180
- npx -y burnoff@1.4.1 audit --startup --ci --github-annotations --client auto
181
- ```
182
-
183
- Pass `--strict` to fail the workflow on warn-level lints as well as error-level secret/deprecated-model findings.
184
-
185
- ## Temporary `ask` Overrides (`allow-once` & `snooze`)
186
-
187
- 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:
188
-
189
- ```bash
190
- npx -y burnoff@1.4.1 allow-once DET-03 --scope deploy.yml
191
- npx -y burnoff@1.4.1 allow-once DET-07 --scope "git log"
192
- npx -y burnoff@1.4.1 snooze DET-04 --minutes 15
193
- npx -y burnoff@1.4.1 allow-once --list
194
- npx -y burnoff@1.4.1 allow-once --clear
195
- ```
196
-
197
- `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.
198
-
199
- ## Claude Code Plugin & Status Line
200
-
201
- 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.
202
-
203
- ## Environment Variables
204
-
205
- - `BURNOFF_HOME`: Override `~/.burnoff/` state directory.
206
- - `BURNOFF_IPC_PATH`: Override daemon named pipe / Unix domain socket path.
207
- - `BURNOFF_PRETOOL_FAIL_MODE`: Set to `closed` to fail-closed on internal hook faults (guard `exitCode: 2` blocks always fail-closed).
208
- - `BURNOFF_POST_OUTPUT_MODE`: Override `PostToolUse` output mode (`auto`, `updatedToolOutput`, `additionalContext`).
209
- - `BURNOFF_TIER1_ACTIVE`: Set to `1` to enable Tier-1 `Grep`/`Glob` fast-path pass-through.
210
-
211
- ## License
212
-
213
- MIT — see [LICENSE](LICENSE).
1
+ # Burnoff
2
+
3
+ **Burnoff** — The local safety and token firewall for Claude Code and Google Antigravity. Zero dependencies, 100% MIT.
4
+
5
+ Deterministic circuit breakers, bounded file-read guards, and CI spend gates that stop runaway test loops, oversized log reads, secret leaks, and Turn-0 context bloat before they hit your API bill.
6
+
7
+ [![CI](https://github.com/Gizzant/burnoff/actions/workflows/ci.yml/badge.svg)](https://github.com/Gizzant/burnoff/actions/workflows/ci.yml)
8
+ [![npm version](https://img.shields.io/npm/v/burnoff.svg)](https://www.npmjs.com/package/burnoff)
9
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
10
+ [![Zero Dependencies](https://img.shields.io/badge/dependencies-0-brightgreen.svg)](package.json)
11
+ [![Socket Security](https://socket.dev/api/badge/npm/package/burnoff)](https://socket.dev/npm/package/burnoff)
12
+
13
+ Burnoff intercepts tool calls locally via `PreToolUse` and `PostToolUse` hooks with a warm local IPC daemon (`p50 8.0 ms, p95 12.1 ms`), keeping oversized reads bounded (`updatedInput`), breaking 3x failing command loops, and blocking destructive shell commands and `.env` credential reads before execution. It also audits Turn-0 config bloat (`CLAUDE.md`, `GEMINI.md`, `.mcp.json`) and reconciles branch spend in GitHub Actions without proxies, MITM, or outbound telemetry.
14
+
15
+ ![Burnoff DET-06 Read-clamp demo](docs/assets/read-clamp-demo.gif)
16
+
17
+ *One intercepted `Read` on an 800-line log file (`APP_SERVER.log`): clamped from `800` lines / `72,000` B (`~18,000` est. tok) to `182` lines / `16,379` B (`~4,095` est. tok) — `~13,905` tokens (`77.3%`) saved cleanly.*
18
+
19
+ ## Zero-Commitment Quickstart (`< 30 Seconds`)
20
+
21
+ Preview your last 7 days of local Claude Code & Antigravity transcripts without installing anything or writing a single file:
22
+
23
+ ```bash
24
+ npx burnoff
25
+ ```
26
+
27
+ Install deterministic hooks + auto-wired status line (no `npm i -D` required):
28
+
29
+ ```bash
30
+ npx burnoff init # Claude Code (.claude/settings.local.json + statusLine)
31
+ npx burnoff init --no-statusline # Hooks only (keep your existing footer)
32
+ npx burnoff init --client antigravity # Google Antigravity CLI (experimental, .agents/hooks.json)
33
+ npx burnoff doctor # Verify Node, SQLite FTS5, hooks, warm daemon & ledger
34
+ ```
35
+
36
+ Escape hatches when you need full speed on an intentional task:
37
+
38
+ ```bash
39
+ npx burnoff pause 15m # Soft-pause ask gates & read clamps (Ring-0 blocks stay active!)
40
+ npx burnoff pause off # Resume normal guardrails immediately
41
+ npx burnoff bypass -- npm test # Run one command directly outside read clamps
42
+ npx burnoff bypass --grant huge.log # Grant a single-use DET-07 override
43
+ npx burnoff uninstall # Cleanly removes hooks, statusLine & git exclude entries
44
+ ```
45
+
46
+ ### Smoke Test (`PreToolUse` Exit `2` Hard Block)
47
+
48
+ <details>
49
+ <summary>Bash (macOS / Linux / Git Bash) and Windows PowerShell smoke tests</summary>
50
+
51
+ **Bash:**
52
+ ```bash
53
+ echo '{"session_id":"smoke-1","tool_name":"Bash","tool_input":{"command":"cat .env;echo ok"}}' | npx --no-install burnoff hook pre; echo "exit=$?"
54
+ ```
55
+
56
+ **Windows PowerShell:**
57
+ ```powershell
58
+ '{"session_id":"smoke-1","tool_name":"Bash","tool_input":{"command":"cat .env;echo ok"}}' | node "$env:APPDATA\npm\node_modules\burnoff\hooks\pre-tool-use.mjs"; "exit=$LASTEXITCODE"
59
+ ```
60
+
61
+ Expected:
62
+ ```text
63
+ [Burnoff DET-02 Secret & Credential Boundary] Access to sensitive credential path ".env" is blocked. (.env.example / .env.sample are permitted.)
64
+ exit=2
65
+ ```
66
+
67
+ </details>
68
+
69
+ ## Measured Latency & Workload Savings
70
+
71
+ Burnoff auto-spawns a workspace-scoped local IPC daemon (`~/.burnoff/run/` on POSIX, Windows named pipe) on `SessionStart` with a 15-minute idle timeout (`BURNOFF_NO_AUTO_DAEMON=1` disables). Measured on **Windows (`win32 10.0.26300`, x64, Node `v25.6.0`)** — see [`docs/BENCHMARKS.md`](docs/BENCHMARKS.md) to reproduce locally:
72
+
73
+ | Path | Mode | Median (`p50`) | `p95` | Notes |
74
+ | :--- | :--- | :---: | :---: | :--- |
75
+ | `PreToolUse` (`DET-01`..`20` IPC) | **Warm auto-daemon** | **`8.0 ms`** | **`12.1 ms`** | Auto-managed IPC (`node scripts/bench-hooks.mjs --runs 5`) |
76
+ | `PreToolUse` (`Grep` Tier-1 fast allow) | Cold CLI subprocess | `95.7 ms` | `103.3 ms` | Regex bypass without full engine load |
77
+ | `SessionStart` (Claude) | Cold CLI subprocess | `121.8 ms` | `124.5 ms` | Spawns warm daemon asynchronously |
78
+ | `PreToolUse` (Claude `Bash`) | Cold CLI subprocess | `128.8 ms` | `140.0 ms` | Fallback when daemon stopped |
79
+ | `PostToolUse` (Claude `Bash`) | Cold CLI subprocess | `143.5 ms` | `159.2 ms` | Includes SQLite FTS5 archive |
80
+ | `PreToolUse` (Claude `Read` bounded) | Cold CLI subprocess | `146.6 ms` | `165.4 ms` | Bounded read firewall cold spawn |
81
+
82
+ Single-pass reproducible workload benchmark (`node scripts/bench-savings.mjs`, `claude-sonnet-5-5` ref rate): **`65,825` tokens saved** across `DET-06` log clamp (`14,625`), `DET-04` loop break + FTS5 offload (`38,400`), Turn-0 config audit (`12,800`), and `3/3` Ring-0 security blocks — `$0.1573` uncached / `$0.0355` at `0.27x` cache-read weight.
83
+
84
+ ## How Burnoff Compares
85
+
86
+ | Feature | **Burnoff (`v2.1.0`)** | Cloud API Proxies | CLI Output Compressors (RTK, etc.) | Usage Viewers (`ccusage`) | Hand-Rolled Shell Hooks |
87
+ | :--- | :---: | :---: | :---: | :---: | :---: |
88
+ | **100% Local (Zero MITM / Zero Network)** | Yes | No (proxy server) | Yes | Yes | Yes |
89
+ | **Ring-0 Secret & Destructive Shell Hard Blocks** | Yes (`DET-01`/`02`/`03`) | Partial | No | No | Fragile regexes |
90
+ | **3x Failure Loop Breaker + FTS5 Search** | Yes (`DET-04`) | No | Partial | No | Rarely |
91
+ | **Non-Code `Read` Clamping (`16 KB` cap)** | Yes (`DET-06`) | No | Bash stdout only | No | Rarely |
92
+ | **Sub-15 ms Warm IPC Daemon + 0 deps** | Yes (`0` npm deps) | Network RTT | Native binary | Read-only CLI | Node cold start |
93
+ | **Turn-0 Config Lint & GitHub PR Cost Gate** | Yes | Cloud dashboard | No | Reports only | No |
94
+
95
+ ## Permanent MIT Core & Privacy Audit
96
+
97
+ - **Permanent MIT Core & Zero-Telemetry Pledge:** Burnoff's core CLI, deterministic hooks (`DET-01`..`20`), Turn-0 linter, and CI budget gate will remain **100% MIT-licensed forever** with **zero outbound network requests** and **zero runtime npm dependencies**.
98
+ - **Security & Trust Documentation:** See [`SECURITY.md`](SECURITY.md) for credential scrubbing rules, fail-closed Ring-0 guarantees, exact file permissions (`0600`/`0700`), and vulnerability reporting. See [`SPONSORS.md`](SPONSORS.md) for sustainable open-source backing.
99
+
100
+ | Data / Path | Purpose | Outbound Network? | Ignored by Git? |
101
+ | :--- | :--- | :---: | :---: |
102
+ | `~/.burnoff/ledger.db` (or `.json`) | Local token savings & guard counts | **Never** | Yes (home dir) |
103
+ | `~/.burnoff/fts/` & `~/.burnoff/snooze/` | Archived long test logs & active `pause`/`bypass` state | **Never** | Yes (home dir) |
104
+ | `.claude/settings.local.json` & `.claude/burnoff-hook-shim.mjs` | Hook & `statusLine` wiring | **Never** | Yes (`.git/info/exclude`) |
105
+
106
+ <details>
107
+ <summary>Full Client Capability Matrix (Claude Code & Google Antigravity CLI)</summary>
108
+
109
+ | Capability | Claude Code | Google Antigravity CLI (experimental) |
110
+ | :--- | :---: | :---: |
111
+ | **DET-01 / 02 / 03** (Shell, secret & protected-file guards) | Yes | Yes (`decision: deny \| ask`) |
112
+ | **DET-04** (Runaway loop breaker) | Yes (`PostToolUse` / `PostToolUseFailure`) | Yes (`PostToolUse.error`) |
113
+ | **DET-05** (Subagent fan-out & prompt-bloat guard) | Yes (`Task` / `Agent`, advisory by default) | Yes (`invoke_subagent`, advisory by default) |
114
+ | **DET-06** (Bounded file-read clamp & overlap trim) | Yes (`updatedInput`) | Yes (`overwrite: { StartLine, EndLine }`) |
115
+ | **DET-07 / 08 / 09 / 10** (Flood bypass, test integrity, edit thrash, rewrite guards) | Yes (`ask` / quiet defaults) | Yes (`decision: ask \| deny`) |
116
+ | **DET-13 / 14 / 17 / BO-TTL-01** (`UserPromptSubmit` coach — opt-in) | Opt-in (`promptCoachEnabled: true`) | Not wired (Claude Code only) |
117
+ | **DET-15 / 18 / 19 / BO-MOD-01..02 / BO-MCP-11** (Budgets, thread-rot, model/effort) | Yes | Partial (`PreToolUse` only) |
118
+ | **DET-20** (Concurrent scope locks, quota brake & cold-read dedup) | Yes (`active_scopes.json`) | Yes |
119
+ | **`PostToolUse` FTS5 log archive & `WebFetch` <=4k cap** | Yes | No (`PostToolUse` returns `{}`) |
120
+ | **Turn-0 startup audit (`burnoff audit --startup`)** | Yes | Yes (`GEMINI.md`, `AGENTS.md`, `.agents/`) |
121
+ | **Local FinOps (`audit`, `pr-cost`, `ci-gate`)** | Yes | Yes (Gemini rate cards & `transcript.jsonl`) |
122
+
123
+ </details>
124
+
125
+ <details>
126
+ <summary>CLI Command Reference</summary>
127
+
128
+ | Command | Description |
129
+ | :--- | :--- |
130
+ | `burnoff` / `burnoff preview [--days 7]` | Run the 3-second zero-mutation read-only transcript preview receipt. |
131
+ | `burnoff init [--client auto\|claude\|antigravity\|both] [--no-statusline] [--global]` | Install hooks, auto-wire `statusLine`, and keep `git status` clean. |
132
+ | `burnoff pause [15m\|1h\|status\|off]` | Temporarily silence ask gates & read clamps while Ring-0 denies stay active. |
133
+ | `burnoff bypass [--grant <substr> \| -- <cmd...>]` | Grant a 1-use `DET-07` override or run a command directly outside clamps. |
134
+ | `burnoff allow-once <DET-ID> --scope <substr>` | Single-use scoped `ask` override (`snooze` for timed overrides). |
135
+ | `burnoff doctor [--gc] [--json]` | Run Node, SQLite FTS5, hook, warm daemon, and ledger diagnostics. |
136
+ | `burnoff audit [--startup [--ci] [--strict] [--github-annotations]]` | Audit local sessions or lint Turn-0 `CLAUDE.md`/`GEMINI.md`/`.mcp.json` bloat. |
137
+ | `burnoff pr-cost [--base main] [--write-summary [file]]` / `burnoff ci-gate [--summary <file>]` | Attribute branch spend, export zero-secret `.burnoff-ci/pr-summary.json` for ephemeral CI runners, & enforce `.burnoff.yaml` CI thresholds. |
138
+ | `burnoff team-digest [--days 7]` / `burnoff search <turnId> [kw]` | 5-line EM spend summary & FTS5 log search. |
139
+ | `burnoff daemon <start\|stop\|status>` | Manually inspect or manage the auto-spawned workspace IPC daemon. |
140
+
141
+ </details>
142
+
143
+ <details>
144
+ <summary>Team Policy (`.burnoff.yaml`), GitHub Actions CI Gates & Environment Variables</summary>
145
+
146
+ Commit `.burnoff.yaml` in your repo root to enforce shared policy across Claude Code and GitHub Actions (see [`.github/workflows/burnoff-pr-gate.yml`](.github/workflows/burnoff-pr-gate.yml) and [`.github/workflows/burnoff-startup-lint.yml`](.github/workflows/burnoff-startup-lint.yml)):
147
+
148
+ ```yaml
149
+ guards:
150
+ mode: guard
151
+ det04Threshold: 3
152
+ det09Action: advisory
153
+ promptCoachEnabled: false
154
+ readClamp:
155
+ enabled: true
156
+ maxLines: 250
157
+ maxBytes: 16384
158
+ neverClampCodeOffCliff: true
159
+ postTool:
160
+ fts5Enabled: true
161
+ minBytesToCompress: 6144
162
+ webFetchMaxTokens: 4000
163
+ ciBudgetGate:
164
+ maxPrCostUsd: 15
165
+ maxPrTokens: 1500000
166
+ minCacheHitPct: 50
167
+ maxWasteRatioPct: 35
168
+ wasteRatioBasis: actionable
169
+ maxRing0Violations: 0
170
+ ```
171
+
172
+ **Ephemeral CI Runner Sync (Zero-Secret):** GitHub Actions runners lack local `~/.claude/projects/` transcripts. Run `burnoff pr-cost --write-summary` locally to export a scrubbed, SHA-256 integrity-verified `.burnoff-ci/pr-summary.json` (zero prompts, zero secrets, zero OS home paths) that `burnoff pr-cost` and `burnoff ci-gate` automatically hydrate and verify in CI.
173
+
174
+ **Environment Variables:**
175
+ - `BURNOFF_HOME` — Override `~/.burnoff/` state directory.
176
+ - `BURNOFF_IPC_PATH` — Override daemon pipe / socket path (disables auto-daemon spawn).
177
+ - `BURNOFF_NO_AUTO_DAEMON` — Set `1` to disable automatic background daemon launch on `SessionStart`.
178
+ - `BURNOFF_PRETOOL_FAIL_MODE` — Set `closed` to fail-closed on internal hook faults (`exitCode: 2` Ring-0 blocks always fail-closed).
179
+ - `BURNOFF_POST_OUTPUT_MODE` — Override `PostToolUse` output mode (`auto`, `updatedToolOutput`, `additionalContext`).
180
+
181
+ </details>
182
+
183
+ ## Requirements, Plugin & License
184
+
185
+ - **Node.js `>=20.19.0`** (`Node.js >=22.13.0` recommended for built-in `node:sqlite` FTS5 indexing; JSON fallback runs automatically on earlier `>=20.19` releases).
186
+ - **Plugin & Status Line Docs:** [`docs/CLAUDE_CODE_PLUGIN.md`](docs/CLAUDE_CODE_PLUGIN.md) · [`docs/DESIGN_PARTNER_INTAKE.md`](docs/DESIGN_PARTNER_INTAKE.md)
187
+ - **License:** MIT — see [LICENSE](LICENSE).