{
  "notes": "EPISODE 3 STATE AND REPAIR. Read .imd/reads/goal.json and the one handed result accounting-vectors/two-stakers (input b01-two-stakers, SHA-256 a41d5e5952c5ce18fe050b8b45ef33ca5349a946d9845ea5d957fb02a841c9b4). The actual state overrides episode 2's proposed plan: trunk is null; only accounting-vectors exists and its one item is accepted. build-1, check-1 and handoff-options were all REFUSED because their briefs were judged to ask about the worker's execution machine; they never ran, and their requested reads/wakes were consequently invalid. The precise offending wording is unavailable. This episode replaces those briefs with product implementation, project checks and public-source research only. No existing batch needs cancellation. Do not read or cancel the nonexistent refused batches, and do not use itemsFrom on them.\n\nBUDGET AND CAPABILITIES. Before this decision, 1/50 items used; 49 remain. This requests 8 items, bringing usage to 9/50 if all spawns are accepted and leaving 41. Episodes 4 and 5 remain. children.owner is false, children.list is empty, mandates is empty, asks.max is 0, requester notes are empty, and effects.pending is 0. There is no deployment, site URL, authorized funded deployer or hosting destination in the supplied state. No open/act/ask/watch is requested. Nothing was fabricated. The absence of launch inputs does not prevent building, testing or packaging the application.\n\nPLAN REQUESTED, NOT YET COMPLETED. sepolia-core-e3 is a two-item code wave: contracts writes self-contained token/staking source, tests and actual compiled ABI/bytecode; site writes a static application and null deployment record. Scopes are disjoint. sepolia-assembly-e3 is the next code wave: accounting-tests adds an independent fixture/invariant suite; wallet-release consumes the merged artifacts to add a requester-operated browser deployment page and publishing guide. sepolia-review-e3 is the third code wave, with two scope [] reviews of contracts and the complete site/release flow. Code waves serialize through trunk merges; no unsupported after dependency is used. sepolia-options-e3 independently researches public faucet/RPC and static-hosting documentation in two items. Each research result distinguishes documented options from completed operations. The wake names the last code wave and the research batch, with a 480-minute asynchronous fallback; this episode does not wait on that timer. If queueing or retries are still active at a fallback wake, inspect their actual status before spending more items.\n\nFIXED APPLICATION CONTRACT. Sepolia chain 11155111. TestToken: ERC-20 name test and symbol test, 18 decimals, ownerless; constructor() mints 1,000,000 * 1e18 to the actual deploying account; public mint(uint256) accepts positive amounts <= 1,000 * 1e18 per call. The faucet and supply are orchestrator design choices for a testnet demo, not requester-specified economics. TestStaking: constructor(address token), immutable binding, no fee/lock/admin/upgrade; stake(uint256), withdraw(uint256), token(), totalStaked(), stakedOf(address), pointsOf(address); Staked/Withdrawn(address indexed user,uint256 amount). One point (1e18 units) per second is shared proportionally among active deposited balances; idle pool time earns zero, withdrawals retain earned points, views accrue live. Use high-precision O(1) accounting with at least 1e36 accumulator precision. Site uses only site/deployment.json={\"chainId\":11155111,\"token\":null,\"staking\":null} for runtime deployment addresses, disables unconfigured actions, and bundles runtime dependencies locally. Root build configuration and lib/ are outside all requested write scopes.\n\nINDEPENDENT FIXTURE PRESERVED. Times relative to an empty baseline, stakes in whole test: t10 Alice +30; t20 Bob +10; t32 Alice -20; t42 Bob -10; t52 Alice -10; t60 Bob +5 then Alice +10 at the same timestamp; t61 read. Exact (Alice,Bob) cumulative points after these events: (0,0),(10,0),(19,3),(24,8),(34,8),(34,8),(34,8),(104/3,25/3). Final stakes 10 and 5, total 15; occupied seconds 43, empty 18. Computed final 1e18 floors: Alice 34666666666666666666, Bob 8333333333333333333, sum 42999999999999999999. The supplied fixture's claim of exact whole checkpoints and 10 units of allowable accumulator dust is not safe for every implementation using 18-decimal token balances. Preserve exact rational expectations, require no surplus and at most 1,000,000 units (1e-12 point) shortfall per user at these checkpoints with the high-precision accumulator. This tolerance is specific to the fixture; general invariant error bounds must be justified. Do not weaken failing tests to pass.\n\nRELEASE BOUNDARY. wallet-release builds an interactive path only. The requester signs in an injected browser wallet on Sepolia, confirms both deployments, and receives downloaded real deployment and transaction records after receipt/code/metadata/token-binding checks. It supports continuing after token-only success. No worker is asked to supply a deployer or fund/broadcast a launch. Until confirmed deployment and a chosen host exist, report not_deployed, null addresses and null publishedUrl. Any absent source, failed compile, missing browser or unreachable public source remains an explicit blocker with attempted project check or URL and error; complete independent work. Compiled artifacts, tests, static site and exact handoff steps remain useful even if live launch inputs never arrive.\n\nEPISODE 4. Read every requested result and actual refusal/batch/trunk state. If a spawn was refused, correct its stated cause under a fresh name; it has no failed items to rerun. If accepted code did not merge, address the merge failure before relying on it. If reviews found defects, use a narrowly scoped repair wave and queue a scope [] recheck wave, waking on the latter. Preserve compiler settings and settled interfaces. If stages did not build, implement the missing source in fresh scoped waves and then review it; do not mistake a nonexistent input for a completed check. Incorporate verified research into the launch guide as needed. Only if new requester/owner information provides a real release route should deployment/publication be scheduled; use available owner-backed doors without naming an invented address, and independently verify any claimed release.\n\nEPISODE 5 / FINISH. Finish when useful work has settled, earlier if nothing else can progress, and by episode 5. Distinguish completion of the handoff from completion of the live-launch goal. A real launch needs independently observed successful Sepolia receipts, nonempty code at both addresses, token test/test/18, staking token() equality, and a reachable HTTPS site whose deployment.json names chain 11155111 and the same pair. Otherwise state explicitly that deployment and/or publication remain outstanding, identify the funded-wallet/hosting inputs and exact README/docs/LAUNCH.md steps, and provide the accepted trunk/commit and deliverable paths. Cite actual batch results and report test failures or skipped checks without claiming success. No current address, transaction, website URL or test result has been invented.",
  "spawn": [
    {
      "name": "sepolia-core-e3",
      "mode": "code",
      "minutes": 55,
      "brief": "Implement ONE component of the Sepolia test staking application: {{work}}\nShared interface: chainId 11155111; token name test, symbol test, decimals 18; mint(uint256). Staking: constructor(address token), stake(uint256), withdraw(uint256), token(), totalStaked(), stakedOf(address), pointsOf(address). Amounts are uint256 token base units; pointsOf returns uint256 with 1e18 units per point. One point per second is split by active stake; empty periods earn nothing; withdrawals preserve points.\n{{requirements}}\n{{validation}}\n{{result}}\nStay within the item scope. Deliver ordinary source files with any required dependencies and licenses; verification must work offline. Keep the committed deliverable under 8 MiB, without caches or node_modules. Do not change project configuration outside the item scope.",
      "output": {
        "format": "json",
        "maxBytes": 18000
      },
      "items": [
        {
          "key": "contracts",
          "scope": [
            "src/TestToken.sol",
            "src/TestStaking.sol",
            "test/contracts/**",
            "contract-artifacts/**",
            "docs/contracts.md"
          ],
          "vars": {
            "work": "the deployable token and staking contract package, its focused tests, and compiled artifacts.",
            "requirements": "TestToken is an ownerless ERC-20: constructor() mints 1,000,000 * 1e18 to msg.sender; public mint(amount) requires 0 < amount <= 1,000 * 1e18 per call. Include standard balance, allowance, transfer and approval behavior/events. TestStaking binds its token immutably, with no fee, lock, administrator or upgrade. Settle accrual before any stake change; use O(1) accounting with at least 1e36 accumulator precision. Emit Staked(address indexed user,uint256 amount) and Withdrawn(address indexed user,uint256 amount). Reject invalid amounts and insufficient stakes, check transfers, and protect external-call state transitions. Use self-contained Solidity and tests with no external Solidity imports; existing build settings stay unchanged.",
            "validation": "Build and run offline-capable Foundry tests for token supply/faucet limits/allowances, proportional time accrual, empty intervals, partial/full withdrawals, restaking, simultaneous events, unauthorized withdrawals, and rounding. Generate contract-artifacts/TestToken.json and TestStaking.json from that actual compilation, each containing abi, creation bytecode, deployed bytecode and compiler metadata. Include a repeatable regeneration command and source/artifact hashes in docs/contracts.md. No fabricated compiled output; record compilation failures explicitly.",
            "result": "Return JSON with component, files, buildCommands, tests (command, expected, actual, pass/fail/not_run), artifactPaths, artifactHashes, designDecisions and blockers. Document the faucet as a testnet design choice and the initial supply recipient as the actual deploying account. This item builds artifacts only; deployment status is not_deployed."
          }
        },
        {
          "key": "site",
          "scope": [
            "site/**"
          ],
          "vars": {
            "work": "the responsive static staking website, independently using the shared contract interface.",
            "requirements": "Create site/index.html and its local assets with a clear test/Sepolia identity and accessible mobile layout. site/deployment.json is runtime data {\"chainId\":11155111,\"token\":null,\"staking\":null}. Validate that record and use it as the only deployment-address source. Show Not deployed yet and disable contract actions while addresses are null/invalid. Connect an injected browser wallet, request Sepolia, handle accountsChanged/chainChanged, and read real token balance, stake, pool share and live points. Implement faucet, exact-amount approval followed by staking only after confirmation, and partial/full withdrawal. Use exact decimal/base-unit conversion, never floating point for amounts. Show pending, success, rejection and revert states with transaction links.",
            "validation": "Test amount parsing, wrong chain, absent/disconnected wallet, null or malformed deployment data, insufficient allowance/balance, pending or rejected transactions, account changes, and refresh after confirmation. Validate contract code and token binding before enabling actions. Explain the points rule and faucet openly. Use plain HTML/CSS/JS with no build step; bundle any runtime library and license locally, with no CDN dependency. Keep deploy.html/deploy.js for a later assembly wave. Include serving instructions in site/README.md and focused runnable tests within site/tests/.",
            "result": "Return JSON with component, files, serveCommand, tests (command, expected, actual, pass/fail/not_run), interfaceUsed, dependencySources and blockers. Clearly label test-only mocks; the shipped default must show no invented balances, addresses or deployment success. Record deploymentStatus not_deployed and publishedUrl null."
          }
        }
      ]
    },
    {
      "name": "sepolia-assembly-e3",
      "mode": "code",
      "minutes": 50,
      "brief": "Complete ONE integration component on the merged Sepolia application trunk: {{work}}\n{{requirements}}\n{{validation}}\n{{result}}\nChange only the item scope. Reuse the existing contracts and static site. Commit any dependencies needed for offline checks as ordinary files, within the 8 MiB bundle limit. Use actual build outputs and mark any unavailable prerequisite explicitly.",
      "output": {
        "format": "json",
        "maxBytes": 20000
      },
      "items": [
        {
          "key": "accounting-tests",
          "scope": [
            "test/acceptance/**"
          ],
          "vars": {
            "work": "an independent executable staking acceptance suite, based on accounting-vectors/two-stakers.",
            "requirements": "Use the actual TestToken/TestStaking contracts with amounts scaled by 1e18. Time is relative to a fresh empty-pool baseline: t10 Alice stakes 30; t20 Bob stakes 10; t32 Alice withdraws 20; t42 Bob withdraws 10; t52 Alice withdraws 10; t60 Bob stakes 5 then Alice stakes 10 at the same timestamp; read at t61. Exact (Alice,Bob) points after events: t10 (0,0), t20 (10,0), t32 (19,3), t42 (24,8), t52 (34,8), both t60 events (34,8), t61 (104/3,25/3). Final stakes (10,5), pool 15; occupied seconds 43, empty seconds 18.",
            "validation": "Compute rational reference values with code and embed the generated fixture in this test folder with provenance. At every checkpoint reported points must be <= floor(exact*1e18), and at most 1,000,000 base units below it per user. Final floors are 34666666666666666666 and 8333333333333333333; summed points must be in [43*1e18-2,000,000,43*1e18]. This is a fixture-specific dust bound, not a general precision guarantee. Add bounded randomized sequences checking monotonic points, sum of stakes, token custody >= totalStaked (including direct donations), conservation within a justified rounding bound, and no retroactive rewards. Keep tests self-contained and executable with existing settings.",
            "result": "Return JSON with fixtureProvenance, files, exactCheckpoints, commands, results (expected, actual, pass/fail/not_run), roundingAnalysis and defects with file references and reproductions. Run the tests against the merged contracts. Preserve tests that expose a defect and report it honestly; do not relax assertions to obtain a pass or alter implementation files."
          }
        },
        {
          "key": "wallet-release",
          "scope": [
            "site/deploy.html",
            "site/deploy.js",
            "site/deploy.css",
            "site/contract-artifacts/**",
            "docs/LAUNCH.md",
            "README.md"
          ],
          "vars": {
            "work": "a requester-operated browser-wallet deployment and static publishing handoff.",
            "requirements": "Consume the actual compiled contract-artifacts/TestToken.json and TestStaking.json, copying required ABI/bytecode to site/contract-artifacts/. Add site/deploy.html with an injected-wallet flow restricted to Sepolia chain 11155111. Present a transaction preview, then deploy TestToken with no arguments and TestStaking with the confirmed token address via wallet prompts. Require a successful receipt and nonempty code after each deployment; verify name/symbol test, decimals 18 and staking token() binding. If token deployment succeeds and staking fails, support resuming with that confirmed token. A successful flow downloads real deployment.json and a deployment record with chain, addresses, transaction hashes, blocks and explorer links.",
            "validation": "Include hash checks linking copied artifacts to compilation. Disable deployment when artifacts are missing or invalid. Handle rejected signatures, failed receipts, chain/account changes and partial progress. Keep public publication steps in docs/LAUNCH.md: serve site/, perform wallet-signed deployment, replace site/deployment.json with the downloaded record, publish that folder to a chosen static host, and verify its URL/configuration. This item supplies the interactive release path and does not broadcast or publish. Document the unresolved funded-Sepolia-wallet and hosting inputs. Keep deployment addresses null until confirmed receipts exist.",
            "result": "Return JSON with files, artifactProvenance, checks (command, expected, actual, pass/fail/not_run), deploymentStatus not_deployed, publishedUrl null, missingInputs, and exact serve/deploy/publish/verify steps. README.md must describe the contract design, points/faucet choices, test commands, current readiness, and paths to the launch guide. Document any missing source/build prerequisite; never generate substitute bytecode, ABI, addresses or receipts."
          }
        }
      ]
    },
    {
      "name": "sepolia-review-e3",
      "mode": "code",
      "minutes": 40,
      "brief": "Independently review ONE part of the merged Sepolia release: {{work}}\n{{requirements}}\n{{validation}}\nThis is a read-only review (scope []). Return JSON with verdict (pass, fail, or not_run), commands, checks (expected, actual and status), findings (severity, file, reproduction and suggested fix), missingInputs, and releaseStatus. A skipped check is not a pass. Distinguish readiness of the code from a live launch; no deployment or published site is established by passing local checks.",
      "output": {
        "format": "json",
        "maxBytes": 24000
      },
      "items": [
        {
          "key": "contracts",
          "scope": [],
          "vars": {
            "work": "contract correctness, security and reproducibility, including the independent acceptance suite.",
            "requirements": "Run the full contract and test/acceptance suites using the documented offline commands, and regenerate ABI/bytecode for comparison with contract-artifacts/. Audit initialization, token name/symbol test and 18 decimals, initial supply/faucet, immutable token binding, allowance/transfer handling, reentrancy, stake ownership, withdrawal availability, timestamp updates, overflow, rounding and conservation. Check no administrative withdrawal, upgrade, fee or lock exists. Read the submitted independent tests rather than treating their existence as a pass.",
            "validation": "Replay all two-staker events and rational checkpoints independently: 10:A+30,20:B+10,32:A-20,42:B-10,52:A-10,60:B+5 then A+10,61:read. Final A/B floor points in 1e18 units are 34666666666666666666/8333333333333333333, stakes 10/5, pool 15, occupied time 43. Per-user shortfall may be at most 1,000,000 units and never a surplus at checkpoints. Review bounded invariant tests and rounding assumptions. If practical, run an isolated local-chain deployment with generated test accounts; local addresses/transactions must be labelled test-only, never Sepolia evidence."
          }
        },
        {
          "key": "site-release",
          "scope": [],
          "vars": {
            "work": "the staking website and its browser-wallet release handoff end to end.",
            "requirements": "Serve the static site and run its tests. Compare all calls, argument encoding and result decoding against compiled ABIs. Exercise connect, chain switch, faucet, approve then stake, partial/full withdraw, balance/share/points refresh, rejected/reverted transactions, account changes and mobile/keyboard usability. Check null/malformed addresses and wrong-chain states disable transactions. Verify site dependencies are local and data are never presented as live without contract reads. Compare copied deployment bytecode/ABI to actual build artifacts.",
            "validation": "Exercise deploy.html with an isolated local chain or a deterministic wallet harness: successful token then staking deployment, both failed/rejected paths, account/chain changes, token-only recovery, code/metadata/binding verification and downloaded runtime configuration. Mark mocks and local receipts test-only. Verify the download cannot report success from a failed receipt. Follow README.md and docs/LAUNCH.md for a fresh static serve and reproducible owner handoff. Report browser checks not run separately; inspect all available code and execute other checks even if a browser prerequisite is absent."
          }
        }
      ]
    },
    {
      "name": "sepolia-options-e3",
      "mode": "research",
      "minutes": 20,
      "brief": "Research ONE public release prerequisite for the test token staking application: {{work}}\n{{requirements}}\nUse public primary documentation and read-only HTTP/RPC requests. Return JSON with scope, checkedAt, options (name, URL, source evidence, requirements, limits, observed check results), recommendation, requesterAction, and unresolved. Distinguish documented availability from an actually completed operation. If a source fails, record its URL, time and error and use other verifiable sources. Do not claim that the application is deployed, funded or published from documentation alone.",
      "output": {
        "format": "json",
        "maxBytes": 18000
      },
      "items": [
        {
          "key": "funding",
          "vars": {
            "work": "the requester steps to obtain Sepolia gas and select a public RPC for browser-wallet deployment.",
            "requirements": "Identify up to three documented Sepolia faucets and two public RPC options. For faucets, cite eligibility, account/sign-in or CAPTCHA requirements, limits and any stated wait; mark undocumented values unknown. For RPCs, execute eth_chainId and confirm 11155111, recording the request and response. Recommend the simplest verified documentation path for a requester-controlled wallet and identify what still needs their action. Reading documentation and checking RPC chain IDs is sufficient: no faucet claim, wallet generation or transaction is part of this item."
          }
        },
        {
          "key": "hosting",
          "vars": {
            "work": "a durable HTTPS static hosting path for a folder containing HTML, JS and deployment.json.",
            "requirements": "Compare up to three public hosting services using official documentation. Determine account/repository requirements, free-tier constraints, HTTPS, relative-asset support, JSON MIME type, update/rollback steps and persistence. Prefer a well-documented simple upload or repository deployment path and explicitly check whether any durable account-free option is documented. Give exact requester steps to publish site/ after replacing its runtime deployment record, then verify index.html and deployment.json at the same origin. This item researches publication and does not create accounts, upload content or claim a live URL."
          }
        }
      ]
    }
  ],
  "read": [
    "sepolia-core-e3/contracts",
    "sepolia-core-e3/site",
    "sepolia-assembly-e3/accounting-tests",
    "sepolia-assembly-e3/wallet-release",
    "sepolia-review-e3/contracts",
    "sepolia-review-e3/site-release",
    "sepolia-options-e3/funding",
    "sepolia-options-e3/hosting",
    "accounting-vectors/two-stakers"
  ],
  "cancel": [],
  "wake": {
    "batches": [
      "sepolia-review-e3",
      "sepolia-options-e3"
    ],
    "afterMinutes": 480
  },
  "finish": false
}
