Clash of Commits 2026 · PS-AI-03 — Autonomous Team of AI Problem-Solvers (Clash of Clans AI War Room)
AC War Room is a team of specialised AI agents that scout enemy bases, debate attack plans, schedule village upgrades and check each other's work. The player gets a plan the whole team has argued over and that code has verified, not one chatbot's guess.
Windows, nothing to install: download AC-War-Room-Windows-x64.zip from the latest release. Extract the whole ZIP, then double-click Open Studio.cmd. If SmartScreen appears, choose More info → Run anyway. The ZIP's README explains the models and keys.
Any OS from source: you need Node.js 22.13 or newer (24 recommended) from nodejs.org. There is nothing to install: the app has no runtime dependencies.
git clone https://github.com/logeswar589/AC-COC.gitcd AC-COCnpm startYour browser opens at http://127.0.0.1:4173/. On Windows you can double-click Start.bat instead; on macOS or Linux run ./start.sh.
Choosing models:
- No key needed: local Ollama models (the default team). Install Ollama, then run
ollama pull qwen3-vl:4b-instruct,ollama pull qwen3:4b-instructandollama pull gemma4:e2b. A signed-in Codex, Claude Code or Gemini CLI also needs no API key: pick it for any seat under War Room team. - Hosted models and the Clash of Clans API: copy
.env.exampleto.envand fill in what you use. Keys stay on your machine and in memory.
Walkthrough: hand-written agent outputs replayed through the real engine, rule checks, objection ledger and scheduler, not a live model run. To replace it with your own runs, see Record your demo.
Battle: the War Room asks for the attacker's camp capacity, and the Scout maps the defenses. Code rejects a 310/300 army. A Critic objects to the top-left entry, and code rejects the Tactician's "fix" because the entry didn't change. The Tactician then moves the entry to the bottom-right, and the map shows the old and new entry with the resolved objection. Village: a commander override says the war starts in 10 hours. Code moves both hero upgrades after the war and catches a 25-hour builder gap. The timeline lists what moved and why.
- Choose Battle room, attach an enemy base screenshot, describe the attack and select Plan attack. The War Room asks for your Town Hall or camp capacity the first time.
- Teamwork (the first tab on every run) shows who objected, what changed in the plan, what code checked and who decided. It also has a run summary with model calls, tokens, time per agent, and how many objections were raised, fixed or dismissed.
- Base map draws the blueprint over your screenshot: defenses by threat, Clan Castle range, trap zones, the entry (old and new), the funnel, numbered spell drops, and each objection with its resolution.
- Choose Village planner, paste your village data export or describe your builders, and plan. Upgrade timeline shows builder, lab, Pet House and Blacksmith lanes, the war window, what moved and why, and your hero and lab levels from the Clash of Clans API.
- Live war in the sidebar is the live clan-war board fed by the Clash of Clans API (it needs a coc token and your clan tag).
.env.example sets WAR_ROOM_RECORD=recordings, so once you copy it to .env, every run you make is saved to recordings/ when it ends. That includes the agents' real outputs, your overrides and your answers.
npm run replayReplays those recordings through the engine: it prints every decision and writes demo/out/war-room-replay.html, which plays them in the War Room UI without a model or key.
npm run record-gifTurns that page into docs/media/war-room-replay.gif, Battle first and then Village, replacing the walkthrough above (it needs Playwright and ffmpeg). recordings/ is ignored by git because a run can include your screenshots and player tag. To share one, check it and commit it with git add -f.
PS-AI-03 asks for an autonomous team of AI problem-solvers that acts as a Clash of Clans war room. The mapping below follows the judging areas as listed in our review of the problem statement. We could not open the official page from our build environment, so check it against the current wording.
| What PS-AI-03 asks for | How AC War Room does it | Where it lives |
|---|---|---|
| Battle planning and scouting | Scout maps defenses from a screenshot. The Tactician plans army, heroes, spells, entry, funnel and timed callouts, sized to your own camps. The blueprint is drawn on the base map. | runtime/war-battle.js, runtime/gamedata.js, ui/warroom.js (map) |
| A team of agents that collaborates and disagrees | 1–4 Critics, a Tactician that must answer every objection, and a Chief Reviewer or no-judge consensus with a minority report. The Teamwork tab shows the whole exchange. | runtime/war-battle.js, runtime/war-ledger.js, ui/warroom.js (Teamwork) |
| Guardrails that a model cannot talk around | Army capacity, hero-war windows, idle gaps, double-booking, maxed upgrades and unresolved objections are all checked in code. A violation sends the plan back, or blocks the run. | runtime/war-guardrails.js, runtime/war-ledger.js, runtime/gamedata.js, runtime/coc.js |
| Upgrade and economy planning | The Economy agent ranks upgrades and a deterministic scheduler places them on builders, the lab, the Pet House and the Blacksmith, keeping heroes free for war. Every upgrade is placed with a reason or deferred with one. | runtime/war-village.js, runtime/war-scheduler.js, runtime/war-windows.js |
| The organizer's example: idle lab, two builders free in 3 hours, heroes needed for war | Covered by an end-to-end engine test. | test/warroom.test.js ("organizer's example") |
| Live data from Clash of Clans | The official Clash of Clans API supplies your Town Hall and levels, the war schedule (including CWL) and the Live war board. | runtime/coc.js, runtime/usb-live.cjs, desktop/live.js |
| Human control | Pause, resume, stop, commander overrides (a war-time override moves the war window), and a capacity question when the run needs your input. | runtime/warroom.js, runtime/war-windows.js |
| Memory and learning | Player rules, profile, war schedule and past attacks with their results. Strategies under 2★ are flagged so they aren't repeated. | runtime/warroom.js (memory), Teamwork tab |
| Cost control | Caps on model calls and tokens per run, with per-agent meters. The run stops cleanly at the cap. | runtime/warroom.js (call), test/rules.test.js |
| Dashboard and polish | The War board (Teamwork, map, timeline, briefing, guardrails), the Live war board, and a one-command standalone app. | ui/, desktop/, server/ |
flowchart LR
UI["Browser or Studio window<br/>ui/ + desktop/"] <-->|messages| CTRL["Controller<br/>runtime/home.cjs"]
CTRL <--> SVC["Service process<br/>runtime/service.cjs"]
SVC --> ENGINE["War Room engine<br/>runtime/warroom.js"]
subgraph Agents
SCOUT[Scout] --> TAC[Battle Tactician]
TAC <-->|objections and revisions| CRIT["Critics 1–4"]
ECO["Upgrade & Economy"] <-->|critiques| CRIT
CRIT --> CHIEF["Chief Reviewer<br/>or consensus"]
end
ENGINE --> Agents
subgraph Code["Checked in code"]
ARMY["Army validator<br/>gamedata.js"]
LEDGER["Objection ledger<br/>war-ledger.js"]
GUARD["Guardrails<br/>war-guardrails.js"]
SCHED["Scheduler<br/>war-scheduler.js"]
WIN["War windows<br/>war-windows.js"]
end
ENGINE --> Code
Agents --> PROV["Model providers<br/>providers.js, agents.js"]
PROV --> OLL[Ollama] & API["OpenAI · Anthropic · Gemini"] & CLI["Codex · Claude Code · Gemini CLI"]
COC["Clash of Clans API<br/>coc.js"] --> ENGINE
COC --> LIVE["Live war board<br/>usb-live.cjs, live.js"]
ENGINE --> DB[("SQLite<br/>runs, events, memory")]
Agents decide what; code decides when and whether a plan is allowed. Every message between agents is an event in the run, which is what the Teamwork tab, the debate view and the replay are built from.
| Agent | What it does |
|---|---|
| Scout | Reads base screenshots (vision model) or village data. Maps every key defense, the Clan Castle range and weak points as coordinates on the image. |
| Battle Tactician | Plans the army, hero abilities, spell drops, entry point, funnel and timed raid callouts. During the raid it turns a live frame into the next call. |
| Critic (1–4) | Hunts for what will go wrong: trap zones, the Clan Castle lure, pathing and funnel failures, spell timing, rule violations. Has to approve before the plan moves on. |
| Upgrade & Economy | Prioritises builder, Laboratory, hero and equipment upgrades, magic items and the loot plan. |
| Chief Reviewer | Final check against the evidence, the critiques, the player's rules, past results and the budget. Writes the plain-English briefing. |
Each agent can run on a different model: local (Ollama: Qwen3, Qwen3-VL, Gemma), hosted APIs (Google Gemini, OpenAI, Anthropic), or CLI agents (Claude Code, Codex and Gemini CLI).
- War Room team → Team: every seat has its own provider, account, model and effort (Low/Med/High). Sliders set the agents in the debate (2–5), the debate rounds and the agents running at once. One switch picks between Chief Reviewer judges and No judge · consensus.
- War Room team → Accounts: Studio can bundle Codex and Gemini CLI during installation. Claude Code uses your local install. Add as many accounts per CLI as you like. Each gets its own sign-in folder and an N at once instance limit, so two seats can share one account or use two different accounts of the same CLI in parallel.
-
Battle. Attach an enemy base screenshot. Scout → Tactician → Critics ⇄ revisions → Chief Reviewer → attack blueprint. The blueprint is drawn on the map with toggleable layers: defenses by threat, Clan Castle range, trap zones, entry arrow, funnel path, numbered spell drops, and each objection with its resolution.
-
Village. Paste the in-game data export or describe your builders. With your player loaded from the Clash of Clans API, hero, lab, pet and equipment levels come in automatically. Scout → Economy → automatic rule checks → Critics ⇄ revisions → Chief Reviewer → upgrade timeline. The timeline shows builder, lab, Pet House and Blacksmith lanes with the war window shaded, anything not scheduled with the reason, and what moved and why.
-
Live war. A third mode, with a full-page board fed by the official Clash of Clans API (including Clan War League). It shows the score and win math, both lineups as a war map, and the team's call as one instruction plus a plan table: attacker → target, Town Hall match-up and stars to aim for. The call comes from the same multi-model team: the Tactician proposes, each Critic checks it on its own model, and the Tactician revises when one objects. Code checks every assignment against attacks left and stars already taken. The coach can be a signed-in CLI agent (Codex, Claude Code, Gemini CLI) with no API key, or a hosted model. Phone screen capture over USB remains an optional source for in-raid calls. Setup
The Clash of Clans API also feeds Village: your real hero, lab, pet and equipment levels go to the agents and appear as bars on the timeline, and code rejects upgrades for anything already maxed.
-
Agents genuinely disagree. Critics must approve, and the Tactician has to answer each objection, accepting or rejecting it with evidence. Every turn is visible in the live debate, round by round.
-
Judge or no-judge. With the Chief Reviewer turned off, the team runs in consensus mode: every agent must agree, or the run ends with "No consensus" and a minority report.
-
Rules no model can talk around. Some rules are checked in code, not by a model:
- no hero upgrade overlapping war or Clan War League (war times come from the Clash of Clans API when a token and clan tag are set)
- no idle builder or lab: every gap on every timeline over 2 hours is a violation
- no double-booked builder
- every proposed upgrade is scheduled or deferred with a visible reason; nothing silently disappears
- the army must use real troops and spells, fit the attacker's own camp and spell capacity exactly, and list each hero once. If the capacity is unknown, the run asks before it plans. The enemy base's Town Hall is never used.
- every high-severity objection must end verified fixed (code checks that the entry, funnel, spells, army, heroes or timing actually changed) or dismissed with evidence that the Critic or Chief Reviewer accepts. An open objection overrules the Chief Reviewer's approval.
A violation goes back to the agent for revision. If it still can't be fixed, the run is blocked.
-
LLMs decide what; code decides when. Agents choose and rank the upgrades; a deterministic scheduler places them on builders, skips upgrades already in progress, and holds hero upgrades until after the war.
-
Memory. Player rules, the profile (Town Hall, hero levels, goals; fetchable from the official Clash of Clans API), the war schedule and every past attack with its stars and %. Attacks that failed are flagged to the Tactician so they aren't repeated.
-
Cost limits. Every run has a cap on model calls and tokens, with live meters. The run stops cleanly when it hits the cap.
-
Human control. Pause, resume and stop any run, or type a commander override that every later agent must follow. A war-time override such as "war starts in 6 hours" moves the run's war window, and code re-places the upgrades at once.
npm testThat runs the unit tests (39) on Node 22 or 24: Battle and Village planning, the guardrails, the objection ledger, critics disagreeing, consensus minority reports, cost caps, overrides, a 400-village scheduler check, live coaching and the Clash of Clans API client. They use simulated model responses and mocked API responses, so they run offline.
npm installnpx playwright install chromiumnpm run test:e2eThose three commands install Playwright and run five browser tests against the standalone app. The tests load two fixture runs from test/fixtures/runs into a throwaway data folder, so they need no key. GitHub Actions runs both suites on every push: .github/workflows/test.yml.
The same War Room also runs inside AC Council Studio, a portable Windows Electron shell that isn't part of this repository. It adds live USB screen capture and CLI account sign-in from a desktop window.
Quickest way: close Studio and double-click INSTALL-WAR-ROOM.cmd in this folder. It finds your AC Council Studio, installs this version into it and opens it. It needs Python 3 and offers to install it with winget if it's missing.
Or, with a writable copy of the Studio installation, close Studio and run the following from the repository root. Replace the example path with your executable.
$studio = "C:\Apps\AC Council Studio\AC Council Studio.exe"
py -3 integrate.py $studio
& $studio- Bundled CLI agents: to include the pinned Codex and Gemini CLI packages, run
npm ci --prefix agentsfrom the repository root before integration. - Hosted models: open Council settings → Coding models & API keys → Manage API keys and pick the models under War Room team. For the strongest battle plans, use Gemini for the Scout and Tactician.
- Clash of Clans API: add a token as coc under Manage API keys, registered for your IP address at developer.clashofclans.com. Then fetch your player or enter your clan tag in War Room memory.
To rebuild the Windows shell from an AC IDE portable archive, see the Studio build instructions.
| Path | What it is |
|---|---|
server/ |
Standalone app: npm start serves the War Room in your browser (index.js, bridge.js) |
runtime/warroom.js |
War Room engine: memory, run control, model calls with budgets and per-agent meters, pause/override |
runtime/war-battle.js, runtime/war-village.js |
The Battle and Village debates: who speaks in which order, revisions, verdicts |
runtime/war-ledger.js |
Objection ledger: every high-severity objection to a verified fix or an accepted dismissal |
runtime/war-guardrails.js, runtime/war-scheduler.js, runtime/war-windows.js |
Schedule rule checks, the deterministic scheduler, and war windows and overrides |
runtime/war-prompts.js, runtime/war-util.js |
Agent personas, output schemas, defaults and shared helpers |
runtime/gamedata.js |
Troop, spell and hero rules for army validation |
runtime/coc.js |
Clash of Clans API client (player, current war, Clan War League), win math and account levels |
runtime/recorder.js |
Records runs (WAR_ROOM_RECORD) and replays them without a model |
runtime/providers.js, runtime/agents.js |
Model adapters (Ollama, OpenAI, Anthropic, Gemini) and CLI agents (Codex, Claude Code, Gemini CLI) |
runtime/usb-live.cjs |
Live coaching loop: Clash of Clans API war state or ADB screen capture, with CLI or hosted coaches |
desktop/live.{js,css} |
Live war mode: score, win math, war map and the coach's plan table |
ui/warroom.* |
War board: Teamwork, map overlay, timeline, briefing, guardrails, team and memory dialogs |
demo/ |
replay.js (replays recordings) and record.js (turns them into the README GIF) |
test/, e2e/ |
Unit tests, Playwright browser tests and test fixtures |
WAR-ROOM.md |
Full feature guide |
Planning runs, debates, attached screenshots and memory are stored locally in SQLite (data/standalone/ for npm start, ignored by git). Live coaching sends the current war state (and, with the USB source, screen frames) to the selected coach while the session is active.
- Small 4B local models work end to end but make weaker plans; hosted vision models read real base screenshots far better.
- Defense positions come from a vision model and are approximate.
- When you haven't entered your own camp and spell capacity, the validator uses the maximum for your Town Hall. Under-upgraded camps can still overflow until you enter the real numbers.
- The Clash of Clans API has no base layouts or builder timers, so Battle still reads layouts from screenshots, and Village still reads builders from the data export or your notes.
The original Council source is available under the 0BSD license. See the publication notes for the Windows shell, icons and branding.
