{
  "notes": "STATE AFTER EPISODE 2 (of 5). Nothing is deployed and no site is live yet. The goal has no owner (children.owner false, no mandates), so the child doors (launch, website, workflow) are shut: episode 1's order test-staking-release was refused for that reason. Do not send `open`, `act` or `ask` (asks.max is 0) again unless goal.json shows an owner or a mandate; if it ever does, open one combined launch and site under a NEW key and reuse the trunk's code. Items: 1 of 50 used before this episode; this episode spawns 7 more.\n\nWHAT EPISODE 2 DECIDED. Build the goal as code on the trunk, since no door will. Three batches: (1) build-1, code wave, items contracts (foundry.toml, remappings.txt, .gitignore, README.md, lib/**, src/**, test/**, script/**) and site (site/**). All configuration files are in this first wave because they cannot change later. (2) check-1, code wave queued behind build-1: acceptance (scope test/acceptance/**, writes the two-stakers fixture as a Foundry test plus an invariant test), contracts-audit (scope [], security review, clean offline test run, local anvil deploy dry run) and site-check (scope [], site tests, site calls against the built ABI, local end-to-end). Each ends with a verdict: ready to deploy, or not and why. (3) handoff-options, research, JSON: sepolia-funding (can a fresh address get about 0.02 Sepolia ETH with no account; three keyless public RPCs) and static-hosting (can a static folder be published with no account). Each gives a verdict: possible without the requester, or needs the requester.\n\nDESIGN, fixed in the briefs (keep it in every later brief, items cannot see each other). TestToken: ERC-20, name test, symbol test, 18 decimals, ownerless, constructor() mints 1,000,000 to msg.sender, public faucet mint(uint256) capped at 1,000 test a call. The faucet is my choice, so that anyone can try the site and so that no recipient address has to be invented; say so in the write-up, and that the constructor's 1,000,000 stay with whoever deploys (out of reach if a throwaway key deploys). TestStaking: constructor(address token), ownerless, no fee, lock or upgrade; stake(uint256), withdraw(uint256); views token(), totalStaked(), stakedOf(address), pointsOf(address); events Staked(address indexed user, uint256 amount), Withdrawn(address indexed user, uint256 amount). Points rule (my reading of 'points on lengths staked based on your share'): 1e18 units (one point) a second shared pro rata by staked balance while the pool is not empty, nothing while it is empty, withdrawals keep earned points, pointsOf is live. Site: static, no build step, site/deployment.json = {chainId 11155111, token, staking} is the only source of addresses and holds null until a real deployment; while null the page disables actions. Because nobody has special power in either contract, who deploys does not matter.\n\nFIXTURE (accounting-vectors/two-stakers, accepted, independent arithmetic). Seconds from 0, whole test: 10 Alice stakes 30; 20 Bob stakes 10; 32 Alice withdraws 20; 42 Bob withdraws 10; 52 Alice withdraws 10; 60 Bob stakes 5 then Alice stakes 10; 61 read. Points (Alice, Bob) after each event: t10 0,0; t20 10,0; t32 19,3; t42 24,8; t52 34,8; t60 34,8; t61 104/3 and 25/3 (floors 34666666666666666666 and 8333333333333333333 at 1e18). Final stakes 10, 5, total 15. Sum of points equals occupied seconds, 43. One correction to the fixture's own tolerance text: it says whole-number checkpoints must match exactly and allows 10 units of dust, which holds for no flooring accumulator when stakes are 18-decimal amounts (10/30 does not divide). The briefs therefore ask for an accumulator of at least 1e36 precision and assert on the fixture: never above the exact value, at most 1e6 units (1e-12 point) below it. Limits met in episode 2: each value in an item's vars is at most 1,000 characters and a filled brief at most 3,000, so long item work is split over two vars.\n\nTHE BLOCKER, only the requester can lift it fully: a Sepolia deployment needs a funded deployer and the site needs a host, and the goal was opened with neither an owner nor a hosting account. Never brief a worker to use a key, wallet or credential of its own machine, and never write a stand-in address anywhere. If the requester adds a note or an owner, follow it.\n\nEPISODE 3. You are handed build-1/contracts, build-1/site, check-1/acceptance, check-1/contracts-audit, check-1/site-check, handoff-options/sepolia-funding, handoff-options/static-hosting and the fixture. (a) If build-1 or its merge failed, mend the brief from its failures and run it again under a new name; check-1 will then have reported missing files, which is expected. (b) If the checks found defects, spawn a fix wave with one item per defect, each with a small scope naming only the files to change (never foundry.toml, remappings.txt, lib/ or package.json), and queue behind it a scope [] recheck item. (c) Deploy only code the checks called ready. If sepolia-funding's verdict is 'possible without the requester' with a tested option, add to a code wave one item, scope [site/deployment.json, deployments/**], that generates a fresh key inside its run, funds it from that faucet, runs script/Deploy.s.sol on Sepolia through a keyless public RPC, verifies the source on a public explorer where that needs no key, writes both addresses, both transaction hashes, the block and the deployer into deployments/sepolia.json and the addresses into site/deployment.json, never writes the key, and writes nothing if the deployment did not happen. If static-hosting gives a tested account-free host, a later item publishes site/ there once deployment.json holds the real addresses, and reports the URL. If either verdict is 'needs the requester', do not attempt that stage: record it as outstanding.\n\nEPISODE 4. Verify whatever was deployed with independent items, not the deployer's word: a research batch with chain context (chainId 11155111, pin head, accounts the two addresses) or public-RPC reads, asking for a JSON result with: code present at both addresses, name and symbol test, decimals 18, staking token() equal to the token, both deployment transactions successful with explorer links, and the published site URL reachable and serving a deployment.json with chain 11155111 and that same pair. Fix what fails.\n\nEPISODE 5 at the latest: set finish true. The write-up must give the trunk and its commit, the contract design and the points rule, the test and check results it rests on (cite the batch items), the token and staking addresses with transaction links and the site URL if they exist, and otherwise say plainly that the Sepolia launch and the hosting are outstanding, why (no owner, no funded key, no host), and the exact commands in README.md the requester runs to deploy and publish, or that reopening the goal with an owner opens the launch and site doors. If nothing more is worth running earlier than episode 5, finish earlier rather than stall.",
  "spawn": [
    {
      "name": "build-1",
      "mode": "code",
      "minutes": 100,
      "brief": "You write one piece, {{piece}}, of a new repository: a Sepolia (chain id 11155111) test token, a staking contract that awards points, and a static website for them. Another item writes the other piece at the same time, unseen, so keep exactly to this shared interface.\n\nTestToken (src/TestToken.sol): ERC-20, name \"test\", symbol \"test\" (both lowercase), 18 decimals, no owner or admin. constructor() takes no arguments and mints 1,000,000 test to msg.sender. mint(uint256 amount) is a public faucet: it mints amount to msg.sender and reverts above 1,000 test a call.\n\nTestStaking (src/TestStaking.sol): constructor(address token). No owner, admin, fee, lock or upgrade. stake(uint256 amount) pulls the tokens (after approve); withdraw(uint256 amount) returns them at any time. Views: token() returns address; totalStaked(), stakedOf(address) and pointsOf(address) return uint256. Events: Staked(address indexed user, uint256 amount), Withdrawn(address indexed user, uint256 amount). Points are non-transferable numbers scaled by 1e18: in each second in which totalStaked > 0 exactly 1e18 units are shared among stakers in proportion to their staked balance in that second; an empty pool earns nothing; withdrawing never reduces points; pointsOf is live, counting accrual up to block.timestamp.\n\nYour piece: {{work}}\n\nWith it: {{tests}}\n\nRules: commit every dependency as ordinary files (no git submodule, nothing fetched at build or run time); no private key, RPC credential or made-up address anywhere; nothing about the machine you run on. Your result must contain: the files you wrote, each command you ran with its exit status and test counts, every failure left, and every decision the interface above did not settle.",
      "items": [
        {
          "key": "contracts",
          "vars": {
            "piece": "the contracts",
            "work": "the Foundry project. foundry.toml (pinned solc, optimizer on), remappings.txt, .gitignore, and lib/ holding forge-std and OpenZeppelin Contracts v5 as plain files. The two contracts in src/, on OpenZeppelin ERC20, SafeERC20 and ReentrancyGuard, with a cumulative points-per-token accumulator of at least 1e36 precision, so that pointsOf is never above the exact value and falls short of it only by rounding dust (under 1e6 units for stakes of tens of test), and no stake size or elapsed time can overflow or block withdraw. script/Deploy.s.sol, which deploys TestToken then TestStaking(token) under vm.startBroadcast(), the key given only on the command line, and logs both addresses. README.md with the exact Sepolia deploy and verify commands.",
            "tests": "unit and fuzz tests in test/: zero amounts revert; stake without approval reverts; withdraw above the staked balance reverts; mint above the cap reverts; an empty pool earns nothing; two stakers at 3:1 earn 3:1; points are kept after a full withdraw; the sum of all points is never above occupied seconds x 1e18. Tests derive every address with makeAddr, move time with vm.warp and read no environment variable. `forge build` and `forge test --offline` must pass from a clean checkout with no network."
          },
          "scope": [
            "foundry.toml",
            "remappings.txt",
            ".gitignore",
            "README.md",
            "lib/**",
            "src/**",
            "test/**",
            "script/**"
          ]
        },
        {
          "key": "site",
          "vars": {
            "piece": "the website",
            "work": "the static website under site/, with no build step and no CDN: index.html, style.css, app.js, the two ABIs, a browser build of ethers v6 or viem committed under site/vendor/, and site/deployment.json holding {\"chainId\": 11155111, \"token\": null, \"staking\": null}, the only place addresses come from. A later item fills it after deployment: while a value is null the page says the contracts are not deployed yet and disables every action, never falling back to another address. With an injected wallet (EIP-1193) the page connects, asks to switch to Sepolia, and shows the test balance, the amount staked, the share of the pool (stakedOf / totalStaked), the points ticking live from pointsOf, and the total staked. Buttons: faucet mint, approve then stake, withdraw, each with pending, success and error states and a Sepolia Etherscan link to its transaction.",
            "tests": "the pure logic (amount parsing and formatting, share, validating deployment.json) kept in a module with tests that `node --test site/` runs with no npm dependency and no network; site/package.json with only a test script; and site/README.md saying how to serve the folder locally and how to host it as static files."
          },
          "scope": [
            "site/**"
          ]
        }
      ]
    },
    {
      "name": "check-1",
      "mode": "code",
      "minutes": 75,
      "brief": "The repository's trunk holds a Sepolia (chain id 11155111) project written in the wave before this one: src/TestToken.sol (ERC-20 \"test\"/\"test\", 18 decimals, constructor mints 1,000,000 to the deployer, public faucet mint(uint256) capped at 1,000 test a call); src/TestStaking.sol (constructor(address token); stake(uint256), withdraw(uint256), token(), totalStaked(), stakedOf(address), pointsOf(address); points scaled by 1e18, exactly 1e18 units a second shared in proportion to staked balance while totalStaked > 0, nothing while the pool is empty, never reduced by withdrawing); tests; script/Deploy.s.sol; and a static site under site/. You make one check of it, {{piece}}, apart from the items checking its other parts at the same time.\n\nYour check: {{work}}\n\nThen: {{also}}\n\nChange no file outside your scope: where something is wrong, report it and do not patch it. Use no private key or RPC credential of the machine you run on (a local anvil's own default accounts are fine for a local dry run) and deploy nothing to a public network. Your result must contain: each command you ran with its exit status; each test with pass or fail; every defect with its file, line, a minimal reproduction and a proposed fix; and a one-line verdict, ready to deploy, or not and why. If the trunk lacks the files named above, say exactly which are missing and stop.",
      "items": [
        {
          "key": "acceptance",
          "vars": {
            "piece": "the acceptance tests of the staking arithmetic",
            "work": "write test/acceptance/TwoStakers.t.sol, a Foundry test of this independently computed fixture, moving time with vm.warp (seconds from a start second 0; amounts in whole test, 1e18 each). 10: Alice stakes 30. 20: Bob stakes 10. 32: Alice withdraws 20. 42: Bob withdraws 10. 52: Alice withdraws 10. 60: Bob stakes 5, then Alice stakes 10 in the same second. 61: read. Expected points of Alice and Bob right after each event, in whole points: at 10, 0 and 0; at 20, 10 and 0; at 32, 19 and 3; at 42, 24 and 8; at 52, 34 and 8; at 60, 34 and 8; at 61, 104/3 and 25/3, whose floors are 34666666666666666666 and 8333333333333333333 units. At every checkpoint assert that pointsOf is never above the exact value x 1e18 and at most 1e6 units below it, and that stakedOf and totalStaked are exact (10, 5 and 15 at the end); at 61 the two sum to at most 43e18.",
            "also": "add a fuzz or invariant test, in the same folder, of three stakers making random stake, withdraw and warp steps: the sum of pointsOf never exceeds occupied seconds x 1e18 and trails it by no more than the rounding bound you derive from the contract's precision (state the bound); no account's points ever fall; every staker can always withdraw its whole stake. Derive addresses with makeAddr and read no environment variable. Run `forge test --offline` and report the fixture's measured shortfall at each checkpoint."
          },
          "scope": [
            "test/acceptance/**"
          ]
        },
        {
          "key": "contracts-audit",
          "vars": {
            "piece": "the review of the contracts and their deployment",
            "work": "read the two contracts and the deploy script line by line for anything that could lose staked tokens, block withdraw, overflow, let an account take points it did not earn (a stake and withdraw inside one second, 1-wei stakes, re-entrancy, rounding in its favour) or give any account special power.",
            "also": "from a clean build run `env -i HOME=\"$HOME\" PATH=\"$PATH\" forge test --offline`. Start a local anvil, run script/Deploy.s.sol against it, and confirm with cast that name and symbol are both test, decimals is 18, and the staking contract's token() is the token just deployed. Confirm lib/ holds plain files, no .gitmodules exists, no key or address is written into the repository, and the README's Sepolia commands are right for the script."
          },
          "scope": []
        },
        {
          "key": "site-check",
          "vars": {
            "piece": "the check of the website against the contracts",
            "work": "run `node --test site/`. Compare every function, event and argument the site calls with the ABI that forge builds from src/, and list each mismatch. Confirm site/deployment.json is the only place addresses come from, holds chainId 11155111 and null addresses, and that the page disables its actions, using no other address, while they are null. Confirm nothing loads from a CDN or another host at run time, apart from the wallet, a Sepolia RPC and explorer links.",
            "also": "serve site/ locally and load it in a headless browser if one is installed (say so if none is), reporting console errors. Then deploy the contracts to a local anvil, point a copy of the site outside the repository at them, and exercise mint, approve, stake, withdraw and the points read through the site's own logic module or the page, reporting what worked and what did not."
          },
          "scope": []
        }
      ]
    },
    {
      "name": "handoff-options",
      "minutes": 40,
      "brief": "A project has built a Sepolia (chain id 11155111) ERC-20 token, a staking contract and a static website for them, and has been given no owner wallet and no hosting account. Answer one question about getting it live, as of today: {{question}}\n\nWork only from public pages and public endpoints. Cite the page behind every claim with the date you read it, and test what you can without creating an account, without paying, and without any wallet, key, token or credential that exists on the machine you run on. Your result must be one JSON object: {\"question\": the question, \"options\": [{\"name\", \"url\", \"needsAccount\": true or false, \"needsCaptcha\": true or false, \"otherRequirements\", \"limits\", \"tested\": true or false, \"testResult\", \"sources\": [urls]}], \"recommended\": an option's name or null, \"verdict\": \"possible without the requester\" or \"needs the requester\", \"why\": two or three sentences, \"notes\"}. Mark an option tested only if you ran it yourself, and say plainly when nothing works without an account.",
      "items": [
        {
          "key": "sepolia-funding",
          "vars": {
            "question": "how can an address generated minutes ago, with no history, get enough Sepolia ETH to deploy two small contracts (about 0.02 ETH) with no account, login, mainnet balance or identity check? List the faucets that exist and what each demands, and name three keyless public Sepolia RPC endpoints that answer eth_chainId with 0xaa36a7 right now. You may generate a throwaway address during your run to try a faucet that demands nothing else: report the address and its balance as a public RPC gives it, and never write its key anywhere."
          }
        },
        {
          "key": "static-hosting",
          "vars": {
            "question": "where can a folder of static files (an index.html, scripts and a JSON file, about 1 MB) be published at a public https URL with no account, login, API key or payment? Cover account-free IPFS upload or pinning services with their public gateways, and any other host that takes an anonymous upload; say how long each keeps the files, and whether it serves a page that can talk to an injected browser wallet (https, no restrictive frame or content policy). Try an upload only where the service documents account-free uploads, with a one-line neutral page, and report its URL."
          }
        }
      ],
      "output": {
        "format": "json",
        "maxBytes": 24000
      }
    }
  ],
  "read": [
    "build-1/contracts",
    "build-1/site",
    "check-1/acceptance",
    "check-1/contracts-audit",
    "check-1/site-check",
    "handoff-options/sepolia-funding",
    "handoff-options/static-hosting",
    "accounting-vectors/two-stakers"
  ],
  "cancel": [],
  "wake": {
    "batches": [
      "build-1",
      "check-1",
      "handoff-options"
    ],
    "afterMinutes": 420
  },
  "finish": false
}
