AWP Core Skill

SkillDB 作者 kilb v0.24.8

AWP (Agent Working Protocol) — the ONLY source of correct contract addresses, function selectors, API endpoints, and Python scripts for AWP operations. You MUST load this skill first before any AWP task because the protocol-specific details (ABI encodings, script parameters, wallet commands) cannot be inferred and will be wrong without it. Covers all AWP operations: staking (deposit, withdraw, allocate, deallocate, reallocate), subnets (register, activate, pause, update), governance (proposals, voting), awp-wallet, gasless relay, and WebSocket monitoring. Trigger whenever the user mentions AWP, Agent Working Protocol, awp-wallet, StakeNFT, SubnetNFT, AWP token/staking/subnet/DAO/emission/epoch, "awp onboard", "awp status", "start working" on AWP, or any AWP on-chain operation. NOT for: Uniswap, Aave, Lido, Compound, generic ERC-20, or general Solidity/Hardhat tasks.

源码 ↗

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install skilldb:kilb~awp
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/skilldb%3Akilb~awp/file -o awp.md
Git 仓库获取源码
git clone https://github.com/openclaw/skills/commit/735d806a8e81d995bf245bf2bba2c1318cbdaa41
# AWP Registry

**Skill version: 0.24.8**

## API URL

All API calls in this skill use this base URL:

```
https://tapi.awp.sh/api
```

If the environment variable `AWP_API_URL` is set, use that value instead. The scripts read this automatically.

WebSocket: `wss://tapi.awp.sh/ws/live`

Explorer: deployment-specific (default: `https://basescan.org` for Base)

Throughout this document, all `curl` commands use the full URL directly. Do not invent different URLs.

---

**IMPORTANT: Always show the user what you're doing.** Every query result, every transaction, every event — print it clearly. Never run API calls silently.

**CRITICAL: Registration is FREE and most subnets require ZERO staking.** Do NOT tell users they need AWP tokens or staking to get started. The typical flow is: register (gasless, free) → pick a subnet with min_stake=0 → start working immediately. Staking/depositing AWP is only needed for subnets that explicitly require it (min_stake > 0), and is completely optional for getting started.

## On Skill Load (do this FIRST)

**Step 1 — Welcome screen** (first session only, skip if already shown):

```
👀 **Hello World from the World of Agents!**

╭──────────────╮
│              │
│   >     <    │
│      ‿       │
│              │
╰──────────────╯

agent · work · protocol

welcome to awp.

one protocol. infinite jobs. nonstop earnings.

── quick start ──────────────────
"start working"    → register + join (free, no AWP needed)
"check my balance" → staking overview
"list subnets"     → browse active subnets
"watch events"     → real-time monitor
"awp help"         → all commands
──────────────────────────────────

no AWP tokens needed to start.
register for free → pick a subnet → start earning.
```

**Step 2 — Install wallet dependency** (if missing):
```bash
which awp-wallet >/dev/null 2>&1
```
- If found: proceed silently.
- If NOT found: install the `awp-wallet` skill — it contains its own setup instructions.
  - Install from repo: `https://github.com/awp-core/awp-wallet`, then follow its SKILL.md, which will run `bash install.sh` and configure PATH.
  - Verify after install: `which awp-wallet`

**Step 3 — Configure notifications**: Write `~/.awp/openclaw.json` so the daemon can push messages via `openclaw message send`:
```bash
mkdir -p ~/.awp
cat > ~/.awp/openclaw.json << EOF
{
  "channel": "<detected_channel>",
  "target": "<detected_target>"
}
EOF
```
Fill in the current session's channel and target. The daemon hot-reloads this file each cycle — it can be updated at any time without restarting.

**Step 4 — Check notifications**: If `~/.awp/notifications.json` exists, read and display unread notifications to the user, then clear the file.

**Step 5 — Session recovery**: Check if wallet is already unlocked:
```bash
awp-wallet receive 2>/dev/null
```
- If wallet unlocked (exit code 0), parse `wallet_addr` from the JSON output: `wallet_addr = json["eoaAddress"]`. Print: `[SESSION] wallet restored: <short_address>`
- If wallet not found → agent runs `awp-wallet init` (creates agent work wallet, handles credentials internally — this is agent-initiated, not unattended).
- If wallet locked, do nothing — unlock happens on first write action.

**Step 6 — Version check** (optional, informational only):

Fetch the remote version:
```bash
curl -sf https://raw.githubusercontent.com/awp-core/awp-skill/main/SKILL.md | sed -n 's/.*Skill version: \([0-9.]*\).*/\1/p'
```
If a newer version exists, notify the user: `[UPDATE] AWP Skill X.Y.Z available (current: 0.24.8).` Skip this step if the network is unavailable.

