preflight-dev 3.1.0 → 3.2.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/README.md +77 -16
- package/dist/cli/init.js +0 -48
- package/dist/cli/init.js.map +1 -1
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/contracts.d.ts +27 -0
- package/dist/lib/contracts.js +309 -0
- package/dist/lib/contracts.js.map +1 -0
- package/dist/lib/patterns.d.ts +38 -0
- package/dist/lib/patterns.js +176 -0
- package/dist/lib/patterns.js.map +1 -0
- package/dist/lib/triage.d.ts +2 -0
- package/dist/lib/triage.js.map +1 -1
- package/dist/profiles.js +4 -0
- package/dist/profiles.js.map +1 -1
- package/dist/tools/check-patterns.d.ts +2 -0
- package/dist/tools/check-patterns.js +33 -0
- package/dist/tools/check-patterns.js.map +1 -0
- package/dist/tools/clarify-intent.js +9 -1
- package/dist/tools/clarify-intent.js.map +1 -1
- package/dist/tools/enrich-agent-task.js +132 -3
- package/dist/tools/enrich-agent-task.js.map +1 -1
- package/dist/tools/estimate-cost.d.ts +2 -0
- package/dist/tools/estimate-cost.js +261 -0
- package/dist/tools/estimate-cost.js.map +1 -0
- package/dist/tools/generate-scorecard.js +466 -14
- package/dist/tools/generate-scorecard.js.map +1 -1
- package/dist/tools/log-correction.js +7 -1
- package/dist/tools/log-correction.js.map +1 -1
- package/dist/tools/onboard-project.js +10 -1
- package/dist/tools/onboard-project.js.map +1 -1
- package/dist/tools/preflight-check.js +16 -0
- package/dist/tools/preflight-check.js.map +1 -1
- package/dist/tools/scope-work.js +6 -0
- package/dist/tools/scope-work.js.map +1 -1
- package/dist/tools/search-contracts.d.ts +2 -0
- package/dist/tools/search-contracts.js +46 -0
- package/dist/tools/search-contracts.js.map +1 -0
- package/dist/tools/session-stats.js +2 -0
- package/dist/tools/session-stats.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +7 -0
- package/src/lib/contracts.ts +354 -0
- package/src/lib/patterns.ts +210 -0
- package/src/lib/triage.ts +2 -0
- package/src/profiles.ts +4 -0
- package/src/tools/check-patterns.ts +43 -0
- package/src/tools/clarify-intent.ts +10 -1
- package/src/tools/enrich-agent-task.ts +150 -3
- package/src/tools/estimate-cost.ts +332 -0
- package/src/tools/generate-scorecard.ts +541 -14
- package/src/tools/log-correction.ts +8 -1
- package/src/tools/onboard-project.ts +10 -1
- package/src/tools/preflight-check.ts +19 -0
- package/src/tools/scope-work.ts +7 -0
- package/src/tools/search-contracts.ts +61 -0
- package/src/tools/session-stats.ts +2 -0
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
// =============================================================================
|
|
2
|
+
// estimate_cost — Estimate token usage and cost for a Claude Code session
|
|
3
|
+
// =============================================================================
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { readFileSync, statSync } from "node:fs";
|
|
6
|
+
import { basename } from "node:path";
|
|
7
|
+
import { findSessionDirs, findSessionFiles } from "../lib/session-parser.js";
|
|
8
|
+
// ── Pricing (per 1M tokens) ────────────────────────────────────────────────
|
|
9
|
+
const PRICING = {
|
|
10
|
+
"claude-sonnet-4": { input: 3.0, output: 15.0 },
|
|
11
|
+
"claude-opus-4": { input: 15.0, output: 75.0 },
|
|
12
|
+
"claude-haiku-3.5": { input: 0.8, output: 4.0 },
|
|
13
|
+
};
|
|
14
|
+
const DEFAULT_MODEL = "claude-sonnet-4";
|
|
15
|
+
const CORRECTION_SIGNALS = /\b(no[,.\s]|wrong|not that|i meant|actually|try again|revert|undo|that's not|not what i)\b/i;
|
|
16
|
+
const PREFLIGHT_TOOLS = new Set([
|
|
17
|
+
"preflight_check",
|
|
18
|
+
"clarify_intent",
|
|
19
|
+
"scope_work",
|
|
20
|
+
"sharpen_followup",
|
|
21
|
+
"token_audit",
|
|
22
|
+
"prompt_score",
|
|
23
|
+
]);
|
|
24
|
+
// ── Helpers ─────────────────────────────────────────────────────────────────
|
|
25
|
+
function estimateTokens(text) {
|
|
26
|
+
return Math.ceil(text.length / 4);
|
|
27
|
+
}
|
|
28
|
+
function extractText(content) {
|
|
29
|
+
if (typeof content === "string")
|
|
30
|
+
return content;
|
|
31
|
+
if (Array.isArray(content)) {
|
|
32
|
+
return content
|
|
33
|
+
.filter((b) => typeof b.text === "string")
|
|
34
|
+
.map((b) => b.text)
|
|
35
|
+
.join("\n");
|
|
36
|
+
}
|
|
37
|
+
return "";
|
|
38
|
+
}
|
|
39
|
+
function extractToolNames(content) {
|
|
40
|
+
if (!Array.isArray(content))
|
|
41
|
+
return [];
|
|
42
|
+
return content
|
|
43
|
+
.filter((b) => b.type === "tool_use" && b.name)
|
|
44
|
+
.map((b) => b.name);
|
|
45
|
+
}
|
|
46
|
+
function formatTokens(n) {
|
|
47
|
+
if (n >= 1_000_000)
|
|
48
|
+
return `${(n / 1_000_000).toFixed(1)}M`;
|
|
49
|
+
if (n >= 1_000)
|
|
50
|
+
return `${(n / 1_000).toFixed(1)}k`;
|
|
51
|
+
return String(n);
|
|
52
|
+
}
|
|
53
|
+
function formatCost(dollars) {
|
|
54
|
+
if (dollars < 0.01)
|
|
55
|
+
return `<$0.01`;
|
|
56
|
+
return `$${dollars.toFixed(2)}`;
|
|
57
|
+
}
|
|
58
|
+
function formatDuration(ms) {
|
|
59
|
+
const mins = Math.floor(ms / 60_000);
|
|
60
|
+
if (mins < 60)
|
|
61
|
+
return `${mins}m`;
|
|
62
|
+
const hours = Math.floor(mins / 60);
|
|
63
|
+
const rem = mins % 60;
|
|
64
|
+
return `${hours}h ${rem}m`;
|
|
65
|
+
}
|
|
66
|
+
function analyzeSessionFile(filePath) {
|
|
67
|
+
const content = readFileSync(filePath, "utf-8");
|
|
68
|
+
const lines = content.trim().split("\n").filter(Boolean);
|
|
69
|
+
const result = {
|
|
70
|
+
inputTokens: 0,
|
|
71
|
+
outputTokens: 0,
|
|
72
|
+
promptCount: 0,
|
|
73
|
+
toolCallCount: 0,
|
|
74
|
+
corrections: 0,
|
|
75
|
+
wastedOutputTokens: 0,
|
|
76
|
+
preflightCalls: 0,
|
|
77
|
+
preflightTokens: 0,
|
|
78
|
+
firstTimestamp: null,
|
|
79
|
+
lastTimestamp: null,
|
|
80
|
+
};
|
|
81
|
+
let lastType = "";
|
|
82
|
+
let lastAssistantTokens = 0;
|
|
83
|
+
for (const line of lines) {
|
|
84
|
+
let obj;
|
|
85
|
+
try {
|
|
86
|
+
obj = JSON.parse(line);
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
91
|
+
// Track timestamps
|
|
92
|
+
const ts = obj.timestamp;
|
|
93
|
+
if (ts) {
|
|
94
|
+
const tsStr = typeof ts === "string" ? ts : new Date(ts < 1e12 ? ts * 1000 : ts).toISOString();
|
|
95
|
+
if (!result.firstTimestamp)
|
|
96
|
+
result.firstTimestamp = tsStr;
|
|
97
|
+
result.lastTimestamp = tsStr;
|
|
98
|
+
}
|
|
99
|
+
if (obj.type === "user") {
|
|
100
|
+
const text = extractText(obj.message?.content);
|
|
101
|
+
const tokens = estimateTokens(text);
|
|
102
|
+
result.inputTokens += tokens;
|
|
103
|
+
result.promptCount++;
|
|
104
|
+
// Correction detection
|
|
105
|
+
if (lastType === "assistant" && CORRECTION_SIGNALS.test(text)) {
|
|
106
|
+
result.corrections++;
|
|
107
|
+
result.wastedOutputTokens += lastAssistantTokens;
|
|
108
|
+
}
|
|
109
|
+
lastType = "user";
|
|
110
|
+
}
|
|
111
|
+
else if (obj.type === "assistant") {
|
|
112
|
+
const msgContent = obj.message?.content;
|
|
113
|
+
const text = extractText(msgContent);
|
|
114
|
+
const tokens = estimateTokens(text);
|
|
115
|
+
result.outputTokens += tokens;
|
|
116
|
+
lastAssistantTokens = tokens;
|
|
117
|
+
// Tool calls
|
|
118
|
+
const toolNames = extractToolNames(msgContent);
|
|
119
|
+
result.toolCallCount += toolNames.length;
|
|
120
|
+
for (const name of toolNames) {
|
|
121
|
+
if (PREFLIGHT_TOOLS.has(name)) {
|
|
122
|
+
result.preflightCalls++;
|
|
123
|
+
// Estimate tool call tokens (name + args)
|
|
124
|
+
const toolBlocks = msgContent.filter((b) => b.type === "tool_use" && b.name === name);
|
|
125
|
+
for (const tb of toolBlocks) {
|
|
126
|
+
result.preflightTokens += estimateTokens(JSON.stringify(tb.input ?? {}));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
lastType = "assistant";
|
|
131
|
+
}
|
|
132
|
+
else if (obj.type === "tool_result") {
|
|
133
|
+
const text = extractText(obj.content);
|
|
134
|
+
const tokens = estimateTokens(text);
|
|
135
|
+
result.inputTokens += tokens;
|
|
136
|
+
// Check if this is a preflight tool result
|
|
137
|
+
if (obj.tool_use_id) {
|
|
138
|
+
// We can't perfectly match tool_use_id to name, so count tokens as preflight
|
|
139
|
+
// if they're small (typical preflight responses)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return result;
|
|
144
|
+
}
|
|
145
|
+
// ── Registration ────────────────────────────────────────────────────────────
|
|
146
|
+
export function registerEstimateCost(server) {
|
|
147
|
+
server.tool("estimate_cost", "Estimate token usage and cost for the current session. Shows waste from vague prompts and savings from preflight checks.", {
|
|
148
|
+
session_dir: z
|
|
149
|
+
.string()
|
|
150
|
+
.optional()
|
|
151
|
+
.describe("Path to session JSONL file (optional, uses latest if omitted)"),
|
|
152
|
+
model: z
|
|
153
|
+
.string()
|
|
154
|
+
.optional()
|
|
155
|
+
.describe("Pricing model to use (claude-sonnet-4, claude-opus-4, claude-haiku-3.5). Default: claude-sonnet-4"),
|
|
156
|
+
}, async ({ session_dir, model }) => {
|
|
157
|
+
const pricingModel = model && PRICING[model] ? model : DEFAULT_MODEL;
|
|
158
|
+
const pricing = PRICING[pricingModel];
|
|
159
|
+
// Find session file
|
|
160
|
+
let filePath;
|
|
161
|
+
if (session_dir) {
|
|
162
|
+
filePath = session_dir;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
// Find latest session file
|
|
166
|
+
const dirs = findSessionDirs();
|
|
167
|
+
let latest = null;
|
|
168
|
+
for (const dir of dirs) {
|
|
169
|
+
const files = findSessionFiles(dir.sessionDir);
|
|
170
|
+
for (const f of files) {
|
|
171
|
+
if (!latest || f.mtime > latest.mtime) {
|
|
172
|
+
latest = f;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
if (!latest) {
|
|
177
|
+
return {
|
|
178
|
+
content: [
|
|
179
|
+
{
|
|
180
|
+
type: "text",
|
|
181
|
+
text: "No session files found in ~/.claude/projects/",
|
|
182
|
+
},
|
|
183
|
+
],
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
filePath = latest.path;
|
|
187
|
+
}
|
|
188
|
+
// Verify file exists
|
|
189
|
+
try {
|
|
190
|
+
statSync(filePath);
|
|
191
|
+
}
|
|
192
|
+
catch {
|
|
193
|
+
return {
|
|
194
|
+
content: [
|
|
195
|
+
{
|
|
196
|
+
type: "text",
|
|
197
|
+
text: `Session file not found: ${filePath}`,
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
const analysis = analyzeSessionFile(filePath);
|
|
203
|
+
const totalTokens = analysis.inputTokens + analysis.outputTokens;
|
|
204
|
+
const inputCost = (analysis.inputTokens / 1_000_000) * pricing.input;
|
|
205
|
+
const outputCost = (analysis.outputTokens / 1_000_000) * pricing.output;
|
|
206
|
+
const totalCost = inputCost + outputCost;
|
|
207
|
+
const wasteCost = (analysis.wastedOutputTokens / 1_000_000) * pricing.output;
|
|
208
|
+
const wastePercent = totalCost > 0 ? ((wasteCost / totalCost) * 100).toFixed(1) : "0";
|
|
209
|
+
// Duration
|
|
210
|
+
let durationStr = "unknown";
|
|
211
|
+
if (analysis.firstTimestamp && analysis.lastTimestamp) {
|
|
212
|
+
const ms = new Date(analysis.lastTimestamp).getTime() -
|
|
213
|
+
new Date(analysis.firstTimestamp).getTime();
|
|
214
|
+
if (ms > 0)
|
|
215
|
+
durationStr = formatDuration(ms);
|
|
216
|
+
}
|
|
217
|
+
// Preflight impact
|
|
218
|
+
const preflightCost = (analysis.preflightTokens / 1_000_000) * pricing.input;
|
|
219
|
+
// Estimate: each preflight check prevents ~0.5 corrections on average
|
|
220
|
+
const estimatedPrevented = Math.round(analysis.preflightCalls * 0.5);
|
|
221
|
+
// Average wasted tokens per correction
|
|
222
|
+
const avgWastePerCorrection = analysis.corrections > 0
|
|
223
|
+
? analysis.wastedOutputTokens / analysis.corrections
|
|
224
|
+
: 500;
|
|
225
|
+
const estimatedSavingsTokens = estimatedPrevented * avgWastePerCorrection;
|
|
226
|
+
const estimatedSavingsCost = (estimatedSavingsTokens / 1_000_000) * pricing.output;
|
|
227
|
+
// Build report
|
|
228
|
+
const lines = [
|
|
229
|
+
`📊 Session Cost Estimate`,
|
|
230
|
+
`━━━━━━━━━━━━━━━━━━━━━━`,
|
|
231
|
+
`Duration: ${durationStr} | ${analysis.promptCount} prompts | ${analysis.toolCallCount} tool calls`,
|
|
232
|
+
`File: ${basename(filePath)}`,
|
|
233
|
+
``,
|
|
234
|
+
`Token Usage (estimated):`,
|
|
235
|
+
` Input: ~${formatTokens(analysis.inputTokens)} tokens`,
|
|
236
|
+
` Output: ~${formatTokens(analysis.outputTokens)} tokens`,
|
|
237
|
+
` Total: ~${formatTokens(totalTokens)} tokens`,
|
|
238
|
+
``,
|
|
239
|
+
`Estimated Cost: ~${formatCost(totalCost)} (${pricingModel.replace(/-/g, " ").replace(/\b\w/g, (c) => c.toUpperCase())})`,
|
|
240
|
+
];
|
|
241
|
+
if (analysis.corrections > 0) {
|
|
242
|
+
lines.push(``, `Waste Analysis:`, ` Corrections detected: ${analysis.corrections}`, ` Wasted output tokens: ~${formatTokens(analysis.wastedOutputTokens)}`, ` Estimated waste: ~${formatCost(wasteCost)} (${wastePercent}% of total)`);
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
lines.push(``, `Waste Analysis:`, ` No corrections detected 🎯`);
|
|
246
|
+
}
|
|
247
|
+
if (analysis.preflightCalls > 0) {
|
|
248
|
+
lines.push(``, `Preflight Impact:`, ` Preflight checks: ${analysis.preflightCalls} calls (~${formatTokens(analysis.preflightTokens)} tokens)`, ` Preflight cost: ~${formatCost(preflightCost)}`);
|
|
249
|
+
if (estimatedPrevented > 0) {
|
|
250
|
+
lines.push(` Estimated corrections prevented: ${estimatedPrevented}`, ` Estimated savings: ~${formatCost(estimatedSavingsCost)}`, ``, `💡 Net benefit: preflight saved ~${formatCost(estimatedSavingsCost - preflightCost)} this session`);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
lines.push(``, `Preflight Impact:`, ` No preflight checks used this session`, ` 💡 Tip: Use preflight_check to catch issues before they cost tokens`);
|
|
255
|
+
}
|
|
256
|
+
return {
|
|
257
|
+
content: [{ type: "text", text: lines.join("\n") }],
|
|
258
|
+
};
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
//# sourceMappingURL=estimate-cost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"estimate-cost.js","sourceRoot":"","sources":["../../src/tools/estimate-cost.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,0EAA0E;AAC1E,gFAAgF;AAGhF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE7E,8EAA8E;AAE9E,MAAM,OAAO,GAAsD;IACjE,iBAAiB,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE;IAC/C,eAAe,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE;IAC9C,kBAAkB,EAAE,EAAE,K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