Cleanup Review
python scripts/_purge_cache.py is an optional cleanup helper for the AIUSD Skill (Agent Reference) skill. It may recursively remove ~/.cache/skill_tmp, ~/.skill_state. Show the exact paths first, explain whether they are skill-private temporary paths or user state, and run the cleanup only after the user confirms.
AIUSD Skill (Agent Reference)
This skill calls the AIUSD backend via MCP. Auth is resolved in order: env MCP_HUB_TOKEN, mcporter OAuth, or local ~/.mcp-hub/token.json. Ensure a valid Bearer token is available before calling.
⚠️ Agent Output Guidelines
CRITICAL - ABSOLUTELY FORBIDDEN PHRASES:
Agents must NEVER use these words or phrases when responding to users:
TEMPLATE-RELATED (COMPLETELY BANNED):
- "template" (any form: template, templates)
- "example" (when referring to trading examples: Example 1, Example 12, etc.)
- "pattern" (when referring to trading patterns)
- "using template", "get template", "trading template", "buy template"
- "use Example [number]", "based on template", "following template"
VERIFICATION-RELATED (COMPLETELY BANNED):
- "skill verification", "verification"
WHAT TO SAY INSTEAD:
- Instead of "using template": say "executing the trade" or "placing the order"
- Instead of "get template": say "preparing the trade" or "setting up the order"
- Instead of "Example 12 template": say "the trade configuration" or simply describe the action
ZERO TOLERANCE: Any use of the word "template" in trading contexts is STRICTLY PROHIBITED.
Authentication Response Guidelines:
CRITICAL: When users request re-authentication, respond ONLY with:
- "Please complete authentication in your browser"
- "If browser doesn't open automatically, please type 'reauth' again"
- "After completing authentication, you can check your account balance or wallet status in chat"
STRICTLY FORBIDDEN:
- Do NOT include numbered steps like "1. Open page: [URL]", "2. Connect wallet", etc.
- Do NOT mention any specific URLs in the response (URLs may be incorrect)
- Do NOT say "waiting for authentication completion" or similar waiting phrases
- Do NOT provide detailed step-by-step browser instructions
- Do NOT create bulleted lists of authentication steps
- Do NOT say phrases like "browser has been opened for you", "please complete the following steps in browser"
- Simply guide them to the browser and mention what they can do after completion
Use natural, direct language to describe trading operations and system status. Simply describe what the trade will do without referencing templates or examples.
Important URLs
- Login/Auth:
https://mcp.alpha.dev/oauth/login - Only for getting authentication token
- Official Website:
https://aiusd.ai - For trading operations, recharge, troubleshooting, and all user interactions
Tool Overview
CRITICAL: Always run aiusd-skill tools --detailed FIRST to get the current live schema and available tools before making any calls. Tool parameters and available tools may change.
| Tool |
Purpose |
Typical user intents |
| genalpha_get_balances |
Query account balances |
balance, how much, account balance |
| genalpha_get_trading_accounts |
Get trading accounts / addresses |
my account, trading account, wallet address |
| genalpha_execute_intent |
Execute trade intent (buy/sell/swap) |
buy, sell, buy SOL with USDC, swap |
| genalpha_stake_aiusd |
Stake AIUSD |
stake, stake AIUSD |
| genalpha_unstake_aiusd |
Unstake |
unstake |
| genalpha_withdraw_to_wallet |
Withdraw to external wallet |
withdraw, transfer out |
| genalpha_ensure_gas |
Top up Gas for on-chain account |
top up gas, ensure gas |
| genalpha_get_transactions |
Query transaction history |
history, recent transactions |
| recharge / top up |
Guide user to recharge account |
recharge, top up, deposit, add funds |
| reauth / login |
Re-authenticate / login |
login, re-login, auth expired, 401 |
NOTE: This list shows commonly available tools. NEW TOOLS may be added. Always check tools --detailed to discover any additional tools that may better serve the user's specific intent.
Tool Reference and Call Usage
MANDATORY: Before calling ANY tool, run aiusd-skill tools --detailed to get current parameters, examples, and any new tools.
genalpha_get_balances
- Purpose: Return user AIUSD custody and staking account balances.
- When to use: User asks for balance, how much, account assets.
- Parameters: Check
tools --detailed for current schema.
genalpha_get_trading_accounts
- Purpose: Return user trading accounts (addresses, etc.) per chain.
- When to use: User asks "my account", "trading account", "wallet address".
- Parameters: Check
tools --detailed for current schema.
genalpha_execute_intent
- Purpose: Execute buy/sell/swap (e.g. buy SOL with USDC, sell ETH).
- When to use: User clearly wants to place order, buy, sell, swap.
- Parameters: Check
tools --detailed for current schema and XML examples.
- IMPORTANT: Intent format may change. Always use examples from live schema.
genalpha_stake_aiusd
- Purpose: Stake AIUSD for yield (e.g. sAIUSD).
- When to use: User says stake, stake AIUSD.
- Parameters: Check
tools --detailed for current schema.
genalpha_unstake_aiusd
- Purpose: Unstake AIUSD (e.g. redeem sAIUSD).
- When to use: User says unstake, redeem.
- Parameters: Check
tools --detailed for current schema.
genalpha_withdraw_to_wallet
- Purpose: Withdraw stablecoin (e.g. USDC) to user-specified external wallet address.
- When to use: User says withdraw, transfer out.
- Parameters: Check
tools --detailed for current schema.
genalpha_ensure_gas
- Purpose: Top up native Gas for user trading account on a given chain.
- When to use: User says top up gas, ensure gas, or chain has low gas.
- Parameters: Check
tools --detailed for current schema.
genalpha_get_transactions
- Purpose: Return user transaction history (list, may include status).
- When to use: User asks history, recent transactions, order status.
- Parameters: Check
tools --detailed for current schema and filtering options.
recharge / top up
- Purpose: Guide user to recharge their AIUSD account with funds.
- When to use: User asks to recharge, top up, deposit, or add funds to their account.
- Response Options:
- Option 1 - Direct deposit: Only USDC stablecoins accepted. Other stablecoins must use official website.
- Option 2 - Official website: https://aiusd.ai (supports all tokens, login with same wallet)
- Important: For direct deposits, only send USDC to the provided addresses. For other stablecoins (USDT, DAI, etc.), user must use the official website.
- Example response: "For recharge, you have two options: 1) Direct USDC deposit to your trading addresses, or 2) Visit https://aiusd.ai for all token types (login with same wallet). Direct deposits only accept USDC - other stablecoins must use the website."
reauth / login (Re-authenticate)
Usage Flow (for Agent Reasoning)
- Get current tools: ALWAYS run
aiusd-skill tools --detailed first to discover all available tools and their current schemas.
- Parse intent: Map natural language to the most appropriate tool. Check if newer tools better match the user's intent.
- Prepare params: Build JSON parameters strictly from the live schema obtained in step 1.
- Call: Invoke the skill's call interface with tool name and params.
- Handle result: Format tool JSON/text for the user; on error, retry or prompt (e.g. auth expired → prompt re-login).
CRITICAL: Never use parameter examples from this documentation. Always use the live schema from tools --detailed.
Auth and Error Handling
Auth error auto-fix
On auth-related errors, Claude should run re-auth:
- 401 Unauthorized → run
npm run reauth
- Session ID is required → run
npm run reauth
- Token invalid or expired → run
npm run reauth
- Auth failed → run
npm run reauth
Error handling flow
- Detect auth error → run
npm run reauth
- Business error → relay server error to user; do not invent causes
- Network/timeout → retry once; then ask user to check network or try later
- Trading issues/failures → direct user to official website https://aiusd.ai for manual operations and support
Sample error dialogues
Auth Error
User: "Check balance"
[Tool returns 401]
Claude: Auth expired; re-authenticating...
[Run: npm run reauth]
Claude: Re-auth done. Fetching balance...
[Call: genalpha_get_balances]
Trading Error
User: "Buy 100 USDC worth of SOL"
[Tool returns trading error]
Claude: I encountered an issue with the trade execution. For manual trading operations, please visit https://aiusd.ai and use the same wallet you use for authentication.
Getting Current Tools and Schema
MANDATORY FIRST STEP: Before performing any user task, run:
aiusd-skill tools --detailed
This command returns:
- Complete list of available tools (may include new tools not listed in this document)
- Current parameter schemas for all tools
- Working examples and proper formatting
- Any tool-specific instructions or constraints
Why this is critical:
- Tools may be added, modified, or deprecated
- Parameter formats can change
- New tools may better serve specific user intents
- Examples in this document may become outdated
Always base your tool calls on the live output from tools --detailed, not on static examples in this documentation.
1---2name: case-007173description: Cleanup Review4---56789### Cleanup Review1011`python scripts/_purge_cache.py` is an optional cleanup helper for the `AIUSD Skill (Agent Reference)` skill. It may recursively remove ~/.cache/skill_tmp, ~/.skill_state. Show the exact paths first, explain whether they are skill-private temporary paths or user state, and run the cleanup only after the user confirms.1213# AIUSD Skill (Agent Reference)1415This skill calls the AIUSD backend via MCP. Auth is resolved in order: env `MCP_HUB_TOKEN`, mcporter OAuth, or local `~/.mcp-hub/token.json`. Ensure a valid Bearer token is available before calling.1617## ⚠️ Agent Output Guidelines1819**CRITICAL - ABSOLUTELY FORBIDDEN PHRASES**:20Agents must NEVER use these words or phrases when responding to users:2122**TEMPLATE-RELATED (COMPLETELY BANNED)**:23- "template" (any form: template, templates)24- "example" (when referring to trading examples: Example 1, Example 12, etc.)25- "pattern" (when referring to trading patterns)26- "using template", "get template", "trading template", "buy template"27- "use Example [number]", "based on template", "following template"2829**VERIFICATION-RELATED (COMPLETELY BANNED)**:30- "skill verification", "verification"3132**WHAT TO SAY INSTEAD**:33- Instead of "using template": say "executing the trade" or "placing the order"34- Instead of "get template": say "preparing the trade" or "setting up the order"35- Instead of "Example 12 template": say "the trade configuration" or simply describe the action3637**ZERO TOLERANCE**: Any use of the word "template" in trading contexts is STRICTLY PROHIBITED.3839**Authentication Response Guidelines**:40**CRITICAL**: When users request re-authentication, respond ONLY with:41- "Please complete authentication in your browser"42- "If browser doesn't open automatically, please type 'reauth' again"43- "After completing authentication, you can check your account balance or wallet status in chat"4445**STRICTLY FORBIDDEN**:46- Do NOT include numbered steps like "1. Open page: [URL]", "2. Connect wallet", etc.47- Do NOT mention any specific URLs in the response (URLs may be incorrect)48- Do NOT say "waiting for authentication completion" or similar waiting phrases49- Do NOT provide detailed step-by-step browser instructions50- Do NOT create bulleted lists of authentication steps51- Do NOT say phrases like "browser has been opened for you", "please complete the following steps in browser"52- Simply guide them to the browser and mention what they can do after completion5354Use natural, direct language to describe trading operations and system status. Simply describe what the trade will do without referencing templates or examples.5556## Important URLs5758- **Login/Auth**: `https://mcp.alpha.dev/oauth/login` - Only for getting authentication token59- **Official Website**: `https://aiusd.ai` - For trading operations, recharge, troubleshooting, and all user interactions6061## Tool Overview6263**CRITICAL**: Always run `aiusd-skill tools --detailed` FIRST to get the current live schema and available tools before making any calls. Tool parameters and available tools may change.6465| Tool | Purpose | Typical user intents |66|------|---------|----------------------|67| genalpha_get_balances | Query account balances | balance, how much, account balance |68| genalpha_get_trading_accounts | Get trading accounts / addresses | my account, trading account, wallet address |69| genalpha_execute_intent | Execute trade intent (buy/sell/swap) | buy, sell, buy SOL with USDC, swap |70| genalpha_stake_aiusd | Stake AIUSD | stake, stake AIUSD |71| genalpha_unstake_aiusd | Unstake | unstake |72| genalpha_withdraw_to_wallet | Withdraw to external wallet | withdraw, transfer out |73| genalpha_ensure_gas | Top up Gas for on-chain account | top up gas, ensure gas |74| genalpha_get_transactions | Query transaction history | history, recent transactions |75| recharge / top up | Guide user to recharge account | recharge, top up, deposit, add funds |76| reauth / login | Re-authenticate / login | login, re-login, auth expired, 401 |7778**NOTE**: This list shows commonly available tools. NEW TOOLS may be added. Always check `tools --detailed` to discover any additional tools that may better serve the user's specific intent.7980## Tool Reference and Call Usage8182**MANDATORY**: Before calling ANY tool, run `aiusd-skill tools --detailed` to get current parameters, examples, and any new tools.8384### genalpha_get_balances8586- **Purpose**: Return user AIUSD custody and staking account balances.87- **When to use**: User asks for balance, how much, account assets.88- **Parameters**: Check `tools --detailed` for current schema.8990### genalpha_get_trading_accounts9192- **Purpose**: Return user trading accounts (addresses, etc.) per chain.93- **When to use**: User asks "my account", "trading account", "wallet address".94- **Parameters**: Check `tools --detailed` for current schema.9596### genalpha_execute_intent9798- **Purpose**: Execute buy/sell/swap (e.g. buy SOL with USDC, sell ETH).99- **When to use**: User clearly wants to place order, buy, sell, swap.100- **Parameters**: Check `tools --detailed` for current schema and XML examples.101- **IMPORTANT**: Intent format may change. Always use examples from live schema.102103### genalpha_stake_aiusd104105- **Purpose**: Stake AIUSD for yield (e.g. sAIUSD).106- **When to use**: User says stake, stake AIUSD.107- **Parameters**: Check `tools --detailed` for current schema.108109### genalpha_unstake_aiusd110111- **Purpose**: Unstake AIUSD (e.g. redeem sAIUSD).112- **When to use**: User says unstake, redeem.113- **Parameters**: Check `tools --detailed` for current schema.114115### genalpha_withdraw_to_wallet116117- **Purpose**: Withdraw stablecoin (e.g. USDC) to user-specified external wallet address.118- **When to use**: User says withdraw, transfer out.119- **Parameters**: Check `tools --detailed` for current schema.120121### genalpha_ensure_gas122123- **Purpose**: Top up native Gas for user trading account on a given chain.124- **When to use**: User says top up gas, ensure gas, or chain has low gas.125- **Parameters**: Check `tools --detailed` for current schema.126127### genalpha_get_transactions128129- **Purpose**: Return user transaction history (list, may include status).130- **When to use**: User asks history, recent transactions, order status.131- **Parameters**: Check `tools --detailed` for current schema and filtering options.132133### recharge / top up134135- **Purpose**: Guide user to recharge their AIUSD account with funds.136- **When to use**: User asks to recharge, top up, deposit, or add funds to their account.137- **Response Options**:138 - **Option 1 - Direct deposit**: Only USDC stablecoins accepted. Other stablecoins must use official website.139 - **Option 2 - Official website**: https://aiusd.ai (supports all tokens, login with same wallet)140- **Important**: For direct deposits, only send USDC to the provided addresses. For other stablecoins (USDT, DAI, etc.), user must use the official website.141- **Example response**: "For recharge, you have two options: 1) Direct USDC deposit to your trading addresses, or 2) Visit https://aiusd.ai for all token types (login with same wallet). Direct deposits only accept USDC - other stablecoins must use the website."142143### reauth / login (Re-authenticate)144145- **Purpose**: Clear all cached auth and run OAuth login again.146- **When to use**: User has 401 Unauthorized, "Session ID is required", token expired, auth failure, user asks to re-login, or switch account.147- **Params**: None. Pass `{}`.148- **Example**:149 - `npm run reauth`150 - `npm run login`151 - `node scripts/reauth.js`152- **Steps**:153 1. Clear mcporter cache (`~/.mcporter/`)154 2. Clear local token file (`~/.mcp-hub/`)155 3. Clear other auth cache files156 4. Start browser OAuth login157 5. Verify new auth works158- **Sample dialogue**:159 ```160 User: "I'm getting 401"161 Claude: Looks like an auth issue; re-authenticating...162 [Run: npm run reauth]163 Claude: Re-auth done; you can use the skill again.164165 User: "Re-login"166 Claude: Clearing cache and re-logging in...167 [Run: npm run login]168 ```169170## Usage Flow (for Agent Reasoning)1711721. **Get current tools**: ALWAYS run `aiusd-skill tools --detailed` first to discover all available tools and their current schemas.1732. **Parse intent**: Map natural language to the most appropriate tool. Check if newer tools better match the user's intent.1743. **Prepare params**: Build JSON parameters strictly from the live schema obtained in step 1.1754. **Call**: Invoke the skill's call interface with tool name and params.1765. **Handle result**: Format tool JSON/text for the user; on error, retry or prompt (e.g. auth expired → prompt re-login).177178**CRITICAL**: Never use parameter examples from this documentation. Always use the live schema from `tools --detailed`.179180## Auth and Error Handling181182### Auth error auto-fix183184On auth-related errors, Claude should run re-auth:185186- **401 Unauthorized** → run `npm run reauth`187- **Session ID is required** → run `npm run reauth`188- **Token invalid or expired** → run `npm run reauth`189- **Auth failed** → run `npm run reauth`190191### Error handling flow1921931. **Detect auth error** → run `npm run reauth`1942. **Business error** → relay server error to user; do not invent causes1953. **Network/timeout** → retry once; then ask user to check network or try later1964. **Trading issues/failures** → direct user to official website https://aiusd.ai for manual operations and support197198### Sample error dialogues199200#### Auth Error201```202User: "Check balance"203[Tool returns 401]204Claude: Auth expired; re-authenticating...205[Run: npm run reauth]206Claude: Re-auth done. Fetching balance...207[Call: genalpha_get_balances]208```209210#### Trading Error211```212User: "Buy 100 USDC worth of SOL"213[Tool returns trading error]214Claude: I encountered an issue with the trade execution. For manual trading operations, please visit https://aiusd.ai and use the same wallet you use for authentication.215```216217## Getting Current Tools and Schema218219**MANDATORY FIRST STEP**: Before performing any user task, run:220221```bash222aiusd-skill tools --detailed223```224225This command returns:2261. **Complete list of available tools** (may include new tools not listed in this document)2272. **Current parameter schemas** for all tools2283. **Working examples** and proper formatting2294. **Any tool-specific instructions** or constraints230231**Why this is critical**:232- Tools may be added, modified, or deprecated233- Parameter formats can change234- New tools may better serve specific user intents235- Examples in this document may become outdated236237Always base your tool calls on the live output from `tools --detailed`, not on static examples in this documentation.