Owners confirm the agent's terms before a transfer (decision 0014) #34
All Vouch review confidence checks passed
Residual risk 0.23 = Change Risk (0.57) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.57 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Ai Authored
ai_authored
0.050
Real PR Conversation Timeline
1 comments
"Review active on #34"
general
weight: 0.35
b3hr4d
<!-- claude-projects-attribution: {"github_login":"b3hr4d"} -->
_Requested by Behrad · project thread_
What it does
Before the agent answers an owner's request with a transfer, it writes the terms it reads in the request: the token, who is paid, the most, and the latest time the transfer may be sent. The owner reads them in words on the wallet's own Approvals page and confirms them, or says no. Until an owner confirms them, the wallet refuses a transfer for that request. Once the agent proposes one, the wallet's pages check it against the confirmed terms. If it is outside them, the pages list why and offer no Approve and no Run. Reject stays. Every transfer still waits for an owner or an approver (decision 0007).
Reading the terms, writing them in words and the check all come from Meant's
@meantjs/consent/terms0.5.0, the confirmed-terms step of the profile spec (D-056 there). The record is [decision 0014](docs/decisions/0014-confirmed-terms.md), accepted on 2026-10-31: Behrad chose option A, which this PR builds. B (the wallet also requires terms on every request) and C (the check runs in the canister) are written out there. The record also cites candid-profile's re-test (its PR #79): with a careful simulated user confirming the terms, no model signed any of 1,950 bad requests.Behrad also accepted raising the
app.jsbudget from 560,000 to 600,000 bytes.app.jsgrows from 543,895 to 579,300 bytes.Changes
candid/wallet.did,canisters/wallet/src/terms.rs,lib.rs,types.rs,storage.rs)-
propose_terms(id, draft)is for proposers (and owners). It takes four fields of 1 to 160 bytes, at most 3 drafts per request, and none once a transfer answers the request.-
confirm_terms(id, { version, terms, id, text })anddecline_terms(id, version)are for owners only. The wallet does not read the terms. It stores the JSON the page confirmed (RFC 8785, at most 2,048 bytes), the words the owner read, who and when. It refuses an id that is not the SHA-256 of that JSON.-
request(id)is a query for members.-
propose_forrefuses a request whose terms wait for an owner or were declined.- Three new audit events.
-
Request.termsis anopt, so requests stored before this change read with none.ui/src/logic/terms.ts,ui/src/parts/terms.tsx,guard.tsx,approvals.tsx,rail.tsx)- The Requests card shows the agent's draft in words, read as of when it was written and in the browser's zone, with "Confirm these terms" and "Not what I meant".
- The Approvals page, and the "Needs you" list beside every page, read the request a transfer answers and check the transfer against the confirmed terms.
- Names that would not name one thing are left out. ICP's name stays ICP's ledger's, even when that ledger cannot be read.
mcp/src/tools.ts)- New
wallet_propose_terms. It reads the draft the way the page will, and refuses one that cannot be read before it is written, so a bad draft costs none of the three. It returns the words the owner will see.-
wallet_requestsnow shows each request's terms and what an owner said.-
wallet_propose_transferrefuses a transfer outside the confirmed terms and gives the reasons.-
@meantjs/formatmoves from 0.1.0 to 0.5.0 inui/andmcp/. The package did not change in anything the wallet uses.-
@meantjs/consent0.5.0 is added to both, andui/also adds@meantjs/profile0.5.0 for the RFC 8785 JSON. All are pinned exactly and listed inui/build.mjs.-
npm audit --omit=devfinds nothing in either package.How it was checked
cargo fmt --all --check, clippy (native andwasm32-unknown-unknown) andcargo test --workspace --exclude integrationall pass.terms_come_before_the_transfer. The upgrade test runs from main's release (12320fe, built in its own target directory). It now writes a request with that release and gives it terms after the upgrade. A fault planted in that new part makes the test fail. Later commits change only the pages, the agent tools and the docs, and the page verification tests pass again after them. CI runs the Bitcoin Core tests and the 100 MiB release test (all three jobs green).npm run buildwith Node 22.22.0 changes onlyapp.js.4b53ee47…. The UI test pins it, the wallet's unit test accepts it, and Python'shashlibgives the same hash.- Setup. The page code was built the way
ui/build.mjsbuilds it, with onlyui/src/ic/client.tsswapped for ic-reactor's test client (@ic-reactor/core/testing). The test client is a fake replica that signs and certifies replies, with the wallet and the ICP ledger written as plain functions. The pages were served athttp://<wallet id>.localhostand driven in Chromium.- Confirming. The owner confirms the agent's draft on the Approvals page. The draft reads "Savings (…-eiw7ojy.1) may be sent at most 1.5 ICP, until the end of 30 November 2026 (UTC+03:00)".
- Outside the terms. A 5 ICP transfer against terms of at most 0.5 ICP shows "Outside the terms" and the reason, and offers only Reject.
- Within the terms. A 1.5 ICP transfer within its terms offers Approve, then Run it once approved.
- Needs you. The "Needs you" list on the Overview does the same.
- Result. 13 of 13 checks pass, with no console errors or page errors. With
termsAllowbroken on purpose, the three "no Approve" checks fail.- Limit. The stand-in is not the canister. The canister's rules are what the PocketIC tests cover.
Not done yet
docs/ui-standard.md, "Not covered yet").scripts/try-local.sh --browsershows it on a local network.🤖 Generated with Claude Code
https://claude.ai/code/session_01WnX8bbgsvo3ZpPBaqqGej3