{
  "markdown": "# SmartPolicy\n\n**Runtime authorization for AI agents and smart contracts.**\n\nDefine what an agent, a user, or a contract is allowed to do — once, as a policy.\nEnforce it everywhere: on-chain via a minimal verifier, off-chain via an MCP server\nand REST API that AI systems consume directly. Update the rules without redeploying\nanything.\n\n> Status (2026-06-12): core contracts live on Ethereum Sepolia\n> (Etherscan-verified, addresses in contracts/deployments/sepolia.json); 54\n> Foundry tests green; MCP server v0 packaged — `npx smartpolicy-mcp` runs\n> zero-config against Sepolia, `npx smartpolicy-mcp deploy` bootstraps any\n> chain from embedded bytecode; AI-consumability proven by unaided\n> fresh-agent execution tests (incl. cold start on an empty chain). NOT\n> audited; internal until mature — no public repo or registry listings yet.\n> Current state, decisions, and how to resume work: PLAN.md.\n\n## Why\n\nEvery team shipping AI agents hits the same wall: the agent can technically do\nanything its keys allow, and the only ways to constrain it are hardcoded prompts or\nredeployed code. Every smart contract team hits the mirror image: access rules baked\ninto the contract at deploy time.\n\nSmartPolicy separates the **rule** from the **enforcement point**:\n\n- A **policy** lives in the on-chain Registry: members, admins, conditions, expiry,\n  and mutability flags. It is data, not code. Changing a rule is a transaction, not\n  a redeploy.\n- **Enforcement** happens wherever the action happens:\n  - A smart contract inherits one modifier and checks the Registry (free view call).\n  - An AI agent (or the service in front of it) asks the MCP server / REST API:\n    *\"may `0xAgent` perform `action` under policy `N`?\"* and receives a short-lived\n    **signed grant** (EIP-712) that any contract or backend can verify.\n\n## What this is NOT\n\n- Not a token. There is no protocol token, no ICO, no governance theater.\n  Revenue is fees: a small fee on on-chain policy writes, and metered (x402)\n  pay-per-call on the hosted API. Reads and verification are free.\n- Not upgradeable. The core Registry is immutable once deployed. Trust comes from\n  code you can read, not admin keys you have to trust. New protocol versions are\n  new deployments.\n- Not an oracle. SmartPolicy answers \"is this allowed?\", not \"what happened in the\n  world?\". Condition values that depend on external facts are attested via signed\n  grants from sources the policy owner chooses.\n\n## Architecture (short version)\n\n```\n┌─────────────┐   MCP / REST (x402 metered)   ┌──────────────────┐\n│  AI agents   │ ────────────────────────────▶ │ SmartPolicy MCP  │\n│  & services  │ ◀──── signed grants ────────  │ server (TS)      │\n└─────────────┘                                └────────┬─────────┘\n                                                        │ reads + grant issuance\n┌─────────────┐   inherit Gate modifier        ┌────────▼─────────┐\n│  Protected   │ ────── view calls ──────────▶ │ PolicyRegistry   │\n│  contracts   │                               │ (Base, immutable)│\n└─────────────┘                                └──────────────────┘\n```\n\nSee [ARCHITECTURE.md](./ARCHITECTURE.md) for the full design and the rationale for\nevery decision (chain, fees, trust model, what was deliberately dropped from v1).\n\n## Repository layout\n\n```\ncontracts/   Solidity core: PolicyRegistry, PolicyGate, interfaces (Foundry)\nmcp/         MCP server + REST API (TypeScript, x402 metering)\nsdk/         TypeScript client SDK (@smartpolicy/sdk) — reads, grants, tx-building\ndocs/        Integration guides (planned)\n```\n\n## Lineage\n\nSmartPolicy is a clean rewrite of the strongest ideas from a 2025 prototype\n(\"Smart Policy Protocol\", Sepolia): the policy registry, the tiered integration\nmodel, and hybrid on-chain + signed-token enforcement. The rewrite deliberately\ndrops the SPOL token/ICO/governance suite, the sports-prediction oracle, the\nfactory contracts, and the upgradeable-proxy trust model, and fixes the known\nsecurity issues (tx.origin checks, missing reentrancy guards, header-only API auth).\n\n## License\n\nApache-2.0 — see [LICENSE](./LICENSE).\n",
  "bytes": 4125,
  "sha": "dbfa4449841f70b1e7fa0cb3f51a132e9531e8c30c2a21e6bd222f525e9332f6",
  "repo_slug": "smartpolicy-protocol/smartpolicy",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_smartpolicy_protocol_smartpoli_65a26bc0/readme"
}