burnoff 1.3.0 → 1.4.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "burnoff",
3
- "version": "1.3.0",
3
+ "version": "1.4.1",
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"
@@ -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.3.0 pr-cost --base "origin/${{ github.base_ref }}" $USAGE_FLAG --json --out .burnoff-ci/pr-cost.json
34
- npx -y burnoff@1.3.0 pr-cost --base "origin/${{ github.base_ref }}" $USAGE_FLAG --markdown --out .burnoff-ci/pr-cost.md
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
35
 
36
36
  - name: Enforce CI Token-Budget Gate
37
37
  id: gate
38
38
  run: |
39
- npx -y burnoff@1.3.0 ci-gate --input .burnoff-ci/pr-cost.json --strict --github-annotations --out .burnoff-ci/ci-gate.md
39
+ npx -y burnoff@1.4.1 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"
@@ -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.3.0 directly.
30
+ # External consumers copying this workflow can use npx -y burnoff@1.4.1 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.3.0 audit --startup --ci --github-annotations --client auto | tee burnoff-startup-lint.txt
35
+ npx -y burnoff@1.4.1 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/README.md CHANGED
@@ -1,195 +1,213 @@
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
- | **`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
- | **Turn-0 startup audit (`burnoff audit --startup`)** | Yes | Yes (`GEMINI.md`, `AGENTS.md`, `.agents/`) |
31
- | **Local FinOps (`audit`, `pr-cost`, `ci-gate`)** | Yes | Yes (Gemini rate cards & `transcript.jsonl`) |
32
-
33
- ## Quickstart
34
-
35
- Install Burnoff in your project, preview changes, wire hooks, and run your Turn-0 health & startup audit:
36
-
37
- ```bash
38
- npm i -D burnoff
39
- npx burnoff init --dry-run
40
- npx burnoff init # Claude Code (.claude/settings.local.json)
41
- npx burnoff init --client antigravity # Google Antigravity CLI (.agents/hooks.json)
42
- npx burnoff init --client antigravity --global # Global (~/.gemini/config/hooks.json)
43
- npx burnoff init --client both # Wire both clients
44
- npx burnoff audit --startup
45
- npx burnoff doctor
46
- npx burnoff doctor --gc # Prune >14d caches & rotate prior-month ledger
47
- ```
48
-
49
- Remove hooks cleanly at any time:
50
-
51
- ```bash
52
- npx burnoff uninstall
53
- npx burnoff uninstall --client antigravity [--global]
54
- ```
55
-
56
- ## Smoke Test (`PreToolUse` exit `2`)
57
-
58
- Verify that the `PreToolUse` guard blocks secret reads before execution:
59
-
60
- ```bash
61
- 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=$?"
62
- ```
63
-
64
- Expected output:
65
-
66
- ```text
67
- [Burnoff DET-02 Secret & Credential Boundary] Access to sensitive credential path ".env" is blocked. (.env.example / .env.sample are permitted.)
68
- exit=2
69
- ```
70
-
71
- ## Measured Hook Latency & `Read`-Clamp Savings
72
-
73
- Measured directly on **Windows (`win32`, Node `v25.6.0`)** (reproduce locally with `npm run test:bench`):
74
-
75
- | Hook / Path | Mode | Median (`p50`) | Notes |
76
- | :--- | :--- | :---: | :--- |
77
- | `hooks/pre-tool-use.mjs` | Cold CLI spawn (`n=5`) | `102.4 ms` | Synchronous named-pipe bailout on cold start (`112.0 ms` p50 over 10 runs in `test:bench`) |
78
- | `hooks/pre-tool-use.mjs` | Warm daemon CLI / RPC (`n=10`) | `97.2 ms` CLI / `1.34 ms` RPC | Over warm IPC (`burnoff daemon start`) |
79
- | `hooks/post-tool-use.mjs` | Cold CLI spawn (`n=5`) | `136.4 ms` | `POST_TOOL_MATCHER` excludes `Grep\|Glob` |
80
-
81
- Example measured `Read`-clamp (`DET-06`) run on an 800-line, `72,000`-byte (`~18,000` est. tokens) log file (`APP_SERVER.log`):
82
-
83
- - **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.
85
-
86
- ## Local-Only Trust & Privacy
87
-
88
- Burnoff runs 100% locally via hook subprocesses and local CLI commands:
89
-
90
- - **Zero outbound network calls & zero proxy/MITM:** Your prompts, source code, and credentials never leave your machine.
91
- - **Exact paths touched:**
92
- - `~/.burnoff/` (or `$BURNOFF_HOME`): savings ledger, FTS5/JSON CLI log archive, and optional local warm daemon socket/pipe.
93
- - `.claude/settings.local.json`: repo-local Claude Code hook wiring only (never modifies shared `.claude/settings.json`).
94
- - `.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`).
95
- - `.agents/hooks.json` (project) or `~/.gemini/config/hooks.json` (global): written only when `--client antigravity` or `--client both` is passed.
96
- - `.git/info/exclude`: privately ignores Burnoff's local files so `git status` stays spotless without touching `.gitignore`.
97
-
98
- ## CLI Commands
99
-
100
- | Command | Purpose |
101
- | :--- | :--- |
102
- | `burnoff init [--dry-run]` | Wire `PreToolUse`, `PostToolUse`, and `PostToolUseFailure` hooks and update `.git/info/exclude`. |
103
- | `burnoff uninstall [--dry-run]` | Remove Burnoff hooks and `.git/info/exclude` block. |
104
- | `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. |
107
- | `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
- | `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
- | `burnoff team-digest [--days 7]` | Output a 5-line weekly summary of local spend, cache efficiency, top cost driver, and guard savings. |
110
- | `burnoff search <turnId> [keyword]` | Search archived FTS5 CLI output without re-running expensive test or build commands. |
111
- | `burnoff daemon <start\|stop\|status>` | Manage the workspace-scoped warm IPC daemon (`~/.burnoff/run/` or Windows named pipe). |
112
-
113
- ## For Teams: Repo Policy & GitHub Actions
114
-
115
- Commit an optional `.burnoff.yaml` in your repository root so every developer shares the same deterministic guardrails, read bounds, and CI gate thresholds:
116
-
117
- ```yaml
118
- guards:
119
- mode: guard
120
- det04Threshold: 3
121
- strictTestIntegrity: false
122
- scopeLockEnabled: true
123
- subagentFanoutEnabled: true
124
- subagentFanoutAction: advisory
125
- subagentMaxBurstCount: 4
126
- subagentBurstWindowSec: 60
127
- subagentMaxPromptChars: 8000
128
-
129
- readClamp:
130
- enabled: true
131
- maxLines: 250
132
- maxBytes: 16384
133
- neverClampCodeOffCliff: true
134
-
135
- postTool:
136
- fts5Enabled: true
137
- minBytesToCompress: 6144
138
- retentionDays: 30
139
-
140
- ciBudgetGate:
141
- maxPrCostUsd: 15
142
- maxPrTokens: 1500000
143
- minCacheHitPct: 50
144
- maxWasteRatioPct: 35
145
- maxRing0Violations: 0
146
- mode: enforce
147
- failOnMissingTranscripts: false
148
- ```
149
-
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.3.0`:
151
-
152
- - Runs `npx -y burnoff@1.3.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.3.0 ci-gate --input .burnoff-ci/pr-cost.json --strict --github-annotations`.
154
- - Appends the Markdown breakdown to `$GITHUB_STEP_SUMMARY` and posts non-fork PR summary comments.
155
-
156
- > **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
-
158
- ## Turn-0 CI Config Linting (`audit --startup --ci`)
159
-
160
- 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:
161
-
162
- ```bash
163
- npx -y burnoff@1.3.0 audit --startup --ci --github-annotations --client auto
164
- ```
165
-
166
- Pass `--strict` to fail the workflow on warn-level lints as well as error-level secret/deprecated-model findings.
167
-
168
- ## Temporary `ask` Overrides (`allow-once` & `snooze`)
169
-
170
- When an interactive `ask` prompt (`DET-01` soft discard, `DET-02` public-cert/arg check, `DET-03` lockfile/workflow edit, or `DET-04` warn-mode loop pause) blocks an intentional action:
171
-
172
- ```bash
173
- npx -y burnoff@1.3.0 allow-once DET-03 --scope deploy.yml
174
- npx -y burnoff@1.3.0 snooze DET-04 --minutes 15
175
- npx -y burnoff@1.3.0 allow-once --list
176
- npx -y burnoff@1.3.0 allow-once --clear
177
- ```
178
-
179
- `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.
180
-
181
- ## Claude Code Plugin & Status Line
182
-
183
- 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.
184
-
185
- ## Environment Variables
186
-
187
- - `BURNOFF_HOME`: Override `~/.burnoff/` state directory.
188
- - `BURNOFF_IPC_PATH`: Override daemon named pipe / Unix domain socket path.
189
- - `BURNOFF_PRETOOL_FAIL_MODE`: Set to `closed` to fail-closed on internal hook faults (guard `exitCode: 2` blocks always fail-closed).
190
- - `BURNOFF_POST_OUTPUT_MODE`: Override `PostToolUse` output mode (`auto`, `updatedToolOutput`, `additionalContext`).
191
- - `BURNOFF_TIER1_ACTIVE`: Set to `1` to enable Tier-1 `Grep`/`Glob` fast-path pass-through.
192
-
193
- ## License
194
-
195
- MIT — see [LICENSE](LICENSE).
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).
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.3.0';
30
+ return '1.4.1';
31
31
  }
