burnoff 1.3.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.
- package/.claude-plugin/plugin.json +1 -1
- package/.github/workflows/burnoff-pr-gate.yml +3 -3
- package/.github/workflows/burnoff-startup-lint.yml +2 -2
- package/README.md +26 -12
- package/bin/burnoff.mjs +6 -5
- package/commands/burnoff.md +2 -2
- package/docs/CLAUDE_CODE_PLUGIN.md +6 -6
- package/docs/DESIGN_PARTNER_INTAKE.md +3 -3
- package/package.json +1 -1
- package/scripts/burnoff-statusline.mjs +20 -0
- package/src/cli/audit.mjs +82 -4
- package/src/cli/startup-audit.mjs +147 -2
- package/src/config/policy.mjs +13 -1
- package/src/guards/loop-breaker.mjs +49 -0
- package/src/guards/phase5-detectors.mjs +727 -0
- package/src/guards/pre-tool-engine.mjs +146 -14
- package/src/guards/snooze.mjs +5 -2
- package/src/storage/antigravity-parser.mjs +18 -1
- package/src/storage/jsonl-parser.mjs +29 -1
- package/src/storage/telemetry-metrics.mjs +703 -0
|
@@ -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.
|
|
34
|
-
npx -y burnoff@1.
|
|
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.
|
|
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"
|
|
@@ -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.
|
|
30
|
+
# External consumers copying this workflow can use npx -y burnoff@1.4.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.
|
|
35
|
+
npx -y burnoff@1.4.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/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
|
+

