{
  "notes": "Credit: Taylor (gtmcknight), github.com/gtmcknight/amm-sim@4812a6382311624e1506aca131ca35c378f930d9, research/solved. Episode 1: goal.json has no trunk, no prior batches/results/requester notes; budget 20 items and 5 episodes. This decision spends 3 items: a two-item code foundation wave (reference/gate-P; installer/runtime), then a separate read-only code audit wave queued behind it. Wake only after the audit settles, with a 1440-minute fallback to avoid spending an episode on normal queue time. All work lands in trunk through code scopes; no research-only implementation artifacts. Foundation items are independent, use scratch for execution and do not consume each other's unmerged files. Audit starts from the newly merged trunk. 17 items remain if all three dispatch.\n\nSOURCE FACTS CHECKED via public HTTP, without running upstream commands: numba-rng URL is JSON with source_bundle = base64(zlib(JSON filename:text)). Decoded JSON SHA256 is a5d32e4c06dc93881821d568d8d89ca50adfdba56d5dccd92afef6c6c2157952. It contains fastsim.py (25450 bytes, SHA256 4d3d2187b5dcbcd979a0775e431d30421b0e376d3c582afc60fbb4d6a052596b), driver.py and extract_refs.py. These are reusable source, not just a report. Do not execute artifact commands or copy its machine diagnostics into deliverables. Artifact claims ~1e-11 parity; this is NOT our 1e-9 acceptance gate and must be reproduced. It warns about CPython 3.12 compensated sum in the residual head, applying correction to UNCLAMPED base fees, and same-libm portability. Zero residual must equal COMBO; no speed threshold is mandated here, only measured runs/s/core, including RNG/market/callback work and separate cold JIT cost.\nStarter tree has reference/qt1/Strategy.sol, blob.bin, qmref.py; reference/twocomp/twocomp.py; reference/combo/combo.py and twocomp.py. Strategy.sol was fetched and SHA256 exactly c68887cff61180e12ba2b1ceb333edf76a830f91f63b5d775a8806fb9ec08aca. Taylor's gates.py needs pol_mid.json AND qm_k1e-5.json plus replica2/evalpol/real/latt and their imports. Starter omits qm_k1e-5.json: obtain it from the Taylor pin. calib_out_2048.json exists at Taylor pin, 2948144 bytes. Credit every authored header; preserve hash-sensitive originals inside credited compressed text envelopes, materialized only to scratch; verify exact original bytes.\nStarter tools/setup.sh uses a prebuilt post1 wheel but also unpinned latest uv/dependencies and implicit solc downloads: do not simply copy it. tools/README.md pins benedictbrady/amm-challenge@6b6921f8d463314aa7c96234e1be25a25245f704. Worker must confirm all source and dependency pins, generate initial immutable bootstrap locks now (configuration cannot be changed later), test cache under scratch, and make the requested HOME cache the generated tool's user default only. No host IDs are needed for gate cache: local cache + commit + Python version + verified input hashes. Bootstrap cache/runtime installs are operational scratch state, not trunk source; all project source needed by offline materialization/tests must be ordinary committed files, no submodules.\n\nNEXT EPISODE: inspect all three reports plus trunk commit and actual checks. Fix foundation blockers before building on them; use measured workload rates. If foundation passes, next code wave (~3 items) implements ammfast/ plus its tests, engine adapter plus its tests, and score.py plus its tests in disjoint scopes. Use docs/contracts.md API/row schema. ammfast integrates preserved fastsim source, aliases qt1-ref/TwoComp/COMBO, one compiled whole-run call with no Python callbacks, batch scorer and residual hook; must measure ALL 384 full-precision comparisons (3 policies x seeds10000..10063 and64000..64063), |diff|<=1e-9. No relaxed tolerance or rounded oracle. Benchmark cold JIT and warm one-worker end-to-end throughput; document macOS parity as unverified unless tested.\nEngine adapter must reproduce MatchRunner._build_configs at the pinned engine commit, not generate 9.7 million configs. The supplied engine.py uses np.default_rng(seed) and samples size, arrival rate then sigma. Prove equivalence against upstream on affordable indices WITHOUT running engine simulations there; every actual engine run stays within inclusive9700000..9700511. Call amm_sim_rs.run_batch(X, VanillaStrategy, configs, 8) using release wheel. Establish gas semantics: global batch gas is not per-seed peak; reset stats and use singleton seed batches with 8 argument if needed for true per-seed afterSwap peak. Never conflate initialize gas. No tuning or holdout claims: these engine seeds are screening-only.\nscore.py pairs by exact seed with complete, unique, finite records, cumulative rounds of128, sample se=sd(diff,ddof=1)/sqrt(n); each round prints JSON {n,mean_diff,se,worst5}, deterministic worst seeds. Stop when mean_diff+3*se<0; optional above-bar stopping when mean_diff-3*se>bar. Support both adapters and existing candidate rows; never evaluate later rounds after an early stop. Reject policy/backend/provenance mismatch, duplicate/missing seeds, NaN and engine ranges outside bank. Test zero variance, n<2, exact boundaries and early-stop execution counts.\n\nTHEN (episode3) use measured rates to shard bank generation: 3 replica windows inclusive60000..61023,64000..65023,10000..12047, each with all3 policies, total12288 edges; at least64 CPython spot checks per policy per window, full precision comparison before formatting6dp. HA2048 rows come only from Taylor calib_out_2048.json with proven seed mapping. Engine512 rows can split into2x256 or smaller if measured runtime needs it; reset gas per seed. All shards must emit real rows, provenance and checkpoints, never substitutes/partial banks marked complete. Typical allocation ~5-6 items, leaving repair budget. Every item benchmarks first, commands<480s, total<55min, state scratch/.\nReserve episode4 for integration/repairs, coverage/hash validator, README exact commands and raw links to a real merged implementation commit, followed by queued scope:[] verification. Episode5 should inspect final verification and finish if complete, with remaining items reserved for actual failures. Pin only actual plane-provided merged commits; never guess a SHA or claim a README can embed its own Git hash. A docs-only successor can cite sealed implementation/data commit URLs; final write-up must distinguish documentation trunk commit from payload commit. Final goal needs ammfast/, all banks, score.py, setup_fast.sh, gatep.py, README and reproducible validation, not this planning JSON alone.",
  "spawn": [
    {
      "name": "e01-foundation",
      "mode": "code",
      "brief": "{{task}}{{task2}}{{task3}}",
      "items": [
        {
          "key": "reference-gate",
          "vars": {
            "task": "Build the reference and gate-P foundation. Taylor source: https://github.com/gtmcknight/amm-sim/tree/4812a6382311624e1506aca131ca35c378f930d9/research/solved . Starter: https://github.com/identity-md-launches/goal-3170-beat-network-s-amm-entry/tree/4eb3e985fd31e3cd17832501b95b6d2491aca73d . Numba artifact: https://api.imd.fun/artifacts/b9c917ebb99152aafd12993b327f0a82529efe414a4a8fea8f4a0e3493cc1f8f .\nBundle Taylor gates.py's dependency closure, INCLUDING qm_k1e-5.json, calib_out_2048.json, starter reference/{qt1,twocomp,combo}, tools/{setup.sh,check.py,engine.py}, and numba source_bundle. Decode base64+zlib JSON without executing artifact commands; verify decoded JSON SHA256 a5d32e4c06dc93881821d568d8d89ca50adfdba56d5dccd92afef6c6c2157952. Verify qt1/Strategy.sol SHA256 c68887cff61180e12ba2b1ceb333edf76a830f91f63b5d775a8806fb9ec08aca. Preserve upstream bytes in compact credited text envelopes. Include licenses and URL/SHA256 inventory ",
            "task2": "reference/sources.json; keep source bundle below 8 MiB.\nImplement offline python3 reference/materialize.py --out scratch/reference, producing taylor/, qt1/, twocomp/, combo/, numba/ and tools/ with verified originals. No network on materialization. Implement gatep.py --reference scratch/reference/taylor --cache scratch/cache/gatep: verify all Taylor inputs every invocation; execute unmodified gates.py once, compare all 12 values with upstream README, atomically cache successful stdout by commit and full Python version plus input digest; reject tampering, timeouts and failed output even on cache hits. Use a lock for concurrent calls. Default user cache is ~/.cache/imd-amm/gatep; tests explicitly use scratch.\nAdd offline tests and docs/reference.md. Write docs/contracts.md fixing ammfast.run(seed,policy,head_params=None) -> {seed:int,edge:float}, run_batch(seeds,policy,head_params=None) -> ordered rows; policy IDs qt1-ref, TwoComp, ",
            "task3": "COMBO; bank JSON {_credit,backend,policy,provenance,rows:[{seed,edge}]} with 6-decimal edge strings, engine rows also after_swap_peak_gas:int. README inventories planned pieces and honestly marks pending ones; no guessed final URLs. Credit Taylor (gtmcknight), solved-policy research, amm-sim@4812a6382311624e1506aca131ca35c378f930d9 in every file header (JSON: first _credit field; immutable originals: credited text envelopes). Before expensive work benchmark a tiny representative workload; cap this item at 55 minutes, each command at 480 seconds, and checkpoint/resume. Runtime state stays under scratch/; never inspect host files, configuration or identifiers. Do not run engine seeds outside 9700000..9700511 or tune policies. Change only your scope. Result: paths, exact commands, measured timings, hashes, passed/failed checks, missing work and a resume command; no unsupported success claims."
          },
          "scope": [
            "reference/**",
            "gatep.py",
            "docs/contracts.md",
            "docs/reference.md",
            "tests/test_gatep.py",
            "README.md"
          ]
        },
        {
          "key": "bootstrap",
          "vars": {
            "task": "Build setup_fast.sh and bootstrap/. Starting harness: https://raw.githubusercontent.com/identity-md-launches/goal-3170-beat-network-s-amm-entry/4eb3e985fd31e3cd17832501b95b6d2491aca73d/tools/setup.sh and tools/README.md at that commit. Engine checkout pinned there is benedictbrady/amm-challenge@6b6921f8d463314aa7c96234e1be25a25245f704. Verify the pin.\nProvide one-command setup with explicit --platform linux-x86_64 or macos-arm64, --replica-only, --cache PATH and --offline. macOS supports replica only. Use CPython 3.12 and compatible pinned numpy/numba/llvmlite wheels. Linux engine uses the supplied prebuilt release amm_sim_rs post1 abi3 wheel, its matching Python harness, Solidity compiler and dependencies; no Rust, maturin, source builds, latest URLs or hidden package-manager downloads. Derive and pin SHA256 of EVERY downloaded byte, including transitive wheels, Python/bootstrap archives, harness and solc. Validate hashes before use ",
            "task2": "and cache reuse. Put dependency/configuration files in this initial wave under bootstrap/; no unneeded package files.\nThe generated installer defaults its reusable user cache to $HOME/.cache/imd-amm, but ALL item execution/tests pass --cache scratch/cache; venv, extraction, temporary files and compilation state under scratch/. Expose scratch/env.sh and document interpreter and engine checkout locations in docs/setup.md. Engine preparation must not consume default engine test seeds; any actual engine smoke uses only 9700000. Setup must stand alone without unmerged sibling files.\nPrint cold/cached setup time; bound transfers, write cache atomically and diagnose offline misses. Include meaningful tests for hash mismatch, missing cache, cached offline rerun and platform/mode refusal. Test Linux cold/warm setup and actual imports, with bounded seeded workload after minimum bootstrap. Verify macOS artifact availability/hashes and test ",
            "task3": "platform selection; do not claim macOS execution without it. Create .gitignore now for scratch/ and Python caches. Result must give versions, exact download URLs/hashes, benchmark costs and next-wave usage. Credit Taylor (gtmcknight), solved-policy research, amm-sim@4812a6382311624e1506aca131ca35c378f930d9 in every file header (JSON: first _credit field; immutable originals: credited text envelopes). Before expensive work benchmark a tiny representative workload; cap this item at 55 minutes, each command at 480 seconds, and checkpoint/resume. Runtime state stays under scratch/; never inspect host files, configuration or identifiers. Do not run engine seeds outside 9700000..9700511 or tune policies. Change only your scope. Result: paths, exact commands, measured timings, hashes, passed/failed checks, missing work and a resume command; no unsupported success claims."
          },
          "scope": [
            "setup_fast.sh",
            "bootstrap/**",
            ".gitignore",
            "tests/test_setup_fast.py",
            "docs/setup.md"
          ]
        }
      ],
      "output": {
        "format": "markdown",
        "maxBytes": 16000
      },
      "merge": {
        "groupSize": 5,
        "brief": "Summarize each component's paths, immutable pins, APIs, measured timings, checks and unresolved blockers. Keep their reported evidence distinct; this summary does not certify unrun integration."
      }
    },
    {
      "name": "e01-foundation-check",
      "mode": "code",
      "brief": "Read-only audit of the merged e01-foundation code wave; no repository edits. If either component failed to land, report the exact absent paths and stop rather than substitute sources. Validate reference/materialize.py, gatep.py, setup_fast.sh, source and dependency pins, docs/contracts.md, docs/setup.md and attribution.\nBenchmark one replica seed or a small import workload first, cap the item at 55 minutes and every command at 480 seconds; checkpoints and ALL runtime/cache state under scratch/, with installer --cache scratch/cache. Do not inspect host configuration or identifiers. Run the documented installer on Linux, materialize references with network disabled, verify original qt1 SHA256 c68887cff61180e12ba2b1ceb333edf76a830f91f63b5d775a8806fb9ec08aca and numba decoded-bundle SHA256 a5d32e4c06dc93881821d568d8d89ca50adfdba56d5dccd92afef6c6c2157952, and all Taylor input hashes. Run gates once and prove its next invocation is cached; test tampering and failure-cache behavior on scratch copies. Check warm offline install, pinned transitive downloads, no Rust and no unverified downloads. Run shipped tests. Only engine smoke seed 9700000 is permitted here; never other engine seeds or default benchmark commands. Treat missing dependencies as failures, not reasons to weaken checks.\nResult must cite the inspected trunk commit; each command with exit/result and elapsed time; all 12 gate values and comparison; cache-hit evidence; exact blockers with source path/line and suggested next scopes; Linux execution versus macOS availability-only evidence; measured costs to size later replica parity and engine-bank work. Do not implement ammfast, score.py or baselines in this audit. Credit Taylor (gtmcknight), amm-sim@4812a6382311624e1506aca131ca35c378f930d9, in the report header.",
      "items": [
        {
          "key": "audit",
          "vars": {},
          "scope": []
        }
      ],
      "output": {
        "format": "markdown",
        "maxBytes": 16000
      },
      "merge": {
        "groupSize": 2,
        "brief": "Preserve inspected trunk commit, commands, measured checks and all failures. Do not turn missing evidence into passes."
      }
    }
  ],
  "read": [
    "e01-foundation/reference-gate",
    "e01-foundation/bootstrap",
    "e01-foundation-check/audit"
  ],
  "cancel": [],
  "wake": {
    "batches": [
      "e01-foundation",
      "e01-foundation-check"
    ],
    "afterMinutes": 1440
  },
  "finish": false
}
