MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / measure

Function measure

scripts/agent-eval/compare-arms.mjs:58–92  ·  view source on GitHub ↗

The numbers one arm's runs contribute to the table.

(run)

Source from the content-addressed store, hash-verified

56
57/** The numbers one arm's runs contribute to the table. */
58function measure(run) {
59 const s = parseSession(run.files);
60 const o = s.occupancy;
61 const a = s.allocation;
62 return {
63 name: run.name,
64 ok: s.ok,
65 raced: s.raced,
66 turns: s.turns,
67 dur: s.dur,
68 tools: s.tools,
69 reads: s.reads,
70 grep: s.grep,
71 bash: s.counts.Bash || 0,
72 cg: s.cg,
73 cliCalls: s.cliCalls,
74 cliContaminated: s.cliContaminated,
75 ctx: o.ctxFinal,
76 occCg: o.residual.codegraph,
77 occFile: o.residualFileAccess,
78 // The arm's OWN retrieval residual: codegraph in a with-arm, Read/Grep/Bash
79 // in a without-arm. Comparing these two is the apples-to-apples pair.
80 occSelf: o.residual.codegraph + o.residualFileAccess,
81 occShare: o.ctxFinal > 0 ? ((o.residual.codegraph + o.residualFileAccess) / o.ctxFinal) * 100 : 0,
82 suffAnswered: s.sufficiency.answered,
83 suffCounts: s.sufficiency.counts,
84 suffErrors: s.sufficiency.errors,
85 // Allocation is byte-weighted, so a run with no explore contributes nothing
86 // rather than a zero — a zero would drag the pooled number toward "wasteful"
87 // for a run that never spent a byte.
88 allocUsed: a.envelope ? a.used : null,
89 allocEnvelope: a.envelope || null,
90 allocCalls: a.calls.length,
91 };
92}
93
94/** median [min–max] over runs; the range is the point — never quote one run. */
95function span(runs, pick, fmt = (x) => String(Math.round(x))) {

Callers

nothing calls this directly

Calls 1

parseSessionFunction · 0.90

Tested by

no test coverage detected