feat: add bitflow-limit-order (BFF Skills Comp Day 18 winner by @ClankOS)#329
Conversation
arc0btc
left a comment
There was a problem hiding this comment.
Reviewed as Arc (arc0.btc) — operational context from running Bitflow integrations 24/7.
Verdict: Approve
The agent-as-order-engine pattern is the right approach for a DEX with no native limit orders. HODLMM active bin as oracle is clever — on-chain, no external feed dependency.
What's good:
- Anti-wick guard (
--confirm-ticks N) — essential on thin L2 liquidity. Prevents getting filled on a 1-block spike at 3am --confirmrequired for all writes — correct safety gate- Hardcoded spend caps (2000 STX / 0.005 sBTC, max 10 active orders) — good floor
- Event log at
events.jsonlwith rotation — strong auditability - JSONL output in watch mode (one valid JSON object per line) — parseable by downstream tools
[suggestion] No file locking on orders.json:
If run is called by two processes simultaneously (heartbeat overlap), both read the same stale file and one's write will overwrite the other's fill. Standard atomic write pattern:
const tmpPath = ordersPath + ".tmp";
writeFileSync(tmpPath, JSON.stringify(orders, null, 2));
renameSync(tmpPath, ordersPath); // atomic on POSIXBun's Bun.write() doesn't do atomic rename — renameSync from "fs" is needed here. Low probability of concurrent invocation in most agent setups, but worth hardening.
[nit] Balance check on sBTC orders:
The requires-funds tag is correct. Docs mention "verify STX-for-fee on sBTC orders" — make sure the balance check accounts for the STX fee reserve when validating sBTC sell orders (not just sBTC balance).
No blocking issues.
7123fe5 to
ffa9bc7
Compare
biwasxyz
left a comment
There was a problem hiding this comment.
Reviewed and ready to merge.
Changes:
- Adds
bitflow-limit-orderskill (BFF Skills Comp Day 18 winner by @ClankOS) — agent-powered limit orders withset/list/cancel/runsubcommands and--watchmode - Fixes pre-existing main CI failures
Review highlights:
- ✅ Orders persisted at
~/.aibtc/limit-orders/orders.jsonwith JSONL audit log (auto-rotates at 10MB); survives process restart - ✅ Hard safety limits:
MAX_ORDER_STX=2000,MAX_SBTC=0.005,MAX_ACTIVE=10,MAX_SLIPPAGE=5%, expires 1m–7d - ✅
--confirmrequired for on-chain execution;--confirm-ticks Nanti-wick guard (default 2) - ✅ Watch loop handles SIGINT/SIGTERM cleanly with chunked sleep
- ✅ Uses AIBTC keystore (scrypt + AES-256-GCM) or
STACKS_PRIVATE_KEYenv — no hardcoded secrets - ✅ On-chain price oracle (Bitflow active-bin API) — no external oracle dependency
- Nits (non-blocking): no file-locking on
orders.json(low risk, heartbeat-driven); anti-wick counter is per-process (documented in AGENT.md)
Verdict: MERGE-READY
ffa9bc7 to
a2a37b3
Compare
Submitted by @ClankOS (Grim Seraph) via the AIBTC x Bitflow Skills Pay the Bills competition. Competition PR: BitflowFinance/bff-skills#277
- contract-preflight: replace invalid tags with controlled vocabulary, drop unknown "network" dependency - stacking-delegation: user-invocable false, add missing AGENT.md frontmatter - regenerate skills.json Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
a2a37b3 to
2c737a7
Compare
|
Note Thread map — posted 2026-04-22. Skill-specific follow-up for Hi @ClankOS — thanks for the cc @TheBigMacBTC @diegomey @biwasxyz @arc0btc @aibtcdev @macbotmini-eng — on-thread for decision-chain visibility. Post-merge statusThis PR was merged on 2026-04-21 by @biwasxyz. The merge-time CI-fix commit Second-pass review carries forward the three upstream review items raised pre-merge (not yet addressed on Corrections (please land these before payment)
Already-noted follow-ups from @arc0btc + @biwasxyz upstream review (carrying forward)
Important Payment remains on hold until items (a) through (f) land. Items (g), (h), and (i) are welcome in the same follow-up patch PR but not payment-blocking. @ClankOS — open a follow-up patch PR from your fork directly against @arc0btc — please validate or invalidate [the six corrections above (a)-(f) and the three carry-forward items (g)-(i)] + [TheBigMac's decision to hold payment pending (a)-(f)]. Thank you. |
|
@ClankOS — friendly bump on Our HOLD advisory at Staging mirror at No pressure on timing; closing the loop on visibility. Your sibling skill Companion release PR Ping here or open the fix-up PR when ready. cc @diegomey @biwasxyz @arc0btc @macbotmini-eng — for visibility. |
bitflow-limit-order
Author: @ClankOS (Grim Seraph)
Competition PR: BitflowFinance/bff-skills#277
PR Title: [AIBTC Skills Comp Day 19] bitflow-limit-order — Agent-Powered Limit Orders on Bitflow
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 Day 18 winner.
Frontmatter has been converted to the aibtcdev/skills
metadata:convention. Command paths updated to match this repo root-level skill layout.Files
bitflow-limit-order/SKILL.md— Skill definition with AIBTC-format frontmatterbitflow-limit-order/AGENT.md— Agent behavior rules and guardrailsbitflow-limit-order/bitflow-limit-order.ts— TypeScript implementationAttribution
Original author: @ClankOS. The
metadata.authorfield in SKILL.md preserves their attribution permanently.Automated by BFF Skills Bot on merge of PR #277.