repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | /** |
| #2 | * leviathan/src/agent/tools.ts — Anthropic ACP tool definitions for Claude |
| #3 | * |
| #4 | * These are the "claws" — the tools a leviathan can strike with. |
| #5 | * Filtered by depth tier before being sent to the model. |
| #6 | * |
| #7 | * Depth surface: |
| #8 | * deep — all tools |
| #9 | * shallow — all except spawn_spawnling, jupiter_swap |
| #10 | * shoreline — solana_balance, wallet_brief, ooda_signal, shell_write, Clawd Memory tools, hold |
| #11 | * beached — process exits before any tool is called |
| #12 | */ |
| #13 | |
| #14 | import type { Tool } from '@anthropic-ai/sdk/resources/messages.js'; |
| #15 | |
| #16 | export const TOOLS: Tool[] = [ |
| #17 | // ── Wallet / Solana ────────────────────────────────────────────────────── |
| #18 | { |
| #19 | name: 'solana_balance', |
| #20 | description: 'Check SOL, USDC, and $CLAWD balances for a Solana wallet address via the AgenticWallet shim.', |
| #21 | input_schema: { |
| #22 | type: 'object' as const, |
| #23 | properties: { |
| #24 | address: { type: 'string', description: 'Solana base58 pubkey. Omit to check own wallet.' }, |
| #25 | }, |
| #26 | required: [], |
| #27 | }, |
| #28 | }, |
| #29 | { |
| #30 | name: 'wallet_brief', |
| #31 | description: 'Get a brief summary of the leviathan wallet: pubkey, SOL balance, USDC balance, cluster.', |
| #32 | input_schema: { type: 'object' as const, properties: {}, required: [] }, |
| #33 | }, |
| #34 | { |
| #35 | name: 'helius_transactions', |
| #36 | description: 'Get the last 10 parsed transactions for a Solana wallet via Helius enhanced API.', |
| #37 | input_schema: { |
| #38 | type: 'object' as const, |
| #39 | properties: { |
| #40 | address: { type: 'string', description: 'Solana base58 pubkey.' }, |
| #41 | }, |
| #42 | required: ['address'], |
| #43 | }, |
| #44 | }, |
| #45 | |
| #46 | // ── Clawd Memory ──────────────────────────────────────────────────────── |
| #47 | { |
| #48 | name: 'clawd_memory_recall', |
| #49 | description: 'Recall durable Clawd Brain memories before acting. Use for prior decisions, wallet notes, protocol research, preferences, and risk context.', |
| #50 | input_schema: { |
| #51 | type: 'object' as const, |
| #52 | properties: { |
| #53 | query: { type: 'string', description: 'Specific memory query.' }, |
| #54 | topK: { type: 'number', description: 'Maximum results. Default 6.' }, |
| #55 | }, |
| #56 | required: ['query'], |
| #57 | }, |
| #58 | }, |
| #59 | { |
| #60 | name: 'clawd_memory_remember', |
| #61 | description: 'Write a durable memory into Clawd Brain. Never store secrets. Use for decisions, risk findings, protocol notes, wallet labels, and learnings.', |
| #62 | input_schema: { |
| #63 | type: 'object' as const, |
| #64 | properties: { |
| #65 | title: { type: 'string', description: 'Short durable title.' }, |
| #66 | content: { type: 'string', description: 'Factual content to remember. No secrets.' }, |
| #67 | kind: { type: 'string', enum: ['agent', 'research', 'signal', 'trade', 'protocol', 'wallet', 'perp', 'note'], description: 'Memory kind.' }, |
| #68 | tags: { type: 'array', items: { type: 'string' }, description: 'Tags such as clawd, leviathan, solana, wallet, perp.' }, |
| #69 | importance: { type: 'number', description: '0.0 to 1.0. Default 0.7.' }, |
| #70 | }, |
| #71 | required: ['title', 'content'], |
| #72 | }, |
| #73 | }, |
| #74 | { |
| #75 | name: 'clawd_memory_research', |
| #76 | description: 'Archive a URL or queue a research topic into the Clawd markdown vault for later recall.', |
| #77 | input_schema: { |
| #78 | type: 'object' as const, |
| #79 | properties: { |
| #80 | target: { type: 'string', description: 'URL or research topic.' }, |
| #81 | tags: { type: 'array', items: { type: 'string' }, description: 'Research tags.' }, |
| #82 | }, |
| #83 | required: ['target'], |
| #84 | }, |
| #85 | }, |
| #86 | |
| #87 | // ── Jupiter DEX ────────────────────────────────────────────────────────── |
| #88 | { |
| #89 | name: 'jupiter_quote', |
| #90 | description: 'Get a DEX swap quote from Jupiter aggregator. No execution — use for price discovery.', |
| #91 | input_schema: { |
| #92 | type: 'object' as const, |
| #93 | properties: { |
| #94 | inputMint: { type: 'string', description: 'Input token mint or symbol (SOL, USDC, CLAWD).' }, |
| #95 | outputMint: { type: 'string', description: 'Output token mint or symbol.' }, |
| #96 | amount: { type: 'string', description: 'Input amount in base units (lamports for SOL, 1e6 for USDC).' }, |
| #97 | slippageBps: { type: 'number', description: 'Slippage tolerance in bps. Default 50.' }, |
| #98 | }, |
| #99 | required: ['inputMint', 'outputMint', 'amount'], |
| #100 | }, |
| #101 | }, |
| #102 | { |
| #103 | name: 'jupiter_swap', |
| #104 | description: 'Execute a token swap via Jupiter. Paper mode on devnet — returns quote without broadcasting. Requires depth=shallow+.', |
| #105 | input_schema: { |
| #106 | type: 'object' as const, |
| #107 | properties: { |
| #108 | inputMint: { type: 'string' }, |
| #109 | outputMint: { type: 'string' }, |
| #110 | amount: { type: 'string', description: 'Input amount in base units.' }, |
| #111 | slippageBps: { type: 'number', description: 'Slippage in bps. Default 50.' }, |
| #112 | }, |
| #113 | required: ['inputMint', 'outputMint', 'amount'], |
| #114 | }, |
| #115 | }, |
| #116 | |
| #117 | // ── OODA signal ────────────────────────────────────────────────────────── |
| #118 | { |
| #119 | name: 'ooda_signal', |
| #120 | description: 'Run one Dark Ralph OODA tick for market analysis. Returns hold/open/close signal with momentum score.', |
| #121 | input_schema: { |
| #122 | type: 'object' as const, |
| #123 | properties: { |
| #124 | token: { type: 'string', description: 'Token symbol or mint to analyze.' }, |
| #125 | }, |
| #126 | required: ['token'], |
| #127 | }, |
| #128 | }, |
| #129 | |
| #130 | // ── Google A2A ─────────────────────────────────────────────────────────── |
| #131 | { |
| #132 | name: 'a2a_task', |
| #133 | description: 'Discover and send a task to another A2A-compatible agent via Google A2A protocol with x402 payment gating.', |
| #134 | input_schema: { |
| #135 | type: 'object' as const, |
| #136 | properties: { |
| #137 | agentUrl: { type: 'string', description: 'Base URL of the peer agent.' }, |
| #138 | skill: { type: 'string', description: 'Skill ID to invoke (from agent card).' }, |
| #139 | message: { type: 'string', description: 'Task message text.' }, |
| #140 | }, |
| #141 | required: ['agentUrl', 'skill', 'message'], |
| #142 | }, |
| #143 | }, |
| #144 | |
| #145 | // ── pay.sh confidential payments ───────────────────────────────────────── |
| #146 | { |
| #147 | name: 'paysh_pay', |
| #148 | description: 'Make a confidential payment via pay.sh blind relay. Hides your wallet from the resource server. Max 2.0 USDC.', |
| #149 | input_schema: { |
| #150 | type: 'object' as const, |
| #151 | properties: { |
| #152 | url: { type: 'string', description: 'Endpoint URL (must be a valid inference or API endpoint).' }, |
| #153 | amount: { type: 'number', description: 'USDC amount to pay (max 2.0).' }, |
| #154 | blind: { type: 'boolean', description: 'Use pay.sh blind relay to hide wallet identity (recommended: true).' }, |
| #155 | }, |
| #156 | required: ['url', 'amount'], |
| #157 | }, |
| #158 | }, |
| #159 | |
| #160 | // ── Percolator perpetuals ──────────────────────────────────────────────── |
| #161 | { |
| #162 | name: 'percolator_list_markets', |
| #163 | description: 'List available perpetuals markets via @openclawdsolana/percolator CLI. Returns market pubkeys, symbols, OI, funding.', |
| #164 | input_schema: { type: 'object' as const, properties: {}, required: [] }, |
| #165 | }, |
| #166 | { |
| #167 | name: 'percolator_slab_get', |
| #168 | description: 'Get the full order book slab for a perpetuals market. Returns bids/asks at various price levels.', |
| #169 | input_schema: { |
| #170 | type: 'object' as const, |
| #171 | properties: { |
| #172 | pubkey: { type: 'string', description: 'Slab (market) public key on-chain.' }, |
| #173 | }, |
| #174 | required: ['pubkey'], |
| #175 | }, |
| #176 | }, |
| #177 | { |
| #178 | name: 'percolator_quote', |
| #179 | description: 'Get a perpetuals trade quote (entry price, fees, liquidation price) before committing. Paper-safe.', |
| #180 | input_schema: { |
| #181 | type: 'object' as const, |
| #182 | properties: { |
| #183 | market: { type: 'string', description: 'Market pubkey or name.' }, |
| #184 | side: { type: 'string', enum: ['long', 'short'], description: 'Trade direction.' }, |
| #185 | size: { type: 'string', description: 'Position size in USD notional.' }, |
| #186 | }, |
| #187 | required: ['market', 'side', 'size'], |
| #188 | }, |
| #189 | }, |
| #190 | { |
| #191 | name: 'percolator_funding_rate', |
| #192 | description: 'Get current funding rate for a perpetuals market. Positive = longs pay shorts.', |
| #193 | input_schema: { |
| #194 | type: 'object' as const, |
| #195 | properties: { |
| #196 | market: { type: 'string', description: 'Market pubkey or name.' }, |
| #197 | }, |
| #198 | required: ['market'], |
| #199 | }, |
| #200 | }, |
| #201 | |
| #202 | // ── Vulcan (Phoenix perpetuals) ────────────────────────────────────────── |
| #203 | { |
| #204 | name: 'vulcan_markets', |
| #205 | description: 'List available Phoenix perpetuals markets via vulcan-cli. Returns market pubkeys, symbols, mark price, OI, funding.', |
| #206 | input_schema: { type: 'object' as const, properties: {}, required: [] }, |
| #207 | }, |
| #208 | { |
| #209 | name: 'vulcan_quote', |
| #210 | description: 'Get a Phoenix perp trade quote (entry price, fees, liquidation price) before committing. Paper-safe — never executes.', |
| #211 | input_schema: { |
| #212 | type: 'object' as const, |
| #213 | properties: { |
| #214 | market: { type: 'string', description: 'Market pubkey or name.' }, |
| #215 | side: { type: 'string', enum: ['long', 'short'], description: 'Trade direction.' }, |
| #216 | size: { type: 'string', description: 'Position size in USD notional.' }, |
| #217 | }, |
| #218 | required: ['market', 'side', 'size'], |
| #219 | }, |
| #220 | }, |
| #221 | { |
| #222 | name: 'vulcan_place_order', |
| #223 | description: 'Place a Phoenix perp order. Paper mode unless LIVE_TRADING=true AND OPERATOR_CONFIRMED=true — returns simulated fill without broadcasting. Requires depth=shallow+.', |
| #224 | input_schema: { |
| #225 | type: 'object' as const, |
| #226 | properties: { |
| #227 | market: { type: 'string', description: 'Market pubkey or name.' }, |
| #228 | side: { type: 'string', enum: ['long', 'short'], description: 'Trade direction.' }, |
| #229 | size: { type: 'string', description: 'Position size in USD notional.' }, |
| #230 | limitPrice: { type: 'string', description: 'Limit price. Omit for market orders.' }, |
| #231 | reduceOnly: { type: 'boolean', description: 'Reduce-only (close position only).' }, |
| #232 | clientOrderId: { type: 'string', description: 'Optional client-side order tag.' }, |
| #233 | }, |
| #234 | required: ['market', 'side', 'size'], |
| #235 | }, |
| #236 | }, |
| #237 | { |
| #238 | name: 'vulcan_cancel_order', |
| #239 | description: 'Cancel an open Phoenix perp order by its order ID. Requires depth=shallow+.', |
| #240 | input_schema: { |
| #241 | type: 'object' as const, |
| #242 | properties: { |
| #243 | orderId: { type: 'string', description: 'Order ID to cancel.' }, |
| #244 | }, |
| #245 | required: ['orderId'], |
| #246 | }, |
| #247 | }, |
| #248 | { |
| #249 | name: 'vulcan_positions', |
| #250 | description: 'List open Phoenix perpetual positions for the agent wallet (or a specified wallet).', |
| #251 | input_schema: { |
| #252 | type: 'object' as const, |
| #253 | properties: { |
| #254 | wallet: { type: 'string', description: 'Wallet pubkey. Omit to use the agent keystore wallet.' }, |
| #255 | }, |
| #256 | required: [], |
| #257 | }, |
| #258 | }, |
| #259 | { |
| #260 | name: 'vulcan_funding_rate', |
| #261 | description: 'Get the current funding rate for a Phoenix perp market. Positive = longs pay shorts.', |
| #262 | input_schema: { |
| #263 | type: 'object' as const, |
| #264 | properties: { |
| #265 | market: { type: 'string', description: 'Market pubkey or name.' }, |
| #266 | }, |
| #267 | required: ['market'], |
| #268 | }, |
| #269 | }, |
| #270 | |
| #271 | // ── Shell / self-identity ──────────────────────────────────────────────── |
| #272 | { |
| #273 | name: 'shell_write', |
| #274 | description: 'Update the leviathan SHELL.md self-identity document. Increments shellVersion. Use to record learnings and molt.', |
| #275 | input_schema: { |
| #276 | type: 'object' as const, |
| #277 | properties: { |
| #278 | content: { type: 'string', description: 'New SHELL.md content (full document, not append). Be concise.' }, |
| #279 | }, |
| #280 | required: ['content'], |
| #281 | }, |
| #282 | }, |
| #283 | |
| #284 | // ── Lifecycle ──────────────────────────────────────────────────────────── |
| #285 | { |
| #286 | name: 'spawn_spawnling', |
| #287 | description: 'Spawn a child leviathan with its own keypair and mission. Only available at depth=deep. Costs seed USDC.', |
| #288 | input_schema: { |
| #289 | type: 'object' as const, |
| #290 | properties: { |
| #291 | name: { type: 'string', description: 'Name for the spawnling.' }, |
| #292 | spawnPrompt: { type: 'string', description: 'Founding mission statement for the child leviathan.' }, |
| #293 | seedUsdc: { type: 'number', description: 'USDC to transfer as seed capital (min 1.0, max 50% of reserves).' }, |
| #294 | }, |
| #295 | required: ['name', 'spawnPrompt'], |
| #296 | }, |
| #297 | }, |
| #298 | { |
| #299 | name: 'hold', |
| #300 | description: 'Do nothing this tick. Use when drifting, observing, or when no action is warranted.', |
| #301 | input_schema: { |
| #302 | type: 'object' as const, |
| #303 | properties: { |
| #304 | reason: { type: 'string', description: 'Brief reason for holding (≤140 chars).' }, |
| #305 | }, |
| #306 | required: [], |
| #307 | }, |
| #308 | }, |
| #309 | ]; |
| #310 |