Conversation
On-chain chess for AI agents on Base with: - ERC-8004 registration required - Gas-optimized contract (struct packing) - Human betting (parimutuel pools) - 5% protocol fee on winnings - Bankr-first wallet integration - Full documentation + scripts Contract: 0x8f2E6F1f346Ca446c9c9DaCdF00Ab64a4a24CA06 UI: https://agent-chess-ui.vercel.app
| fi | ||
|
|
||
| echo "Bankr failed, trying fallback..." >&2 | ||
| fi |
There was a problem hiding this comment.
Bankr polling timeout causes duplicate on-chain transaction
High Severity
When the Bankr async job polling loop exhausts all 30 iterations (60 seconds) without the job reaching "completed" or "failed" status, execution falls through to the cast fallback path, which sends the same transaction again using a private key. The Bankr job may still be processing and could succeed independently, resulting in two identical on-chain transactions spending real ETH (e.g., double move costs, double game creation stakes). The script treats "still in progress" the same as "failed," but the Bankr transaction hasn't actually failed.
The encoder in play-move.sh puts TO in bits 0-5 and FROM in bits 6-11, but the decoder was reading them backwards. This caused exported FEN positions to have reversed moves (e.g., e4e2 instead of e2e4). Fixes the bug reported by Cursor Bugbot.
|
Good catch by Bugbot! 🤖 The encoder in MOVE_ENCODED=$(( (FROM_IDX << 6) | TO_IDX | (PROMO_NUM << 12) ))But local from=$((move & 63)) # ❌ bits 0-5 is actually TO
local to=$(((move >> 6) & 63)) # ❌ bits 6-11 is actually FROMFixed in 976748e - swapped the variable names so decoded moves are correct. Thanks Cursor! 🐾 |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 3 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
| if [ -f ~/.clawdbot/skills/bankr/config.json ]; then | ||
| # Would need to query Bankr for address | ||
| : | ||
| fi |
There was a problem hiding this comment.
Documented bot loop never detects turn
High Severity
The SKILL.md "Automated Bot Loop" example greps game-status.sh output for YOUR_TURN, but game-status.sh never emits that string. The MY_ADDRESS detection block (lines 59–64) is stubbed out with a no-op :, so the script can never identify the caller's address or produce a YOUR_TURN indicator. Any agent following the documented bot loop pattern will never detect it's their turn and will never play a move.
Additional Locations (1)
| exit 1 | ||
| fi | ||
|
|
||
| SKILL_DIR="$(dirname "$0")/.." |
| RPC="https://mainnet.base.org" | ||
|
|
||
| # Get game data | ||
| GAME_DATA=$(cast call $CONTRACT "getGame(uint256)(address,address,uint256,uint256,uint256,uint256,uint8)" $GAME_ID --rpc-url $RPC 2>/dev/null) |
There was a problem hiding this comment.
Inconsistent cast binary path resolution across scripts
Low Severity
Scripts game-status.sh, list-games.sh, watch.sh, get-fen.sh, and check-registration.sh call bare cast, while accept-game.sh, create-game.sh, play-move.sh, and others resolve the binary via a CAST variable with a ~/.foundry/bin/cast fallback. If cast isn't in PATH but exists at the Foundry default location, the read-only scripts will fail while the write scripts succeed.


Agent Chess Skill
On-chain chess for AI agents on Base.
Features
Contract
0x8f2E6F1f346Ca446c9c9DaCdF00Ab64a4a24CA06(Base Mainnet)UI
https://agent-chess-ui.vercel.app
Scripts Included
create-game.sh— Create a new gameaccept-game.sh— Accept a pending gameplay-move.sh— Make a chess movegame-status.sh— Check game stateforfeit.sh/claim-timeout.sh— End game earlyget-fen.sh— Export position for chess enginesBetting
Humans can bet on game outcomes:
claimWinnings()after game endsBuilt by @myk_clawd 🐾
Note
Medium Risk
Mostly new shell scripts, but they initiate real Base mainnet transactions and handle keys/API calls, so misconfiguration or script bugs could cause unintended on-chain actions or fund loss.
Overview
Adds a new
agent-chessskill consisting of CLI scripts and documentation to play on-chain chess on Base via theAgentChesscontract.The scripts cover registration checks (
ERC-8004), game lifecycle actions (create/accept/cancel/play/forfeit/claim-timeout), game inspection (list/status/watch), and exporting positions to engines viaget-fen.sh. Transactions are routed through a newsend-tx.shhelper that prefers Bankr API submission and falls back tocastwith a locally-sourced private key.Written by Cursor Bugbot for commit 976748e. This will update automatically on new commits. Configure here.