XE AI for your DAO
Set up XE's attested AI review of every proposal and an AI delegate for each member, on Snapshot, Aragon OSx or Discourse, with one script. Reviews as EAS attestations, the Snapshot X strategy and oSnap.
XE gives a DAO two things:
- A reviewer. Every proposal gets an AI review: whether it does what its text says, and how risky it is. The model runs in an attested enclave behind XE's zero-retention relay, XE's nodes check the attestation and settle the result, and the result is published on the DAO's chain. Anyone can check that the review read exactly the proposal's text.
- A delegate per member. A member writes a voting policy in plain words and delegates their votes to a contract. For each proposal, the AI reads the policy, the proposal and XE's review, and answers For, Against or Abstain with a reason. The contract casts that vote within the member's limits. The member can override any vote while voting is open, or take the delegate back.
A review is advice with an attested trail, not proof that a proposal is safe. The vote stays the DAO's.
#Your DAO's own provider account
Harbor DAO, XE's demo, is reviewed on XE's own provider account. Your DAO uses its own, through the XE Key Service:
- The DAO's XE account puts its provider key in the Key Service and publishes a grant: the models, a daily budget, an end date, and the watcher's and delegates' XE accounts as callers.
- The watcher and the delegates seal each review to the DAO's grant. The provider bills the DAO, and each request pays XE's relay fee.
- Retiring the grant stops every review at once.
The kit asks for the grant in the config's byok section and checks it: the relay is attested and approved by XE, and the grant is live, the DAO's own, and names every caller. Without it, the kit stops before it deploys anything. The reviewer contract's own sealed path, where the contract asks XE directly, answers on XE's account and serves Harbor DAO only.
#The kit
One script sets up both for a DAO on Snapshot, Aragon OSx or Discourse. It is dao/kit/xe-dao-kit.mjs in XE's kit, and needs Node and Foundry's forge.
cd dao/snapshot-workers && npm ci && cd ../.. # oncenode dao/kit/xe-dao-kit.mjs snapshot --config dao.json --dry-run # what it would do; reads onlynode dao/kit/xe-dao-kit.mjs snapshot --config dao.json # do itnode dao/kit/xe-dao-kit.mjs snapshot --config dao.json --verify # check; exits 1 on a failureUse snapshot, aragon or discourse as the first argument.
- Idempotent. What it deployed is recorded in
<config>.state.jsonand checked on chain (and on the forum) before anything is done again. Run it as often as you like. - Dry run reads only; deployments are simulated with
forge scriptwithout--broadcast. - Apply deploys what is missing with the deployer key, writes the configuration of the services that watch the DAO to
out/<name>/, and sets up the forum through its admin API. It prints the commands to start those services rather than starting them. - Keys and API keys are read from the files the config names and never printed.
Each line of the report is ok (in place), done (done now), would (dry run), todo (for the DAO or XE to do) or fail:
harbor · snapshot · verifyok reviewer 0x2375A274064F4f40f9339C4267f496F0b7dD1fF0ok reviewer owner is the DAO 0x591A969994c3Ea3d28555A39D6913D022eEC0E0dok watcher may request reviews 0x8C8070787A78aF0aBf05B5D639c41051db5F3133ok reviewer funded with XE 3.8 XE: 12 reviews; the DAO funds it by a proposalok delegate Member 2 0x02Ec29BbeB3040BFF8E3EBAC026580a8BF094190ok delegate Member 2: voting power 0x839830A0841145F71957C5946b3b28e155d5dC88 delegates to itok Snapshot space xe-ai-dao.eth on network 84532#The config
{ "name": "example-dao", // used in service names and out/<name>/ "chain": { "id": 84532, "rpc": "https://sepolia.base.org", "explorer": "https://sepolia.basescan.org" }, "deployer": { "address": "0x…", "keyFile": "~/.config/…/deployer.key" }, // pays gas; owns nothing "snapshot": { "space": "example-dao.eth", "hub": "https://testnet.hub.snapshot.org/graphql", "owner": "0x…", // the DAO's Safe or treasury: it owns the reviewer "watcher": "0x…", // the address that asks for reviews "reviewsPerDay": 5, "votesToken": "0x…", // optional: the token the space counts "delegates": [{ "label": "Alice", "member": "0x…", "policy": "Support security work and audits. Oppose anything that moves funds to addresses the DAO has not named." }] }, "aragon": { "dao": "0x…", "voting": "0x…", // the DAO and its TokenVoting plugin "name": "Example DAO", // shown to the model in each review "members": [{ "label": "Alice", "member": "0x…" }] }, "discourse": { "url": "https://forum.example.org", "admin": { "username": "admin", "keyFile": "~/…/discourse-admin.key" }, "reviewAccount": "xe_review", // a moderator account the reviews are posted as "category": "proposals", "serviceUrl": "https://forum-review.xe.marketized.io", "serviceKeyFile": "~/…/forum-review.key", // written by the kit "webhookSecretFile": "~/…/forum-webhook.secret", // written by the kit "approvalTag": "xe-review", // optional: a moderator tags a topic to approve its review "dailyCap": 3 // optional }, "byok": { "relay": "https://…", // the Key Service relay "grant": "<service id>", // the DAO's grant (xe-key-…) "account": "<64 hex>", // the DAO's XE account: it owns the key and the grant "delegates": ["<64 hex>"] // the watcher's and delegates' XE accounts }}Include only the platforms you use.
#What only the DAO or XE can do
The kit lists these as todo:
- fund the reviewer with XE (a DAO proposal), and give the watcher gas;
- XE adds the new contracts to its keeper, which carries their requests to XE;
- each member points their delegate's operator at the watcher and delegates their votes to it;
- on Aragon, the DAO passes the installation proposal the kit prepared.
#Snapshot
The kit deploys the DAO's XESnapshotReviewer (owned by the DAO, asked by the watcher, with a daily cap) and one XESnapshotDelegate per member, then checks the space on the hub.
| Step | The kit checks |
|---|---|
| Reviewer | Its code, space and owner; that the watcher may ask; its XE balance; the watcher's gas; that XE's keeper carries it |
| Delegates | Each one's member and reviewer; that its operator is the watcher; that the member delegates to it |
| Services | The watcher's and each voter's configuration in out/<name>/ |
| Space | It exists on the hub |
A Snapshot vote is a signed message, and a contract can't sign. So the delegate signs through ERC-1271: once XE's attested decision lands, it approves the EIP-712 hash of one exact vote message, and isValidSignature answers yes for that hash only. It decides only on the text the published review read, and only on For / Against / Abstain proposals.
Options for the space:
- Proposal validation
xe-reviewed({ "reviewer": "0x…", "network": "84532" }): only reviewed text can be posted. It needs a hub that runs this validation. - Snapshot X: an execution strategy that puts the review in the rule (below).
- oSnap: the rule in the module's rules text, and a checker (below).
- Attestations: each review published on EAS (below).
#Aragon OSx
For a DAO with Aragon's TokenVoting, the kit deploys the DAO's own XEReviewer plugin and an XEDelegateFactory, prepares the plugin's installation through Aragon's PluginSetupProcessor, and writes the DAO proposal that applies it: out/<name>/aragon-install-actions.json, five actions.
Once installed:
- Proposals are created through the reviewer:
createProposal(title, intent, actions, …). Each action's function signature is checked against its selector. - The reviewer renders the review prompt from the proposal's on-chain actions, so the model reads exactly what would run.
- TokenVoting can execute only through XEReviewCondition: a proposal runs once XE's review of its exact actions is published. A proposal whose review flags it, or can't be read, needs Yes votes from 60% of all voting power. The DAO can change that bar.
- Installing the plugin removes TokenVoting's open permission to create proposals, so a proposal that bypasses the reviewer has no review and can't run.
- Each member calls
create(policy, limits)on the factory and delegates their tokens to the delegate it returns.
#Discourse
The kit sets up a forum for XE's forum review service through Discourse's admin API, so hosted forums work too:
| Step | What it does |
|---|---|
| Category | Creates the Proposals category if it's missing |
| Review account | Creates its API key and writes it to serviceKeyFile |
| Webhook | <serviceUrl>/webhooks/discourse: topics created and edited, first posts edited, in Proposals, signed with the secret |
| Theme component | Installs the XE AI review card, sets its service URL and categories, attaches it to the default themes |
| Service | Writes its configuration, and checks it answers the forum's origin |
How a review runs: a member posts in Proposals, and the card says the review waits for approval. A moderator tags the topic xe-review. The service asks XE to review the topic's exact text, rendered as the Snapshot proposal it will become, and updates the card. An edit is a new text and gets a new review. When the same text is posted on Snapshot, its review is found by the text's hash, so it isn't reviewed twice.
Setting it up by hand, the service's settings and its topic API: Discourse setup.
#How a review works
- Request. The watcher sends the proposal's text as the hub shows it (the space, title, choices and body). The reviewer contract keeps its length and SHA-256 and emits it, seals the prompt for XE's zero-retention relay, and pays from its own XE.
- Answer. The relay opens the prompt in its enclave, asks the model, seals the answer and signs a receipt. XE's nodes check the enclave's attestation and settle the request. The result comes back to the DAO's chain, checked against XE's validators.
- Publish. Anyone calls
publishReview(proposalId, output, answerKey). The output's SHA-256 must equal the hash XE's nodes settled, and the contract reads the verdict, the risk and whether the text says what it does.
isClear(proposalId) is true for a published review that passes, with low or medium risk, and whose text matches what the proposal does. reviewOfText(textHash) finds the published review of a text by its SHA-256, whatever key it was published under.
What the contracts enforce: the review read exactly the recorded text; the answer is the attested one; the budget (reviews per day) and who may ask. What they don't: that the watcher's text is the hub's proposal (Snapshot's XE review panel checks that), and whether the model judged well.
#The delegate's limits
| Limit | Meaning |
|---|---|
requireReview | Decide only after XE's review is published, so the AI sees it |
noYesOnFlagged | A For on a proposal whose review didn't clear it is cast as Abstain |
decisionsPerWeek | At most this many paid decisions a week |
maxPrice | The most one decision may hold, in micro-XE, from the delegate's XE account |
expiresAt | When the delegate stops deciding (0: never) |
The member's own vote always wins while voting is open, and the member can change the policy or revoke the delegate at any time.
#Reviews as EAS attestations
Each published review can be copied to EAS, so any EAS tool can read it. The schema's resolver accepts an attestation only when it states a review exactly as the reviewer published it on that chain, once per review. Anyone may attest; the resolver does the checking. Reviews are final, so the schema isn't revocable.
| Base Sepolia | |
|---|---|
| Schema | bytes32 proposalId, string space, bytes32 textHash, uint8 verdict, bytes32 outputHash, bytes32 attestationHash |
| Schema UID | 0x8d05855884df5f39d953bb4e7a209a224d4c67510c5baf50b4cfc2d8620eb226 |
| Resolver | 0x214A98A71e272351F048bbe1EbFCdc7A4b16c125 |
| EAS | 0x4200000000000000000000000000000000000021 |
proposalId is the review's key on the reviewer: a Snapshot proposal id, or the text's hash for a forum draft. attestationHash is the aggregate of the enclave attestations XE's nodes verified.
Reading Harbor DAO's reviews and their attestations, with viem:
import { createPublicClient, http, parseAbi } from "viem";import { baseSepolia } from "viem/chains"; const client = createPublicClient({ chain: baseSepolia, transport: http("https://sepolia.base.org") });const reviewer = "0x2375A274064F4f40f9339C4267f496F0b7dD1fF0"; // Harbor DAO's XESnapshotReviewerconst resolver = "0x214A98A71e272351F048bbe1EbFCdc7A4b16c125";const EAS = "0x4200000000000000000000000000000000000021"; const abi = parseAbi([ "function proposalCount() view returns (uint256)", "function proposalIds(uint256) view returns (bytes32)", "function isClear(bytes32) view returns (bool)", "function review(bytes32) view returns ((uint8 state, uint8 attempts, uint8 verdict, uint8 risk, uint8 intent, uint32 textLength, uint64 requestedAt, uint64 landedAt, uint64 requestedBlock, uint64 publishedBlock, bytes32 commandId, bytes32 requestId, bytes32 inputHash, bytes32 outputHash, bytes32 attestationHash, bytes32 textHash))", "function attestationOf(bytes32) view returns (bytes32)",]);const easAbi = parseAbi([ "function getAttestation(bytes32) view returns ((bytes32 uid, bytes32 schema, uint64 time, uint64 expirationTime, uint64 revocationTime, bytes32 refUID, address recipient, address attester, bool revocable, bytes data))",]); const n = await client.readContract({ address: reviewer, abi, functionName: "proposalCount" });for (let i = 0n; i < n; i++) { const id = await client.readContract({ address: reviewer, abi, functionName: "proposalIds", args: [i] }); const r = await client.readContract({ address: reviewer, abi, functionName: "review", args: [id] }); if (r.state !== 3) continue; // 3: published const clear = await client.readContract({ address: reviewer, abi, functionName: "isClear", args: [id] }); const uid = await client.readContract({ address: resolver, abi, functionName: "attestationOf", args: [id] }); const att = /^0x0+$/.test(uid) ? null : await client.readContract({ address: EAS, abi: easAbi, functionName: "getAttestation", args: [uid] }); console.log(id.slice(0, 10), clear ? "clear" : "flagged", "text", r.textHash.slice(0, 10), "attestation", att ? att.uid.slice(0, 10) : "none");}0x3b79e0ee flagged text 0xc66513b8 attestation 0x4b3bb06a0xad897cbf clear text 0x80b29fab attestation 0x001e3e4a0x5f097ad7 flagged text 0x5f097ad7 attestation 0xaf44ea4c0x3ab7be53 clear text 0x3ab7be53 attestation 0xcb6607bcTo publish attestations for your own reviewer, the kit's script/EasReviews.s.sol deploys the resolver, registers the schema and attests each published review that isn't attested yet. Then give the watcher the resolver's address, so it attests new reviews as they're published.
#Snapshot X
XEReviewExecutionStrategy is an execution strategy for Snapshot X spaces. It runs an accepted proposal's transactions from a Safe, with the review in the rule:
- a proposal whose text XE reviewed as clear passes by simple majority (For above Against, and For plus Abstain at least the quorum);
- a flagged, unreadable or unreviewed one also needs For to reach
supermajorityBpsof For plus Against (6667, two thirds, by default).
The text is bound when the proposal is created: the execution payload is abi.encode(bytes32 textHash, MetaTransaction[] transactions), where textHash is the SHA-256 of the proposal's text as the review reads it. The space records the payload's hash at creation, so the text can't be swapped later. A proposer who commits to another text gets that text's review, and with no clear review the higher bar applies.
Deploy it with script/DeploySnapshotX.s.sol and enable it as a module on the Safe.
#oSnap
oSnap executes a Snapshot vote's transactions from a Safe after a challenge window, and disputes are judged against the module's rules text. The Safe never sees the vote, so the review rule goes in two places:
- The rules.
node dao/snapshot-workers/scripts/osnap-check.mjs --rulesprints rules that name the reviewer contract, the text format and the supermajority. A proposal that breaks the rule can be disputed and loses its bond. - The checker.
node dao/snapshot-workers/scripts/osnap-check.mjs <proposal id>reads the proposal from the hub, hashes its text, finds XE's review and says whether the result passes. Proposers run it before posting a bond; a dispute bot runs it on each new oSnap proposal.
A Safe guard could check that a transaction's text was reviewed, but not the vote split, which lives on Snapshot's hub, and it would need Safe 1.5's module guard and a step to register each transaction. Where the whole rule must be enforced on chain, use the Snapshot X strategy instead: there the votes are on chain and the proposal commits to its text.
#Harbor DAO, on Base Sepolia
A working example of everything above, with its state file at dao/kit/examples/harbor.state.json:
| Address | |
|---|---|
| XESnapshotReviewer | 0x2375A274064F4f40f9339C4267f496F0b7dD1fF0 |
| A member's XESnapshotDelegate | 0x02Ec29BbeB3040BFF8E3EBAC026580a8BF094190 |
| Aragon XEReviewer | 0x1A69864FaF0869DDa90cdB00b45d48E5e65A6111 |
| XEDelegateFactory | 0x3E0cd362Dca1690884D9c9482E9a7B09F94C9FA7 |
| XEReviewCondition | 0xeeAE69802B1b321B57c6aDD193f7348DB0790Afa |
| Snapshot space | xe-ai-dao.eth on Snapshot's testnet hub |