ClashGO

command module
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 30 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README ΒΆ

ClashGO βš”οΈ

Release Go Platform

High-performance, lightweight Clash of Clans automation engine written in Go and OpenCV. Built natively for macOS (Apple Silicon) with sub-millisecond persistent ADB transport, resilient computer vision, self-healing recovery, a sleek desktop GUI, and a headless CLI.


⚑ Key Highlights

  • Native Apple Silicon Architecture: Compiled directly for ARM64 macOS β€” zero Rosetta translation, minimal memory footprint, and low thermals.
  • Persistent ADB Engine: Bypasses slow adb shell execution loops using a raw persistent socket connection (exec:/system/bin/screencap), reducing capture latency to ~30–50ms.
  • Resilient Computer Vision: Multi-scale template matching and OCR powered by OpenCV and Apple Vision, with built-in asset pooling to eliminate memory thrash.
  • Self-Healing State Watchdogs: Auto-dismisses post-boot splash chains ("TAP!" continue $\to$ castle logo $\to$ news dialog) and recovers gracefully from disconnected emulators, network stalls, and UI interruptions.
  • Customizable Strategy Formulas: Author drop orders, deploy angles, and timings via YAML strategies (assets/strategies/) paired with geometric formula JSONs (pkg/formula/).
  • Interactive Visual Calibration: Launch browser-based interactive tools (make roi-picker, make pick-coords) to drag boxes, crop templates, and calibrate HUD coordinates live on emulator frames.
  • 1-Click In-App Updater: Automated GitHub Releases integration. Detects new versions, verifies SHA-256 signatures, applies detached hot-swaps, and relaunches with zero manual re-installation.
  • Headless CLI (bot_cli) & Desktop GUI (Wails): Run the full bot engine headlessly inside tmux for 24/7 background farming (~25–40 MB RSS), or launch the modern React/Wails UI for visual analytics and live control.
  • Unattended by default: safe pacing is on for new installs (an 18 h active window, 55–95 min sessions, game-stopped breaks, 8 attacks/h and 50/day), the army queues itself when the camps are empty, full storages dump into walls and park instead of stalling the loop, and make daemon-install installs a LaunchAgent that survives reboots and keeps the Mac awake. The dashboard names the exact reason whenever the bot is deliberately idle.
  • Guided First-Run Setup: Pick an army, an upgrade plan, and loot floors in a three-step wizard. Auto EDrag Rush is recommended by default from its higher estimated loot per hour, adaptive loot takes over the search floors once it has enough samples, and pet upgrades start from the 2026 Phoenix β†’ Spirit Fox β†’ Sneezy queue.

πŸš€ Quickstart

Prerequisites
  1. macOS (Apple Silicon M1/M2/M3/M4 recommended).
  2. Android Emulator (e.g., BlueStacks) configured to:
    • Resolution: 860 Γ— 732
    • DPI: 160 DPI
    • ADB enabled on 127.0.0.1:5555 (default).
# Desktop GUI β†’ /Applications/ClashGO.app
curl -fsSL https://raw.githubusercontent.com/DSargent21/ClashGo/main/tools/install.sh | bash

# Headless CLI β†’ ~/.local/bin/bot_cli
curl -fsSL https://raw.githubusercontent.com/DSargent21/ClashGo/main/tools/install.sh | bash -s -- --cli

The installer resolves the latest release, verifies every download against the release SHA256SUMS, and needs no sudo. Use --version, --app-dir, --bin-dir, or --data-dir to override defaults; see bash tools/install.sh --help.

Homebrew users get managed upgrades via the cask:

brew install --cask dsargent21/tap/clashgo
brew upgrade --cask clashgo

See docs/HOMEBREW.md for tap setup and release automation. Prefer a manual install? Download ClashGO.dmg from GitHub Releases, drag ClashGO.app into /Applications, and launch.

2. Headless CLI (bot_cli)

For maximum efficiency and 24/7 background servers. The command above installs the prebuilt, self-contained binary (OpenCV dylibs bundled); to build from source instead:

# Build the standalone binary
make build-cli

# Print version and git commit
./build/bin/bot_cli -v

# Run with performance optimizations and custom loot filters
./build/bin/bot_cli -perf -gold 600000 -elixir 600000 -min-de 3000

See docs/CLI.md for full flag documentation (-perf, -once, -deploy-only, -devices, -strategies).

3. Run it 24/7 (optional)
make daemon-install     # LaunchAgent + caffeinate, survives reboot/sleep
make daemon-status
make daemon-uninstall

The agent runs tools/run_bot_keepalive.sh (respawns on any exit, notifies after three consecutive crashes). Pacing lives in Config β†’ Schedule; session_state.json keeps the hourly/daily counters across restarts.


πŸ› οΈ Tooling & Calibration Suite

ClashGO includes a suite of developer and calibration utilities in cmd/:

