Commit graph

11 commits

Author SHA1 Message Date
jedarden
bd4b0d3244 Add LLM prompt builder and ensemble integration (Phase 7)
- selector: tournament selection for parent sampling from island populations
- prompt: assembles evolution prompts from parent code, replay analysis, and meta description
- llm: OpenAI-compatible client routing to ZAI proxy with fast (GLM-5-Turbo) and strong (GLM-5) tiers, plus code block extraction from model responses
- Tests for prompt assembly, code extraction, and tournament selection

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 22:26:09 -04:00
jedarden
4aca8add20 Add Discord/Slack alerting webhooks to Go API server
Implements the monitoring alerting deliverable from Phase 6. The Alerter
module sends color-coded notifications to Discord and/or Slack webhooks
for operational events: bot health transitions, stale job re-enqueues,
and match errors. Includes per-key rate limiting to prevent alert storms.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 01:32:47 -04:00
jedarden
f1a0830c51 Add Go API server (cmd/acb-api) with PostgreSQL, Valkey, and Glicko-2
Implements the K8s-native Go API service per the plan architecture:
- HTTP server with graceful shutdown and env-var configuration
- PostgreSQL schema (bots, matches, match_participants, jobs, rating_history)
- Health/ready endpoints checking PostgreSQL and Valkey connectivity
- Bot registration with health check, HMAC secret gen, AES-256-GCM encryption
- Key rotation and bot status endpoints
- Job claim via Valkey BRPOP, result submission with Glicko-2 rating update
- Glicko-2 rating system: multi-player pairwise, Illinois volatility algorithm
- Background tickers: matchmaker (1m), health checker (15m), stale job reaper (5m)
- Worker API key authentication (Bearer/X-API-Key)
- Dockerfile, K8s Deployment (2 replicas), ClusterIP Service
- 30 unit tests covering Glicko-2, crypto, config, and handlers

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 01:21:48 -04:00
jedarden
0f7d55c5d4 Fix sin/cos math bug and add cellular automata map generation
Replace broken Taylor series sin/cos approximations with math.Sin/math.Cos
in both engine/match.go and cmd/acb-mapgen. The Taylor series produced
incorrect results for angles > π, causing wrong positions in 3+ player maps.

Upgrade map generator wall placement from random scatter to cellular
automata (B5/S4 rule, 4 iterations) with rotational symmetry enforcement
and connectivity validation. Add comprehensive mapgen tests and dominance
win condition tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 01:10:46 -04:00
jedarden
20c48783cc Add Prometheus metrics endpoint to match worker
Some checks are pending
CI / Go Tests (push) Waiting to run
CI / Worker API Tests (push) Waiting to run
CI / Indexer Tests (push) Waiting to run
CI / Web Build (push) Waiting to run
Adds a metrics HTTP server to acb-worker exposing Prometheus text format
at /metrics, plus /health and /ready K8s probe endpoints. Tracks counters
(matches, errors, jobs, replays, polls, heartbeats) and histograms
(match duration, replay upload duration, replay size). Instruments the
full worker execution flow. Fixes .gitignore binary patterns to use
root-anchored paths so cmd/ subdirectories aren't incorrectly excluded.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-26 00:50:10 -04:00
jedarden
4b1966a839 Add .gitignore and package-lock.json files
- Add comprehensive .gitignore for binaries, node_modules, and build outputs
- Add package-lock.json for cmd/acb-indexer and worker-api
- Ensures reproducible builds with exact dependency versions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 10:30:03 -04:00
jedarden
23186b77e1 Start Phase 6: Add deployment configuration and containers
- Add Dockerfile for acb-worker match execution container
- Add docker-compose.bots.yml for orchestrating all 6 strategy bots
- Add docker-compose.workers.yml for worker and indexer deployment
- Add .env.example documenting all required environment variables
- Add DEPLOYMENT.md with deployment guide and troubleshooting
- Update PROGRESS.md with Phase 6 progress

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 09:41:14 -04:00
jedarden
4bbc3f0515 Complete Phase 4: Add index builder container
- Add /api/data/export endpoint to worker-api for data export
- Create cmd/acb-indexer/ TypeScript container:
  - API client for fetching data from Worker API
  - Index generator for leaderboard, bot profiles, match index
  - File writer for outputting JSON files
  - Optional Cloudflare Pages deploy support
  - Unit tests (6 tests)
- Update PROGRESS.md to mark Phase 4 complete

Phase 4 is now complete. All exit criteria met:
- Matchmaker cron creates jobs in D1
- Workers claim and execute matches
- Replays land in R2
- Results flow into D1
- Ratings update via Glicko-2
- Leaderboard.json rebuilds automatically
- Stale job reaper recovers from worker disappearance

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 08:39:47 -04:00
jedarden
6659027bec Implement match worker container (cmd/acb-worker/)
- Worker polls Cloudflare Worker API for pending match jobs
- Claims jobs and executes matches using the game engine
- Uploads replays to R2 via S3-compatible API
- Sends heartbeats during match execution
- Submits results back to Worker API
- Includes retry logic with exponential backoff
- API client tests for job coordination endpoints

Also fixes glicko2.ts: export g() and E() functions for testing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 08:06:15 -04:00
jedarden
890785c5c4 Complete Phase 1: add connectivity validation and determinism tests
- Add connectivity.go: BFS-based map connectivity validation with retry
- Update mapgen to use connectivity checking by default
- Add determinism_test.go: property-based tests for reproducibility
  - Same seed produces identical replays
  - Turn execution is deterministic
  - Grid operations are deterministic
  - Combat resolution is deterministic
  - Full 500-turn match validation
- All 32 tests pass
- Update PROGRESS.md: Phase 1 complete

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 03:44:44 -04:00
jedarden
6d3f3506b3 Implement Phase 1 core engine: grid, combat, fog of war, turn execution
- Add engine package with toroidal grid, game state, turn execution
- Implement focus-fire combat resolution with simultaneous deaths
- Add fog of war visibility filtering for bot state
- Implement energy collection (contested resources denied)
- Add bot spawning at active cores
- Implement win conditions: elimination, draw, dominance, turns
- Add replay JSON writer for match recording
- Add match runner with concurrent bot communication
- Add CLI tools: acb-local (match runner), acb-mapgen (map generator)
- Add comprehensive unit tests (26 tests passing)

Exit criteria met: can run complete 500-turn matches and produce valid replays

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-24 01:48:27 -04:00