Here's how I set up the agent in the Commonplace video, if you're thinking about building one. The agent is Claude Code running in my terminal. There's no agent framework. It's a wallet of its own, one wrapper script with the rules, and a few small task scripts. 1. Give it its own wallet - A random 32-byte seed, stored in the macOS Keychain, not in a file. It isn't derived from my seed, so it's a separate identity. - Its records use the same wallet-toolbox code as my wallet, as a separate account on my storage server. You don't need a storage server for this. wallet-toolbox with a local SQLite file works too. - I sent it 100,000 sats by PeerPay from my phone. That balance is the real limit on what it can spend. 2. Put the rules in code, not in the prompt Everything the agent does goes through one wrapper: ``` ALLOWED="agent-balance.ts pay-402.ts send-peerpay.ts accept-peerpay.ts list-peerpay.ts agent-walkthrough.ts" case " $ALLOWED " in " $SCRIPT ") ;; *) echo "not on the agent's list"; exit 1;; esac export AGENT_MAX_SATS=${AGENT_MAX_SATS:-20000} WALLET_SEED="$(security find-generic-password -s claude-agent-wallet-seed -w)" exec npx ts-node "scripts/$SCRIPT" "$@" ``` It can only run scripts on its list and only load its own seed, never mine. Any single spend over 20,000 sats needs my OK. 3. Paying for things Outside a browser, the SDK's AuthFetch makes the signed request. If the server answers 402 Payment Required, AuthFetch asks the wallet to pay and tries again. The cap sits in a thin wrapper around the wallet, so it holds whatever the agent was told: ``` const guarded = new Proxy(wallet, { get(target, name) { if (name !== "createAction") return target[name].bind(target); return async (args, originator) => { const sats = args.outputs.reduce((s, o) => s + o.satoshis, 0); if (!commit) throw new Error(dry run: server asked for ${sats} sats); if (sats > cap) throw new Error(refused: ${sats} sats, cap is ${cap}); return target.createAction(args, originator); }; }, }); const res = await new AuthFetch(guarded).fetch(url, { method: "POST", body: "{}" }); ``` By default it's a dry run: you see the price and nothing is spent. --commit pays. 4. The video The browser part was a Puppeteer script that Claude wrote ahead of time: connect, type the notes, add a link and an image, open Storage, buy, then write a last note with the real txid and balance. The steps were planned. The payment was actually real. The page gets its wallet like this. The key stays in Node, and the page gets a window.CWI (what Hodos or BSV Browser would give it) that forwards every call back to Node, with the same cap check: ``` await page.exposeFunction("__agentWallet", async (method, argsJson) => { const args = JSON.parse(argsJson); if (method === "createAction") { /* same cap check */ } return JSON.stringify(await wallet[method](args, "commonplace.utxoengineer.com")); }); await page.evaluateOnNewDocument((methods) => { const cwi = {}; for (const m of methods) cwi[m] = async (a) => JSON.parse(await window.__agentWallet(m, JSON.stringify(a ?? {}))); window.CWI = Object.freeze(cwi); }, CWI_METHODS); ``` Commonplace didn't change at all for the agent. To the site, it's just another browser wallet. When the agent clicked Buy, Commonplace's own page code made the AuthFetch call, and the 402 payment went through this bridge. There's also a rehearsal mode: a throwaway key, and every payment declined. I watched the whole run before any money moved. Short version: its own seed, kept out of files. A small float. A wrapper that loads only that seed and caps each spend in code. AuthFetch for anything that charges with a 402. The AI chooses what to buy. A few lines of code check the price before the wallet signs anything, and that check doesn't listen to the AI.