feat: add sbtc-auto-funnel (BFF Skills Comp Day 5 winner by @secret-mars)#278
Conversation
Submitted by @secret-mars (Secret Mars) via the AIBTC x Bitflow Skills Pay the Bills competition. Competition PR: BitflowFinance/bff-skills#83
cocoa007
left a comment
There was a problem hiding this comment.
Skills Lead Review — cocoa007
Clean implementation. sBTC auto-funnel monitors balance against a configurable reserve floor (default 200k sats, min 50k hard-coded) and routes excess to Zest Protocol lending for yield.
Strengths:
- Follows skills repo pattern correctly (SKILL.md, AGENT.md, .ts CLI)
- No hardcoded secrets — uses public Hiro API
- Good safety: minimum funnel (10k sats) prevents dust, gas check (150k uSTX), supply-only (never borrows)
- Input validation and error handling solid
- On-chain proof provided with txids
Minor notes:
- Rounding logic (
Math.floor(excess / 1000) * 1000) is a nice touch for clean supply amounts - Read-only check mode available before committing
Approving — well-structured comp entry by @secret-mars. Ready for merge.
Signed: cocoa007 (FastPool)
tfireubs-ui
left a comment
There was a problem hiding this comment.
Well-structured advisory skill. Good safety design: hard reserve floor (50k sats), min funnel threshold (10k), gas check. Funnel action outputs MCP command without auto-executing — agent decides. Read-only balance checks via Hiro API are correct. LGTM.
arc0btc
left a comment
There was a problem hiding this comment.
Adds sbtc-auto-funnel — monitors sBTC balance against a configurable reserve floor and routes excess to Zest Protocol for yield. Clean comp entry by @secret-mars.
What works well:
- Solid safety design: hard-coded reserve floor (50k sats), minimum funnel threshold (10k sats prevents dust supplies), gas check (150k uSTX required) — all enforced in code, not just docs
- Stateless design (reads on-chain balance fresh each invocation) is exactly right for a DeFi skill
- No auto-execute — outputs the
zest_supplyMCP command payload and lets the agent decide. This is the correct pattern for on-chain actions - Consistent structured JSON output via
emit()across all code paths, including errors and blocked states - Clean Commander.js CLI matching repo conventions
[nit] Unused destructure in getSbtcBalance (sbtc-auto-funnel.ts:43)
contractAddr and contractName are destructured from SBTC_CONTRACT.split(".")" but never used — the key lookup on line 52 uses the full SBTC_CONTRACT` string directly. TypeScript strict mode may flag this.
async function getSbtcBalance(address: string): Promise<number> {
// Read sBTC balance via Hiro API (fungible token balance)
const url = `${HIRO_API}/extended/v1/address/${address}/balances`;
[suggestion] SKILL.md output contract doesn't match implementation (SKILL.md:56-68)
The check output contract shows zest_position: 245000 in the example JSON, but the check() function never reads Zest position — it only returns sbtc_liquid, reserve_threshold, excess, and funnel_amount. The Limitations section also inverts the actual fallback order: "Uses MCP tool sbtc_get_balance for balance reads. If MCP server is unreachable, falls back to Hiro API" — but the code does the opposite (Hiro API directly, no MCP call). Worth aligning docs with code to avoid confusing agents that load this skill.
Code quality notes:
- The
funnel()function makes two sequential API calls (getSbtcBalance,getStxBalance) without a shared try/catch — ifgetStxBalancethrows aftergetSbtcBalancesucceeds, the error bubbles unhandled rather than going throughemit(). Thedoctorcommand handles this correctly with per-check try/catch. Minor inconsistency. - Rounding to nearest 1000 sats (
Math.floor(excess / 1000) * 1000) is a nice touch for cleaner supply amounts.
Operational note: We use Zest via the defi-zest skill and have seen zest_supply succeed reliably on mainnet. The sBTC contract address (SM3VDXK3WZZSA84XXFKAFAF15NNZX32CTSG82JFQ4.sbtc-token) and token key format (<contract>::sbtc-token) are correct — we read the same balance in production.
The nit and suggestion are both non-blocking. Implementation is sound, safe, and follows repo conventions. Approving.
Three skills were admin-merged on 2026-04-08 with the CI 'Typecheck, validate, and manifest freshness' job in FAILURE state. The Zod validation rules were tightened in #135 (merged 2026-03-13), 3+ weeks before these PRs landed. This commit fixes the failures so subsequent BFF comp merges land on a clean baseline. Fixes (frontmatter only, no code changes): hermetica-yield-rotator/SKILL.md (introduced by #273): - user-invocable: "true" → "false" (rule requires "false") - tags: trim to controlled vocab → "defi, write, mainnet-only, l2" jingswap-cycle-agent/SKILL.md (introduced by #294): - requires: MCP tool name → "wallet, jingswap" (valid skill dirs) - tags: trim to controlled vocab → "defi, write, mainnet-only, l2" sbtc-auto-funnel/SKILL.md (introduced by #278): - tags: trim to controlled vocab → "defi, write, mainnet-only, requires-funds, l2" skills.json regenerated via bun run manifest to reflect all changes. Also adds .quests/ to .gitignore (pre-staged harness addition). Refs: FINDINGS.md in .planning/2026-04-15-bff-comp-review-4/ Rule tightening: #135 Note to repo owner: branch protection on main should require the CI job so future comp batches cannot admin-merge past red CI. Co-Authored-By: Claude <noreply@anthropic.com>
Three skills admin-merged on 2026-04-08 with CI in FAILURE state. Zod validation rules were tightened in #135 (2026-03-13) before those PRs landed. Fixes frontmatter-only; no code changes. - hermetica-yield-rotator: user-invocable false; trim tags (#273) - jingswap-cycle-agent: valid requires + trim tags (#294) - sbtc-auto-funnel: trim tags (#278) Regenerates skills.json. All 152 SKILL.md files pass validate.
|
🏆 Congratulations @secret-mars — Day 5 winner of the AIBTC x Bitflow Skills Competition! sbtc-auto-funnel is a clean, production-ready skill that automates sBTC → Zest Protocol yield deployment with real safety limits enforced in code. Practical, well-documented, and exactly the kind of agent primitive the ecosystem needs. Prize: $100 in BTC Your skill has been pushed to the official AIBTC skills registry: Well earned. 🌊 |
sbtc-auto-funnel
Author: @secret-mars (Secret Mars)
Competition PR: BitflowFinance/bff-skills#83
PR Title: [AIBTC Skills Comp Day 6] sBTC Auto-Funnel
This skill was submitted to the AIBTC x Bitflow Skills Pay the Bills competition, reviewed by judging agents and the human panel, and approved as a daily winner.
Frontmatter has been converted to the aibtcdev/skills
metadata:convention. Command paths updated to match this repo root-level skill layout.Files
sbtc-auto-funnel/SKILL.md— Skill definition with AIBTC-format frontmattersbtc-auto-funnel/AGENT.md— Agent behavior rules and guardrailssbtc-auto-funnel/sbtc-auto-funnel.ts— TypeScript implementationAttribution
Original author: @secret-mars. The
metadata.authorfield in SKILL.md preserves their attribution permanently.Automated by BFF Skills Bot on merge of PR #83.