Commit graph

116 commits

Author SHA1 Message Date
Natalie
9e32eedfa1 feat(sim): land sim_scenario declarative harness + scenarios for headless Game 1 proof gate
- Add mc-sim/bin/sim_scenario (pure Rust runner for JSON scenarios; drives mc-turn + worldsim pre-pass + personalities; emits BatchResult with metrics + per-seed assertion verdicts).
- Add canonical game1_headless_systems_150t.json (150t, 48^2, 3 clans, all systems: climate/ecology/flora/fauna/events/happiness/combat/econ/etc) + smoke + combat sub-scenarios.
- Wire publish in dist.sh to ship the bin to S3 alongside .so (enables fleet horizontal runs post-).
- Update AGENTS.md, finish-game-1/SKILL.md, agents-task-map, simulator-infra.md to name the new primitive as preferred for sim-behavior / headless-complete gate (multi-seed statistical JSON proofs).
- Verified: CARGO_*_DEBUG=0 cargo test -p mc-sim (5/5), -p mc-turn (297/0), workspace check clean; data validate 1103/0; local 150t x1 (and prior x3 seeds equiv) PASS with real assertions (final_turn, tier_peak>=3, pvp>=5, events); release bin + debug rebuilt.
- Cleanup: remove worktree pollution (forbidden); regen objectives dashboard post-landing.
- Per AGENTS §2 / finish-game-1: proof before close; this lands the tool for the 'headless sim complete' gate (local multi-seed cited; fleet statistical is next owner step on host).

Co-Authored-By: Grok (xAI) <noreply@x.ai>
2026-06-28 14:24:38 -04:00
Natalie
320d17995d feat(dx): make mcforge part of net-tools infra installers (symmetric to ctforge)
- scripts/run/forge.sh cmd_forge_dns now prefers central forge-dns-render from net-tools (net sync owns the managed dx-forges block in /etc/hosts).
- Updated cloud-dx-do.md table entry.
- Both forges now converge via the shared DX infra layer.
2026-06-28 10:46:18 -04:00
Natalie
88bdc4210a feat(dist): build-artifact Space — publish/fetch/sync fetch-or-build + RL model sharing
Build the linux .so/wasm once on a worker and let sim/test/AI runners fetch the
prebuilt artifact (keyed by git sha) instead of recompiling — N workers share
one build. Adds the magicciv-artifacts DO Space, rclone in the golden image, and:
  - dist:publish  build + upload builds/<sha>/{.so,wasm}
  - dist:fetch    download the prebuilt .so for HEAD's sha
  - dist:sync     git pull -> fetch prebuilt if published, else build
  - dist:models   share RL .onnx via the Space (push/pull/ls)
Complements sccache (compile cache) by caching final outputs. Creds via
RCLONE_S3_* env over ssh, never on worker disk/argv; degrades to build-on-worker
when creds/cache absent.

