🌊 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
TypeScript agentic-aiagentic-frameworkagentic-workflowagentsai-agentsai-assistantai-skillsautonomous-agentsclaudecodexdsh-pluginharnessmcp-servermulti-agentmulti-agent-systemsnpmskillsswarmswarm-intelligencetypescript
feat(cost-tracker): wire codemod benchmark into cost-trend (ADR-143 follow-up)
ruv0403a34279ff
diff --git a/docs/benchmarks/runs/codemod-2026-05-29T19-31-22-484Z.json b/plugins/ruflo-cost-tracker/docs/benchmarks/runs/codemod-2026-05-29T21-27-54-272Z.jsonsimilarity index 81%rename from docs/benchmarks/runs/codemod-2026-05-29T19-31-22-484Z.jsonrename to plugins/ruflo-cost-tracker/docs/benchmarks/runs/codemod-2026-05-29T21-27-54-272Z.jsonindex 3605f1a3a3..6f058c4026 100644--- a/docs/benchmarks/runs/codemod-2026-05-29T19-31-22-484Z.json+++ b/plugins/ruflo-cost-tracker/docs/benchmarks/runs/codemod-2026-05-29T21-27-54-272Z.json@@ -1,16 +1,16 @@{"summary": {- "runAt": "2026-05-29T19:31:22.484Z",+ "runAt": "2026-05-29T21:27:54.272Z","benchmark": "codemod-tier1","corpusVersion": 1,"corpusSize": 12,"winRate": 1,"winRatePct": "100.0%","successCount": 12,- "avgLatencyMs": 0.5533,- "p50LatencyMs": 0.296,- "p99LatencyMs": 3.1452,- "maxLatencyMs": 3.1452,+ "avgLatencyMs": 0.549,+ "p50LatencyMs": 0.306,+ "p99LatencyMs": 2.9676,+ "maxLatencyMs": 2.9676,"structuralCostUsd": 0,"llmBaseline": "estimated","estimatedSavingsUsd": {@@ -26,7 +26,7 @@"correct": true,"changed": true,"edits": 2,- "latencyMs": 3.1452+ "latencyMs": 2.9676},{"id": "v2c-reassigned",@@ -34,7 +34,7 @@"correct": true,"changed": true,"edits": 1,- "latencyMs": 0.4904+ "latencyMs": 0.475},{"id": "v2c-for-loop",@@ -42,7 +42,7 @@"correct": true,"changed": true,"edits": 1,- "latencyMs": 0.6178+ "latencyMs": 0.5999},{"id": "v2c-destructure",@@ -50,7 +50,7 @@"correct": true,"changed": true,"edits": 1,- "latencyMs": 0.296+ "latencyMs": 0.306},{"id": "v2c-scope-aware",@@ -58,7 +58,7 @@"correct": true,"changed": true,"edits": 2,- "latencyMs": 0.619+ "latencyMs": 0.8177},{"id": "v2c-comments-preserved",@@ -66,7 +66,7 @@"correct": true,"changed": true,"edits": 1,- "latencyMs": 0.2776+ "latencyMs": 0.2913},{"id": "rmc-midblock",@@ -74,7 +74,7 @@"correct": true,"changed": true,"edits": 1,- "latencyMs": 0.2854+ "latencyMs": 0.282},{"id": "rmc-multiple",@@ -82,7 +82,7 @@"correct": true,"changed": true,"edits": 2,- "latencyMs": 0.1528+ "latencyMs": 0.1397},{"id": "rmc-indented",@@ -90,7 +90,7 @@"correct": true,"changed": true,"edits": 1,- "latencyMs": 0.1218+ "latencyMs": 0.1083},{"id": "rmc-keep-logger",@@ -98,7 +98,7 @@"correct": true,"changed": false,"edits": 0,- "latencyMs": 0.0757+ "latencyMs": 0.0618},{"id": "log-named-fn",@@ -106,7 +106,7 @@"correct": true,"changed": true,"edits": 1,- "latencyMs": 0.1759+ "latencyMs": 0.1789},{"id": "log-arrow-var",@@ -114,7 +114,7 @@"correct": true,"changed": true,"edits": 1,- "latencyMs": 0.3822+ "latencyMs": 0.3603}]}\ No newline at end of filediff --git a/docs/benchmarks/runs/codemod-latest.json b/plugins/ruflo-cost-tracker/docs/benchmarks/runs/codemod-latest.jsonsimilarity index 81%rename from docs/benchmarks/runs/codemod-latest.jsonrename to plugins/ruflo-cost-tracker/docs/benchmarks/runs/codemod-latest.jsonindex 3605f1a3a3..6f058c4026 100644--- a/docs/benchmarks/runs/codemod-latest.json+++ b/plugins/ruflo-cost-tracker/docs/benchmarks/runs/codemod-latest.json@@ -1,16 +1,16 @@{"summary": {- "runAt": "2026-05-29T19:31:22.484Z",+ "runAt": "2026-05-29T21:27:54.272Z","benchmark": "codemod-tier1","corpusVersion": 1,"corpusSize": 12,"winRate": 1,"winRatePct": "100.0%","successCount": 12,- "avgLatencyMs": 0.5533,- "p50LatencyMs": 0.296,- "p99LatencyMs": 3.1452,- "maxLatencyMs": 3.1452,+ "avgLatencyMs": 0.549,+ "p50LatencyMs": 0.306,+ "p99LatencyMs": 2.9676,+ "maxLatencyMs": 2.9676,"structuralCostUsd": 0,"llmBaseline": "estimated","estimatedSavingsUsd": {@@ -26,7 +26,7 @@"correct": true,"changed": true,"edits": 2,- "latencyMs": 3.1452+ "latencyMs": 2.9676},{"id": "v2c-reassigned",@@ -34,7 +34,7 @@"correct": true,"changed": true,"edits": 1,- "latencyMs": 0.4904+ "latencyMs": 0.475},{"id": "v2c-for-loop",@@ -42,7 +42,7 @@"correct": true,"changed": true,"edits": 1,- "latencyMs": 0.6178+ "latencyMs": 0.5999},{"id": "v2c-destructure",@@ -50,7 +50,7 @@"correct": true,"changed": true,"edits": 1,- "latencyMs": 0.296+ "latencyMs": 0.306},{"id": "v2c-scope-aware",@@ -58,7 +58,7 @@"correct": true,"changed": true,"edits": 2,- "latencyMs": 0.619+ "latencyMs": 0.8177},{"id": "v2c-comments-preserved",@@ -66,7 +66,7 @@"correct": true,"changed": true,"edits": 1,- "latencyMs": 0.2776+ "latencyMs": 0.2913},{"id": "rmc-midblock",@@ -74,7 +74,7 @@"correct": true,"changed": true,"edits": 1,- "latencyMs": 0.2854+ "latencyMs": 0.282},{"id": "rmc-multiple",@@ -82,7 +82,7 @@"correct": true,"changed": true,"edits": 2,- "latencyMs": 0.1528+ "latencyMs": 0.1397},{"id": "rmc-indented",@@ -90,7 +90,7 @@"correct": true,"changed": true,"edits": 1,- "latencyMs": 0.1218+ "latencyMs": 0.1083},{"id": "rmc-keep-logger",@@ -98,7 +98,7 @@"correct": true,"changed": false,"edits": 0,- "latencyMs": 0.0757+ "latencyMs": 0.0618},{"id": "log-named-fn",@@ -106,7 +106,7 @@"correct": true,"changed": true,"edits": 1,- "latencyMs": 0.1759+ "latencyMs": 0.1789},{"id": "log-arrow-var",@@ -114,7 +114,7 @@"correct": true,"changed": true,"edits": 1,- "latencyMs": 0.3822+ "latencyMs": 0.3603}]}\ No newline at end of filediff --git a/plugins/ruflo-cost-tracker/scripts/trend.mjs b/plugins/ruflo-cost-tracker/scripts/trend.mjsindex 268f135916..81fe01c4ba 100755--- a/plugins/ruflo-cost-tracker/scripts/trend.mjs+++ b/plugins/ruflo-cost-tracker/scripts/trend.mjs@@ -4,9 +4,14 @@// the smoke gate misses (gate is binary; trend is a curve).//// Usage:-// node scripts/trend.mjs # markdown summary+// node scripts/trend.mjs # markdown summary (booster series)// TREND_FORMAT=json node scripts/trend.mjs # machine-readable JSON// TREND_LIMIT=10 node scripts/trend.mjs # consider only the most recent N runs+// BENCH_NAME=codemod-tier1 node scripts/trend.mjs # a specific benchmark series+//+// Runs are tagged via summary.benchmark. With no BENCH_NAME, only legacy booster+// runs (untagged or benchmark==="booster") are shown, so other benchmarks+// (e.g. codemod-tier1) never conflate the booster drift curve.import { readFileSync, readdirSync, statSync } from 'node:fs';import { fileURLToPath } from 'node:url';@@ -17,19 +22,27 @@ const PLUGIN_ROOT = resolve(HERE, '..');const RUNS_DIR = join(PLUGIN_ROOT, 'docs', 'benchmarks', 'runs');function loadRuns() {+ const benchName = process.env.BENCH_NAME;const files = readdirSync(RUNS_DIR)- .filter((f) => f.endsWith('.json') && f !== 'latest.json')+ .filter((f) => f.endsWith('.json') && !f.endsWith('latest.json')).map((f) => ({ f, mtime: statSync(join(RUNS_DIR, f)).mtimeMs })).sort((a, b) => a.mtime - b.mtime);const limit = parseInt(process.env.TREND_LIMIT || '50', 10);- return files.slice(-limit).map(({ f }) => {+ return files.map(({ f }) => {try {const json = JSON.parse(readFileSync(join(RUNS_DIR, f), 'utf-8'));return { file: f, summary: json.summary || {} };} catch {return null;}- }).filter(Boolean);+ }).filter(Boolean)+ // Keep one benchmark series: BENCH_NAME if set, else legacy booster runs+ // (untagged or benchmark==="booster"). Prevents cross-benchmark conflation.+ .filter((r) => {+ const b = r.summary.benchmark;+ return benchName ? b === benchName : (b === undefined || b === 'booster');+ })+ .slice(-limit);}function pct(n) { return `${(n * 100).toFixed(1)}%`; }diff --git a/v3/@claude-flow/cli/scripts/benchmark-codemods.mjs b/v3/@claude-flow/cli/scripts/benchmark-codemods.mjsindex a9be0e1a35..b004569d8a 100644--- a/v3/@claude-flow/cli/scripts/benchmark-codemods.mjs+++ b/v3/@claude-flow/cli/scripts/benchmark-codemods.mjs@@ -6,9 +6,10 @@// - latency (avg / p50 / p99 / max)// - cost: $0 measured (no API call) + estimated savings vs an LLM edit//-// Writes a run JSON in the cost-trend summary schema to-// <repo>/docs/benchmarks/runs/codemod-<timestamp>.json (+ codemod-latest.json)-// so the cost-tracker's trend tooling can ingest it.+// Writes a run JSON (tagged summary.benchmark="codemod-tier1") into the+// cost-tracker plugin's runs dir, which is exactly what `cost-trend` reads:+// plugins/ruflo-cost-tracker/docs/benchmarks/runs/codemod-<timestamp>.json+// View the series with: BENCH_NAME=codemod-tier1 node scripts/trend.mjs//// Usage:// node scripts/benchmark-codemods.mjs # build dist first (npm run build)@@ -23,7 +24,8 @@ import { performance } from 'node:perf_hooks';const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));const CLI_ROOT = resolve(SCRIPT_DIR, '..');const REPO_ROOT = resolve(SCRIPT_DIR, '../../../..');-const RUNS_DIR = join(REPO_ROOT, 'docs', 'benchmarks', 'runs');+// Write to the cost-tracker plugin's runs dir — the exact path `cost-trend` reads.+const RUNS_DIR = join(REPO_ROOT, 'plugins', 'ruflo-cost-tracker', 'docs', 'benchmarks', 'runs');// Estimated per-edit LLM cost (USD). Documented estimates, NOT a live call —// used only to express the savings of a $0 deterministic codemod.diff --git a/v3/docs/adr/ADR-143-deterministic-tier1-codemods.md b/v3/docs/adr/ADR-143-deterministic-tier1-codemods.mdindex 112ff56285..bbe6da4559 100644--- a/v3/docs/adr/ADR-143-deterministic-tier1-codemods.md+++ b/v3/docs/adr/ADR-143-deterministic-tier1-codemods.md@@ -112,9 +112,14 @@ LLM-produced edit snippets), but it is **out of the Tier-1 path**.codemod and only emits `[CODEMOD_AVAILABLE]` if it actually changes something;a verified no-op falls through to model routing. With no file, it recommendsTier-1 best-effort (the executor verifies before writing).-4. **Measured benchmark + corpus guardrail** — `bench/codemod-corpus.json` (12- golden cases) + `scripts/benchmark-codemods.mjs` measure correctness/latency and- write a run JSON (cost-trend schema) to `docs/benchmarks/runs/codemod-*.json`.+4. **Measured benchmark + corpus guardrail + cost-trend wiring** —+ `bench/codemod-corpus.json` (12 golden cases) + `scripts/benchmark-codemods.mjs`+ measure correctness/latency and write a run JSON (tagged+ `summary.benchmark="codemod-tier1"`) into the cost-tracker plugin's runs dir,+ the exact path `cost-trend` reads. `cost-trend` is now benchmark-aware:+ `BENCH_NAME=codemod-tier1 node scripts/trend.mjs` shows the codemod series,+ while the default trend keeps showing only legacy booster runs (untagged /+ `benchmark==="booster"`) — no cross-benchmark conflation.`__tests__/codemod-corpus.test.ts` fails CI on any regression vs golden.## Verification