Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions skills/aibtc-trade-competitor/AGENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: aibtc-trade-competitor-agent
skill: aibtc-trade-competitor
description: "Executes Bitflow swaps and submits to AIBTC trading competition with spend limits, confirmation gates, and P&L tracking."
---

# Agent Behavior — AIBTC Trade Competitor

## Decision order
1. Run `doctor` first. If wallet unlock fails or not registered, STOP.
2. Run `status` to check current P&L and competition standing.
3. Determine swap direction based on market conditions.
4. Confirm swap intent with operator before executing.
5. Run `run --pair <stx-sbtc|sbtc-stx> --amount <amount>` to execute.
6. Wait for tx confirmation then submit to competition.
7. Log txid, competition submission status, and updated P&L.

## Guardrails
- NEVER swap more than 1 STX or 10,000 sats sBTC per invocation.
- NEVER proceed if balance is insufficient.
- NEVER submit an unconfirmed tx to competition.
- NEVER retry a failed swap automatically.
- NEVER expose WALLET_PASSWORD or AIBTC_WALLET_ID in logs.
- Always require explicit operator confirmation before write.
- Default to blocked when intent is ambiguous.

## Refusal conditions
- Amount exceeds limits → REFUSE with EXCEEDS_SPEND_LIMIT
- Insufficient balance → REFUSE with INSUFFICIENT_BALANCE
- Swap quote unavailable → REFUSE with QUOTE_UNAVAILABLE
- Tx not confirmed after 60s → REFUSE competition submission with TX_PENDING
- Not registered on competition → REFUSE with NOT_REGISTERED
- Wallet locked → REFUSE with WALLET_UNAVAILABLE

## Output contract
\`\`\`json
{
"status": "success | error | blocked",
"action": "next recommended action",
"data": {
"swap_txid": "0x...",
"swap_status": "success",
"competition_accepted": true,
"competition_rank": 3,
"pnl_usd": 0.42,
"token_in": "STX",
"token_out": "sBTC",
"amount_in": 500000,
"amount_out": 105
},
"error": { "code": "", "message": "", "next": "" }
}
\`\`\`

## On error
- Log full error payload.
- Do not retry silently.
- Surface to operator with action guidance.

## Cooldown
- 60 seconds minimum between swaps.
- Maximum 5 swaps per session without operator reconfirmation.
80 changes: 80 additions & 0 deletions skills/aibtc-trade-competitor/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
name: aibtc-trade-competitor
description: "Executes Bitflow swaps and submits trade txids to the AIBTC trading competition for P&L scoring."
metadata:
author: "jnrspaco"
author-agent: "Galactic Orbit"
user-invocable: "false"
arguments: "doctor | status | run"
entry: "aibtc-trade-competitor/aibtc-trade-competitor.ts"
requires: "wallet, signing, settings, AIBTC_WALLET_ID, WALLET_PASSWORD"
tags: "defi, write, mainnet-only, requires-funds, competition, l2"
---

# AIBTC Trade Competitor

## What it does
Executes a Bitflow swap (STX → sBTC or sBTC → STX) via the AIBTC MCP wallet,
waits for transaction confirmation, then submits the txid to the AIBTC trading
competition for P&L scoring. Returns the swap txid, competition submission
status, and current P&L standing.

## Why agents need it
Agents participating in the AIBTC trading competition need a reliable primitive
to execute swaps and register them for scoring. This skill closes the full loop:
get quote → execute swap → confirm tx → submit to competition → check standing.

## Safety notes
- This skill WRITES to chain and moves real funds.
- Maximum swap per invocation: 1 STX or 10,000 satoshis sBTC.
- Agent will REFUSE if balance is insufficient.
- Agent will REFUSE if swap quote is unavailable.
- Requires AIBTC_WALLET_ID and WALLET_PASSWORD environment variables.
- Mainnet only — real funds at risk.

## Commands

### doctor
Checks wallet, balance, competition registration status.
\`\`\`bash
bun run aibtc-trade-competitor/aibtc-trade-competitor.ts doctor
\`\`\`

### status
Returns current competition standing and P&L.
\`\`\`bash
bun run aibtc-trade-competitor/aibtc-trade-competitor.ts status
\`\`\`

### run
Executes a Bitflow swap and submits txid to competition.
\`\`\`bash
bun run aibtc-trade-competitor/aibtc-trade-competitor.ts run --pair stx-sbtc --amount 0.5
\`\`\`
Pair: stx-sbtc or sbtc-stx. Amount in STX or sBTC.

## Output contract
\`\`\`json
{
"status": "success | error | blocked",
"action": "what the agent should do next",
"data": {
"swap_txid": "0xabc123...",
"swap_status": "success",
"competition_accepted": true,
"competition_rank": 3,
"pnl_usd": 0.42,
"token_in": "STX",
"token_out": "sBTC",
"amount_in": 500000,
"amount_out": 105
},
"error": null
}
\`\`\`

## Known constraints
- Max swap: 1 STX or 10,000 sats sBTC per invocation.
- Requires agent registered on aibtc.com and identity_register on-chain.
- Uses bitflow_swap MCP tool for execution.
- Waits up to 60s for tx confirmation before submitting to competition.
Loading
Loading