# Recorded research-loop example

This example lets visitors load a known task, compare editable cost assumptions with recorded usage, and inspect why they differ. Loading it makes no new inference calls, reads no user file, uploads no logs and does not save anything automatically. Optional analysis export/save uses the existing local import controls.

## Provenance and scope

- Collected: 2026-09-24T02:06:22.195Z (collection start).
- Runner: official Pi Agent 0.87.1, Pi OpenAI-compatible adapter.
- Target: Gemini `gemini-3.1-flash-lite`.
- Task: `fresh-v1-holdout-research-complete`.
- Original Actions run: https://github.com/luhayes/jevcalc/actions/runs/35945790892 (private repository access required).
- Experiment code: `bdf7203f386f258c8a962d5e05972d9a37b9f763`.
- Synthetic six-document task, fixed tool arguments, sequential single-call turns. Real provider calls; tool results and side effects are fixtures.
- Path: search, six reads, mock report acknowledgement, finish. Nine model requests; eight workload tool calls plus a terminal control call. No final prose is generated. The simulator represents the last call as completion control, not an answer.
- This selected run completed the fixture checks and had no provider retries. Completion does not establish report quality.

## What is compared

The usage records preserve provider input/output counts and recorded durations. Missing cache buckets remain unknown. Costs are counts multiplied by the experiment's supplied September 23 tariffs: $0.25/M input and $1.50/M output. They are not invoice amounts or a current pricing claim. Mock tools have no fee in this fixture; hosting/compute are excluded.

The assumptions are reconstructed **after execution** from the chosen path and message content. They use `content-heuristic-v2`: one token per four non-CJK characters, one per CJK character, rounded upward; message framing is assumed at three tokens per message plus three per request. Tool definitions, system content, tool returns and accepted replies are counted separately. Provider usage never sets the assumptions. Six identical-sized read stages are grouped into one repeatable stage. No fitted multiplier forces agreement.

The approximate curve can disagree with usage because tokenization, protocol serialization and framing differ. Changing retention, output length, model allocation or prices creates an **unexecuted counterfactual**; it cannot prove savings at equal quality. When the scenario changes, the importer asks for renewed workload and turn-alignment confirmation. The recorded baseline never changes.

This single example is an onboarding demonstration, not a held-out accuracy benchmark, production trace or evidence of arbitrary-prompt prediction.

## Reproduction from the saved artifact

In a checkout of JevCalc, an authorized maintainer with the original Actions artifact can run:

```sh
node scripts/build-usage-example.mjs /path/to/downloaded/artifact
npm test
```

The extractor checks the selected completed nine-turn run and allowlists numeric records and content-derived budgets into `src/lib/examples/pi-research.json`. It does not publish raw messages, signatures, provider response IDs, headers or credentials. The output includes a SHA-256 of the selected original JSONL line for artifact matching. The test checks all reconstructed per-turn inputs/outputs against the content-only budgets, and independently checks cost arithmetic against recorded usage.

Loading replaces query, assumptions, strategy and rates only after confirmation. Restore previous scenario returns the in-memory original, including an unfinished query edit; any previous local import remains mounted and available. Refresh discards this unsaved session. No automatic saving or share-link inclusion occurs.
