Skip to content

armgit / ruflo

Public Imported from GitHub
0

🌊 The original agent harness. Deploy intelligent multi-player swarms, coordinate autonomous workflows, and build conversational AI systems. Features adaptive memory, self-learning intelligence, federation, vector RAG integration, and native Claude Code / Codex / Hermes and many more Integrated

feat(cost-tracker): P7 — corpus v3 expansion (16 → 25 cases) (v0.10.0)

Reuvenc16114659af8
diff --git a/plugins/ruflo-cost-tracker/.claude-plugin/plugin.json b/plugins/ruflo-cost-tracker/.claude-plugin/plugin.json
index cd937e3c0b..8c8094f02f 100644
--- a/plugins/ruflo-cost-tracker/.claude-plugin/plugin.json
+++ b/plugins/ruflo-cost-tracker/.claude-plugin/plugin.json
@@ -1,7 +1,7 @@
{
"name": "ruflo-cost-tracker",
"description": "Token usage tracking, model cost attribution per agent, budget alerts, and optimization recommendations — uses memory_* (namespace-routed) for cost-tracking and cost-patterns; pairs with federation budget circuit breaker (ADR-097)",
- "version": "0.9.0",
+ "version": "0.10.0",
"author": {
"name": "ruvnet",
"url": "https://github.com/ruvnet"
diff --git a/plugins/ruflo-cost-tracker/bench/booster-corpus.json b/plugins/ruflo-cost-tracker/bench/booster-corpus.json
index b1315931b9..c9c1ebbde1 100644
--- a/plugins/ruflo-cost-tracker/bench/booster-corpus.json
+++ b/plugins/ruflo-cost-tracker/bench/booster-corpus.json
@@ -1,5 +1,5 @@
{
- "version": 2,
+ "version": 3,
"description": "Golden corpus for cost-tracker's Agent Booster verification. Two case classes — `expectedTier1: true` cases SHOULD apply via booster; `expectedTier1: false` cases SHOULD escalate (low confidence or output != expected) so the router/skill can route them to Tier 2/3.",
"normalize": "trim, collapse whitespace runs to single space",
"metrics": {
@@ -155,6 +155,90 @@
"code": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
"edit": "Rewrite as an iterative loop with no recursion.",
"expected": "function factorial(n) { let result = 1; for (let i = 2; i <= n; i++) { result *= i; } return result; }"
+ },
+ {
+ "id": "var-to-let-1",
+ "intent": "var-to-let",
+ "language": "javascript",
+ "expectedTier1": true,
+ "code": "var i = 0; for (i = 0; i < 10; i++) { sink(i); }",
+ "edit": "let i = 0; for (i = 0; i < 10; i++) { sink(i); }",
+ "expected": "let i = 0; for (i = 0; i < 10; i++) { sink(i); }"
+ },
+ {
+ "id": "double-quote-to-single",
+ "intent": "string-quote-style",
+ "language": "javascript",
+ "expectedTier1": true,
+ "code": "function greet(name) { return \"hello \" + name; }",
+ "edit": "function greet(name) { return 'hello ' + name; }",
+ "expected": "function greet(name) { return 'hello ' + name; }"
+ },
+ {
+ "id": "add-readonly-prop",
+ "intent": "add-readonly",
+ "language": "typescript",
+ "expectedTier1": true,
+ "code": "class Box { value: number = 0; }",
+ "edit": "class Box { readonly value: number = 0; }",
+ "expected": "class Box { readonly value: number = 0; }"
+ },
+ {
+ "id": "remove-debugger",
+ "intent": "remove-debug",
+ "language": "javascript",
+ "expectedTier1": true,
+ "code": "function go() { debugger; doWork(); }",
+ "edit": "function go() { doWork(); }",
+ "expected": "function go() { doWork(); }"
+ },
+ {
+ "id": "import-add-named",
+ "intent": "import-add",
+ "language": "typescript",
+ "expectedTier1": true,
+ "code": "import { foo } from './x'; foo();",
+ "edit": "import { foo, bar } from './x'; foo();",
+ "expected": "import { foo, bar } from './x'; foo();"
+ },
+ {
+ "id": "remove-trailing-semis",
+ "intent": "format-tweak",
+ "language": "javascript",
+ "expectedTier1": true,
+ "code": "const a = 1;; const b = 2;;",
+ "edit": "const a = 1; const b = 2;",
+ "expected": "const a = 1; const b = 2;"
+ },
+ {
+ "id": "adversarial-extract-class",
+ "intent": "extract-class",
+ "language": "typescript",
+ "expectedTier1": false,
+ "comment": "Splitting one class into two with delegation requires reasoning about responsibility boundaries.",
+ "code": "class UserService { saveUser(u: any) { db.put(u); audit.log('save', u.id); } private db = realDb; private audit = { log: (k: string, v: any) => console.log(k, v) }; }",
+ "edit": "Extract the `audit` concern into its own AuditService class and have UserService delegate to it.",
+ "expected": "class AuditService { log(k: string, v: any) { console.log(k, v); } } class UserService { saveUser(u: any) { db.put(u); this.audit.log('save', u.id); } private db = realDb; private audit = new AuditService(); }"
+ },
+ {
+ "id": "adversarial-callback-to-promise",
+ "intent": "callback-to-promise",
+ "language": "javascript",
+ "expectedTier1": false,
+ "comment": "Restructuring control flow from callbacks to async/await requires understanding execution semantics, not pattern matching.",
+ "code": "function loadConfig(cb) { fs.readFile('./c.json', (err, data) => { if (err) cb(err); else cb(null, JSON.parse(data)); }); }",
+ "edit": "Rewrite as an async function that returns a Promise<Config> using fs.promises and try/catch.",
+ "expected": "async function loadConfig() { try { const data = await fs.promises.readFile('./c.json'); return JSON.parse(data); } catch (err) { throw err; } }"
+ },
+ {
+ "id": "adversarial-deeply-nested-conditional",
+ "intent": "early-return-flatten",
+ "language": "javascript",
+ "expectedTier1": false,
+ "comment": "Flattening nested conditionals into guard clauses requires reasoning about boolean logic + control flow.",
+ "code": "function process(x) { if (x) { if (x.valid) { if (x.size > 0) { return doWork(x); } else { return null; } } else { return null; } } else { return null; } }",
+ "edit": "Flatten using early returns / guard clauses — return null at each failed precondition.",
+ "expected": "function process(x) { if (!x) return null; if (!x.valid) return null; if (x.size <= 0) return null; return doWork(x); }"
}
]
}
diff --git a/plugins/ruflo-cost-tracker/docs/benchmarks/runs/2026-05-05T04-00-21-167Z.json b/plugins/ruflo-cost-tracker/docs/benchmarks/runs/2026-05-05T04-00-21-167Z.json
new file mode 100644
index 0000000000..8be73c25dd
--- /dev/null
+++ b/plugins/ruflo-cost-tracker/docs/benchmarks/runs/2026-05-05T04-00-21-167Z.json
@@ -0,0 +1,417 @@
+{
+ "summary": {
+ "runAt": "2026-05-05T04:00:21.167Z",
+ "corpusVersion": 2,
+ "corpusSize": 25,
+ "tier1Cases": 18,
+ "adversarialCases": 7,
+ "winRate": 1,
+ "winRatePct": "100.0%",
+ "overallCorrect": 0.72,
+ "escalationRate": 1,
+ "escalationRatePct": "100.0%",
+ "successCount": 18,
+ "avgLatencyMs": 0.32,
+ "p50LatencyMs": 0,
+ "p99LatencyMs": 6,
+ "maxLatencyMs": 6,
+ "avgWallMs": 0.36,
+ "avgConfidence": 0.552444064617157,
+ "minConfidence": 0,
+ "confidenceThreshold": 0.5,
+ "aboveThresholdCount": 18,
+ "structuralCostUsd": 0,
+ "llmBaseline": "skipped"
+ },
+ "results": [
+ {
+ "id": "var-to-const-1",
+ "intent": "var-to-const",
+ "expectedTier1": true,
+ "success": true,
+ "correct": true,
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 6,
+ "wallMs": 6,
+ "confidence": 0.6465277671813965,
+ "strategy": "fuzzy_replace",
+ "tokensIn": 6,
+ "tokensOut": 7
+ },
+ {
+ "id": "var-to-const-2",
+ "intent": "var-to-const",
+ "expectedTier1": true,
+ "success": true,
+ "correct": true,
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 1,
+ "wallMs": 1,
+ "confidence": 0.8513461351394653,
+ "strategy": "fuzzy_replace",
+ "tokensIn": 13,
+ "tokensOut": 13
+ },
+ {
+ "id": "add-types-1",
+ "intent": "add-types",
+ "expectedTier1": true,
+ "success": true,
+ "correct": true,
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.6412500143051147,
+ "strategy": "fuzzy_replace",
+ "tokensIn": 9,
+ "tokensOut": 15
+ },
+ {
+ "id": "add-types-2",
+ "intent": "add-types",
+ "expectedTier1": true,
+ "success": true,
+ "correct": true,
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.6055588126182556,
+ "strategy": "fuzzy_replace",
+ "tokensIn": 13,
+ "tokensOut": 23
+ },
+ {
+ "id": "remove-console-1",
+ "intent": "remove-console",
+ "expectedTier1": true,
+ "success": true,
+ "correct": true,
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.6954487562179565,
+ "strategy": "fuzzy_replace",
+ "tokensIn": 12,
+ "tokensOut": 7
+ },
+ {
+ "id": "remove-console-2",
+ "intent": "remove-console",
+ "expectedTier1": true,
+ "success": true,
+ "correct": true,
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.5508301258087158,
+ "strategy": "fuzzy_replace",
+ "tokensIn": 17,
+ "tokensOut": 7
+ },
+ {
+ "id": "add-error-handling-1",
+ "intent": "add-error-handling",
+ "expectedTier1": true,
+ "success": true,
+ "correct": true,
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.8500000238418579,
+ "strategy": "exact_replace",
+ "tokensIn": 10,
+ "tokensOut": 19
+ },
+ {
+ "id": "add-error-handling-2",
+ "intent": "add-error-handling",
+ "expectedTier1": true,
+ "success": true,
+ "correct": true,
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.8500000238418579,
+ "strategy": "exact_replace",
+ "tokensIn": 11,
+ "tokensOut": 20
+ },
+ {
+ "id": "async-await-1",
+ "intent": "async-await",
+ "expectedTier1": true,
+ "success": true,
+ "correct": true,
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.8500000238418579,
+ "strategy": "exact_replace",
+ "tokensIn": 14,
+ "tokensOut": 17
+ },
+ {
+ "id": "async-await-2",
+ "intent": "async-await",
+ "expectedTier1": true,
+ "success": true,
+ "correct": true,
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.8500000238418579,
+ "strategy": "exact_replace",
+ "tokensIn": 12,
+ "tokensOut": 17
+ },
+ {
+ "id": "add-logging-1",
+ "intent": "add-logging",
+ "expectedTier1": true,
+ "success": true,
+ "correct": true,
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 1,
+ "confidence": 0.7152736783027649,
+ "strategy": "fuzzy_replace",
+ "tokensIn": 8,
+ "tokensOut": 13
+ },
+ {
+ "id": "add-logging-2",
+ "intent": "add-logging",
+ "expectedTier1": true,
+ "success": true,
+ "correct": true,
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.6442474126815796,
+ "strategy": "fuzzy_replace",
+ "tokensIn": 8,
+ "tokensOut": 14
+ },
+ {
+ "id": "adversarial-extract-function",
+ "intent": "extract-function",
+ "expectedTier1": false,
+ "success": false,
+ "correct": false,
+ "escalatedCorrectly": true,
+ "lowConfidence": true,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0,
+ "strategy": "failed",
+ "tokensIn": 0,
+ "tokensOut": 0,
+ "actualPrefix": "function process(items) { let total = 0; for (const i of items) { if (i.active) { total += i.value; } } if (total > 100)",
+ "expectedPrefix": "function sum_active(items) { let total = 0; for (const i of items) { if (i.active) { total += i.value; } } return total;"
+ },
+ {
+ "id": "adversarial-type-narrowing",
+ "intent": "type-narrowing",
+ "expectedTier1": false,
+ "success": false,
+ "correct": false,
+ "escalatedCorrectly": true,
+ "lowConfidence": true,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0,
+ "strategy": "failed",
+ "tokensIn": 0,
+ "tokensOut": 0,
+ "actualPrefix": "type Result = { kind: 'ok'; value: number } | { kind: 'err'; message: string }; function describe(r: Result) { return r.",
+ "expectedPrefix": "type Result = { kind: 'ok'; value: number } | { kind: 'err'; message: string }; function describe(r: Result) { if (r.kin"
+ },
+ {
+ "id": "adversarial-cross-method-rename",
+ "intent": "rename-symbol",
+ "expectedTier1": false,
+ "success": false,
+ "correct": false,
+ "escalatedCorrectly": true,
+ "lowConfidence": true,
+ "latencyMs": 1,
+ "wallMs": 1,
+ "confidence": 0,
+ "strategy": "failed",
+ "tokensIn": 0,
+ "tokensOut": 0,
+ "actualPrefix": "class Cache { get(k: string) { return this.store[k]; } set(k: string, v: any) { this.store[k] = v; } private store: Reco",
+ "expectedPrefix": "class Cache { lookup(k: string) { return this.store[k]; } set(k: string, v: any) { this.store[k] = v; } private store: R"
+ },
+ {
+ "id": "adversarial-recursive-rewrite",
+ "intent": "recursive-to-iterative",
+ "expectedTier1": false,
+ "success": false,
+ "correct": false,
+ "escalatedCorrectly": true,
+ "lowConfidence": true,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0,
+ "strategy": "failed",
+ "tokensIn": 0,
+ "tokensOut": 0,
+ "actualPrefix": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
+ "expectedPrefix": "function factorial(n) { let result = 1; for (let i = 2; i <= n; i++) { result *= i; } return result; }"
+ },
+ {
+ "id": "var-to-let-1",
+ "intent": "var-to-let",
+ "expectedTier1": true,
+ "success": true,
+ "correct": true,
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.9179807305335999,
+ "strategy": "exact_replace",
+ "tokensIn": 12,
+ "tokensOut": 12
+ },
+ {
+ "id": "double-quote-to-single",
+ "intent": "string-quote-style",
+ "expectedTier1": true,
+ "success": true,
+ "correct": true,
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.9124999642372131,
+ "strategy": "exact_replace",
+ "tokensIn": 12,
+ "tokensOut": 12
+ },
+ {
+ "id": "add-readonly-prop",
+ "intent": "add-readonly",
+ "expectedTier1": true,
+ "success": true,
+ "correct": true,
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.8140649795532227,
+ "strategy": "fuzzy_replace",
+ "tokensIn": 8,
+ "tokensOut": 11
+ },
+ {
+ "id": "remove-debugger",
+ "intent": "remove-debug",
+ "expectedTier1": true,
+ "success": true,
+ "correct": true,
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.7668138742446899,
+ "strategy": "fuzzy_replace",
+ "tokensIn": 10,
+ "tokensOut": 7
+ },
+ {
+ "id": "import-add-named",
+ "intent": "import-add",
+ "expectedTier1": true,
+ "success": true,
+ "correct": true,
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.8162500262260437,
+ "strategy": "fuzzy_replace",
+ "tokensIn": 9,
+ "tokensOut": 10
+ },
+ {
+ "id": "remove-trailing-semis",
+ "intent": "format-tweak",
+ "expectedTier1": true,
+ "success": true,
+ "correct": true,
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.8330092430114746,
+ "strategy": "fuzzy_replace",
+ "tokensIn": 7,
+ "tokensOut": 7
+ },
+ {
+ "id": "adversarial-extract-class",
+ "intent": "extract-class",
+ "expectedTier1": false,
+ "success": false,
+ "correct": false,
+ "escalatedCorrectly": true,
+ "lowConfidence": true,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0,
+ "strategy": "failed",
+ "tokensIn": 0,
+ "tokensOut": 0,
+ "actualPrefix": "class UserService { saveUser(u: any) { db.put(u); audit.log('save', u.id); } private db = realDb; private audit = { log:",
+ "expectedPrefix": "class AuditService { log(k: string, v: any) { console.log(k, v); } } class UserService { saveUser(u: any) { db.put(u); t"
+ },
+ {
+ "id": "adversarial-callback-to-promise",
+ "intent": "callback-to-promise",
+ "expectedTier1": false,
+ "success": false,
+ "correct": false,
+ "escalatedCorrectly": true,
+ "lowConfidence": true,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0,
+ "strategy": "failed",
+ "tokensIn": 0,
+ "tokensOut": 0,
+ "actualPrefix": "function loadConfig(cb) { fs.readFile('./c.json', (err, data) => { if (err) cb(err); else cb(null, JSON.parse(data)); })",
+ "expectedPrefix": "async function loadConfig() { try { const data = await fs.promises.readFile('./c.json'); return JSON.parse(data); } catc"
+ },
+ {
+ "id": "adversarial-deeply-nested-conditional",
+ "intent": "early-return-flatten",
+ "expectedTier1": false,
+ "success": false,
+ "correct": false,
+ "escalatedCorrectly": true,
+ "lowConfidence": true,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0,
+ "strategy": "failed",
+ "tokensIn": 0,
+ "tokensOut": 0,
+ "actualPrefix": "function process(x) { if (x) { if (x.valid) { if (x.size > 0) { return doWork(x); } else { return null; } } else { retur",
+ "expectedPrefix": "function process(x) { if (!x) return null; if (!x.valid) return null; if (x.size <= 0) return null; return doWork(x); }"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/plugins/ruflo-cost-tracker/docs/benchmarks/runs/latest.json b/plugins/ruflo-cost-tracker/docs/benchmarks/runs/latest.json
index f07d5087ea..8be73c25dd 100644
--- a/plugins/ruflo-cost-tracker/docs/benchmarks/runs/latest.json
+++ b/plugins/ruflo-cost-tracker/docs/benchmarks/runs/latest.json
@@ -1,86 +1,27 @@
{
"summary": {
- "runAt": "2026-05-05T03:30:00.655Z",
+ "runAt": "2026-05-05T04:00:21.167Z",
"corpusVersion": 2,
- "corpusSize": 16,
- "tier1Cases": 12,
- "adversarialCases": 4,
+ "corpusSize": 25,
+ "tier1Cases": 18,
+ "adversarialCases": 7,
"winRate": 1,
"winRatePct": "100.0%",
- "overallCorrect": 0.75,
+ "overallCorrect": 0.72,
"escalationRate": 1,
"escalationRatePct": "100.0%",
- "successCount": 12,
- "avgLatencyMs": 0.5,
+ "successCount": 18,
+ "avgLatencyMs": 0.32,
"p50LatencyMs": 0,
- "p99LatencyMs": 5,
- "maxLatencyMs": 5,
- "avgWallMs": 0.5625,
- "avgConfidence": 0.5469051748514175,
+ "p99LatencyMs": 6,
+ "maxLatencyMs": 6,
+ "avgWallMs": 0.36,
+ "avgConfidence": 0.552444064617157,
"minConfidence": 0,
"confidenceThreshold": 0.5,
- "aboveThresholdCount": 12,
+ "aboveThresholdCount": 18,
"structuralCostUsd": 0,
- "llmBaseline": {
- "model": "models/gemini-2.0-flash",
- "baseUrl": "https://generativelanguage.googleapis.com/v1beta/openai/",
- "total": 16,
- "passed": 15,
- "winRate": 0.9375,
- "avgLatencyMs": 762.125,
- "totalTokensIn": 1972,
- "totalTokensOut": 603,
- "avgTokensIn": 123.25,
- "avgTokensOut": 37.6875,
- "totalCostUsd": 0.00043840000000000003,
- "avgCostUsdPerEdit": 0.000027400000000000002,
- "pricing": {
- "input_per_1M": 0.1,
- "output_per_1M": 0.4
- }
- },
- "speedupVsLlm": 1524.25,
- "costDeltaUsdPerEdit": 0.000027400000000000002,
- "anthropic": {
- "claude-sonnet-4-6": {
- "model": "claude-sonnet-4-6",
- "total": 16,
- "passed": 15,
- "winRate": 0.9375,
- "avgLatencyMs": 1158.0625,
- "totalTokensIn": 1986,
- "totalTokensOut": 650,
- "avgTokensIn": 124.125,
- "avgTokensOut": 40.625,
- "totalCostUsd": 0.015708000000000003,
- "avgCostUsdPerEdit": 0.0009817500000000002,
- "pricing": {
- "input": 3,
- "output": 15
- },
- "speedupVsBooster": 2316.125,
- "costSavedPerEditUsd": 0.0009817500000000002
- },
- "claude-opus-4-7": {
- "model": "claude-opus-4-7",
- "total": 16,
- "passed": 15,
- "winRate": 0.9375,
- "avgLatencyMs": 1517.9375,
- "totalTokensIn": 2757,
- "totalTokensOut": 739,
- "avgTokensIn": 172.3125,
- "avgTokensOut": 46.1875,
- "totalCostUsd": 0.09678,
- "avgCostUsdPerEdit": 0.00604875,
- "pricing": {
- "input": 15,
- "output": 75
- },
- "speedupVsBooster": 3035.875,
- "costSavedPerEditUsd": 0.00604875
- }
- }
+ "llmBaseline": "skipped"
},
"results": [
{
@@ -91,7 +32,7 @@
"correct": true,
"escalatedCorrectly": false,
"lowConfidence": false,
- "latencyMs": 5,
+ "latencyMs": 6,
"wallMs": 6,
"confidence": 0.6465277671813965,
"strategy": "fuzzy_replace",
@@ -181,8 +122,8 @@
"correct": true,
"escalatedCorrectly": false,
"lowConfidence": false,
- "latencyMs": 1,
- "wallMs": 1,
+ "latencyMs": 0,
+ "wallMs": 0,
"confidence": 0.8500000238418579,
"strategy": "exact_replace",
"tokensIn": 10,
@@ -242,7 +183,7 @@
"escalatedCorrectly": false,
"lowConfidence": false,
"latencyMs": 0,
- "wallMs": 0,
+ "wallMs": 1,
"confidence": 0.7152736783027649,
"strategy": "fuzzy_replace",
"tokensIn": 8,
@@ -330,452 +271,147 @@
"tokensOut": 0,
"actualPrefix": "function factorial(n) { return n <= 1 ? 1 : n * factorial(n - 1); }",
"expectedPrefix": "function factorial(n) { let result = 1; for (let i = 2; i <= n; i++) { result *= i; } return result; }"
- }
- ],
- "llmResults": [
- {
- "id": "var-to-const-1",
- "intent": "var-to-const",
- "correct": true,
- "wallMs": 661,
- "tokensIn": 105,
- "tokensOut": 17,
- "costUsd": 0.0000173
},
{
- "id": "var-to-const-2",
- "intent": "var-to-const",
- "correct": true,
- "wallMs": 479,
- "tokensIn": 113,
- "tokensOut": 21,
- "costUsd": 0.000019699999999999998
- },
- {
- "id": "add-types-1",
- "intent": "add-types",
- "correct": true,
- "wallMs": 660,
- "tokensIn": 114,
- "tokensOut": 24,
- "costUsd": 0.000021000000000000002
- },
- {
- "id": "add-types-2",
- "intent": "add-types",
- "correct": true,
- "wallMs": 571,
- "tokensIn": 130,
- "tokensOut": 35,
- "costUsd": 0.000027
- },
- {
- "id": "remove-console-1",
- "intent": "remove-console",
- "correct": true,
- "wallMs": 464,
- "tokensIn": 103,
- "tokensOut": 13,
- "costUsd": 0.0000155
- },
- {
- "id": "remove-console-2",
- "intent": "remove-console",
- "correct": true,
- "wallMs": 525,
- "tokensIn": 107,
- "tokensOut": 12,
- "costUsd": 0.0000155
- },
- {
- "id": "add-error-handling-1",
- "intent": "add-error-handling",
+ "id": "var-to-let-1",
+ "intent": "var-to-let",
+ "expectedTier1": true,
+ "success": true,
"correct": true,
- "wallMs": 604,
- "tokensIn": 113,
- "tokensOut": 27,
- "costUsd": 0.000022100000000000002
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.9179807305335999,
+ "strategy": "exact_replace",
+ "tokensIn": 12,
+ "tokensOut": 12
},
{
- "id": "add-error-handling-2",
- "intent": "add-error-handling",
+ "id": "double-quote-to-single",
+ "intent": "string-quote-style",
+ "expectedTier1": true,
+ "success": true,
"correct": true,
- "wallMs": 1551,
- "tokensIn": 121,
- "tokensOut": 31,
- "costUsd": 0.000024500000000000003
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.9124999642372131,
+ "strategy": "exact_replace",
+ "tokensIn": 12,
+ "tokensOut": 12
},
{
- "id": "async-await-1",
- "intent": "async-await",
+ "id": "add-readonly-prop",
+ "intent": "add-readonly",
+ "expectedTier1": true,
+ "success": true,
"correct": true,
- "wallMs": 592,
- "tokensIn": 118,
- "tokensOut": 24,
- "costUsd": 0.000021400000000000002
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.8140649795532227,
+ "strategy": "fuzzy_replace",
+ "tokensIn": 8,
+ "tokensOut": 11
},
{
- "id": "async-await-2",
- "intent": "async-await",
+ "id": "remove-debugger",
+ "intent": "remove-debug",
+ "expectedTier1": true,
+ "success": true,
"correct": true,
- "wallMs": 738,
- "tokensIn": 110,
- "tokensOut": 22,
- "costUsd": 0.0000198
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.7668138742446899,
+ "strategy": "fuzzy_replace",
+ "tokensIn": 10,
+ "tokensOut": 7
},
{
- "id": "add-logging-1",
- "intent": "add-logging",
+ "id": "import-add-named",
+ "intent": "import-add",
+ "expectedTier1": true,
+ "success": true,
"correct": true,
- "wallMs": 577,
- "tokensIn": 103,
- "tokensOut": 19,
- "costUsd": 0.0000179
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.8162500262260437,
+ "strategy": "fuzzy_replace",
+ "tokensIn": 9,
+ "tokensOut": 10
},
{
- "id": "add-logging-2",
- "intent": "add-logging",
+ "id": "remove-trailing-semis",
+ "intent": "format-tweak",
+ "expectedTier1": true,
+ "success": true,
"correct": true,
- "wallMs": 768,
- "tokensIn": 115,
- "tokensOut": 26,
- "costUsd": 0.000021900000000000004
+ "escalatedCorrectly": false,
+ "lowConfidence": false,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0.8330092430114746,
+ "strategy": "fuzzy_replace",
+ "tokensIn": 7,
+ "tokensOut": 7
},
{
- "id": "adversarial-extract-function",
- "intent": "extract-function",
+ "id": "adversarial-extract-class",
+ "intent": "extract-class",
+ "expectedTier1": false,
+ "success": false,
"correct": false,
- "wallMs": 1125,
- "tokensIn": 184,
- "tokensOut": 141,
- "costUsd": 0.0000748,
- "actualPrefix": "function sum_active(items) { let total = 0; for (const i of items) { if (i.active) { total += i.value; } } return total;",
- "expectedPrefix": "function sum_active(items) { let total = 0; for (const i of items) { if (i.active) { total += i.value; } } return total;"
- },
- {
- "id": "adversarial-type-narrowing",
- "intent": "type-narrowing",
- "correct": true,
- "wallMs": 1306,
- "tokensIn": 150,
- "tokensOut": 58,
- "costUsd": 0.0000382
+ "escalatedCorrectly": true,
+ "lowConfidence": true,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0,
+ "strategy": "failed",
+ "tokensIn": 0,
+ "tokensOut": 0,
+ "actualPrefix": "class UserService { saveUser(u: any) { db.put(u); audit.log('save', u.id); } private db = realDb; private audit = { log:",
+ "expectedPrefix": "class AuditService { log(k: string, v: any) { console.log(k, v); } } class UserService { saveUser(u: any) { db.put(u); t"
},
{
- "id": "adversarial-cross-method-rename",
- "intent": "rename-symbol",
- "correct": true,
- "wallMs": 836,
- "tokensIn": 171,
- "tokensOut": 81,
- "costUsd": 0.000049500000000000004
+ "id": "adversarial-callback-to-promise",
+ "intent": "callback-to-promise",
+ "expectedTier1": false,
+ "success": false,
+ "correct": false,
+ "escalatedCorrectly": true,
+ "lowConfidence": true,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0,
+ "strategy": "failed",
+ "tokensIn": 0,
+ "tokensOut": 0,
+ "actualPrefix": "function loadConfig(cb) { fs.readFile('./c.json', (err, data) => { if (err) cb(err); else cb(null, JSON.parse(data)); })",
+ "expectedPrefix": "async function loadConfig() { try { const data = await fs.promises.readFile('./c.json'); return JSON.parse(data); } catc"
},
{
- "id": "adversarial-recursive-rewrite",
- "intent": "recursive-to-iterative",
- "correct": true,
- "wallMs": 737,
- "tokensIn": 115,
- "tokensOut": 52,
- "costUsd": 0.0000323
+ "id": "adversarial-deeply-nested-conditional",
+ "intent": "early-return-flatten",
+ "expectedTier1": false,
+ "success": false,
+ "correct": false,
+ "escalatedCorrectly": true,
+ "lowConfidence": true,
+ "latencyMs": 0,
+ "wallMs": 0,
+ "confidence": 0,
+ "strategy": "failed",
+ "tokensIn": 0,
+ "tokensOut": 0,
+ "actualPrefix": "function process(x) { if (x) { if (x.valid) { if (x.size > 0) { return doWork(x); } else { return null; } } else { retur",
+ "expectedPrefix": "function process(x) { if (!x) return null; if (!x.valid) return null; if (x.size <= 0) return null; return doWork(x); }"
}
- ],
- "anthropicResults": {
- "claude-sonnet-4-6": [
- {
- "id": "var-to-const-1",
- "intent": "var-to-const",
- "correct": true,
- "wallMs": 949,
- "tokensIn": 105,
- "tokensOut": 20,
- "costUsd": 0.0006150000000000001
- },
- {
- "id": "var-to-const-2",
- "intent": "var-to-const",
- "correct": true,
- "wallMs": 795,
- "tokensIn": 113,
- "tokensOut": 24,
- "costUsd": 0.000699
- },
- {
- "id": "add-types-1",
- "intent": "add-types",
- "correct": true,
- "wallMs": 800,
- "tokensIn": 114,
- "tokensOut": 27,
- "costUsd": 0.000747
- },
- {
- "id": "add-types-2",
- "intent": "add-types",
- "correct": true,
- "wallMs": 1745,
- "tokensIn": 130,
- "tokensOut": 38,
- "costUsd": 0.0009599999999999999
- },
- {
- "id": "remove-console-1",
- "intent": "remove-console",
- "correct": true,
- "wallMs": 1164,
- "tokensIn": 103,
- "tokensOut": 16,
- "costUsd": 0.000549
- },
- {
- "id": "remove-console-2",
- "intent": "remove-console",
- "correct": true,
- "wallMs": 1042,
- "tokensIn": 107,
- "tokensOut": 15,
- "costUsd": 0.000546
- },
- {
- "id": "add-error-handling-1",
- "intent": "add-error-handling",
- "correct": true,
- "wallMs": 845,
- "tokensIn": 113,
- "tokensOut": 30,
- "costUsd": 0.000789
- },
- {
- "id": "add-error-handling-2",
- "intent": "add-error-handling",
- "correct": true,
- "wallMs": 1072,
- "tokensIn": 121,
- "tokensOut": 34,
- "costUsd": 0.0008730000000000001
- },
- {
- "id": "async-await-1",
- "intent": "async-await",
- "correct": true,
- "wallMs": 949,
- "tokensIn": 118,
- "tokensOut": 27,
- "costUsd": 0.0007589999999999999
- },
- {
- "id": "async-await-2",
- "intent": "async-await",
- "correct": true,
- "wallMs": 1329,
- "tokensIn": 110,
- "tokensOut": 25,
- "costUsd": 0.000705
- },
- {
- "id": "add-logging-1",
- "intent": "add-logging",
- "correct": true,
- "wallMs": 887,
- "tokensIn": 103,
- "tokensOut": 22,
- "costUsd": 0.000639
- },
- {
- "id": "add-logging-2",
- "intent": "add-logging",
- "correct": true,
- "wallMs": 952,
- "tokensIn": 115,
- "tokensOut": 29,
- "costUsd": 0.0007800000000000001
- },
- {
- "id": "adversarial-extract-function",
- "intent": "extract-function",
- "correct": true,
- "wallMs": 1978,
- "tokensIn": 184,
- "tokensOut": 142,
- "costUsd": 0.002682
- },
- {
- "id": "adversarial-type-narrowing",
- "intent": "type-narrowing",
- "correct": false,
- "wallMs": 1379,
- "tokensIn": 156,
- "tokensOut": 61,
- "costUsd": 0.0013830000000000001,
- "actualPrefix": "type Result = { kind: 'ok'; value: number } | { kind: 'err'; message: string }; function describe(r: Result) { return r.",
- "expectedPrefix": "type Result = { kind: 'ok'; value: number } | { kind: 'err'; message: string }; function describe(r: Result) { if (r.kin"
- },
- {
- "id": "adversarial-cross-method-rename",
- "intent": "rename-symbol",
- "correct": true,
- "wallMs": 1425,
- "tokensIn": 173,
- "tokensOut": 85,
- "costUsd": 0.001794
- },
- {
- "id": "adversarial-recursive-rewrite",
- "intent": "recursive-to-iterative",
- "correct": true,
- "wallMs": 1218,
- "tokensIn": 121,
- "tokensOut": 55,
- "costUsd": 0.001188
- }
- ],
- "claude-opus-4-7": [
- {
- "id": "var-to-const-1",
- "intent": "var-to-const",
- "correct": true,
- "wallMs": 1265,
- "tokensIn": 147,
- "tokensOut": 24,
- "costUsd": 0.004005
- },
- {
- "id": "var-to-const-2",
- "intent": "var-to-const",
- "correct": true,
- "wallMs": 1064,
- "tokensIn": 159,
- "tokensOut": 30,
- "costUsd": 0.004635
- },
- {
- "id": "add-types-1",
- "intent": "add-types",
- "correct": true,
- "wallMs": 1655,
- "tokensIn": 156,
- "tokensOut": 31,
- "costUsd": 0.004665000000000001
- },
- {
- "id": "add-types-2",
- "intent": "add-types",
- "correct": true,
- "wallMs": 2102,
- "tokensIn": 176,
- "tokensOut": 44,
- "costUsd": 0.00594
- },
- {
- "id": "remove-console-1",
- "intent": "remove-console",
- "correct": true,
- "wallMs": 1418,
- "tokensIn": 150,
- "tokensOut": 22,
- "costUsd": 0.0039
- },
- {
- "id": "remove-console-2",
- "intent": "remove-console",
- "correct": true,
- "wallMs": 1236,
- "tokensIn": 153,
- "tokensOut": 20,
- "costUsd": 0.003795
- },
- {
- "id": "add-error-handling-1",
- "intent": "add-error-handling",
- "correct": true,
- "wallMs": 1215,
- "tokensIn": 162,
- "tokensOut": 38,
- "costUsd": 0.00528
- },
- {
- "id": "add-error-handling-2",
- "intent": "add-error-handling",
- "correct": true,
- "wallMs": 1266,
- "tokensIn": 168,
- "tokensOut": 41,
- "costUsd": 0.005594999999999999
- },
- {
- "id": "async-await-1",
- "intent": "async-await",
- "correct": true,
- "wallMs": 1354,
- "tokensIn": 165,
- "tokensOut": 34,
- "costUsd": 0.005025
- },
- {
- "id": "async-await-2",
- "intent": "async-await",
- "correct": true,
- "wallMs": 1066,
- "tokensIn": 155,
- "tokensOut": 31,
- "costUsd": 0.00465
- },
- {
- "id": "add-logging-1",
- "intent": "add-logging",
- "correct": true,
- "wallMs": 1358,
- "tokensIn": 148,
- "tokensOut": 28,
- "costUsd": 0.004319999999999999
- },
- {
- "id": "add-logging-2",
- "intent": "add-logging",
- "correct": true,
- "wallMs": 1483,
- "tokensIn": 157,
- "tokensOut": 33,
- "costUsd": 0.00483
- },
- {
- "id": "adversarial-extract-function",
- "intent": "extract-function",
- "correct": true,
- "wallMs": 2575,
- "tokensIn": 239,
- "tokensOut": 121,
- "costUsd": 0.01266
- },
- {
- "id": "adversarial-type-narrowing",
- "intent": "type-narrowing",
- "correct": false,
- "wallMs": 1844,
- "tokensIn": 216,
- "tokensOut": 76,
- "costUsd": 0.00894,
- "actualPrefix": "type Result = { kind: 'ok'; value: number } | { kind: 'err'; message: string }; function describe(r: Result) { return r.",
- "expectedPrefix": "type Result = { kind: 'ok'; value: number } | { kind: 'err'; message: string }; function describe(r: Result) { if (r.kin"
- },
- {
- "id": "adversarial-cross-method-rename",
- "intent": "rename-symbol",
- "correct": true,
- "wallMs": 1997,
- "tokensIn": 232,
- "tokensOut": 102,
- "costUsd": 0.01113
- },
- {
- "id": "adversarial-recursive-rewrite",
- "intent": "recursive-to-iterative",
- "correct": true,
- "wallMs": 1389,
- "tokensIn": 174,
- "tokensOut": 64,
- "costUsd": 0.00741
- }
- ]
- }
+ ]
}
\ No newline at end of file
diff --git a/plugins/ruflo-cost-tracker/scripts/smoke.sh b/plugins/ruflo-cost-tracker/scripts/smoke.sh
index 407fcd8c56..22710501e9 100755
--- a/plugins/ruflo-cost-tracker/scripts/smoke.sh
+++ b/plugins/ruflo-cost-tracker/scripts/smoke.sh
@@ -8,10 +8,10 @@ step() { printf "→ %s ... " "$1"; }
ok() { printf "PASS\n"; PASS=$((PASS+1)); }
bad() { printf "FAIL: %s\n" "$1"; FAIL=$((FAIL+1)); }
-step "1. plugin.json declares 0.9.0 with new keywords"
+step "1. plugin.json declares 0.10.0 with new keywords"
v=$(grep -E '"version"' "$ROOT/.claude-plugin/plugin.json" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
-if [[ "$v" != "0.9.0" ]]; then
- bad "expected 0.9.0, got '$v'"
+if [[ "$v" != "0.10.0" ]]; then
+ bad "expected 0.10.0, got '$v'"
else
miss=""
for k in namespace-routing mcp agentic-flow agent-booster tier1-routing model-routing benchmarking verified telemetry budget; do
@@ -182,20 +182,22 @@ else
if [[ "$pass" == "yes" ]]; then ok; else bad "Tier 1 win rate $rate < 0.80"; fi
fi
-step "24. corpus has both Tier 1 and adversarial cases"
+step "24. corpus v3 has 18+ Tier 1 cases AND 6+ adversarial cases"
F="$ROOT/bench/booster-corpus.json"
miss=""
node -e "
const d = JSON.parse(require('fs').readFileSync('$F'));
const t1 = d.cases.filter(c => c.expectedTier1 !== false).length;
const adv = d.cases.filter(c => c.expectedTier1 === false).length;
- if (t1 < 5) process.exit(1);
- if (adv < 2) process.exit(2);
+ if (t1 < 18) process.exit(1);
+ if (adv < 6) process.exit(2);
+ if (d.cases.length < 25) process.exit(3);
" 2>/dev/null
case $? in
0) ok ;;
- 1) bad "fewer than 5 Tier 1 cases" ;;
- 2) bad "fewer than 2 adversarial cases" ;;
+ 1) bad "fewer than 18 Tier 1 cases" ;;
+ 2) bad "fewer than 6 adversarial cases" ;;
+ 3) bad "fewer than 25 total cases" ;;
*) bad "corpus check failed" ;;
esac