|
|
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,
|
|
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
|
|
106
|
-
| `burnoff audit [--session <file>] [--json]` | Parse local JSONL transcripts
|
|
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,10 +160,10 @@ 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.
|
|
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.
|
|
153
|
-
- Runs `npx -y burnoff@1.
|
|
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.
|
|
@@ -160,20 +173,21 @@ See [`.github/workflows/burnoff-pr-gate.yml`](.github/workflows/burnoff-pr-gate.
|
|
|
160
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:
|
|
161
174
|
|
|
162
175
|
```bash
|
|
163
|
-
npx -y burnoff@1.
|
|
176
|
+
npx -y burnoff@1.4.0 audit --startup --ci --github-annotations --client auto
|
|
164
177
|
```
|
|
165
178
|
|
|
166
179
|
Pass `--strict` to fail the workflow on warn-level lints as well as error-level secret/deprecated-model findings.
|
|
167
180
|
|
|
168
181
|
## Temporary `ask` Overrides (`allow-once` & `snooze`)
|
|
169
182
|
|
|
170
|
-
When an interactive `ask` prompt (`DET-01` soft discard, `DET-02` public-cert/arg check, `DET-03` lockfile/workflow edit, or `DET-
|
|
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:
|
|
171
184
|
|
|
172
185
|
```bash
|
|
173
|
-
npx -y burnoff@1.
|
|
174
|
-
npx -y burnoff@1.
|
|
175
|
-
npx -y burnoff@1.
|
|
176
|
-
npx -y burnoff@1.
|
|
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
|
|
177
191
|
```
|
|
178
192
|
|
|
179
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.
|
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.
|
|
30
|
+
return '1.4.0';
|
|
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
|
|
package/commands/burnoff.md
CHANGED
|
@@ -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.
|
|
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
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.
|
|
10
|
+
npx -y burnoff@1.4.0 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.
|
|
19
|
+
npx -y burnoff@1.4.0 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.
|
|
62
|
-
npx -y burnoff@1.
|
|
63
|
-
npx -y burnoff@1.
|
|
64
|
-
npx -y burnoff@1.
|
|
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
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.
|
|
34
|
-
npx -y burnoff@1.
|
|
35
|
-
npx -y burnoff@1.
|
|
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
36
|
```
|
|
37
37
|
|
|
38
38
|
### 4. Security & Privacy Requirements
|
package/package.json
CHANGED
|
@@ -61,6 +61,26 @@ export function renderBurnoffStatusLine(inputJson = {}, options = {}) {
|
|
|
61
61
|
parts.push(`sess: ${formatUsd(sessionCost)}`);
|
|
62
62
|
}
|
|
63
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
|
+
|
|
64
84
|
return parts.join(' | ');
|
|
65
85
|
}
|
|
66
86
|
|
package/src/cli/audit.mjs
CHANGED
|
@@ -20,6 +20,14 @@ import {
|
|
|
20
20
|
import { getSavedQuotaReceiptSummary } from '../storage/ledger.mjs';
|
|
21
21
|
import { attributeUncachedTokens } from '../config/uncached-attribution.mjs';
|
|
22
22
|
import { valuateBatch } from '../config/pricing.mjs';
|
|
23
|
+
import {
|
|
24
|
+
discoverAntigravityConversationDbs,
|
|
25
|
+
readAntigravityConversationDbMetrics,
|
|
26
|
+
discoverLocalOtelFiles,
|
|
27
|
+
parseOtelGenAiSpans,
|
|
28
|
+
extractStepTimingMetrics,
|
|
29
|
+
aggregateTelemetryMetrics
|
|
30
|
+
} from '../storage/telemetry-metrics.mjs';
|
|
23
31
|
|
|
24
32
|
function summarizeParsedSession(meta, parsed, options = {}) {
|
|
25
33
|
const steps = Array.isArray(parsed?.steps) ? parsed.steps : [];
|
|
@@ -111,6 +119,8 @@ function summarizeParsedSession(meta, parsed, options = {}) {
|
|
|
111
119
|
const uncachedAttribution = attributeUncachedTokens(attributionCalls, {
|
|
112
120
|
claudeCodeVersion: options.claudeCodeVersion || null
|
|
113
121
|
});
|
|
122
|
+
const stepTimings = steps.map(extractStepTimingMetrics);
|
|
123
|
+
const sessionTelemetry = aggregateTelemetryMetrics({ stepTimings });
|
|
114
124
|
|
|
115
125
|
return {
|
|
116
126
|
sessionId,
|
|
@@ -134,6 +144,13 @@ function summarizeParsedSession(meta, parsed, options = {}) {
|
|
|
134
144
|
: 0,
|
|
135
145
|
entrypoint,
|
|
136
146
|
mtimeMs: meta.mtimeMs || 0,
|
|
147
|
+
telemetry: {
|
|
148
|
+
ttftSampleCount: sessionTelemetry.ttftSampleCount,
|
|
149
|
+
tpsSampleCount: sessionTelemetry.tpsSampleCount,
|
|
150
|
+
medianTtftMs: sessionTelemetry.medianTtftMs,
|
|
151
|
+
medianTokensPerSec: sessionTelemetry.medianTokensPerSec
|
|
152
|
+
},
|
|
153
|
+
_stepTimings: stepTimings,
|
|
137
154
|
attributionCalls,
|
|
138
155
|
uncachedAttribution
|
|
139
156
|
};
|
|
@@ -148,6 +165,9 @@ export function auditClaudeSessions(options = {}) {
|
|
|
148
165
|
: null;
|
|
149
166
|
const homeDir = explicitHomeDir || getHomeDir();
|
|
150
167
|
const limit = Math.max(1, Number(options.limit ?? 20));
|
|
168
|
+
const clientOpt = String(options.client || 'auto').trim().toLowerCase();
|
|
169
|
+
const includeAg =
|
|
170
|
+
clientOpt === 'antigravity' || clientOpt === 'ag' || clientOpt === 'both' || clientOpt === 'auto';
|
|
151
171
|
let candidates;
|
|
152
172
|
if (options.sessionPath) {
|
|
153
173
|
const abs = path.resolve(options.sessionPath);
|
|
@@ -162,10 +182,7 @@ export function auditClaudeSessions(options = {}) {
|
|
|
162
182
|
}
|
|
163
183
|
];
|
|
164
184
|
} else {
|
|
165
|
-
const clientOpt = String(options.client || 'auto').trim().toLowerCase();
|
|
166
185
|
const includeClaude = clientOpt !== 'antigravity' && clientOpt !== 'ag';
|
|
167
|
-
const includeAg =
|
|
168
|
-
clientOpt === 'antigravity' || clientOpt === 'ag' || clientOpt === 'both' || clientOpt === 'auto';
|
|
169
186
|
const claudeList = includeClaude ? discoverClaudeCodeSessions(homeDir, options) : [];
|
|
170
187
|
const agList = includeAg ? discoverAntigravityTranscripts({ homeDir, cwd: options.cwd }) : [];
|
|
171
188
|
candidates = [...claudeList, ...agList]
|
|
@@ -232,11 +249,53 @@ export function auditClaudeSessions(options = {}) {
|
|
|
232
249
|
const uncachedAttribution = attributeUncachedTokens(allAttributionCalls, {
|
|
233
250
|
claudeCodeVersion: options.claudeCodeVersion || null
|
|
234
251
|
});
|
|
235
|
-
|
|
252
|
+
|
|
253
|
+
const otelFiles =
|
|
254
|
+
options.otelPath || !options.sessionPath
|
|
255
|
+
? discoverLocalOtelFiles({ homeDir, otelPath: options.otelPath || null })
|
|
256
|
+
: [];
|
|
257
|
+
const otelSpans = [];
|
|
258
|
+
for (const otelFile of otelFiles) {
|
|
259
|
+
otelSpans.push(...parseOtelGenAiSpans(otelFile).spans);
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
let dbPaths = [];
|
|
263
|
+
if (Array.isArray(options.antigravityDbPath)) {
|
|
264
|
+
dbPaths = options.antigravityDbPath.filter(Boolean);
|
|
265
|
+
} else if (typeof options.antigravityDbPath === 'string' && options.antigravityDbPath.trim()) {
|
|
266
|
+
dbPaths = [options.antigravityDbPath.trim()];
|
|
267
|
+
} else if (options.antigravityDbDir || (includeAg && !options.sessionPath)) {
|
|
268
|
+
dbPaths = discoverAntigravityConversationDbs({
|
|
269
|
+
homeDir,
|
|
270
|
+
conversationDirs: options.antigravityDbDir ? [options.antigravityDbDir] : null,
|
|
271
|
+
maxDbs: Math.min(limit, 50)
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
const antigravityDbSteps = [];
|
|
275
|
+
let antigravityDbsScanned = 0;
|
|
276
|
+
for (const dbPath of dbPaths) {
|
|
277
|
+
const dbRes = readAntigravityConversationDbMetrics(dbPath);
|
|
278
|
+
if (dbRes.ok) {
|
|
279
|
+
antigravityDbsScanned += 1;
|
|
280
|
+
antigravityDbSteps.push(...dbRes.steps);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const allStepTimings = sessions.flatMap((s) => s._stepTimings || []);
|
|
285
|
+
const telemetry = aggregateTelemetryMetrics({
|
|
286
|
+
stepTimings: allStepTimings,
|
|
287
|
+
otelSpans,
|
|
288
|
+
antigravityDbSteps,
|
|
289
|
+
otelFilesScanned: otelFiles.length,
|
|
290
|
+
antigravityDbsScanned
|
|
291
|
+
});
|
|
292
|
+
|
|
293
|
+
const cleanSessions = sessions.map(({ attributionCalls: _calls, _stepTimings: _timings, ...rest }) => rest);
|
|
236
294
|
|
|
237
295
|
return {
|
|
238
296
|
ok: true,
|
|
239
297
|
totals,
|
|
298
|
+
telemetry,
|
|
240
299
|
valuation,
|
|
241
300
|
uncachedAttribution,
|
|
242
301
|
ledger: {
|
|
@@ -263,6 +322,25 @@ export function formatAuditReport(report = {}) {
|
|
|
263
322
|
` Estimated Cost : $${Number(t.estimatedCostUsd || 0).toFixed(4)} | 200k-cliff turns=${t.cliffTurns ?? 0} | rewind branches=${t.rewindBranches ?? 0}${quotaTag}`,
|
|
264
323
|
` Guard Savings : $${Number(report.ledger?.avoidedWriteUSD || 0).toFixed(4)} avoided (${(report.ledger?.avoidedWriteTokens || 0).toLocaleString('en-US')} tok)`
|
|
265
324
|
];
|
|
325
|
+
const perf = report.telemetry;
|
|
326
|
+
if (perf) {
|
|
327
|
+
const perfParts = [];
|
|
328
|
+
if (perf.medianTtftMs !== null && perf.medianTtftMs !== undefined) {
|
|
329
|
+
const label = perf.medianTtftMs >= 1000
|
|
330
|
+
? `${(perf.medianTtftMs / 1000).toFixed(2)}s`
|
|
331
|
+
: `${Math.round(perf.medianTtftMs)}ms`;
|
|
332
|
+
perfParts.push(`TTFT p50=${label}`);
|
|
333
|
+
}
|
|
334
|
+
if (perf.medianTokensPerSec !== null && perf.medianTokensPerSec !== undefined) {
|
|
335
|
+
perfParts.push(`${perf.medianTokensPerSec.toFixed(1)} tok/s (p50)`);
|
|
336
|
+
}
|
|
337
|
+
if (Number(perf.otel?.spanCount || 0) > 0) {
|
|
338
|
+
perfParts.push(`OTel gen_ai spans=${perf.otel.spanCount}`);
|
|
339
|
+
}
|
|
340
|
+
if (perfParts.length > 0) {
|
|
341
|
+
lines.push(` Performance : ${perfParts.join(' | ')}`);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
266
344
|
if (t.sdkCliSessions > 0 || t.sdkCliHeuristicApplied) {
|
|
267
345
|
lines.push(
|
|
268
346
|
` Quota Heuristic: headless sdk-cli (claude -p) observed in ${t.sdkCliSessions || 1} session(s) (~1.8x 5h quota burn heuristic per #97074; observational estimate, not a guaranteed constant).`
|
|
@@ -56,6 +56,8 @@ export const DEFAULT_MCP_INSTRUCTIONS_TOKENS_PER_SERVER = 600;
|
|
|
56
56
|
export const IDLE_COMPACTION_MIN_VERSION = '2.1.290';
|
|
57
57
|
export const DEFAULT_IDLE_COMPACT_MIN_TOKENS = 200000;
|
|
58
58
|
export const SDK_CLI_QUOTA_MULTIPLIER_HEURISTIC = 1.8;
|
|
59
|
+
export const COARSE_META_TOOL_MIN_SERVERS = 3;
|
|
60
|
+
export const COARSE_META_TOOL_MIN_TOKENS = 10000;
|
|
59
61
|
|
|
60
62
|
export const VERIFIED_CLAUDE_FLAGS = Object.freeze([
|
|
61
63
|
'--chrome',
|
|
@@ -951,8 +953,11 @@ function evaluateClaudeEagerMcpGate({
|
|
|
951
953
|
eagerGateActive: false,
|
|
952
954
|
gateReasons: [],
|
|
953
955
|
enableToolSearch,
|
|
956
|
+
toolSearchDisabled,
|
|
954
957
|
disableExperimentalBetas,
|
|
955
958
|
isCustomGateway,
|
|
959
|
+
baseUrl: baseUrl || null,
|
|
960
|
+
isLocalhostProxy: Boolean(baseUrl && isLocalhostBaseUrl(baseUrl)),
|
|
956
961
|
isSshSession,
|
|
957
962
|
gatewayVerified,
|
|
958
963
|
configuredServerCount: discovered.length,
|
|
@@ -987,8 +992,11 @@ function evaluateClaudeEagerMcpGate({
|
|
|
987
992
|
eagerGateActive: true,
|
|
988
993
|
gateReasons,
|
|
989
994
|
enableToolSearch,
|
|
995
|
+
toolSearchDisabled,
|
|
990
996
|
disableExperimentalBetas,
|
|
991
997
|
isCustomGateway,
|
|
998
|
+
baseUrl: baseUrl || null,
|
|
999
|
+
isLocalhostProxy: Boolean(baseUrl && isLocalhostBaseUrl(baseUrl)),
|
|
992
1000
|
isSshSession,
|
|
993
1001
|
gatewayVerified,
|
|
994
1002
|
configuredServerCount: discovered.length,
|
|
@@ -1000,6 +1008,107 @@ function evaluateClaudeEagerMcpGate({
|
|
|
1000
1008
|
};
|
|
1001
1009
|
}
|
|
1002
1010
|
|
|
1011
|
+
/**
|
|
1012
|
+
* Returns true if `rawUrl` points to a loopback / localhost proxy endpoint.
|
|
1013
|
+
*/
|
|
1014
|
+
export function isLocalhostBaseUrl(rawUrl) {
|
|
1015
|
+
const s = String(rawUrl || '').trim();
|
|
1016
|
+
if (!s) return false;
|
|
1017
|
+
try {
|
|
1018
|
+
const u = new URL(s);
|
|
1019
|
+
const host = u.hostname.toLowerCase().replace(/^\[|\]$/g, '');
|
|
1020
|
+
return (
|
|
1021
|
+
host === 'localhost' ||
|
|
1022
|
+
host === '127.0.0.1' ||
|
|
1023
|
+
host === '::1' ||
|
|
1024
|
+
host === '0.0.0.0' ||
|
|
1025
|
+
host === 'host.docker.internal' ||
|
|
1026
|
+
host.endsWith('.localhost')
|
|
1027
|
+
);
|
|
1028
|
+
} catch {
|
|
1029
|
+
return false; // ignore: malformed ANTHROPIC_BASE_URL is not treated as localhost proxy
|
|
1030
|
+
}
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
/**
|
|
1034
|
+
* BO-MCP-10: Eager-only coarse meta-tool coaching + local `ANTHROPIC_BASE_URL`
|
|
1035
|
+
* MCP proxy `CACHE-BACKFIRE TRAP` lint. Never emits coarse meta-tool advice when
|
|
1036
|
+
* native deferred `ToolSearch` loading is healthy (`eagerGateActive === false`).
|
|
1037
|
+
*/
|
|
1038
|
+
export function evaluateMcpProxyAndMetaToolCoaching({
|
|
1039
|
+
harness = 'claude-code',
|
|
1040
|
+
eagerGateActive = false,
|
|
1041
|
+
baseUrl = null,
|
|
1042
|
+
isLocalhostProxy = isLocalhostBaseUrl(baseUrl),
|
|
1043
|
+
gatewayVerified = false,
|
|
1044
|
+
toolSearchDisabled = false,
|
|
1045
|
+
disableExperimentalBetas = false,
|
|
1046
|
+
isSshSession = false,
|
|
1047
|
+
configuredServerCount = 0,
|
|
1048
|
+
configuredServerNames = [],
|
|
1049
|
+
startupTaxTokensPerTurn = 0,
|
|
1050
|
+
file = 'env'
|
|
1051
|
+
} = {}) {
|
|
1052
|
+
const proxyLooksLikeMcpGateway = /mcp|proxy|gateway|router/i.test(String(baseUrl || ''));
|
|
1053
|
+
const proxyCacheBackfireTrap = Boolean(
|
|
1054
|
+
harness === 'claude-code' &&
|
|
1055
|
+
isLocalhostProxy &&
|
|
1056
|
+
!gatewayVerified &&
|
|
1057
|
+
!toolSearchDisabled &&
|
|
1058
|
+
!disableExperimentalBetas &&
|
|
1059
|
+
!isSshSession &&
|
|
1060
|
+
(configuredServerCount > 0 || proxyLooksLikeMcpGateway)
|
|
1061
|
+
);
|
|
1062
|
+
|
|
1063
|
+
const meetsCoarseThreshold =
|
|
1064
|
+
configuredServerCount >= COARSE_META_TOOL_MIN_SERVERS ||
|
|
1065
|
+
Number(startupTaxTokensPerTurn || 0) >= COARSE_META_TOOL_MIN_TOKENS;
|
|
1066
|
+
const coarseMetaToolCoaching = Boolean(eagerGateActive && !proxyCacheBackfireTrap && meetsCoarseThreshold);
|
|
1067
|
+
|
|
1068
|
+
const lints = [];
|
|
1069
|
+
let coachingNote = null;
|
|
1070
|
+
|
|
1071
|
+
if (proxyCacheBackfireTrap) {
|
|
1072
|
+
coachingNote =
|
|
1073
|
+
`CACHE-BACKFIRE TRAP (BO-MCP-10): Localhost ANTHROPIC_BASE_URL proxy (${baseUrl}) wraps an otherwise native-deferred Claude Code setup, risking #95087 beta-header stripping (forcing eager MCP fallback) and extra proxy latency. Unset ANTHROPIC_BASE_URL to restore native ToolSearch deferral, or set BURNOFF_GATEWAY_VERIFIED_TOOL_SEARCH=1 if verified.`;
|
|
1074
|
+
lints.push({
|
|
1075
|
+
ruleId: 'BO-MCP-10',
|
|
1076
|
+
kind: 'proxy_cache_backfire',
|
|
1077
|
+
severity: 'warn',
|
|
1078
|
+
harness,
|
|
1079
|
+
file,
|
|
1080
|
+
message: coachingNote,
|
|
1081
|
+
remediation:
|
|
1082
|
+
'Remove unnecessary local ANTHROPIC_BASE_URL MCP proxies when native Claude Code ToolSearch deferral is available.'
|
|
1083
|
+
});
|
|
1084
|
+
} else if (coarseMetaToolCoaching) {
|
|
1085
|
+
coachingNote =
|
|
1086
|
+
`Eager MCP Coarse Meta-Tool Coaching (BO-MCP-10): Eager schema loading active (${configuredServerCount} servers, ~${Number(startupTaxTokensPerTurn || 0).toLocaleString('en-US')} est. tok/turn). Consolidate fine-grained MCP tools into coarse progressive-disclosure meta-tools or disable unused servers between sessions.`;
|
|
1087
|
+
lints.push({
|
|
1088
|
+
ruleId: 'BO-MCP-10',
|
|
1089
|
+
kind: 'eager_coarse_meta_tool',
|
|
1090
|
+
severity: 'info',
|
|
1091
|
+
harness,
|
|
1092
|
+
file,
|
|
1093
|
+
configuredServers: configuredServerNames,
|
|
1094
|
+
message: coachingNote,
|
|
1095
|
+
remediation:
|
|
1096
|
+
'Consolidate chatty fine-grained MCP tools behind coarse domain actions only while eager loading is unavoidable, or re-enable native ToolSearch deferral.'
|
|
1097
|
+
});
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
return {
|
|
1101
|
+
status: proxyCacheBackfireTrap ? 'warn' : coarseMetaToolCoaching ? 'info' : 'pass',
|
|
1102
|
+
eagerGateActive: Boolean(eagerGateActive),
|
|
1103
|
+
isLocalhostProxy: Boolean(isLocalhostProxy),
|
|
1104
|
+
baseUrl: baseUrl || null,
|
|
1105
|
+
proxyCacheBackfireTrap,
|
|
1106
|
+
coarseMetaToolCoaching,
|
|
1107
|
+
coachingNote,
|
|
1108
|
+
lints
|
|
1109
|
+
};
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1003
1112
|
/**
|
|
1004
1113
|
* BO-MCP-05 (#97616): Scans configured MCP tool definitions and observed Claude Code
|
|
1005
1114
|
* MCP tool names for `mcp__<server>__<tool>` identifiers exceeding 64 characters.
|
|
@@ -2296,6 +2405,20 @@ export function runClaudeStartupAudit({
|
|
|
2296
2405
|
settingsLayers,
|
|
2297
2406
|
harness: 'claude-code'
|
|
2298
2407
|
});
|
|
2408
|
+
const mcpProxyAndMetaTool = evaluateMcpProxyAndMetaToolCoaching({
|
|
2409
|
+
harness: 'claude-code',
|
|
2410
|
+
eagerGateActive: mcpStartupTax.eagerGateActive,
|
|
2411
|
+
baseUrl: mcpStartupTax.baseUrl,
|
|
2412
|
+
isLocalhostProxy: mcpStartupTax.isLocalhostProxy,
|
|
2413
|
+
gatewayVerified: mcpStartupTax.gatewayVerified,
|
|
2414
|
+
toolSearchDisabled: mcpStartupTax.toolSearchDisabled,
|
|
2415
|
+
disableExperimentalBetas: mcpStartupTax.disableExperimentalBetas,
|
|
2416
|
+
isSshSession: mcpStartupTax.isSshSession,
|
|
2417
|
+
configuredServerCount: mcpStartupTax.configuredServerCount,
|
|
2418
|
+
configuredServerNames: mcpStartupTax.configuredServerNames,
|
|
2419
|
+
startupTaxTokensPerTurn: mcpStartupTax.startupTaxTokensPerTurn,
|
|
2420
|
+
file: 'env'
|
|
2421
|
+
});
|
|
2299
2422
|
const sdkCliDetected = telemetry.entrypoints.includes('sdk-cli');
|
|
2300
2423
|
const sdkCliSessionsCount = telemetry.sdkCliSessions7d || (sdkCliDetected ? 1 : 0);
|
|
2301
2424
|
const sdkCliQuotaHeuristic = {
|
|
@@ -2378,6 +2501,7 @@ export function runClaudeStartupAudit({
|
|
|
2378
2501
|
});
|
|
2379
2502
|
}
|
|
2380
2503
|
lints.push(...deprecatedModelsAndFlags.lints);
|
|
2504
|
+
lints.push(...mcpProxyAndMetaTool.lints);
|
|
2381
2505
|
|
|
2382
2506
|
let issueCount = 0;
|
|
2383
2507
|
let estimatedTurn0ReclaimableTokens = 0;
|
|
@@ -2399,6 +2523,7 @@ export function runClaudeStartupAudit({
|
|
|
2399
2523
|
issueCount += 1;
|
|
2400
2524
|
}
|
|
2401
2525
|
for (const l of lints) {
|
|
2526
|
+
if (l.severity === 'info') continue;
|
|
2402
2527
|
if ((l.ruleId === 'BO-CFG-03' || l.ruleId === 'BO-CFG-04') && mcpTaxCounted) continue;
|
|
2403
2528
|
if (l.ruleId === 'BO-CFG-09' && disableArtifactAlreadyCounted && l.message.includes('"disableArtifact"')) continue;
|
|
2404
2529
|
issueCount += 1;
|
|
@@ -2440,6 +2565,7 @@ export function runClaudeStartupAudit({
|
|
|
2440
2565
|
deprecatedModelsAndFlags,
|
|
2441
2566
|
idleCompactionRoi,
|
|
2442
2567
|
volatilePrefix,
|
|
2568
|
+
mcpProxyAndMetaTool,
|
|
2443
2569
|
sdkCliQuotaHeuristic
|
|
2444
2570
|
}
|
|
2445
2571
|
},
|
|
@@ -2524,6 +2650,9 @@ export function formatClaudeStartupAuditReport(report) {
|
|
|
2524
2650
|
if (c.sdkCliQuotaHeuristic?.detected && c.sdkCliQuotaHeuristic.message) {
|
|
2525
2651
|
lines.push(` - [info] ${c.sdkCliQuotaHeuristic.message}`);
|
|
2526
2652
|
}
|
|
2653
|
+
if (c.mcpProxyAndMetaTool?.coachingNote) {
|
|
2654
|
+
lines.push(` - [${c.mcpProxyAndMetaTool.status}] ${c.mcpProxyAndMetaTool.coachingNote}`);
|
|
2655
|
+
}
|
|
2527
2656
|
}
|
|
2528
2657
|
|
|
2529
2658
|
if (r) {
|
|
@@ -2703,9 +2832,17 @@ export function runAntigravityStartupAudit({
|
|
|
2703
2832
|
isEstimated: true,
|
|
2704
2833
|
summaryLine: `Antigravity MCP servers active: ${uniqueServers.length} (~${mcpTaxTokens} est. tok/turn)`
|
|
2705
2834
|
};
|
|
2835
|
+
const mcpProxyAndMetaTool = evaluateMcpProxyAndMetaToolCoaching({
|
|
2836
|
+
harness: 'antigravity',
|
|
2837
|
+
eagerGateActive: uniqueServers.length > 0,
|
|
2838
|
+
configuredServerCount: uniqueServers.length,
|
|
2839
|
+
configuredServerNames: uniqueServers,
|
|
2840
|
+
startupTaxTokensPerTurn: mcpTaxTokens,
|
|
2841
|
+
file: paths.projectMcpJson.replace(/\\/g, '/')
|
|
2842
|
+
});
|
|
2706
2843
|
|
|
2707
|
-
const lints = [...strictJsonSyntax.lints, ...volatilePrefix.lints];
|
|
2708
|
-
let issueCount = lints.length;
|
|
2844
|
+
const lints = [...strictJsonSyntax.lints, ...volatilePrefix.lints, ...mcpProxyAndMetaTool.lints];
|
|
2845
|
+
let issueCount = lints.filter((l) => l.severity !== 'info').length;
|
|
2709
2846
|
let estimatedTurn0ReclaimableTokens = 0;
|
|
2710
2847
|
if (mcpStatus === 'warn') {
|
|
2711
2848
|
issueCount += 1;
|
|
@@ -2729,6 +2866,7 @@ export function runAntigravityStartupAudit({
|
|
|
2729
2866
|
},
|
|
2730
2867
|
checks: {
|
|
2731
2868
|
mcpCheck,
|
|
2869
|
+
mcpProxyAndMetaTool,
|
|
2732
2870
|
strictJsonSyntax,
|
|
2733
2871
|
volatilePrefix
|
|
2734
2872
|
}
|
|
@@ -2762,6 +2900,9 @@ export function formatAntigravityStartupAuditReport(report) {
|
|
|
2762
2900
|
if (c?.mcpCheck) {
|
|
2763
2901
|
lines.push(` - [${c.mcpCheck.status}] ${c.mcpCheck.summaryLine}`);
|
|
2764
2902
|
}
|
|
2903
|
+
if (c?.mcpProxyAndMetaTool?.coachingNote) {
|
|
2904
|
+
lines.push(` - [${c.mcpProxyAndMetaTool.status}] ${c.mcpProxyAndMetaTool.coachingNote}`);
|
|
2905
|
+
}
|
|
2765
2906
|
if (r) {
|
|
2766
2907
|
lines.push(
|
|
2767
2908
|
` - Rules [${r.status}]: ${r.files.length} file(s), ${r.totalRuleCount} always-on rules (${r.onDemandCount} on-demand), ~${r.totalTokensEst.toLocaleString('en-US')} est. tokens`
|
|
@@ -2973,8 +3114,12 @@ export default {
|
|
|
2973
3114
|
IDLE_COMPACTION_MIN_VERSION,
|
|
2974
3115
|
DEFAULT_IDLE_COMPACT_MIN_TOKENS,
|
|
2975
3116
|
SDK_CLI_QUOTA_MULTIPLIER_HEURISTIC,
|
|
3117
|
+
COARSE_META_TOOL_MIN_SERVERS,
|
|
3118
|
+
COARSE_META_TOOL_MIN_TOKENS,
|
|
2976
3119
|
VERIFIED_CLAUDE_FLAGS,
|
|
2977
3120
|
FORBIDDEN_WORKAROUND_FLAGS,
|
|
3121
|
+
isLocalhostBaseUrl,
|
|
3122
|
+
evaluateMcpProxyAndMetaToolCoaching,
|
|
2978
3123
|
formatJsonCliArg,
|
|
2979
3124
|
validateClaudeCliCommand,
|
|
2980
3125
|
inspectJsoncSyntax,
|