cwc-fix

cwc-fix is a command for Claude Code from anthropics/cwc-workshops. It costs 12 tokens per session (1,072 once invoked), scanned A, original, Apache-2.0.

A troubleshooting and repair procedure for the Agent Battle setup, including its server, bot, relay, and event service. It checks running processes, local status pages, registrations, and recent log errors.

In plain words
What is it for?
Use it when the game server, bot, relay connection, or leaderboard service is broken or has stopped responding.
Why use it?
It helps identify which part of the setup stopped working and points to the appropriate restart or repair action. It is designed to leave the participant's AGENT configuration unchanged.

Command for Claude Code ✓ vendor

Written for Claude Code: installed under .claude/.

Good fit Use it when the game server, bot, relay connection, or leaderboard service is broken or has stopped responding.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/anthropics/cwc-workshops/cwc-fix
About the project

CWC Workshops is a collection of materials from Anthropic-run workshops on building and evaluating AI-assisted coding workflows. The workshops cover model selection, multi-agent systems, managed agents, and product development with coding agents. The catalogue entries are examples and teaching materials from those workflows.

anthropics/cwc-workshops · 2,047 stars · on GitHub

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/anthropics/cwc-workshops

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for cwc-fix

README.md
[![agentmods](https://agentmods.dev/badge/commands/anthropics/cwc-workshops/cwc-fix.svg)](https://agentmods.dev/commands/anthropics/cwc-workshops/cwc-fix)
Your own site
<a href="https://agentmods.dev/commands/anthropics/cwc-workshops/cwc-fix"><img src="https://agentmods.dev/badge/commands/anthropics/cwc-workshops/cwc-fix.svg" alt="Measured on agentmods" height="20"></a>
Per session 12 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,072 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00012 $0.01072
Opus 5 $0.00006 $0.00536
Sonnet 5 $0.00002 $0.00214
Haiku 4.5 $0.00001 $0.00107

Measured 8d ago against content hash a3162e7266e2, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

cwc-fix scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl -fsS -m 3 http://localhost:8088/state 2>&1 | head -c 400 || echo "(unreachable)"
agent-battle/.claude/commands/cwc-fix.md · 89 lines

How it starts

The opening of the file, as written. The whole thing — 89 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Something broke mid-session. Diagnose and fix the infrastructure without touching the participant's AGENT config.

Health check (run all of these, then reason from the results)

echo "── processes ──"
ps -eo pid,comm,args | grep -E 'java.*server.jar|node.*bot.js|node.*server.mjs|cloudflared' | grep -v grep
echo "── bot state (local) ──"
curl -fsS -m 3 http://localhost:8088/state 2>&1 | head -c 400 || echo "(unreachable)"
echo "── relay registration ──"
. .env.setup 2>/dev/null
[ -n "${RELAY_URL:-}" ] && curl -fsS -m 5 "${RELAY_URL%/}/p/${RELAY_KEY}/status" 2>&1 || echo "(no .env.setup — run ./setup.sh first)"
echo "── event server ──"
curl -fsS -m 5 "${LEADERBOARD_URL:-http://localhost:8888/api}/leaderboard" 2>&1 | head -c 200 || echo "(unreachable)"
echo "── recent errors ──"
tail -20 /tmp/mc-server.log /tmp/mc-bot.log /tmp/event-local.log 2>/dev/null
grep '\[relay\]' /tmp/mc-bot.log 2>/dev/null | tail -10

Decision tree

  • No java process → server died. ./setup.sh --restart.
  • No node bot.js process → bot died (often heap OOM after long runs, or kicked by server). ./setup.sh --restart.
  • Bot state unreachable but process alive → bot hung. Kill and restart: ./setup.sh --restart.
  • Bot reachable locally, relay status "connected":false → the bot's outbound WebSocket to the event server is down. Look at the [relay] lines in /tmp/mc-bot.log:
    • reconnecting in Ns lines → it's retrying; if the event server is up (curl $EVENT_URL/api/config), wait ~30s. If still down, ./setup.sh --restart.
    • superseded by another registration → they ran setup on two machines with the same copied repo/key. rm .relay-key && ./setup.sh --restart mints a fresh key on this machine.
  • Event server unreachable ($EVENT_URL/api/config fails) → that's the facilitator's problem (they restart it from their hosting dashboard). Nothing to fix on this machine; tell the participant to flag the facilitator. Their bot reconnects automatically when it's back.
  • my_agent.py says "no tools" or hangs at "looking for existing agent" forever → stale .agent_cache.json pointing at a dead agent. rm -f .agent_cache.json and retry.
  • Viewer at :8088/view is blank blue → prismarine-viewer y<0 bug. (cd bot && node patch-viewer.cjs) && ./setup.sh --restart, then hard-refresh the browser (Cmd-Shift-R / Ctrl-Shift-R).
  • SOLO mode: tunnel unreachablerm -f /tmp/cf-tunnel-8888.log && ./setup.sh re-mints the tunnel. The public hostname changes, so also rm -f .agent_cache.json (the agent's MCP URL moved).

Read the full file on GitHub · 89 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 8d ago First seen · 89 lines · 12 tokens per session scan A a3162e7266e2

Subscribe to this mod's changes

cwc-fix is a command published in the GitHub repository anthropics/cwc-workshops (2,047 stars, last pushed 11d ago), licensed Apache-2.0. It adds 12 tokens to every session and 1,072 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.