Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

docs(structure): map the recurring payments surface to its page, APIs, and crons

nirholas7ec336bd50d0
diff --git a/STRUCTURE.md b/STRUCTURE.md
index 7fe2675f8..1d2cbccde 100644
--- a/STRUCTURE.md
+++ b/STRUCTURE.md
@@ -145,6 +145,7 @@ bottom.
| Multiplayer 3D world (world.three.ws) | [deploy/world/](deploy/world) — [Dockerfile](deploy/world/Dockerfile), [cloudrun.yaml](deploy/world/cloudrun.yaml), [apply-hardening.sh](deploy/world/apply-hardening.sh), patches in [deploy/world/patches/](deploy/world/patches); health monitor [api/cron/world-health.js](api/cron/world-health.js) | Live · `hyperfy-world` on Cloud Run | [Hyperfy](https://github.com/hyperfy-xyz/hyperfy) pinned to an exact upstream commit and rebuilt with three local patches (server-side upload cap, `/status` blueprint-asset enumeration, fail-closed-without-`ADMIN_CODE`). World state (SQLite + uploaded assets) lives in the GCS bucket `world-three-ws-data` mounted at `/app/world`, so the container is stateless. **The world is gated:** without `ADMIN_CODE` Hyperfy's `effectiveRank` falls back to `Ranks.ADMIN` and every anonymous visitor gets server-side build rights — the fail-open default that emptied the world on 2026-06-12. Deploy + verify with `bash deploy/world/apply-hardening.sh`; builders unlock in-world with `/admin <code>`. See [deploy/world/README.md](deploy/world/README.md) |
| On-chain identity | [contracts/](contracts) | In-repo | Foundry-based on-chain agent identity, ERC-8004 |
| Contract audit pack | [contracts/AUDIT-README.md](contracts/AUDIT-README.md), invariants [specs/ECONOMY_CONTRACT_INVARIANTS.md](specs/ECONOMY_CONTRACT_INVARIANTS.md), threat model [specs/ECONOMY_CONTRACT_THREAT_MODEL.md](specs/ECONOMY_CONTRACT_THREAT_MODEL.md), static analysis [contracts/audit/](contracts/audit) | In-repo | Everything a review firm needs on day one for the reputation, royalty and delegation contracts: scope + deploy status per contract, stable invariant ids with a positive and a negative test each, an assets/actors/failure-modes threat model, and committed Slither + Clippy output with every finding fixed or dispositioned in writing |
+| Recurring payments (subscriptions + DCA) | Page [public/recurring.html](public/recurring.html) `→ /recurring`, module [src/recurring.js](src/recurring.js), lifecycle rules [api/_lib/recurring.js](api/_lib/recurring.js), APIs [api/agent-subscriptions.js](api/agent-subscriptions.js) `→ /api/agent-subscriptions` and [api/dca-strategies.js](api/dca-strategies.js) `→ /api/dca-strategies`, hourly crons `run-subscriptions` + `run-dca` in [api/cron/[name].js](api/cron/%5Bname%5D.js), schema [api/_lib/migrations/20260813191500_recurring_payment_lifecycle.sql](api/_lib/migrations/20260813191500_recurring_payment_lifecycle.sql) | Live | One signed ERC-7710 permission, then money moves on a schedule: a subscription transfers a fixed USDC amount to an agent's wallet each period, a DCA strategy swaps the same amount into a token through Uniswap V3. `/recurring` is the whole lifecycle in one place (create, pause, resume, cancel, per-charge history) plus an Incoming tab scoped by agent ownership rather than by payer, so a creator sees what is being paid in. Every attempt is written to `subscription_charges` / `dca_executions`, and one shared classifier decides what a failure means: a revoked or expired permission pauses the schedule with the reason attached, a network blip releases the period claim and retries for three ticks, a timeout is never retried (the only failure that could double-charge), a diverged DCA quote skips the period for free, and a platform-side relayer outage never counts against the owner at all. Settlement needs `AGENT_RELAYER_KEY` + `RPC_URL_<chainId>` on the deployment; DCA creation needs `DCA_ALLOWED_TOKEN_OUT` + `DCA_CHAIN_ID`. Docs: [docs/recurring-payments.md](docs/recurring-payments.md). Tests: [tests/recurring-charge-outcomes.test.js](tests/recurring-charge-outcomes.test.js), [tests/api/recurring-subscription-cron.test.js](tests/api/recurring-subscription-cron.test.js) |
| Solana program invariant tests | [contracts/program-tests/](contracts/program-tests) | In-repo | LiteSVM suite running the real compiled SBF bytecode of `skill_license` and `agent_invocation` against invariants `SL-*` and `AI-*`, with the real SPL Token and ATA programs loaded |
| Reputation Staking Market | spec [specs/REPUTATION_STAKING_MARKET.md](specs/REPUTATION_STAKING_MARKET.md), engine [src/shared/reputation-staking.js](src/shared/reputation-staking.js), server [api/_lib/reputation-market.js](api/_lib/reputation-market.js) + [api/reputation/market*.js](api/reputation), surface [public/reputation/market/](public/reputation/market) `→ /reputation/market` | In-repo · devnet open, mainnet owner-gated | Phase 3 roadmap: stake conviction on an agent and earn from its attested action history. A stake is a staker-signed Solana transfer to the market escrow carrying an `rsm.v1` SPL-Memo, so the chain (not the database) defines a position; the server only verifies it by reading the transaction back. Yield comes from a fixed per-epoch pool split by `principal × time × agentWeight`, where the weight is derived purely from the agent's signed `threews.*` attestations (work concave in `log2`, faults charged double), so conviction never pays itself. Principal is never slashed and settlement clamps earnings to the escrow surplus. Extends the SPL-Memo attestation layer in [docs/solana-reputation.md](docs/solana-reputation.md). Storage: [reputation_staking_market migration](api/_lib/migrations/20260811140000_reputation_staking_market.sql). Walkthrough: [docs/reputation-staking-market.md](docs/reputation-staking-market.md). Devnet proof: `node scripts/reputation-market-proof.mjs`. Tests: [tests/reputation-staking.test.js](tests/reputation-staking.test.js) |
| On-chain skill licenses | [contracts/skill-license/](contracts/skill-license) `→ /api/skills/license-onchain` | In-repo | Anchor program: each purchased skill = a 1/1 SPL NFT + `SkillLicense` PDA, a trustless alternative to DB-backed access checks. Backend: [api/_lib/skill-license-onchain.js](api/_lib/skill-license-onchain.js) |