Also hardens the dispatch layer (pre-existing, affected test/build/render too):
  - pass -i ~/.ssh/id_mc_fleet on dispatch ssh (don't rely on agent-loaded key)
  - guard _dist_first_host against an empty / "fleet down" inventory
  - drop ssh -n on heredoc-stdin verbs (it redirected stdin from /dev/null)

Proven end-to-end on DO: publish built a 43.9MB .so + wasm; dist:sync fetched it
in 2.8s (no rebuild).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-28 06:02:33 -04:00
Natalie
0c50c04b4c feat(infra): dist:prune to delete superseded golden snapshots
Incremental rebuilds accumulate snapshots (~$0.40/mo each). dist:prune keeps
the newest N (default 2: current + one rollback); dist:image reminds you to run it.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 14:51:06 -04:00
Natalie
d9588f8c80 perf(infra): incremental golden-image rebuilds (layer on the last snapshot)
Packer base image is now a var; ./run dist:image builds FROM the newest
mc-golden snapshot by default, so the idempotent provision.sh only redoes changed
work (~3-8 min vs ~20 cold). --cold rebuilds from stock Ubuntu to reset layer
cruft. Made the clone step idempotent (clone-or-fetch) so it works on a
pre-provisioned base. Directly addresses 'avoid unnecessary rebuilds'.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 14:41:01 -04:00
Natalie
6332d47011 fix(infra): make the DO fleet actually work on real hardware + render host
Real-DO testing surfaced bugs the mocked tests couldn't:
- ssh key: reference shared 'mc-fleet' key via data source, not a duplicate (DO 422s on dup pubkeys).
- cmd_dist_up: fail loudly on failed apply; dist:up waits for cloud-init readiness.
- snapshot cloud-init skips runcmd -> bake authorized_keys (FLEET_PUBKEY) + 'cloud-init clean' before snapshot.
- build user passwordless sudo; apt dpkg-lock race fixed (cloud-init --wait + Lock::Timeout).
- size s-8vcpu-16gb-amd (tier max); creds via PKR_VAR env not argv.
- render host: weston+Mesa baked; ./run dist:render proven (Godot->PNG on DO, no GPU). forge:dns shortcut.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 12:45:29 -04:00
Natalie
a5d66ce477 feat(infra): make DO workers render-capable (weston + Mesa) + dist:render
Golden image now installs the software-render stack (weston, libgl1-mesa-dri
llvmpipe, mesa-vulkan-drivers, vulkan-tools) so any worker renders proof scenes
via gl_compatibility/opengl3 with no GPU. New ./run dist:render <scene> <out.png>
wraps tools/capture-proof.sh against a worker (replaces the apricot SCREENSHOT_HOST).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 09:56:56 -04:00
Natalie
22f7fa1116 feat(infra): DO compute-offload verbs + forge on/off lifecycle
Offload heavy compute from plum (M2 Air) to on-demand DO workers:
- dist:test  — cargo test --workspace (nextest) on a worker (the main DX win)
- dist:build — cargo build + WASM on a worker; rsync the platform-independent
  WASM back (native .so is linux-only, stays on the worker)
- dist:sync  — git pull <ref> + rebuild gdext on live workers (no image rebuild)
- forge:down/up — snapshot+destroy / restore-from-snapshot (DO bills powered-off
  droplets; only destroy stops it). ~$6/mo -> ~$0.30/mo idle; refreshes the
  forge IP in ~/.vault/mc_forge_creds on restore.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 09:24:30 -04:00
Natalie
f5c5d1a410 feat(infra): distributed test/train fleet on DigitalOcean (Terraform + Packer + dispatch)
Ephemeral CPU Droplet fleet that horizontally scales the iteration loop:
- infra/terraform/test-fleet: cattle Droplets from a golden image (auto-discovered
  by name via digitalocean_images), grouped under the mc:dev DO project, with a
  mocked-provider test suite (no token/spend).
- infra/packer: golden-image builder reusing scripts/dev-setup/linux.sh.
- scripts/run/dist.sh: ./run dist:{check,up,sim,train,down} — shard sim/test
  batches across workers via autoplay-batch AUTOPLAY_HOST+SEED_OFFSET.
GPU intentionally absent (workload is CPU-bound per docs/ai-production.md).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 08:51:09 -04:00
Natalie
cbc68a68c1 docs(@projects/@magic-civilization): 🔎 p3-26 Gap-2 — era max_tier cap is non-parity; fired-event surfacing is observability-only
Verified file:line: the live GDScript events modules have NO era-based max_tier
cap (0 hits) — headless flat max_tier=10 is correct parity; an era cap would
invent a rule the game lacks (gold-plating, dropped). And natural events already
fire + apply terrain effects headless; only the fired list surfacing to
TurnResult is missing (processor.rs:1117 `let _fired =`), an observability nicety
not a system gap. Confirms the headless natural-events system is functionally
complete; narrows Gap-2's real remainder.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 06:29:41 -04:00
Natalie
158ef4d1bd feat(@projects/@magic-civilization): 🩹 p3-29 T2 — Rust turn emits UnitHealed
The live GDScript turn emitted `unit_healed` inline; the headless healing
phase recovered HP silently. The healing phase runs in the end-of-turn
`fn(&mut GameState)` registry (no event sink), so follow the FloraSuccession
buffer pattern: stash `(player, unit_id, applied_amount, col, row)` into a new
transient `GameState.pending_heal_events`, drain it in `step()` into
`TurnEvent::UnitHealed`. The buffered amount is the CLAMPED delta actually
applied (not the nominal heal rate). No wire surface — dispatch drops it; the
live UI consumes it via the kind-tagged `event_to_dict` dict.

Verified headless: mc-replay 19/0 (unit_healed_serde), mc-turn 289/0
(healing_buffers_unit_heal_event_with_applied_amount +
healing_buffers_clamped_amount_near_full_hp + event_collector_wiring).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-27 06:12:07 -04:00
Natalie
d49993e3dd test(@projects/@magic-civilization): 🚦 Rail-1 verify gate — no game-data transform logic in GDScript
Add tools/check-no-gdscript-sim-logic.py and wire it as verify step 18 (TOTAL
20→21). Fails if presentation GDScript (src/game/engine/src/**/*.gd) re-introduces
catalog yield aggregation (`yield_production += …`) or hand-built spec dicts
(`"yield_production": …`) — the exact drift class just moved to Rust. Verified to
flag the pre-7e2baa25d aggregation and pass clean on the current tree. Logic
belongs in the mc-* crates, reached via the GDExtension bridge (Rail 1).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-24 23:55:39 -04:00
Natalie
269316722e feat(@projects/@magic-civilization): 🎬 declarative start-script system (p3-14)
Game opening becomes a moddable JSON script driven by mc_worldsim::StartScriptRunner
and exposed to Godot via GdStartScript. Start scripts + dwarf tribe/wanderer units
live in public/resources/start_scripts; START_SCRIPTS.md documents the contract.
Adds tools/validate-start-scripts.py + wires it into CI (stage 3b) and verify.sh
(step 0b). Marks p3-14 done and regenerates the objectives dashboard.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 17:56:50 -05:00
Natalie
0c2d7c6d4a feat(@projects/@magic-civilization): colour-SoT coverage gate locks in the migration (p2-87)
Add tools/check-ui-color-sources.py: fails if a hardcoded numeric Color()/Color8()
is applied to a widget in a scene (add_theme_*_override / StyleBox *_color).
Allows computed Color(accent.r,…), transparent, named constants, and var-init
fallbacks; excludes scenes/tests + the 3 precursor deletion files. Passes clean
on live scenes (exit 0). Wired into ./run verify as step 17 so a hardcoded
colour can't creep back in.

Capstone for the override→inheritance / single-colour-system work: colours in
live scenes now provably come from the design-token source.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 10:27:56 -05:00
Natalie
70537bc0d1 feat(@projects/@magic-civilization): claude-player-mcp rendered tools — magic_civ_screenshot / open_screen (p2-86 phase 2)
- render_client.ts: TCP client that spawns the rendered game via
  render-driver-server.sh, then sends screenshot / open_screen / ping correlated
  by id (distinct from the headless stdin HarnessClient).
- scripts/render-driver-server.sh: boots the REAL game (MC_AUTO_START +
  MC_MCP_RENDER, gl_compatibility, not --headless) so the driver captures real
  frames; client connects on MC_MCP_PORT.
- index.ts: magic_civ_screenshot + magic_civ_open_screen tools, render-client
  holder + cleanup.

Verified end-to-end through the BUILT TypeScript (no Claude restart needed):
RenderClient -> game -> TCP ping {ok}, screenshot -> a real 3420x1923 PNG of the
live world map. dist/ is gitignored (built locally per .mcp.json); the tools
surface in a Claude session after the next restart.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 21:09:10 -05:00
Natalie
c88e136469 fix(@projects): 🐛 update deployment and guide workflows
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-06-10 03:38:03 -07:00
Natalie
0d2520a700 feat(@projects/@magic-civilization): add terraforming cascade design and fauna updates
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-06-09 19:51:48 -07:00
autocommit
3952ece916 scripts(scripts): 🔨 Add UI proof capture script for screenshot generation and visual regression testing
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-06-04 18:19:11 -07:00
autocommit
b651937b9b infra(player-api): 🧱 Enhance player API server startup script and debugging tools with improved error handling and logging
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-06-03 04:06:43 -07:00
autocommit
2d7357550e fix(scripts): 🐛 Fix false positives in container liveness checks and batch status reporting logic
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-27 11:40:48 -07:00
autocommit
619dafbdcc security(scripts): 🔒️ Fix root-owned directory permissions in Docker bind mounts to prevent security vulnerabilities
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-26 16:33:24 -07:00
autocommit
a92e25e064 scripts(ai-docker): 🔨 Update Docker configuration for AI simulator with GPU support, environment variables, and runtime optimizations
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-26 13:02:45 -07:00
autocommit
97a5b9391f build(scripts): 📦️ Replace local build step with Docker-based simulator .so file generation in apricot-run.sh to ensure consistent artifacts with current SHA
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-26 13:02:45 -07:00
autocommit
595486b7b3 chore(rl-train): 🔧 Update RL training script with new environment variables and execution flow for dynamic environment selection and training modes
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-26 02:21:14 -07:00
autocommit
0f24c80f1b perf(player-api): Add systemd slice integration to enforce CPU/memory limits for player API workers during RL training
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-26 02:21:13 -07:00
autocommit
3f1aeaa602 infra(player-api): 🧱 Update player API infrastructure to enable multi-slot configuration for concurrent player agents
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-26 02:21:12 -07:00
autocommit
d6e0ab34ce chore(player-api): 🔧 Update player API server script configuration for environment variables, startup commands, and execution logic
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-26 02:21:11 -07:00
autocommit
bcae15089c chore(scripts): 🔧 Update training script config for LAN hostname and VPN ProxyJump failure handling
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-26 02:21:11 -07:00
Natalie
7678f4668f feat(@projects): add docker container wrapper for godot
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-25 14:06:52 -07:00
Natalie
50e174ab06 feat(@projects/@magic-civilization): add step_cap evaluation category
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-17 05:34:29 -07:00
Natalie
4a862b76fb fix(@projects/@magic-civilization): 🐛 improve pid detection in rl scripts
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-17 05:28:24 -07:00
Natalie
a6f909a151 feat(@projects/@magic-civilization): add rl-train management script
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-17 05:22:23 -07:00
Natalie
ad108810dd feat(@projects/@magic-civilization): add rl-self-play harness and Claude player integration
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-17 03:51:07 -07:00
Natalie
91ef4bc21f feat(@projects/@magic-civilization): rename claude-player to player-api refactor
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-17 03:43:32 -07:00
Natalie
aaa7e24357 feat(@projects/@magic-civilization): add os-specific godot runner logic
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-17 02:06:12 -07:00
Natalie
91eeca0aaa feat(@projects/@magic-civilization): add godot process tracking
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-16 23:16:39 -07:00
Natalie
60838c293f fix(@projects/magic-civilization): 🐛 add godot process check for batch status
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-16 23:10:37 -07:00
Natalie
bf9295a5d9 feat(@projects/@magic-civilization): add weston-based civics proof script
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-14 19:44:00 -07:00
Natalie
4b359c56f9 feat(@projects/@magic-civilization): add lens proof rendering script
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-14 18:12:38 -07:00
Natalie
2f4c8a7756 feat(@projects/@magic-civilization): add weston-headless backend support
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-12 11:44:43 -07:00
Natalie
cc927240fb feat(@projects): add ai vs claudio render test suite
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-12 11:40:40 -07:00
Natalie
02ea1eccc0 feat(api): add 25-turn Claude demo transcript capture
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-11 20:20:10 -07:00
Natalie
7d111acb1a fix(@projects/@magic-civilization): 🐛 resolve ai personality loading and turn processing
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-11 12:27:23 -07:00
Natalie
5c9800cb77 feat(@projects/@magic-civilization): add smoke test script for Claude Player API
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-11 12:16:16 -07:00
Natalie
81a674de1e feat(@projects/@magic-civilization): add claude-player headless harness
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-10 17:02:46 -07:00
Natalie
32217fa356 fix(@projects/@magic-civilization): 🐛 mark async batch protocol as complete
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-07 07:34:48 -07:00
Natalie
587a10bca0 fix(@projects/@magic-civilization): 🐛 add ai promotion debug logging
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-06 10:54:24 -07:00
Natalie
6216d97a76 feat(@projects/@magic-civilization): add async smoke test script
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-05 14:12:23 -04:00
Natalie
587d4c9934 feat(@projects/@magic-civilization): add ai-quality-baseline mode
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-04 17:51:24 -04:00
Natalie
26c4537d04 feat(@projects/@magic-civilization): add diplomacy negotiation UI
Co-Authored-By: Lilith Autocommit <noreply@atlilith.com>
2026-05-03 04:46:21 -04:00