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
54 changes: 54 additions & 0 deletions skills/zest-supply-executor/AGENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: zest-supply-executor-agent
skill: zest-supply-executor
description: "Supplies STX to Zest Protocol via AIBTC MCP wallet with hardcoded spend limit and real on-chain execution proof."
---

# Agent Behavior — Zest Supply Executor

## Decision order
1. Run `doctor` first. If wallet unlock fails or balance insufficient, STOP.
2. Confirm supply intent with operator.
3. Run `run --amount <stx>` to execute supply on-chain.
4. Parse JSON output, confirm txid on Hiro explorer.
5. Log txid and amount supplied.

## Guardrails
- NEVER supply more than 1 STX per invocation.
- NEVER proceed if wallet unlock fails.
- NEVER proceed if STX balance is insufficient.
- NEVER retry a failed transaction automatically.
- NEVER expose CLIENT_MNEMONIC in logs or output.
- Always require explicit operator confirmation before write.

## Refusal conditions
- Amount > 1 STX → REFUSE with EXCEEDS_SPEND_LIMIT
- Insufficient STX balance → REFUSE with INSUFFICIENT_BALANCE
- Wallet unlock failed → REFUSE with WALLET_UNAVAILABLE
- MCP server unavailable → REFUSE with MCP_UNAVAILABLE

## Output contract
\`\`\`json
{
"status": "success | error | blocked",
"action": "next recommended action",
"data": {
"txid": "0x...",
"amount_stx": 0.1,
"amount_micro_stx": 100000,
"protocol": "zest",
"function": "supply",
"tx_status": "pending"
},
"error": { "code": "", "message": "", "next": "" }
}
\`\`\`

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

## Cooldown
- 60 seconds minimum between supply operations.
- Maximum 3 supplies per session without operator reconfirmation.
74 changes: 74 additions & 0 deletions skills/zest-supply-executor/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
name: zest-supply-executor
description: "Supplies STX to Zest Protocol lending pool via AIBTC MCP wallet and returns a real on-chain transaction ID as proof."
metadata:
author: "jnrspaco"
author-agent: "Galactic Orbit"
user-invocable: "false"
arguments: "doctor | run"
entry: "zest-supply-executor/zest-supply-executor.ts"
requires: "wallet, signing, settings"
tags: "defi, write, mainnet-only, requires-funds, l2"
---

# Zest Supply Executor

## What it does
Supplies STX to the Zest Protocol lending pool on Stacks mainnet by calling
the AIBTC MCP wallet's zest_supply tool directly. Spawns the MCP server,
unlocks the wallet, executes the supply transaction, and returns the real
on-chain transaction ID as proof. Enforces a hardcoded 1 STX spend limit
per invocation with pre-flight balance checks.

## Why agents need it
Agents need a simple, provable primitive to supply STX to Zest and start
earning yield. This skill closes the loop between intent and execution —
it does not just output parameters, it actually signs and broadcasts the
transaction and returns the txid.

## Safety notes
- This skill WRITES to chain and moves real funds.
- Maximum supply per invocation: 1 STX — hardcoded spend limit.
- Agent will REFUSE if STX balance is insufficient.
- Agent will REFUSE if wallet unlock fails.
- Agent will REFUSE if amount exceeds spend limit.
- Mainnet only — real funds at risk.
- Requires CLIENT_MNEMONIC environment variable.

## Commands

### doctor
Checks MCP server, wallet unlock, and STX balance.
\`\`\`bash
bun run zest-supply-executor/zest-supply-executor.ts doctor
\`\`\`

### run
Supplies STX to Zest lending pool and returns real txid.
\`\`\`bash
bun run zest-supply-executor/zest-supply-executor.ts run --amount 0.1
\`\`\`
Amount in STX. Max per invocation: 1 STX.

## Output contract
\`\`\`json
{
"status": "success | error | blocked",
"action": "what the agent should do next",
"data": {
"txid": "0xabc123...",
"amount_stx": 0.1,
"amount_micro_stx": 100000,
"protocol": "zest",
"function": "supply",
"tx_status": "pending"
},
"error": null
}
\`\`\`

## Known constraints
- Max supply: 1 STX per invocation.
- Requires CLIENT_MNEMONIC environment variable set.
- Requires STX balance greater than amount plus gas (~0.01 STX).
- MCP server spawned locally via npx @aibtc/mcp-server.
55 changes: 55 additions & 0 deletions skills/zest-supply-executor/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions skills/zest-supply-executor/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"compilerOptions":{"module":"nodenext","moduleResolution":"nodenext","target":"es2020","types":["node"],"skipLibCheck":true}}
Loading
Loading