snake-game

star 1

Persistent autoplay daemon for the Trifle Snake game with modular strategy system

kbarbel640-del By kbarbel640-del schedule Updated 2/8/2026

name: snake-game description: Persistent autoplay daemon for the Trifle Snake game with modular strategy system version: 2.0.0 metadata: clawdhub: emoji: "๐Ÿ" requires: bins: ["node"] platforms: ["api"] depends: ["trifle-auth"]


Snake Game Skill

Play the Trifle Snake game automatically with a persistent daemon and modular strategy system.

Installation

Via ClawdHub

clawdhub install trifle-labs/snake-game

Via Git (symlink method)

# Clone the skills repo
git clone https://github.com/trifle-labs/skills.git ~/repos/trifle-skills

# Symlink to your openclaw workspace
ln -s ~/repos/trifle-skills/snake-game ~/.openclaw/workspace/skills/snake-game

# Make executable
chmod +x ~/.openclaw/workspace/skills/snake-game/snake.mjs

Manual Installation

# Copy to your skills directory
cp -r snake-game ~/.openclaw/workspace/skills/

# Make executable
chmod +x ~/.openclaw/workspace/skills/snake-game/snake.mjs

Prerequisites

  • Must be authenticated via trifle-auth skill first
  • Node.js 18+ installed
  • Balls balance (earned from games, auth bonuses, etc.)

Quick Start

# Start daemon in foreground
node snake.mjs start

# Start daemon in background (detached)
node snake.mjs start --detach

# Check status
node snake.mjs status

# Stop daemon
node snake.mjs stop

Commands

Daemon Control

snake start [--detach] [--strategy NAME]   # Start the autoplay daemon
snake stop                                  # Stop the running daemon
snake status                                # Show daemon status and stats
snake attach [-f]                           # View daemon logs (-f to follow)
snake pause                                 # Pause voting (daemon keeps running)
snake resume                                # Resume voting

Configuration

snake config [key] [value]     # Get/set configuration values
snake strategies               # List available strategies
snake server [live|staging]    # Switch game server
snake telegram [chat_id|off]   # Configure Telegram logging

Service Management

snake install-service      # Install systemd (Linux) or launchd (macOS)
snake uninstall-service    # Remove the service

Game Commands (Manual)

snake state                           # Get current game state
snake vote <dir> <team> [amount]      # Submit a vote manually
snake strategy                        # Analyze current game
snake balance                         # Check ball balance

Strategies

The skill includes 5 built-in strategies:

Strategy Alias Description
expected-value ev, default Maximizes expected value. Balanced.
aggressive agg High bids on leading teams.
underdog und Backs small pools for bigger payouts.
conservative con Minimum bids, prioritizes safety.
random rand Random valid moves.

Switch Strategy

snake config strategy aggressive
# or
snake start --strategy aggressive

Creating Custom Strategies

Extend BaseStrategy in lib/strategies/:

import { BaseStrategy } from './base.mjs';

export class MyStrategy extends BaseStrategy {
  constructor(options = {}) {
    super('my-strategy', 'Description', options);
  }

  computeVote(parsed, balance, state) {
    // Return { direction, team, amount, reason } or null
  }
}

Configuration

Key Default Description
strategy expected-value Active strategy
server live live or staging
minBalance 5 Min balance to vote
telegramChatId null Telegram chat ID

Process Management

Prevent Multiple Instances

Uses PID file to prevent duplicates.

Persist with systemd (Linux)

snake install-service
systemctl --user enable snake-daemon
systemctl --user start snake-daemon

Persist with launchd (macOS)

snake install-service
launchctl load ~/Library/LaunchAgents/com.openclaw.snake-daemon.plist

Architecture

snake-game/
โ”œโ”€โ”€ snake.mjs              # Main CLI
โ”œโ”€โ”€ lib/
โ”‚   โ”œโ”€โ”€ config.mjs         # Config management
โ”‚   โ”œโ”€โ”€ api.mjs            # API client
โ”‚   โ”œโ”€โ”€ telegram.mjs       # Telegram logging
โ”‚   โ”œโ”€โ”€ game-state.mjs     # State parsing
โ”‚   โ”œโ”€โ”€ process.mjs        # Process management
โ”‚   โ””โ”€โ”€ strategies/        # Strategy modules
โ””โ”€โ”€ daemon/
    โ””โ”€โ”€ autoplay.mjs       # Daemon loop
Install via CLI
npx skills add https://github.com/kbarbel640-del/skills --skill snake-game
Repository Details
star Stars 1
call_split Forks 0
navigation Branch main
article Path SKILL.md
More from Creator
kbarbel640-del
kbarbel640-del Explore all skills →