> ## Documentation Index
> Fetch the complete documentation index at: https://ouroborai.xyz/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# SDK Modules

> Package dependency graph and module exports

ouroborai is structured as a Bun workspace monorepo. Packages are scoped
under `@arb-agent/` and apps live in the `apps/` directory.

## Dependency Graph

```
@arb-agent/sdk
  |
  +-- @arb-agent/adapters
  |     |
  |     +-- @arb-agent/skills
  |     +-- apps/api
  |     +-- apps/mcp-server
  |
  +-- @arb-agent/timeboost
  |     |
  |     +-- apps/api
  |     +-- apps/mcp-server
  |
  +-- @arb-agent/smart-account
        |
        +-- apps/api
        +-- apps/mcp-server
```

Build order: `sdk` first, then `adapters`, `skills`, `timeboost`, and
`smart-account` in parallel, and finally the apps.

***

## @arb-agent/sdk

**Path**: `packages/sdk/`

The foundation package containing chain configuration, contract addresses,
type definitions, token resolution, and wallet utilities.

### Key Exports

| Export            | Module      | Description                                               |
| ----------------- | ----------- | --------------------------------------------------------- |
| `arbitrumOne`     | `chain.ts`  | Arbitrum One chain definition (id: 42161)                 |
| `robinhoodChain`  | `chain.ts`  | Robinhood Chain definition (id: 46630)                    |
| `CONTRACTS`       | `chain.ts`  | All contract addresses (DEX, lending, tokens, etc.)       |
| `CHAINLINK_FEEDS` | `chain.ts`  | Chainlink price feed addresses                            |
| `ArbWallet`       | `wallet.ts` | Wallet wrapper (public + wallet clients, balance queries) |
| `resolveToken`    | `tokens.ts` | Symbol-to-address resolution                              |

### Type Exports

Core types used across all packages:

| Type                                          | Description                     |
| --------------------------------------------- | ------------------------------- |
| `SwapParams`, `SwapQuote`                     | Trade parameter and quote types |
| `OpenPerpParams`, `PerpPosition`, `PerpSide`  | Perpetual position types        |
| `SupplyParams`, `BorrowParams`, `AccountData` | Lending types                   |
| `ExpressLaneBid`, `ExpressLaneStatus`         | TimeBoost types                 |
| `Job`, `JobStatus`                            | Job queue types                 |
| `Thread`, `ThreadMessage`, `ThreadRole`       | Conversation thread types       |
| `RwaStockInfo`                                | Tokenized RWA stock types       |
| `Skill`                                       | Skill metadata type             |
| `ApiKey`, `ApiKeyTier`                        | API key types                   |
| `BridgeParams`, `BridgeQuote`, `BridgeRoute`  | Cross-chain bridge types        |
| `TokenLaunchParams`, `LaunchedToken`          | Token launchpad types           |
| `PredictionMarket`, `MarketOutcome`           | Prediction market types         |
| `AlchemixVariant`, `AlchemixAccountData`      | Alchemix V2 types               |

### Contract Addresses

`CONTRACTS` includes addresses for:

* **DEX**: Uniswap V3 Universal Router, SwapRouter02, Camelot Router, Pendle Router
* **Lending**: Aave V3 Pool, Data Provider, Oracle
* **Account Abstraction**: EntryPoint v0.6, Pimlico EntryPoint v1
* **TimeBoost**: Auction contract
* **Tokens**: USDC, USDC.e, WETH, ARB, WBTC, PENDLE, GRAIL, aUSDC
* **Alchemix**: AlchemistV2 (alETH + alUSD), Transmuters, WETH Gateway

***

## @arb-agent/adapters

**Path**: `packages/adapters/`

Protocol-specific adapters that wrap on-chain interactions behind a uniform
interface. Each adapter takes a `PublicClient`, `WalletClient`, and account
address.

### Exports

| Adapter             | Protocol            | Capabilities                                 |
| ------------------- | ------------------- | -------------------------------------------- |
| `UniswapV3Adapter`  | Uniswap V3          | quote, swap                                  |
| `CamelotAdapter`    | Camelot DEX         | quote, swap                                  |
| `GmxV2Adapter`      | GMX V2              | openPosition, closePosition, getPositions    |
| `AaveV3Adapter`     | Aave V3             | supply, borrow, repay, getAccountData        |
| `RwaAdapter`        | Robinhood Chain     | findBySymbol, getStockInfo, getRegistryStats |
| `BridgeAdapter`     | Cross-chain bridges | quote, getSupportedChains                    |
| `AlchemixAdapter`   | Alchemix V2         | getAccountData, getSupportedTokens           |
| `PolymarketAdapter` | Polymarket          | searchMarkets, getTopMarkets, getMarket      |

***

## @arb-agent/timeboost

**Path**: `packages/timeboost/`

TimeBoost express lane bidder and reseller.

### Exports

| Export             | Description                                             |
| ------------------ | ------------------------------------------------------- |
| `TimeBoostBidder`  | Main bidder class with bid loop, MEV estimation, resale |
| `TimeBoostConfig`  | Configuration type for the bidder                       |
| `RoundOpportunity` | Round profit estimation type                            |
| `AuctioneerStats`  | Aggregate auctioneer statistics type                    |
| `ResaleSlot`       | Express lane resale slot type                           |

See [Configure TimeBoost](/docs/guides/configure-timeboost) for usage details.

***

## @arb-agent/smart-account

**Path**: `packages/smart-account/`

ERC-4337 smart account wrapper using ZeroDev Kernel.

### Exports

| Export              | Description                                      |
| ------------------- | ------------------------------------------------ |
| `AgentSmartAccount` | Kernel smart account with session key management |
| `createSessionKey`  | Create a scoped session key with spending limits |

Session keys allow the agent to trade autonomously within defined constraints
(allowed protocols, spending limits, time window) without exposing the master
private key.

***

## @arb-agent/skills

**Path**: `packages/skills/`

Skill loader for fetching and caching SKILL.md documentation bundles.

### Exports

| Export        | Description                             |
| ------------- | --------------------------------------- |
| `SkillLoader` | Class for loading skills by name or URL |
| `skillLoader` | Singleton instance with 1-hour cache    |

Built-in skills: `arb-trade`, `gmx`, `camelot`, `pendle`, `aave`, `kyan`,
`rwa-stocks`, `timeboost-bid`.

See [Add a Skill](/docs/guides/add-a-skill) for details on creating custom skills.

***

## Apps

| App          | Path               | Description                            |
| ------------ | ------------------ | -------------------------------------- |
| `api`        | `apps/api/`        | Hono REST API server                   |
| `web`        | `apps/web/`        | Next.js 15 web terminal                |
| `telegram`   | `apps/telegram/`   | grammY Telegram bot                    |
| `mcp-server` | `apps/mcp-server/` | MCP server for Claude Code integration |

## Build Notes

* `@zerodev/*`, `permissionless`, and `tslib` must be marked `--external`
  in Bun build to avoid bundling errors
* Bun stores resolved packages in `node_modules/.bun/`
* The web app inlines types from `@arb-agent/sdk` to avoid pulling
  Node.js-only modules (`ArbWallet`) into client bundles
