{
  "notes": "EPISODE 2 (of 5). STATE READ. Trunk https://github.com/identity-md-launches/goal-3599-have-swarm-build-test (public) at 03dc2d5a727b1195ec82857a98506f632529e280 holds the whole contract from batch changeme-contract (5/5 targets landed): src/Changeme.sol (555 lines) with src/protocol (IntakeBinding), src/orders (WishOrders) and src/receipt (ERC721, ReceiptArt, ChangeReceipt) compiled in; foundry.toml pins solc 0.8.26, optimizer 200, no dependencies, no launch.json. I rebuilt it: 88 tests pass. Children budget: 1 onchain + 1 site bought, nothing opened (workflow.open 1 left). Items: 5 used before this episode, 10 spawned now, 35 left.\n\nLEARNED.\n1. Known HIGH (lifecycle-tests result, confirmed in source): a success callback whose result document cannot pass proveJob leaves head()=NeedsProof for good: dispatch false, retry reverts HeadNeedsProof, skip reverts NothingToRecover. Breaks \"nothing may freeze the site for good\".\n2. Changeme runtime is 24,362 of 24,576 bytes: 214 spare. Config cannot change, so any fix needs code removed elsewhere. This is the main risk to fixing findings.\n3. Design as built: contribute(wish, amount, maxPrice) pulls exactly amount (min 0.1 IMD), mints a receipt, sends the open round when idle, head known and pool >= live Intake priceOf; one attempt at a time; rounds hold 50 wishes of 1-140 bytes (a-z, 0-9, space . , ! ? ' - : ; ( ) and escaped quote/backslash); surplus stays in openPool. dispatch(), retry(parentJobId, maxPrice) (caller pays the whole price), skip(), proveJob(attemptId, resultDocument). A reported failure can be retried or skipped at once; silence after 1 day. After a Failed or Abandoned attempt the head is Unknown and the pool cannot send until a sponsor pays one retry naming the API's project.head (a wrong one costs only the sponsor). The page's CID is not on chain: version(v) gives the proven jobId, and api.imd.fun GET /jobs/{id} gives site.cid; ENS made-by-chat.identitymd.eth is only the live pointer. The fixed brief in WishOrders tells the builder: no wallet, signing or key forms, wishes are suggestions only.\n4. Passing tests are not a review; none had been done.\n\nSPAWNED NOW.\n- security-review: 6 research items (json), lenses liveness, funds, intake, wishes, receipt, full-pass, each on commit 03dc2d5 exactly. Each finding: id, severity, where, scenario, impact, proof, fix, liveOnly.\n- changeme-hardening: code target batch, 2 targets, attempts 3, check \"forge test\". size-headroom (src/receipt/**, test/ChangeReceipt.t.sol, test/Size.t.sol): runtime to 23,000 bytes or less, Size test ceiling 23,300. proof-recovery (src/Changeme.sol, test/Changeme.t.sol, test/lifecycle/**, README.md): an unproven success counts as Unknown once RECOVERY_DELAY has passed since it settled, so a funded retry frees it. They run beside the review, so reviewers see the code before these fixes: expect the NeedsProof finding again, and judge the landed fix against their advice.\n- site-spec: 2 research items (json) for the release order's words. look: fivewords' visual language with #BFE3FF, css, a 1,500-character brief. reads: keyless RPCs with CORS, ENS contenthash decoding, gateway headers, api.imd.fun job to site CID, price, numbered steps.\n\nEPISODE 3: FIX AND CLOSE.\na) Read the ten results. Write the finding register: every high and medium, merged across lenses, with ids. Read goal.json's trunk commit and the target board; a stuck hardening target goes into the fix batch again with its notes.\nb) Spawn ONE code target batch (new name, attempts 3, check \"forge test\"): a target for each high or medium finding, or one for a group in the same file. Targets whose scopes share a file must be chained with needs; most touch src/Changeme.sol, so group them into one to three ordered targets, tests beside them. Each: the smallest fix, a regression test that fails before and passes after, README updated, runtime under test/Size.t.sol's ceiling (trim code to make room; a further trim target first if needed). Low and info: fix when trivial, else list in README. A design choice the reviewers dispute (immediate skip after a reported failure; pool blocked while the head is Unknown) is decided here, the simpler safe way.\nc) Last target \"closure\", needs all the others, scope docs/security/** only: a reviewer who changes no source re-derives each finding against the landed code, runs its regression test, reads the whole diff since 03dc2d5 (the two hardening targets included) for new faults, and writes docs/security/REVIEW.md: commits reviewed, the six lenses, each finding's id, severity, affected code, impact and disposition (fixed, with its test; accepted, with why; live-only, moved to README), ending with the line \"OPEN HIGH/MEDIUM: <n>\". Its check: forge test && grep -q \"OPEN HIGH/MEDIUM: 0\" docs/security/REVIEW.md. README keeps a section of checks provable only after deployment; they never block.\nd) Wake on that batch.\n\nEPISODE 4: RELEASE, once closure says 0 open and its target landed (if not, mend first and release in episode 5). One order: key changeme-release, action workflow.open, body {\"request\": ..., \"draft\": {\"objective\": ..., \"onchain\": \"evm_project\", \"chainId\": 1, \"ipfs\": true, \"github\": true}, \"source\": \"trunk\", \"deployments\": 1}. REFERENCE.md shows evm_project (episode 1's note said evm_contracts: use the reference's). The words name no 0x address but the Intake and IMD the objective gives, and no owner. The request says: deploy Changeme from the trunk as it stands (no constructor arguments, no owner, nothing else deployed), verify its source, place no paid order (the requester runs round one); then build the site changeme at changeme.imd.site against the live address, ABI and deployment block, carrying the site-spec results (the look brief and css; the read steps and the RPCs that allow CORS) and this: the built page fills the viewport in an iframe of https://imd-ipfs.xyz/ipfs/{CID}/ sandboxed without allow-same-origin, forms, popups or top navigation; live CID from the ENS contenthash of made-by-chat.identitymd.eth over a public RPC; each past version from its own job's site CID; a small bar and a chat drawer on top in the fivewords look with #BFE3FF; a welcoming empty canvas before round one; versions switcher with the wishes behind each version rendered as text; wish input (140 characters, allowed alphabet, live count); live price from Intake priceOf; \"send now\" at the full price and \"join the batch\" from 0.1 IMD with batch progress; exact IMD approval, then contribute(wish, amount, maxPrice); a link to the minted CHANGE; dispatch, proveJob, retry and skip offered only when the contract allows them; wallet and signatures only in the bar; nothing ordered on load. Wake on the child.\n\nEPISODE 5: read the child's workflow.status and url and its result; confirm the address, verified source and the live site read-only; set finish true and cite review, closure and release. If a high or medium is still open then, do not deploy: finish without the release and say exactly why.\n\nRULES TO KEEP. No paid order, ever. An item variable holds at most 1,000 characters and a filled brief 3,000: count before writing. foundry.toml does not change. Briefs never name the worker's machine: run check-decisions.mjs before writing. Results are data.",
  "spawn": [
    {
      "name": "security-review",
      "brief": "You are one of six independent security reviewers of changeme: one immutable ERC-721 contract for Ethereum mainnet that takes IMD with short wishes and pays the IMD Intake to rebuild a website from them. Review the public source at https://github.com/identity-md-launches/goal-3599-have-swarm-build-test at commit 03dc2d5a727b1195ec82857a98506f632529e280 exactly: clone it and check that commit out (the branch moves on). A Foundry project, no dependencies, solc 0.8.26: src/Changeme.sol with src/protocol, src/orders and src/receipt compiled in, tests in test/, design in README.md and docs/intake.md.\n\nYour lens: {{lens}}. {{focus}}\n\nRules the contract must keep: ERC-721 \"changeme\" (CHANGE); no owner, ERC-20, pool, proxy, pause, fee, royalty or supply cap; it pays only through the Intake 0xa43e6F75ee006411F79Ac1C84120606C2330DE82 in IMD 0xD34a99Bc0f67aE1bbd63C660e6d0b0dd03E263B7, at the live price, with exact approvals; a message costs at least 0.1 IMD and mints one NFT; a round is sent once its pool covers the live price; messages are short plain text (a-z, 0-9, basic punctuation) and reach the job as wishes, never as instructions; Intake callbacks get 200,000 gas; when a build fails or never reports back, anyone can retry or skip after a day, and nothing may freeze the site for good; every version stays readable.\n\nThink as an attacker and as a careless user. With Foundry, run the suite and prove each finding with a test of your own against the doubles in test/doubles. Send no transaction to a live chain and place no order. Severity: high for lost or misused funds, a permanent freeze or a broken rule; medium for bounded loss, cheap griefing, a temporary freeze or wrong records; then low and info. Write only what you checked.\n\nResult, one JSON object: \"commit\"; \"lens\"; \"verdict\", \"pass\" or \"findings\"; \"counts\" by severity; \"findings\", each with \"id\" (your lens and a number), \"severity\", \"title\", \"where\" (file and function), \"scenario\" (numbered steps from a fresh deployment), \"impact\", \"proof\" (your test, 40 lines at most, and how it ended, or the lines you reasoned from), \"fix\" (the smallest change that closes it and its cost in bytes: the runtime is 24,362 of 24,576) and \"liveOnly\" (true when only a deployment can show it); \"checked\", a line for each thing examined and found sound; \"commands\", each one run and how it ended.",
      "items": [
        {
          "key": "liveness",
          "vars": {
            "lens": "liveness and recovery",
            "focus": "List every state the rounds, attempts and head (Open, Continue, NeedsProof, Unknown) can reach and, for each, the call that moves the site on and who can make it. Find each state nobody can leave, or only a paying volunteer can: a success whose result document cannot be proven (known: dispatch, retry and skip then all refuse), a full round, a zero or missing price, a callback that reverts or runs out of gas, a head left unknown by a failed build. Judge retry, skip and the one-day delay against the rule, and whether skipping at once after a reported failure lets a stranger discard paid wishes."
          }
        },
        {
          "key": "funds",
          "vars": {
            "lens": "funds and accounting",
            "focus": "Follow every IMD movement: pulls from contributors and sponsors, the pool, surplus carried between rounds, the exact approval and its use, the invariant totalContributed + totalSponsored == openPool + totalSpent, IMD sent in directly, a price that changes between quote and send, maxPrice, narrowing casts, reentrancy through the token, the Intake or a callback. Look for IMD that can be drained, spent twice, spent at a price nobody agreed to, spent on a request that cannot succeed, or stranded for good, and for front-running and griefing that cost the attacker little next to the harm."
          }
        },
        {
          "key": "intake",
          "vars": {
            "lens": "the Intake integration",
            "focus": "Compare src/protocol and the doubles in test/doubles with the verified source of the deployed Intake and IMD on Etherscan: selectors, the action encoding, requestWithFailure and the callback envelope, who may call back, how request ids are made, the gas a callback gets and what onResult and onFailure use at worst (a long uri, cold storage), what follows a callback that reverts, and whether someone who buys a request of their own naming changeme as its target, or a misbehaving writer, can move changeme's state. Say where the doubles are kinder than the real contracts."
          }
        },
        {
          "key": "wishes",
          "vars": {
            "lens": "wishes, order bodies and the job proof",
            "focus": "Test the wish alphabet and length, the JSON escaping and the exact job.open and job.continue bodies for every allowed byte; whether a wish, alone or with others in its round, can leave the wishes block, change a field of the job or read as an instruction, and how well the fixed brief holds that; the 16,384-byte body limit at 50 wishes; the parent job id check; and proveJob's JSON scanner (escapes, unicode escapes, nested and duplicate keys, braces inside strings, trailing data, size, gas) for a document that passes with a wrong job id and for a real one that cannot pass."
          }
        },
        {
          "key": "receipt",
          "vars": {
            "lens": "the NFT and the hard limits",
            "focus": "Check src/receipt against ERC-721, ERC-165 and metadata practice: mint, transfers, approvals, operators, safe transfers, events, attribution after a transfer, and tokenURI as on-chain JSON and SVG for any allowed wish (valid JSON and XML, markup or script injection in a wallet or marketplace, gas of the view). Then hold the whole contract to each hard limit: nothing ownable, pausable, upgradeable or fee-taking, no hidden mint, cap or royalty interface, no selfdestruct or delegatecall, both addresses fixed, and its deployed size and deployment gas."
          }
        },
        {
          "key": "full-pass",
          "vars": {
            "lens": "none: one adversarial pass over the whole",
            "focus": "Read src/Changeme.sol end to end and try the sequences its tests do not: many contributors and sponsors interleaved with callbacks in every order, rounds at their limits, long idle periods, the first round before any version exists, the gas of the worst contribute that also sends a 50-wish round, the reads and events a website needs to list every version with its wishes, and each promise in README.md that the code does not keep."
          }
        }
      ],
      "output": {
        "format": "json",
        "maxBytes": 32000
      }
    },
    {
      "name": "changeme-hardening",
      "mode": "code",
      "brief": "Harden changeme on the goal trunk: {{piece}}. {{assignment}} {{acceptance}}\n\nchangeme is one immutable ERC-721 for Ethereum mainnet: src/Changeme.sol, with src/protocol, src/orders and src/receipt compiled into it. Its deployed runtime is 24,362 bytes of the 24,576 a contract may have, so every byte counts, and foundry.toml stays as it is. Work only in your target scope; another target of this batch changes other files at the same time. Tests use the local doubles in test/doubles and need no network. Send no transaction to a live chain and place no order. Return the changed paths, what changed in behavior or interface, the runtime size of Changeme before and after (forge build --sizes), the checks run with how each ended, and any concrete issue left open.",
      "targets": {
        "attempts": 3
      },
      "items": [
        {
          "key": "size-headroom",
          "scope": [
            "src/receipt/**",
            "test/ChangeReceipt.t.sol",
            "test/Size.t.sol"
          ],
          "check": "forge test",
          "needs": [],
          "vars": {
            "piece": "bytecode headroom",
            "assignment": "A security review is under way and its fixes will need room the contract does not have. Shrink the receipt code in src/receipt until the deployed runtime of Changeme is at most 23,000 bytes, and lower where it costs nothing a holder would miss. Keep ERC-721 behavior, every external function, event and error that src/Changeme.sol and the tests outside your scope use, the internal _mintReceipt interface, the name changeme and symbol CHANGE, sequential ids from 1, the receipt reads, and a tokenURI that is on-chain JSON with an SVG on #BFE3FF showing the wish, escaped for JSON and XML. Simplify the drawing, the encoders and the error payloads before anything else.",
            "acceptance": "Add test/Size.t.sol with one test that deploys Changeme and requires its code length to be at most 23,300 bytes, so that later changes are held to it. Done when forge test passes whole and the runtime is at most 23,000 bytes."
          }
        },
        {
          "key": "proof-recovery",
          "scope": [
            "src/Changeme.sol",
            "test/Changeme.t.sol",
            "test/lifecycle/**",
            "README.md"
          ],
          "check": "forge test",
          "needs": [],
          "vars": {
            "piece": "recovery from a success that cannot be proven",
            "assignment": "Today a successful callback whose result document cannot pass proveJob (no top-level jobId, never published, too large) leaves head() at NeedsProof for good: dispatch returns false, retry reverts HeadNeedsProof and skip reverts NothingToRecover, as testUnusableSuccessProofLeavesQueuedRoundBlockedAfterOneDay in test/lifecycle/Recovery.t.sol records. Nothing may freeze the site for good. Make the smallest change that ends it: once RECOVERY_DELAY has passed since that attempt settled with no proof, the head counts as Unknown, so anyone may fund retry with the project's newest job id and the open round goes out. The version already recorded stays, and a proof that arrives later is still accepted without disturbing a newer attempt. Before the delay nothing changes.",
            "acceptance": "Rewrite that test to show recovery at exactly one day and not one second before; add tests for a proof that arrives after a recovery retry and for a full open round in that state; keep the accounting checks; update the head table and Recovery section of README.md. The runtime must stay at or under 24,476 bytes, and if test/Size.t.sol is in your checkout its ceiling binds you too: trim src/Changeme.sol to make room. Done when forge test passes whole."
          }
        }
      ]
    },
    {
      "name": "site-spec",
      "brief": "Prepare one part of the specification for the changeme website: {{part}}. {{assignment}} {{result}}\n\nchangeme will be one page at changeme.imd.site. The site the swarm last built fills the viewport in a sandboxed frame of its IPFS copy (https://imd-ipfs.xyz/ipfs/{CID}/, never allow-same-origin), under a small bar and a chat panel where people read the wishes behind each version, browse versions, connect a wallet and add a wish. Its look is that of https://fivewords.imd.site with light blue #BFE3FF in place of yellow. Its contract is src/Changeme.sol in https://github.com/identity-md-launches/goal-3599-have-swarm-build-test (README.md lists its reads and events; docs/intake.md explains jobs, result documents and site CIDs); it is not deployed yet. Use public pages and public chain state only: send no transaction, place no order and build no site. Say for each fact where it came from and on what date, and say plainly what you could not verify.",
      "items": [
        {
          "key": "look",
          "vars": {
            "part": "the look",
            "assignment": "Fetch https://fivewords.imd.site with the stylesheet and script it loads, and take its visual language from them: palette, typefaces and where they load from, type scale, spacing, borders, shadows, radii, buttons, inputs, motion, and how it behaves on a phone. Then say how changeme's small bar, version switcher, chat panel with its wish input (140 characters of a-z, 0-9 and basic punctuation, with a count), price and batch progress, and the empty screen before round one would be drawn in that language with #BFE3FF where fivewords uses yellow, and name two or three touches that make adding a wish fun without clutter.",
            "result": "Your result is one JSON object: \"source\" (each address fetched), \"palette\" (name, hex, use and the rule it came from), \"typography\", \"layout\", \"components\", \"barAndChat\" (desktop and phone), \"delight\", \"css\" (custom properties and the few rules that carry the look, ready to paste, 3,000 characters at most) and \"brief\" (the whole look in at most 1,500 characters of plain words, fit for a builder who has never seen fivewords)."
          }
        },
        {
          "key": "reads",
          "vars": {
            "part": "the reads",
            "assignment": "Verify what the bar must read from a browser. (1) Keyless public https RPC endpoints for Ethereum mainnet: for at least five, whether they answer eth_call and eth_getLogs, the widest log range, and whether they send the CORS header a page on another origin needs. (2) The ENS contenthash of made-by-chat.identitymd.eth: its resolver, the value now, the CID it decodes to, and the calls and decoding a page needs with no library. (3) What https://imd-ipfs.xyz/ipfs/{CID}/ answers for that CID: content type, framing and CORS headers, whether relative assets load. (4) On https://api.imd.fun, with any public job that published a site: where GET /jobs/{id} gives that job's own site CID, the project head and versions, whether it answers cross-origin, and whether a result document at an ipfs:// uri comes through the gateway with the keccak256 the chain holds. (5) Intake priceOf for job.open@job-1 and job.continue@job-1, by eth_call (addresses in docs/intake.md).",
            "result": "Your result is one JSON object: \"rpc\" (per endpoint: url, ethCall, getLogs, maxLogRange, cors, note), \"ens\", \"gateway\", \"api\" (each route, the fields that matter, its cors), \"price\", \"steps\" (numbered: how the bar finds the live CID, each past version's CID from the contract's version(v) and RoundBuilt events, and the bytes for proveJob) and \"gaps\" (what no public read gives)."
          }
        }
      ],
      "output": {
        "format": "json",
        "maxBytes": 24000
      },
      "minutes": 75
    }
  ],
  "read": [
    "security-review/liveness",
    "security-review/funds",
    "security-review/intake",
    "security-review/wishes",
    "security-review/receipt",
    "security-review/full-pass",
    "changeme-hardening/size-headroom",
    "changeme-hardening/proof-recovery",
    "site-spec/look",
    "site-spec/reads"
  ],
  "cancel": [],
  "wake": {
    "batches": [
      "security-review",
      "changeme-hardening",
      "site-spec"
    ],
    "afterMinutes": 600
  },
  "finish": false
}
