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.
- 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 +213 -195
- 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/hooks/hook-io.mjs +691 -599
- package/package.json +1 -1
- package/scripts/bench-hooks.mjs +252 -0
- package/scripts/burnoff-statusline.mjs +20 -0
- package/src/cli/audit.mjs +82 -4
- package/src/cli/doctor.mjs +583 -462
- package/src/cli/hook-health.mjs +429 -0
- package/src/cli/init.mjs +668 -646
- package/src/cli/startup-audit.mjs +147 -2
- package/src/clients/antigravity.mjs +285 -285
- package/src/config/policy.mjs +307 -294
- package/src/guards/credential-scrubber.mjs +185 -0
- package/src/guards/loop-breaker.mjs +797 -744
- package/src/guards/phase5-detectors.mjs +727 -0
- package/src/guards/post-tool-engine.mjs +875 -854
- package/src/guards/pre-tool-engine.mjs +973 -846
- package/src/guards/read-clamp.mjs +826 -804
- package/src/guards/shell-guard.mjs +1705 -1676
- package/src/guards/snooze.mjs +5 -2
- package/src/guards/structural-boundaries.mjs +175 -0
- package/src/ipc/fast-client.mjs +255 -255
- package/src/storage/antigravity-parser.mjs +18 -1
- package/src/storage/fts5-archive.mjs +734 -733
- package/src/storage/jsonl-parser.mjs +29 -1
- package/src/storage/telemetry-metrics.mjs +703 -0
|
@@ -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,
|