Executable agent recipeMeasured workload

Compress four real chapters before the model call.

This checked-in recipe compiles four complete, published Maha Strategies book chapters for one comparative-analysis task. It reports real BPE token counts, the API's source-coverage metric, and input-token economics against the production 0.001 USDC x402 fee.

Measured

What the run produced.

Raw workload

22,340 tokens

106,764 bytes across 4 sources

Compiled pack

5,733 tokens

16,607 BPE input tokens removed

Reduction

74.34%

Fixed 8,000-token requested budget

Source coverage

100%

4/4 sources contributed at least one passage

Declared economic assumption

$0.049821 gross input cost avoided at a $3/M reference rate.

x402 fee

$0.001

Net input cost avoided

$0.048821

Gross saving / fee

49.72×

This is not a universal savings claim. It compares one raw-input model call with one compiled-input model call at the explicitly declared reference rate. It excludes output-token cost from both alternatives, network latency, and any downstream call required to evaluate answer quality. Override the rate when reproducing the run.

Run it

Measure locally first. Pay only when you choose live mode.

1. Reproduce without payment

npm run recipe:context-compiler

Runs the exact compiler implementation against the committed chapters. No key, network request, or payment is used.

2. Exercise production x402

npm run recipe:context-compiler:live

Requires X402_BUYER_PRIVATE_KEY in the process environment. It signs and settles exactly one production payment on Base Mainnet.

Use a dedicated, limited-balance test wallet. Never commit a private key or paste it into source code. Live mode is deliberately opt-in and cannot run without the environment variable.

Boundaries

What the measurement does—and does not—establish

  • Real workload: the inputs are complete chapters already published in this repository, not generated filler or a simulated token count.
  • Exact reproduction: committed input and output hashes make corpus or compiler drift visible in the regression test.
  • Coverage boundary: 100% source coverage means every source contributed at least one passage. It does not mean every fact or passage survived.
  • Quality boundary: the recipe measures selection and economics, not whether a downstream model produces a correct or complete answer.

input sha256:bf968a5eb6dfe890da2d205ed9a4bed3410ed64a43f10a775381340dee0dc192
output sha256:a48b3a666f8d34ac290184ccf1635dc6b622016c0f9e240d278f4e9a030dd9f2