> For the complete documentation index, see [llms.txt](https://celebi-fund.gitbook.io/untitled/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://celebi-fund.gitbook.io/untitled/readme.md).

# CELEBI.FUND

![CELEBI.FUND banner](/files/pQ1b7pD9Uiw2OvvhEYFQ)

> **Give an agent a mandate. Keep the keys.**

An autonomous, policy-bound trading agent for **Robinhood Chain** (EVM L2, chain id `4663`) and **Robinhood Stock Tokens**. It executes onchain swaps under a human-authored *Mandate Stone* — a plain-English investment constitution that is deterministically compiled into cryptographic session-key permissions. LLMs propose. Deterministic code decides.

***

## Table of Contents

1. [What This Is](#1-what-this-is)
2. [Design Principles](#2-design-principles)
3. [System Architecture](#3-system-architecture)
4. [Core Concepts](#4-core-concepts)
   * [Mandate Stone](#41-mandate-stone)
   * [Proof of Restraint](#42-proof-of-restraint)
   * [Time Capsule](#43-time-capsule)
   * [Time Stop](#44-time-stop)
   * [Session Keys](#45-session-keys)
5. [Routes & Screens](#5-routes--screens)
6. [The Policy Engine](#6-the-policy-engine)
7. [Onchain Execution Pipeline](#7-onchain-execution-pipeline)
8. [Smart Accounts & Session Keys](#8-smart-accounts--session-keys)
9. [Canonical Registry](#9-canonical-registry)
10. [Oracle & Preflight Safety](#10-oracle--preflight-safety)
11. [Quote Providers](#11-quote-providers)
12. [Robinhood Trading MCP (Off-chain Brokerage)](#12-robinhood-trading-mcp-off-chain-brokerage)
13. [Eligibility & Jurisdiction Gating](#13-eligibility--jurisdiction-gating)
14. [Data Model](#14-data-model)
15. [Security Model](#15-security-model)
16. [Configuration & Environment](#16-configuration--environment)
17. [Brand & IP Safety](#17-brand--ip-safety)
18. [Roadmap](#18-roadmap)
19. [Glossary](#19-glossary)
20. [Legal Notice](#20-legal-notice)

***

## 1. What This Is

`celebi.fund` is a **non-custodial, mandate-bound autonomous trading agent** targeting native Robinhood Stock Tokens on Robinhood Chain. It is architected around one uncompromising rule:

> **The LLM never signs. The LLM never chooses. The LLM proposes.** All authorization is expressed as **deterministic, machine-checkable permissions** derived from a user-signed mandate.

The system exposes three execution rails, each isolated behind an adapter interface:

| Rail                                 | Asset class                        | Custody                           | Signing                            |
| ------------------------------------ | ---------------------------------- | --------------------------------- | ---------------------------------- |
| **Robinhood Chain** (native)         | Stock Tokens (ERC-20, 18 dec)      | User-controlled EVM smart account | Session key or user wallet         |
| **Robinhood Trading MCP** (optional) | U.S. equities (offchain brokerage) | Brokerage                         | OAuth to dedicated Agentic account |
| **Demo**                             | Simulated                          | None                              | None (read-only)                   |

***

## 2. Design Principles

1. **Deterministic authority.** LLMs generate proposals and prose. A pure, testable policy engine decides whether any proposal is executable.
2. **Non-custodial by default.** Private keys are held by the user's wallet or by an ephemeral, revocable, time-boxed session key generated **in the browser**.
3. **Verifiable price truth.** Every proposal is checked against a **Chainlink** feed, staleness bound, and L2 sequencer health signal. No feed → no trade.
4. **Legible restraint.** Every rejection is persisted as *Proof of Restraint* with a machine-readable reason code and human-readable explanation.
5. **Reversible autonomy.** A single, always-visible *Time Stop* control revokes every active session key and drops the agent to read-only mode.
6. **Jurisdictional honesty.** Access is gated by explicit self-attestation *and* server-side region checks. Restricted regions are blocked at the API boundary, not just the UI.
7. **Trademark hygiene.** Codename and mascot artwork are isolated in a single config module and marked for replacement before commercial launch.

***

## 3. System Architecture

```
                     ┌──────────────────────────────┐
                     │        Browser (React)       │
                     │  ─ Mandate Stone editor      │
                     │  ─ Time Capsule / Activity   │
                     │  ─ Wallet (viem + wagmi)     │
                     │  ─ Ephemeral session-key gen │
                     └──────────────┬───────────────┘
                                    │  server functions (typed RPC)
                                    ▼
      ┌─────────────────────────────────────────────────────────┐
      │                  Edge Server Runtime                    │
      │                                                         │
      │  Policy Engine (pure, deterministic)                    │
      │  Quote Adapters ─┬─ Uniswap Trading API (proxy)         │
      │                  └─ Onchain Universal Router fallback   │
      │  Oracle Reader (Chainlink feeds + staleness guard)      │
      │  Preflight (sequencer + feed health)                    │
      │  Session-Key Store (AES-256-GCM at rest)                │
      │  Eligibility Attestation Ledger                         │
      │  MCP Client (OAuth-bound Robinhood brokerage)           │
      └──────────────┬───────────────────────────┬──────────────┘
                     │                           │
                     ▼                           ▼
        ┌───────────────────────┐   ┌───────────────────────────┐
        │  Robinhood Chain L2   │   │  Robinhood Trading MCP    │
        │  (chain id 4663)      │   │  (agent.robinhood.com)    │
        │  ─ Stock Tokens       │   │  ─ Agentic brokerage acct │
        │  ─ Chainlink feeds    │   │                           │
        │  ─ Universal Router   │   │                           │
        └───────────────────────┘   └───────────────────────────┘
```

**Stack:** React 19 · TypeScript (strict) · TanStack Start (SSR, server functions, file routes) · Tailwind v4 · shadcn/ui · Framer Motion · Recharts · viem · wagmi · Alchemy Account Kit · Postgres with row-level security.

***

## 4. Core Concepts

### 4.1 Mandate Stone

The **Mandate Stone** is a human-readable investment constitution. It is authored in the *Agent Lab*, cryptographically bound to the user, and compiled into an enforceable permissions object.

A Mandate declares:

* **Universe** — allowlist of Stock Tokens the agent may touch.
* **Sizing** — max notional per trade, daily aggregate cap, per-asset cap.
* **Price discipline** — max acceptable slippage bps, min oracle freshness, min liquidity depth.
* **Cadence** — cooldown between trades, review interval.
* **Kill conditions** — auto-revoke on drawdown / cap breach / oracle stall.
* **Expiry** — hard TTL after which the mandate must be renewed.

The Stone is the *only* source of authority. If a proposal is not expressible within the compiled permissions, it cannot execute — irrespective of what the model recommends.

### 4.2 Proof of Restraint

Every rejected proposal is written to an append-only ledger with:

* The proposal (asset, side, size, thesis).
* The **rule that blocked it** (structured reason code + human copy).
* The oracle snapshot at the moment of evaluation.
* The mandate revision hash.

*Proof of Restraint* is the counterpart to the trade ledger: it makes the agent's **inaction** as auditable as its action.

### 4.3 Time Capsule

Every executed trade is sealed with:

* Written **thesis** at time of execution.
* **Confidence range** (LLM-declared, not treated as truth).
* Evidence timestamps (oracle round id, block number, quote id).
* **Scheduled review date** — the mandate re-evaluates the position on that date and produces a follow-up capsule (hold / trim / exit + why).

### 4.4 Time Stop

A persistent, always-visible control in the top navigation. One click:

1. Revokes every active session key.
2. Marks the smart account as read-only.
3. Writes a `time_stop_triggered` audit event.
4. Requires a fresh mandate signature to resume autonomy.

### 4.5 Session Keys

Short-lived EOAs generated **in the browser**, whose permissions are the deterministic image of the Mandate Stone. See [§ 8](#8-smart-accounts--session-keys).

***

## 5. Routes & Screens

| Route        | Purpose                                                                                                                                                                                    |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `/`          | Landing. Product story, mandate walkthrough, demo mode entry.                                                                                                                              |
| `/auth`      | Sign-in and eligibility attestation.                                                                                                                                                       |
| `/app`       | Dashboard: active mandate, session state, PnL, next reviews.                                                                                                                               |
| `/agent-lab` | Mandate Stone authoring, permission preview, compile & sign.                                                                                                                               |
| `/markets`   | Stock Token browser with live Chainlink prices, multipliers, and metadata.                                                                                                                 |
| `/live`      | Production execution readiness gates, **Run agent tick** dry-run panel, and **Scheduled agent queue** (`agent_intents`) that pg\_cron drains every minute through the same executor core.  |
| `/activity`  | Real-time Time Capsule timeline and Proof of Restraint ledger (Postgres change stream via `supabase_realtime`), with CSV and PDF export of the blocked-decisions report for audit sharing. |
| `/safety`    | Session-key management, Time Stop, sequencer/feed health, revocation history.                                                                                                              |
| `/brokerage` | Optional: Robinhood Trading MCP connection status and offchain activity.                                                                                                                   |

***

## 6. The Policy Engine

Location: `src/lib/policy/evaluate.ts`.

**Pure function. No I/O. Fully testable.**

Signature:

```ts
evaluate(proposal, mandate, oracleSnapshot, portfolioState) → Decision
```

`Decision` is a discriminated union:

```ts
type Decision =
  | { kind: "allow"; permissions: CompiledPermissions; quoteConstraints: QuoteConstraints }
  | { kind: "reject"; reasonCode: RejectReason; explanation: string };
```

**Rejection reason codes** (non-exhaustive):

| Code                             | Meaning                                  |
| -------------------------------- | ---------------------------------------- |
| `ASSET_NOT_IN_UNIVERSE`          | Symbol not in the mandate allowlist.     |
| `NOTIONAL_EXCEEDS_PER_TRADE_CAP` | Size > per-trade cap.                    |
| `NOTIONAL_EXCEEDS_DAILY_CAP`     | Would breach 24h aggregate cap.          |
| `COOLDOWN_ACTIVE`                | Prior trade too recent.                  |
| `ORACLE_STALE`                   | Chainlink round age > max.               |
| `ORACLE_MISSING`                 | No feed registered for asset.            |
| `SEQUENCER_DOWN`                 | L2 sequencer uptime feed reports outage. |
| `SLIPPAGE_EXCEEDS_TOLERANCE`     | Quote slippage > mandate bound.          |
| `MANDATE_EXPIRED`                | Mandate TTL has passed.                  |
| `KILL_SWITCH_TRIPPED`            | Drawdown or breach kill condition met.   |
| `SESSION_KEY_MISSING`            | No active, unexpired session key.        |

The engine is deterministic: identical inputs always yield identical decisions. This is what makes *Proof of Restraint* meaningful.

***

## 7. Onchain Execution Pipeline

For a Stock Token swap on Robinhood Chain, the pipeline is:

```
LLM proposal
   │
   ▼
Policy Engine.evaluate()  ──► reject → Proof of Restraint ledger
   │ allow
   ▼
Quote provider (Uniswap Trading API → onchain Universal Router fallback)
   │
   ▼
Oracle re-read (Chainlink)     ──► stale → reject
Preflight (sequencer health)   ──► down  → reject
Slippage delta vs oracle       ──► breach → reject
   │
   ▼
checkAgainstPermissions(userOp, compiledPermissions)  ──► fail → reject
   │
   ▼
Sign UserOperation with session key (ephemeral, browser-generated)
   │
   ▼
Submit via Alchemy bundler + Gas Manager (sponsored gas)
   │
   ▼
Wait for receipt → seal Time Capsule
```

Every arrow that ends in **reject** is written to the ledger with the reason code, oracle snapshot, and mandate hash.

***

## 8. Smart Accounts & Session Keys

### 8.1 Account model

* **Smart account:** Alchemy Light Account on Robinhood Chain (`chainId: 4663`) via `@account-kit/smart-contracts`.
* **Signer paths:**
  * `user-wallet` — human-in-the-loop, browser wallet signs each UserOp.
  * `session-key` — ephemeral EOA signs autonomously within compiled permissions.
* **Gas:** Sponsored via Alchemy Gas Manager Policy.

### 8.2 Session-key lifecycle

```
Agent Lab: sign Mandate
      │
      ▼
Browser: crypto.getRandomValues → generate ephemeral privateKey
      │
      ▼
Compile Mandate → Permissions {
   allowedTargets:  [routers, universeTokens],
   allowedSelectors: [ERC20.approve, UniversalRouter.execute],
   perOpCap, dailyCap, cooldown, expiry
}
      │
      ▼
Server: AES-256-GCM encrypt(privateKey)  →  agent_sessions table
      │
      ▼
Autonomous execution (each UserOp):
   checkAgainstPermissions(uo) → sign with session key → submit
      │
      ▼
Time Stop OR expiry OR kill switch:
   mark session revoked, write session_key_revoked event
```

### 8.3 On-chain enforcement note

Alchemy's Light Account v2 does not ship a native session-key permissions plugin. In this build, permissions are enforced by **two independent layers**:

1. The **policy engine**, before proposal admission.
2. The **pre-sign guard** (`checkAgainstPermissions`), before the session key signs anything.

The compiled permissions object is already shaped to swap into a Modular Account with an on-chain session-key plugin when the ecosystem catches up — the compiler output is the contract, not the enforcer.

Files: `src/lib/chain/smart-account.ts`, `session-key.ts`, `session-key-client.ts`, `session-key.functions.ts`, `session-executor.server.ts`, `session-executor-core.server.ts`, `session-executor.functions.ts`.

### 8.4 Autonomous executor (`runProposalForUser`)

The executor lives in `src/lib/chain/session-executor-core.server.ts` as a plain server-only function. Two callers share this exact code path:

* `executeProposalWithSessionKey` — authenticated `createServerFn` invoked by the **Run agent tick** panel on `/live`.
* `POST /api/public/hooks/agent-tick` — bearer-authenticated cron endpoint invoked by pg\_cron every minute to drain the `agent_intents` queue.

Every terminal branch writes a durable row so `/activity` can show exactly what happened and why.

```
proposal
   ├─► load active mandate + rules             ─► none    → reject: no_mandate
   ├─► load active session key                 ─► expired → reject: session_expired
   ├─► deterministic policy.evaluate()         ─► block   → reject: policy   (proposals.status = blocked, policy_decisions row)
   ├─► multi-provider quote (see §11)          ─► fail    → reject: quote    (proposals.status = rejected, quote_attempts[] audited)
   │      • router allowlist check
   │      • buyToken == registry token check
   │      • quote-expiry check
   ├─► open executions row (status = signing)
   ├─► rebuild Alchemy Light Account from decrypted session key
   │      • assert derived address == stored smart_account
   ├─► optional ERC-20 approve UO
   │      • pre-sign guard vs compiled permissions ─► fail → guard_blocked
   ├─► swap UO
   │      • pre-sign guard vs compiled permissions ─► fail → guard_blocked
   │      • on-chain failure                      ─► fail → onchain
   └─► seal execution (confirmed) + audit_events(session_key_executed with quote_source + quote_attempts[])
```

Key invariants:

* The session-key private material is decrypted **only in memory** inside the handler; the derived signer address must match the address stored at issue time or execution aborts.
* The pre-sign guard (`checkAgainstPermissions`) runs **twice** per swap — once for the approve UO, once for the swap UO — and is independent of the up-front policy check.
* Every quote's `to` and `allowanceTarget` must be in `CANONICAL_ROUTERS`; a rogue or malicious quote pointing at an arbitrary contract cannot be signed regardless of which provider returned it.
* Alchemy Gas Manager sponsorship is required — missing `ALCHEMY_API_KEY` or `ALCHEMY_GAS_POLICY_ID` aborts before signing.

### 8.5 Scheduled agent tick (`/api/public/hooks/agent-tick`)

Users queue trade intents from the **Scheduled agent queue** panel on `/live`. Each intent is a row in `agent_intents` (`pending` → `processing` → `done` / `failed` / `cancelled`). A pg\_cron job POSTs to `/api/public/hooks/agent-tick` every minute with `Authorization: Bearer $CRON_SECRET`; the handler:

1. Timing-safe compares the bearer against `CRON_SECRET`.
2. Atomically claims up to 5 due-now intents by flipping their `status` from `pending` to `processing`.
3. Runs each through `runProposalForUser` — the same executor core as the manual button.
4. Writes the full `RunResult` back to the intent's `last_result` and sets terminal status.

Cancelling a pending intent (owner-scoped, RLS-enforced) removes it from the queue before it is claimed. Revoking the session key on `/safety` hard-stops every subsequent tick because the executor rejects at the `no_session` / `session_expired` gate.

### 8.6 Run agent tick (dry run)

`/live` also exposes a **Run agent tick** panel that invokes `executeProposalWithSessionKey` synchronously with a mocked market snapshot and configurable symbol / amount / slippage / thesis. It hits the same executor core, so:

* With gates red or no session key issued, it renders the **exact stage** that blocked (`no_mandate`, `no_session`, `policy`, `quote`, `presign_guard`, `onchain`) plus the structured reasons. This is Proof of Restraint made visible.
* With every gate green, mandate rail set to Robinhood Chain, and a session key active on `/safety`, it will sign and submit a real UserOperation.

The panel is labeled DRY RUN but does not neuter the pipeline; a green environment produces real onchain writes.

***

## 9. Canonical Registry

Location: `src/lib/chain/registry.server.ts`.

The registry is the **only** source of truth for token and feed addresses. Nothing in the app resolves an asset by ticker alone.

* **35 canonical assets:** WETH, USDG, and 33 Stock/ETF Tokens (NVDA, AAPL, SPY, …).
* Each entry: `{ symbol, address, decimals: 18, chainlinkFeed, kind: "stock" | "etf" | "quote" | "gas" }`.
* Feed values already incorporate the ERC-8056 UI multiplier for corporate actions. **Never multiply a second time.**
* Router registry (`CANONICAL_ROUTERS`) is populated only for verified deployments on chain `4663`.

Lookup helpers refuse to return an entry that is missing an oracle feed for kinds that require pricing.

***

## 10. Oracle & Preflight Safety

Location: `src/lib/chain/oracle.functions.ts`, `preflight.functions.ts`.

Before *and after* quoting, the pipeline runs:

1. **Feed presence check** — asset has a Chainlink feed in the registry.
2. **Round staleness** — `block.timestamp - answerUpdatedAt ≤ maxStaleness` (per-asset, defaults to 30 min for equities during market hours).
3. **Answer validity** — non-negative, non-zero, within sanity bounds vs prior round.
4. **L2 sequencer health** — Arbitrum-Nitro sequencer status endpoint (Chainlink sequencer uptime feed for Robinhood Chain will be swapped in when Chainlink publishes it).
5. **Slippage vs oracle** — quoted execution price cannot deviate from oracle mid by more than the mandate's `maxSlippageBps`.

Any failure short-circuits the pipeline and writes a *Proof of Restraint* entry.

***

## 11. Quote Providers

The executor calls a single adapter — `fetchExecutableQuote` in `src/lib/chain/quote-provider.server.ts` — that tries venues in order and records every attempt (success or failure reason) in the audit trail. First success wins; total failure returns `all_quote_providers_failed` with per-venue reasons.

| Order | Provider            | Source                                                     | Auth                                                                                               | Notes |
| ----- | ------------------- | ---------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | ----- |
| 1     | Uniswap Trading API | `UNISWAP_TRADING_API_KEY`                                  | Signed executable quote (`v1/quote` + `v1/swap`) on chain 4663 via `UniswapTradingClient`.         |       |
| 2     | Generic RFQ         | `QUOTE_PROVIDER_URL` (+ optional `QUOTE_PROVIDER_API_KEY`) | HTTPS `POST` returning normalized quote shape. Drop-in slot for 0x, Rialto, Lighter, Arcus, 1inch. |       |

Every returned quote is normalized to the same shape (`to`, `data`, `value`, `sellToken`, `buyToken`, `sellAmount`, `buyAmount`, `allowanceTarget`, `price`, `expiresAt`) and then re-validated: router allowlist, `buyToken` matches the registry, non-native `data` is hex, and expiry is inside `[5s, 600s]`. The LLM never appears here — calldata comes only from the trusted provider or a whitelisted router ABI.

Executed trades record `quote_source` and `quote_attempts[]` in `audit_events.payload`, so `/activity` can show which venue actually filled and which were down.

Files: `src/lib/chain/quote-provider.server.ts`, `quote.functions.ts`, `quote-uniswap.functions.ts`, `uniswap-trading.server.ts`, `uniswap-trading.functions.ts`.

***

## 12. Robinhood Trading MCP (Off-chain Brokerage)

Optional secondary rail for U.S. equities via Robinhood's Agentic Trading MCP at `https://agent.robinhood.com/mcp/trading`.

* OAuth 2.0 with PKCE; tokens stored encrypted (AES-256-GCM) using `MCP_TOKEN_ENC_KEY`.
* Bound to a **dedicated Agentic brokerage account** with a user-set reserved budget.
* The same policy engine gates MCP tool calls: `place_order` is only admitted if the equivalent proposal passes mandate checks.
* Per-tool spend caps and per-tool cooldowns applied server-side.
* Every tool call is written to the activity ledger with request/response digest.

Clearly labeled in the UI as **"Brokerage, offchain"** — this rail does not touch Stock Tokens or Robinhood Chain.

Files: `src/lib/mcp/*`.

***

## 13. Eligibility & Jurisdiction Gating

Robinhood Stock Tokens are unavailable to U.S. persons and restricted in additional jurisdictions (including Canada, the United Kingdom, and Switzerland). Enforcement is layered:

1. **Server-side region signal** at the API boundary — restricted regions receive a hard block, not a UI hide.
2. **Explicit user self-attestation** captured, versioned, and stored in the `eligibility_attestations` ledger.
3. **Attestation freshness** required at trade time — stale attestations force re-attestation before any execution path opens.

Files: `src/lib/eligibility/*`, `src/components/EligibilityGate.tsx`.

***

## 14. Data Model

All tables live in Postgres with row-level security enabled. Highlights:

| Table                        | Purpose                                                                                                                                                                                                                                                                                                                   | Access                  |
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- |
| `mandates` + `mandate_rules` | Versioned Mandate Stones and their compiled rule rows.                                                                                                                                                                                                                                                                    | Owner read/write.       |
| `agent_sessions`             | Encrypted session keys, smart-account + signer addresses, compiled permissions, expiry, revocation state.                                                                                                                                                                                                                 | **Service role only.**  |
| `proposals`                  | Every LLM-generated proposal, admitted or not (`pending` → `blocked` / `rejected` / `executed`).                                                                                                                                                                                                                          | Owner read.             |
| `policy_decisions`           | Policy engine outputs with reason codes, joined to proposals.                                                                                                                                                                                                                                                             | Owner read.             |
| `executions`                 | Executed swaps — status (`signing` / `guard_blocked` / `failed` / `confirmed`), tx hash, filled units/price.                                                                                                                                                                                                              | Owner read.             |
| `agent_intents`              | Queue of user-scheduled trade intents drained by pg\_cron (`pending` → `processing` → `done` / `failed` / `cancelled`), with `attempts`, `last_result`, `scheduled_after`, `claimed_at`.                                                                                                                                  | Owner read/write.       |
| `mcp_connections`            | Encrypted OAuth tokens for the brokerage rail.                                                                                                                                                                                                                                                                            | **Service role only.**  |
| `eligibility_attestations`   | Signed jurisdiction attestations.                                                                                                                                                                                                                                                                                         | Owner read.             |
| `audit_events`               | Append-only lifecycle events (`session_key_issued`, `session_key_revoked`, `session_key_executed` — includes `quote_source` + `quote_attempts[]` — `time_stop_triggered`, …). Streamed to `/activity` via Supabase Realtime (`supabase_realtime` publication covers `audit_events`, `proposals`, and `policy_decisions`). | Owner read (sanitized). |

Sensitive tables (`agent_sessions`, `mcp_connections`) have **no user policies** — access flows exclusively through vetted server functions.

***

## 15. Security Model

* **Non-custodial.** Users hold the smart-account signer. Session keys are ephemeral, revocable, and scoped.
* **Encryption at rest.** Session-key private material and MCP OAuth tokens are AES-256-GCM encrypted with a server-only key.
* **Row-level security everywhere.** Every `public` table has RLS enabled and explicit `GRANT`s aligned to policy.
* **Deterministic authority.** The compiled permissions object is the sole authorization artifact accepted by the executor.
* **Pre-sign guard.** Even with a valid session key, the executor refuses to sign a UserOperation whose target/selector/value falls outside the compiled permissions.
* **Time Stop.** One-click universal revocation, exposed on every screen.
* **Kill switches.** Drawdown, cap breach, and oracle stall auto-revoke.
* **Audit trail.** Session issue/revoke, mandate changes, MCP connect/disconnect, jurisdiction attestations, and Time Stop events are append-only.
* **LLM containment.** Models return **structured proposals only**. They never produce calldata, addresses, amounts as strings, or sign anything.

***

## 16. Configuration & Environment

Public config (safe in browser): chain id, RPC URL, canonical registry, brand strings.

Server-only secrets:

| Variable                                        | Purpose                                                                                           |
| ----------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| `ALCHEMY_API_KEY`                               | Bundler + Gas Manager on Robinhood Chain.                                                         |
| `ALCHEMY_GAS_POLICY_ID`                         | Gas sponsorship policy id.                                                                        |
| `RPC_URL_ROBINHOOD_CHAIN`                       | Authenticated RPC endpoint.                                                                       |
| `MCP_TOKEN_ENC_KEY`                             | 32-byte key for AES-256-GCM (session keys + MCP tokens).                                          |
| `MCP_OAUTH_CLIENT_ID` / `_SECRET`               | Robinhood Trading MCP OAuth client.                                                               |
| `UNISWAP_TRADING_API_KEY`                       | Primary quote provider (Uniswap Trading API on chain 4663).                                       |
| `QUOTE_PROVIDER_URL` / `QUOTE_PROVIDER_API_KEY` | Fallback RFQ venue endpoint + optional bearer.                                                    |
| `CRON_SECRET`                                   | Bearer token pg\_cron sends to `/api/public/hooks/agent-tick`; verified with timing-safe compare. |

Secrets are read **inside server-function handlers**, never at module scope of shared files.

***

## 17. Brand & IP Safety

* Codename **"Celebi"** and all mascot pixel-art are placeholder assets referencing third-party IP.
* All name, tagline, and imagery references route through `src/config/brand.ts`.
* Before any commercial launch: rename, replace artwork with licensed or original assets, and remove the codename from persisted data.
* Disclaimers baked into `brand.disclaimers` are rendered wherever the mascot appears.

***

## 18. Roadmap

* Populate `CANONICAL_ROUTERS` for verified deployments on chain `4663`.
* Modular Account migration for **on-chain** session-key permission enforcement (compiler output already shaped for it).
* Chainlink L2 Sequencer Uptime Feed swap-in when published for Robinhood Chain.
* Third and fourth RFQ venue adapters (0x, 1inch) behind the existing `fetchExecutableQuote` waterfall — the adapter shape is stable.
* On-chain Time Stop: extend `/safety` revoke to call `uninstallSessionKey` on the smart account (currently DB-only revoke).
* Surface sequencer + Chainlink staleness banners in the UI (logic exists in preflight; not yet rendered pre-trade).
* Server-side jurisdiction gate as `_authenticated` middleware (client attestation today).
* Time Capsule: populate + render thesis / confidence / evidence timestamps / review date fields (columns exist).
* Proof of Restraint public share link (read-only tokenized URL).
* Rate-limit `issueWalletNonce`.
* Per-tool spend caps and cooldowns for the MCP rail (UI surface).
* Observability: policy-decision metrics, oracle health SLOs, revocation reason breakdowns, executor stage histograms.
* Legal copy review across landing, `/auth`, `/agent-lab`, and `/markets`.
* Brand IP swap (codename + artwork).

***

## 19. Glossary

* **Robinhood Chain** — Arbitrum-based EVM L2, chain id `4663` (mainnet), `46630` (testnet). ETH for gas.
* **Stock Token** — ERC-20 (18 decimals) representing economic exposure to a referenced security. Uses ERC-8056 UI multiplier for corporate actions. Issued as tokenized debt; no beneficial ownership of the underlying share.
* **Chainlink feed** — Price oracle whose answer already incorporates the token's UI multiplier.
* **Mandate Stone** — User-authored, signed investment constitution.
* **Compiled Permissions** — Deterministic image of the Mandate: allowed targets, selectors, caps, cooldown, expiry.
* **Session Key** — Ephemeral EOA that signs autonomously within Compiled Permissions.
* **Time Capsule** — Sealed record of a trade: thesis, confidence, evidence, review date.
* **Proof of Restraint** — Ledger of rejected proposals with reason codes.
* **Time Stop** — Universal revoke-and-freeze control.
* **MCP** — Model Context Protocol; used here for the optional Robinhood Trading brokerage rail.

***

## 20. Legal Notice

Nothing in this repository or its documentation is investment, legal, or tax advice. All prices, balances, quotes, transactions, and performance shown in demo mode are simulated. Robinhood Stock Tokens are tokenized debt securities and are **not** direct ownership of the referenced shares; they confer no voting rights and availability is jurisdiction-dependent. Users are responsible for verifying eligibility under applicable law. The project is not affiliated with, endorsed by, or sponsored by Robinhood, Nintendo, The Pokémon Company, Chainlink, Alchemy, Uniswap, or any other named third party.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://celebi-fund.gitbook.io/untitled/readme.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