32
32
 
33
33
  const BOOLEAN_FLAGS = new Set([
@@ -104,9 +104,9 @@ function formatHelp() {
104
104
  ' init [--client claude|antigravity|both|auto] [--global] [--dry-run] [--cwd <dir>] Install Burnoff hooks',
105
105
  ' uninstall [--client claude|antigravity|both|auto] [--global] [--dry-run] [--cwd <dir>] Remove Burnoff hooks',
106
106
  ' doctor [--gc] [--json] Run Node/SQLite/hooks/daemon/FTS5/ledger diagnostics',
107
- ' audit [--startup [--ci] [--strict] [--github-annotations]] [--client auto|claude|antigravity|both] [--session <file>] [--json] Audit transcripts or Turn-0 config',
108
- ' allow-once [DET-01..DET-04|*] [--scope <substr>] [--minutes <N>] [--session <id>] [--list|--clear] Temporary ask-gate override',
109
- ' snooze [DET-01..DET-04|*] [--minutes 15] [--scope <substr>] [--session <id>] [--list|--clear] Timed ask-gate snooze',
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',
110
110
  ' pr-cost [--base main] [--client auto|claude|antigravity|both] [--json|--markdown] Attribute branch commits to AI cost',
111
111
  ' export [--since <sha>] [--out <file>] Export PR attribution JSON for CI budget gate',
112
112
  ' ci-gate [--strict] [--github-annotations] Enforce .burnoff.yaml ciBudgetGate thresholds',
@@ -229,6 +229,7 @@ async function handleAudit(flags, io) {
229
229
  homeDir: flags.home || undefined,
230
230
  client: clientOpt,
231
231
  sessionPath: typeof flags.session === 'string' ? flags.session : undefined,
232
+ otelPath: typeof flags.otel === 'string' ? flags.otel : undefined,
232
233
  limit: flags.limit ? Number(flags.limit) : undefined
233
234
  });
234
235
  const text = flags.json ? JSON.stringify(report, null, 2) + '\n' : formatAuditReport(report);
@@ -485,7 +486,7 @@ async function handleAllowOnce(cmd, positionals, flags, io) {
485
486
  const rawDetArg = positionals[1];
486
487
  const detectorId = normalizeSnoozeDetectorId(rawDetArg === undefined ? '*' : rawDetArg);
487
488
  if (!detectorId) {
488
- io.stderr.write(`Invalid detector ID "${rawDetArg}". Expected DET-01..DET-04, all, or *.\n`);
489
+ io.stderr.write(`Invalid detector ID "${rawDetArg}". Expected DET-01..DET-04, DET-07..DET-09, all, or *.\n`);
489
490
  return 1;
490
491
  }
491
492
 
@@ -3,13 +3,13 @@ description: Run Burnoff diagnostics, Turn-0 startup audits, ask-gate overrides,
3
3
  argument-hint: "[doctor|audit|startup|allow-once <DET-xx>|snooze <DET-xx>|pr-cost|team-digest|init]"
4
4
  ---
5
5
 
6
- Run Burnoff (`npx -y burnoff@1.3.0` or local `node bin/burnoff.mjs` when developing in the Burnoff repo) according to `$ARGUMENTS`:
6
+ Run Burnoff (`npx -y burnoff@1.4.1` or local `node bin/burnoff.mjs` when developing in the Burnoff repo) according to `$ARGUMENTS`:
7
7
 
8
8
  - Empty arguments: run `burnoff doctor` and `burnoff team-digest --days 7` and summarize findings clearly.
9
9
  - `doctor`: run `burnoff doctor` to verify Node/SQLite FTS5, hooks, and warm daemon health.
10
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
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`; never bypasses `deny` hard blocks).
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
13
  - `pr-cost` or `team-digest`: run `burnoff $ARGUMENTS` to inspect AI branch cost attribution or 7-day savings telemetry.
14
14
  - `init`: run `burnoff init --client claude` to install/refresh `.claude/settings.local.json` hooks deterministically.
15
15
 
@@ -7,7 +7,7 @@ Burnoff ships a lightweight Claude Code plugin manifest (`.claude-plugin/plugin.
7
7
  Run the CLI installer in your repository (or pass `--global` for user-wide defaults):
8
8
 
9
9
  ```bash
10
- npx -y burnoff@1.3.0 init --client claude
10
+ npx -y burnoff@1.4.1 init --client claude
11
11
  ```
12
12
 
13
13
  Why hooks are installed via `burnoff init` instead of a static hook file:
@@ -16,7 +16,7 @@ Why hooks are installed via `burnoff init` instead of a static hook file:
16
16
  - Verify installation anytime with:
17
17
 
18
18
  ```bash
19
- npx -y burnoff@1.3.0 doctor
19
+ npx -y burnoff@1.4.1 doctor
20
20
  ```
21
21
 
22
22
  ## 2. Enable `/burnoff` Slash Command
@@ -58,10 +58,10 @@ burnoff | saved: 14.2k tok ($0.04) | guards: 2 | ctx: 38%
58
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
59
 
60
60
  ```bash
61
- npx -y burnoff@1.3.0 allow-once DET-03 --scope deploy.yml
62
- npx -y burnoff@1.3.0 snooze DET-04 --minutes 15
63
- npx -y burnoff@1.3.0 allow-once --list
64
- npx -y burnoff@1.3.0 allow-once --clear
61
+ npx -y burnoff@1.4.1 allow-once DET-03 --scope deploy.yml
62
+ npx -y burnoff@1.4.1 snooze DET-04 --minutes 15
63
+ npx -y burnoff@1.4.1 allow-once --list
64
+ npx -y burnoff@1.4.1 allow-once --clear
65
65
  ```
66
66
 
67
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.
@@ -30,9 +30,9 @@ Burnoff (`MIT`, zero runtime dependencies, 100% local execution) is onboarding a
30
30
  Run inside a representative repo and paste sanitized summary lines only:
31
31
 
32
32
  ```bash
33
- npx -y burnoff@1.3.0 doctor
34
- npx -y burnoff@1.3.0 audit --startup --ci
35
- npx -y burnoff@1.3.0 team-digest --days 7
33
+ npx -y burnoff@1.4.1 doctor
34
+ npx -y burnoff@1.4.1 audit --startup --ci
35
+ npx -y burnoff@1.4.1 team-digest --days 7
36
36
  ```
37
37
 
38
38
  ### 4. Security & Privacy Requirements