Skip to content

Add acceptance checks, a storage recovery contract, and the mainnet script - #22

Merged
angelraph merged 1 commit into
masterfrom
claude/acceptance-checks
Nov 10, 2026
Merged

angelraph merged 1 commit into
masterfrom
claude/acceptance-checks

Conversation

@angelraph

Copy link
Copy Markdown
Owner

Part 3 of the plan, plus the pieces mainnet needs.

Acceptance checks (src/verify/checks.ts). The buyer can attach one test to a job:

  • url_contains: a public https page must contain some text. Only public hosts are fetched (no IPs, localhost or internal names), redirects are not followed, there is an 8 s timeout and a 1 MB cap.
  • github_pr_merged: owner/name pull request #n must be merged.
  • sha256: the delivery must be an exact agreed file.

How it works:

  • POST /invites accepts check, stored with the invite.
  • POST /invites/:id/check runs it on demand (public).
  • /relay runs it before relaying. A failing delivery gets 422 "The acceptance check failed: …. Nothing was sent.", and every run is logged as DELIVERY_CHECKED.
  • The website: the job form has an optional "Acceptance check"; the payee's invite page shows the check, the last verdict, and "Test it now".
  • Agents: openJob and the MCP clausehold_open_job tool accept check.
  • npm run judge: the main job now carries a sha256 check. The wrong file must be refused, then the right one pays.
  • README, JUDGES.md and the threat model say plainly that the check lives in the desk, not the contract.

Storage recovery (contracts/cleanup, scripts/recover-storage.ts): a 12 KB contract that only the account's own key can call, which removes the storage keys it is given. Rehearsed on testnet with a real factory and the real code:

  • 418,186 bytes stored and 4.18 NEAR locked
  • the cleanup freed 4.06 NEAR
  • deleting the throwaway account returned 5.9958 of the 6 NEAR to the funder

Mainnet (scripts/mainnet-proof.ts, not run yet): deploy the factory to clausehold.near with a USDC-only mandate where only clausehold.near may write clauses, then write and fund one 2 USDC clause, deliver it as a relayed meta-transaction, close it, and fetch a dry NEAR Intents quote. --dry prints the costs first.

Checks: root typecheck; 234 tests (7 of them new, for the checks); cargo test -p cleanup (2); web typecheck and build.

🤖 Generated with Claude Code

…cript

A buyer can attach a check to a job (a page must contain text, a pull request must be merged, or the delivery must be an exact file). The desk runs it before relaying any delivery and refuses one that fails, with the reason. The payee sees it and can test it first; agents set it through MCP; npm run judge sends the wrong file first and expects the refusal.

contracts/cleanup and scripts/recover-storage.ts free the NEAR a factory locks for storage. Rehearsed on testnet: 4.06 of 4.18 NEAR freed, and 5.9958 of 6 NEAR back after deleting the account. scripts/mainnet-proof.ts deploys the factory to clausehold.near and runs one 2 USDC clause end to end.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@vercel

vercel Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
clausehold Ready Ready Preview Nov 10, 2026 10:41am UTC
clausehold-api-mainnet Ready Ready Preview Nov 10, 2026 10:41am UTC
clausehold-api-testnet Ready Ready Preview Nov 10, 2026 10:41am UTC

@angelraph
angelraph merged commit 4ff6a2d into master Nov 10, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant