Skip to content

Find code by asking what it does. A CLI for coding agents that uses Jev to discover relevant files and source context.

Record combined-cost research and preserve captured usage

David Zhang6e0ec4f08370
diff --git a/.agents/skills/jevgrep/SKILL.md b/.agents/skills/jevgrep/SKILL.md
index 1f3712f..e96ce91 100644
--- a/.agents/skills/jevgrep/SKILL.md
+++ b/.agents/skills/jevgrep/SKILL.md
@@ -28,9 +28,11 @@ Pass a natural-language question and an optional search root. The root defaults
to the current directory; a narrower folder limits the search to that subtree.
Use `jg --help` for available options.
-Results are printed to stdout; no report file is created. If the shell returns a
-running session, retrieve the completed output through that session. The complete
-context ends with `End context.`; shell output limits may truncate it.
+Results are printed to stdout; no report file is created. Preserve the complete
+shell-tool result, including any session/process ID. If the search is still
+running, wait on that ID until it exits; do not launch another search to recover
+its output. The complete context ends with `End context.`; shell output limits
+may truncate it.
## Output
diff --git a/evals/README.md b/evals/README.md
index 5917ad9..75a52f0 100644
--- a/evals/README.md
+++ b/evals/README.md
@@ -34,3 +34,6 @@ The [final product research report](results/relevance-threshold-2026-09-27.md) r
The [speed study](results/speed-2026-09-28.md) compares the frozen local optimizations and native TypeSafe route against that previous cohort and the same saved no-Jev baselines.
The [total-cost rerun](results/total-cost-2026-09-28.md) uses published 0.4.3 and includes Jev costs, the default for all future runs. Historical reports retain their original accounting basis.
+
+The [combined-cost research](results/combined-cost-research-2026-09-28.md) examines
+why lower retrieval charges can be offset by greater coding-agent expense.
diff --git a/evals/implementation/swebench/installed.py b/evals/implementation/swebench/installed.py
index 0bd3032..dfbab98 100644
--- a/evals/implementation/swebench/installed.py
+++ b/evals/implementation/swebench/installed.py
@@ -646,8 +646,16 @@ def observed_jev(out, events, log_valid, traces_copied, provider="vercel"):
coverage = False
continue
end = matching[0]
- if (end.get('status') != 200 or end.get('transportError') or end.get('incompleteStream') or
- end.get('responseBytes') != response.stat().st_size or end.get('requestBytes') != requests[identifier].stat().st_size):
+ # The broker captures each Jev chunk before writing it to the client.
+ # A client disconnect can therefore leave a complete bill in the trace
+ # even though responseBytes (delivered bytes) is smaller. Count that
+ # paid request, including its retries; malformed JSON still fails above.
+ captured_after_disconnect = (end.get('transportError') == 'BrokenPipeError' and
+ count(end.get('responseBytes')) and end['responseBytes'] <= response.stat().st_size)
+ if (end.get('status') != 200 or end.get('incompleteStream') or
+ (not captured_after_disconnect and (end.get('transportError') or
+ end.get('responseBytes') != response.stat().st_size)) or
+ end.get('requestBytes') != requests[identifier].stat().st_size):
coverage = False
except (OSError, ValueError, KeyError, TypeError, AttributeError, InvalidOperation):
coverage = False
@@ -660,6 +668,7 @@ def observed_jev(out, events, log_valid, traces_copied, provider="vercel"):
'pricing': pricing, 'cost_kind': 'estimate' if pricing else 'reported',
'included_in_scored_task_cost': True, 'client_calls': len(ids), 'responses_with_cost': len(costs),
'complete': complete, 'observed_cost_usd': known if complete else None, 'known_cost_usd': known,
+ 'responses_with_client_disconnect': sum(event.get('transportError') == 'BrokenPipeError' for event in ends),
'input_tokens': sum(inputs) if coverage and len(inputs) == len(ids) else None,
'output_tokens': sum(outputs) if coverage and len(outputs) == len(ids) else None,
'provider_attempts': sum(attempts) if coverage and len(attempts) == len(ids) else None,
diff --git a/evals/implementation/swebench/test_installed.py b/evals/implementation/swebench/test_installed.py
index ebec2e7..185905d 100644
--- a/evals/implementation/swebench/test_installed.py
+++ b/evals/implementation/swebench/test_installed.py
@@ -395,6 +395,19 @@ class InstalledTests(unittest.TestCase):
events[-1]['transportError']='Interrupted'
self.assertIsNone(runner.observed_jev(root,events,True,True)['observed_cost_usd'])
+ def test_jev_retained_bill_counts_when_client_disconnects_after_response_capture(self):
+ with tempfile.TemporaryDirectory() as temporary:
+ root=Path(temporary);events=self.jev_fixture(root)
+ events[-1]['transportError']='BrokenPipeError'
+ events[-1]['responseBytes']=0
+ result=runner.observed_jev(root,events,True,True)
+ self.assertTrue(result['complete'])
+ self.assertEqual(result['observed_cost_usd'],0.03)
+ self.assertEqual(result['input_tokens'],20)
+ response=root/'jev-traces'/('1'*32+'.response.json')
+ response.write_text('{')
+ self.assertFalse(runner.observed_jev(root,events,True,True)['complete'])
+
def test_retained_jev_cost_survives_missing_log_or_request_start(self):
for missing_log in [True, False]:
with self.subTest(missing_log=missing_log),tempfile.TemporaryDirectory() as temporary:
diff --git a/evals/results/combined-cost-research-2026-09-28.json b/evals/results/combined-cost-research-2026-09-28.json
new file mode 100644
index 0000000..3facc51
--- /dev/null
+++ b/evals/results/combined-cost-research-2026-09-28.json
@@ -0,0 +1,350 @@
+{
+ "status": "research concluded; published implementation retained",
+ "baseline": "total-cost-2026-09-28.json",
+ "candidate": "restored128",
+ "package_sha256": "15be7a2f9ccc42ab73fb146052da59e567e18c34911367b7979832d2b86ef834",
+ "baseline_report_sha256": "f1219f6d114448f058e9421ac89f2ffc277467b34f30593c1540cf6e04b5e96f",
+ "official_solves": 8,
+ "baseline_official_solves": 8,
+ "tasks": [
+ {
+ "name": "astropy",
+ "resolved": true,
+ "protocol_valid": true,
+ "fully_billed": true,
+ "combined_usd": 0.7165619919999999,
+ "jev_usd": 0.053494392,
+ "cost_upper_bound_usd": 0.7165619919999999,
+ "jev_cost_upper_bound_usd": 0.053494392,
+ "acceptance_cost_basis": "reported usage at retained list price",
+ "baseline_combined_usd": 0.493752812,
+ "baseline_jev_usd": 0.150145212
+ },
+ {
+ "name": "django",
+ "resolved": true,
+ "protocol_valid": true,
+ "fully_billed": true,
+ "combined_usd": 1.095760078,
+ "jev_usd": 0.102259878,
+ "cost_upper_bound_usd": 1.095760078,
+ "jev_cost_upper_bound_usd": 0.102259878,
+ "acceptance_cost_basis": "reported usage at retained list price",
+ "baseline_combined_usd": 1.503687584,
+ "baseline_jev_usd": 0.351474984
+ },
+ {
+ "name": "matplotlib",
+ "resolved": false,
+ "protocol_valid": true,
+ "fully_billed": true,
+ "combined_usd": 0.467903172,
+ "jev_usd": 0.080029572,
+ "cost_upper_bound_usd": 0.467903172,
+ "jev_cost_upper_bound_usd": 0.080029572,
+ "acceptance_cost_basis": "reported usage at retained list price",
+ "baseline_combined_usd": 0.596602188,
+ "baseline_jev_usd": 0.175165788
+ },
+ {
+ "name": "pylint",
+ "resolved": false,
+ "protocol_valid": true,
+ "fully_billed": true,
+ "combined_usd": 0.691407208,
+ "jev_usd": 0.052026408,
+ "cost_upper_bound_usd": 0.691407208,
+ "jev_cost_upper_bound_usd": 0.052026408,
+ "acceptance_cost_basis": "reported usage at retained list price",
+ "baseline_combined_usd": 0.292289784,
+ "baseline_jev_usd": 0.066664584
+ },
+ {
+ "name": "pytest",
+ "resolved": true,
+ "protocol_valid": true,
+ "fully_billed": true,
+ "combined_usd": 0.768812326,
+ "jev_usd": 0.032856726,
+ "cost_upper_bound_usd": 0.768812326,
+ "jev_cost_upper_bound_usd": 0.032856726,
+ "acceptance_cost_basis": "reported usage at retained list price",
+ "baseline_combined_usd": 0.528859888,
+ "baseline_jev_usd": 0.111920088
+ },
+ {
+ "name": "requests",
+ "resolved": true,
+ "protocol_valid": true,
+ "fully_billed": true,
+ "combined_usd": 0.298788644,
+ "jev_usd": 0.004342044,
+ "cost_upper_bound_usd": 0.298788644,
+ "jev_cost_upper_bound_usd": 0.004342044,
+ "acceptance_cost_basis": "reported usage at retained list price",
+ "baseline_combined_usd": 0.349568814,
+ "baseline_jev_usd": 0.012791814
+ },
+ {
+ "name": "scikit",
+ "resolved": true,
+ "protocol_valid": true,
+ "fully_billed": false,
+ "combined_usd": null,
+ "jev_usd": null,
+ "cost_upper_bound_usd": 0.39258190800000003,
+ "jev_cost_upper_bound_usd": 0.096783708,
+ "acceptance_cost_basis": "conservative provider-context ceiling for missing native charges; actual bill unknown",
+ "baseline_combined_usd": 0.292258492,
+ "baseline_jev_usd": 0.079381092
+ },
+ {
+ "name": "sphinx",
+ "resolved": true,
+ "protocol_valid": true,
+ "fully_billed": true,
+ "combined_usd": 0.546857152,
+ "jev_usd": 0.055463352,
+ "cost_upper_bound_usd": 0.546857152,
+ "jev_cost_upper_bound_usd": 0.055463352,
+ "acceptance_cost_basis": "reported usage at retained list price",
+ "baseline_combined_usd": 0.5392377340000001,
+ "baseline_jev_usd": 0.167765934
+ },
+ {
+ "name": "sympy",
+ "resolved": true,
+ "protocol_valid": true,
+ "fully_billed": true,
+ "combined_usd": 0.43280565000000004,
+ "jev_usd": 0.05894805,
+ "cost_upper_bound_usd": 0.43280565000000004,
+ "jev_cost_upper_bound_usd": 0.05894805,
+ "acceptance_cost_basis": "reported usage at retained list price",
+ "baseline_combined_usd": 0.359203994,
+ "baseline_jev_usd": 0.093028194
+ },
+ {
+ "name": "xarray",
+ "resolved": true,
+ "protocol_valid": true,
+ "fully_billed": true,
+ "combined_usd": 0.412758778,
+ "jev_usd": 0.066406578,
+ "cost_upper_bound_usd": 0.412758778,
+ "jev_cost_upper_bound_usd": 0.066406578,
+ "acceptance_cost_basis": "reported usage at retained list price",
+ "baseline_combined_usd": 0.7009377640000001,
+ "baseline_jev_usd": 0.270070164
+ }
+ ],
+ "combined_cost_upper_bound_usd": 5.824236908,
+ "baseline_combined_usd": 5.6563990539999995,
+ "known_combined_cost_usd": 5.7719391799999995,
+ "jev_cost_upper_bound_usd": 0.6026107079999999,
+ "baseline_jev_usd": 1.478407854,
+ "timing": {
+ "scope": "All ten frozen first attempts. wall_s includes retrieval and coding/localverification, excludes setup/officialgrading.",
+ "rows": [
+ {
+ "task": "django",
+ "baseline": {
+ "wall_s": 367.1729112920002,
+ "retrieval_wait_s": 99.5581932500354,
+ "work_s": 267.6147180419648,
+ "jev_calls": 921
+ },
+ "candidate": {
+ "wall_s": 390.6613638330018,
+ "retrieval_wait_s": 135.51508137502242,
+ "work_s": 255.1462824579794,
+ "jev_calls": 272
+ }
+ },
+ {
+ "task": "xarray",
+ "baseline": {
+ "wall_s": 154.6803119169781,
+ "retrieval_wait_s": 58.366360582993366,
+ "work_s": 96.31395133398473,
+ "jev_calls": 807
+ },
+ "candidate": {
+ "wall_s": 194.82056504196953,
+ "retrieval_wait_s": 0.0,
+ "work_s": 194.82056504196953,
+ "jev_calls": 114
+ }
+ },
+ {
+ "task": "sphinx",
+ "baseline": {
+ "wall_s": 125.24509529100033,
+ "retrieval_wait_s": 39.13462225004332,
+ "work_s": 86.110473040957,
+ "jev_calls": 496
+ },
+ "candidate": {
+ "wall_s": 105.9309443749953,
+ "retrieval_wait_s": 21.013335124996956,
+ "work_s": 84.91760924999835,
+ "jev_calls": 194
+ }
+ },
+ {
+ "task": "pytest",
+ "baseline": {
+ "wall_s": 130.86067179200472,
+ "retrieval_wait_s": 0.0,
+ "work_s": 130.86067179200472,
+ "jev_calls": 324
+ },
+ "candidate": {
+ "wall_s": 267.4302607080317,
+ "retrieval_wait_s": 0.0,
+ "work_s": 267.4302607080317,
+ "jev_calls": 75
+ }
+ },
+ {
+ "task": "scikit",
+ "baseline": {
+ "wall_s": 84.86842679098481,
+ "retrieval_wait_s": 0.0,
+ "work_s": 84.86842679098481,
+ "jev_calls": 249
+ },
+ "candidate": {
+ "wall_s": 173.54026812501252,
+ "retrieval_wait_s": 0.0,
+ "work_s": 173.54026812501252,
+ "jev_calls": 146
+ }
+ },
+ {
+ "task": "astropy",
+ "baseline": {
+ "wall_s": 96.07012474996736,
+ "retrieval_wait_s": 0.0,
+ "work_s": 96.07012474996736,
+ "jev_calls": 362
+ },
+ "candidate": {
+ "wall_s": 588.7129652500153,
+ "retrieval_wait_s": 333.5089325000299,
+ "work_s": 255.20403274998534,
+ "jev_calls": 114
+ }
+ },
+ {
+ "task": "requests",
+ "baseline": {
+ "wall_s": 91.80887075001374,
+ "retrieval_wait_s": 8.07811587501783,
+ "work_s": 83.73075487499591,
+ "jev_calls": 61
+ },
+ "candidate": {
+ "wall_s": 103.94635766599094,
+ "retrieval_wait_s": 13.504510041966569,
+ "work_s": 90.44184762402438,
+ "jev_calls": 13
+ }
+ },
+ {
+ "task": "sympy",
+ "baseline": {
+ "wall_s": 136.16144016600447,
+ "retrieval_wait_s": 0.0,
+ "work_s": 136.16144016600447,
+ "jev_calls": 281
+ },
+ "candidate": {
+ "wall_s": 135.5842262909864,
+ "retrieval_wait_s": 63.214656250027474,
+ "work_s": 72.36957004095893,
+ "jev_calls": 126
+ }
+ },
+ {
+ "task": "matplotlib",
+ "baseline": {
+ "wall_s": 211.51810679095797,
+ "retrieval_wait_s": 67.35965399997076,
+ "work_s": 144.1584527909872,
+ "jev_calls": 650
+ },
+ "candidate": {
+ "wall_s": 185.5360709169763,
+ "retrieval_wait_s": 44.53250691702124,
+ "work_s": 141.00356399995508,
+ "jev_calls": 178
+ }
+ },
+ {
+ "task": "pylint",
+ "baseline": {
+ "wall_s": 89.66493179096142,
+ "retrieval_wait_s": 0.0,
+ "work_s": 89.66493179096142,
+ "jev_calls": 203
+ },
+ "candidate": {
+ "wall_s": 243.55788329202915,
+ "retrieval_wait_s": 53.815367083007004,
+ "work_s": 189.74251620902214,
+ "jev_calls": 135
+ }
+ }
+ ],
+ "totals": {
+ "baseline": {
+ "wall_s": 1488.0508913308731,
+ "retrieval_wait_s": 272.4969459580607,
+ "work_s": 1215.5539453728124,
+ "jev_calls": 4354
+ },
+ "candidate": {
+ "wall_s": 2389.720905499009,
+ "retrieval_wait_s": 665.1043892920716,
+ "work_s": 1724.6165162069374,
+ "jev_calls": 1367
+ }
+ },
+ "caveats": [
+ "Single observed attempt per task; no baseline rerun. Provider/network/host conditions not controlled.",
+ "retrieval_wait_s is budget-credit time only for standalone commands. Zero does not mean zero retrieval time. Use wall_s for end-to-end task elapsed comparison.",
+ "Fixed cost benchmark is total-cost-2026-09-28, whose packages report0.4.3; current installed release0.4.4 has not been rerun as a new baseline."
+ ]
+ },
+ "accounting": {
+ "native_model": "jev-1.13.0",
+ "input_usd_per_million": 0.042,
+ "output_usd_per_million": 0,
+ "basis": "Published list-price estimate, not invoice reconciliation. Sol generation charges plus native Jev, including failed attempts and retries.",
+ "missing_native_calls": 19,
+ "task_with_missing_usage": "scikit",
+ "conservative_allowance_usd": 0.052297728,
+ "method": "65536inputtokens per missing native response; conservative published64kcontextceiling. Actual charges remain unknown; known subtotal alone exceeds baseline.",
+ "source": "https://docs.typesafe.ai/models"
+ },
+ "decision": "Do not promote as combined-cost improvement. Official quality retained, native cost lower, combined cost higher. User relaxed15%target; that does not make a cost increase a win.",
+ "comparison_controls": "All10task prompts byte-identical; source HEAD/tree,runtimeimage,engine/model/effort andruntimeversions match; onefirstattempt pertask; no rerunbaseline or cheapestcellpooling. Exact currentpublicskill packaged.",
+ "raw_evidence": "evals/runs/swebench/cost-half-research/restored128-cohort (ignored local run storage)",
+ "final_followup": {
+ "candidate": "compact32",
+ "package_sha256": "f70a358bf398d595b6ca9daedfdbb774c76ca68fb8dc0a640ff7050d45e9fa6e",
+ "change": "Only declaration cap128to32 relative to restored128package; all other package bytes identical.",
+ "task": "pytest-dev__pytest-6197",
+ "official_resolved": true,
+ "protocol_valid": true,
+ "actual_combined_cost_usd": null,
+ "known_combined_cost_usd": 0.708094676,
+ "known_sol_usd": 0.668771,
+ "jev_usd": 0.039323676,
+ "missing_sol_requests": 1,
+ "baseline_combined_usd": 0.528859888,
+ "decision": "Reject as combined-cost optimization: known charges alone already exceed fixedbaseline by33.9%. Added helper/test snippets in a fixed-query diagnostic did not establish an end-to-end win."
+ },
+ "outcome": "No new retrieval candidate promoted. Unsuccessful product experiments preserved in ignored researchpatch/packages, then reverted from working production code. Retain published0.4.4; no new cost-improvementrelease."
+}
diff --git a/evals/results/combined-cost-research-2026-09-28.md b/evals/results/combined-cost-research-2026-09-28.md
new file mode 100644
index 0000000..74a4b29
--- /dev/null
+++ b/evals/results/combined-cost-research-2026-09-28.md
@@ -0,0 +1,52 @@
+# Combined-cost research
+
+Reducing retrieval expense did not reduce total task expense in the completed
+ten-task experiment. The candidate retained 8/10 official solves, matching the
+fixed baseline, but its known charges already exceed the baseline before any
+allowance for missing native usage. It is not a verified combined-cost improvement.
+
+The [result data](combined-cost-research-2026-09-28.json) owns task-level costs,
+package identity, accounting assumptions and timings. Its comparison is the
+[fixed total-cost cohort](total-cost-2026-09-28.md), not a fresh baseline run.
+The final, separately identified batch-size follow-up also failed to establish a
+combined-cost improvement. It solved Pytest, but known charges alone were above
+that task's fixed baseline; one Sol charge remains unavailable. The published
+implementation is retained, and no cost-improvement release is justified.
+
+## What the experiment establishes
+
+Larger declaration batches, shared question criteria and preview-based admission
+can substantially reduce Jev requests and input charges while retaining official
+solve outcomes on this tuned cohort. Those savings are insufficient when the
+coding agent does more exploration, patch revision or verification. The decision
+metric must remain the complete coding task plus retrieval, including failures.
+
+Useful extra excerpts are not automatically cheaper context. Conversely, a shorter
+packet is not automatically better: relevant helpers and regression examples can
+save later exploration. Retrieval-only probes identify mechanisms worth testing;
+they cannot establish a total-task cost win.
+
+Fewer requests also did not imply faster task completion. The retained wall-clock
+observations include retrieval, coding and local verification, but exclude setup
+and official grading. Provider and host conditions were not controlled, so these
+are observed timings rather than a causal speed benchmark. In the slow Astropy
+run, native responses averaged under one second while gaps between requests
+dominated elapsed retrieval time.
+
+## Limits and accounting
+
+Scikit-learn has 19 native calls with empty responses. Their actual charges remain
+unknown. The reported ceiling assigns each the full 65,536-token request allowance
+at the retained public input price; it never treats missing usage as free. The
+candidate costs more even without that allowance. Native prices are list-price
+estimates, not reconciled invoices.
+
+All ten comparisons retain their first attempts, matching task prompts, source
+revisions, runtime images and model settings. The candidate packages the current
+public retrieval skill. No cheapest-result pooling or baseline reruns are used.
+These repeatedly studied Python tasks do not establish language-wide or untouched
+task generalization.
+
+The user relaxed the original 15% target to permit an evidence-based stopping
+point. That changes when research can conclude; it does not change the measured
+results or justify publishing a cost increase as a saving.
diff --git a/skills/jevgrep/SKILL.md b/skills/jevgrep/SKILL.md
index 1f3712f..e96ce91 100644
--- a/skills/jevgrep/SKILL.md
+++ b/skills/jevgrep/SKILL.md
@@ -28,9 +28,11 @@ Pass a natural-language question and an optional search root. The root defaults
to the current directory; a narrower folder limits the search to that subtree.
Use `jg --help` for available options.
-Results are printed to stdout; no report file is created. If the shell returns a
-running session, retrieve the completed output through that session. The complete
-context ends with `End context.`; shell output limits may truncate it.
+Results are printed to stdout; no report file is created. Preserve the complete
+shell-tool result, including any session/process ID. If the search is still
+running, wait on that ID until it exits; do not launch another search to recover
+its output. The complete context ends with `End context.`; shell output limits
+may truncate it.
## Output