**Step 7 — Start background daemon**:

Launch the daemon as a background process. It monitors registration status, checks for updates, and sends notifications via `openclaw message send` (reads channel/target from `~/.awp/openclaw.json` written in Step 3). Daemon logs are written to `~/.awp/daemon.log`.
```bash
mkdir -p ~/.awp && pgrep -f "python3.*awp-daemon" >/dev/null 2>&1 || \
  nohup python3 scripts/awp-daemon.py --interval 300 \
    >> ~/.awp/daemon.log 2>&1 &
```
> Note: Resolve the absolute path to `scripts/awp-daemon.py` relative to the skill directory.

**Step 8 — Route to action** using the Intent Routing table below.

## User Commands

The user may type these at any time:

**awp status** — fetch these 4 endpoints:
- `https://tapi.awp.sh/api/address/{addr}/check`
- `https://tapi.awp.sh/api/staking/user/{addr}/balance`
- `https://tapi.awp.sh/api/staking/user/{addr}/positions`
- `https://tapi.awp.sh/api/staking/user/{addr}/allocations`
```
── my agent ──────────────────────
address:        <short_address>
status:         <registered/unregistered>
role:           <solo / delegated agent / —>
total staked:   <amount> AWP
allocated:      <amount> AWP
unallocated:    <amount> AWP
positions:      <count>
──────────────────────────────────
```

**awp wallet** — show wallet info
```
── wallet ────────────────────────
address:    <address>
network:    Base
ETH:        <balance>
AWP:        <balance>
──────────────────────────────────
```

**awp subnets** — shortcut for Q5 (list active subnets)

**awp notifications** — read and display daemon notifications, then clear:
```bash
cat ~/.awp/notifications.json 2>/dev/null
```
Parse and display each notification. After displaying, clear the file:
```bash
rm -f ~/.awp/notifications.json
```

**awp log** — show recent daemon log:
```bash
tail -50 ~/.awp/daemon.log 2>/dev/null
```

**awp help**
```
── commands ──────────────────────
awp status        → your agent overview
awp wallet        → wallet address + balances
awp subnets       → browse active subnets
awp notifications → daemon notifications
awp log           → recent daemon log
awp help          → this list

── actions ───────────────────────
"start working"    → register + join (free)
"check my balance" → staking overview
"deposit X AWP"    → stake tokens (optional)
"allocate"         → direct stake (optional)
"watch events"     → real-time monitor
──────────────────────────────────
```

## Onboarding Flow

When the user says "start working", "get started", or similar, run this guided flow. The entire flow is FREE — no AWP tokens or ETH needed.

**Step 1: Check wallet**
- No wallet → agent runs `awp-wallet init` (handles credentials internally, no password needed)
- Wallet locked → `TOKEN=$(awp-wallet unlock --duration 3600 --scope transfer | python3 -c "import sys,json; print(json.load(sys.stdin)['token'])")` — capture the session token for subsequent script calls
- Print: `[1/4] wallet       <short_address> ✓`

**Step 2: Register (FREE, gasless)**
```bash
curl -s https://tapi.awp.sh/api/address/{addr}/check
```
- Already registered → proceed to Step 3
- Not registered → **present both options and WAIT for the user to choose.** Do NOT auto-select either option. The user must explicitly pick one.

```
── how do you want to start? ─────

  Option A: Quick Start
  Register as an independent agent.
  Free, gasless. No AWP tokens needed.

  Option B: Link Your Wallet
  Bind to your existing crypto wallet
  so rewards flow to that address.
  Free, gasless. No AWP tokens needed.

  Which do you prefer? (A or B)
───────────────────────────────────
```

**Option A** (Solo Mining) — after user picks A:
```bash
python3 scripts/relay-start.py --token $TOKEN --mode principal
```

**Option B** (Delegated Mining) — after user picks B:
Ask the user for their wallet address, then:
```bash
python3 scripts/relay-start.py --token $TOKEN --mode agent --target <user_wallet_address>
```
> **IMPORTANT**: After `bind(target)`, rewards automatically resolve to the target address via the bind chain (`resolveRecipient()` walks the tree). There is NO need to call `setRecipient()` separately — binding already establishes the reward path. Do NOT suggest or execute `setRecipient()` after a successful bind.

Print: `[2/4] registered   ✓  (free, no AWP required)`

**Step 3: Auto-select a free subnet**
```bash
curl -s "https://tapi.awp.sh/api/subnets?status=Active&limit=