- Initialize pnpm workspace
- Create
packages/client(Vite + React + TypeScript) - Create
packages/server(Express + TypeScript) - Create
packages/shared(shared types and utilities) - Create
packages/lit-actions(Lit Action code) - Configure TypeScript for all packages
- Set up path aliases and package references
- Create
.env.examplewith all required variables
- Set up Prisma in root
- Create initial schema (User, Swarm, SwarmMembership, Transaction, TransactionTarget)
- Create initial migration
- Add seed script for development
- Set up Express with TypeScript
- Add middleware (cors, json, error handling)
- Set up environment variable loading (dotenv)
- Create health check endpoint
- Set up Prisma client singleton
- Add request logging (morgan or similar)
- Set up Vite + React + TypeScript
- Install and configure wagmi + viem
- Set up React Router
- Create basic layout components
- Configure Tailwind CSS (or preferred styling)
- Set up API client (fetch wrapper with auth)
- Create SIWE nonce endpoint (
POST /api/auth/nonce) - Create login endpoint (
POST /api/auth/login)- Verify SIWE signature
- Create user if not exists
- Generate and return JWT
- Create auth middleware (verify JWT)
- Create
GET /api/auth/meendpoint
- Create ConnectWallet component using wagmi
- Implement SIWE signing flow
- Store JWT in localStorage/memory
- Create auth context/provider
- Add auth state to API client
- Create protected route wrapper
- Install Lit Protocol v8 SDK (
@lit-protocol/lit-node-client) - Create Lit client singleton with network from env
- Implement connection/session management
- Create helper for subsidized PKP minting
- Create function to mint PKP for new swarm
- Store PKP public key and token ID in database
- Handle errors and retries
- Create Lit Action for signing transactions
- Accept transaction data and wallet addresses
- Sign UserOperation for each wallet
- Return signatures
- Bundle Lit Action for deployment
- Test Lit Action in isolation
- Install ZeroDev SDK (
@zerodev/sdk,@zerodev/ecdsa-validator) - Create ZeroDev client factory with project ID from env
- Implement bundler URL derivation from project ID + chain ID
- Create function to compute counterfactual address for user
- Create function to add PKP as session signer
- Test wallet creation flow
- Create function to build UserOperation
- Create function to sign UserOp with Lit PKP
- Create function to submit UserOp to bundler
- Handle gas estimation and paymaster
-
GET /api/swarms- List all swarms (public) -
POST /api/swarms- Create swarm (requires auth)- Validate input (name, description)
- Mint Lit PKP
- Create swarm in database
-
GET /api/swarms/:id- Get swarm details -
GET /api/swarms/:id/members- Get swarm members (manager only)
- Create manager dashboard page
- List manager's swarms
- Create swarm form/modal
- Show swarm stats (member count, etc.)
- Show swarm info (name, description, social)
- List all members with agent wallet addresses
- Show member balances (via Alchemy) - Deferred to Phase 8
- Transaction form (to, value, data inputs) - Deferred to Phase 7
-
POST /api/swarms/:id/join- Join swarm- Accept client-computed wallet address and session key approval
- Create SwarmMembership record with sessionKeyApproval
- Handle re-joining after leaving
-
GET /api/memberships- Get user's memberships -
GET /api/memberships/:id- Get membership details -
POST /api/memberships/:id/leave- Leave a swarm
- Install ZeroDev SDK packages on client
- Create
smartWallet.tswithcreateAgentWalletfunction - User's wallet creates kernel account with PKP as session signer
- Serialize permission account for backend transaction signing
- Create swarm discovery page (already existed, enhanced)
- List all public swarms
- Search/filter swarms
- Join swarm button with multi-step status display
- Show membership status on swarm cards
- List user's swarm memberships
- Show agent wallet address for each
- Show status (active, etc.)
- Copy address to clipboard functionality
- Show swarm info
- Show agent wallet address with copy button
- Show deposit instructions
- Show balance (ETH + ERC20s via Alchemy) - Deferred to Phase 8
- Link to external dApp for withdrawals (Zerion, Safe)
- Link to BaseScan for viewing balance
- Leave swarm functionality with confirmation
- Define template placeholder types
- Create template parser to extract placeholders from args
- Create template resolver function:
{{walletAddress}}- agent wallet address{{ethBalance}}- ETH balance in wei{{tokenBalance:0x...}}- ERC20 token balance{{percentage:ethBalance:N}}- N% of ETH balance{{percentage:tokenBalance:0x...:N}}- N% of token balance{{blockTimestamp}}- current block timestamp{{deadline:N}}- timestamp + N seconds{{slippage:amount:N}}- amount minus N% (for minAmountOut)
- Support ABI mode (encodeFunctionData with viem)
- Support raw calldata mode (hex string with placeholder substitution)
- Add validation for template structure
- Unit tests for template resolution - Deferred to Phase 9
-
POST /api/swarms/:id/transactions- Execute transaction- Validate manager owns swarm
- Validate template structure
- Create Transaction record with template
- Get all active members
- For each member:
- Fetch balances via Alchemy
- Resolve template placeholders
- Encode calldata
- Create TransactionTarget with resolved data
- Use deserialized permission account for PKP signing
- Submit UserOps to bundler
- Return transaction ID
-
GET /api/swarms/:id/transactions- List swarm transactions -
GET /api/transactions/:id- Get transaction status/details
- Poll bundler for UserOp status
- Update TransactionTarget status on confirmation
- Update Transaction status when all targets complete
- Transaction template builder form:
- Mode toggle: ABI mode vs Raw calldata mode
- Contract address input
- ABI Mode:
- ABI paste/upload (JSON)
- Function selector dropdown (populated from ABI)
- Dynamic argument inputs based on function signature
- Raw Calldata Mode:
- Hex data textarea with placeholder support
- Placeholder insertion buttons (wallet address, balance, deadline, slippage, etc.)
- ETH value input (with placeholder support)
- Template preview showing resolved values for sample wallet - Deferred to future
- Transaction history list
- Transaction detail view with per-member status
- Store common contract ABIs (ERC20 Transfer, Approve, WETH Deposit/Withdraw)
- Quick-select for common operations
- Pre-built templates for common swaps - Deferred to future
- Using Alchemy JSON-RPC API directly (no SDK needed)
- Create balance fetching service
- Get ETH balance via viem
- Get all ERC20 token balances via
alchemy_getTokenBalances(automatic discovery) - Get token metadata via
alchemy_getTokenMetadata
- Cache balances with 30s TTL (in-memory cache)
- Cache token metadata permanently (tokens don't change)
- Balance display component with loading/error states
- Token list with icons/names from Alchemy metadata API
- USD value display (optional, requires price feed) - Deferred to future
- Refresh balance button with visual feedback
- Add "Withdraw" button to each token row in BalanceDisplay component
- Create WithdrawModal component
- Token symbol and balance display
- Amount input with validation
- "Max" button to fill full balance
- Destination address (pre-filled with user's EOA, read-only)
- Withdraw button with loading state
- Error/success feedback
- Create withdrawal function in smartWallet.ts
- Build ERC20 transfer calldata (to user's EOA)
- Create kernel account client with user as signer
- Submit UserOp via ZeroDev bundler
- Handle gas sponsorship via paymaster
- Handle ETH withdrawal (native transfer, not ERC20)
- Wire up WithdrawModal to BalanceDisplay
- Refresh balances after successful withdrawal
- Add transaction status feedback (pending → confirmed)
- Handle errors gracefully (insufficient balance, gas issues)
- Add 0x API key to environment variables
- Create
packages/server/src/lib/zeroEx.tsservice- Get swap quote via
/swap/v1/quote - Handle token price lookups via
/swap/v1/price - Support Base network (chain ID 8453 / 84532 for testnet)
- Get swap quote via
- Add common token list for Base (ETH, WETH, USDC, DAI, USDbC, cbETH)
- Create endpoint
POST /api/swarms/:id/swap/preview- Accept: sellToken, buyToken, sellPercentage, slippagePercentage
- For each member: fetch balance, call 0x for quote
- Return: per-member preview (sellAmount, buyAmount, estimatedPriceImpact)
- Create endpoint
GET /api/swarms/:id/holdings- Aggregate token holdings across all swarm members
- Return total ETH balance, tokens with total balances and holder count
- Create endpoint
POST /api/swarms/:id/swap/execute- Build approval tx if needed (ERC20 approve to allowanceTarget)
- Build swap tx from 0x quote data
- Execute via existing transaction infrastructure (PKP signing)
- Return transaction ID for status tracking
- Handle multi-step transactions (approve + swap via encodeCalls)
- Reuse existing transaction status tracking
- Create SwapForm component (with integrated preview)
- Sell token selector (dropdown with held tokens + common tokens)
- Buy token selector
- Amount input: percentage slider (1-100%)
- Slippage tolerance input (preset buttons + custom input)
- "Preview Swap" button
- Create SwapPreview (integrated into SwapForm as step)
- Table showing per-member: wallet, sell amount, expected buy amount
- Total volume summary
- Success/error count display
- "Execute Swap" button
- Reuse TransactionHistory for swap display
- Fetch aggregate token holdings via /api/swarms/:id/holdings
- Show "held tokens" in sell dropdown for easy selection
- Token metadata from Alchemy + common token list
- Add comprehensive error handling to all endpoints
- Create user-friendly error messages
- Add error boundaries to React
- Add loading skeletons/spinners
- Optimistic updates where appropriate
- Unit tests for critical utilities (51 tests for template engine)
- Integration tests for API endpoints (covered in README documentation)
- E2E tests for critical flows (documented in README)
- API documentation
- Setup instructions in README
- Environment variable documentation
- Add Twitter/X OAuth 2.0 credentials to environment variables
TWITTER_CLIENT_IDTWITTER_CLIENT_SECRETTWITTER_CALLBACK_URL
- Create Twitter OAuth endpoints
GET /api/auth/twitter- Initiate OAuth flow, return auth URLGET /api/auth/twitter/callback- Handle OAuth callbackPOST /api/auth/twitter/disconnect- Disconnect Twitter account
- Store Twitter user info in database
- Add
twitterId,twitterUsernamefields to User model
- Add
- Add middleware to require linked Twitter account for swarm creation
- Add "Connect Twitter" button to manager profile/settings
- Show Twitter connection status (connected vs not connected)
- Update CreateSwarmModal to check for linked Twitter
- Show error/prompt if not connected
- Display manager's Twitter handle on swarm cards/detail pages
- Add fee recipient environment variable
SWAP_FEE_RECIPIENT- Wallet address to receive feesSWAP_FEE_BPS- Fee in basis points (default 50 = 0.5%)
- Update shared constants with fee configuration
- Update
zeroEx.tsto include fee parameters in quotes- 0x API supports
buyTokenPercentageFeeparameter - Fee is taken from buy token and sent to recipient
- 0x API supports
- Update swap preview to show fee amount
- Display fee in absolute terms and percentage
- Show fee recipient (truncated address)
- Ensure fee is included in swap execution calls
- Update SwapForm preview to display fee breakdown
- "Platform fee: X tokens (0.5%)"
- "You receive: Y tokens"
- Add fee disclosure to swarm documentation/FAQ
- Update smart wallet creation to use unique index per swarm
- Compute index as
BigInt(keccak256("swarm_vault_<swarmId>"))(uint256) - This ensures users get a unique agent wallet address for this app vs other ZeroDev apps
- Compute index as
- Update client-side
createAgentWalletfunction inpackages/client/src/lib/smartWallet.ts- Updated
swarmIdToIndex()to use keccak256 hash
- Updated
- Update server-side
computeSmartWalletAddressif applicable- Added matching
swarmIdToIndex()inpackages/server/src/lib/zerodev.ts
- Added matching
- Verify existing memberships still work (index is stored in sessionKeyApproval)
- Note: Existing test memberships will need to be recreated (new index = different address)
- Add SAFE integration fields to Swarm model
safeAddress- Gnosis SAFE address (optional)requireSafeSignoff- Boolean to enable/disable requirement
- Add SAFE SDK packages
@safe-global/protocol-kit@safe-global/api-kit
- Create SAFE service for interacting with SAFE API
- Create
ProposedActionmodel in databaseid,swarmId,managerIdactionType(SWAP, TRANSACTION, etc.)actionData(JSON with transaction details)safeMessageHash- Hash for SAFE to signstatus(PROPOSED, APPROVED, REJECTED, EXECUTED, EXPIRED)proposedAt,approvedAt,expiresAt
- Create manager endpoints for proposals
POST /api/swarms/:id/proposals- Create new proposalGET /api/swarms/:id/proposals- List proposalsGET /api/proposals/:id- Get proposal detailsPOST /api/proposals/:id/execute- Execute approved proposal
- Create function to generate SAFE message hash from action data
- Create function to check SAFE signature status via SAFE API
- Create function to verify on-chain SAFE signature (fallback)
- Expose endpoint for checking proposal approval status
GET /api/proposals/:id/status
- Update Lit Action to support SAFE sign-off verification
- Accept proposal ID and SAFE address as parameters
- Verify SAFE signature via API before signing
- Only sign if SAFE has approved the exact action hash
- Reject with clear error if signature missing/invalid
- Add SAFE verification parameters to transaction execution flow
- Handle timeout/expiry of proposals
- Update SwapForm to support proposal mode when SAFE is configured
- Creates proposal instead of executing directly
- Shows proposal ID after creation
- Link to SAFE app for signing
- Create ProposalList component
- Show pending, approved, executed proposals
- Status indicators (waiting for SAFE, ready to execute, expired)
- Check status and execute buttons
- Proposal detail integrated into list view
- Show message hash for SAFE signing
- Show approval status
- "Execute" button when approved
- Add SAFE configuration modal in swarm settings
- Enable/disable SAFE requirement toggle
- SAFE address input with validation
- Validate SAFE exists before saving
- Show SAFE status on swarm detail page
- Display current SAFE address
- Show enabled/disabled status
Note: SAFE functionality is complete on the backend and in the database, but needs more testing/fixes before launch. Disabling in the UI means users can't access it, allowing us to launch without it and re-enable later.
-
SwarmDetail.tsx- Comment out SAFE configuration button and status display -
SwarmDetail.tsx- Comment out ProposalList section -
SwapForm.tsx- Comment out proposal mode logic (always execute directly) - TypeScript compiles successfully
- Backend SAFE routes remain (no changes needed)
- Database schema remains (no changes needed)
- Lit Actions with SAFE verification remain (no changes needed)
Note: This app hasn't launched yet, so no migration of existing PKPs is needed. Just wipe the local database and start fresh with the Naga network.
- Update environment variables
- Change
LIT_NETWORKto use Naga network (naga-devfor development,nagafor production)
- Change
- Update
packages/server/src/lib/env.ts- Update network validation enum - Update
packages/server/src/lib/lit.ts- Complete rewrite for new Naga SDK API - Update
.env.examplewith Naga network values
- Migrate to new Lit Protocol Naga SDK v8.x packages:
@lit-protocol/lit-client(replaces@lit-protocol/lit-node-client)@lit-protocol/auth(replaces@lit-protocol/auth-helpers)@lit-protocol/networks(new package for network configs)- Removed:
@lit-protocol/constants,@lit-protocol/contracts-sdk
- Update client creation to use
createLitClient({ network: nagaDev }) - Update authentication to use Auth Manager pattern with
createEoaAuthContext - Update PKP minting to use
litClient.mintWithEoa({ account })
- Update
signTransaction.tsto usejsParamspattern for parameter access - Update
signTransactionWithSafe.tsto usejsParamspattern - Migrate from
Lit.Actions.signEcdsatoLitActions.signAndCombineEcdsa - Update
litActions.tshelper to parse new signature response format
- Wipe local database and test PKP minting on Naga network
- Test full swarm creation flow
- Test transaction execution via PKP
- Test swap execution via PKP
- Verify signature format compatibility with ZeroDev
- Update plan.md with Phase 14 learnings and migration notes
Goal: Enable swarm managers to programmatically trade on behalf of their users via API. Managers should be able to give this documentation to an LLM and have it generate trading code for them.
- Choose and install API documentation framework
- Used
swagger-jsdoc+@scalar/express-api-reference - Scalar provides modern, beautiful API docs with built-in playground
- Used
- Configure OpenAPI spec generation from existing routes
- Created
packages/server/src/lib/openapi.tswith full spec configuration
- Created
- Add OpenAPI annotations/JSDoc to all manager-relevant endpoints:
- Auth:
POST /api/auth/nonce,POST /api/auth/login,GET /api/auth/me - Swarms:
GET /api/swarms,POST /api/swarms,GET /api/swarms/:id,GET /api/swarms/:id/members - Transactions:
POST /api/swarms/:id/transactions,GET /api/swarms/:id/transactions,GET /api/transactions/:id - Swaps:
GET /api/swarms/:id/holdings,POST /api/swarms/:id/swap/preview,POST /api/swarms/:id/swap/execute - Memberships:
POST /api/swarms/:swarmId/join,GET /api/memberships,GET /api/memberships/:id,POST /api/memberships/:id/leave,GET /api/memberships/:id/balance
- Auth:
- Serve interactive API docs at
/api/docs - Include authentication instructions (SIWE flow) in description
- Document all request/response schemas with examples
- Add code examples (JavaScript/fetch as default)
- Create dedicated authentication and trading guide in OpenAPI description:
- Authentication flow (get nonce → sign SIWE message → get JWT)
- How to fetch swarm holdings
- How to preview a swap
- How to execute a swap
- How to check transaction status
- Template placeholders reference table
- OpenAPI spec available at
/api/openapi.jsonfor LLM consumption
- Server compiles and starts successfully with API docs
- API playground available at
/api/docs - JWT auth configured in security schemes
Goal: Allow managers to generate API keys for programmatic access instead of requiring them to export their wallet private key and sign SIWE messages.
- Add API key fields to User model
apiKeyHash- bcrypt hash of the API key (never store plaintext)apiKeyPrefix- First 8 chars for identification (e.g.,svk_abc1...)apiKeyCreatedAt- Timestamp when key was generated
-
POST /api/auth/api-key/generate- Generate new API key- Creates random 32-byte key with prefix
svk_ - Hashes with bcrypt and stores hash
- Returns full key ONLY ONCE in response
- Automatically revokes any existing key
- Creates random 32-byte key with prefix
-
GET /api/auth/api-key- Get API key info (prefix, createdAt)- Does NOT return the full key
-
DELETE /api/auth/api-key- Revoke current API key
- Update auth middleware to accept API key in Authorization header
- Format:
Authorization: Bearer svk_xxxxx... - Validate by hashing provided key and comparing to stored hash
- Return same user info as JWT auth
- Format:
- Add "API Key" section to Settings page
- Show current key status (none, or prefix + created date)
- "Generate API Key" button (or "Regenerate" if one exists)
- Create API key generation modal
- Show full key ONLY ONCE with copy button
- Warning: "This is the only time you'll see this key"
- Confirm/close button
- Regenerate confirmation (generates new key, automatically revokes old one)
- Update API docs with OpenAPI annotations for API key endpoints
- Add API key section to manager trading guide (optional - users can figure it out)
- Replace custom wallet connection UI with RainbowKit
- Handles wallet connection, disconnection, and reconnection reliably
- Provides polished connect modal with multiple wallet options
- Eliminates complex wagmi state management in Layout.tsx
- Install
@rainbow-me/rainbowkitpackage - Configure RainbowKitProvider with wagmi config
- Replace custom connect button with RainbowKit's ConnectButton
- Update auth flow to work with RainbowKit's connection events
Goal: Create a TypeScript SDK package (
@swarmvault/sdk) that wraps the Swarm Vault API, making it easy for managers to programmatically execute swaps and transactions. The SDK should be simple enough that giving it to an LLM can generate trading scripts.
- Create
packages/sdkdirectory in monorepo - Initialize package.json with:
- Name:
@swarmvault/sdk - Main/module/types exports
- Dependencies: fetch (for Node.js compatibility)
- Name:
- Set up TypeScript configuration (extends root tsconfig)
- Set up build tooling (tsup or similar for dual ESM/CJS output)
- Add to pnpm workspace
- Create
SwarmVaultClientclass with:- Constructor accepting API URL and API key (or JWT)
- Automatic Authorization header handling
- Error handling and typed responses
- Implement authentication methods:
setApiKey(key: string)- Set API key for authsetJwt(token: string)- Set JWT for authgetMe()- Get current user info
- Implement swarm management methods:
listSwarms()- List all swarmsgetSwarm(id: string)- Get swarm detailsgetSwarmMembers(id: string)- Get swarm members (manager only)getSwarmHoldings(id: string)- Get aggregated token holdings
- Implement swap methods:
previewSwap(swarmId, params)- Preview a swap with expected outcomes- params:
{ sellToken, buyToken, sellPercentage, slippagePercentage } - Returns per-member preview with amounts
- params:
executeSwap(swarmId, params)- Execute a swap- Returns transaction ID for status tracking
getTransaction(id: string)- Get transaction status and detailswaitForTransaction(id: string, options?)- Poll until transaction completes- options:
{ timeoutMs?, pollIntervalMs? }
- options:
- Implement raw transaction methods:
executeTransaction(swarmId, template)- Execute a transaction template- template: ABI mode or raw calldata mode
listTransactions(swarmId)- List swarm transactions
- Export all relevant types from shared package:
Swarm,SwarmMember,MembershipTransaction,TransactionTarget,TransactionStatusSwapPreviewRequest,SwapPreviewResponseSwapExecuteRequest,SwapExecuteResponseTokenHoldings,TokenBalance
- Create
examples/directory in SDK package - Create
swap-usdc-to-weth.tsexample:- Connects with API key
- Gets swarm holdings to find USDC balance
- Previews swap of 50% USDC to WETH
- Logs preview results
- Executes swap
- Polls for completion and logs final result
- Create
check-holdings.tsexample:- Lists all swarms managed by the user
- For each swarm, displays aggregated token holdings
- Create
README.mdin examples folder with usage instructions
- Create comprehensive README.md for SDK package:
- Installation instructions (
npm install @swarmvault/sdk) - Quick start guide
- API reference with all methods
- Authentication section (API key vs JWT)
- Error handling
- TypeScript usage
- Installation instructions (
- Add JSDoc comments to all public methods
- Generate API reference docs (TypeDoc or similar) - Deferred to future
- Update main README.md to mention SDK option
- Add section to API docs distinguishing:
- Direct API usage (any language, use OpenAPI spec)
- SDK usage (JavaScript/TypeScript projects)
- Add SDK installation and quick start to
/api/docsdescription
- Add unit tests for SDK methods (mocked fetch) - Deferred to future
- Test SDK against running local server - Deferred to future
- Verify examples work end-to-end - Deferred to future
- Prepare for npm publishing (package.json metadata, LICENSE)
Goal: Make swarms private by default. Managers can share invite links to allow specific users to join. Public swarms can be discovered and joined by anyone.
- Add
isPublicboolean field to Swarm model (default:false) - Add
inviteCodestring field to Swarm model (unique, nullable) - Create migration that sets
isPublic = falsefor all existing swarms - Generate invite codes for existing swarms (or leave null until manager requests)
- Update
POST /api/swarms- Create swarm- Accept
isPublicboolean in request body (default:false) - Auto-generate
inviteCodefor private swarms
- Accept
- Update
GET /api/swarms- List swarms- Only return public swarms (
isPublic = true) to non-managers - Managers see their own swarms regardless of visibility
- Only return public swarms (
- Update
GET /api/swarms/:id- Get swarm details- Return swarm if public, or if user is manager, or if user is member
- Return 404 for private swarms user doesn't have access to
- Create
GET /api/swarms/invite/:inviteCode- Get swarm by invite code- Returns swarm details for valid invite code
- Allows users to preview private swarm before joining
- Update
POST /api/swarms/:id/join- Join swarm- If swarm is private, require
inviteCodein request body - Validate invite code matches swarm's invite code
- Public swarms can be joined without invite code
- If swarm is private, require
- Create
POST /api/swarms/:id/invite/regenerate- Regenerate invite code- Manager only
- Invalidates old invite link, generates new code
- Create
PATCH /api/swarms/:id/visibility- Update swarm visibility- Manager only
- Toggle
isPublicsetting
- Add "Public" checkbox to CreateSwarmModal
- Label: "Public Swarm" with description based on state
- Unchecked by default (swarms are private by default)
- Show info text explaining private vs public
- Update SwarmDiscovery page to show public swarms
- Backend filters to only show public swarms to non-managers
- Show Private badge for manager's private swarms in list
- Show visibility status (Public/Private badge) on swarm cards
- Add "Copy Invite Link" button in swarm detail page
- Generates link:
{baseUrl}/join/{inviteCode}
- Generates link:
- Add "Regenerate Link" option with confirmation
- Add toggle to change swarm visibility (public/private)
- Create
/join/:inviteCoderoute - Fetch swarm details using invite code
- Show swarm preview (name, description, manager Twitter)
- "Join Swarm" button initiates normal join flow
- Handle invalid/expired invite codes gracefully
- Test private swarm creation with invite code generation
- Test joining private swarm via invite link
- Test that private swarms don't appear in public discovery
- Test invite code regeneration invalidates old links
- Test toggling visibility between public/private
Goal: Create a publishable Claude skill that allows managers to execute swaps and transactions through Claude (Claude Code, Claude Desktop, or any Claude interface with tool use). The skill should include comprehensive context documentation and use the existing
@swarmvault/sdkfor API interactions.
- Create
packages/claude-skilldirectory in monorepo - Create skill manifest/configuration file (package.json)
- Skill name:
@swarmvault/claude-skill - Description: Execute swaps and transactions for your Swarm Vault swarms
- Required tools: Bash (for running SDK commands via tsx)
- Skill name:
- Set up skill context file structure
- Add to pnpm workspace (via
packages/*wildcard)
- Create main context document (
SKILL.md) with:- Overview of Swarm Vault and manager capabilities
- Authentication setup (API key generation instructions)
- Available operations summary
- Include Template Placeholders reference:
{{walletAddress}}- Agent wallet address{{ethBalance}}- ETH balance (wei){{tokenBalance:0xAddr}}- ERC20 token balance{{percentage:ethBalance:N}}- N% of ETH balance{{percentage:tokenBalance:0xAddr:N}}- N% of token balance{{blockTimestamp}}- Current block timestamp{{deadline:N}}- Timestamp + N seconds{{slippage:amount:N}}- Amount minus N% (for minAmountOut)
- Include token address constants for Base Mainnet and Sepolia
- Include common operation examples with full code
- Create executable scripts for common operations:
check-holdings.ts- List holdings for a swarmpreview-swap.ts- Preview a swap without executingexecute-swap.ts- Execute a swapexecute-transaction.ts- Execute raw transaction templatecheck-transaction.ts- Get transaction status
- Scripts should accept CLI arguments and output structured JSON
- Include proper error handling and user-friendly messages
- Ensure scripts work standalone (no build step needed with tsx)
- Create manager trading prompt that includes:
- When to use preview vs execute
- How to interpret holdings response
- How to construct transaction templates
- Safety checks (confirm before executing)
- Error handling guidance
- Create examples prompt with common scenarios (in SKILL.md):
- "Swap 50% of USDC to WETH for my swarm"
- "Check what tokens my swarm holds"
- "Execute a custom token transfer"
- "Wait for a transaction to complete"
- Create
.env.examplefor skill usersSWARM_VAULT_API_KEY- Manager's API keySWARM_VAULT_API_URL- API base URL (default: production)SWARM_ID- Default swarm ID (optional)
- Create setup instructions in README.md
- Test skill context is readable by Claude (deferred - requires live testing)
- Test each script works with valid API key (deferred - requires live testing)
- Test common scenarios end-to-end (deferred - requires live testing)
- Test error handling (deferred - requires live testing)
- Create README.md with:
- What this skill enables
- Installation instructions
- Required setup (API key, environment variables)
- Usage examples
- Troubleshooting guide
- Prepare for distribution:
- GitHub repository structure (part of monorepo)
- Uses workspace SDK dependency
- Add link to skill from main Swarm Vault docs (deferred)
- Add WalletConnect/Reown SDK
- Create "Connect to dApp" flow
- Allow user to sign transactions from their agent wallet
- Integrate Alchemy simulation API
- Add simulation check to Lit Action
- Block suspicious transactions
- Spending limits per user
- Analytics dashboard
- Swarm performance metrics
- Clone repo
- Copy
.env.exampleto.env - Fill in environment variables:
DATABASE_URLLIT_PRIVATE_KEYZERODEV_PROJECT_IDALCHEMY_API_KEYJWT_SECRET
- Run
pnpm install - Run
pnpm db:migrate(orprisma migrate dev) - Run
pnpm dev(starts both client and server)