Borrowing it
Nothing to install: this file belongs to thorchain/swap.thorchain. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/thorchain/swap.thorchain/main/AGENTS.mdgit clone --depth 1 https://github.com/thorchain/swap.thorchainWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/thorchain/swap.thorchain/agents-md)<a href="https://agentmods.dev/instructions/thorchain/swap.thorchain/agents-md"><img src="https://agentmods.dev/badge/instructions/thorchain/swap.thorchain/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/thorchain/swap.thorchain/agents-md"><img src="https://agentmods.dev/badge/instructions/thorchain/swap.thorchain/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.02939 | $0.02939 |
| Opus 5.5 | $0.01176 | $0.01176 |
| Sonnet 5.5 | $0.00588 | $0.00588 |
| Haiku 4.5 | $0.00294 | $0.00294 |
Grade A, and why
swap.thorchain AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 4d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 111 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AGENTS.md — working on this codebase
Instructions for AI coding agents contributing to swap.thorchain.org (the runtime guidance served to browsing agents lives at /AGENTS.md on the
site, generated from src/lib/agent/discovery.ts — this file is about the code).
What this is
Next.js (App Router, TypeScript, Tailwind) web UI for native cross-chain swaps, powered by THORChain and Maya Protocol. Users sign in their own wallets, or use memoless ("instant") swaps with no wallet connection.
Two-component architecture:
- UI — this repo.
- Backend API — the swap aggregator:
https://api.thorchain.org/v1(quotes/routing,x-api-keygated) andhttps://api.thorchain.org/memoless/api/v1(memoless swaps, no key). Protocol metadata (pools, mimir, THORNames, balances) comes from THORNode/Midgard gateways — seesrc/lib/api.tsandsrc/lib/thorchain-api.ts.
Commands
npm run dev— dev server (Turbopack). Check whether one is already running before starting another.npx tsc --noEmit -p tsconfig.json— typecheck; this is the CI-relevant check (next lintis currently broken).npm run build— production build (standalone output, single instance — in-memory rate limiting and idempotency stores rely on this).
Key areas
src/components/swap/— swap flow UI;src/lib/wallets.ts— wallet/TCSwap SDK config (env vars in.env.example).src/lib/tronlink.ts— a connector the SDK does not ship, registered inwallets.tslike any@tcswap/wallets/*one. Exodus is not one of these: it lives in the SDK as@tcswap/wallets/exodus(the browser extension), added in../TCSwap. Mind the version — through 4.3.26 that subpath was an alias for Exodus's unrelated Passkeys wallet, which has always had its own@tcswap/wallets/passkeysexport and still does; only 4.3.27 onwards carries the extension connector, sopackage.jsonmust ask for at least that. Brave Wallet is in the SDK too, as@tcswap/wallets/brave(connectBrave, 4.3.34 onwards): it reaches both of Brave's accounts, EVM and Solana, through Brave's own providers, whereconnectEVMWalletwithWalletOption.BRAVEgets the EVM account only, from whichever extension ownswindow.ethereum. Rabby isWalletOption.RABBY(4.3.35 onwards) on the SDK'sconnectEVMWallet, which uses the provider Rabby announces over EIP-6963 (rdnsio.rabby) rather thanwindow.ethereum— Rabby takes that from MetaMask only when set as the default wallet, and flags itisMetaMasktoo. Binance Wallet is the SDK's@tcswap/wallets/binance(connectBinance, 4.3.37 onwards): the Binance Web3 Wallet extension injects everything under thewindow.binancew3wnamespace — an EIP-1193 EVM provider (ethereum, also announced over EIP-6963 ascom.binance.wallet, the connector's last-resort lookup), a Phantom-shaped Solana one (solana), a Unisat-compatible Bitcoin one (bitcoin, mirrored aswindow.unisatflaggedisBinanceon builds without the namespaced copy), and its own Tron provider (tron), which answersgetAccount()/signTransaction()rather than TronLink'stronWebsurface. The Bitcoin provider exists only in the Binance App's in-app dApp browser — the Chrome extension serves EVM, Solana and TRON only, so the app filters BTC out of the wallet's chain list (supportedChainsinsrc/lib/wallets.ts). WalletConnect is the SDK's@tcswap/wallets/walletconnect(connectWalletconnect), listed only whenNEXT_PUBLIC_WALLETCONNECT_PROJECT_IDis set. One QR scan connects every selected chain the wallet supports; the app warns about the rest. A reload restores the stored sessions without a QR code (restoreOnly), and a session ended from the phone removes its chains (onWalletconnectDisconnect, thendisconnectWallet(WALLETCONNECT, chains)). The connect dialog callspreloadWalletconnectwhen it opens, so the QR modal opens at once, andisWalletconnectDismissedtells a closed QR modal from a real error. Needs@tcswap/wallets4.3.36 or later.- Disconnect a wallet with core's
disconnectWallet(@tcswap/core4.1.36 or later), notdisconnectChainper chain. A chain holds only the last wallet connected on it, sodisconnectChainmay hit another wallet;disconnectWalletends only this wallet's sessions and hands each chain back to another connected wallet. isPrivateSwapinsrc/store/limit-swap-store.ts— the PRIVATE tab: the swap is routed through Houdini Swap (AppConfig.privateProvider,providers: ["HOUDINI"]on the aggregator,@tcswap/plugins/houdiniin the SDK) instead of the native protocols. Each tab has its own asset list (useModeAssetsinsrc/hooks/use-assets.ts), and a private route is priced floating and tracked by its Houdini order id (Transaction.providerSwapId). Seedocs/private-swaps.mdbefore touching anyHOUDINIbranch.public/widget.js+src/app/widget/— the embeddable swap iframe. The loader mirrors the host page's dark/light mode into the iframe: it reads the effective background painted behind the widget (so a.darkclass,data-theme, or a CSS-variable swap all work without configuration), boots the iframe with?theme=, and pushes later changes overpostMessage—src/app/widget/theme.tsholds that contract plus the pre-paint script that stops the embed flashing the wrong theme. Keepwidget.jsplain unbundled ES5-style script — it runs as-is on third-party sites.src/lib/agent/discovery-files.ts— single registry of every static discovery file (/llms.txt,/AGENTS.md,/openapi.json,/.well-known/*, …), served bysrc/proxy.tsbefore filesystem routes. Add new agent/developer surfaces here, not as route folders.src/lib/agent/discovery.ts— markdown content for/AGENTS.md,/llms.txt,/llms-full.md,/auth.md, and the agent skill;src/lib/agent/openapi.ts— the OpenAPI document.src/lib/agent/developer-portal.ts— content for/developers.md;src/app/developers/page.tsxis a hand-built HTML mirror — keep the two in sync.src/lib/agent/developer-docs.ts— the named developer resources at/developers/<topic>(quickstart, api, mcp, auth, sdks, webhooks). One markdown source per topic feeds both the HTML page (src/app/developers/[topic]/page.tsx, rendered bysrc/components/markdown-article.tsx) and the.mdtwin, so they cannot drift. Topic metadata lives indeveloper-topics.ts— split out sodeveloper-portal.tscan link the pages without an import cycle.- The MCP server is anonymous and must stay that way: publish no
/.well-known/oauth-*metadata and no registration endpoint, and never link one from a discovery document either — a linked path reads as published metadata. MCP connectors read protected-resource metadata as "OAuth required" and then fail a sign-in flow against a site with no accounts — see the note indocs/agent-readiness/orank.md,testNoAuthorizationSurfaceBlocksConnectors, and the link guard intestDiscoveryDocsAreTruthful(test/agent-contracts.test.mjs), which also asserts that every own-origin URL a discovery document links resolves. sdk/python,sdk/go— dependency-free clients over this site's keyless public surfaces (the MCP tools and the support endpoints). The TypeScript SDK is the already-published@tcswap/sdkfrom the TCSwap monorepo — do not add a second npm client for the same APIs.src/lib/agent/sdks.tsis the single list the developer docs, llms.txt, and AGENTS.md render from; PyPI publication is still a manual step (seedocs/agent-readiness/orank.md).src/lib/agent/skills.ts— published agent skills (one per capability area, YAML frontmatter); routes and the skills index are generated fromAGENT_SKILLS.src/lib/agent/markdown-pages.ts— markdown twins:.mdappended to any content page URL, plusAccept: text/markdownnegotiation, resolved insrc/proxy.ts.src/lib/agent/pricing.ts— content for/pricing.md;src/lib/agent/agent-mode.ts— the/?mode=agentview (JSON or markdown byAccept), derived fromMCP_TOOLSanddeveloperEndpointsso it stays in sync.src/lib/agent/mcp-tools.ts— tool definitions and the server card (edge-safe, nonode:crypto);src/lib/agent/mcp-server.ts+src/lib/agent/mcp-ui.ts— public MCP server at/mcp(stateless streamable HTTP, read-only THORNode tools, MCP Apps quote view).public/robots.txtcarries AI Content-Signal lines whose ordering matters.src/app/api/— support endpoints (/api/v1/*canonical, unversioned aliases kept); JSON errors viasrc/lib/api-error.ts, idempotency viasrc/lib/agent/idempotency.ts.src/lib/rate-limit.ts— per-client limiter shared by/mcpand the support endpoints. Key oncf-connecting-ip(or the last forwarded hop), never the firstx-forwarded-forentry: the edge appends to whatever the caller sent, so the leftmost value is forgeable.src/components/chatwoot-widget.tsx— the live-chat widget (a Chatwoot Website-channel inbox), rendered only whenNEXT_PUBLIC_CHATWOOT_WEBSITE_TOKENis set. There is no bug-report form or/api/report-bugendpoint any more — support is live chat and email.server.json(repo root) +src/app/.well-known/mcp-registry-auth/route.ts— the official MCP Registry record and its domain-ownership proof (served fromMCP_REGISTRY_AUTH). Keepserver.json'sversionin step withMCP_SERVER_INFO.version; publishing steps are indocs/agent-readiness/mcp-registry.md.docs/agent-readiness/— notes on agent-readiness scanners and decisions; read before changing discovery surfaces.src/lib/banner.ts+src/app/api/banner/route.ts+src/hooks/use-banner.ts— the announcement banner. It is content owned by the affiliate admin (swap.thorchain-admin, admin-only/banner, published at its/api/banner), not by this repo: this app proxies that endpoint through its own origin (30s cache,BANNER_API_URL) and each tab polls every 10 min once the browser is idle, so a banner goes up without a deploy and never competes with the swap's own requests. An icon uploaded there is proxied the same way at/api/banner/icon, so the banner is always same-origin. Nothing is bundled — an unreachable admin means the last-seen banner, or none. Its copy is translated by the admin on save and is deliberately not insrc/i18n/messages. Seedocs/banner.md.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 4d ago Changed · +6 lines · +224 tokens per session 7dcfb3c4728b
- 11d ago Changed · +8 lines · +248 tokens per session 56b88711d891
- 14d ago Changed · +2 lines · +84 tokens per session a56f17efdc73
- 19d ago Changed · +2 lines · +86 tokens per session 8a22af7dbf10
- 26d ago Changed 47959bbdad6e
- 1mo ago Changed · -2 lines · -86 tokens per session ac7689119b4b
- 1mo ago Changed · +4 lines · +135 tokens per session 25f5cc4a4ced
- 2mo ago Changed · +4 lines · +154 tokens per session a5c5468dd288
- 2mo ago Changed · +1 lines · +42 tokens per session dc95a5a52267
- 2mo ago First seen · 86 lines · 2,052 tokens per session scan A b1925b3f85f7
swap.thorchain AGENTS.md is an instructions file published in the GitHub repository thorchain/swap.thorchain (2 stars, last pushed today), licensed MIT. It adds 2,939 tokens to every session, about $0.0118 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
swap.thorchain AGENTS.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| swap.thorchain AGENTS.mdthorchain/swap.thorchain | Instructions file | 2 | today | MIT | A | 2,939 | Codex, OpenCode |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | today | MIT | A | 7,461 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 5,649 | GitHub Copilot |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | today | MIT | A | 4,680 | Codex, OpenCode |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 3,093 | GitHub Copilot |
| vscode model-prompts.instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 2,022 | GitHub Copilot |