Command / Tool Description
make roi-picker Drag-and-drop web ROI selector (http://127.0.0.1:8795) for buttons, slots, and templates
make pick-coords Visual deploy point picker (http://127.0.0.1:8791) for calibrating base boundary lines
make pick-army-slots Calibrate clickable boxes for army recipe slots on live frames
make attack-verify Renders attack plans (deploy taps, spells, red zone) onto emulator frame without tapping
make attack-record Macro recorder: capture clicks on emulator to JSON
make attack-replay Macro replayer: fire recorded attack JSON at cadence
make see Terminal ASCII screen inspector and vision debug eye
./tools/observe.sh Terminal capture + classifier + Apple Vision OCR dump
make smoke-live Headless Wails App smoke: one real raid, verify stats + history, stop
make smoke-live-app Packaged-app self-test: build, launch with --live-smoke, run one real raid, exit 0/1

Live smoke commands spend one real attack on the active account and require a connected BlueStacks device. The packaged binary also accepts --live-smoke directly.


πŸ’Ύ Resource Usage & Efficiency

All metrics reflect Apple Silicon runs with BlueStacks at 860Γ—732 / 160 DPI:

Scenario ClashGO RSS ClashGO CPUΒΉ + BlueStacks RSSΒ² Combined Footprint
CLI Headless (Idle / UI only) ~25–40 MB <1% (1 core) ~800 MB–1.2 GB ~0.8–1.2 GB
CLI Headless (Active battle, -perf) ~45–70 MB ~8–15% (1 core) ~1.0–1.5 GB ~1.0–1.6 GB
GUI (Idle / Dashboard) ~60–85 MB ~1–2% (1 core) ~800 MB–1.2 GB ~0.9–1.3 GB
GUI (Active battle) ~80–120 MB ~12–20% (1 core) ~1.0–1.5 GB ~1.1–1.6 GB

ΒΉ Single-core CPU percentage. During battle, vision classification runs at throttled intervals to minimize CPU usage while guaranteeing fast result detection. Β² BlueStacks memory footprint is governed by the Android guest OS and emulator settings.

See docs/PERFORMANCE.md for profiling details and optimization benchmarks.


πŸ“š Documentation Index


🚒 Release Workflow

Releases are built automatically via GitHub Actions:

# 1. Update productVersion in wails.json
# 2. Tag and push
git tag v1.1.1
git push origin v1.1.1

GitHub Actions compiles the universal Go binaries, packages the self-contained DMG (ULMO LZMA compression) and zip bundle, emits latest.json, and publishes the release assets automatically.


🀝 Contributing

Contributions, issues, and PRs are welcome!

  • Testing or porting to Windows (see roadmap).
  • Authoring new troop and spell strategies in assets/strategies/.
  • Reporting bugs or edge cases with logs from logs/.

πŸ“„ License

Distributed under the MIT License. See LICENSE for details.

Documentation ΒΆ

The Go Gopher

There is no documentation for this package.

Directories ΒΆ

Path Synopsis
cmd
attack_record command
cmd/attack_record is a MACRO RECORDER + REPLAYER for ClashGO.
cmd/attack_record is a MACRO RECORDER + REPLAYER for ClashGO.
attack_report command
Command attack_report answers the two questions a finished attack actually raises, from the run's own log:
Command attack_report answers the two questions a finished attack actually raises, from the run's own log:
attack_verify command
Command attack_verify is the 720p review harness: it proves the attack plan is correct BEFORE a battle is spent on it, by rendering exactly what the bot would tap onto a live (or saved) 720p battle screenshot.
Command attack_verify is the 720p review harness: it proves the attack plan is correct BEFORE a battle is spent on it, by rendering exactly what the bot would tap onto a live (or saved) 720p battle screenshot.
capture_template command
cmd/capture_template is a manual template-recapture tool.
cmd/capture_template is a manual template-recapture tool.
classify_probe command
Command classify_probe classifies a screenshot (default: live adb capture) with the repo's own classifier and prints the score for every state rule plus a few key pixel reads, so a stuck bot can be diagnosed from what the vision layer actually sees.
Command classify_probe classifies a screenshot (default: live adb capture) with the repo's own classifier and prints the score for every state rule plus a few key pixel reads, so a stuck bot can be diagnosed from what the vision layer actually sees.
countprobe command
design_attack command
cmd/design_attack is the one-stop tool for authoring + verifying the per-unit `formula.json` consumed by the deploy pipeline.
cmd/design_attack is the one-stop tool for authoring + verifying the per-unit `formula.json` consumed by the deploy pipeline.
pick_army_slots command
pick_coords command
Command pick_coords is the deploy-point picker: it shows the live emulator frame in the Preview tab and lets you click the exact points the bot should use, per side, then writes them into precision_config.json.
Command pick_coords is the deploy-point picker: it shows the live emulator frame in the Preview tab and lets you click the exact points the bot should use, per side, then writes them into precision_config.json.
pickpage command
pickpage writes the wall-flow picking page to a file, with the captured frames inlined as data URIs.
pickpage writes the wall-flow picking page to a file, with the captured frames inlined as data URIs.
ratioprobe command
redprobe command
Command redprobe shows what the red no-deploy boundary detector sees: the binary mask it builds, every contour it weighed, and the verdict on each.
Command redprobe shows what the red no-deploy boundary detector sees: the binary mask it builds, every contour it weighed, and the verdict on each.
refmap command
refmap converts rectangles a human dragged on a live frame into the reference coordinates the bot's asset files are written in.
refmap converts rectangles a human dragged on a live frame into the reference coordinates the bot's asset files are written in.
release_manifest command
Command release_manifest emits a `latest.json` file for the just-built release zip.
Command release_manifest emits a `latest.json` file for the just-built release zip.
resprobe command
Command resprobe measures how the CoC HUD scales between two framebuffer geometries.
Command resprobe measures how the CoC HUD scales between two framebuffer geometries.
result_probe command
Command result_probe is a diagnostic harness that runs the bot's own battle-result OCR pipeline against a saved screenshot (defaults to last_battle_result.png in the config dir).
Command result_probe is a diagnostic harness that runs the bot's own battle-result OCR pipeline against a saved screenshot (defaults to last_battle_result.png in the config dir).
roi_picker command
run_session command
screendump command
see command
Command see is the debugging agent's eyes on the emulator.
Command see is the debugging agent's eyes on the emulator.
swipe_probe command
Command swipe_probe is a standalone live-verification harness for the human-gesture input layer (Phase 1 of the autonomous hardening loop): it connects to the emulator like the bot does and exercises the sendevent bezier-swipe primitives against the live device.
Command swipe_probe is a standalone live-verification harness for the human-gesture input layer (Phase 1 of the autonomous hardening loop): it connects to the emulator like the bot does and exercises the sendevent bezier-swipe primitives against the live device.
tapaudit command
tapaudit reviews every touch the bot fired, straight from the NDJSON tap trace (CLASHGO_TAP_TRACE=<path>).
tapaudit reviews every touch the bot fired, straight from the NDJSON tap trace (CLASHGO_TAP_TRACE=<path>).
tapfind command
test_wall_upgrade command
cmd/test_wall_upgrade is a manual verification tool for the wall-upgrade system.
cmd/test_wall_upgrade is a manual verification tool for the wall-upgrade system.
tplprobe command
Command tplprobe locates one stored template on a frame across a scale sweep and prints the ranked result.
Command tplprobe locates one stored template on a frame across a scale sweep and prints the ranked result.
uiact command
wallserve command
wallserve is the local picking session: a page you drag boxes on, a Save button, and the picks written to a file on this machine instead of sitting in a browser tab.
wallserve is the local picking session: a page you drag boxes on, a Save button, and the picks written to a file on this machine instead of sitting in a browser tab.
wedge_probe command
wmresize command
Command wmresize changes a running device's display geometry.
Command wmresize changes a running device's display geometry.
internal
accounts
Package accounts owns the set of Clash of Clans accounts ClashGO can operate.
Package accounts owns the set of Clash of Clans accounts ClashGO can operate.
adb
Package adb β€” bootprobe.go
Package adb β€” bootprobe.go
attacklog
Package attacklog turns a bot run log into a per-unit account of what the deploy phase actually did.
Package attacklog turns a bot run log into a per-unit account of what the deploy phase actually did.
autotune
Package autotune turns the loot the bot already reads on every searched base into a self-tuning search threshold.
Package autotune turns the loot the bot already reads on every searched base into a self-tuning search threshold.
bot
Package bot β€” boot_report.go
Package bot β€” boot_report.go
game
Package game β€” chestdismiss.go
Package game β€” chestdismiss.go
notify
Package notify delivers an unattended run's events to an external webhook: Discord, Telegram, or any endpoint that accepts a JSON `text` field.
Package notify delivers an unattended run's events to an external webhook: Discord, Telegram, or any endpoint that accepts a JSON `text` field.
paths
Package paths resolves absolute, writable locations for the bot's runtime files.
Package paths resolves absolute, writable locations for the bot's runtime files.
pickpage
Package pickpage renders the wall-flow picking page: the captured frames with the boxes a human dragged on them.
Package pickpage renders the wall-flow picking page: the captured frames with the boxes a human dragged on them.
updater
Package updater polls GitHub Releases for new ClashGO versions, downloads updates with SHA256 verification, and signals the UI / applies updates on demand.
Package updater polls GitHub Releases for new ClashGO versions, downloads updates with SHA256 verification, and signals the UI / applies updates on demand.
village
Package village reads the game's own Data Export β€” Profile β†’ Settings β†’ More Settings β†’ Data Export β†’ Copy β€” into the few facts about the account that vision cannot answer.
Package village reads the game's own Data Export β€” Profile β†’ Settings β†’ More Settings β†’ Data Export β†’ Copy β€” into the few facts about the account that vision cannot answer.
vision
Digit classification against canonical-size templates.
Digit classification against canonical-size templates.
pkg
formula
Package formula defines the per-unit deploy coordinate schema produced by the `design_attack` interactive tool and consumed by the deploy pipeline in `internal/attack`.
Package formula defines the per-unit deploy coordinate schema produced by the `design_attack` interactive tool and consumed by the deploy pipeline in `internal/attack`.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL