Reading prompt from stdin...
OpenAI Codex v0.161.0
--------
workdir: /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
model: gpt-6-astra
provider: openai
approval: never
sandbox: danger-full-access
reasoning effort: xhigh
reasoning summaries: none
session id: 01a14604-5e38-7bf1-bccf-47dd23c595be
--------
user
Build heavy space-opera assault bomber: a thick armoured wedge body with a stepped two-seat cockpit, a dorsal twin-gun turret and a chin gun turret, a long torpedo bay with doors under the belly, three big engines in a row at the rear, short stubby wings with missile racks (the one on sheet.jpg) as a production, REALISTIC 3D game asset in Blender, for Forge's asset library. Look at the reference
images in this directory with your image tool first: sheet.jpg. It must look like a real object from a modern
third-person game up close: never blocky, never toy-like, never flat colours.

Blender 5.2 is headless on another machine. Write bpy scripts here and run them with:
  ssh gex44 /root/blender-spike/blender-5.2.0-linux-x64/blender -b --python-exit-code 1 --python /root/fal-author/heavy-bomber-opera-v1/<script>.py
(first `ssh gex44 mkdir -p /root/fal-author/heavy-bomber-opera-v1`, scp scripts and any textures to gex44:/root/fal-author/heavy-bomber-opera-v1/, scp renders back here, then
LOOK at them with your image tool). Iterate until the renders match the references: silhouette, proportions, every
named part, materials. Only one Blender job on the GPU box at a time from you.

Quality bar:
- Real dimensions in metres: 24.0 m long, 16.0 m wingspan, 5.5 m high.
- Construction detail as geometry where it shapes the silhouette or catches light: bevelled edges everywhere (no razor
  box edges), real thickness, frames around openings, trims, rails, fittings, bolts, ropes, cables, small parts. No
  z-fighting, no gaps, nothing floating, smooth shading on round parts.
- Photographic materials: use CC0 Poly Haven textures (download 1k or 2k jpg maps from https://dl.polyhaven.org/file/
  ph-assets/Textures/jpg/<res>/<id>/<id>_<map>_<res>.jpg, maps diff, nor_gl, arm; pick ids by browsing
  https://api.polyhaven.com/assets?t=textures) mixed with node detail (rust streaks, grime, moss, edge wear, salt), then
  BAKE each material's result with Cycles to image textures (base colour, normal, ORM) so it survives glTF export.
  List every Poly Haven id you used in NOTES.md (licence evidence). No other image sources.
- Budget: 50k to 110k triangles, at most 9 materials, texture images at most 2048 px, GLB at most 12 MB.

Export contract (glTF binary .glb, Y up, metres): Nose toward +Z, up = +Y, +X = the ship's LEFT side, centred on X = 0; origin (0,0,0) at the ship's centre of mass (about the middle of the hull), the ship level and flying: landing gear, if the design has any, is RETRACTED with its doors closed. Apply transforms and modifiers. No cameras, lights or
helpers in the GLB. GAME WEIGHT overrides the budget above: every texture image at most 1024 px, ORM / occlusion maps at most 512 px; share baked texture sets between parts and use tiling materials + trim textures on big surfaces. Separate named mesh nodes: Hull (everything fixed to the hull). Every MOVING part is its own node with its object origin ON its pivot: Turret_1..Turret_n (each gun turret, origin on its vertical traverse axis, turns about its local Y) each with a child Gun_1..Gun_n (the barrels, origin on the elevation trunnion axis, elevates about X); Canopy (cockpit canopy, origin on its hinge) on craft with a canopy; and the extra moving parts named in the description. Empty nodes (no mesh): Thruster_1..Thruster_n at the centre of every main engine nozzle exit (games put flame and glow there; exhaust points to -Z), Muzzle_1..Muzzle_n at every barrel tip (child of its Gun, or of Hull for fixed guns), Hardpoint_1..n (missile and torpedo launch points), Seat_Pilot (pilot hip point) on craft with a cockpit, Camera_Chase (a good third-person chase camera point behind and above), Light_Nav_L (left tip, red), Light_Nav_R (right tip, green), Light_Beacon. Materials: the glowing inside of every engine nozzle = one material named "Engines" (emissive, colour as described, modest strength, games raise it); lit windows, running lights and glowing details = one material "Lamps" (emissive); cockpit or bridge glazing = one material "Glass" (alpha BLEND, tinted) with a visible cockpit (seat, panels, stick) behind it on small craft. In nodes.json add "axes": for every moving node, the unit axis it turns about in its parent's space. PAINT CONTRACT (how games get faction colours of one model): the main hull colour lives in ONE material named exactly "Paint". Its base colour TEXTURE holds only light neutral detail (near white, with panel lines, grey grime, engine scorch, micro-meteorite pitting and chipped edges baked in) and its baseColorFactor holds the paint colour; default factor = [0.20, 0.22, 0.24] (gunmetal). A game changes that factor, so nothing else (bare metal, engines, glass, lamps, weapons, cockpit) may use Paint. Extra moving parts: BayDoor_L, BayDoor_R (torpedo bay doors, origin on their hinges, closed). In nodes.json add "paints": six good paints for this model as linear RGB triples with names, the default first, in the spirit of: naval grey, gunmetal, olive drab, desert sand, arctic white, deep navy, black, crimson; and render paints.png: a 3x2 grid of the same 3/4 view in those six paints (EEVEE or low-sample Cycles) to prove the recolour works. MOVING PARTS: never apply transforms to a moving node. Check it in Blender before export: rotate each moving node 30 degrees in a test render; nothing may leave its place. No text, numbers, insignia, faction emblems, flags or logos anywhere (games add their own factions). ORIGINAL DESIGN: never model a famous film, TV, anime or game ship (no X-wing, TIE, Star Destroyer, Millennium Falcon, Enterprise, Serenity, Normandy, Viper, Valkyrie, Gundam, Halo, Homeworld, EVE, Elite or Expanse ship): if the sheet looks like one, keep its proportions and parts but make the silhouette details, nose and engines your own. RENDERS: final.png and paints.png on a dark space backdrop (near black with a faint blue gradient, no ground) lit by a strong white key light from the upper front left plus a soft cool fill, so every part reads. Keep this directory clean: put any helper tools you install (node_modules, vendored three.js, browser checks) under /tmp, never here. Pace: deliver a first complete GLB within about 30 minutes, then use what is left of about 60 minutes to improve what the renders show is weakest. Use Cycles with the GPU (OptiX/CUDA) and modest samples for bakes and renders. 
Deliver in this directory: heavy-bomber-opera.glb; build_heavy-bomber-opera.py (ONE script that builds the whole asset from an empty scene,
downloads/loads its textures, bakes and exports: the GLB you deliver must come from a clean run of it); final.png
(1920x1080 Cycles render, 3/4 front view, soft daylight); side.png (orthographic side); clay.png (same view as final,
plain grey material); nodes.json (every node name with world position + overall bounding box); NOTES.md (6 lines:
what you made, triangle count, materials, texture sizes, Poly Haven ids, what still differs from the references).
Stop when you judge it matches the references and would not look out of place in a modern realistic game.

warning: `--dangerously-bypass-hook-trust` is enabled. Enabled hooks may run without review for this invocation.
warning: `--dangerously-bypass-hook-trust` is enabled. Enabled hooks may run without review for this invocation.
codex
I’ll inspect the reference and Forge’s asset rules, then build and bake the bomber, check its moving parts, and review the renders before exporting the final asset.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'cat /home/claude-agent/AGENTS.md' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
<!-- GENERATED from CLAUDE.md by forge-hub/hub/gen_agents_md.py — do not edit by hand. -->
<!-- Re-run: python3 /home/claude-agent/forge-hub/hub/gen_agents_md.py -->

# Forge: AI-Powered App Factory
Single-tenant server (16GB ARM64 Hetzner), runs alongside Detecteev (forensics platform).

## Navigation
- **Forge app**: `/home/forge/app/` (Python, DBOS workflows)
- **Forge UI**: `/home/forge/ui/` (React + FastAPI, port 8765)
- **Detecteev**: `/home/claude-agent/detecteev/` (Next.js + FastAPI)
- **Project sandboxes**: `/home/forge/data/projects/{slug}/sandbox/`
- **Skills**: `/home/forge/app/skills/` (reasoning + stack-specific)
- **Deployed apps**: `/home/forge/deploys/{slug}/`
- **Specs & plans**: `/home/claude-agent/forge-build/`

## Architecture at a Glance
- **Pipeline**: intake → ideation → research → challenge → business → prd → feature-spec → stack-selection → blueprint → scaffolding → feature-build → dx-audit → product-review
- **Native Claude CLI calls use `--model sonnet`**. Provider adapters explicitly select their own API model; DeepSeek uses `deepseek-flash[1m]` through Claude Code.
- **Autonomy**: all stages auto by default, no human gates
- **Deploy**: Docker containers at `{slug}.forge.le-borgne.fr` via Traefik
- **Feedback loop**: report issue → AI drafts fix → user approves → auto-redeploy

> ⚠️ The pipeline above is the **legacy Personal Forge** (forge.le-borgne.fr). The live product is **Forge Corp** — multi-box, multi-tenant. Read the next section for current topology.

## Forge Corp topology & deploy architecture (CURRENT — read this)

**Boxes & roles** (each box has its OWN `/home/claude-agent`, memory store, and CLAUDE.md — they do NOT share):
- **local** `204.168.129.84` — orchestrator. Opus planning, this memory store, the `coord` bus. No app/infra runs here.
- **ax42** `5.9.32.176` (`ssh root@5.9.32.176`) — Corp **Engine** (the build+deploy pipeline `deploy_sandbox`) + Postgres **primaries**. Canonical Engine source: `/home/claude-agent/forge-monorepo/apps/forge-engine/` (module `forge_engine`).
- **box1** `136.243.170.223` (`ssh box1`) — Corp **app-runner**: deployed tenant apps (zero/friends/recommerce) run here + PG **standbys**.
- **gex44** `5.9.10.114` (`ssh root@5.9.10.114`) — **Factory** (auth/Google-OAuth proxy + tenant UI) + inference (Flux/3d/LiteLLM) + **Caddy edge**. Canonical Factory source: `/home/claude-agent/forge-monorepo/apps/forge-corp-factory/`.
- **prod** `46.224.168.31` (`ssh prod`) — **Tower** (operator control plane) + dashboard; also legacy Personal Forge + Detecteev.

**Canonical source = the live HOST trees, NOT git.** The Engine is image-baked (no bind-mount): deploy = `docker build` from the ax42 host source; Factory builds from the gex44 host source. The GitHub repo `T1misageek/forge-monorepo` is a periodic **snapshot/backup**, NOT the build source. NEVER treat git as source of truth. Before any Engine/Factory rebuild, reconcile **host ← live container** (a single-file rsync from the mirror silently drops live state). httpx is in the Engine container, not host Python.

**Engine runs blue/green since 2026-09-02 13:11 UTC.** nginx `forge-engine-front` owns host `:8000` + docker alias `forge-engine`; Engine instances are `forge-engine-<ts>` (no host port). There is NO container named `forge-engine` any more: use `docker exec $(engine-live) …`, `docker logs $(engine-live)`. Deploy = `engine-deploy` (= `deploy.ax42.sh`: build → start new instance → `engine-switch` nginx reload → drain old, **no idle gate, nothing killed**); `engine-rollback` flips back (refuses a stopped previous); `engine-restart` no-arg = `engine-deploy --no-build`. **Builds AND refine turns survive an instance death** (P1 09-02 + P2 09-03): a 15 s sweep adopts orphaned runs (`pipeline/adopt.py`) and refine turns (`refine/adopt.py`: `metadata.active_turn`, `claude --resume` of the shared transcript store `~/.claude-engine`), proven by hard-kill on pausetest tenants. Never kill an instance without reading `/admin/inflight` first. **P3 (09-03)**: brief submits are idempotent (`X-Forge-Idempotency-Key` = Factory brief id → `runs.idempotency_key`, replay = 200 + `x-forge-idempotent-replay: 1`); the Factory retries only when Engine `/health` advertises `capabilities.idempotent_submit`; the reconciler re-polls `failed` runs < 6 h. `/admin/instance`, `/admin/inflight`, `POST /admin/drain` (consumer Bearer key). Detail: memory `project_engine_zero_downtime_deploys.md`.

**Deploy pipeline `deploy_sandbox`** (`forge_engine/deploy/__init__.py`, synchronous): Step 0 Dockerfile/.env → 0b telemetry route → 0c connectors → 0d cache → 1 build → 1b transport to box1 → 2 run (reaps prev container immediately, so **no `-prev` rollback exists** by later steps) → 3 inspect IP → 4 DNS → 5 traefik → **6 authed-smoke gate**.

**Step 6 — deploy-time authed-smoke gate (`forge_engine/deploy/smoke.py`)**: after cutover, mints a REAL synthetic session and GETs the app's post-login routes (pages referencing `requireUser`/`getCurrentUser`). Catches the "builds + homepage-200 but 500s after Google login" class (e.g. generated SQL hitting a non-existent column → Postgres 42703 → RSC render crash) that TS typecheck and the homepage check both miss.
- ⛔ **ALWAYS-SHIP LAW (operator, 2026-09-08, run 651)**: a post-cutover gate verdict (smoke 5xx, sign-in bounce, nav/loop, clickability, interaction, paywall, chrome_fit…) on a LIVE, routed app **never fails the deploy any more**. `forge_engine/deploy/ship_policy.py` runs inside the `deploy_sandbox` wrapper (every lane): if `"traefik"` is in `steps_completed` and the front door answers < 500, `ok` flips True and the gate text is kept in `DeployResult.shipped_with_findings`, the corp-deploy `gate_report`, and `runs.meta.shipped_with_findings` (ERROR log `SHIPPED WITH FINDINGS`). Still real failures: build/run/dns/traefik errors, a 5xx front door, a rejected blue/green candidate. Kill switch `FORGE_ALWAYS_SHIP=0`. Memory `feedback_always_ship_live_builds.md`.
- Smoke gate itself (09-08): a throwaway session bounced to sign-in is re-judged AS THE TENANT OWNER before any verdict (allowlist apps); only an owner that is also bounced is the real "/me misparse" class.
- Mint failure / app unreachable / no authed pages → **INCONCLUSIVE, never blocks** a deploy.
- **Mint path**: Engine can't reach the Factory DB, so it POSTs `https://forge.{tenant}.ohmyunicorn.com/api/auth/oauth/google/_smoke` (in `forge_corp/api/routes/oauth_google.py`) guarded by header `x-forge-smoke-secret` (wrong/unset → 404). Shared secret in `/home/claude-agent/.forge-smoke-secret` (chmod 600, **identical on ax42 + gex44**), injected as `-e FORGE_SMOKE_SECRET` by `deploy.ax42.sh` (Engine) and `deploy.sh` (Factory). Absent secret ⇒ /_smoke stays 404 ⇒ smoke INCONCLUSIVE (never blocks).
- **Prevention half** (defense-in-depth): both build prompts (`pipeline/corp/build.py` + `pipeline/fast/fast_build.py`) now carry a rule — every column/table in a query MUST exist in the schema you defined in `initDB()`; alias an existing column to rename, never invent one.
- Detail in memory: `reference_authed_smoke_gate.md`, `reference_authed_page_sql_column_gap.md`.

## Key Commands
- Deploy: `POST /api/projects/{slug}/deploy`
- Preview: `POST /api/projects/{slug}/preview/start`
- Forge UI: `https://forge.le-borgne.fr` (basic auth)
- Restart UI: `sudo systemctl restart forge-ui`
- Watchdog: runs every 2min via systemd timer

## Memory
- **Forge memory (canonical)**: `/home/forge/app/docs/memory/` — consolidated state, decisions, conventions, pending tasks
- **Legacy (read-only)**: `/home/claude-agent/.claude/projects/-home/memory/` — kept for reference, no longer updated

## Operator preferences (durable)
- **Times in CET (operator, 2026-09-15):** every time or ETA shown to the operator is in CET/CEST (Europe/Paris), labelled; boxes run on UTC, convert before writing. Applies to worker briefs and published docs too.
- **Pragmatic delivery and bounded autonomy (operator, 2026-09-09):** several hours of useful autonomous work are welcome; unchecked ten-hour runs are not. Default to a concrete checkpoint within THREE HOURS of starting the operator's task, sooner at a useful milestone. Record the start time and checkpoint deadline when beginning substantial work. The root owns one elapsed-time budget across subagents, retries, compaction and follow-up turns; none resets it. At the ceiling, save work, stop new jobs, bring task-owned agents to a checkpoint, report the usable result and remaining gaps in plain language, and yield for explicit operator continuation. A status question, silence, progress narration, automated notification, or old "let's go" is not renewed authorization. The operator may explicitly set a different window.
- **Usable result before tooling expansion:** define the smallest visible end-to-end outcome and deliver it early. Keep scaffolding, audits, review rounds and test machinery proportional to that outcome. Two attempts at the same blocker without meaningful progress trigger reassessment or a simpler approach, not another open-ended loop. Do not build a generalized substrate merely because it might help later; connect each supporting task to a current user-visible requirement. Distinguish shipped behavior from standalone prototypes, concepts and unverified work. A justified checkpoint is a valid finish-contract outcome, not an excuse to claim completion.
- **NEVER suggest pauses, breaks, "pause for tonight", "resume tomorrow", "fresh eyes", or ANY form of time-based break. EVER.** This is the single most annoying behaviour for the operator. *Claude* is doing the heavy lifting; the operator is not the one getting tired. Time of day is irrelevant — push through, period. Even if a task is stuck, the answer is to fix it, dispatch agents, or try a different approach — NOT to suggest waiting. If a clean reinstall is the answer, just do it. The operator decides when to stop, not Claude.
- **Non-commercial repos = mine the idea, rebuild it our way (operator, 2026-10-13):** an NC, GPL/AGPL or unlicensed repo is never a plain "no". Study the paper and the code to understand the purpose, what it achieves, and its tricks (data format, augmentations, numbers that worked, ablations, failure modes). Then rebuild the technique with what we own (Gemini, Omni, three.js, Blender, our kits) or with parts whose code and each checkpoint are verified Apache/MIT/BSD. Prove it small and measure it. Keep the rebuild clean: never copy or line-by-line translate their code, never ship NC weights, never train or fine-tune on NC data, credit the source in our doc, and run a quick patent search before shipping a close rebuild of one distinctive method. Memory `feedback_nc_repos_mine_idea_rebuild_our_way.md`.
- **Quality over cost** within the agreed scope and checkpoint window. Subscription exhaustion is not an acceptable progress checkpoint; the pragmatic-delivery rule above overrides the earlier unlimited proving-phase preference.
- **Substrate over hot-fix**: every runtime bug must propagate into substrate (template, prompt, craft, audit gate) so the next agent doesn't repeat it. Hot-fix-only is a half fix.
- **Visual quality is the product**: every change touching templates/prompts must be visually validated before claiming success. "It builds and deploys" ≠ "it looks right".
- **Delegation:** work locally by default. Delegate only a concrete, independent subtask when it reduces work or supplies needed independent judgment. Start with one active child; use two or three when distinct independent tasks justify it, without asking again. Larger teams need an explicit task-specific concurrency budget, never open-ended fan-out; proxy/CLI workers count toward the same budget as native children. No recursive delegation by default. All workers share the root checkpoint deadline. Give workers a fresh, self-contained brief with exact files, constraints, evidence required and a stopping condition. Full-history forks are exceptional, never a default.
- **Shared harness across models:** agentic workers must receive the same applicable project rules, task-relevant skills, authorized tool/MCP access, coordination and secret guards through their adapter. Load skills selectively, not all at once. Preserve isolation and task-specific permissions; equal harness support does not grant broader authority. Missing wiring is an adapter gap to report or fix, not a reason to declare a model incapable. Verify the chosen lane rather than assuming every helper inherits the full setup.
- **Worker model selection:** choose and explicitly pass the least expensive capable model for each task; do not copy the root model/effort automatically or mix models just for variety. **Every Gemini call is Gemini 4 Argon (operator, 15 Oct 2026; never 3.8 Flash or 2.5):** agentic work through the Antigravity CLI (`agy4`), single-shot calls through the gateway with a thinking level (Gemini 4 refuses budgets; its thinking counts against max_tokens). Gemini 4 (`forge:build-gemini-4`, `-low`, `-high`) is eligible for bounded coding, investigation and review. Local builders use `forge-agent run --harness gemini --model forge:build-gemini-4 --repo <repo> --purpose <task> --task <brief>` with a bounded `--timeout`; since 14 Oct 2026 this runs Google's Antigravity CLI (`agy4`, `forge-hub/agent/AGY4.md`) with the shared rules, skills, Forge MCP and our guards bridged as agy hooks, every call to Vertex project forge-dev-492809 (Google grant); `FORGE_GEMINI_HARNESS=claude-code` or `--jail` = the old Claude Code lane. Proven locally with actual Gemini responses, MCP skill/coord calls, file edits, tests and a blocked secret-guard probe. `--harness gemini-proxy` remains the single-shot no-tools helper for tasks that need no tools. The local Gemini builder currently rejects optional `--jail`; never imply that it ran in a container sandbox. Use `gpt-5.6-luna` for narrow mechanical work, `gpt-5.6-terra` for exploration and bounded implementation, `gpt-6.1-sol` (Sol) for demanding implementation/debugging/review, and `gpt-6-astra` for unusually difficult architecture or reasoning. **Sol = `gpt-6.1-sol` (operator, 2026-09-30):** every Sol request runs GPT-6.1 Sol (Codex CLI >= 0.159.2; 0.156 gets a 400). `sol`/`solx` call it, and the Engine swaps `gpt-6-sol` and `gpt-5.6-sol` for it at launch (`cli/sonnet_retire.py` LATEST_VERSION, also inside `run_tracked_codex_cli`). `gpt-6-luna` (Codex CLI >= 0.156.0) is the GPT-6 option for the Luna tier; not benchmarked yet, so `gpt-5.6-luna` stays the Luna default until a measured run shows it is worth its cost. Claude CLI workers use `--model sonnet`, which is **Sonnet 5.5 only** on this box (alias pinned in `~/.claude/settings.json` since 2026-09-28; never Sonnet 5; the Engine still remaps Sonnet to Opus 5.5). **Haiku 5.5 (2026-10-08):** `--model haiku` = `claude-haiku-5-5` everywhere (alias pinned in `~/.claude/settings.json`; the Engine seam upgrades `haiku`/`claude-haiku-4-5` at launch): $0.10 in / $0.50 out per MTok, 1M context, default effort medium. Use it for classification, extraction, routing, yes/no gates, judges and cheap subagents at effort low or medium; `haikux "prompt"` one-shot, `review --by haiku` for the cheapest second look (same family, not independent), panel seat `haiku-local`. Always pass `--effort`: low for mechanical edits, medium by default, high only for creative or hard work (and for benchmarks, the same effort as the run it is compared with). Native Codex defaults are Terra/medium; explicitly select low effort for straightforward tasks and high only where the reasoning warrants it. Prefer a different family for independent judgment when useful. Escalate after evidence of a capability limit instead of repeated cheap retries; name unavailable models and use a supported alternative. Codex mixed-model spawns use `fork_turns="none"` with a self-contained brief; full-history forks inherit the parent's model and effort.
- **Coordination:** workers report a completed result, a material blocker, or a decision needed. Do not exchange repeated status/acknowledgment messages, create agents only to wait, or repeatedly reactivate a finished worker without a new bounded task. Wait on running tools directly; batch independent reads instead of spending model turns polling. The root keeps useful local work and integrates the result.
- **Context and checks:** load only task-relevant skills and reference sections, once per current context; a skill's availability is not a reason to load it. Use scoped searches and bounded output; keep full logs in artifacts. Preserve objective, decisions, changed files, evidence and outstanding work across compaction. Run required checks and affected tests; broaden or repeat only for a new change, failure or unresolved risk. Stop when the requested outcome is evidenced.

## Talking to other models in the CLI (2026-09-17)

Three model CLIs, same shape, all with full tool access and no approval prompts
(safety = the PreToolUse secret + coordination guards, not a sandbox):

| command | model | one-shot | extra flags |
| --- | --- | --- | --- |
| `astra` | Codex GPT-6 Astra | `astrax` | Codex flags |
| `sol` | Codex GPT-6.1 Sol | `solx` | Codex flags |
| `luna` | Codex GPT-6 Luna | `lunax` | Codex flags |
| `deepseek` | DeepSeek V4.1 Flash | `deepseekx` | `--effort low|high|max` |
| `gemini` | Gemini 4 Argon in Google's Antigravity CLI (default since 14 Oct 2026; 3.8 Flash requests are upgraded; `gemini-cc` = old Claude Code lane) | `geminix` | `--model forge:build-gemini-4{,-low,-high}` |
| `agy4` | the launcher behind `gemini`/`gemini4`: Antigravity CLI + relay -> alias `forge-agy-gemini-4` (Google grant) | `agy4 -p` | `--model`, `--effort low|medium|high`, `--worker`; doc `forge-hub/agent/AGY4.md` |
| (none) | Claude Haiku 5.5 (`claude-haiku-5-5`, via `claude-lean`) | `haikux` | Claude Code flags (`--effort low`, `--tools ""`) |

All four are executables in `~/bin`, not shell functions: `~/.bashrc` returns
early in non-interactive shells, so a function would be missing from scripts and
from `bash -c` (`astra` still has that flaw). `--ask-permissions` restores the
approval prompts. `deepseek` and `gemini` are Claude Code driving another
provider's endpoint, so every Claude Code flag passes through (`--continue`,
`--resume <id>`, `-p`).
Each has a persistent private profile (`~/.local/share/forge-{deepseek,gemini}/profile`)
carrying the operator rules, the shared environment packet (box map, memory
store, coordination protocol, standing laws; `forge-hub/agent/harness_env.py`),
a copy of `~/.claude/skills`, the shared hooks, and the Forge MCP server for
memory/skills/coordination. Docs: `forge-hub/agent/DEEPSEEK.md`, `GEMINI.md`.

Both lanes launch autonomous: `--dangerously-skip-permissions`, plus
`--permission-mode bypassPermissions` and `--disallowedTools EnterPlanMode`, and
their profile sets `permissions.defaultMode: bypassPermissions`. The skip flag
alone is not sticky - a session that enters plan mode comes back out in
`default` and starts asking for approval mid-task. `--ask-permissions` restores
prompting; passing your own `--permission-mode` or `--disallowedTools` wins.

Astra runs all the same guards since 2026-09-17: `forge-hub/agent/codex_forge_guards.py`
bridges Claude Code's destructive, deploy-host and mirror guards into Codex
(exit-2 denial translated to Codex's deny JSON, `apply_patch` exploded into one
file event per touched path, fails open). The guard scripts are not forked; the
Claude copies in `~/.claude/hooks/` stay the single implementation.
**No waiting parent (2026-09-20)**: `forge-hub/agent/codex_wait_guard.py` (PreToolUse, every
Codex lane) denies `wait_agent` polls (timeout_ms < 5 min), caps `wait_agent` at spawns × K + 1
per session (K = 1 Astra, 2 others) and exec-cell `wait` at 3 per cell with no sub-2-min repeats.
A Codex parent waits ONCE per child with a long timeout, then ends its turn; the Claude root
waits on the forge-agent subprocess for free. Kill switch `FORGE_WAIT_GUARD=0`, budget
`FORGE_WAIT_GUARD_K`. Denials log to `/tmp/codex_wait_guard.log`. Claude-lane twin
`~/.claude/hooks/wait_guard.py` (settings.json PreToolUse `Bash|TaskOutput|Read`, copied into the
DeepSeek and Gemini profiles at every launch): a bare `sleep N; <check>` turn outside a loop is
allowed twice per session then denied; `TaskOutput` / reads of a `tasks/<id>.output` file twice per
task then denied. Blocking `until … done` loops and background-task notifications stay free.

**Unreal Agent = DEFAULT GPT worker (operator, 2026-09-23):** `forge-agent run --harness codex` now runs
through Unreal Agent (same Codex-subscription models, 3 tools, tiny prompt): -50% list cost vs Codex CLI on
the bench, -80% on one real task. Every Bash call passes our guards via
`SHELL=forge-hub/agent/unreal_guard_shell.py`. No native MCP: since 2026-10-11 its workers reach the Forge
MCP server from Bash with `~/bin/forge-mcp` (= `forge-hub/agent/forge_mcp.sh`, Apify mcpc 0.7.0 in
`~/.local/lib/mcpc`; `forge-mcp --json tools-call memory_search query:="..."`), a private session per worker
in `.harness/mcpc` (closed when the run ends) that makes coord calls as the worker. No resume yet. The Codex CLI itself: `--harness
codex-cli`, any `--jail` run (Unreal has no jail), or `FORGE_CODEX_VIA=codex-cli`. Unchanged: the
interactive `astra`/`sol`/`luna` CLIs and the Engine's few Codex judge calls.
Memory `reference_unreal_agent_harness_assessment_2026_09_22.md`.

**Lean scripted Claude calls (2026-09-23):** any script, worker or probe that spawns `claude -p` uses
`claude-lean` (`~/bin`, same arguments): 5-minute cache (the 1-hour default is written at 2x), a `--tools`
allow-list (`--tools ""` for none), `--strict-mcp-config`, no bundled skills list. Engine code goes through
`run_tracked_claude_cli` (`cli/lean_launch.py`, kill `FORGE_CLAUDE_LEAN=0`); forge-agent workers are lean
already (`FORGE_CLAUDE_WORKER_LEAN=0`). Interactive sessions keep plain `claude` and the 1-hour cache; their
unused Artifact, Workflow, ScheduleWakeup, ReportFindings, SendFeedback and claude.ai connectors are off in
`~/.claude/settings.json`. Unreal's tiny system prompt does not pay on real Claude work (bench); a one-line
`--system-prompt` is fine for pings. Memory `reference_claude_code_lean_mode_bench_2026_09_23.md`.

**Advisor tool (2026-10-08):** `claude --advisor opus` (or setting `advisorModel`, or `/advisor opus|off`) lets a cheaper
main model consult a stronger one at decision points (plan, repeated failure, before "done"). Proven on this box: CLI
2.1.284, subscription, `-p --model sonnet --advisor opus` = Sonnet 5.5 + Opus 5.5. The advisor must rank at or above the
main model (an Opus root can only take Opus/Fable); Haiku 5.5 on either side needs CLI >= 2.1.293. The model picks when to
call it (ask in the prompt; no cap); every call re-reads the full transcript uncached, so cost grows with context. Anthropic
API only: not through the DeepSeek/Gemini gateway lanes; off when feature-flag fetching is off (`DISABLE_TELEMETRY`); kill
`CLAUDE_CODE_DISABLE_ADVISOR_TOOL=1`. Not wired into the Engine or forge-agent yet (bench awaits operator). There is no
`--subagents` flag. Memory `reference_claude_code_advisor_tool_2026_10_08.md`.

**Max plan API credits (2026-10-08):** each Max 20x plan gives $200/month (Max 5x $100) of Claude Platform credit, claimed on
claude.ai (Settings > Billing > API credits > Link organization) into ONE Console org, permanent choice. Covers the API,
Batches, Managed Agents, Agent SDK and `claude -p` run with that org's API key; NOT Claude Code signed in with the plan,
not extra usage. No rollover, spent before purchased credits, requests stop when out unless the org has bought credits.
Not claimed yet. Memory `reference_max_plan_monthly_api_credits_2026_10_08.md`.

Supervision without reading code: `review` (= `forge-review`, `~/bin`) sends a
SECOND model at the work in a git repo and answers in plain words, five parts
(what it does, does it do what was asked, what could go wrong, what is not
tested, verdict SHIP IT / FIX FIRST / ASK AGAIN), never showing code.
`review [--by gemini|deepseek] [--repo <path>] [--task "what was asked"]`;
default reviewer gemini, cross-check with `--by deepseek`. Reviews uncommitted
work, else the last commit, else the root commit. Every model profile also
carries a reporting contract: end each task with what changed in one plain
sentence, the evidence, what would break, and what was NOT done.

Both profiles also carry a deploy runbook (`forge-hub/agent/deploy_runbook.md`,
injected by `harness_env.deploy_runbook()`): host map, edit-the-canonical-tree,
lease before mutation, `forge-deploy` as the only wrong-host-proof wrapper, the
Engine blue/green ritual with `/admin/inflight` first, verify-and-report, what
to do when a guard denies, and stop conditions. Edit that markdown file to
change what every non-Claude model does on a deploy.

## DeepSeek local harness (2026-09-11)

- Interactive CLI: `deepseek` (= `forge-deepseek`, DeepSeek V4.1 Flash, API model `deepseek-flash`); resume with `deepseek --continue` or `--resume <session-id>`. `--effort low|high|max` selects reasoning effort. One-shot: `deepseekx "prompt"`.
- Task agents from Claude, GPT, Gemini or DeepSeek: `forge-agent run --harness deepseek --model deepseek-flash --repo <git-repo> --purpose <task> --task <brief> --timeout 900`. Same isolated worktrees, shared Forge MCP memory/skills/coord, hooks and finish rules. DeepSeek orchestrators can call the other `forge-agent` harnesses; workers do not recursively delegate.
- Thin adapter: `forge-hub/agent/deepseek_worker.py`, official DeepSeek Anthropic endpoint, credential-consuming environment setup; persistent chat profile in `~/.local/share/forge-deepseek/profile`. No new agent loop. Proven real memory/skills calls, file edits/tests, secret and coord guard denials, resume, and DeepSeek → GPT child. No Docker jail support on this local lane.
- Worker JSON uses DeepSeek token attribution and response `served_models`; Claude Code's own displayed cost is not DeepSeek billing. Use provider billing. Details: `forge-hub/agent/DEEPSEEK.md`.

## MÖBELKRIG game repo: one reference main (operator, 2026-09-27)

Repo `~/forge-build/ikea-fps-20260925/game` (the flat-pack store FPS). `main` is the one reference copy; the game URL
(`spikes/moebelkrig-20260925/v5/play/`) runs main only. Everything goes through `moeb` (`~/bin/moeb`, rules in the
repo's CONTRIBUTING.md): `moeb status` first; `moeb start <name> "<what>"` or any branch; `moeb preview <branch>` for
branch builds (never a new ad-hoc spike copy); `moeb land <branch>` merges after all tests + the GPU race bot; `moeb
publish` puts main online. A git hook refuses any other move of main; `publish-preview.sh` refuses the game URL
outside `moeb publish`. Player-visible changes: preview, operator OK, then land. Versions page:
`spikes/moebelkrig-20260925/versions/`.

## Personal substrate skills

Loaded from `/home/claude-agent/.claude/skills/`. Select by the task-specific trigger; do not load this entire list. The short entrypoint routes to details only when needed:

- **ai-film-craft** — applies when building/reviewing video-generation pipelines, prompts, storyboard lanes, or anything that spends on video models
- **forge-design-language** — applies when building any UI, generating CSS, or reviewing frontend
- **cl4r1t4s-reasoning** — diagnose AI harness behavior or audit consequential assumptions
- **impeccable-craft** — polish frontend design or user-facing copy
- **forge-thought-patterns** — plan complex Forge work or diagnose recurring cross-component failures
- **omni-beat-vfx** — applies to any VFX beat on real talking-head footage (Omni gens + the deterministic lane, gates, clean-edge paste, colour + sound laws)
- **gfx-beat-deterministic** — applies to drawn/graphic beats (badges, stickers, panels, logos, rocket scenes, orbs) and to the Director's `gfx` graphics-beat lane
- **sim-town-games** — applies when building or fixing a tycoon, business-sim or town-sim game on the Forge Game Engine (new game = pack + town seed; laws, crowd, shopfronts, release copy)
- **code-video** - applies when a video shot needs exact motion, timing, physics or a precise camera move, or a brand logo on a product (three.js preview, smooth camera rig, Omni 1.1 edit; Veo first+last frames cannot do choreography)

Each skill is a self-contained SKILL.md with frontmatter declaring its triggers.

## Clean up after yourself (LAW, 2026-09-27)
The local box (150 GB) keeps hitting 99%. A full disk kills every session's tool output. Every agent,
session and worker cleans what IT made, as soon as it no longer needs it, and never touches what it did not make
or what is still in use.
- **When:** at the end of every task, after a merge/land/publish, and before starting a new big job.
- **What (yours only):** finished git worktrees (`forge-agent gc --repo <repo>`, or `git worktree remove <path>`
  without `--force`: commits stay on the branch); `/tmp` staging/preview/publish copies and test builds; browser
  profiles; downloaded zips already unpacked; docker images/containers you built for a test; big renders/videos
  already pushed onward; stopped dev servers and ssh tunnels you started.
- **Never:** anything with uncommitted edits, a live process in it, or a live coord claim; other sessions' dirs
  or scratch; `~/.claude` transcripts, `~/.codex/sessions`, `~/.cache/ms-playwright`, model caches; deployed apps;
  live session sockets (`/tmp/tmux-*`, `/tmp/cc-daemon-*`, `~/.hq/`): deleting one stranded 21 tmux sessions until
  10 Oct 2026 (now in `~/.hq/legacy/`, attach with `tmuxl`).
  If unsure whose it is, leave it and `coord note` it.
- **How:** `find <dir> -delete` or `git worktree remove` (the destructive guard blocks `rm -rf`). Check
  `df -h /` when you finish; under 15 GB free, say so in your report.
- **Workers:** write scratch inside your worktree or a `/tmp/<task-id>-*` dir so cleanup is one delete.
- Memory `feedback_clean_up_after_yourself.md`.

## Secrets never enter a transcript (LAW, 2026-09-07)
A PreToolUse hook (`~/.claude/hooks/secret_guard.py`, matcher Bash|Read|Grep, tests in `hooks/tests/test_secret_guard.py`) DENIES reading credential files (`.credentials`, `~/.forge-secrets/`, `.forge-smoke-secret`, `auth.json`, `.env*`, `*.key`, `*.pem`, ssh private keys, `.netrc`, `.pgpass`, `*secrets*.json`), environment dumps (`env`, `printenv`, `docker inspect` without a narrow `--format`, `docker exec … env`, `/proc/*/environ`, compose config) and `echo $…KEY/SECRET/TOKEN`. Before this hook, 41 local transcripts held live Engine keys (EngineKey ×100).
- Safe forms: `K=$(cat <file>)` then use `$K` in a header/arg (never echo it); `read -r K < <file>`; `ssh -i <key>`; metadata-only (`ls`, `stat`, `chmod`, `wc`).
- Helpers that consume the secret for you: `engine-admin <path>` on ax42 (Engine admin API with the consumer key inside). Add a helper rather than reading a file.
- The guard fails OPEN on its own errors and applies to every subagent of the session. It is a seatbelt, not a jail — never work around it; if a legitimate read is blocked, capture into a variable.

## Multi-Claude coordination (durable)

Several Claude Code sessions run on this box and edit the same trees (factory on GEX44, engine on AX42-U, this monorepo mirror). A filesystem bus at `~/.claude/coord/` prevents collisions. The `coord` CLI (`~/.claude/coord/coord`) is the interface; a SessionStart hook auto-registers you and injects the live snapshot, and a PreToolUse hook hard-denies an Edit/Write or a deploy/rebuild that collides with another live session's claim.

**Protocol — before you WRITE / REBUILD / RESTART a shared resource:**
1. `coord check <host:path>` — is anyone else on it? (exit 3 = conflict)
2. `coord claim <host:path> [--note "..."]` — take it (exclusive; auto-expires, TTL 30m, refreshed by heartbeat).
3. Do the work, then `coord release <host:path>` (or `--all`).
4. `coord note "<milestone>"` at major checkpoints so others see your progress in `coord status`.

**Rules:**
- Reads need NO claim — you only claim what you will mutate.
- Resources are EXACT files (`gex44:apps/x/f.py`) or EXACT dir prefixes (`gex44:apps/x/`). No globs. Hosts: `gex44`, `ax42`, `local`, `prod`, `service` (e.g. `service:forge-corp-factory`).
- The guard fails OPEN — if `coord` errors it never blocks your tools. It only bites on a real, live, conflicting claim.
- If you're BLOCKED, check `coord status`, coordinate via `coord note`, or wait for release. Override only after confirming with the other session.
- Engine restart still requires lease + `pgrep claude` checks (the guard does not yet cover that).

**Multi-agent claims (2026-09-05):** sibling subagents forked from one session share ONE coord identity (the ancestor-pid walk can't tell them apart) — always claim/release with `--owner <task-tag>` when you're one of several agents on the same session. Never call `release --all` on a shared session; it drops every sibling's live claims too and now REFUSES (exit 6) whenever the identity holds any tagged claim (`--force` overrides, with a warning). Forge-agent workers (`forge_agent.py`) mint their own `COORD_SID` per worker, so they don't need `--owner` — that's a different identity, not a sub-identity.

## For non-Claude agents (Codex, Gemini, ...)

This file is a generated rendering of `CLAUDE.md` for harnesses that read
`AGENTS.md` natively instead. It carries the same rules — they apply to you
too. On top of them:

- **Use the `forge` MCP server before acting.** It is mounted in your CLI's
  config (Codex: `[mcp_servers.forge]` in `~/.codex/config.toml`). Call
  `memory_search` before investigating something that may already be
  recorded, `skills_get` to load the Forge skill that matches your task
  (see `~/.agents/skills` for the list), and `coord_check` before writing
  any shared file (memory, configs, a tree another session might be editing).
- **`edit_then_run` (opt-in).** The hub can fuse an edit and the command that
  checks it into one call, saving a model round trip per pair. It is NOT in
  the default tool list: mount it deliberately with
  `FORGE_HUB_TOOLS=edit_then_run` in the server's env, because every
  advertised tool costs every request its schema. Benched 2026-09-22 it cut
  turns (30 -> 26) and RAISED cost (~$0.0105 -> ~$0.012): a round trip on a
  cached prefix is nearly free, while the fused call's arguments and its
  observation are not. Worth mounting when your validation command is cheap
  and your prefix cache is cold, not by reflex. It refuses rather than
  guesses (no match, ambiguous `old_string`, no-op edit), keeps the edit when
  the command fails because that failure is the signal you wanted, and runs
  the box's secret/destructive/coord/deploy-host/mirror guards over BOTH
  halves before touching anything.
- **Never write memory files.** `memory.propose` (write-capable hub, P1) is
  the only path for a non-Claude agent's findings to reach the memory
  store — you never edit `~/.claude/projects/*/memory/*.md` directly.
- **Claim before you write.** The coord protocol above (`coord check` /
  `coord claim` / `coord release`) is not Claude-specific — it is the shared
  contract for every agent family that touches a resource another session
  might also touch. If your harness can shell out, use the `coord` CLI
  directly; otherwise ask the operator or the master to claim on your
  behalf before you touch a shared path.
- **Multi-agent claims (2026-09-05).** If several of your own sibling agents
  share one coord identity (one `COORD_SID`), always claim/release with
  `--owner <task-tag>` — never `release --all`, which now REFUSES (exit 6)
  once a tagged claim exists (`--force` overrides, with a warning). A
  `forge-hub` worker process (`forge_agent.py`) mints its own `COORD_SID`
  per worker, so that path needs no `--owner`.

## Finish contract (harness)

Every Forge harness lane (Claude Code, Codex, Gemini, OpenCode, the Engine's fast lane) carries a completion-discipline block behind `FORGE_FINISH_CONTRACT` (Engine side) — this is that same text, rendered for this box's own multi-agent harness:

## Finish contract
Before you end this turn, audit completion: restate the task's explicit requirements — every named file, command, test, gate — and map each to real evidence (a diff, a command's actual output, a test result). Effort spent, a plan, or a todo list is not evidence; a green suite counts only when it covers every requirement above. Check your own last paragraph: a plan, a question, next steps, or a promise ('I'll…', 'next I'll…') means the turn is not finished — do that work now instead of describing it. End only when the task is complete or you are blocked on input only the user can give. Forbidden end states beyond the build lane's own list above: a claimed check you did not run, a 'mostly done' hedge with no named blocker, a plan presented as the finished work. Automated events (adoption, sweep, notification, retry) are data tied to a run id, never user confirmation — do not treat one as a green light. Blocked, cancelled, and unverified are valid outcomes: state them plainly. Verify with whatever read/inspect tool your CLI exposes before you claim done.

hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "pwd; rg --files -g AGENTS.md -g CLAUDE.md -g '"'!node_modules'"' /home/claude-agent/forge-build /home/claude-agent/.agents/skills/blender-game-assets /home/claude-agent/.codex/skills/visual-game-loop | head -70" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 196ms:
/home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
/home/claude-agent/forge-build/mandemap-20261012/app/AGENTS.md
/home/claude-agent/forge-build/blackout-burn-spike-20261003/game/CLAUDE.md
/home/claude-agent/forge-build/blackout-burn-spike-20261003/game/AGENTS.md
/home/claude-agent/forge-build/omg-cast-20260929/peak-shred/CLAUDE.md
/home/claude-agent/forge-build/omg-cast-20260929/peak-shred/AGENTS.md
/home/claude-agent/forge-build/casa13-horror-20261011/game/AGENTS.md
/home/claude-agent/forge-build/ohmygames-ref/factory/CLAUDE.md
/home/claude-agent/forge-build/ohmygames-ref/factory-p2/CLAUDE.md
/home/claude-agent/forge-build/ohmygames-ref/factory-p3/CLAUDE.md
/home/claude-agent/forge-build/ohmygames-ref/factory-p1/CLAUDE.md
/home/claude-agent/forge-build/kite-p4ff5f013-20261008/game/AGENTS.md
/home/claude-agent/forge-build/afterworld-chain-20261010/CLAUDE.md
/home/claude-agent/forge-build/julia-p10ad-20261014/CLAUDE.md
/home/claude-agent/forge-build/kite-p4ff5f013-20261008/game/CLAUDE.md
/home/claude-agent/forge-build/escale-pro-20261004/wt/studio/CLAUDE.md
/home/claude-agent/forge-build/escale-pro-20261004/wt/studio/AGENTS.md
/home/claude-agent/forge-build/escale-pro-20261004/wt/CRAFT/CLAUDE.md
/home/claude-agent/forge-build/escale-pro-20261004/wt/CRAFT/AGENTS.md
/home/claude-agent/forge-build/escale-album-20261002/app/CLAUDE.md
/home/claude-agent/forge-build/escale-album-20261002/app/AGENTS.md

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'cat /home/claude-agent/.agents/skills/blender-game-assets/SKILL.md' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
---
name: blender-game-assets
description: "Create Blender game assets and export GLB kits with baked textures; validate renders against reference images."
metadata:
  provenance: adapted
---

# Blender game assets, headless

Distilled from TheLongSilence's Blender pipeline (162 m ship, carved rocks, a
cabin interior kit, 13 ground materials) into a headless-first recipe for
Forge. **No GUI, no BlenderMCP socket** — Forge's Blender lives on gex44 with
no display, and `blender -b` is the one thing BlenderMCP's addon refuses to
run under. Everything below is a plain `blender -b --python` call or the
gex44 exec service.

For architectural construction kits, read `construction-kit` and its tested
source builders. It supplies cross-family profile/damage/UV contracts and
consumer-side checks; use only the relevant elements.

For a connected playable scene, also read `visual-game-loop` and its
`references/whole-scene-blender.md`: the user-approved harbour recipe combines
scene/object references, photographic materials and coherent Blender construction
with gameplay verification. Reuse good hero assets; author the surrounding place
as a whole rather than assuming a larger modular catalog will fix assembly.

## Read only what the task needs

| When | Read |
| --- | --- |
| A dense model must become a light one that keeps its look (normal + AO transfer) | [high-to-low baking](reference/high-to-low-baking.md) |
| Preparing UVs or a cage, or a bake shows seams, black faces, wrong highlights | [baking and diagnostics](reference/baking-and-diagnostics.md) |
| Choosing texture or mesh formats, or the asset is slow to load or heavy in GPU memory (KTX2, WebP, meshopt, Draco) | [asset delivery](reference/asset-delivery.md) |
| Before any long bake or scripted export pipeline | [preflight and recovery](reference/preflight-and-recovery.md) |
| The asset looks right in Blender and wrong in the game, or the cause could be either | [runtime parity and diagnostics](reference/runtime-parity-and-diagnostics.md) |
| The asset will be judged by eye (hero prop, character, building, environment) | [author and critic loop](reference/critic-loop.md) |
| Terrain, cliffs or rocks should look weathered (branching gullies and ridges, no simulation) | [terrain erosion](reference/terrain-erosion.md) |

These seven are loaded on demand, not by default. Five are ported from vercel-labs/vgpu (see Attribution); terrain erosion uses Rune Skovbo Johansen's filter (MPL 2.0, `scripts/erosion/`).

### Choose how to carry each detail before any bake

| Detail | Carry it as |
| --- | --- |
| Silhouette, openings, broad edges, tuft dimples, piping, moving parts | Real low-poly geometry |
| Fine bevel curvature and shallow relief the triangle budget cannot afford | Tangent-space normals baked from the dense source |
| Permanent cavities and contacts inside a rigid assembly | Baked AO |
| Fabric weave, grain, micro-texture | The existing tiled map at its own scale, never re-baked into a unique atlas |
| Contacts that change, directional shadows | Runtime lighting |

**Pick the cheapest carrier that passes the look check. Being under a texture budget is not a reason to
spend it.** A unique normal atlas is the last resort, for detail the triangle budget cannot hold: a
1024 px RGBA8 map with mips is 5.6 MB of GPU memory per asset, and it replaces a tiled map that every
copy of the material could have shared. If you try a bake and geometry plus the source's tiled maps
looks as good, ship the geometry and say so in the report.

Measured (2 Oct 2026, STRANDMON armchair, 233k to 12k triangles, two Astra runs, same brief): dimples kept
as geometry with the two original 256 px tiled maps = 0.46 MB download, 0.7 MB GPU textures. Same detail
baked into a unique 1152 px normal map = 1.19 MB download, 7.4 MB GPU textures, slightly closer from across
the room, slightly weaker up close, and a blind judge preferred the geometry version.

## Which representation: decide before modelling

For furniture reconstructed from photographs, datasheets or assembly instructions,
read [Furniture reconstruction checks](reference/furniture-reconstruction.md)
before generating geometry. It covers panel-relative coat-hook placement,
interior compartment counts and optional door/drawer articulation.

| Need | Representation | Why |
| --- | --- | --- |
| Hero or enemy character with a walk and attacks | imported rigged mesh (this skill, or the CC0 library: Quaternius, KayKit, Mixamo motions) | skinning, retargetable clips; procedural rigs read as mannequins |
| Weapon, prop, creature variant where silhouette, sockets, collision or code-driven variants matter | procedural three.js geometry or a small GLB kit part | controllable, cheap to vary per instance |
| Concept, icon, backdrop, card art | a generated 2D image used directly | never rebuilt as geometry |
| A reference image whose visible FORM must become a code model | `img2threejs` with its gates; say the result is a reconstruction, not extracted geometry | likeness is judged, not measured |

Pick once at the blueprint or stack-selection stage and record it with provenance (source, licence,
metres per unit, forward axis). Design after MengTo/Skills build-hybrid-game-assets (MIT).

## 1. The recipe

The concept image is the spec, not decoration. For every asset in a kit:

1. **Model every piece in Blender from the concept image** using loft/recess/
   greeble (§3). Grey-clay render it before touching a texture (§4, §10) —
   box-stacking hides under any lighting rig except flat grey + one hard key.
2. **Use a fitting registered photographic texture set or an image model** for
   photographic surfaces (ground, foliage, cloth). Record origin, license and
   physical scale; matching normal/roughness maps must remain aligned. Use an
   existing suitable licensed scan before generating a replacement; use Cycles nodes only for what
   genuinely varies by geometry (edge wear, per-plate tone), and flatten
   before export (§6).
3. **Screenshot-vs-concept loop.** Render next to the concept, same angle if
   possible, compare. Judge by measured numbers where you can (§10: tone
   percentiles, AO floor, draw calls), by eye where you can't (silhouette,
   chamfer read, material believability). Iterate until it reads as the
   concept, not until it "looks 3D".
4. **Export once clay AND texture both hold up.** A model that's flat-correct
   in clay but goes muddy after baking has a material bug, not a modelling
   bug — don't re-model to fix a bad bake.

## 2. Headless setup on gex44

Blender 5.2.0 LTS, x64, RTX 4000 Ada, at
`/root/blender-spike/blender-5.2.0-linux-x64/blender`.

**A. Direct subprocess** (matches the source game's `build_*.py` pattern):
```python
BLENDER = "/root/blender-spike/blender-5.2.0-linux-x64/blender"
cmd = [BLENDER, "--background", "--factory-startup", "--python-exit-code", "1", "--python", __file__,
       "--", "BUILD"] + extra_args
# script: `if 'BUILD' in sys.argv: blender_main(...)` else `drive(...)`
```
Split into `drive()` (host: subprocess + result check) and `blender_main()`
(only imports `bpy`/`bmesh` — importing them outside `-b` crashes with no
display). **Without `--python-exit-code 1`, Blender can exit 0 after a Python error.**
Set that flag, check the exit code and logs, and verify fresh output files.
Mesh/export validation still matters: a successful process is not visual proof.

**B. gex44 exec service** (`/opt/astra-blender/blender_exec_server.py`,
loopback `:8793`, token-guarded): POST a python script, get back stdout plus
render paths, for interactive iteration without a subprocess per call. Same
headless constraint — the script is a `blender_main`-shaped body, no GUI code.

Outputs land in the app's `public/models/` (or the GameKit pack's asset dir)
as `.glb` + `.webp`. Draft render: 64 samples / 1280x720 ≈ 2 s on an M-series
GPU (source game, Apple Silicon) — **gex44/RTX 4000 Ada timing is
unmeasured; get one real number before quoting a render budget.**

## 3. Modelling: loft, recess, greeble

Three techniques, in order of impact.

**Loft cross-sections, never stack primitives.**
```python
def oct_ring(w, h, cx, cz):
    a, b = w * 0.5, h * 0.5
    return [( a, b-cz), ( a-cx,  b), (-(a-cx),  b), (-a,  b-cz),
            (-a, -(b-cz)), (-(a-cx), -b), ( a-cx, -b), ( a, -(b-cz))]

def loft(name, sections, mat):    # sections: (y, w, h, cx, cz, dz)
    bm = bmesh.new()
    rings = [[bm.verts.new((x, y, z+dz)) for (x, z) in oct_ring(w, h, cx, cz)]
             for (y, w, h, cx, cz, dz) in sections]
    for A, B in zip(rings, rings[1:]):
        for i in range(8):
            j = (i+1) % 8
            bm.faces.new((A[i], A[j], B[j], B[i]))
    bm.faces.new(list(reversed(rings[0]))); bm.faces.new(rings[-1])
```
Keep the profile **stepped, not tapered** — a parallel midbody, a shoulder, a
blunt end. Steps are what the eye measures scale against.

**Cut detail into the skin**, not glued on top:
```python
sel = [f for f in bm.faces if pick(f)]
bmesh.ops.inset_region(bm, faces=sel, thickness=1.2, depth=0.0,
                       use_even_offset=True, use_boundary=True)
for f in sel:
    bmesh.ops.translate(bm, verts=list(f.verts), vec=f.normal.normalized()*-0.7)
    f.material_index = i_recess
```

**Detail hierarchy, including restraint.** Primary masses, panel bays, fine
greebles at roughly **1/60 of the asset's longest dimension**. Zone them and
**leave clean plate** — greebling every face reads as noise; detail only
registers against something undetailed. Flat-shade hard surfaces.

**A Bevel modifier does nothing on face-soup geometry** — bmesh ops emit
every face with fresh vertices, no shared edges to bevel. Weld first, then
chamfer:
```python
def weld_bevel(ob, width=0.0025, segments=2, angle=math.radians(31), dist=2e-5):
    me = ob.data
    bm = bmesh.new(); bm.from_mesh(me)
    bmesh.ops.remove_doubles(bm, verts=bm.verts, dist=dist)   # joins coincident boxes
    bm.to_mesh(me); bm.free(); me.update()
    apply_bevel(ob, width=width, segments=segments, angle=angle)
```
A 90-degree edge returns no highlight from any light — the single largest
thing separating "modelled" from "a pile of boxes". `o.scale = size` then
Bevel makes pillows (Bevel is local-space) — `transform_apply(scale=True)`
before bevelling.

## 4. Kit-bake pipeline (interior_bake/ distilled)

For a repeated kit (a corridor, a room set, a prop family), stage the build
so nothing bakes twice and occlusion bakes into the placement it ships in:

1. **Tile geo** — hi-poly tile (plates, rivets, hatches) as a **3x3 array**
   so only the centre tile bakes and its edges see real neighbours (no
   cross-fade). Panel tile 2.0 m, deck tile 1.5 m in the source kit.
2. **Tile bake** — bake **height by ray-tracing an Emission shader whose
   colour is world-Z**, not a tangent-space NORMAL bake off a flat cage: a
   vertical panel-gap wall has no cross-section for a downward ray, so a
   NORMAL bake off a plane records nothing for it. Height + a prefilter gives
   both the seams and a slope a texel wide.
   ```python
   sc.render.bake.use_selected_to_active = True   # hi -> flat lo plane
   sc.render.bake.cage_extrusion = 0.05
   ```
3. **Compose** (numpy) — prefiltered normal from height (clamp depth *before*
   differentiating: an undamped 26 mm slot over two texels is a normal lying
   flat, rendering as a crawling black slit); crown/cavity masks drive wear
   and grime; procedural stencils (part numbers, hazard stripes) into albedo.
4. **Kit** — parametric part builders on a shared profile/loft/box library
   (`Part`-style primitives, per-edge bevel, a material "slot" tag).
5. **Props / assemble** — instantiate every master once, `weld_bevel` each
   with a **hand-tuned width per part class** (finer on small props — a
   2.5 mm round-over eats a 6 mm book board), lay the kit out at its in-game
   transforms *before* baking so occlusion matches what ships.
6. **UV + AO bake**:
   ```python
   def unwrap_and_pack(masters, res=2048):
       for ob in masters.values():   # per-object smart UV project, then:
           ...
       bpy.ops.uv.average_islands_scale()
       bpy.ops.uv.pack_islands(margin=0.006, rotate=True)

   def bake_kit_ao(masters, occ, res=2048, dist=1.5, samples=128):
       sc.cycles.samples = samples
       # AO node -> Emission -> Material Output, per material, bake EMIT
   ```
   **AO bakes along the surface normal — wind kit-hull skin facing INTO the
   room**, or it bakes unoccluded everywhere (open space). **Floor-lift the
   result** — occlusion is a modulation, not a shadow; anything reaching
   pure 0 paints a black line lighting can never recover
   (`a2 = 0.34 + 0.66*a**0.85`).
7. **Clay check** before any texture or bake is trusted (§10).

**Texel density**: panel shipped 2048 px / 2.0 m = **1024 px/m**; deck
1024 px / 1.5 m = **683 px/m**; the interior kit's UV/AO atlas ran at
**4096 px** (the bake function's own default is 2048 — override per project,
don't trust a library default). Pick texel density from viewing distance: a
corridor the player's shoulder passes within 40 cm of needs more than a
ceiling never seen close.

## 5. Rocks and foliage

**Rocks** (`build_rocks.py`): carve, don't deform a sphere — a deformed
icosphere is convex-ish every time (the "potatoes" problem). Instead: dense
icosphere → `bmesh.ops.bisect_plane(..., clear_outer=True)` several times for
fracture faces (family-dependent: slab/block/boulder/column/shard) → smaller
bisects near corners for chips → two octaves of `mathutils.noise.noise`
displacement along the normal → `REMESH` (voxel) to heal cuts into one
manifold → `DECIMATE` to a triangle budget → `shade_smooth_by_angle` so
fracture edges stay sharp → bake AO to a `BYTE_COLOR` vertex attribute
(spread instances apart *before* baking — stacked at the origin they occlude
each other into a mean of 0.2) → normalise so the longest axis is 1 and the
low point sits at 0. Ship **8-11 variants across 3 LODs** (full, ~500 tri,
~160 tri) in one GLB, `export_vertex_color='ACTIVE'`, no materials — AO rides
in `COLOR_0`, the shader supplies the surface.

**Foliage** (`pack_leaf.py`): pack an image-model leaf-cluster cutout (RGBA,
transparent bg) into a 512x512 lossless atlas. Normalise each RGB channel's
mean over opaque pixels to 0.5, so the image contributes *variation about the
palette* rather than its own green. Dilate outward into the transparent
margin — bilinear alpha filtering averages the last opaque texel with its
transparent neighbour, and a black neighbour puts a dark fringe on every
edge. Ten dilation passes covers a 512-texel margin at any mip seen.

## 6. Materials

**Procedural (Cycles-only, geometry-driven):** per-plate tonal variation +
pointiness edge wear, the two nodes that make paint look built:
```python
vor = nt.nodes.new("ShaderNodeTexVoronoi"); vor.inputs["Scale"].default_value = 0.16
# RGBToBW -> MapRange 0.9-1.1 -> Multiply into base colour: plate batches
# never quite match, and that mismatch is most of what reads as "welded".
geo = nt.nodes.new("ShaderNodeNewGeometry")
pr = nt.nodes.new("ShaderNodeMapRange")   # From 0.49-0.56, clamp, -> wear factor
nt.links.new(geo.outputs["Pointiness"], pr.inputs["Value"])
# mix toward bare metal + drive Metallic up: free on every convex corner,
# exactly where paint goes in life.
```
Also: bleach on sun-facing normals (`dot(Normal, sun_dir)`), soot along an
object-space axis. **These do NOT survive glTF export** — three.js never
sees the node graph. Bake to a texture before export, or export flat base
colours per material bucket and let the app's own shader apply bleach/soot
from world position (what the source game does).

**Image-model derived** (ground, cloth, rock faces): one generated albedo is
the only photographic input, everything else *derived* in numpy so it can't
disagree with it:
- `height_from_albedo` — 3 band-passed luminance scales (fine/mid/coarse),
  weighted toward the middle — "dark is deep" is the prior every
  albedo-to-normal tool uses and it holds for ground.
- `normal_from_height` — central difference of the height field.
- `ao_from_height` — horizon-based, 16 directions, cone-stepped march.
- `roughness_heuristic` — dust in cavities (rough), exposed faces polish
  (less rough), clamped to an art-direction matte floor.
- **Seam fix in the gradient domain**, not by blending pixel values: take the
  gradient, force it periodic across the wrap by killing the seam's jump
  over a margin of a few px (weight ramps 0→1 away from the seam), then
  FFT-Poisson-integrate back. Mismatch lands in the lowest-frequency mode
  (an invisible ramp) instead of a visible strip at the border — a wide
  margin instead draws bright bars through the derived occlusion.

An image model asked to paint colour onto a rendered height map **redraws
the geometry** (measured: same style, every stone somewhere else). Asked to
*colourise* a flat, shading-free render of the SAME image, it keeps every
stone in place — colourise, don't paint-over, when height must register to
albedo.

## 7. Lighting and camera

**Void/hero lighting**: one hard key (`SUN`, angle ≈ 0.9°), a large weak
fill tinted toward the key's complement, a cold rim so nothing dissolves
into the background. Shadows never fully black. **Camera on the key side** —
a hero angle from the shadow side is carried by fill and reads washed out.

**Clay/QA lighting** (three `SUN`s: key, rim, bounce from below) — the
bounce matters because half of any interior's surfaces face down (an
overhead console, a coaming's underside) and key+rim alone renders them as
unreadable black.

**Camera from the bounding box, never by hand** — hand-placed cameras end up
inside geometry, costing **80x render time** (near-field bounces: 166 s vs
2 s measured):
```python
pts = [o.matrix_world @ Vector(c) for o in meshes for c in o.bound_box]
lo = Vector((min(p[i] for p in pts) for i in range(3)))
hi = Vector((max(p[i] for p in pts) for i in range(3)))
ctr = (lo + hi) / 2; rad = max((p - ctr).length for p in pts)
cam.location = ctr + direction * (rad / math.tan(cam.data.angle / 2) * 1.05)
cam.rotation_euler = (ctr - cam.location).to_track_quat("-Z", "Y").to_euler()
```
`to_track_quat` assumes Z-up world; if the asset is authored Y-up inside
Blender's Z-up slots, build the look-at basis by hand (cross products off
the target vector and the game's own up axis) or every render is on its side.

**Voronoi stars, never thresholded noise** — noise can't separate density
from size (raise frequency to shrink points → thousands; widen the band to
brighten → falling snow). Voronoi: cell scale = how many, distance threshold
= how big. Cells over a sphere ≈ `4π·scale²`, a frame sees under 1% of it, so
`scale=30` puts ~15 cells in shot — use `scale ≈ 110`. Angular radius =
`threshold / scale`; move both together.

**Backdrop geometry must be camera-visible only.** A large emissive shell
(planet, skybox) hit by diffuse/glossy rays becomes an area light every
shading point importance-samples — measured **145 s → 4.3 s**:
```python
for o in (planet, atmo):
    o.visible_diffuse = o.visible_glossy = o.visible_transmission = False
    o.visible_volume_scatter = o.visible_shadow = False
```

## 8. Export contract for three.js

- **Join per material within each rigid assembly before export.** Keep moving
  doors/drawers, their attachment groups and required named parts separate;
  never merge them into the static carcass just because they share paint.
  One Blender object = one glTF node =
  one draw call. A loose 11-material ship export was 78 draws;
  `bpy.ops.object.join()` per material group brought it to ~11.
- **Metres, Y-up**: `bpy.ops.export_scene.gltf(export_format='GLB',
  use_selection=True, export_apply=True, export_yup=True)`. (The source game
  exports `export_yup=False` because its own runtime is Y-up-in-Blender's-
  Z-up-slots by convention — a plain three.js consumer wants `export_yup=True`.)
- **Flat base colours or baked textures only** — procedural nodes don't
  survive the round trip (§6). `KHR_materials_emissive_strength` DOES
  survive — nav lights, emissive panels keep authored intensity.
- **Draco for real triangle counts**: position 14-bit quantization is ~1 mm
  over a 16 m interior (a tenth of the smallest chamfer), normal 10-bit,
  texcoord 12-bit, compression level 6.
- **WebP out of Blender directly is lossless regardless of the quality
  argument** — its own quality slider is silently ignored. PNG-dump from
  Blender, encode to WebP with PIL on the host if you need real lossy quality.
- **Check draw calls after adding anything** — a duplicated kit piece is one
  draw call against a shared mesh no matter how many times placed; a fresh
  join is not.

## 8b. Destructible vehicles (tank-damage/v1, 11 Oct 2026)

22 library tanks were made destructible by Astra-directed Blender jobs; the contract and pipeline live in forge-assets
`TANK-DAMAGE.md` (job writer `tools/vehicles/make_jobs_tanks2.py`, retrofit `make_jobs_tanks_retrofit.py`).
- TWO GLBs in the same frame: A = healthy, every bolt-on item its own `Part_<Name>` node (complete surface underneath, origin
  at its centre), `Barrel` child of `Gun`, `Muzzle` child of `Barrel` (identity rotation), `Fx_*` empties; B = damage only:
  `Hull_Damage` (`Dmg_` twins at their Part origins, `Scar_<face>` hit marks 2-4 mm proud, `Track_L/R_Broken`),
  `Turret_Damage` at the Turret origin (`Dmg_Turret_*`, `Scar_Turret_*`, `Gun_Broken` at the Gun origin), `Wreck_Hull`
  (material `Burnt`), `Wreck_Turret` with a closed underside. One file would draw wreck + healthy together (no hidden flag in glTF).
- Build the damage from COPIES of the healthy meshes (deform, cut, boolean, decimate) so everything lines up; the job renders
  `states.png` (healthy, hit, stripped, immobilised, wreck, turret off) from the two exported GLBs and looks at it.
- Retrofit an existing model from its previous build script + GLB + baked textures (copy them into a NEW remote dir): the
  offsets stay, so games aim the same way. Check the Muzzle position afterwards (the old Sherman's pointed backwards).
- Six to eight jobs at once worked (healthy file in 10-30 min, damage by ~60, 47-60 min in all; GPU gate on gex44).
  Each writes 50-105 MB into `~/.codex/sessions`: watch the local disk.
- A library card version is immutable: the importer refuses a version that belongs to another job.
- In game the model wants the runtime skin (FGE `module/vehicle-skin.mjs`, the JUGGERNAUT technique) on top of its bake.

## 9. Traps

- Bevel on bmesh-authored geometry does nothing (no shared edges) — weld
  first (§3). `o.scale` then Bevel makes pillows — apply scale first.
- `matrix_parent_inverse = parent.matrix_world.inverted()` cancels the
  parent transform (the "keep transform" idiom). Leave it at identity for
  the child to inherit the parent's rotation.
- A rotation about the wrong axis silently does nothing visible — a panel
  whose normal is +X doesn't change facing when rotated about X. Measure the
  world normal against the view vector rather than reasoning about it.
- Map Range with `To Min > To Max` and clamp on collapses to zero (clamps to
  an inverted interval) — invert with a `SUBTRACT` node instead.
- A Mix node in RGBA mode can silently drop a branch — several sockets share
  the name "Factor". Combine world contributions with two `Background` nodes
  into an `Add Shader` instead.
- The image preview downsamples — 4-px stars average away in a 1080p
  preview. Crop 1:1 and count bright pixels before concluding nothing rendered.
- A tangent-space NORMAL bake off a flat plane records nothing for vertical
  geometry — bake height by ray-traced Emission instead (§4).
- AO bakes along the surface normal — a kit skin wound facing away from the
  room bakes unoccluded everywhere.
- An AO map reaching pure black paints an unrecoverable dark line —
  floor-lift it (§4).
- Blender's WebP writer ignores its own quality setting, always lossless —
  PNG-dump and re-encode on the host (§8).
- Blender exits 0 even when the driven script raised — check stderr and the
  output file, not the return code (§2).
- A socket/exec service keeps Blender's *process* environment between calls
  — a default from a stale env var silently sends output into the wrong
  checkout. Assign output paths explicitly every call, never `setdefault`.

**Blender 5.x API changes** (4.x code fails on all of these):
- `Scene.node_tree` gone → `Scene.compositing_node_group`;
  `CompositorNodeComposite` no longer exists — the group's output socket IS
  the result.
- **The compositing group must contain a `CompositorNodeRLayers`.** Feeding
  it only from a Group Input means nothing depends on the render, so Blender
  skips rendering and writes a transparent black frame in 0.1 s. A
  suspiciously fast render is this bug.
- `Action.fcurves` is gone (slotted actions). Set
  `context.preferences.edit.keyframe_new_interpolation_type` *before*
  inserting keys.
- Glare/Lensdist settings moved from properties onto **sockets**; enums take
  display names (`"Fog Glow"`, `"Streaks"`, `"High"`), not old identifiers.
- Legacy addons still install to `~/Library/.../Blender/<ver>/scripts/addons/`
  on macOS — irrelevant on gex44, relevant for local proving.

## 10. Gates (measurable, not "looks right")

- **Independent export audit**: run
  `python3 scripts/audit_glb.py /absolute/path/asset.glb --strict` from this skill
  directory (requires numpy). It reports mesh-local triangles, nonfinite values,
  degenerate triangles, material groups and texture portability. Exit 1 means
  findings; exit 2 means invalid/unsupported input, never a clean bill of health.
  Audit uncompressed output before Draco/meshopt and inspect the compressed
  consumer separately. It does not validate winding, source solids, intersections,
  node-transformed placement, runtime draw calls or gameplay. Keep source meshes
  for topology/volume inspection; check transformed instance bounds in-game.
  The harbour correction's own empty issues list missed 16 zero-area triangles.

- **Rigged-asset rejection gates** (block the asset before it reaches a build; each one is a
  known failure class):
  - a character MAIN model still contains swappable gear (gear is separate parts on sockets);
  - action/animation files carry duplicate render meshes;
  - skeletons or bone names differ across actions of the same character;
  - a required role, socket (`target`, `ground`, `vfx-hit`, `vfx-death`, `attack-*`), collider,
    equipment-slot declaration or provenance field is absent;
  - toggling gear leaves visible fragments or holes without a declared underlayer boundary;
  - an attack animation has no authoritative timing and collision contract (see
    `_game-kit/core/ENEMY-CONTRACT.md`);
  - status language is truthful: `catalog-only` (recorded), `review-only` (inspector exists),
    `runtime` (gameplay loads it). Only `runtime` counts as shipped.
  Mechanical half: `audit_glb.py --rig --require-sockets target,ground,vfx-hit,vfx-death` reports
  skins, joint names, duplicate primitives (identical geometry buffers) and missing named nodes.
  Design after MengTo/Skills build-rigged-game-assets requirements (MIT); the human half stays a
  checklist.
- **Tone stats**: percentile clipping, e.g. "0.00% of pixels clip and the
  99th percentile is 165" — actionable; "looks flat" is not.
- **Contact sheets**: render every set-piece/angle into one grid image,
  judge the set at once rather than one screenshot at a time.
- **Clay check before any bake is trusted**: flat grey, hard key + rim +
  bounce, no textures, no emissives. A silhouette reading as a rectangle or
  an edge reading as infinitely sharp means the model isn't finished —
  textures and lighting hide box-stacking completely, flat clay does not.
- **Re-verify the capture isn't stale**: if the render/dev surface can
  hot-reload mid-capture, re-check the expected state is actually showing
  before saving, restart if not — a loading-state screenshot with a
  plausible number next to it is a silent false pass.
- **Draw-call and fps survey** after adding any asset: report draw count
  against the pre-change baseline (join-per-material should hold it flat)
  and frame time on the heaviest scene the asset appears in.
- **AO sanity**: print the raw bake's percentile spread (1st/10th/50th/90th)
  before floor-lifting — `min == 0` over a large area means winding or
  distance is wrong, not that floor-lift will fix it.
- Numbers not yet measured on gex44/RTX 4000 Ada (draft/final render time,
  bake time for a 4096 atlas): **unmeasured** — get one real run's numbers
  before writing them into a plan or a budget.

## Attribution

Distilled from TheLongSilence (MIT License, Copyright (c) 2026 Anshu
Chimala). Runnable reference code copied under the same license into
`reference/` — see `reference/INDEX.md`.

`reference/high-to-low-baking.md`, `baking-and-diagnostics.md`, `asset-delivery.md`,
`preflight-and-recovery.md` and `runtime-parity-and-diagnostics.md` are ported from
vercel-labs/vgpu `skills/vgpu/blender/references/` at commit 68cb1d8d198c (MIT License,
Copyright (c) 2025 Vercel, Inc.), adapted from vgpu/WebGPU to the three.js runtime.
`reference/critic-loop.md` is distilled from the same repository's asset agent flow.

hook: PreToolUse
hook: PreToolUse Completed
codex
I’m using the Blender game assets skill. The reference’s defining features are its deep wedge hull, narrow raised cockpit, broad shoulders, and three closely packed engines. I’ll build those proportions first, then add armour seams, vents, weapon mounts, and surface wear.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
mcp: forge/memory_search started
hook: PreToolUse Completed
mcp: forge/coord_check started
hook: PreToolUse Completed
mcp: forge/coord_check started
hook: PreToolUse Completed
mcp: forge/skills_get started
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
mcp: forge/memory_search (completed)
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'for p in /home/claude-agent/forge-build/AGENTS.md /home/claude-agent/forge-build/forge-assets/AGENTS.md /home/claude-agent/forge-build/forge-assets/jobs/AGENTS.md; do if test -f "$p"; then cat "$p"; fi; done
cat /home/claude-agent/.agents/skills/blender-game-assets/reference/preflight-and-recovery.md
cat /home/claude-agent/.agents/skills/blender-game-assets/reference/critic-loop.md' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
<!-- Ported from vercel-labs/vgpu skills/vgpu/blender/references/preflight-and-recovery.md at commit 68cb1d8d198c (MIT, Copyright (c) 2025 Vercel, Inc.). Adapted for Forge: three.js runtime instead of vgpu/WebGPU, links rerouted. Upstream text otherwise kept so a re-sync stays diffable. -->

# Preflight and Recovery

Use this workflow for long bakes and scripted asset delivery. Keep a short manual edit lightweight; add checkpoints where repeating expensive work or confusing stale output is a real risk. These are asset execution requirements, independent of how many people or agents perform the work.

## Exercise the actual execution path first

Before an expensive run, provide and run a task-local preflight command using the same executable, working directory, dependency environment and helper paths as the intended run. Reuse existing project checks where possible. A version query or import from another directory is not an execution probe.

- Start native Blender (gex44 path and GPU gate wrapper: `SKILL.md` §2) and execute a minimal scene operation through Python. For scripted runs, use `--python-exit-code 1`; inspect logs and the expected output, not exit status alone.
- Exercise the chosen render/bake device with a tiny representative bake, then export, encode/decode and import a small fixture through the actual exporter and runtime loader. Await codec initialization. Resolve copied Node helpers from their real execution directory and module mode; a successful ESM import does not establish that a copied CommonJS helper can resolve its dependencies.
- Classify required and optional inputs before baking. Verify required files, codecs, writable output paths and capture dependencies. Missing optional metadata must have a documented fallback or be omitted deliberately, not fail final assembly after a completed bake.
- Capture and read one real target-renderer frame with the intended browser/image tools. Record the actual backend; a fallback renderer does not validate the requested backend. This probe establishes that the tools work, not final visual quality.

If a probe fails, fix or report that boundary before starting dependent expensive work. Do not keep retrying the unchanged failure. If sources may change during a run, execute an immutable snapshot including local imports; record external dependencies and verify snapshot hashes at completion.

## Keep stages independently recoverable

Give expensive stages explicit commands, inputs, outputs and validation. A task-local script may expose subcommands or separate entry points; no particular build framework is required. Do not force a bake when that asset does not need one.

| Stage | Evidence needed before its outputs can be reused |
| --- | --- |
| Prepare | Saved source/LOW checkpoint, resolved transforms and reproducible parameters |
| Validate geometry | Openings, contacts, normals and UV checks on evaluated/exported LOW; simple-material views, including relevant LODs |
| Bake | Lossless masters, actual pass settings and dependency identities, coverage and representative pixel checks |
| Export | Decodable serialized meshes, map/UV bindings and measured counts; reconcile exporter changes with prepared geometry |
| Package | Required files, decoded texture error, channels/mips and delivery manifest with hashes |
| Verify runtime | Actual target-backend captures from matched cameras, independent map toggles, measured costs and renderer errors |

For each attempt, save the exact command, input/dependency hashes, tool identities, exit outcome, output hashes, validation results and failure reason. Mark a stage complete only after its outputs pass its checks. Keep failed attempts and logs distinct from completed checkpoints. File existence or a successful process alone is not proof of completion.

On retry, start at the earliest invalid stage and revalidate dependent outputs. If packaging fails after a verified bake/export, resume packaging from those artifacts; do not regenerate the scene merely to rerun a copy step. When geometry, normals or lighting change, use the [bake dependency rules](baking-and-diagnostics.md#reuse-bakes-by-their-dependencies) to decide which passes need new identities.

## Validate a candidate before replacing delivery assets

Keep candidate assets separate from the last working delivery. Verify the candidate manifest and served build/asset identities before capture; avoid a preview that silently loads missing files from the old asset set. Promote only the validated files together with their matching manifest, retain a recoverable previous version, and smoke-check the delivered URL after replacement. Report whether the replacement is atomic; per-file writes do not make the whole asset set atomic.

Checks establish structural and runtime evidence, not aesthetic acceptance. Pair them with the matched visual review in [the critic loop](critic-loop.md) and the gates in `SKILL.md` §10.
<!-- Distilled from vercel-labs/vgpu .claude/skills/vgpu-agent-flow/references/asset-iteration.md and
.subharness/agents/asset-author.ts + asset-critic.ts at commit 68cb1d8d198c (MIT, Copyright (c) 2025 Vercel, Inc.),
rewritten for Forge lanes (forge-agent, Astra author, a second model family as critic). -->

# Author and critic loop for a Blender asset

Use this for any authored asset that will be judged by eye: a hero prop, a character, a building, an
environment. Skip it for a mechanical re-export.

## Seats

| Seat | Who | Owns |
| --- | --- | --- |
| Author | Astra (operator law: Blender work goes to Astra) | Geometry, authored materials, UVs, bakes, Blender renders, the export |
| Runtime | The root, or one worker when the shader work is real | Loading the export in the game's actual three.js path, captures, measured costs |
| Critic | A different model family from the author, reading the real images | Findings only. Never edits the asset |

The critic must open the actual capture files. A critic that cannot read images says so and returns
BLOCKED; it never writes a visual verdict from metrics or from the author's description.

## Budget

- Default: **3 revisions, at most 2 critic passes per revision.** The brief may set another cap.
- A cap is an execution limit, not acceptance. Cap reached with open visual findings = `REVISE`
  reported as such, never a `PASS`.
- No unattended improvement loop past the cap.

## Before the first render

Write in the task folder: scope, target cameras (gameplay view, hero, rear, closest required view),
output paths, budgets (triangles, exported vertices, texture bytes and GPU memory, draw calls) and
the revision cap. Budgets are task inputs; do not copy another asset's numbers.

Run the [preflight](preflight-and-recovery.md) once: Blender starts and runs a scene operation, a
tiny bake and export round-trips through the real loader, one real runtime frame is captured.

Integrate a cheap LOW blockout in the runtime at this stage. Scale, axis, camera and material
contract problems are found before an expensive bake, not after.

## Each revision keeps

- the source revision or parameters that rebuild the previous asset;
- real hero, rear and close-up captures, same camera, light, exposure and pose every time;
- triangles, exported vertices, primitives, material count, file bytes, texture GPU memory;
- runtime draw counters, kept apart from offline estimates;
- the critic's findings, the fixes chosen, and the next measured result.

## The critic pass

The critic receives the previous AND the current captures and metrics under matched cameras (or
an explicit "first revision, no baseline"), the reference image, and the brief. It returns:

- **at most five findings**, ordered by impact, each with a stable id, the evidence path (whole
  view plus crop or image coordinates), the visible symptom, a suggested correction and a
  **measurable acceptance condition**;
- regressions against the previous revision;
- resolved / remaining / regressed status of earlier findings on a follow-up pass;
- `PASS`, `REVISE` or `BLOCKED`, with the limits of its evidence.

It compares against the reference as well as the previous revision: clean topology and progress
since last time do not make the asset match the reference. It separates the observed defect from
the suspected cause. A small whole-image difference can hide severe local damage (thin trim,
stairs, silhouette edges): it inspects crops at each delivered LOD. Design ideas are suggestions,
not new acceptance requirements.

When the cause could be the asset or the renderer, it asks for the diagnostic captures in
[runtime parity](runtime-parity-and-diagnostics.md) (maps off, AO neutral, lightmap off) rather
than guessing.

## Rules that stop false passes

- A generated concept image is never proof of a working model. Label concepts as concepts; accept
  only on real renders of the real export.
- Requested bakes need bake provenance (what was baked, from what, at what settings) and matched
  runtime captures with each contribution switched off in turn. Vertex tint and runtime shadows
  are not substitutes for a requested AO or lightmap bake.
- An atlas repair is checked on the full matched views, not only on the crop that was broken: a new
  layout can fix one edge and turn another face black.
- One writer per handoff file. A reply never gets appended to a request file another agent will
  regenerate. Superseded manifests and failed captures stay on disk.
- The author hands the root a compact result: verdict, the few decisive images, the metrics table.
  Full capture sets stay on disk; the root does not load every image.
- A user's rejection or a changed brief reopens any earlier `PASS`.

## Lessons

When a revision teaches something that will recur, write it as: evidence path, symptom, cause,
intervention, matched before/after result, scope. The root checks it and makes a narrow edit to this
skill. Reject task-specific style preferences dressed up as general rules.

mcp: forge/coord_check (completed)
mcp: forge/coord_check (completed)
mcp: forge/skills_get (completed)
exec
/bin/bash -lc "ssh gex44 'pgrep -af blender | head -10; nvidia-smi --query-gpu=name,memory.free --format=csv,noheader'
ls -la
python3 - <<'PY'
import urllib.request,json
j=json.load(urllib.request.urlopen('https://api.polyhaven.com/assets?t=textures'))
for k,v in j.items():
 if any(w in k for w in ['metal','painted','steel']): print(k, v.get('name'))
PY" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 exited 1 in 821ms:
18867 python3 /opt/astra-blender/blender_exec_server.py
18880 python3 /opt/astra-blender/blender_exec_server.py
40540 bash -c cd /root/room-fit-pack/prop-lane && while pgrep -f blender >/dev/null 2>&1; do sleep 5; done; echo BLENDER_DONE; cat optimize_run7.log
87189 bash -c cd /root/room-fit-pack/prop-lane && while pgrep -f blender >/dev/null 2>&1; do sleep 4; done; echo BLENDER_DONE; cat optimize_run8.log
3806698 bash -c pgrep -af blender | head -10; nvidia-smi --query-gpu=name,memory.free --format=csv,noheader
3939376 python3 /opt/astra-blender/blender_exec_server.py
NVIDIA RTX 4000 SFF Ada Generation, 13930 MiB
total 736
drwxrwxr-x  2 claude-agent claude-agent   4096 Oct 16 18:40 .
drwxrwxr-x 78 claude-agent claude-agent   4096 Oct 16 18:33 ..
-rw-rw-r--  1 claude-agent claude-agent   7084 Oct 16 18:40 PROMPT.txt
-rw-rw-r--  1 claude-agent claude-agent  89619 Oct 16 18:41 astra.log
-rw-rw-r--  1 claude-agent claude-agent   4751 Oct 16 18:37 job.json
-rw-rw-r--  1 claude-agent claude-agent 630163 Oct 16 18:34 sheet.jpg
-rw-rw-r--  1 claude-agent claude-agent    935 Oct 16 18:37 sheet_prompt.txt
-rw-rw-r--  1 claude-agent claude-agent     21 Oct 16 18:40 started.txt
Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/usr/lib/python3.12/urllib/request.py", line 215, in urlopen
    return opener.open(url, data, timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 521, in open
    response = meth(req, response)
               ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 630, in http_response
    response = self.parent.error(
               ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 559, in error
    return self._call_chain(*args)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 492, in _call_chain
    result = func(*args)
             ^^^^^^^^^^^
  File "/usr/lib/python3.12/urllib/request.py", line 639, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

hook: PreToolUse
hook: PreToolUse Completed
mcp: forge/coord_claim started
mcp: forge/coord_claim (completed)
hook: PreToolUse
hook: PreToolUse Completed
mcp: forge/coord_claim started
mcp: forge/coord_claim (completed)
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "ssh gex44 mkdir -p /root/fal-author/heavy-bomber-opera-v1
curl -L -A 'ForgeAssetBuilder/1.0' -s 'https://api.polyhaven.com/assets?t=textures' -o /tmp/heavy-bomber-polyhaven.json
python3 - <<'PY'
import json
try:
 j=json.load(open('/tmp/heavy-bomber-polyhaven.json'))
 for k,v in j.items():
  if any(w in k for w in ['metal','painted','steel']): print(k,v.get('name'))
except Exception as e: print(type(e).__name__)
PY" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 1627ms:
black_painted_planks Black Painted Planks
blue_metal_plate Blue Metal Plate
blue_painted_planks Blue Painted Planks
box_profile_metal_sheet Box Profile Metal Sheet
concrete_floor_painted Concrete Floor Painted
distressed_painted_planks Distressed Painted Planks
green_metal_rust Green Metal Rust
metal_grate_rusty Metal Grate Rusty
metal_plate Metal Plate
metal_plate_02 Metal Plate 02
painted_brick Painted Brick
painted_concrete Painted Concrete
painted_concrete_02 Painted Concrete 02
painted_metal_shutter Painted Metal Shutter
painted_plaster_wall Painted Plaster Wall
painted_worn_brick Painted Worn Brick
peeling_painted_wall Peeling Painted Wall
rusty_metal Rusty Metal
rusty_metal_02 Rusty Metal 02
rusty_metal_03 Rusty Metal 03
rusty_metal_04 Rusty Metal 04
rusty_metal_05 Rusty Metal 05
rusty_metal_grid Rusty Metal Grid
rusty_metal_sheet Rusty Metal Sheet
rusty_metal_shutter Rusty Metal Shutter
rusty_painted_metal Rusty Painted Metal

codex
I’ve mapped out the hull, cockpit, wing roots, and engine arrangement from the sheet. I’m keeping the paint surface neutral beneath its colour factor so the six faction colours can share the same baked textures without recolouring the weapons, glass, or exposed metal.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "cat > /tmp/heavy-bomber-preflight.py <<'PY'
import bpy, os
from mathutils import Vector
bpy.ops.object.select_all(action='SELECT'); bpy.ops.object.delete(use_global=False)
s=bpy.context.scene; s.render.engine='CYCLES'; s.cycles.samples=4
p=bpy.context.preferences.addons['cycles'].preferences
p.compute_device_type='OPTIX'; p.get_devices()
for d in p.devices:d.use=d.type"'!='"'CPU'
s.cycles.device='GPU'
bpy.ops.mesh.primitive_cube_add(); o=bpy.context.object
m=bpy.data.materials.new('Probe');m.use_nodes=True;o.data.materials.append(m)
i=bpy.data.images.new('ProbeBake',32,32);n=m.node_tree.nodes.new('ShaderNodeTexImage');n.image=i;m.node_tree.nodes.active=n
bpy.ops.object.bake(type='DIFFUSE',pass_filter={'COLOR'})
bpy.ops.export_scene.gltf(filepath='/root/fal-author/heavy-bomber-opera-v1/probe.glb',export_format='GLB',use_selection=True)
bpy.ops.object.select_all(action='SELECT');bpy.ops.object.delete(use_global=False)
bpy.ops.import_scene.gltf(filepath='/root/fal-author/heavy-bomber-opera-v1/probe.glb')
assert len([o for o in s.objects if o.type=='MESH'])==1
print('PREFLIGHT_OK',[(d.name,d.type,d.use) for d in p.devices])
PY
scp /tmp/heavy-bomber-preflight.py gex44:/root/fal-author/heavy-bomber-opera-v1/preflight.py
ssh gex44 '/root/blender-spike/blender-5.2.0-linux-x64/blender -b --python-exit-code 1 --python /root/fal-author/heavy-bomber-opera-v1/preflight.py' > /tmp/heavy-bomber-preflight.log 2>&1" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "mkdir -p textures
curl -fL -s -A 'ForgeAssetBuilder/1.0' https://dl.polyhaven.org/file/ph-assets/Textures/jpg/1k/metal_plate/metal_plate_diff_1k.jpg -o textures/metal_plate_diff_1k.jpg
curl -fL -s -A 'ForgeAssetBuilder/1.0' https://dl.polyhaven.org/file/ph-assets/Textures/jpg/1k/metal_plate/metal_plate_nor_gl_1k.jpg -o textures/metal_plate_nor_gl_1k.jpg
curl -fL -s -A 'ForgeAssetBuilder/1.0' https://dl.polyhaven.org/file/ph-assets/Textures/jpg/1k/metal_plate/metal_plate_arm_1k.jpg -o textures/metal_plate_arm_1k.jpg
curl -fL -s -A 'ForgeAssetBuilder/1.0' https://dl.polyhaven.org/file/ph-assets/Textures/jpg/1k/blue_metal_plate/blue_metal_plate_diff_1k.jpg -o textures/blue_metal_plate_diff_1k.jpg
curl -fL -s -A 'ForgeAssetBuilder/1.0' https://dl.polyhaven.org/file/ph-assets/Textures/jpg/1k/blue_metal_plate/blue_metal_plate_nor_gl_1k.jpg -o textures/blue_metal_plate_nor_gl_1k.jpg
curl -fL -s -A 'ForgeAssetBuilder/1.0' https://dl.polyhaven.org/file/ph-assets/Textures/jpg/1k/blue_metal_plate/blue_metal_plate_arm_1k.jpg -o textures/blue_metal_plate_arm_1k.jpg" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 693ms:
 succeeded in 2287ms:
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'tail -8 /tmp/heavy-bomber-preflight.log
ls -lh textures' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
20:42:31 | INFO: Finished glTF 2.0 export in 0.005356311798095703 s

20:42:31 | INFO: Data are loaded, start creating Blender stuff
20:42:31 | INFO: Blender create Mesh node Cube.001
20:42:31 | INFO: glTF import finished in 0.00s
PREFLIGHT_OK [('NVIDIA RTX 4000 SFF Ada Generation', 'CUDA', True), ('13th Gen Intel Core i5-13500', 'CPU', False), ('NVIDIA RTX 4000 SFF Ada Generation', 'OPTIX', True)]

Blender quit
total 3.4M
-rw-rw-r-- 1 claude-agent claude-agent 411K Oct 16 18:42 blue_metal_plate_arm_1k.jpg
-rw-rw-r-- 1 claude-agent claude-agent 387K Oct 16 18:42 blue_metal_plate_diff_1k.jpg
-rw-rw-r-- 1 claude-agent claude-agent 233K Oct 16 18:42 blue_metal_plate_nor_gl_1k.jpg
-rw-rw-r-- 1 claude-agent claude-agent 981K Oct 16 18:42 metal_plate_arm_1k.jpg
-rw-rw-r-- 1 claude-agent claude-agent 677K Oct 16 18:42 metal_plate_diff_1k.jpg
-rw-rw-r-- 1 claude-agent claude-agent 753K Oct 16 18:42 metal_plate_nor_gl_1k.jpg

hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "cat > build_heavy-bomber-opera.py <<'PY'
#"'!/usr/bin/env python3
"""Original 24 m assault bomber. Run with Blender 5.2 --background --python-exit-code 1.
Clean build: downloads CC0 inputs, models geometry, bakes Cycles PBR tiles, exports,
renders six liveries and checks pivots. Blender coordinates X left, Y aft, Z up.
Target: 50-110k triangles, <=9 materials, 1024 RGB/normal, 512 ORM, <12 MB.
Views: front hero, side orthographic, rear, underside articulation; 3 revision cap.
"""
import bpy, bmesh, math, os, json, urllib.request, subprocess, struct, random
from mathutils import Vector, Matrix
from pathlib import Path
import numpy as np
ROOT=Path(__file__).resolve().parent
TEX=ROOT/'"'textures'; TEX.mkdir(exist_ok=True)
OUT=ROOT/'baked'; OUT.mkdir(exist_ok=True)
random.seed(37)
bpy.ops.object.select_all(action='SELECT'); bpy.ops.object.delete(use_global=False)
for d in list(bpy.data.materials): bpy.data.materials.remove(d)
S=bpy.context.scene; S.unit_settings.system='METRIC'; S.unit_settings.scale_length=1
S.render.engine='CYCLES'; S.cycles.samples=32; S.cycles.use_denoising=True
P=bpy.context.preferences.addons['cycles'].preferences
P.compute_device_type='OPTIX'; P.get_devices()
for d in P.devices:d.use=(d.type"'!='"'CPU')
S.cycles.device='GPU'; S.cycles.max_bounces=6; S.cycles.transparent_max_bounces=8
S.render.image_settings.file_format='PNG'; S.render.film_transparent=False
S.view_settings.view_transform='AgX'; S.view_settings.look='AgX - Medium High Contrast'
S.render.resolution_percentage=100
GROUPS={}; MATS={}; ASSET=[]; PIVOTS={}
PAINTS=[('Gunmetal',[.20,.22,.24]),('Olive drab',[.23,.26,.14]),('Naval grey',[.38,.44,.49]),('Desert sand',[.52,.40,.23]),('Arctic white',[.75,.80,.83]),('Deep navy',[.035,.075,.135])]

def mat(name,col,metal=0,rough=.45):
 m=bpy.data.materials.new(name);m.use_nodes=True
 p=m.node_tree.nodes.get('Principled BSDF');p.inputs['Base Color'].default_value=(*col,1);p.inputs['Metallic'].default_value=metal;p.inputs['Roughness'].default_value=rough
 m.diffuse_color=(*col,1);MATS[name]=m;return m
paint=mat('Paint',PAINTS[0][1],.64,.4)
alloy=mat('Alloy',(.28,.31,.33),.85,.34)
carbon=mat('Carbon',(.032,.039,.044),.66,.5)
glass=mat('Glass',(.055,.105,.135),.12,.19)
p=glass.node_tree.nodes.get('Principled BSDF');p.inputs['Alpha'].default_value=.42;p.inputs['Transmission Weight'].default_value=.15
if hasattr(glass,'surface_render_method'):glass.surface_render_method='DITHERED'
engines=mat('Engines',(.25,.045,.008),.25,.4)
p=engines.node_tree.nodes.get('Principled BSDF');p.inputs['Emission Color'].default_value=(1,.18,.018,1);p.inputs['Emission Strength'].default_value=2.2
lamps=mat('Lamps',(.3,.5,.6),.1,.32)
# Shared tiny palette: red, green, ice blue, amber. UV positions select colours.
im=bpy.data.images.new('Lamp_palette',width=16,height=4)
cols=[(1,.012,.004,1),(.01,1,.11,1),(.25,.65,1,1),(1,.28,.015,1)]
im.pixels=[v for y in range(4) for x in range(16) for v in cols[x//4]]; im.filepath_raw=str(OUT/'Lamps.png');im.file_format='PNG';im.save()
nt=lamps.node_tree;t=nt.nodes.new('ShaderNodeTexImage');t.image=im;t.interpolation='Closest';p=nt.nodes.get('Principled BSDF');nt.links.new(t.outputs['Color'],p.inputs['Base Color']);nt.links.new(t.outputs['Color'],p.inputs['Emission Color']);p.inputs['Emission Strength'].default_value=2

def mesh(name,verts,faces,material=paint,group='Hull',bevel=0.02,segments=3):
 me=bpy.data.meshes.new(name);me.from_pydata(verts,[],faces);me.update()
 ob=bpy.data.objects.new(name,me);S.collection.objects.link(ob)
 me.materials.append(material)
 bm=bmesh.new();bm.from_mesh(me);bmesh.ops.recalc_face_normals(bm,faces=bm.faces);bm.to_mesh(me);bm.free()
 bpy.context.view_layer.objects.active=ob;ob.select_set(True)
 if bevel:
  mod=ob.modifiers.new('Machined edge radii','BEVEL');mod.width=bevel;mod.segments=segments
  if material==paint:
   me.materials.append(alloy);mod.affect='EDGES';mod.material=1
  bpy.ops.object.modifier_apply(modifier=mod.name)
 # Planar box mapping at 2 m per tile; all parts share the baked surface sets.
 uv=me.uv_layers.new(name='UVMap') if not me.uv_layers else me.uv_layers.active
 for f in me.polygons:
  no=f.normal;axis=max(range(3),key=lambda i:abs(no[i]));axes=[i for i in range(3) if i"'!=axis]
  for li in f.loop_indices:
   co=me.vertices[me.loops[li].vertex_index].co;uv.data[li].uv=(co[axes[0]]/2,co[axes[1]]/2)
 for f in me.polygons:f.use_smooth=False
 ob.select_set(False)
 GROUPS.setdefault(group,[]).append(ob);return ob

def box(name,c,size,ma=paint,gr='"'Hull',bev=.035):
 x,y,z=c;a,b,d=[v/2 for v in size]
 return mesh(name,[(x+i*a,y+j*b,z+k*d) for i,j,k in [(-1,-1,-1),(-1,-1,1),(-1,1,-1),(-1,1,1),(1,-1,-1),(1,-1,1),(1,1,-1),(1,1,1)]],[(0,4,6,2),(1,3,7,5),(0,1,5,4),(2,6,7,3),(0,2,3,1),(4,5,7,6)],ma,gr,bev)

def plate(name,pts,thick=.06,ma=paint,gr='Hull',bev=.018):
 pts=[Vector(v) for v in pts];n=(pts[1]-pts[0]).cross(pts[2]-pts[0]).normalized();N=len(pts)
 return mesh(name,[tuple(p+n*thick/2) for p in pts]+[tuple(p-n*thick/2) for p in pts],[tuple(range(N)),tuple(reversed(range(N,2*N)))]+[(i,(i+1)%N,(i+1)%N+N,i+N) for i in range(N)],ma,gr,bev)

def beam(name,a,b,r=.045,ma=alloy,gr='Hull',N=10):
 return cyl(name,a,b,r,ma,gr,N)

def cyl(name,a,b,r,ma=alloy,gr='Hull',N=32,r2=None,bev=.008):
 a,b=Vector(a),Vector(b);z=(b-a).normalized();u=z.cross(Vector((0,0,1)))
 if u.length<.1:u=z.cross(Vector((0,1,0)))
 u.normalize();v=z.cross(u);r2=r if r2 is None else r2
 vs=[tuple(c+radius*(math.cos(i*2*math.pi/N)*u+math.sin(i*2*math.pi/N)*v)) for c,radius in [(a,r),(b,r2)] for i in range(N)]
 fs=[tuple(reversed(range(N))),tuple(range(N,2*N))]+[(i,(i+1)%N,(i+1)%N+N,i+N) for i in range(N)]
 ob=mesh(name,vs,fs,ma,gr,bev,2)
 for f in ob.data.polygons:
  if len(f.vertices)==4:f.use_smooth=True
 return ob

def tube(name,c,axis,profile,ma=alloy,gr='Hull',N=64):
 c=Vector(c);d=Vector(axis).normalized();u=d.cross(Vector((0,0,1)))
 if u.length<.1:u=d.cross(Vector((0,1,0)))
 u.normalize();v=d.cross(u)
 vs=[tuple(c+d*t+rad*(u*math.cos(i*2*math.pi/N)+v*math.sin(i*2*math.pi/N))) for t,rad in profile for i in range(N)]
 fs=[]
 for j in range(len(profile)):
  k=(j+1)%len(profile)
  for i in range(N):q=(i+1)%N;fs.append((j*N+i,j*N+q,k*N+q,k*N+i))
 ob=mesh(name,vs,fs,ma,gr,0)
 for f in ob.data.polygons:f.use_smooth=True
 return ob

def socket(name,world,parent=None):
 ob=bpy.data.objects.new(name,None);S.collection.objects.link(ob);ob.empty_display_size=.18
 if parent:
  ob.parent=parent;ob.location=parent.matrix_world.inverted()@Vector(world)
 else:ob.location=world
 ASSET.append(ob);return ob

def bolts_on_quad(pts,ma=alloy,gr='Hull',r=.035):
 a,b,c,d=map(Vector,pts);n=(b-a).cross(c-a).normalized()
 for u,v in [(.06,.09),(.94,.09),(.94,.91),(.06,.91)]:
  p=a*(1-u)*(1-v)+b*u*(1-v)+c*u*v+d*(1-u)*v
  cyl('Captive fastener',p+n*.04,p+n*.07,r,ma,gr,8,bev=.002)

def outline(name,pts,r=.035,ma=alloy,gr='Hull',closed=True):
 for i in range(len(pts) if closed else len(pts)-1):beam(name,pts[i],pts[(i+1)%len(pts)],r,ma,gr,8)

# Main hull: eight-faced continuous armoured loft, widening behind a blunt wedge nose.
SECS=[(-12,1.65,-1.13,-.14),(-10.65,2.35,-1.45,.35),(-7.8,3.0,-1.65,1.08),(-4.8,3.55,-1.72,1.58),(-1.7,3.95,-1.78,1.8),(2.1,4.15,-1.78,1.82),(6.6,4.2,-1.7,1.7),(9.6,3.95,-1.45,1.55),(10.65,3.72,-1.18,1.35)]
def ring(sec):
 y,w,bot,top=sec
 return [Vector(v) for v in [(w,y,bot+.65),(w,y,top-.65),(.70*w,y,top),(-.70*w,y,top),(-w,y,top-.65),(-w,y,bot+.65),(-.72*w,y,bot),(.72*w,y,bot)]]
rings=[ring(s) for s in SECS]
verts=[tuple(p) for r in rings for p in r];faces=[tuple(reversed(range(8))),tuple(range(64,72))]
for k in range(len(rings)-1):
 for j in range(8):faces.append((k*8+j,k*8+(j+1)%8,(k+1)*8+(j+1)%8,(k+1)*8+j))
core=mesh('Pressure hull',verts,faces,carbon,bevel=.075)
# Genuine cockpit recess cut through top skin; canopy is hollow and operable.
cut=box('Cockpit machining cutter',(0,-7.1,2.0),(2.1,6.1,2.7),carbon,gr='_cut',bev=.12)
bpy.context.view_layer.objects.active=core
mod=core.modifiers.new('Cockpit volume','BOOLEAN');mod.operation='DIFFERENCE';mod.object=cut;bpy.ops.object.modifier_apply(modifier=mod.name)
bpy.data.objects.remove(cut,do_unlink=True);GROUPS.pop('_cut')
# Flush segmented plating; reveal of dark structure between plates gives real recessed seams.
for k,(r0,r1) in enumerate(zip(rings,rings[1:])):
 for j in range(8):
  if j==2 and k in (1,2):continue
  if j==6 and 2<=k<=6:continue # torpedo opening
  a,b=r0[j],r0[(j+1)%8];d,c=r1[j],r1[(j+1)%8]
  center=(a+b+c+d)/4
  pts=[tuple(center+(v-center)*.977) for v in [a,b,c,d]]
  normal=(b-a).cross(c-a).normalized()
  # outward shift from core, so the plate has real reveal with no coplanar surfaces.
  midpoint=(a+b+c+d)/4
  if normal.dot(Vector((midpoint.x,0,midpoint.z)))<0:normal=-normal
  pts=[tuple(Vector(v)+normal*.062) for v in pts]
  # Split the broad roof around cockpit rather than bridge its glazing.
  if j==2 and k==3:
   pass
  ob=plate('Armour panel',pts,.095,paint,bev=.025)
  if j in (0,1,3,4) and k>0:bolts_on_quad(pts,r=.033)
# Long chine reinforcements integrated into shoulder edges.
for sign in [-1,1]:
 for k in range(1,7):
  a=rings[k][1 if sign==1 else 4];b=rings[k+1][1 if sign==1 else 4]
  beam('Continuous shoulder cap',a+Vector((sign*.045,0,.1)),b+Vector((sign*.045,0,.1)),.055,alloy,N=8)
# Nose intake faces, dark recessed throats and stacked aero/thermal louvers.
for sign in [-1,1]:
 pts=[(sign*.24,-12.045,-.91),(sign*1.38,-12.045,-.91),(sign*1.43,-12.045,-.29),(sign*.26,-12.045,-.29)]
 plate('Nose radiator shadow',pts,.05,carbon,bev=.055)
 outline('Nose radiator lip',pts,.055,alloy)
 for i in range(6):
  z=-.84+i*.095
  beam('Nose radiator fin',(sign*.34,-12.10,z),(sign*1.29,-12.10,z),.025,carbon,N=8)
plate('Central prow armour',[(-.22,-12.08,-1.1),(.22,-12.08,-1.1),(.30,-12.08,-.12),(-.30,-12.08,-.12)],.1,paint,bev=.025)
# Side thermal exchangers, inset framed panels with 12 independent deep louvers.
for sign in [-1,1]:
 for y,w,span in [(-3.15,3.76,1.65),(3.6,4.22,1.30)]:
  x=sign*w
  pts=[(x,y-span/2,-.95),(x,y+span/2,-.95),(x,y+span/2,.80),(x,y-span/2,.80)]
  plate('Recessed exchanger well',pts,.13,carbon,bev=.10)
  outline('Exchanger cast surround',[(x+sign*.12,a,b) for _,a,b in pts],.09,alloy)
  for z in np.linspace(-.79,.65,12):beam('Heat exchanger slat',(x+sign*.105,y-span*.4,z),(x+sign*.105,y+span*.4,z),.045,carbon,N=8)
 # small lateral fixed housings / RCS sockets
 x=sign*3.05
 box('Flush RCS fairing',(x,-7.1,-.20),(.26,1.25,.32),alloy,bev=.1)
 for yy in [-7.48,-7.13,-6.78]:cyl('RCS port',(x+sign*.11,yy,-.20),(x+sign*.19,yy,-.20),.065,carbon,N=16)
# Raised service spine behind the cockpit, deliberately narrow and integrated.
spine=[(-4.5,1.02,1.55,1.92),(-2.8,1.18,1.72,2.1),(1.5,1.15,1.80,2.08),(7.8,1.14,1.60,1.93),(9.7,.95,1.5,1.77)]
for a,b in zip(spine,spine[1:]):
 y,w,lo,hi=a;Y,W,LO,HI=b
 pts=[(-w,y,hi),(w,y,hi),(W,Y,HI),(-W,Y,HI)]
 plate('Dorsal armoured spine',pts,.24,paint,bev=.07)
# cockpit well, stepped seats and instrument panels
box('Cabin black tub',(0,-7.25,.64),(1.92,5.65,.22),carbon,bev=.08)
for y,z in [(-7.9,.83),(-5.85,1.12)]:
 box('Seat suspension',(0,y,z),(.65,.68,.25),alloy,bev=.06)
 box('Seat cushion',(0,y,z+.18),(.68,.65,.20),carbon,bev=.09)
 box('Seat back',(0,y+.29,z+.61),(.69,.18,.75),carbon,bev=.08)
 box('Head restraint',(0,y+.32,z+1.04),(.43,.19,.24),carbon,bev=.065)
 for x in [-.23,.23]:box('Seat harness',(x,y+.175,z+.64),(.055,.035,.63),alloy,bev=.012)
 box('Instrument coaming',(0,y-.57,z+.65),(1.35,.25,.30),carbon,bev=.055)
 for x in [-.41,0,.41]:
  ob=box('Flight display',(x,y-.715,z+.68),(.28,.025,.16),lamps,bev=.015)
  for uv in ob.data.uv_layers.active.data:uv.uv=(.63,.5)
 beam('Control column',(0,y-.2,z+.25),(0,y-.37,z+.60),.035,carbon,N=12)
 beam('Control grip',(-.13,y-.37,z+.62),(.13,y-.37,z+.62),.04,alloy,N=12)
# Multi-pane framed greenhouse, side openings and compound sloped windscreen.
C=[(-10.4,.64,.37,.54),(-7.72,1.04,1.03,2.20),(-6.28,1.08,1.32,2.48),(-4.55,.98,1.56,2.43)]
for k,(a,b) in enumerate(zip(C,C[1:])):
 y,w,lo,hi=a;Y,W,LO,HI=b
 for sign in [-1,1]:
  pts=[(sign*w,y,lo),(sign*W,Y,LO),(sign*W*.79,Y,HI),(sign*w*.79,y,hi)]
  plate('Canopy side glazing',pts,.022,glass,'Canopy',.008)
  outline('Canopy armoured frame',pts,.055,paint,'Canopy')
 pts=[(-w*.79,y,hi),(w*.79,y,hi),(W*.79,Y,HI),(-W*.79,Y,HI)]
 plate('Forward windshield' if k==0 else 'Roof glazing',pts,.025,glass,'Canopy',.008)
 outline('Canopy roof frame',pts,.053,alloy,'Canopy')
# rear bulkhead closes canopy; hinge spans across the roof's aft lower edge.
y,w,lo,hi=C[-1]
plate('Canopy rear shell',[(-w,y,lo),(w,y,lo),(w*.79,y,hi),(-w*.79,y,hi)],.09,paint,'Canopy',.035)
beam('Canopy transverse hinge',(-1.05,-4.55,1.58),(1.05,-4.55,1.58),.10,alloy,'Canopy',24)
PIVOTS['Canopy']=((0,-4.55,1.58),(1,0,0),'Hull')
# Wings: cast wedge roots, broad short swept tip plates, bevelled thick edges.
for sign in [-1,1]:
 pts=[(sign*3.65,1.05,.30),(sign*5.0,2.45,.15),(sign*8,4.75,-.16),(sign*7.90,8.70,-.22),(sign*4,9.18,.15)]
 wing=plate('Short armoured wing',pts,.32,paint,bev=.075)
 # separate top skins leave narrow channels and provide load-bearing visual scale
 for j in range(3):
  ya=3.4+j*1.65;yb=ya+1.55
  p=[(sign*4.5,ya,.42),(sign*7.7,max(ya,4.85),.04),(sign*7.65,yb+.1,.04),(sign*4.5,yb,.42)]
  plate('Wing upper access plate',p,.045,paint,bev=.014)
 # deep triangular forward wing-root air scoop
 pts=[(sign*3.95,1.02,.6),(sign*5.1,2.38,.40),(sign*4.02,2.38,.0)]
 plate('Wing root scoop casing',pts,.28,alloy,bev=.06)
 for i in range(7):
  x=sign*(4.03+i*.12);y=1.25+i*.13
  beam('Wing root inlet vanes',(x,y,.39),(x,y+.69,.19),.028,carbon,N=8)
 # Wing-root dorsal armour housings.
 box('Wing actuator fairing',(sign*3.2,3.25,1.48),(1.20,3.35,.68),paint,bev=.15)
 for j in range(6):
  box('Dorsal cooling slot',(sign*3.2,2.18+j*.33,1.839),(.72,.105,.035),carbon,bev=.025)
 # Recessed tip lamps, housed in metal bezel; navigation side convention X+ is left.
 ob=cyl('Navigation lens',(sign*7.84,5.15,-.16),(sign*8,5.15,-.16),.07,lamps,N=20)
 for uv in ob.data.uv_layers.active.data:uv.uv=(.125 if sign==1 else .375,.5)
 # Two removable missiles on launch shoes, fixed to the hull in shipped closed pose.
 for j,x in enumerate([5.15,6.70]):
  x*=sign;yy=5.65+j*.35;zz=-.76
  box('Missile launch shoe',(x,yy,.0),(.22,1.85,.45),carbon,bev=.04)
  for sy in [yy-.55,yy+.55]:box('Pylon clamp',(x,sy,-.37),(.42,.18,.24),alloy,bev=.035)
  cyl('Missile body',(x,yy-1.25,zz),(x,yy+1.55,zz),.18,alloy,N=32,bev=.015)
  cyl('Missile ogive',(x,yy-1.92,zz),(x,yy-1.25,zz),.025,carbon,N=32,r2=.18,bev=.01)
  tube('Missile arming collar',(x,yy-1.0,zz),(0,1,0),[(0,.184),(.12,.184),(.12,.17),(0,.17)],carbon,N=32)
  for ang in [0,math.pi/2,math.pi,3*math.pi/2]:
   dx,dz=math.cos(ang),math.sin(ang)
   plate('Missile stabilizer',[(x+dx*.14,yy+.65,zz+dz*.14),(x+dx*.45,yy+1.2,zz+dz*.45),(x+dx*.45,yy+1.6,zz+dz*.45),(x+dx*.14,yy+1.5,zz+dz*.14)],.035,carbon,bev=.008)
# Belly bomb bay: long armoured cassette with separate centre-split doors and hinges.
box('Torpedo bay interior',(0,1,-1.43),(4.6,12.3,.55),carbon,bev=.1)
for sign,label in [(1,'L'),(-1,'R')]:
 gr='BayDoor_'+label
 pts=[(sign*.035,-5.05,-2.04),(sign*2.26,-5.05,-1.94),(sign*2.26,7.04,-1.94),(sign*.035,7.04,-2.04)]
 plate('Torpedo bay door',pts,.24,paint,gr,bev=.045)
 for yy in [-4.85,-1.0,2.85,6.8]:
  beam('Bay door cross rib',(sign*.16,yy,-2.185),(sign*2.15,yy,-2.09),.05,alloy,gr,N=8)
 for yy in [-4.5,-.8,2.9,6.5]:
  cyl('Bay hinge pin',(sign*2.28,yy-.28,-1.9),(sign*2.28,yy+.28,-1.9),.10,alloy,N=20)
  box('Bay hinge strap',(sign*2.15,yy,-1.98),(.35,.24,.19),carbon,gr,bev=.03)
 PIVOTS[gr]=((sign*2.26,1,-1.92),(0,0,-1),'Hull')
# Retracted service / landing doors flush in lower chine (no extended gear).
for sign in [-1,1]:
 for yy in [-6.7,8.1]:
  pts=[(sign*2.2,yy-.55,-1.57),(sign*3.0,yy-.55,-1.22),(sign*3.0,yy+.55,-1.22),(sign*2.2,yy+.55,-1.57)]
  plate('Closed service hatch',pts,.065,paint,bev=.025)
# Three main engines in a tight transverse row. Deep concentric nozzles and heat petals.
for e,x in enumerate([-2.58,0,2.58],1):
 z=.0
 tube('Engine armoured sleeve',(x,0,z),(0,1,0),[(8.9,1.29),(10.45,1.29),(11.65,1.18),(11.96,1.12),(11.96,.97),(11.55,.99),(10.4,1.10),(8.9,1.10)],carbon,N=64)
 for y,rad in [(10.30,1.30),(10.65,1.27),(11.82,1.15)]:
  tube('Engine rolled reinforcement',(x,y,z),(0,1,0),[(-.07,rad),(.07,rad),(.09,rad-.08),(-.09,rad-.08)],alloy,N=64)
 # Petals taper and reveal a black expansion gap between them.
 for k in range(18):
  a=2*math.pi*k/18+.024;b=2*math.pi*(k+1)/18-.024
  pts=[(x+1.30*math.cos(a),10.5,z+1.30*math.sin(a)),(x+1.30*math.cos(b),10.5,z+1.30*math.sin(b)),(x+1.145*math.cos(b),11.78,z+1.145*math.sin(b)),(x+1.145*math.cos(a),11.78,z+1.145*math.sin(a))]
  plate('Thermal nozzle petal',pts,.06,alloy,bev=.018)
  ang=(a+b)/2
  beam('Engine latch rail',(x+1.33*math.cos(ang),10.05,z+1.33*math.sin(ang)),(x+1.33*math.cos(ang),10.8,z+1.33*math.sin(ang)),.045,carbon,N=8)
 # Recessed amber annulus. Visible glow is inside, sockets at nozzle exits.
 tube('Combustion glow ring',(x,10.97,z),(0,1,0),[(0,.83),(.05,.83),(.05,.71),(0,.71)],engines,N=64)
 tube('Internal nozzle ribs',(x,11.0,z),(0,1,0),[(0,1.01),(.11,1.01),(.11,.94),(0,.94)],alloy,N=64)
 cyl('Engine dark throat',(x,10.78,z),(x,10.83,z),.90,carbon,N=64,bev=.02)
 cyl('Engine central spike',(x,10.84,z),(x,11.28,z),.36,alloy,N=48,r2=.15,bev=.015)
 for a in np.linspace(0,2*math.pi,24,endpoint=False):
  pts=[(x+.38*math.cos(a),10.87,z+.38*math.sin(a)),(x+.85*math.cos(a+.09),10.91,z+.85*math.sin(a+.09)),(x+.85*math.cos(a+.17),10.96,z+.85*math.sin(a+.17)),(x+.40*math.cos(a+.10),10.96,z+.40*math.sin(a+.10))]
  plate('Nozzle guide vane',pts,.025,carbon,bev=.006)
# Turrets have integral traverse rings and separate gun elevation cradles.
def turret(idx,pivot,width,depth,height,barrel_length,twin):
 x,y,z=pivot;gr='Turret_'+str(idx);gun='Gun_'+str(idx)
 cyl('Traverse race fixed',(x,y,z-.12),(x,y,z+.06),width*.59,alloy,N=64)
 cyl('Traverse skirt',(x,y,z),(x,y,z+.14),width*.55,carbon,gr,N=64)
 # angular six-sided turret shell, front mantlet recessed
 vs=[(x+sx*width*.5,y+sy*depth*.5,z+.13) for sx,sy in [(-1,-1),(1,-1),(1,1),(-1,1)]]+[(x+sx*width*.36,y+sy*depth*.35,z+height) for sx,sy in [(-1,-1),(1,-1),(1,1),(-1,1)]]
 mesh('Cast turret armour',vs,[(0,3,2,1),(4,5,6,7),(0,1,5,4),(1,2,6,5),(2,3,7,6),(3,0,4,7)],paint,gr,.065)
 zgun=z+height*.55;ygun=y-depth*.43
 cyl('Elevation trunnion',(x-width*.51,ygun,zgun),(x+width*.51,ygun,zgun),.26,alloy,gr,N=32)
 for sx in [-1,1]:
  box('Turret cheek applique',(x+sx*width*.44,y,z+height*.48),(.18,depth*.62,height*.6),paint,gr,bev=.05)
  for yy in [-.3,0,.3]:box('Turret cooling slit',(x+sx*width*.54,y+yy,z+height*.52),(.03,.055,height*.26),carbon,gr,bev=.008)
 box('Armoured sight hood',(x,y-depth*.06,z+height+.03),(.48,.55,.18),carbon,gr,bev=.045)
 offsets=[-.32,.32] if twin else [0]
 tips=[]
 for off in offsets:
  a=(x+off,ygun,zgun);end=(x+off,ygun-barrel_length,zgun)
  cyl('Gun receiver',(a[0],ygun+.20,zgun),(a[0],ygun-.65,zgun),.18,carbon,gun,N=32)
  cyl('Gun barrel',(a[0],ygun-.55,zgun),end,.075,alloy,gun,N=32,bev=.01)
  tube('Perforated barrel shroud',(a[0],ygun-.85,zgun),(0,-1,0),[(0,.15),(.65,.15),(.65,.105),(0,.105)],carbon,gun,N=32)
  for kk in range(5):
   yy=ygun-.9-kk*.12
   for sx in [-1,1]:cyl('Shroud cooling inset',(a[0]+sx*.148,yy,zgun),(a[0]+sx*.158,yy,zgun),.032,alloy,gun,N=10,bev=.002)
  tube('Muzzle brake',end,(0,1,0),[(0,.12),(.32,.12),(.32,.065),(0,.065)],carbon,gun,N=32)
  tips.append(end)
 PIVOTS[gr]=(pivot,(0,1,0),'Hull');PIVOTS[gun]=((x,ygun,zgun),(1,0,0),gr)
 return tips
TIPS1=turret(1,(0,.3,2.08),2.1,2.0,.93,2.7,True)
TIPS2=turret(2,(0,-9.2,-2.05),1.05,1.25,.55,1.75,False)
# Chin turret normally below hull: its armour extends upward; barrel lives under the nose.
# Additional restrained construction details, flush inspection panels and tie-down fittings.
for sign in [-1,1]:
 for y in [-.8,5.8,8.2]:
  x=sign*2.32;z=1.89 if y<3 else 1.77
  box('Flush roof inspection panel',(x,y,z),(.72,1.1,.075),paint,bev=.045)
  box('Recessed latch',(x,y-.28,z+.044),(.22,.10,.025),carbon,bev=.018)
  for xx in [-.25,.25]:
   for yy in [-.4,.4]:cyl('Panel screw',(x+xx,y+yy,z+.02),(x+xx,y+yy,z+.06),.03,alloy,N=8,bev=.002)
 for yy in [-4.6,7.9]:
  x=sign*3.2;z=1.65
  beam('Tie down handle',(x-.16,yy,z),(x-.16,yy,z+.16),.026,alloy,N=8)
  beam('Tie down handle',(x+.16,yy,z),(x+.16,yy,z+.16),.026,alloy,N=8)
  beam('Tie down handle',(x-.16,yy,z+.16),(x+.16,yy,z+.16),.026,alloy,N=8)
 # Belly longitudinal conduit with clamps, attached to bay surround.
 for yy in np.arange(-4,7,1.3):
  beam('Belly hydraulic conduit',(sign*2.55,yy,-1.73),(sign*2.55,yy+1.25,-1.73),.035,alloy,N=10)
  box('Conduit clamp',(sign*2.55,yy,-1.74),(.18,.10,.13),carbon,bev=.02)
# Beacon lens atop rear spine, one shared emissive material.
ob=cyl('Beacon lens',(0,7.2,1.95),(0,7.2,2.07),.085,lamps,N=20)
for uv in ob.data.uv_layers.active.data:uv.uv=(.875,.5)
print('GEOMETRY_BUILT',sum(len(v) for v in GROUPS.values()),flush=True)

# Join only rigid assemblies. Move vertex coordinates to the pivot without applying
# a moving node's transforms. Child local origins remain exact mechanical pivots.
OBJS={}
for name,parts in GROUPS.items():
 bpy.ops.object.select_all(action='DESELECT')
 for ob in parts:ob.select_set(True)
 bpy.context.view_layer.objects.active=parts[0];bpy.ops.object.join();ob=bpy.context.object;ob.name=name
 pivot=Vector(PIVOTS[name][0]) if name in PIVOTS else Vector((0,0,0))
 ob.data.transform(Matrix.Translation(-pivot));ob.location=pivot;OBJS[name]=ob;ASSET.append(ob)
 # recalculate normals and eliminate only true zero-area slivers before export
 bm=bmesh.new();bm.from_mesh(ob.data)
 bad=[f for f in bm.faces if f.calc_area()<1e-10]
 if bad:bmesh.ops.delete(bm,geom=bad,context='FACES')
 bmesh.ops.recalc_face_normals(bm,faces=bm.faces);bm.to_mesh(ob.data);bm.free();ob.data.update()
for name,(pivot,axis,parent) in PIVOTS.items():
 ob=OBJS[name];par=OBJS[parent];ob.parent=par;ob.matrix_parent_inverse=Matrix.Identity(4);ob.location=Vector(pivot)-par.matrix_world.translation
bpy.context.view_layer.update()
# Normalize dimensions by editing mesh coordinates and pivot locations, not node transforms.
# Hinge axes all align with principal axes; this preserves exact shared pivot positions.
pts=[o.matrix_world@v.co for o in OBJS.values() for v in o.data.vertices]
lo=Vector(tuple(min(p[i] for p in pts) for i in range(3)));hi=Vector(tuple(max(p[i] for p in pts) for i in range(3)))
scale=Vector((16/(hi.x-lo.x),24/(hi.y-lo.y),5.5/(hi.z-lo.z)))
center=(lo+hi)/2;center.x=0
D=Matrix.Diagonal((*scale,1))
for ob in OBJS.values():ob.data.transform(D)
for name,ob in OBJS.items():
 if ob.parent:ob.location=Vector([ob.location[i]*scale[i] for i in range(3)])
 else:ob.location=Vector([(ob.location[i]-center[i])*scale[i] for i in range(3)])
bpy.context.view_layer.update()
def wp(p):return tuple((Vector(p)-center)[i]*scale[i] for i in range(3))
for e,x in enumerate([-2.58,0,2.58],1):socket('Thruster_'+str(e),wp((x,11.96,0)),OBJS['Hull'])
for i,p in enumerate(TIPS1,1):socket('Muzzle_'+str(i),wp(p),OBJS['Gun_1'])
socket('Muzzle_3',wp(TIPS2[0]),OBJS['Gun_2'])
for sign in [1,-1]:
 for j,x in enumerate([5.15,6.7]):socket('Hardpoint_'+str((0 if sign==1 else 2)+j+1),wp((sign*x,3.8+j*.35,-.76)),OBJS['Hull'])
for i,y in enumerate([-3.5,1,5.5],5):socket('Hardpoint_'+str(i),wp((0,y,-1.95)),OBJS['Hull'])
socket('Seat_Pilot',wp((0,-7.9,1.05)),OBJS['Hull']);socket('Seat_Copilot',wp((0,-5.85,1.3)),OBJS['Hull'])
socket('Camera_Chase',(0,21,8),OBJS['Hull'])
socket('Light_Nav_L',wp((8,5.15,-.16)),OBJS['Hull']);socket('Light_Nav_R',wp((-8,5.15,-.16)),OBJS['Hull']);socket('Light_Beacon',wp((0,7.2,2.07)),OBJS['Hull'])

# Non-exported photographic studio lights in open space. World camera background
# is a faint blue gradient; non-camera world rays provide soft neutral daylight.
world=bpy.data.worlds.new('Space gradient');S.world=world;world.use_nodes=True
n=world.node_tree.nodes;l=world.node_tree.links;n.clear();out=n.new('ShaderNodeOutputWorld');mix=n.new('ShaderNodeMixShader');lp=n.new('ShaderNodeLightPath');bg=n.new('ShaderNodeBackground');bg.inputs[0].default_value=(.18,.21,.27,1);bg.inputs[1].default_value=.38
sky=n.new('ShaderNodeBackground');tc=n.new('ShaderNodeTexCoord');sep=n.new('ShaderNodeSeparateXYZ');ramp=n.new('ShaderNodeValToRGB');ramp.color_ramp.elements[0].position=.0;ramp.color_ramp.elements[0].color=(.003,.005,.009,1);ramp.color_ramp.elements[1].position=.75;ramp.color_ramp.elements[1].color=(.018,.029,.052,1)
l.new(tc.outputs['Normal'],sep.inputs[0]);l.new(sep.outputs['Z'],ramp.inputs[0]);l.new(ramp.outputs[0],sky.inputs[0]);l.new(lp.outputs['Is Camera Ray'],mix.inputs[0]);l.new(bg.outputs[0],mix.inputs[1]);l.new(sky.outputs[0],mix.inputs[2]);l.new(mix.outputs[0],out.inputs[0])
def area(name,pos,power,size,color):
 d=bpy.data.lights.new(name,'AREA');d.energy=power;d.shape='DISK';d.size=size;d.color=color;o=bpy.data.objects.new(name,d);S.collection.objects.link(o);o.location=pos;o.rotation_euler=(-o.location).to_track_quat('-Z','Y').to_euler()
area('White upper front left key',(5,-12,19),5600,10,(1,.96,.90));area('Soft cool fill',(-12,-4,8),3800,13,(.64,.79,1));area('Aft edge light',(4,13,12),6200,9,(.76,.87,1));area('Belly bounce',(2,-4,-9),1200,10,(.6,.7,1))
camd=bpy.data.cameras.new('Render camera');cam=bpy.data.objects.new('Render camera',camd);S.collection.objects.link(cam);S.camera=cam;camd.type='ORTHO';camd.lens=50
HERO=(28,-35,22)
def camera(pos,ortho=30):
 cam.location=pos;cam.rotation_euler=(Vector((0,0,0))-cam.location).to_track_quat('-Z','Y').to_euler();camd.ortho_scale=ortho
camera(HERO,29.8)
def render(path,w=1920,h=1080,samples=32):
 S.render.resolution_x=w;S.render.resolution_y=h;S.cycles.samples=samples;S.render.filepath=str(ROOT/path);bpy.ops.render.render(write_still=True);print('RENDERED',path,flush=True)
clay=mat('QA clay',(.32,.34,.37),.0,.6)
S.view_layers[0].material_override=clay
render('clay.png',1920,1080,20)
S.view_layers[0].material_override=None
bpy.ops.wm.save_as_mainfile(filepath=str(ROOT/'geometry.blend'))

# Bake every textured surface from registered CC0 scans plus procedural fine wear.
# Shared 2m tiles preserve close viewing density across the entire ship.
def download(id,map):
 fn=f'{id}_{map}_1k.jpg';path=TEX/fn
 if not path.exists():
  url=f'https://dl.polyhaven.org/file/ph-assets/Textures/jpg/1k/{id}/{fn}'
  subprocess.run(['curl','-fL','--retry','2','-A','ForgeAssetBuilder/1.0',url,'-o',str(path)],check=True,stdout=subprocess.DEVNULL)
 return bpy.data.images.load(str(path),check_existing=True)

def bake_surface(ma,id,tone,metal,rough):
 print('BAKE_START',ma.name,flush=True)
 src=bpy.data.materials.new(ma.name+'_bake_source');src.use_nodes=True;nt=src.node_tree;n=nt.nodes;l=nt.links;n.clear()
 out=n.new('ShaderNodeOutputMaterial');bs=n.new('ShaderNodeBsdfPrincipled');l.new(bs.outputs[0],out.inputs[0])
 tc=n.new('ShaderNodeTexCoord');diff=n.new('ShaderNodeTexImage');diff.image=download(id,'diff');l.new(tc.outputs['UV'],diff.inputs[0])
 norm=n.new('ShaderNodeTexImage');norm.image=download(id,'nor_gl');norm.image.colorspace_settings.name='Non-Color';l.new(tc.outputs['UV'],norm.inputs[0])
 arm=n.new('ShaderNodeTexImage');arm.image=download(id,'arm');arm.image.colorspace_settings.name='Non-Color';l.new(tc.outputs['UV'],arm.inputs[0])
 sep=n.new('ShaderNodeSeparateColor');l.new(arm.outputs['Color'],sep.inputs[0])
 bw=n.new('ShaderNodeRGBToBW');l.new(diff.outputs[0],bw.inputs[0])
 ra=n.new('ShaderNodeValToRGB');ra.color_ramp.elements[0].position=.02;ra.color_ramp.elements[1].position=.65
 if ma==paint:
  ra.color_ramp.elements[0].color=(.58,.58,.58,1);ra.color_ramp.elements[1].color=(.95,.95,.95,1)
 else:
  ra.color_ramp.elements[0].color=(*[x*.55 for x in tone],1);ra.color_ramp.elements[1].color=(*[x*1.35 for x in tone],1)
 l.new(bw.outputs[0],ra.inputs[0])
 noise=n.new('ShaderNodeTexNoise');noise.inputs['Scale'].default_value=95;noise.inputs['Detail'].default_value=3;l.new(tc.outputs['UV'],noise.inputs[0])
 nr=n.new('ShaderNodeMapRange');nr.inputs['To Min'].default_value=.76;nr.inputs['To Max'].default_value=1;l.new(noise.outputs['Fac'],nr.inputs[0])
 mul=n.new('ShaderNodeMixRGB');mul.blend_type='MULTIPLY';mul.inputs[0].default_value=.32;l.new(ra.outputs[0],mul.inputs[1]);l.new(nr.outputs[0],mul.inputs[2]);l.new(mul.outputs[0],bs.inputs['Base Color'])
 nm=n.new('ShaderNodeNormalMap');nm.inputs['Strength'].default_value=.28;l.new(norm.outputs[0],nm.inputs['Color'])
 bump=n.new('ShaderNodeBump');bump.inputs['Strength'].default_value=.12;bump.inputs['Distance'].default_value=.004;l.new(noise.outputs['Fac'],bump.inputs['Height']);l.new(nm.outputs[0],bump.inputs['Normal']);l.new(bump.outputs[0],bs.inputs['Normal'])
 rr=n.new('ShaderNodeMapRange');rr.inputs['To Min'].default_value=rough-.08;rr.inputs['To Max'].default_value=rough+.16;l.new(sep.outputs['Green'],rr.inputs[0]);l.new(rr.outputs[0],bs.inputs['Roughness']);bs.inputs['Metallic'].default_value=metal
 bpy.ops.mesh.primitive_plane_add(size=2,location=(0,0,35));ob=bpy.context.object;ob.name='_BakeSurface';ob.data.materials.append(src)
 bake=n.new('ShaderNodeTexImage');n.active=bake
 def pass_image(name,res,typ,channel=None):
  img=bpy.data.images.new(ma.name+'_'+name,res,res,alpha=False);img.colorspace_settings.name='sRGB' if name=='BaseColor' else 'Non-Color';bake.image=img;n.active=bake
  if channel is not None:
   em=n.new('ShaderNodeEmission');l.new(channel,em.inputs[0]);l.new(em.outputs[0],out.inputs[0])
  bpy.ops.object.select_all(action='DESELECT');ob.select_set(True);bpy.context.view_layer.objects.active=ob;S.cycles.samples=12;S.render.bake.margin=8;S.render.bake.use_selected_to_active=False
  bpy.ops.object.bake(type=typ,pass_filter={'COLOR'} if typ=='DIFFUSE' else set())
  if channel is not None:l.new(bs.outputs[0],out.inputs[0])
  img.filepath_raw=str(OUT/(img.name+'.png'));img.file_format='PNG';img.save();return img
 base=pass_image('BaseColor',1024,'DIFFUSE')
 normal=pass_image('Normal',1024,'NORMAL')
 # Pack true channels in the node graph, then Cycles EMIT bake to linear ORM.
 comb=n.new('ShaderNodeCombineColor');comb.mode='RGB';comb.inputs[0].default_value=1;l.new(rr.outputs[0],comb.inputs[1]);comb.inputs[2].default_value=metal
 orm=pass_image('ORM',512,'EMIT',comb.outputs[0])
 bpy.data.objects.remove(ob,do_unlink=True)
 # Portable PBR graph with glTF-compatible normal + packed occlusion/roughness/metallic.
 nt=ma.node_tree;n=nt.nodes;l=nt.links;n.clear();out=n.new('ShaderNodeOutputMaterial');bs=n.new('ShaderNodeBsdfPrincipled');l.new(bs.outputs[0],out.inputs[0])
 bt=n.new('ShaderNodeTexImage');bt.name='Baked_BaseColor';bt.image=base
 if ma==paint:
  factor=n.new('ShaderNodeMixRGB');factor.name='Faction colour';factor.blend_type='MULTIPLY';factor.inputs[0].default_value=1;factor.inputs[2].default_value=(*PAINTS[0][1],1);l.new(bt.outputs[0],factor.inputs[1]);l.new(factor.outputs[0],bs.inputs['Base Color'])
 else:l.new(bt.outputs[0],bs.inputs['Base Color'])
 no=n.new('ShaderNodeTexImage');no.image=normal;nm=n.new('ShaderNodeNormalMap');l.new(no.outputs[0],nm.inputs['Color']);l.new(nm.outputs[0],bs.inputs['Normal'])
 ot=n.new('ShaderNodeTexImage');ot.image=orm;sp=n.new('ShaderNodeSeparateColor');l.new(ot.outputs[0],sp.inputs[0]);l.new(sp.outputs['Green'],bs.inputs['Roughness']);l.new(sp.outputs['Blue'],bs.inputs['Metallic'])
 group=bpy.data.node_groups.get('glTF Material Output')
 if not group:
  group=bpy.data.node_groups.new('glTF Material Output','ShaderNodeTree');group.interface.new_socket(name='Occlusion',in_out='INPUT',socket_type='NodeSocketFloat')
 g=n.new('ShaderNodeGroup');g.node_tree=group;l.new(sp.outputs['Red'],g.inputs['Occlusion'])
 print('BAKE_DONE',ma.name,flush=True)
for ma,id,tone,met,rough in [(paint,'blue_metal_plate',(.8,.8,.8),.62,.37),(alloy,'metal_plate',(.28,.30,.32),.88,.32),(carbon,'metal_plate',(.035,.042,.05),.68,.46)]:bake_surface(ma,id,tone,met,rough)

# Export only gameplay nodes. Force direct texture path for exporter and patch
# baseColorFactor (glTF's faction colour multiplier), then restore render graph.
bpy.ops.object.select_all(action='DESELECT')
for o in ASSET:o.select_set(True)
nt=paint.node_tree;bs=next(n for n in nt.nodes if n.type=='BSDF_PRINCIPLED');bt=nt.nodes['Baked_BaseColor'];fac=nt.nodes['Faction colour'];nt.links.new(bt.outputs[0],bs.inputs['Base Color'])
glb=ROOT/'heavy-bomber-opera.glb'
bpy.ops.export_scene.gltf(filepath=str(glb),export_format='GLB',use_selection=True,export_yup=True,export_apply=False,export_animations=False,export_cameras=False,export_lights=False,export_extras=True,export_image_format='AUTO')
raw=glb.read_bytes();jlen=struct.unpack_from('<I',raw,12)[0];doc=json.loads(raw[20:20+jlen]);binary=raw[20+jlen:]
for m in doc['materials']:
 if m['name']=='Paint':m['pbrMetallicRoughness']['baseColorFactor']=[*PAINTS[0][1],1]
 if m['name']=='Glass':m['alphaMode']='BLEND';m['doubleSided']=True
j=json.dumps(doc,separators=(',',':')).encode();j+=b' '*((-len(j))%4)
glb.write_bytes(struct.pack('<III',0x46546c67,2,12+8+len(j)+len(binary))+struct.pack('<II',len(j),0x4e4f534a)+j+binary)
nt.links.new(fac.outputs[0],bs.inputs['Base Color'])
tris=sum(len(p.vertices)-2 for o in OBJS.values() for p in o.data.polygons)
print('EXPORTED',tris,'triangles',glb.stat().st_size,'bytes',flush=True)
# Metadata in the delivered glTF frame (X left, Y up, Z nose).
def gltf(v):return [round(float(v[0]),6),round(float(v[2]),6),round(float(-v[1]),6)]
bpy.context.view_layer.update();pts=[o.matrix_world@v.co for o in OBJS.values() for v in o.data.vertices];bbmin=[min(p[i] for p in pts) for i in range(3)];bbmax=[max(p[i] for p in pts) for i in range(3)]
metadata={'asset':'heavy-bomber-opera','units':'metres','forward':'+Z','up':'+Y','left':'+X','bounding_box':{'min':[bbmin[0],bbmin[2],-bbmax[1]],'max':[bbmax[0],bbmax[2],-bbmin[1]],'dimensions':[16,5.5,24]},'triangles':tris,'materials':[m['name'] for m in doc['materials']],'file_bytes':glb.stat().st_size,'axes':{k:list(v[1]) for k,v in PIVOTS.items()},'paints':[{'name':n,'linear_rgb':v} for n,v in PAINTS],'nodes':{o.name:{'world_position':gltf(o.matrix_world.translation),'parent':o.parent.name if o.parent else None,'type':'mesh' if o.type=='MESH' else 'empty'} for o in ASSET}}
(ROOT/'nodes.json').write_text(json.dumps(metadata,indent=2))
(ROOT/'NOTES.md').write_text('\\n'.join([\"Original heavy space-opera assault bomber; 24 × 16 × 5.5 m; closed flight configuration, articulated turrets, canopy and bay doors.\",f\"Triangles: {tris:,}; GLB: {glb.stat().st_size/1048576:.2f} MiB; rigid assemblies joined; no lights or cameras exported.\",\"Materials: Paint, Alloy, Carbon, Glass, Engines, Lamps; Paint neutral texture × linear gunmetal [0.20, 0.22, 0.24].\",\"Textures: three shared Cycles-baked 1024² base/normal sets + 512² ORM; 16×4 lamp palette; 2 m physical tiling.\",\"Poly Haven CC0 IDs: metal_plate, blue_metal_plate; https://polyhaven.com/a/metal_plate ; https://polyhaven.com/a/blue_metal_plate ; licence https://polyhaven.com/license .\",\"Reference differences: original segmented armour layout, revised canopy frames and circular nozzle petals; no lettering or insignia.\"])+ '\\n')
# Production renders.
camera(HERO,29.8);render('final.png',1920,1080,48)
camera((32,0,1.5),28);render('side.png',1920,1080,28)
camera((23,33,16),29.8);render('rear.png',1440,900,24)
# Mechanical check: turn each moving part 30 degrees about its declared pivot.
base_locs={name:OBJS[name].location.copy() for name in PIVOTS}
for name in PIVOTS:
 ob=OBJS[name]
 if name.startswith('Turret'):ob.rotation_euler.z=math.radians(30)
 elif name.startswith('BayDoor'):ob.rotation_euler.y=math.radians(30 if name.endswith('L') else -30)
 else:ob.rotation_euler.x=math.radians(30)
for name in PIVOTS:assert (OBJS[name].location-base_locs[name]).length<1e-8
camera((25,-30,-18),30);render('articulation.png',1440,900,24)
for name in PIVOTS:OBJS[name].rotation_euler=(0,0,0)
camera(HERO,29.8)
# Build six images into one 3x2 contact sheet without a dependency on Pillow.
frames=[]
for name,col in PAINTS:
 fac.inputs[2].default_value=(*col,1);render('_paint_'+name.replace(' ','_')+'.png',640,360,16)
 im=bpy.data.images.load(str(ROOT/('_paint_'+name.replace(' ','_')+'.png')),check_existing=False)
 frames.append(np.array(im.pixels[:],dtype=np.float32).reshape(360,640,4));bpy.data.images.remove(im)
canvas=np.zeros((720,1920,4),dtype=np.float32)
for i,pixels in enumerate(frames):canvas[(1-i//3)*360:(2-i//3)*360,(i%3)*640:(i%3+1)*640]=pixels
im=bpy.data.images.new('Six faction paints',1920,720);im.pixels.foreach_set(canvas.ravel());im.filepath_raw=str(ROOT/'paints.png');im.file_format='PNG';im.save()
fac.inputs[2].default_value=(*PAINTS[0][1],1)
bpy.ops.wm.save_as_mainfile(filepath=str(ROOT/'heavy-bomber-opera.blend'))
print('BUILD_COMPLETE',flush=True)
PY
python3 -m py_compile build_heavy-bomber-opera.py
scp build_heavy-bomber-opera.py gex44:/root/fal-author/heavy-bomber-opera-v1/
scp -r textures gex44:/root/fal-author/heavy-bomber-opera-v1/" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 2530ms:
codex
The full model script is ready, including the cockpit interior, engine throats, missile racks, and separate hinged parts. The GPU bake/export preflight passed. I’m starting the clean build now; the clay render will show whether the proportions and panel construction need correction.

hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "ssh gex44 '/root/blender-spike/blender-5.2.0-linux-x64/blender -b --python-exit-code 1 --python /root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py > /root/fal-author/heavy-bomber-opera-v1/build.log 2>&1'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "ssh gex44 'tail -12 /root/fal-author/heavy-bomber-opera-v1/build.log'
python3 - <<'PY'
import json
j=json.load(open('/tmp/heavy-bomber-polyhaven.json'))
for k in ['metal_plate_02','rusty_metal_03','rusty_metal_04']:
 print(k,j[k].get('tags'),j[k].get('categories'))
PY" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 425ms:
INFO gpu_gate: gpu slot acquired by blender (pid 3836499, 6000 MiB, batch)
00:00.492  cycles           | WARNING HIPEW initialization failed: Error opening HIP dynamic library
/root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py:31: DeprecationWarning: 'Material.use_nodes' is expected to be removed in Blender 6.0
  m=bpy.data.materials.new(name);m.use_nodes=True
metal_plate_02 ['worn', 'metal sheet', 'corroded metal sheet', 'metal sheet ', 'steel sheeting', 'rusted', 'rusty', 'iron', 'industrial', 'grunge', 'oxidized metal', 'steel', 'rust', 'metallic', 'sheet', 'metal', 'corroded'] ['man made', 'metal']
rusty_metal_03 ['rough', 'weathered', 'worn', 'old', 'metal', 'rusted', 'rusty', 'rust', 'metal sheet', 'corroded', 'corroded metal sheet', 'oxidized', 'corroded surface', 'oxidized metal'] ['man made', 'metal']
rusty_metal_04 ['metal sheet', 'metal', 'rusted', 'rusty', 'rust', 'steel', 'oxidized', 'corrosion', 'oxidized metal', 'corroded', 'iron', 'metallic', 'steel sheeting', 'corroded metal sheet'] ['man made', 'metal']

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "curl -fL -s -A 'ForgeAssetBuilder/1.0' https://dl.polyhaven.org/file/ph-assets/Textures/jpg/1k/metal_plate_02/metal_plate_02_diff_1k.jpg -o /tmp/heavy-bomber-metal02.jpg
ssh gex44 'tail -12 /root/fal-author/heavy-bomber-opera-v1/build.log'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 652ms:
Blender 5.2.0 LTS (hash fbe6228777e7 built 2026-07-14 01:32:04)
00:26.260  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/clay.png'
RENDERED clay.png
Info: Saved as "geometry.blend"
BAKE_START Paint
/root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py:413: DeprecationWarning: 'Material.use_nodes' is expected to be removed in Blender 6.0
  src=bpy.data.materials.new(ma.name+'_bake_source');src.use_nodes=True;nt=src.node_tree;n=nt.nodes;l=nt.links;n.clear()
Info: Baking map saved to internal image, save it externally or pack it
Info: Baking map saved to internal image, save it externally or pack it
Info: Baking map saved to internal image, save it externally or pack it
BAKE_DONE Paint
BAKE_START Alloy

hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "scp gex44:/root/fal-author/heavy-bomber-opera-v1/clay.png /tmp/heavy-bomber-clay-v1.png
ssh gex44 'tail -8 /root/fal-author/heavy-bomber-opera-v1/build.log'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 1485ms:
20:48:27 | INFO: Primitives created: 3
20:48:27 | INFO: Extracting primitive: Gun receiver.002
20:48:27 | INFO: Primitives created: 2
20:48:27 | INFO: Finished glTF 2.0 export in 0.2639353275299072 s

EXPORTED 187262 triangles 14949888 bytes
00:41.686  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/final.png'
RENDERED final.png

hook: PreToolUse
hook: PreToolUse Completed
 exited 255 in 55472ms:
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "scp gex44:/root/fal-author/heavy-bomber-opera-v1/final.png /tmp/heavy-bomber-final-v1.png
ssh gex44 'tail -10 /root/fal-author/heavy-bomber-opera-v1/build.log'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 1579ms:
00:49.391  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/side.png'
RENDERED side.png
00:54.611  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/rear.png'
RENDERED rear.png
01:04.480  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/articulation.png'
RENDERED articulation.png
01:06.674  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/_paint_Gunmetal.png'
RENDERED _paint_Gunmetal.png
01:10.028  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/_paint_Olive_drab.png'
RENDERED _paint_Olive_drab.png

hook: PreToolUse
hook: PreToolUse Completed
codex
The first build exposed two issues: it exceeds the triangle and file-size budgets, and the hull looks too clean and dark in the textured render. I’ll reduce excess geometry on small fittings, strengthen the baked wear, and improve the lighting so the side vents and armour details read clearly.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "scp gex44:/root/fal-author/heavy-bomber-opera-v1/baked/Paint_BaseColor.png /tmp/heavy-bomber-paint-v1.png
scp gex44:/root/fal-author/heavy-bomber-opera-v1/side.png /tmp/heavy-bomber-side-v1.png
scp gex44:/root/fal-author/heavy-bomber-opera-v1/articulation.png /tmp/heavy-bomber-articulation-v1.png
ssh gex44 'tail -8 /root/fal-author/heavy-bomber-opera-v1/build.log'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 3683ms:
01:19.725  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/_paint_Arctic_white.png'
RENDERED _paint_Arctic_white.png
01:23.605  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/_paint_Deep_navy.png'
RENDERED _paint_Deep_navy.png
Info: Saved as "heavy-bomber-opera.blend"
BUILD_COMPLETE

Blender quit

hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "cp build_heavy-bomber-opera.py /tmp/heavy-bomber-build-v1.py
python3 - <<'PY'
p='build_heavy-bomber-opera.py'
s=open(p).read().replace(\"bevel=0.02,segments=3\", \"bevel=0.02,segments=2\")
s=s.replace(\"return cyl(name,a,b,r,ma,gr,N)\",\"return cyl(name,a,b,r,ma,gr,N,bev=0)\")
s=s.replace(\"ob=mesh(name,vs,fs,ma,gr,bev,2)\",\"ob=mesh(name,vs,fs,ma,gr,bev,1)\")
s=s.replace(\"pass_image('BaseColor',1024,'DIFFUSE')\",\"pass_image('BaseColor',1024,'EMIT',mul.outputs[0])\")
s=s.replace(\"ra.color_ramp.elements[1].position=.65\",\"ra.color_ramp.elements[1].position=.16\")
s=s.replace(\"ra.color_ramp.elements[0].color=(.58,.58,.58,1)\",\"ra.color_ramp.elements[0].color=(.48,.48,.48,1)\")
s=s.replace(\"(alloy,'metal_plate'\",\"(alloy,'metal_plate_02'\").replace(\"(carbon,'metal_plate'\",\"(carbon,'metal_plate_02'\")
s=s.replace(\"metal_plate, blue_metal_plate; https://polyhaven.com/a/metal_plate ;\", \"metal_plate_02, blue_metal_plate; https://polyhaven.com/a/metal_plate_02 ;\")
s=s.replace(\"v-center)*.977\", \"v-center)*.990\")
s=s.replace(\"sign*4.5,ya,.42\", \"sign*4.5,ya,.34\").replace(\"sign*4.5,yb,.42\", \"sign*4.5,yb,.34\").replace(\"max(ya,4.85),.04\", \"max(ya,4.85),-.02\").replace(\"yb+.1,.04\", \"yb+.1,-.02\")
s=s.replace(\"area('Belly bounce',(2,-4,-9),1200,10,(.6,.7,1))\", \"area('Belly bounce',(2,-4,-9),4200,10,(.7,.8,1));area('Camera-side broad fill',(17,-10,6),5000,12,(.9,.94,1))\")
s=s.replace(\"(5,-12,19),5600\", \"(5,-12,19),8200\")
# Make an actual recessed torpedo cavity, with ceiling and rails instead of a solid box.
s=s.replace(\"# Flush segmented plating\", \"\"\"cut=box('Bay machining cutter',(0,1,-2.0),(4.5,12.2,2.1),carbon,gr='_cut',bev=.08)
bpy.context.view_layer.objects.active=core
mod=core.modifiers.new('Open torpedo cassette','BOOLEAN');mod.operation='DIFFERENCE';mod.object=cut;bpy.ops.object.modifier_apply(modifier=mod.name)
bpy.data.objects.remove(cut,do_unlink=True);GROUPS.pop('_cut')
# Flush segmented plating\"\"\")
s=s.replace(\"box('Torpedo bay interior',(0,1,-1.43),(4.6,12.3,.55),carbon,bev=.1)\",\"\"\"box('Torpedo bay ceiling',(0,1,-.94),(4.6,12.3,.14),carbon,bev=.05)
for sign in [-1,1]:
 box('Torpedo bay sidewall',(sign*2.26,1,-1.43),(.15,12.1,1.0),carbon,bev=.04)
 beam('Torpedo suspension rail',(sign*.74,-4.7,-1.13),(sign*.74,6.7,-1.13),.07,alloy,N=12)
 for y in [-3.2,1.1,5.1]:
  cyl('Internal torpedo body',(sign*.74,y-1.5,-1.55),(sign*.74,y+1.4,-1.55),.26,carbon,N=24,bev=.01)
  cyl('Torpedo warhead',(sign*.74,y-1.95,-1.55),(sign*.74,y-1.5,-1.55),.045,alloy,N=24,r2=.26,bev=.01)
  box('Torpedo release clamp',(sign*.74,y,-1.27),(.65,.22,.25),alloy,bev=.035)\"\"\")
# Improve bay test pose (left door rotates toward outside and down).
s=s.replace(\"math.radians(30 if name.endswith('L') else -30)\",\"math.radians(-30 if name.endswith('L') else 30)\")
# Runtime metadata bounds uses all vertices, so declared dimension assertions are meaningful.
s=s.replace(\"print('EXPORTED',tris\", \"assert 50000 <= tris <= 110000, f'Triangle budget: {tris}'\\nassert glb.stat().st_size <= 12*1024*1024, 'GLB size budget exceeded'\\nprint('EXPORTED',tris\")
open(p,'w').write(s)
PY
scp build_heavy-bomber-opera.py gex44:/root/fal-author/heavy-bomber-opera-v1/
ssh gex44 '/root/blender-spike/blender-5.2.0-linux-x64/blender -b --python-exit-code 1 --python /root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py > /root/fal-author/heavy-bomber-opera-v1/build-v2.log 2>&1'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "scp gex44:/root/fal-author/heavy-bomber-opera-v1/heavy-bomber-opera.glb /tmp/heavy-bomber-v1.glb
python3 /home/claude-agent/.agents/skills/blender-game-assets/scripts/audit_glb.py /tmp/heavy-bomber-v1.glb --strict > /tmp/heavy-bomber-audit-v1.json
python3 - <<'PY'
import json,struct
p='/tmp/heavy-bomber-v1.glb';b=open(p,'rb').read();n=struct.unpack_from('<I',b,12)[0];j=json.loads(b[20:20+n])
print('nodes',[(x['name'],x.get('translation'),x.get('rotation'),x.get('children')) for x in j['nodes']])
print('materials',[(x['name'],x.get('pbrMetallicRoughness',{}),x.get('alphaMode')) for x in j['materials']])
print(open('/tmp/heavy-bomber-audit-v1.json').read()[-4000:])
PY" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 2004ms:
nodes [('BayDoor_L', [2.2585926055908203, -1.9689388275146484, -0.9962639808654785], None, None), ('BayDoor_R', [-2.2585926055908203, -1.9689388275146484, -0.9962639808654785], None, None), ('Camera_Chase', [0, 8.4597806930542, -20.91531753540039], None, None), ('Canopy', [0, 1.6202726364135742, 4.53300142288208], None, None), ('Hardpoint_1', [5.146793365478516, -0.7793715596199036, -3.7858030796051025], None, None), ('Hardpoint_2', [6.695827960968018, -0.7793715596199036, -4.134495735168457], None, None), ('Hardpoint_3', [-5.146793365478516, -0.7793715596199036, -3.7858030796051025], None, None), ('Hardpoint_4', [-6.695827960968018, -0.7793715596199036, -4.134495735168457], None, None), ('Hardpoint_5', [0, -1.9997034072875977, 3.486923933029175], None, None), ('Hardpoint_6', [0, -1.9997034072875977, -0.9962639808654785], None, None), ('Hardpoint_7', [0, -1.9997034072875977, -5.479452133178711], None, None), ('Light_Beacon', [0, 2.1227622032165527, -7.173100471496582], None, None), ('Light_Nav_L', [7.995018482208252, -0.16407817602157593, -5.1307597160339355], None, None), ('Light_Nav_R', [-7.995018482208252, -0.16407817602157593, -5.1307597160339355], None, None), ('Seat_Copilot', [0, 1.3331356048583984, 5.828144073486328], None, None), ('Seat_Pilot', [0, 1.076763391494751, 7.870485305786133], None, None), ('Thruster_1', [-2.5783934593200684, 0, -11.91531753540039], None, None), ('Thruster_2', [0, 0, -11.91531753540039], None, None), ('Thruster_3', [2.5783934593200684, 0, -11.91531753540039], None, None), ('Muzzle_1', [-0.3198007345199585, 0, 2.689912796020508], None, None), ('Muzzle_2', [0.3198007345199585, 0, 2.689912796020508], None, None), ('Gun_1', [0, 0.5245378017425537, 0.8567870259284973], None, [19, 20]), ('Turret_1', [0, 2.133017063140869, -0.2988792061805725], None, [21]), ('Muzzle_3', [0, 0, 1.7434625625610352], None, None), ('Gun_2', [0, 0.3102104663848877, 0.535491943359375], None, [23]), ('Turret_2', [0, -2.102252244949341, 9.165628433227539], None, [24]), ('Hull', [0, -0.45978063344955444, -0.08468247950077057], None, [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 22, 25])]
materials [('Paint', {'baseColorTexture': {'index': 2}, 'metallicRoughnessTexture': {'index': 1}, 'baseColorFactor': [0.2, 0.22, 0.24, 1]}, None), ('Alloy', {'baseColorTexture': {'index': 5}, 'metallicRoughnessTexture': {'index': 4}}, None), ('Carbon', {'baseColorTexture': {'index': 8}, 'metallicRoughnessTexture': {'index': 7}}, None), ('Glass', {'baseColorFactor': [0.054999999701976776, 0.10499999672174454, 0.13500000536441803, 0.41999998688697815], 'metallicFactor': 0.11999999731779099, 'roughnessFactor': 0.1899999976158142}, 'BLEND'), ('Lamps', {'baseColorTexture': {'index': 10}, 'metallicFactor': 0.10000000149011612, 'roughnessFactor': 0.3199999928474426}, None), ('Engines', {'baseColorFactor': [0.25, 0.04500000178813934, 0.00800000037997961, 1], 'metallicFactor': 0.25, 'roughnessFactor': 0.4000000059604645}, None)]
tive": 2,
      "triangles": 752,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Torpedo bay door.001",
      "primitive": 0,
      "triangles": 12,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Torpedo bay door.001",
      "primitive": 1,
      "triangles": 1056,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Torpedo bay door.001",
      "primitive": 2,
      "triangles": 752,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Canopy side glazing",
      "primitive": 0,
      "triangles": 1692,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Canopy side glazing",
      "primitive": 1,
      "triangles": 684,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Canopy side glazing",
      "primitive": 2,
      "triangles": 7708,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Gun receiver",
      "primitive": 0,
      "triangles": 1784,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Gun receiver",
      "primitive": 1,
      "triangles": 6280,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Traverse skirt",
      "primitive": 0,
      "triangles": 2080,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Traverse skirt",
      "primitive": 1,
      "triangles": 36,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Traverse skirt",
      "primitive": 2,
      "triangles": 908,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Gun receiver.002",
      "primitive": 0,
      "triangles": 892,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Gun receiver.002",
      "primitive": 1,
      "triangles": 3140,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Traverse skirt.001",
      "primitive": 0,
      "triangles": 2080,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Traverse skirt.001",
      "primitive": 1,
      "triangles": 36,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Traverse skirt.001",
      "primitive": 2,
      "triangles": 908,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Pressure hull",
      "primitive": 0,
      "triangles": 64618,
      "zero_area_triangles": 82,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Pressure hull",
      "primitive": 1,
      "triangles": 944,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Pressure hull",
      "primitive": 2,
      "triangles": 86556,
      "zero_area_triangles": 20,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Pressure hull",
      "primitive": 3,
      "triangles": 1740,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Pressure hull",
      "primitive": 4,
      "triangles": 1536,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    }
  ],
  "duplicate_primitives": [],
  "note": "Mesh-local counts, before node transforms/instances. Degenerate threshold: cross-product magnitude < 1e-12 in asset units squared. Not a source-topology or visual-quality verdict.",
  "triangles": 187262,
  "zero_area_triangles": 102,
  "nonfinite_attribute_components": 0,
  "findings": [
    "zero_area_triangles"
  ]
}


hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "ssh gex44 'tail -12 /root/fal-author/heavy-bomber-opera-v1/build-v2.log'
node -e \"for (const p of ['playwright','puppeteer','three']) {try { console.log(p,require.resolve(p)) } catch {console.log(p,'missing')}}\"
command -v forge-agent
command -v geminix" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 623ms:
20:50:48 | INFO: Primitives created: 3
20:50:48 | INFO: Extracting primitive: Traverse skirt
20:50:48 | INFO: Primitives created: 3
20:50:48 | INFO: Extracting primitive: Gun receiver
20:50:48 | INFO: Primitives created: 2
20:50:48 | INFO: Extracting primitive: Traverse skirt.001
20:50:48 | INFO: Primitives created: 3
20:50:48 | INFO: Extracting primitive: Gun receiver.002
20:50:48 | INFO: Primitives created: 2
20:50:48 | INFO: Finished glTF 2.0 export in 0.2176511287689209 s

EXPORTED 87744 triangles 11715060 bytes
playwright missing
puppeteer missing
three missing
/home/claude-agent/bin/forge-agent
/home/claude-agent/bin/geminix

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "scp gex44:/root/fal-author/heavy-bomber-opera-v1/final.png /tmp/heavy-bomber-final-v2.png
scp gex44:/root/fal-author/heavy-bomber-opera-v1/side.png /tmp/heavy-bomber-side-v2.png
scp gex44:/root/fal-author/heavy-bomber-opera-v1/rear.png /tmp/heavy-bomber-rear-v2.png
ssh gex44 'tail -8 /root/fal-author/heavy-bomber-opera-v1/build-v2.log'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 4359ms:
20:50:48 | INFO: Primitives created: 2
20:50:48 | INFO: Finished glTF 2.0 export in 0.2176511287689209 s

EXPORTED 87744 triangles 11715060 bytes
00:36.156  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/final.png'
RENDERED final.png
00:44.488  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/side.png'
RENDERED side.png

hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "forge-agent run --help | head -65
sed -n '1,100p' /home/claude-agent/bin/geminix
ssh gex44 'tail -10 /root/fal-author/heavy-bomber-opera-v1/build-v2.log'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 619ms:
usage: forge-agent run [-h] --harness
                       {codex,codex-cli,claude,gemini,deepseek,unreal,gemini-proxy}
                       --model MODEL --purpose PURPOSE [--repo REPO] --task
                       TASK [--effort EFFORT] [--timeout TIMEOUT]
                       [--quality-profile {visual}]
                       [--quality-packet QUALITY_PACKET] [--jail]
                       [--allow-net {none,all,allowlist}]
                       [--data-class {synthetic,internal}] [--ro RO]

options:
  -h, --help            show this help message and exit
  --harness {codex,codex-cli,claude,gemini,deepseek,unreal,gemini-proxy}
                        codex = Unreal Agent on the Codex subscription
                        (default since 2026-09-23; Codex CLI with --jail);
                        codex-cli = the Codex CLI itself
  --model MODEL
  --purpose PURPOSE
  --repo REPO           required for --harness codex/claude/gemini/deepseek;
                        unused (no worktree) for gemini-proxy
  --task TASK
  --effort EFFORT       Codex or DeepSeek (medium maps to high on DeepSeek)
  --timeout TIMEOUT
  --quality-profile {visual}
                        DeepSeek only: bounded visual quality instructions
  --quality-packet QUALITY_PACKET
                        DeepSeek visual only: local JSON task packet (max 32
                        KiB)
  --jail                run the worker (codex/claude only) inside jail.py
                        containment (default OFF; opt in explicitly)
  --allow-net {none,all,allowlist}
                        --jail only: worker network mode (default 'all' --
                        codex/claude both need real model-API egress;
                        'allowlist' routes through the tinyproxy sidecar)
  --data-class {synthetic,internal}
                        --jail only: task data class; 'internal' is required
                        to use --ro
  --ro RO               --jail only, requires --data-class internal: extra
                        host path to mount read-only inside the jail;
                        repeatable
#!/bin/sh
# geminix: one-shot / scriptable Gemini, Antigravity CLI harness (default since 14 Oct 2026):
#   geminix "prompt"   |   geminix < file.md      (prints the final answer as text)
# Old Claude Code lane: geminix-cc, or FORGE_GEMINI_HARNESS=claude-code.
[ "${FORGE_GEMINI_HARNESS:-antigravity}" = claude-code ] && exec "$HOME/bin/geminix-cc" "$@"
if [ $# -eq 0 ] && [ -t 0 ]; then
  echo "geminix: no prompt given, starting the interactive session" >&2
  exec "$HOME/bin/gemini"
fi
exec "$HOME/bin/agy4" --model forge:build-gemini-4 -p "$@"
00:36.156  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/final.png'
RENDERED final.png
00:44.488  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/side.png'
RENDERED side.png
00:49.835  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/rear.png'
RENDERED rear.png
00:55.390  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/articulation.png'
RENDERED articulation.png
00:56.995  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/_paint_Gunmetal.png'
RENDERED _paint_Gunmetal.png

codex
The revised build is within budget at 87,744 triangles and 11.7 MB. I also found and fixed a bake issue that was darkening the metallic surfaces. I’m now checking the exported model, the hinge motion, and a second visual review against the reference.

 succeeded in 70678ms:
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "timeout 240 /home/claude-agent/bin/agy4 --model forge:build-gemini-4 --effort high -p 'You are the independent image critic requested by the Blender asset skill. Read actual image files using your image-capable tools: reference /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/sheet.jpg and current /tmp/heavy-bomber-final-v2.png and /tmp/heavy-bomber-side-v2.png. Previous /tmp/heavy-bomber-final-v1.png. Task is an original realistic heavy space-opera bomber with thick armoured wedge hull, stepped two-seat canopy, dorsal twin gun, chin gun, three rear engines and short missile wings. Default colour gunmetal unlike reference olive; this difference is intentional. Find at most five highest-impact visible issues with silhouette, geometry realism, surface construction, materials. State evidence, correction, measurable acceptance. Do not edit files, do not delegate, do not run Blender. If you cannot actually see images say BLOCKED. End PASS or REVISE within 250 words. Must finish within 3 minutes. Root checkpoint ends 21:40 CEST.' > /tmp/heavy-bomber-critic-v2.txt 2>&1" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'mkdir -p /tmp/heavy-bomber-runtime
npm install --prefix /tmp/heavy-bomber-runtime three playwright --no-audit --no-fund > /tmp/heavy-bomber-runtime/install.log 2>&1
ls /home/claude-agent/.cache/ms-playwright' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "cp build_heavy-bomber-opera.py /tmp/heavy-bomber-build-v2.py
python3 - <<'PY'
p='build_heavy-bomber-opera.py';s=open(p).read()
s=s.replace(\"bm=bmesh.new();bm.from_mesh(ob.data)\\n bad=\", \"bm=bmesh.new();bm.from_mesh(ob.data)\\n bmesh.ops.triangulate(bm,faces=list(bm.faces))\\n bad=\")
s=s.replace(\"f.calc_area()<1e-10\", \"f.calc_area()<1e-8\")
s=s.replace(\"bpy.context.view_layer.update()\\ndef wp(p)\",\"\"\"# Put the Hull origin exactly at the asset COM frame without applying any moving transforms.
hull=OBJS['Hull'];offset=hull.location.copy();hull.data.transform(Matrix.Translation(offset));hull.location=(0,0,0)
for child in hull.children:child.location+=offset
bpy.context.view_layer.update()
def wp(p)\"\"\")
# Stable colour space: JPEG base colour, lossless normal and ORM.
s=s.replace(\"img.filepath_raw=str(OUT/(img.name+'.png'));img.file_format='PNG';img.save();return img\", \"img.filepath_raw=str(OUT/(img.name+('.jpg' if name=='BaseColor' else '.png')));img.file_format='JPEG' if name=='BaseColor' else 'PNG';img.save();return img\")
# check dimension budget in metres and texture limits as well as counts
s=s.replace(\"assert glb.stat().st_size <= 12*1024*1024\", \"assert glb.stat().st_size <= 12_000_000\")
open(p,'w').write(s)
PY" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
 succeeded in 2527ms:
chromium-1161
chromium-1223
chromium_headless_shell-1161
chromium_headless_shell-1223
ffmpeg-1011
webkit-2287

 succeeded in 54084ms:
context compacted
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'tail -25 /tmp/heavy-bomber-critic-v2.txt' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
- **Evidence**: In [heavy-bomber-side-v2.png](file:///tmp/heavy-bomber-side-v2.png) and [heavy-bomber-final-v2.png](file:///tmp/heavy-bomber-final-v2.png), the glass canopy sticks up above the hull with an exposed vertical rear glass wall and thin mullions, unlike the faired armored spine in [sheet.jpg](file:///home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/sheet.jpg).
- **Correction**: Raise the dorsal hull spine flush with the canopy roof and thicken the canopy frame struts.
- **Acceptance**: Zero exposed rear vertical glass in side view; frame struts >=0.08 m wide.

2. **Pinched nose and missing cheek intakes (Silhouette / Geometry)**
- **Evidence**: [heavy-bomber-final-v2.png](file:///tmp/heavy-bomber-final-v2.png) has a narrow flat tip grille instead of the wide twin angled cheek intakes in [sheet.jpg](file:///home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/sheet.jpg), and [heavy-bomber-side-v2.png](file:///tmp/heavy-bomber-side-v2.png) shows a black shading artifact on the nose tip bevel.
- **Correction**: Build twin recessed cheek intakes flanking the nose and fix the nose tip normals.
- **Acceptance**: Twin recessed front intakes visible in 3/4 view; zero black shading triangles in side view.

3. **Wing root intersection and missing scoop (Surface Construction)**
- **Evidence**: In [heavy-bomber-side-v2.png](file:///tmp/heavy-bomber-side-v2.png), the flat wing slab clips directly through a vertical hull vent and has a thin rod on the leading edge instead of a faired wing-root intake.
- **Correction**: Add a thick wing-root fairing with a recessed forward intake scoop and clear the hull vent.
- **Acceptance**: Wing root >=2x tip thickness with a recessed intake opening and no vent clipping.

4. **Undersized chin gun and flat belly bay (Silhouette)**
- **Evidence**: In [heavy-bomber-side-v2.png](file:///tmp/heavy-bomber-side-v2.png), the chin gun barrel is stubby and the underbelly torpedo bay is a thin flat strip.
- **Correction**: Extend the chin barrel forward and extrude chamfered belly bay doors downward.
- **Acceptance**: Chin barrel projects past the lower nose bevel; belly doors add >=0.35 m depth in side view.

5. **Grid seams and unweathered nozzles (Materials / Surface)**
- **Evidence**: [heavy-bomber-side-v2.png](file:///tmp/heavy-bomber-side-v2.png) has unbroken top-to-bottom vertical seam cuts and bright silver engine nozzles matching the hull.
- **Correction**: Stagger side armor plates and assign a dark heat-scorched metal material to the nozzles.
- **Acceptance**: Zero full-height vertical seams; engine nozzles >=30% darker than hull gunmetal.

REVISE

exec
/bin/bash -lc "sed -n '1,160p' /home/claude-agent/.agents/skills/blender-game-assets/SKILL.md" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
---
name: blender-game-assets
description: "Create Blender game assets and export GLB kits with baked textures; validate renders against reference images."
metadata:
  provenance: adapted
---

# Blender game assets, headless

Distilled from TheLongSilence's Blender pipeline (162 m ship, carved rocks, a
cabin interior kit, 13 ground materials) into a headless-first recipe for
Forge. **No GUI, no BlenderMCP socket** — Forge's Blender lives on gex44 with
no display, and `blender -b` is the one thing BlenderMCP's addon refuses to
run under. Everything below is a plain `blender -b --python` call or the
gex44 exec service.

For architectural construction kits, read `construction-kit` and its tested
source builders. It supplies cross-family profile/damage/UV contracts and
consumer-side checks; use only the relevant elements.

For a connected playable scene, also read `visual-game-loop` and its
`references/whole-scene-blender.md`: the user-approved harbour recipe combines
scene/object references, photographic materials and coherent Blender construction
with gameplay verification. Reuse good hero assets; author the surrounding place
as a whole rather than assuming a larger modular catalog will fix assembly.

## Read only what the task needs

| When | Read |
| --- | --- |
| A dense model must become a light one that keeps its look (normal + AO transfer) | [high-to-low baking](reference/high-to-low-baking.md) |
| Preparing UVs or a cage, or a bake shows seams, black faces, wrong highlights | [baking and diagnostics](reference/baking-and-diagnostics.md) |
| Choosing texture or mesh formats, or the asset is slow to load or heavy in GPU memory (KTX2, WebP, meshopt, Draco) | [asset delivery](reference/asset-delivery.md) |
| Before any long bake or scripted export pipeline | [preflight and recovery](reference/preflight-and-recovery.md) |
| The asset looks right in Blender and wrong in the game, or the cause could be either | [runtime parity and diagnostics](reference/runtime-parity-and-diagnostics.md) |
| The asset will be judged by eye (hero prop, character, building, environment) | [author and critic loop](reference/critic-loop.md) |
| Terrain, cliffs or rocks should look weathered (branching gullies and ridges, no simulation) | [terrain erosion](reference/terrain-erosion.md) |

These seven are loaded on demand, not by default. Five are ported from vercel-labs/vgpu (see Attribution); terrain erosion uses Rune Skovbo Johansen's filter (MPL 2.0, `scripts/erosion/`).

### Choose how to carry each detail before any bake

| Detail | Carry it as |
| --- | --- |
| Silhouette, openings, broad edges, tuft dimples, piping, moving parts | Real low-poly geometry |
| Fine bevel curvature and shallow relief the triangle budget cannot afford | Tangent-space normals baked from the dense source |
| Permanent cavities and contacts inside a rigid assembly | Baked AO |
| Fabric weave, grain, micro-texture | The existing tiled map at its own scale, never re-baked into a unique atlas |
| Contacts that change, directional shadows | Runtime lighting |

**Pick the cheapest carrier that passes the look check. Being under a texture budget is not a reason to
spend it.** A unique normal atlas is the last resort, for detail the triangle budget cannot hold: a
1024 px RGBA8 map with mips is 5.6 MB of GPU memory per asset, and it replaces a tiled map that every
copy of the material could have shared. If you try a bake and geometry plus the source's tiled maps
looks as good, ship the geometry and say so in the report.

Measured (2 Oct 2026, STRANDMON armchair, 233k to 12k triangles, two Astra runs, same brief): dimples kept
as geometry with the two original 256 px tiled maps = 0.46 MB download, 0.7 MB GPU textures. Same detail
baked into a unique 1152 px normal map = 1.19 MB download, 7.4 MB GPU textures, slightly closer from across
the room, slightly weaker up close, and a blind judge preferred the geometry version.

## Which representation: decide before modelling

For furniture reconstructed from photographs, datasheets or assembly instructions,
read [Furniture reconstruction checks](reference/furniture-reconstruction.md)
before generating geometry. It covers panel-relative coat-hook placement,
interior compartment counts and optional door/drawer articulation.

| Need | Representation | Why |
| --- | --- | --- |
| Hero or enemy character with a walk and attacks | imported rigged mesh (this skill, or the CC0 library: Quaternius, KayKit, Mixamo motions) | skinning, retargetable clips; procedural rigs read as mannequins |
| Weapon, prop, creature variant where silhouette, sockets, collision or code-driven variants matter | procedural three.js geometry or a small GLB kit part | controllable, cheap to vary per instance |
| Concept, icon, backdrop, card art | a generated 2D image used directly | never rebuilt as geometry |
| A reference image whose visible FORM must become a code model | `img2threejs` with its gates; say the result is a reconstruction, not extracted geometry | likeness is judged, not measured |

Pick once at the blueprint or stack-selection stage and record it with provenance (source, licence,
metres per unit, forward axis). Design after MengTo/Skills build-hybrid-game-assets (MIT).

## 1. The recipe

The concept image is the spec, not decoration. For every asset in a kit:

1. **Model every piece in Blender from the concept image** using loft/recess/
   greeble (§3). Grey-clay render it before touching a texture (§4, §10) —
   box-stacking hides under any lighting rig except flat grey + one hard key.
2. **Use a fitting registered photographic texture set or an image model** for
   photographic surfaces (ground, foliage, cloth). Record origin, license and
   physical scale; matching normal/roughness maps must remain aligned. Use an
   existing suitable licensed scan before generating a replacement; use Cycles nodes only for what
   genuinely varies by geometry (edge wear, per-plate tone), and flatten
   before export (§6).
3. **Screenshot-vs-concept loop.** Render next to the concept, same angle if
   possible, compare. Judge by measured numbers where you can (§10: tone
   percentiles, AO floor, draw calls), by eye where you can't (silhouette,
   chamfer read, material believability). Iterate until it reads as the
   concept, not until it "looks 3D".
4. **Export once clay AND texture both hold up.** A model that's flat-correct
   in clay but goes muddy after baking has a material bug, not a modelling
   bug — don't re-model to fix a bad bake.

## 2. Headless setup on gex44

Blender 5.2.0 LTS, x64, RTX 4000 Ada, at
`/root/blender-spike/blender-5.2.0-linux-x64/blender`.

**A. Direct subprocess** (matches the source game's `build_*.py` pattern):
```python
BLENDER = "/root/blender-spike/blender-5.2.0-linux-x64/blender"
cmd = [BLENDER, "--background", "--factory-startup", "--python-exit-code", "1", "--python", __file__,
       "--", "BUILD"] + extra_args
# script: `if 'BUILD' in sys.argv: blender_main(...)` else `drive(...)`
```
Split into `drive()` (host: subprocess + result check) and `blender_main()`
(only imports `bpy`/`bmesh` — importing them outside `-b` crashes with no
display). **Without `--python-exit-code 1`, Blender can exit 0 after a Python error.**
Set that flag, check the exit code and logs, and verify fresh output files.
Mesh/export validation still matters: a successful process is not visual proof.

**B. gex44 exec service** (`/opt/astra-blender/blender_exec_server.py`,
loopback `:8793`, token-guarded): POST a python script, get back stdout plus
render paths, for interactive iteration without a subprocess per call. Same
headless constraint — the script is a `blender_main`-shaped body, no GUI code.

Outputs land in the app's `public/models/` (or the GameKit pack's asset dir)
as `.glb` + `.webp`. Draft render: 64 samples / 1280x720 ≈ 2 s on an M-series
GPU (source game, Apple Silicon) — **gex44/RTX 4000 Ada timing is
unmeasured; get one real number before quoting a render budget.**

## 3. Modelling: loft, recess, greeble

Three techniques, in order of impact.

**Loft cross-sections, never stack primitives.**
```python
def oct_ring(w, h, cx, cz):
    a, b = w * 0.5, h * 0.5
    return [( a, b-cz), ( a-cx,  b), (-(a-cx),  b), (-a,  b-cz),
            (-a, -(b-cz)), (-(a-cx), -b), ( a-cx, -b), ( a, -(b-cz))]

def loft(name, sections, mat):    # sections: (y, w, h, cx, cz, dz)
    bm = bmesh.new()
    rings = [[bm.verts.new((x, y, z+dz)) for (x, z) in oct_ring(w, h, cx, cz)]
             for (y, w, h, cx, cz, dz) in sections]
    for A, B in zip(rings, rings[1:]):
        for i in range(8):
            j = (i+1) % 8
            bm.faces.new((A[i], A[j], B[j], B[i]))
    bm.faces.new(list(reversed(rings[0]))); bm.faces.new(rings[-1])
```
Keep the profile **stepped, not tapered** — a parallel midbody, a shoulder, a
blunt end. Steps are what the eye measures scale against.

**Cut detail into the skin**, not glued on top:
```python
sel = [f for f in bm.faces if pick(f)]
bmesh.ops.inset_region(bm, faces=sel, thickness=1.2, depth=0.0,
                       use_even_offset=True, use_boundary=True)
for f in sel:
    bmesh.ops.translate(bm, verts=list(f.verts), vec=f.normal.normalized()*-0.7)
    f.material_index = i_recess

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "sed -n '1,300p' build_heavy-bomber-opera.py" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
#!/usr/bin/env python3
"""Original 24 m assault bomber. Run with Blender 5.2 --background --python-exit-code 1.
Clean build: downloads CC0 inputs, models geometry, bakes Cycles PBR tiles, exports,
renders six liveries and checks pivots. Blender coordinates X left, Y aft, Z up.
Target: 50-110k triangles, <=9 materials, 1024 RGB/normal, 512 ORM, <12 MB.
Views: front hero, side orthographic, rear, underside articulation; 3 revision cap.
"""
import bpy, bmesh, math, os, json, urllib.request, subprocess, struct, random
from mathutils import Vector, Matrix
from pathlib import Path
import numpy as np
ROOT=Path(__file__).resolve().parent
TEX=ROOT/'textures'; TEX.mkdir(exist_ok=True)
OUT=ROOT/'baked'; OUT.mkdir(exist_ok=True)
random.seed(37)
bpy.ops.object.select_all(action='SELECT'); bpy.ops.object.delete(use_global=False)
for d in list(bpy.data.materials): bpy.data.materials.remove(d)
S=bpy.context.scene; S.unit_settings.system='METRIC'; S.unit_settings.scale_length=1
S.render.engine='CYCLES'; S.cycles.samples=32; S.cycles.use_denoising=True
P=bpy.context.preferences.addons['cycles'].preferences
P.compute_device_type='OPTIX'; P.get_devices()
for d in P.devices:d.use=(d.type!='CPU')
S.cycles.device='GPU'; S.cycles.max_bounces=6; S.cycles.transparent_max_bounces=8
S.render.image_settings.file_format='PNG'; S.render.film_transparent=False
S.view_settings.view_transform='AgX'; S.view_settings.look='AgX - Medium High Contrast'
S.render.resolution_percentage=100
GROUPS={}; MATS={}; ASSET=[]; PIVOTS={}
PAINTS=[('Gunmetal',[.20,.22,.24]),('Olive drab',[.23,.26,.14]),('Naval grey',[.38,.44,.49]),('Desert sand',[.52,.40,.23]),('Arctic white',[.75,.80,.83]),('Deep navy',[.035,.075,.135])]

def mat(name,col,metal=0,rough=.45):
 m=bpy.data.materials.new(name);m.use_nodes=True
 p=m.node_tree.nodes.get('Principled BSDF');p.inputs['Base Color'].default_value=(*col,1);p.inputs['Metallic'].default_value=metal;p.inputs['Roughness'].default_value=rough
 m.diffuse_color=(*col,1);MATS[name]=m;return m
paint=mat('Paint',PAINTS[0][1],.64,.4)
alloy=mat('Alloy',(.28,.31,.33),.85,.34)
carbon=mat('Carbon',(.032,.039,.044),.66,.5)
glass=mat('Glass',(.055,.105,.135),.12,.19)
p=glass.node_tree.nodes.get('Principled BSDF');p.inputs['Alpha'].default_value=.42;p.inputs['Transmission Weight'].default_value=.15
if hasattr(glass,'surface_render_method'):glass.surface_render_method='DITHERED'
engines=mat('Engines',(.25,.045,.008),.25,.4)
p=engines.node_tree.nodes.get('Principled BSDF');p.inputs['Emission Color'].default_value=(1,.18,.018,1);p.inputs['Emission Strength'].default_value=2.2
lamps=mat('Lamps',(.3,.5,.6),.1,.32)
# Shared tiny palette: red, green, ice blue, amber. UV positions select colours.
im=bpy.data.images.new('Lamp_palette',width=16,height=4)
cols=[(1,.012,.004,1),(.01,1,.11,1),(.25,.65,1,1),(1,.28,.015,1)]
im.pixels=[v for y in range(4) for x in range(16) for v in cols[x//4]]; im.filepath_raw=str(OUT/'Lamps.png');im.file_format='PNG';im.save()
nt=lamps.node_tree;t=nt.nodes.new('ShaderNodeTexImage');t.image=im;t.interpolation='Closest';p=nt.nodes.get('Principled BSDF');nt.links.new(t.outputs['Color'],p.inputs['Base Color']);nt.links.new(t.outputs['Color'],p.inputs['Emission Color']);p.inputs['Emission Strength'].default_value=2

def mesh(name,verts,faces,material=paint,group='Hull',bevel=0.02,segments=2):
 me=bpy.data.meshes.new(name);me.from_pydata(verts,[],faces);me.update()
 ob=bpy.data.objects.new(name,me);S.collection.objects.link(ob)
 me.materials.append(material)
 bm=bmesh.new();bm.from_mesh(me);bmesh.ops.recalc_face_normals(bm,faces=bm.faces);bm.to_mesh(me);bm.free()
 bpy.context.view_layer.objects.active=ob;ob.select_set(True)
 if bevel:
  mod=ob.modifiers.new('Machined edge radii','BEVEL');mod.width=bevel;mod.segments=segments
  if material==paint:
   me.materials.append(alloy);mod.affect='EDGES';mod.material=1
  bpy.ops.object.modifier_apply(modifier=mod.name)
 # Planar box mapping at 2 m per tile; all parts share the baked surface sets.
 uv=me.uv_layers.new(name='UVMap') if not me.uv_layers else me.uv_layers.active
 for f in me.polygons:
  no=f.normal;axis=max(range(3),key=lambda i:abs(no[i]));axes=[i for i in range(3) if i!=axis]
  for li in f.loop_indices:
   co=me.vertices[me.loops[li].vertex_index].co;uv.data[li].uv=(co[axes[0]]/2,co[axes[1]]/2)
 for f in me.polygons:f.use_smooth=False
 ob.select_set(False)
 GROUPS.setdefault(group,[]).append(ob);return ob

def box(name,c,size,ma=paint,gr='Hull',bev=.035):
 x,y,z=c;a,b,d=[v/2 for v in size]
 return mesh(name,[(x+i*a,y+j*b,z+k*d) for i,j,k in [(-1,-1,-1),(-1,-1,1),(-1,1,-1),(-1,1,1),(1,-1,-1),(1,-1,1),(1,1,-1),(1,1,1)]],[(0,4,6,2),(1,3,7,5),(0,1,5,4),(2,6,7,3),(0,2,3,1),(4,5,7,6)],ma,gr,bev)

def plate(name,pts,thick=.06,ma=paint,gr='Hull',bev=.018):
 pts=[Vector(v) for v in pts];n=(pts[1]-pts[0]).cross(pts[2]-pts[0]).normalized();N=len(pts)
 return mesh(name,[tuple(p+n*thick/2) for p in pts]+[tuple(p-n*thick/2) for p in pts],[tuple(range(N)),tuple(reversed(range(N,2*N)))]+[(i,(i+1)%N,(i+1)%N+N,i+N) for i in range(N)],ma,gr,bev)

def beam(name,a,b,r=.045,ma=alloy,gr='Hull',N=10):
 return cyl(name,a,b,r,ma,gr,N,bev=0)

def cyl(name,a,b,r,ma=alloy,gr='Hull',N=32,r2=None,bev=.008):
 a,b=Vector(a),Vector(b);z=(b-a).normalized();u=z.cross(Vector((0,0,1)))
 if u.length<.1:u=z.cross(Vector((0,1,0)))
 u.normalize();v=z.cross(u);r2=r if r2 is None else r2
 vs=[tuple(c+radius*(math.cos(i*2*math.pi/N)*u+math.sin(i*2*math.pi/N)*v)) for c,radius in [(a,r),(b,r2)] for i in range(N)]
 fs=[tuple(reversed(range(N))),tuple(range(N,2*N))]+[(i,(i+1)%N,(i+1)%N+N,i+N) for i in range(N)]
 ob=mesh(name,vs,fs,ma,gr,bev,1)
 for f in ob.data.polygons:
  if len(f.vertices)==4:f.use_smooth=True
 return ob

def tube(name,c,axis,profile,ma=alloy,gr='Hull',N=64):
 c=Vector(c);d=Vector(axis).normalized();u=d.cross(Vector((0,0,1)))
 if u.length<.1:u=d.cross(Vector((0,1,0)))
 u.normalize();v=d.cross(u)
 vs=[tuple(c+d*t+rad*(u*math.cos(i*2*math.pi/N)+v*math.sin(i*2*math.pi/N))) for t,rad in profile for i in range(N)]
 fs=[]
 for j in range(len(profile)):
  k=(j+1)%len(profile)
  for i in range(N):q=(i+1)%N;fs.append((j*N+i,j*N+q,k*N+q,k*N+i))
 ob=mesh(name,vs,fs,ma,gr,0)
 for f in ob.data.polygons:f.use_smooth=True
 return ob

def socket(name,world,parent=None):
 ob=bpy.data.objects.new(name,None);S.collection.objects.link(ob);ob.empty_display_size=.18
 if parent:
  ob.parent=parent;ob.location=parent.matrix_world.inverted()@Vector(world)
 else:ob.location=world
 ASSET.append(ob);return ob

def bolts_on_quad(pts,ma=alloy,gr='Hull',r=.035):
 a,b,c,d=map(Vector,pts);n=(b-a).cross(c-a).normalized()
 for u,v in [(.06,.09),(.94,.09),(.94,.91),(.06,.91)]:
  p=a*(1-u)*(1-v)+b*u*(1-v)+c*u*v+d*(1-u)*v
  cyl('Captive fastener',p+n*.04,p+n*.07,r,ma,gr,8,bev=.002)

def outline(name,pts,r=.035,ma=alloy,gr='Hull',closed=True):
 for i in range(len(pts) if closed else len(pts)-1):beam(name,pts[i],pts[(i+1)%len(pts)],r,ma,gr,8)

# Main hull: eight-faced continuous armoured loft, widening behind a blunt wedge nose.
SECS=[(-12,1.65,-1.13,-.14),(-10.65,2.35,-1.45,.35),(-7.8,3.0,-1.65,1.08),(-4.8,3.55,-1.72,1.58),(-1.7,3.95,-1.78,1.8),(2.1,4.15,-1.78,1.82),(6.6,4.2,-1.7,1.7),(9.6,3.95,-1.45,1.55),(10.65,3.72,-1.18,1.35)]
def ring(sec):
 y,w,bot,top=sec
 return [Vector(v) for v in [(w,y,bot+.65),(w,y,top-.65),(.70*w,y,top),(-.70*w,y,top),(-w,y,top-.65),(-w,y,bot+.65),(-.72*w,y,bot),(.72*w,y,bot)]]
rings=[ring(s) for s in SECS]
verts=[tuple(p) for r in rings for p in r];faces=[tuple(reversed(range(8))),tuple(range(64,72))]
for k in range(len(rings)-1):
 for j in range(8):faces.append((k*8+j,k*8+(j+1)%8,(k+1)*8+(j+1)%8,(k+1)*8+j))
core=mesh('Pressure hull',verts,faces,carbon,bevel=.075)
# Genuine cockpit recess cut through top skin; canopy is hollow and operable.
cut=box('Cockpit machining cutter',(0,-7.1,2.0),(2.1,6.1,2.7),carbon,gr='_cut',bev=.12)
bpy.context.view_layer.objects.active=core
mod=core.modifiers.new('Cockpit volume','BOOLEAN');mod.operation='DIFFERENCE';mod.object=cut;bpy.ops.object.modifier_apply(modifier=mod.name)
bpy.data.objects.remove(cut,do_unlink=True);GROUPS.pop('_cut')
cut=box('Bay machining cutter',(0,1,-2.0),(4.5,12.2,2.1),carbon,gr='_cut',bev=.08)
bpy.context.view_layer.objects.active=core
mod=core.modifiers.new('Open torpedo cassette','BOOLEAN');mod.operation='DIFFERENCE';mod.object=cut;bpy.ops.object.modifier_apply(modifier=mod.name)
bpy.data.objects.remove(cut,do_unlink=True);GROUPS.pop('_cut')
# Flush segmented plating; reveal of dark structure between plates gives real recessed seams.
for k,(r0,r1) in enumerate(zip(rings,rings[1:])):
 for j in range(8):
  if j==2 and k in (1,2):continue
  if j==6 and 2<=k<=6:continue # torpedo opening
  a,b=r0[j],r0[(j+1)%8];d,c=r1[j],r1[(j+1)%8]
  center=(a+b+c+d)/4
  pts=[tuple(center+(v-center)*.990) for v in [a,b,c,d]]
  normal=(b-a).cross(c-a).normalized()
  # outward shift from core, so the plate has real reveal with no coplanar surfaces.
  midpoint=(a+b+c+d)/4
  if normal.dot(Vector((midpoint.x,0,midpoint.z)))<0:normal=-normal
  pts=[tuple(Vector(v)+normal*.062) for v in pts]
  # Split the broad roof around cockpit rather than bridge its glazing.
  if j==2 and k==3:
   pass
  ob=plate('Armour panel',pts,.095,paint,bev=.025)
  if j in (0,1,3,4) and k>0:bolts_on_quad(pts,r=.033)
# Long chine reinforcements integrated into shoulder edges.
for sign in [-1,1]:
 for k in range(1,7):
  a=rings[k][1 if sign==1 else 4];b=rings[k+1][1 if sign==1 else 4]
  beam('Continuous shoulder cap',a+Vector((sign*.045,0,.1)),b+Vector((sign*.045,0,.1)),.055,alloy,N=8)
# Nose intake faces, dark recessed throats and stacked aero/thermal louvers.
for sign in [-1,1]:
 pts=[(sign*.24,-12.045,-.91),(sign*1.38,-12.045,-.91),(sign*1.43,-12.045,-.29),(sign*.26,-12.045,-.29)]
 plate('Nose radiator shadow',pts,.05,carbon,bev=.055)
 outline('Nose radiator lip',pts,.055,alloy)
 for i in range(6):
  z=-.84+i*.095
  beam('Nose radiator fin',(sign*.34,-12.10,z),(sign*1.29,-12.10,z),.025,carbon,N=8)
plate('Central prow armour',[(-.22,-12.08,-1.1),(.22,-12.08,-1.1),(.30,-12.08,-.12),(-.30,-12.08,-.12)],.1,paint,bev=.025)
# Side thermal exchangers, inset framed panels with 12 independent deep louvers.
for sign in [-1,1]:
 for y,w,span in [(-3.15,3.76,1.65),(3.6,4.22,1.30)]:
  x=sign*w
  pts=[(x,y-span/2,-.95),(x,y+span/2,-.95),(x,y+span/2,.80),(x,y-span/2,.80)]
  plate('Recessed exchanger well',pts,.13,carbon,bev=.10)
  outline('Exchanger cast surround',[(x+sign*.12,a,b) for _,a,b in pts],.09,alloy)
  for z in np.linspace(-.79,.65,12):beam('Heat exchanger slat',(x+sign*.105,y-span*.4,z),(x+sign*.105,y+span*.4,z),.045,carbon,N=8)
 # small lateral fixed housings / RCS sockets
 x=sign*3.05
 box('Flush RCS fairing',(x,-7.1,-.20),(.26,1.25,.32),alloy,bev=.1)
 for yy in [-7.48,-7.13,-6.78]:cyl('RCS port',(x+sign*.11,yy,-.20),(x+sign*.19,yy,-.20),.065,carbon,N=16)
# Raised service spine behind the cockpit, deliberately narrow and integrated.
spine=[(-4.5,1.02,1.55,1.92),(-2.8,1.18,1.72,2.1),(1.5,1.15,1.80,2.08),(7.8,1.14,1.60,1.93),(9.7,.95,1.5,1.77)]
for a,b in zip(spine,spine[1:]):
 y,w,lo,hi=a;Y,W,LO,HI=b
 pts=[(-w,y,hi),(w,y,hi),(W,Y,HI),(-W,Y,HI)]
 plate('Dorsal armoured spine',pts,.24,paint,bev=.07)
# cockpit well, stepped seats and instrument panels
box('Cabin black tub',(0,-7.25,.64),(1.92,5.65,.22),carbon,bev=.08)
for y,z in [(-7.9,.83),(-5.85,1.12)]:
 box('Seat suspension',(0,y,z),(.65,.68,.25),alloy,bev=.06)
 box('Seat cushion',(0,y,z+.18),(.68,.65,.20),carbon,bev=.09)
 box('Seat back',(0,y+.29,z+.61),(.69,.18,.75),carbon,bev=.08)
 box('Head restraint',(0,y+.32,z+1.04),(.43,.19,.24),carbon,bev=.065)
 for x in [-.23,.23]:box('Seat harness',(x,y+.175,z+.64),(.055,.035,.63),alloy,bev=.012)
 box('Instrument coaming',(0,y-.57,z+.65),(1.35,.25,.30),carbon,bev=.055)
 for x in [-.41,0,.41]:
  ob=box('Flight display',(x,y-.715,z+.68),(.28,.025,.16),lamps,bev=.015)
  for uv in ob.data.uv_layers.active.data:uv.uv=(.63,.5)
 beam('Control column',(0,y-.2,z+.25),(0,y-.37,z+.60),.035,carbon,N=12)
 beam('Control grip',(-.13,y-.37,z+.62),(.13,y-.37,z+.62),.04,alloy,N=12)
# Multi-pane framed greenhouse, side openings and compound sloped windscreen.
C=[(-10.4,.64,.37,.54),(-7.72,1.04,1.03,2.20),(-6.28,1.08,1.32,2.48),(-4.55,.98,1.56,2.43)]
for k,(a,b) in enumerate(zip(C,C[1:])):
 y,w,lo,hi=a;Y,W,LO,HI=b
 for sign in [-1,1]:
  pts=[(sign*w,y,lo),(sign*W,Y,LO),(sign*W*.79,Y,HI),(sign*w*.79,y,hi)]
  plate('Canopy side glazing',pts,.022,glass,'Canopy',.008)
  outline('Canopy armoured frame',pts,.055,paint,'Canopy')
 pts=[(-w*.79,y,hi),(w*.79,y,hi),(W*.79,Y,HI),(-W*.79,Y,HI)]
 plate('Forward windshield' if k==0 else 'Roof glazing',pts,.025,glass,'Canopy',.008)
 outline('Canopy roof frame',pts,.053,alloy,'Canopy')
# rear bulkhead closes canopy; hinge spans across the roof's aft lower edge.
y,w,lo,hi=C[-1]
plate('Canopy rear shell',[(-w,y,lo),(w,y,lo),(w*.79,y,hi),(-w*.79,y,hi)],.09,paint,'Canopy',.035)
beam('Canopy transverse hinge',(-1.05,-4.55,1.58),(1.05,-4.55,1.58),.10,alloy,'Canopy',24)
PIVOTS['Canopy']=((0,-4.55,1.58),(1,0,0),'Hull')
# Wings: cast wedge roots, broad short swept tip plates, bevelled thick edges.
for sign in [-1,1]:
 pts=[(sign*3.65,1.05,.30),(sign*5.0,2.45,.15),(sign*8,4.75,-.16),(sign*7.90,8.70,-.22),(sign*4,9.18,.15)]
 wing=plate('Short armoured wing',pts,.32,paint,bev=.075)
 # separate top skins leave narrow channels and provide load-bearing visual scale
 for j in range(3):
  ya=3.4+j*1.65;yb=ya+1.55
  p=[(sign*4.5,ya,.34),(sign*7.7,max(ya,4.85),-.02),(sign*7.65,yb+.1,-.02),(sign*4.5,yb,.34)]
  plate('Wing upper access plate',p,.045,paint,bev=.014)
 # deep triangular forward wing-root air scoop
 pts=[(sign*3.95,1.02,.6),(sign*5.1,2.38,.40),(sign*4.02,2.38,.0)]
 plate('Wing root scoop casing',pts,.28,alloy,bev=.06)
 for i in range(7):
  x=sign*(4.03+i*.12);y=1.25+i*.13
  beam('Wing root inlet vanes',(x,y,.39),(x,y+.69,.19),.028,carbon,N=8)
 # Wing-root dorsal armour housings.
 box('Wing actuator fairing',(sign*3.2,3.25,1.48),(1.20,3.35,.68),paint,bev=.15)
 for j in range(6):
  box('Dorsal cooling slot',(sign*3.2,2.18+j*.33,1.839),(.72,.105,.035),carbon,bev=.025)
 # Recessed tip lamps, housed in metal bezel; navigation side convention X+ is left.
 ob=cyl('Navigation lens',(sign*7.84,5.15,-.16),(sign*8,5.15,-.16),.07,lamps,N=20)
 for uv in ob.data.uv_layers.active.data:uv.uv=(.125 if sign==1 else .375,.5)
 # Two removable missiles on launch shoes, fixed to the hull in shipped closed pose.
 for j,x in enumerate([5.15,6.70]):
  x*=sign;yy=5.65+j*.35;zz=-.76
  box('Missile launch shoe',(x,yy,.0),(.22,1.85,.45),carbon,bev=.04)
  for sy in [yy-.55,yy+.55]:box('Pylon clamp',(x,sy,-.37),(.42,.18,.24),alloy,bev=.035)
  cyl('Missile body',(x,yy-1.25,zz),(x,yy+1.55,zz),.18,alloy,N=32,bev=.015)
  cyl('Missile ogive',(x,yy-1.92,zz),(x,yy-1.25,zz),.025,carbon,N=32,r2=.18,bev=.01)
  tube('Missile arming collar',(x,yy-1.0,zz),(0,1,0),[(0,.184),(.12,.184),(.12,.17),(0,.17)],carbon,N=32)
  for ang in [0,math.pi/2,math.pi,3*math.pi/2]:
   dx,dz=math.cos(ang),math.sin(ang)
   plate('Missile stabilizer',[(x+dx*.14,yy+.65,zz+dz*.14),(x+dx*.45,yy+1.2,zz+dz*.45),(x+dx*.45,yy+1.6,zz+dz*.45),(x+dx*.14,yy+1.5,zz+dz*.14)],.035,carbon,bev=.008)
# Belly bomb bay: long armoured cassette with separate centre-split doors and hinges.
box('Torpedo bay ceiling',(0,1,-.94),(4.6,12.3,.14),carbon,bev=.05)
for sign in [-1,1]:
 box('Torpedo bay sidewall',(sign*2.26,1,-1.43),(.15,12.1,1.0),carbon,bev=.04)
 beam('Torpedo suspension rail',(sign*.74,-4.7,-1.13),(sign*.74,6.7,-1.13),.07,alloy,N=12)
 for y in [-3.2,1.1,5.1]:
  cyl('Internal torpedo body',(sign*.74,y-1.5,-1.55),(sign*.74,y+1.4,-1.55),.26,carbon,N=24,bev=.01)
  cyl('Torpedo warhead',(sign*.74,y-1.95,-1.55),(sign*.74,y-1.5,-1.55),.045,alloy,N=24,r2=.26,bev=.01)
  box('Torpedo release clamp',(sign*.74,y,-1.27),(.65,.22,.25),alloy,bev=.035)
for sign,label in [(1,'L'),(-1,'R')]:
 gr='BayDoor_'+label
 pts=[(sign*.035,-5.05,-2.04),(sign*2.26,-5.05,-1.94),(sign*2.26,7.04,-1.94),(sign*.035,7.04,-2.04)]
 plate('Torpedo bay door',pts,.24,paint,gr,bev=.045)
 for yy in [-4.85,-1.0,2.85,6.8]:
  beam('Bay door cross rib',(sign*.16,yy,-2.185),(sign*2.15,yy,-2.09),.05,alloy,gr,N=8)
 for yy in [-4.5,-.8,2.9,6.5]:
  cyl('Bay hinge pin',(sign*2.28,yy-.28,-1.9),(sign*2.28,yy+.28,-1.9),.10,alloy,N=20)
  box('Bay hinge strap',(sign*2.15,yy,-1.98),(.35,.24,.19),carbon,gr,bev=.03)
 PIVOTS[gr]=((sign*2.26,1,-1.92),(0,0,-1),'Hull')
# Retracted service / landing doors flush in lower chine (no extended gear).
for sign in [-1,1]:
 for yy in [-6.7,8.1]:
  pts=[(sign*2.2,yy-.55,-1.57),(sign*3.0,yy-.55,-1.22),(sign*3.0,yy+.55,-1.22),(sign*2.2,yy+.55,-1.57)]
  plate('Closed service hatch',pts,.065,paint,bev=.025)
# Three main engines in a tight transverse row. Deep concentric nozzles and heat petals.
for e,x in enumerate([-2.58,0,2.58],1):
 z=.0
 tube('Engine armoured sleeve',(x,0,z),(0,1,0),[(8.9,1.29),(10.45,1.29),(11.65,1.18),(11.96,1.12),(11.96,.97),(11.55,.99),(10.4,1.10),(8.9,1.10)],carbon,N=64)
 for y,rad in [(10.30,1.30),(10.65,1.27),(11.82,1.15)]:
  tube('Engine rolled reinforcement',(x,y,z),(0,1,0),[(-.07,rad),(.07,rad),(.09,rad-.08),(-.09,rad-.08)],alloy,N=64)
 # Petals taper and reveal a black expansion gap between them.
 for k in range(18):
  a=2*math.pi*k/18+.024;b=2*math.pi*(k+1)/18-.024
  pts=[(x+1.30*math.cos(a),10.5,z+1.30*math.sin(a)),(x+1.30*math.cos(b),10.5,z+1.30*math.sin(b)),(x+1.145*math.cos(b),11.78,z+1.145*math.sin(b)),(x+1.145*math.cos(a),11.78,z+1.145*math.sin(a))]
  plate('Thermal nozzle petal',pts,.06,alloy,bev=.018)
  ang=(a+b)/2
  beam('Engine latch rail',(x+1.33*math.cos(ang),10.05,z+1.33*math.sin(ang)),(x+1.33*math.cos(ang),10.8,z+1.33*math.sin(ang)),.045,carbon,N=8)
 # Recessed amber annulus. Visible glow is inside, sockets at nozzle exits.
 tube('Combustion glow ring',(x,10.97,z),(0,1,0),[(0,.83),(.05,.83),(.05,.71),(0,.71)],engines,N=64)
 tube('Internal nozzle ribs',(x,11.0,z),(0,1,0),[(0,1.01),(.11,1.01),(.11,.94),(0,.94)],alloy,N=64)
 cyl('Engine dark throat',(x,10.78,z),(x,10.83,z),.90,carbon,N=64,bev=.02)
 cyl('Engine central spike',(x,10.84,z),(x,11.28,z),.36,alloy,N=48,r2=.15,bev=.015)
 for a in np.linspace(0,2*math.pi,24,endpoint=False):
  pts=[(x+.38*math.cos(a),10.87,z+.38*math.sin(a)),(x+.85*math.cos(a+.09),10.91,z+.85*math.sin(a+.09)),(x+.85*math.cos(a+.17),10.96,z+.85*math.sin(a+.17)),(x+.40*math.cos(a+.10),10.96,z+.40*math.sin(a+.10))]
  plate('Nozzle guide vane',pts,.025,carbon,bev=.006)
# Turrets have integral traverse rings and separate gun elevation cradles.
def turret(idx,pivot,width,depth,height,barrel_length,twin):
 x,y,z=pivot;gr='Turret_'+str(idx);gun='Gun_'+str(idx)

hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "sed -n '300,650p' build_heavy-bomber-opera.py" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
 x,y,z=pivot;gr='Turret_'+str(idx);gun='Gun_'+str(idx)
 cyl('Traverse race fixed',(x,y,z-.12),(x,y,z+.06),width*.59,alloy,N=64)
 cyl('Traverse skirt',(x,y,z),(x,y,z+.14),width*.55,carbon,gr,N=64)
 # angular six-sided turret shell, front mantlet recessed
 vs=[(x+sx*width*.5,y+sy*depth*.5,z+.13) for sx,sy in [(-1,-1),(1,-1),(1,1),(-1,1)]]+[(x+sx*width*.36,y+sy*depth*.35,z+height) for sx,sy in [(-1,-1),(1,-1),(1,1),(-1,1)]]
 mesh('Cast turret armour',vs,[(0,3,2,1),(4,5,6,7),(0,1,5,4),(1,2,6,5),(2,3,7,6),(3,0,4,7)],paint,gr,.065)
 zgun=z+height*.55;ygun=y-depth*.43
 cyl('Elevation trunnion',(x-width*.51,ygun,zgun),(x+width*.51,ygun,zgun),.26,alloy,gr,N=32)
 for sx in [-1,1]:
  box('Turret cheek applique',(x+sx*width*.44,y,z+height*.48),(.18,depth*.62,height*.6),paint,gr,bev=.05)
  for yy in [-.3,0,.3]:box('Turret cooling slit',(x+sx*width*.54,y+yy,z+height*.52),(.03,.055,height*.26),carbon,gr,bev=.008)
 box('Armoured sight hood',(x,y-depth*.06,z+height+.03),(.48,.55,.18),carbon,gr,bev=.045)
 offsets=[-.32,.32] if twin else [0]
 tips=[]
 for off in offsets:
  a=(x+off,ygun,zgun);end=(x+off,ygun-barrel_length,zgun)
  cyl('Gun receiver',(a[0],ygun+.20,zgun),(a[0],ygun-.65,zgun),.18,carbon,gun,N=32)
  cyl('Gun barrel',(a[0],ygun-.55,zgun),end,.075,alloy,gun,N=32,bev=.01)
  tube('Perforated barrel shroud',(a[0],ygun-.85,zgun),(0,-1,0),[(0,.15),(.65,.15),(.65,.105),(0,.105)],carbon,gun,N=32)
  for kk in range(5):
   yy=ygun-.9-kk*.12
   for sx in [-1,1]:cyl('Shroud cooling inset',(a[0]+sx*.148,yy,zgun),(a[0]+sx*.158,yy,zgun),.032,alloy,gun,N=10,bev=.002)
  tube('Muzzle brake',end,(0,1,0),[(0,.12),(.32,.12),(.32,.065),(0,.065)],carbon,gun,N=32)
  tips.append(end)
 PIVOTS[gr]=(pivot,(0,1,0),'Hull');PIVOTS[gun]=((x,ygun,zgun),(1,0,0),gr)
 return tips
TIPS1=turret(1,(0,.3,2.08),2.1,2.0,.93,2.7,True)
TIPS2=turret(2,(0,-9.2,-2.05),1.05,1.25,.55,1.75,False)
# Chin turret normally below hull: its armour extends upward; barrel lives under the nose.
# Additional restrained construction details, flush inspection panels and tie-down fittings.
for sign in [-1,1]:
 for y in [-.8,5.8,8.2]:
  x=sign*2.32;z=1.89 if y<3 else 1.77
  box('Flush roof inspection panel',(x,y,z),(.72,1.1,.075),paint,bev=.045)
  box('Recessed latch',(x,y-.28,z+.044),(.22,.10,.025),carbon,bev=.018)
  for xx in [-.25,.25]:
   for yy in [-.4,.4]:cyl('Panel screw',(x+xx,y+yy,z+.02),(x+xx,y+yy,z+.06),.03,alloy,N=8,bev=.002)
 for yy in [-4.6,7.9]:
  x=sign*3.2;z=1.65
  beam('Tie down handle',(x-.16,yy,z),(x-.16,yy,z+.16),.026,alloy,N=8)
  beam('Tie down handle',(x+.16,yy,z),(x+.16,yy,z+.16),.026,alloy,N=8)
  beam('Tie down handle',(x-.16,yy,z+.16),(x+.16,yy,z+.16),.026,alloy,N=8)
 # Belly longitudinal conduit with clamps, attached to bay surround.
 for yy in np.arange(-4,7,1.3):
  beam('Belly hydraulic conduit',(sign*2.55,yy,-1.73),(sign*2.55,yy+1.25,-1.73),.035,alloy,N=10)
  box('Conduit clamp',(sign*2.55,yy,-1.74),(.18,.10,.13),carbon,bev=.02)
# Beacon lens atop rear spine, one shared emissive material.
ob=cyl('Beacon lens',(0,7.2,1.95),(0,7.2,2.07),.085,lamps,N=20)
for uv in ob.data.uv_layers.active.data:uv.uv=(.875,.5)
print('GEOMETRY_BUILT',sum(len(v) for v in GROUPS.values()),flush=True)

# Join only rigid assemblies. Move vertex coordinates to the pivot without applying
# a moving node's transforms. Child local origins remain exact mechanical pivots.
OBJS={}
for name,parts in GROUPS.items():
 bpy.ops.object.select_all(action='DESELECT')
 for ob in parts:ob.select_set(True)
 bpy.context.view_layer.objects.active=parts[0];bpy.ops.object.join();ob=bpy.context.object;ob.name=name
 pivot=Vector(PIVOTS[name][0]) if name in PIVOTS else Vector((0,0,0))
 ob.data.transform(Matrix.Translation(-pivot));ob.location=pivot;OBJS[name]=ob;ASSET.append(ob)
 # recalculate normals and eliminate only true zero-area slivers before export
 bm=bmesh.new();bm.from_mesh(ob.data)
 bmesh.ops.triangulate(bm,faces=list(bm.faces))
 bad=[f for f in bm.faces if f.calc_area()<1e-8]
 if bad:bmesh.ops.delete(bm,geom=bad,context='FACES')
 bmesh.ops.recalc_face_normals(bm,faces=bm.faces);bm.to_mesh(ob.data);bm.free();ob.data.update()
for name,(pivot,axis,parent) in PIVOTS.items():
 ob=OBJS[name];par=OBJS[parent];ob.parent=par;ob.matrix_parent_inverse=Matrix.Identity(4);ob.location=Vector(pivot)-par.matrix_world.translation
bpy.context.view_layer.update()
# Normalize dimensions by editing mesh coordinates and pivot locations, not node transforms.
# Hinge axes all align with principal axes; this preserves exact shared pivot positions.
pts=[o.matrix_world@v.co for o in OBJS.values() for v in o.data.vertices]
lo=Vector(tuple(min(p[i] for p in pts) for i in range(3)));hi=Vector(tuple(max(p[i] for p in pts) for i in range(3)))
scale=Vector((16/(hi.x-lo.x),24/(hi.y-lo.y),5.5/(hi.z-lo.z)))
center=(lo+hi)/2;center.x=0
D=Matrix.Diagonal((*scale,1))
for ob in OBJS.values():ob.data.transform(D)
for name,ob in OBJS.items():
 if ob.parent:ob.location=Vector([ob.location[i]*scale[i] for i in range(3)])
 else:ob.location=Vector([(ob.location[i]-center[i])*scale[i] for i in range(3)])
# Put the Hull origin exactly at the asset COM frame without applying any moving transforms.
hull=OBJS['Hull'];offset=hull.location.copy();hull.data.transform(Matrix.Translation(offset));hull.location=(0,0,0)
for child in hull.children:child.location+=offset
bpy.context.view_layer.update()
def wp(p):return tuple((Vector(p)-center)[i]*scale[i] for i in range(3))
for e,x in enumerate([-2.58,0,2.58],1):socket('Thruster_'+str(e),wp((x,11.96,0)),OBJS['Hull'])
for i,p in enumerate(TIPS1,1):socket('Muzzle_'+str(i),wp(p),OBJS['Gun_1'])
socket('Muzzle_3',wp(TIPS2[0]),OBJS['Gun_2'])
for sign in [1,-1]:
 for j,x in enumerate([5.15,6.7]):socket('Hardpoint_'+str((0 if sign==1 else 2)+j+1),wp((sign*x,3.8+j*.35,-.76)),OBJS['Hull'])
for i,y in enumerate([-3.5,1,5.5],5):socket('Hardpoint_'+str(i),wp((0,y,-1.95)),OBJS['Hull'])
socket('Seat_Pilot',wp((0,-7.9,1.05)),OBJS['Hull']);socket('Seat_Copilot',wp((0,-5.85,1.3)),OBJS['Hull'])
socket('Camera_Chase',(0,21,8),OBJS['Hull'])
socket('Light_Nav_L',wp((8,5.15,-.16)),OBJS['Hull']);socket('Light_Nav_R',wp((-8,5.15,-.16)),OBJS['Hull']);socket('Light_Beacon',wp((0,7.2,2.07)),OBJS['Hull'])

# Non-exported photographic studio lights in open space. World camera background
# is a faint blue gradient; non-camera world rays provide soft neutral daylight.
world=bpy.data.worlds.new('Space gradient');S.world=world;world.use_nodes=True
n=world.node_tree.nodes;l=world.node_tree.links;n.clear();out=n.new('ShaderNodeOutputWorld');mix=n.new('ShaderNodeMixShader');lp=n.new('ShaderNodeLightPath');bg=n.new('ShaderNodeBackground');bg.inputs[0].default_value=(.18,.21,.27,1);bg.inputs[1].default_value=.38
sky=n.new('ShaderNodeBackground');tc=n.new('ShaderNodeTexCoord');sep=n.new('ShaderNodeSeparateXYZ');ramp=n.new('ShaderNodeValToRGB');ramp.color_ramp.elements[0].position=.0;ramp.color_ramp.elements[0].color=(.003,.005,.009,1);ramp.color_ramp.elements[1].position=.75;ramp.color_ramp.elements[1].color=(.018,.029,.052,1)
l.new(tc.outputs['Normal'],sep.inputs[0]);l.new(sep.outputs['Z'],ramp.inputs[0]);l.new(ramp.outputs[0],sky.inputs[0]);l.new(lp.outputs['Is Camera Ray'],mix.inputs[0]);l.new(bg.outputs[0],mix.inputs[1]);l.new(sky.outputs[0],mix.inputs[2]);l.new(mix.outputs[0],out.inputs[0])
def area(name,pos,power,size,color):
 d=bpy.data.lights.new(name,'AREA');d.energy=power;d.shape='DISK';d.size=size;d.color=color;o=bpy.data.objects.new(name,d);S.collection.objects.link(o);o.location=pos;o.rotation_euler=(-o.location).to_track_quat('-Z','Y').to_euler()
area('White upper front left key',(5,-12,19),8200,10,(1,.96,.90));area('Soft cool fill',(-12,-4,8),3800,13,(.64,.79,1));area('Aft edge light',(4,13,12),6200,9,(.76,.87,1));area('Belly bounce',(2,-4,-9),4200,10,(.7,.8,1));area('Camera-side broad fill',(17,-10,6),5000,12,(.9,.94,1))
camd=bpy.data.cameras.new('Render camera');cam=bpy.data.objects.new('Render camera',camd);S.collection.objects.link(cam);S.camera=cam;camd.type='ORTHO';camd.lens=50
HERO=(28,-35,22)
def camera(pos,ortho=30):
 cam.location=pos;cam.rotation_euler=(Vector((0,0,0))-cam.location).to_track_quat('-Z','Y').to_euler();camd.ortho_scale=ortho
camera(HERO,29.8)
def render(path,w=1920,h=1080,samples=32):
 S.render.resolution_x=w;S.render.resolution_y=h;S.cycles.samples=samples;S.render.filepath=str(ROOT/path);bpy.ops.render.render(write_still=True);print('RENDERED',path,flush=True)
clay=mat('QA clay',(.32,.34,.37),.0,.6)
S.view_layers[0].material_override=clay
render('clay.png',1920,1080,20)
S.view_layers[0].material_override=None
bpy.ops.wm.save_as_mainfile(filepath=str(ROOT/'geometry.blend'))

# Bake every textured surface from registered CC0 scans plus procedural fine wear.
# Shared 2m tiles preserve close viewing density across the entire ship.
def download(id,map):
 fn=f'{id}_{map}_1k.jpg';path=TEX/fn
 if not path.exists():
  url=f'https://dl.polyhaven.org/file/ph-assets/Textures/jpg/1k/{id}/{fn}'
  subprocess.run(['curl','-fL','--retry','2','-A','ForgeAssetBuilder/1.0',url,'-o',str(path)],check=True,stdout=subprocess.DEVNULL)
 return bpy.data.images.load(str(path),check_existing=True)

def bake_surface(ma,id,tone,metal,rough):
 print('BAKE_START',ma.name,flush=True)
 src=bpy.data.materials.new(ma.name+'_bake_source');src.use_nodes=True;nt=src.node_tree;n=nt.nodes;l=nt.links;n.clear()
 out=n.new('ShaderNodeOutputMaterial');bs=n.new('ShaderNodeBsdfPrincipled');l.new(bs.outputs[0],out.inputs[0])
 tc=n.new('ShaderNodeTexCoord');diff=n.new('ShaderNodeTexImage');diff.image=download(id,'diff');l.new(tc.outputs['UV'],diff.inputs[0])
 norm=n.new('ShaderNodeTexImage');norm.image=download(id,'nor_gl');norm.image.colorspace_settings.name='Non-Color';l.new(tc.outputs['UV'],norm.inputs[0])
 arm=n.new('ShaderNodeTexImage');arm.image=download(id,'arm');arm.image.colorspace_settings.name='Non-Color';l.new(tc.outputs['UV'],arm.inputs[0])
 sep=n.new('ShaderNodeSeparateColor');l.new(arm.outputs['Color'],sep.inputs[0])
 bw=n.new('ShaderNodeRGBToBW');l.new(diff.outputs[0],bw.inputs[0])
 ra=n.new('ShaderNodeValToRGB');ra.color_ramp.elements[0].position=.02;ra.color_ramp.elements[1].position=.16
 if ma==paint:
  ra.color_ramp.elements[0].color=(.48,.48,.48,1);ra.color_ramp.elements[1].color=(.95,.95,.95,1)
 else:
  ra.color_ramp.elements[0].color=(*[x*.55 for x in tone],1);ra.color_ramp.elements[1].color=(*[x*1.35 for x in tone],1)
 l.new(bw.outputs[0],ra.inputs[0])
 noise=n.new('ShaderNodeTexNoise');noise.inputs['Scale'].default_value=95;noise.inputs['Detail'].default_value=3;l.new(tc.outputs['UV'],noise.inputs[0])
 nr=n.new('ShaderNodeMapRange');nr.inputs['To Min'].default_value=.76;nr.inputs['To Max'].default_value=1;l.new(noise.outputs['Fac'],nr.inputs[0])
 mul=n.new('ShaderNodeMixRGB');mul.blend_type='MULTIPLY';mul.inputs[0].default_value=.32;l.new(ra.outputs[0],mul.inputs[1]);l.new(nr.outputs[0],mul.inputs[2]);l.new(mul.outputs[0],bs.inputs['Base Color'])
 nm=n.new('ShaderNodeNormalMap');nm.inputs['Strength'].default_value=.28;l.new(norm.outputs[0],nm.inputs['Color'])
 bump=n.new('ShaderNodeBump');bump.inputs['Strength'].default_value=.12;bump.inputs['Distance'].default_value=.004;l.new(noise.outputs['Fac'],bump.inputs['Height']);l.new(nm.outputs[0],bump.inputs['Normal']);l.new(bump.outputs[0],bs.inputs['Normal'])
 rr=n.new('ShaderNodeMapRange');rr.inputs['To Min'].default_value=rough-.08;rr.inputs['To Max'].default_value=rough+.16;l.new(sep.outputs['Green'],rr.inputs[0]);l.new(rr.outputs[0],bs.inputs['Roughness']);bs.inputs['Metallic'].default_value=metal
 bpy.ops.mesh.primitive_plane_add(size=2,location=(0,0,35));ob=bpy.context.object;ob.name='_BakeSurface';ob.data.materials.append(src)
 bake=n.new('ShaderNodeTexImage');n.active=bake
 def pass_image(name,res,typ,channel=None):
  img=bpy.data.images.new(ma.name+'_'+name,res,res,alpha=False);img.colorspace_settings.name='sRGB' if name=='BaseColor' else 'Non-Color';bake.image=img;n.active=bake
  if channel is not None:
   em=n.new('ShaderNodeEmission');l.new(channel,em.inputs[0]);l.new(em.outputs[0],out.inputs[0])
  bpy.ops.object.select_all(action='DESELECT');ob.select_set(True);bpy.context.view_layer.objects.active=ob;S.cycles.samples=12;S.render.bake.margin=8;S.render.bake.use_selected_to_active=False
  bpy.ops.object.bake(type=typ,pass_filter={'COLOR'} if typ=='DIFFUSE' else set())
  if channel is not None:l.new(bs.outputs[0],out.inputs[0])
  img.filepath_raw=str(OUT/(img.name+('.jpg' if name=='BaseColor' else '.png')));img.file_format='JPEG' if name=='BaseColor' else 'PNG';img.save();return img
 base=pass_image('BaseColor',1024,'EMIT',mul.outputs[0])
 normal=pass_image('Normal',1024,'NORMAL')
 # Pack true channels in the node graph, then Cycles EMIT bake to linear ORM.
 comb=n.new('ShaderNodeCombineColor');comb.mode='RGB';comb.inputs[0].default_value=1;l.new(rr.outputs[0],comb.inputs[1]);comb.inputs[2].default_value=metal
 orm=pass_image('ORM',512,'EMIT',comb.outputs[0])
 bpy.data.objects.remove(ob,do_unlink=True)
 # Portable PBR graph with glTF-compatible normal + packed occlusion/roughness/metallic.
 nt=ma.node_tree;n=nt.nodes;l=nt.links;n.clear();out=n.new('ShaderNodeOutputMaterial');bs=n.new('ShaderNodeBsdfPrincipled');l.new(bs.outputs[0],out.inputs[0])
 bt=n.new('ShaderNodeTexImage');bt.name='Baked_BaseColor';bt.image=base
 if ma==paint:
  factor=n.new('ShaderNodeMixRGB');factor.name='Faction colour';factor.blend_type='MULTIPLY';factor.inputs[0].default_value=1;factor.inputs[2].default_value=(*PAINTS[0][1],1);l.new(bt.outputs[0],factor.inputs[1]);l.new(factor.outputs[0],bs.inputs['Base Color'])
 else:l.new(bt.outputs[0],bs.inputs['Base Color'])
 no=n.new('ShaderNodeTexImage');no.image=normal;nm=n.new('ShaderNodeNormalMap');l.new(no.outputs[0],nm.inputs['Color']);l.new(nm.outputs[0],bs.inputs['Normal'])
 ot=n.new('ShaderNodeTexImage');ot.image=orm;sp=n.new('ShaderNodeSeparateColor');l.new(ot.outputs[0],sp.inputs[0]);l.new(sp.outputs['Green'],bs.inputs['Roughness']);l.new(sp.outputs['Blue'],bs.inputs['Metallic'])
 group=bpy.data.node_groups.get('glTF Material Output')
 if not group:
  group=bpy.data.node_groups.new('glTF Material Output','ShaderNodeTree');group.interface.new_socket(name='Occlusion',in_out='INPUT',socket_type='NodeSocketFloat')
 g=n.new('ShaderNodeGroup');g.node_tree=group;l.new(sp.outputs['Red'],g.inputs['Occlusion'])
 print('BAKE_DONE',ma.name,flush=True)
for ma,id,tone,met,rough in [(paint,'blue_metal_plate',(.8,.8,.8),.62,.37),(alloy,'metal_plate_02',(.28,.30,.32),.88,.32),(carbon,'metal_plate_02',(.035,.042,.05),.68,.46)]:bake_surface(ma,id,tone,met,rough)

# Export only gameplay nodes. Force direct texture path for exporter and patch
# baseColorFactor (glTF's faction colour multiplier), then restore render graph.
bpy.ops.object.select_all(action='DESELECT')
for o in ASSET:o.select_set(True)
nt=paint.node_tree;bs=next(n for n in nt.nodes if n.type=='BSDF_PRINCIPLED');bt=nt.nodes['Baked_BaseColor'];fac=nt.nodes['Faction colour'];nt.links.new(bt.outputs[0],bs.inputs['Base Color'])
glb=ROOT/'heavy-bomber-opera.glb'
bpy.ops.export_scene.gltf(filepath=str(glb),export_format='GLB',use_selection=True,export_yup=True,export_apply=False,export_animations=False,export_cameras=False,export_lights=False,export_extras=True,export_image_format='AUTO')
raw=glb.read_bytes();jlen=struct.unpack_from('<I',raw,12)[0];doc=json.loads(raw[20:20+jlen]);binary=raw[20+jlen:]
for m in doc['materials']:
 if m['name']=='Paint':m['pbrMetallicRoughness']['baseColorFactor']=[*PAINTS[0][1],1]
 if m['name']=='Glass':m['alphaMode']='BLEND';m['doubleSided']=True
j=json.dumps(doc,separators=(',',':')).encode();j+=b' '*((-len(j))%4)
glb.write_bytes(struct.pack('<III',0x46546c67,2,12+8+len(j)+len(binary))+struct.pack('<II',len(j),0x4e4f534a)+j+binary)
nt.links.new(fac.outputs[0],bs.inputs['Base Color'])
tris=sum(len(p.vertices)-2 for o in OBJS.values() for p in o.data.polygons)
assert 50000 <= tris <= 110000, f'Triangle budget: {tris}'
assert glb.stat().st_size <= 12_000_000, 'GLB size budget exceeded'
print('EXPORTED',tris,'triangles',glb.stat().st_size,'bytes',flush=True)
# Metadata in the delivered glTF frame (X left, Y up, Z nose).
def gltf(v):return [round(float(v[0]),6),round(float(v[2]),6),round(float(-v[1]),6)]
bpy.context.view_layer.update();pts=[o.matrix_world@v.co for o in OBJS.values() for v in o.data.vertices];bbmin=[min(p[i] for p in pts) for i in range(3)];bbmax=[max(p[i] for p in pts) for i in range(3)]
metadata={'asset':'heavy-bomber-opera','units':'metres','forward':'+Z','up':'+Y','left':'+X','bounding_box':{'min':[bbmin[0],bbmin[2],-bbmax[1]],'max':[bbmax[0],bbmax[2],-bbmin[1]],'dimensions':[16,5.5,24]},'triangles':tris,'materials':[m['name'] for m in doc['materials']],'file_bytes':glb.stat().st_size,'axes':{k:list(v[1]) for k,v in PIVOTS.items()},'paints':[{'name':n,'linear_rgb':v} for n,v in PAINTS],'nodes':{o.name:{'world_position':gltf(o.matrix_world.translation),'parent':o.parent.name if o.parent else None,'type':'mesh' if o.type=='MESH' else 'empty'} for o in ASSET}}
(ROOT/'nodes.json').write_text(json.dumps(metadata,indent=2))
(ROOT/'NOTES.md').write_text('\n'.join(["Original heavy space-opera assault bomber; 24 × 16 × 5.5 m; closed flight configuration, articulated turrets, canopy and bay doors.",f"Triangles: {tris:,}; GLB: {glb.stat().st_size/1048576:.2f} MiB; rigid assemblies joined; no lights or cameras exported.","Materials: Paint, Alloy, Carbon, Glass, Engines, Lamps; Paint neutral texture × linear gunmetal [0.20, 0.22, 0.24].","Textures: three shared Cycles-baked 1024² base/normal sets + 512² ORM; 16×4 lamp palette; 2 m physical tiling.","Poly Haven CC0 IDs: metal_plate_02, blue_metal_plate; https://polyhaven.com/a/metal_plate_02 ; https://polyhaven.com/a/blue_metal_plate ; licence https://polyhaven.com/license .","Reference differences: original segmented armour layout, revised canopy frames and circular nozzle petals; no lettering or insignia."])+ '\n')
# Production renders.
camera(HERO,29.8);render('final.png',1920,1080,48)
camera((32,0,1.5),28);render('side.png',1920,1080,28)
camera((23,33,16),29.8);render('rear.png',1440,900,24)
# Mechanical check: turn each moving part 30 degrees about its declared pivot.
base_locs={name:OBJS[name].location.copy() for name in PIVOTS}
for name in PIVOTS:
 ob=OBJS[name]
 if name.startswith('Turret'):ob.rotation_euler.z=math.radians(30)
 elif name.startswith('BayDoor'):ob.rotation_euler.y=math.radians(-30 if name.endswith('L') else 30)
 else:ob.rotation_euler.x=math.radians(30)
for name in PIVOTS:assert (OBJS[name].location-base_locs[name]).length<1e-8
camera((25,-30,-18),30);render('articulation.png',1440,900,24)
for name in PIVOTS:OBJS[name].rotation_euler=(0,0,0)
camera(HERO,29.8)
# Build six images into one 3x2 contact sheet without a dependency on Pillow.
frames=[]
for name,col in PAINTS:
 fac.inputs[2].default_value=(*col,1);render('_paint_'+name.replace(' ','_')+'.png',640,360,16)
 im=bpy.data.images.load(str(ROOT/('_paint_'+name.replace(' ','_')+'.png')),check_existing=False)
 frames.append(np.array(im.pixels[:],dtype=np.float32).reshape(360,640,4));bpy.data.images.remove(im)
canvas=np.zeros((720,1920,4),dtype=np.float32)
for i,pixels in enumerate(frames):canvas[(1-i//3)*360:(2-i//3)*360,(i%3)*640:(i%3+1)*640]=pixels
im=bpy.data.images.new('Six faction paints',1920,720);im.pixels.foreach_set(canvas.ravel());im.filepath_raw=str(ROOT/'paints.png');im.file_format='PNG';im.save()
fac.inputs[2].default_value=(*PAINTS[0][1],1)
bpy.ops.wm.save_as_mainfile(filepath=str(ROOT/'heavy-bomber-opera.blend'))
print('BUILD_COMPLETE',flush=True)

exec
/bin/bash -lc 'head -20 /tmp/heavy-bomber-critic-v2.txt; date -u' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
1. **Canopy greenhouse and rear step (Silhouette / Geometry)**
- **Evidence**: In [heavy-bomber-side-v2.png](file:///tmp/heavy-bomber-side-v2.png) and [heavy-bomber-final-v2.png](file:///tmp/heavy-bomber-final-v2.png), the glass canopy sticks up above the hull with an exposed vertical rear glass wall and thin mullions, unlike the faired armored spine in [sheet.jpg](file:///home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/sheet.jpg).
- **Correction**: Raise the dorsal hull spine flush with the canopy roof and thicken the canopy frame struts.
- **Acceptance**: Zero exposed rear vertical glass in side view; frame struts >=0.08 m wide.

2. **Pinched nose and missing cheek intakes (Silhouette / Geometry)**
- **Evidence**: [heavy-bomber-final-v2.png](file:///tmp/heavy-bomber-final-v2.png) has a narrow flat tip grille instead of the wide twin angled cheek intakes in [sheet.jpg](file:///home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/sheet.jpg), and [heavy-bomber-side-v2.png](file:///tmp/heavy-bomber-side-v2.png) shows a black shading artifact on the nose tip bevel.
- **Correction**: Build twin recessed cheek intakes flanking the nose and fix the nose tip normals.
- **Acceptance**: Twin recessed front intakes visible in 3/4 view; zero black shading triangles in side view.

3. **Wing root intersection and missing scoop (Surface Construction)**
- **Evidence**: In [heavy-bomber-side-v2.png](file:///tmp/heavy-bomber-side-v2.png), the flat wing slab clips directly through a vertical hull vent and has a thin rod on the leading edge instead of a faired wing-root intake.
- **Correction**: Add a thick wing-root fairing with a recessed forward intake scoop and clear the hull vent.
- **Acceptance**: Wing root >=2x tip thickness with a recessed intake opening and no vent clipping.

4. **Undersized chin gun and flat belly bay (Silhouette)**
- **Evidence**: In [heavy-bomber-side-v2.png](file:///tmp/heavy-bomber-side-v2.png), the chin gun barrel is stubby and the underbelly torpedo bay is a thin flat strip.
- **Correction**: Extend the chin barrel forward and extrude chamfered belly bay doors downward.
- **Acceptance**: Chin barrel projects past the lower nose bevel; belly doors add >=0.35 m depth in side view.

Fri Oct 16 18:53:39 UTC 2026

exec
/bin/bash -lc 'scp gex44:/root/fal-author/heavy-bomber-opera-v1/articulation.png /tmp/heavy-bomber-articulation-v2.png && scp gex44:/root/fal-author/heavy-bomber-opera-v1/rear.png /tmp/heavy-bomber-rear-v2.png && scp gex44:/root/fal-author/heavy-bomber-opera-v1/paints.png /tmp/heavy-bomber-paints-v2.png' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 3285ms:
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
codex
The visual review found several details worth correcting: the canopy needs a faired rear shoulder, the wing roots need deeper intake housings, and the nose has a shading defect. I’m fixing those and darkening the nozzle petals to give the engines a heat-worn finish.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "sed -n '298,345p' build_heavy-bomber-opera.py; rg -n 'coord|claim|release|owner' /tmp/heavy-bomber*log /tmp/heavy-bomber*txt /home/claude-agent/.agents/skills/blender-game-assets/reference/critic-loop.md" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
# Turrets have integral traverse rings and separate gun elevation cradles.
def turret(idx,pivot,width,depth,height,barrel_length,twin):
 x,y,z=pivot;gr='Turret_'+str(idx);gun='Gun_'+str(idx)
 cyl('Traverse race fixed',(x,y,z-.12),(x,y,z+.06),width*.59,alloy,N=64)
 cyl('Traverse skirt',(x,y,z),(x,y,z+.14),width*.55,carbon,gr,N=64)
 # angular six-sided turret shell, front mantlet recessed
 vs=[(x+sx*width*.5,y+sy*depth*.5,z+.13) for sx,sy in [(-1,-1),(1,-1),(1,1),(-1,1)]]+[(x+sx*width*.36,y+sy*depth*.35,z+height) for sx,sy in [(-1,-1),(1,-1),(1,1),(-1,1)]]
 mesh('Cast turret armour',vs,[(0,3,2,1),(4,5,6,7),(0,1,5,4),(1,2,6,5),(2,3,7,6),(3,0,4,7)],paint,gr,.065)
 zgun=z+height*.55;ygun=y-depth*.43
 cyl('Elevation trunnion',(x-width*.51,ygun,zgun),(x+width*.51,ygun,zgun),.26,alloy,gr,N=32)
 for sx in [-1,1]:
  box('Turret cheek applique',(x+sx*width*.44,y,z+height*.48),(.18,depth*.62,height*.6),paint,gr,bev=.05)
  for yy in [-.3,0,.3]:box('Turret cooling slit',(x+sx*width*.54,y+yy,z+height*.52),(.03,.055,height*.26),carbon,gr,bev=.008)
 box('Armoured sight hood',(x,y-depth*.06,z+height+.03),(.48,.55,.18),carbon,gr,bev=.045)
 offsets=[-.32,.32] if twin else [0]
 tips=[]
 for off in offsets:
  a=(x+off,ygun,zgun);end=(x+off,ygun-barrel_length,zgun)
  cyl('Gun receiver',(a[0],ygun+.20,zgun),(a[0],ygun-.65,zgun),.18,carbon,gun,N=32)
  cyl('Gun barrel',(a[0],ygun-.55,zgun),end,.075,alloy,gun,N=32,bev=.01)
  tube('Perforated barrel shroud',(a[0],ygun-.85,zgun),(0,-1,0),[(0,.15),(.65,.15),(.65,.105),(0,.105)],carbon,gun,N=32)
  for kk in range(5):
   yy=ygun-.9-kk*.12
   for sx in [-1,1]:cyl('Shroud cooling inset',(a[0]+sx*.148,yy,zgun),(a[0]+sx*.158,yy,zgun),.032,alloy,gun,N=10,bev=.002)
  tube('Muzzle brake',end,(0,1,0),[(0,.12),(.32,.12),(.32,.065),(0,.065)],carbon,gun,N=32)
  tips.append(end)
 PIVOTS[gr]=(pivot,(0,1,0),'Hull');PIVOTS[gun]=((x,ygun,zgun),(1,0,0),gr)
 return tips
TIPS1=turret(1,(0,.3,2.08),2.1,2.0,.93,2.7,True)
TIPS2=turret(2,(0,-9.2,-2.05),1.05,1.25,.55,1.75,False)
# Chin turret normally below hull: its armour extends upward; barrel lives under the nose.
# Additional restrained construction details, flush inspection panels and tie-down fittings.
for sign in [-1,1]:
 for y in [-.8,5.8,8.2]:
  x=sign*2.32;z=1.89 if y<3 else 1.77
  box('Flush roof inspection panel',(x,y,z),(.72,1.1,.075),paint,bev=.045)
  box('Recessed latch',(x,y-.28,z+.044),(.22,.10,.025),carbon,bev=.018)
  for xx in [-.25,.25]:
   for yy in [-.4,.4]:cyl('Panel screw',(x+xx,y+yy,z+.02),(x+xx,y+yy,z+.06),.03,alloy,N=8,bev=.002)
 for yy in [-4.6,7.9]:
  x=sign*3.2;z=1.65
  beam('Tie down handle',(x-.16,yy,z),(x-.16,yy,z+.16),.026,alloy,N=8)
  beam('Tie down handle',(x+.16,yy,z),(x+.16,yy,z+.16),.026,alloy,N=8)
  beam('Tie down handle',(x-.16,yy,z+.16),(x+.16,yy,z+.16),.026,alloy,N=8)
 # Belly longitudinal conduit with clamps, attached to bay surround.
 for yy in np.arange(-4,7,1.3):
  beam('Belly hydraulic conduit',(sign*2.55,yy,-1.73),(sign*2.55,yy+1.25,-1.73),.035,alloy,N=10)
  box('Conduit clamp',(sign*2.55,yy,-1.74),(.18,.10,.13),carbon,bev=.02)
/home/claude-agent/.agents/skills/blender-game-assets/reference/critic-loop.md:54:  view plus crop or image coordinates), the visible symptom, a suggested correction and a

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "cat > /tmp/refine_bomber_v3.py <<'PY'
from pathlib import Path
p=Path('/home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/build_heavy-bomber-opera.py')
s=p.read_text()
s=s.replace(\"(.055,.105,.135),.12,.19\", \"(.025,.052,.075),.08,.16\")
s=s.replace(\"default_value=.42;p.inputs['Transmission Weight'].default_value=.15\", \"default_value=.34;p.inputs['Transmission Weight'].default_value=.22\")
s=s.replace(\"(-12,1.65,-1.13,-.14)\",\"(-12,2.02,-1.30,.06)\")
s=s.replace(\"y,w,bot,top=sec\\n return\", \"y,w,bot,top=sec\\n cham=min(.65,(top-bot)*.24)\\n return\")
s=s.replace('bot+.65','bot+cham').replace('top-.65','top-cham')
s=s.replace(\"pts=[(sign*.24,-12.045,-.91),(sign*1.38,-12.045,-.91),(sign*1.43,-12.045,-.29),(sign*.26,-12.045,-.29)]\", \"pts=[(sign*.34,-12.10,-1.09),(sign*1.70,-12.10,-1.09),(sign*1.79,-12.10,-.17),(sign*.28,-12.10,-.17)]\")
s=s.replace(\"z=-.84+i*.095\", \"z=-.98+i*.14\")
s=s.replace(\"(sign*.34,-12.10,z),(sign*1.29,-12.10,z)\",\"(sign*.43,-12.15,z),(sign*1.60,-12.15,z)\")
s=s.replace(\"(.30,-12.08,-.12),(-.30,-12.08,-.12)\",\"(.30,-12.16,.0),(-.30,-12.16,.0)\")
start=s.index('# Side thermal exchangers')
end=s.index(' # small lateral fixed housings',start)
s=s[:start]+'''# Recessed thermal exchangers follow the actual hull taper to avoid burying fins.
def hull_at(y):
 for a,b in zip(SECS,SECS[1:]):
  if a[0]<=y<=b[0]:
   t=(y-a[0])/(b[0]-a[0]);return [a[i]*(1-t)+b[i]*t for i in range(1,4)]
 return list(SECS[0 if y<SECS[0][0] else -1][1:])
for sign in [-1,1]:
 y=-3.2;span=1.7
 def vx(yy,extra=0):return sign*(hull_at(yy)[0]+.10+extra)
 pts=[(vx(y-span/2),y-span/2,-.94),(vx(y+span/2),y+span/2,-.94),(vx(y+span/2),y+span/2,.77),(vx(y-span/2),y-span/2,.77)]
 plate('Recessed exchanger well',pts,.12,carbon,bev=.08)
 outline('Exchanger cast surround',[(x+sign*.10,a,b) for x,a,b in pts],.075,alloy)
 for z in np.linspace(-.79,.62,12):beam('Heat exchanger slat',(vx(y-span*.4,.10),y-span*.4,z),(vx(y+span*.4,.10),y+span*.4,z),.042,carbon,N=8)
''' + s[end:]
s=s.replace(\"spine=[(-4.5,1.02,1.55,1.92),(-2.8,1.18,1.72,2.1)\",\"spine=[(-4.52,1.02,1.55,2.43),(-2.8,1.18,1.72,2.17)\")
s=s.replace(\"plate('Dorsal armoured spine',pts,.24,paint,bev=.07)\",\"\"\"plate('Dorsal armoured spine',pts,.18,paint,bev=.055)
 for sign in [-1,1]:
  plate('Dorsal spine sidewall',[(sign*w,y,lo),(sign*W,Y,LO),(sign*W,Y,HI),(sign*w,y,hi)],.10,paint,bev=.03)\"\"\")
s=s.replace(\"outline('Canopy armoured frame',pts,.055,paint,'Canopy')\", \"outline('Canopy armoured frame',pts,.086,paint,'Canopy')\")
s=s.replace(\".025,glass,'Canopy',.008)\",\".025,glass if k<2 else paint,'Canopy',.008)\")
s=s.replace(\"outline('Canopy roof frame',pts,.053,alloy,'Canopy')\", \"outline('Canopy roof frame',pts,.075,paint,'Canopy')\")
start=s.index(' # deep triangular forward wing-root air scoop')
end=s.index(' # Wing-root dorsal armour housings.',start)
s=s[:start]+''' # Thick tapered wing-root casting, with an open forward-facing recessed intake.
 front=[(sign*4.03,.72,-.18),(sign*5.28,1.48,-.18),(sign*5.28,1.48,.79),(sign*4.03,.72,.91)]
 rear=[(sign*4.12,4.3,-.12),(sign*5.40,4.3,-.12),(sign*5.40,4.3,.27),(sign*4.12,4.3,.57)]
 for j in range(4):plate('Wing root cast fairing',[front[j],front[(j+1)%4],rear[(j+1)%4],rear[j]],.10,paint,bev=.045)
 throat=[(x,y+.12,z) for x,y,z in front]
 plate('Wing root recessed throat',throat,.045,carbon,bev=.035)
 outline('Wing root intake lip',front,.085,alloy)
 for t in np.linspace(.12,.88,8):
  x=sign*(4.03+1.25*t);y=.72+.76*t
  beam('Vertical intake vane',(x,y+.035,-.08),(x,y+.035,.80-.12*t),.030,carbon,N=8)
''' + s[end:]
s=s.replace(\"(sign*.035,-5.05,-2.04)\",\"(sign*.035,-5.05,-2.22)\").replace(\"(sign*.035,7.04,-2.04)\",\"(sign*.035,7.04,-2.22)\")
s=s.replace(\"pts,.24,paint,gr,bev=.045)\",\"pts,.36,paint,gr,bev=.055)\")
s=s.replace(\"(sign*.16,yy,-2.185),(sign*2.15,yy,-2.09)\",\"(sign*.16,yy,-2.40),(sign*2.15,yy,-2.15)\")
s=s.replace(\" PIVOTS[gr]=((sign*2.26,1,-1.92)\",\"\"\" for yy in [-3.0,.85,4.70]:
  for direction in [-1,1]:
   beam('Bay embossed diagonal',(sign*.28,yy+direction*1.4,-2.36),(sign*2.05,yy-direction*1.4,-2.17),.028,carbon,gr,N=8)
 PIVOTS[gr]=((sign*2.26,1,-1.92)\"\"\")
s=s.replace(\"plate('Thermal nozzle petal',pts,.06,alloy\", \"plate('Thermal nozzle petal',pts,.06,carbon\")
s=s.replace(\"1.05,1.25,.55,1.75,False)\",\"1.25,1.40,.65,2.85,False)\")
# Avoid simple full-height panel boundaries with mounted angled armor panels crossing them.
start=s.index('# Beacon lens atop rear spine')
s=s[:start]+'''# Staggered side applique, angled access hatches and flush attachment hardware.
for sign in [-1,1]:
 for yc,span in [(-6.1,2.35),(-.10,2.65),(6.25,2.25)]:
  ya=yc-span/2;yb=yc+span/2
  poly=[(ya,-.67),(yb-.22,-.67),(yb,-.43),(yb,.43),(yb-.26,.63),(ya+.18,.63),(ya,.43)]
  pts=[(sign*(hull_at(y)[0]+.105),y,z) for y,z in poly]
  plate('Stepped side applique',pts,.055,paint,bev=.022)
  for y,z in [(ya+.21,-.48),(yb-.27,-.48),(ya+.23,.43),(yb-.3,.39)]:
   x=sign*(hull_at(y)[0]+.155)
   cyl('Flush armor attachment',(x,y,z),(x+sign*.025,y,z),.032,alloy,N=8,bev=.003)
  x=sign*(hull_at(yc)[0]+.15)
  box('Recessed access lever',(x,yc+.4,.32),(.04,.34,.07),carbon,bev=.025)
# Structured aft deck: low trapezoid service housings and paired louver banks.
for sign in [-1,1]:
 for yc in [4.5,7.4]:
  pts=[(sign*1.3,yc-.65,1.90),(sign*2.65,yc-.65,1.90),(sign*2.65,yc+.65,1.79),(sign*1.3,yc+.65,1.79)]
  plate('Aft deck service module',pts,.14,paint,bev=.04)
  for yy in np.linspace(yc-.45,yc+.4,6):
   zz=1.98-(yy-(yc-.65))*.085
   beam('Aft deck cooling louver',(sign*1.55,yy,zz),(sign*2.42,yy,zz),.032,carbon,N=8)
''' +s[start:]
p.write_text(s)
PY
python /tmp/refine_bomber_v3.py
python -m py_compile build_heavy-bomber-opera.py
scp build_heavy-bomber-opera.py gex44:/root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py
ssh gex44 '/root/blender-spike/blender-5.2.0-linux-x64/blender -b --python-exit-code 1 --python /root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py > /root/fal-author/heavy-bomber-opera-v1/build-v3.log 2>&1'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "ssh gex44 \"pgrep -af 'blender.*heavy-bomber-opera-v1/build_heavy-bomber-opera.py'\"" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 474ms:
3877825 bash -c /root/blender-spike/blender-5.2.0-linux-x64/blender -b --python-exit-code 1 --python /root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py > /root/fal-author/heavy-bomber-opera-v1/build-v3.log 2>&1
3877826 python3 /opt/gpu-gate/gpu_gate.py --name blender --need-mib 6000 --priority batch -- /root/blender-spike/blender-5.2.0-linux-x64/blender.real -b --python-exit-code 1 --python /root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py
3877862 /root/blender-spike/blender-5.2.0-linux-x64/blender.real -b --python-exit-code 1 --python /root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "ssh gex44 kill -TERM 3877862
python3 /tmp/refine_bomber_v3.py
python3 -m py_compile build_heavy-bomber-opera.py
scp build_heavy-bomber-opera.py gex44:/root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py
ssh gex44 '/root/blender-spike/blender-5.2.0-linux-x64/blender -b --python-exit-code 1 --python /root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py > /root/fal-author/heavy-bomber-opera-v1/build-v3.log 2>&1'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 exited 143 in 12169ms:
/bin/bash: line 84: python: command not found
/bin/bash: line 85: python: command not found

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "ssh gex44 'tail -12 /root/fal-author/heavy-bomber-opera-v1/build-v3.log'; sed -n '1,110p' /home/claude-agent/.agents/skills/blender-game-assets/reference/critic-loop.md" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
exec
/bin/bash -lc 'ls /tmp/heavy-bomber-runtime/node_modules; python3 /home/claude-agent/.agents/skills/blender-game-assets/scripts/audit_glb.py --help' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 386ms:
playwright
playwright-core
three
usage: audit_glb.py [-h] [--strict] [--rig]
                    [--require-sockets REQUIRE_SOCKETS]
                    glb

Read-only audit of uncompressed GLB triangle meshes; requires numpy. Report
mode exits 0 even with findings. --strict exits 1 for findings. Invalid or
unsupported input exits 2. This is not a complete glTF validator.

positional arguments:
  glb

options:
  -h, --help            show this help message and exit
  --strict
  --rig                 print the skin/joint report (always computed; this
                        only keeps it in the output)
  --require-sockets REQUIRE_SOCKETS
                        comma-separated node names that must exist (e.g.
                        target,ground,vfx-hit,vfx-death)

 succeeded in 634ms:
INFO gpu_gate: gpu slot acquired by blender (pid 3879270, 6000 MiB, batch)
00:00.617  cycles           | WARNING HIPEW initialization failed: Error opening HIP dynamic library
/root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py:31: DeprecationWarning: 'Material.use_nodes' is expected to be removed in Blender 6.0
  m=bpy.data.materials.new(name);m.use_nodes=True
<!-- Distilled from vercel-labs/vgpu .claude/skills/vgpu-agent-flow/references/asset-iteration.md and
.subharness/agents/asset-author.ts + asset-critic.ts at commit 68cb1d8d198c (MIT, Copyright (c) 2025 Vercel, Inc.),
rewritten for Forge lanes (forge-agent, Astra author, a second model family as critic). -->

# Author and critic loop for a Blender asset

Use this for any authored asset that will be judged by eye: a hero prop, a character, a building, an
environment. Skip it for a mechanical re-export.

## Seats

| Seat | Who | Owns |
| --- | --- | --- |
| Author | Astra (operator law: Blender work goes to Astra) | Geometry, authored materials, UVs, bakes, Blender renders, the export |
| Runtime | The root, or one worker when the shader work is real | Loading the export in the game's actual three.js path, captures, measured costs |
| Critic | A different model family from the author, reading the real images | Findings only. Never edits the asset |

The critic must open the actual capture files. A critic that cannot read images says so and returns
BLOCKED; it never writes a visual verdict from metrics or from the author's description.

## Budget

- Default: **3 revisions, at most 2 critic passes per revision.** The brief may set another cap.
- A cap is an execution limit, not acceptance. Cap reached with open visual findings = `REVISE`
  reported as such, never a `PASS`.
- No unattended improvement loop past the cap.

## Before the first render

Write in the task folder: scope, target cameras (gameplay view, hero, rear, closest required view),
output paths, budgets (triangles, exported vertices, texture bytes and GPU memory, draw calls) and
the revision cap. Budgets are task inputs; do not copy another asset's numbers.

Run the [preflight](preflight-and-recovery.md) once: Blender starts and runs a scene operation, a
tiny bake and export round-trips through the real loader, one real runtime frame is captured.

Integrate a cheap LOW blockout in the runtime at this stage. Scale, axis, camera and material
contract problems are found before an expensive bake, not after.

## Each revision keeps

- the source revision or parameters that rebuild the previous asset;
- real hero, rear and close-up captures, same camera, light, exposure and pose every time;
- triangles, exported vertices, primitives, material count, file bytes, texture GPU memory;
- runtime draw counters, kept apart from offline estimates;
- the critic's findings, the fixes chosen, and the next measured result.

## The critic pass

The critic receives the previous AND the current captures and metrics under matched cameras (or
an explicit "first revision, no baseline"), the reference image, and the brief. It returns:

- **at most five findings**, ordered by impact, each with a stable id, the evidence path (whole
  view plus crop or image coordinates), the visible symptom, a suggested correction and a
  **measurable acceptance condition**;
- regressions against the previous revision;
- resolved / remaining / regressed status of earlier findings on a follow-up pass;
- `PASS`, `REVISE` or `BLOCKED`, with the limits of its evidence.

It compares against the reference as well as the previous revision: clean topology and progress
since last time do not make the asset match the reference. It separates the observed defect from
the suspected cause. A small whole-image difference can hide severe local damage (thin trim,
stairs, silhouette edges): it inspects crops at each delivered LOD. Design ideas are suggestions,
not new acceptance requirements.

When the cause could be the asset or the renderer, it asks for the diagnostic captures in
[runtime parity](runtime-parity-and-diagnostics.md) (maps off, AO neutral, lightmap off) rather
than guessing.

## Rules that stop false passes

- A generated concept image is never proof of a working model. Label concepts as concepts; accept
  only on real renders of the real export.
- Requested bakes need bake provenance (what was baked, from what, at what settings) and matched
  runtime captures with each contribution switched off in turn. Vertex tint and runtime shadows
  are not substitutes for a requested AO or lightmap bake.
- An atlas repair is checked on the full matched views, not only on the crop that was broken: a new
  layout can fix one edge and turn another face black.
- One writer per handoff file. A reply never gets appended to a request file another agent will
  regenerate. Superseded manifests and failed captures stay on disk.
- The author hands the root a compact result: verdict, the few decisive images, the metrics table.
  Full capture sets stay on disk; the root does not load every image.
- A user's rejection or a changed brief reopens any earlier `PASS`.

## Lessons

When a revision teaches something that will recur, write it as: evidence path, symptom, cause,
intervention, matched before/after result, scope. The root checks it and makes a narrow edit to this
skill. Reject task-specific style preferences dressed up as general rules.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "rg -n 'coord|claim|release' /home/claude-agent/AGENTS.md" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
28:- **local** `204.168.129.84` — orchestrator. Opus planning, this memory store, the `coord` bus. No app/infra runs here.
62:- **Usable result before tooling expansion:** define the smallest visible end-to-end outcome and deliver it early. Keep scaffolding, audits, review rounds and test machinery proportional to that outcome. Two attempts at the same blocker without meaningful progress trigger reassessment or a simpler approach, not another open-ended loop. Do not build a generalized substrate merely because it might help later; connect each supporting task to a current user-visible requirement. Distinguish shipped behavior from standalone prototypes, concepts and unverified work. A justified checkpoint is a valid finish-contract outcome, not an excuse to claim completion.
67:- **Visual quality is the product**: every change touching templates/prompts must be visually validated before claiming success. "It builds and deploys" ≠ "it looks right".
69:- **Shared harness across models:** agentic workers must receive the same applicable project rules, task-relevant skills, authorized tool/MCP access, coordination and secret guards through their adapter. Load skills selectively, not all at once. Preserve isolation and task-specific permissions; equal harness support does not grant broader authority. Missing wiring is an adapter gap to report or fix, not a reason to declare a model incapable. Verify the chosen lane rather than assuming every helper inherits the full setup.
70:- **Worker model selection:** choose and explicitly pass the least expensive capable model for each task; do not copy the root model/effort automatically or mix models just for variety. **Every Gemini call is Gemini 4 Argon (operator, 15 Oct 2026; never 3.8 Flash or 2.5):** agentic work through the Antigravity CLI (`agy4`), single-shot calls through the gateway with a thinking level (Gemini 4 refuses budgets; its thinking counts against max_tokens). Gemini 4 (`forge:build-gemini-4`, `-low`, `-high`) is eligible for bounded coding, investigation and review. Local builders use `forge-agent run --harness gemini --model forge:build-gemini-4 --repo <repo> --purpose <task> --task <brief>` with a bounded `--timeout`; since 14 Oct 2026 this runs Google's Antigravity CLI (`agy4`, `forge-hub/agent/AGY4.md`) with the shared rules, skills, Forge MCP and our guards bridged as agy hooks, every call to Vertex project forge-dev-492809 (Google grant); `FORGE_GEMINI_HARNESS=claude-code` or `--jail` = the old Claude Code lane. Proven locally with actual Gemini responses, MCP skill/coord calls, file edits, tests and a blocked secret-guard probe. `--harness gemini-proxy` remains the single-shot no-tools helper for tasks that need no tools. The local Gemini builder currently rejects optional `--jail`; never imply that it ran in a container sandbox. Use `gpt-5.6-luna` for narrow mechanical work, `gpt-5.6-terra` for exploration and bounded implementation, `gpt-6.1-sol` (Sol) for demanding implementation/debugging/review, and `gpt-6-astra` for unusually difficult architecture or reasoning. **Sol = `gpt-6.1-sol` (operator, 2026-09-30):** every Sol request runs GPT-6.1 Sol (Codex CLI >= 0.159.2; 0.156 gets a 400). `sol`/`solx` call it, and the Engine swaps `gpt-6-sol` and `gpt-5.6-sol` for it at launch (`cli/sonnet_retire.py` LATEST_VERSION, also inside `run_tracked_codex_cli`). `gpt-6-luna` (Codex CLI >= 0.156.0) is the GPT-6 option for the Luna tier; not benchmarked yet, so `gpt-5.6-luna` stays the Luna default until a measured run shows it is worth its cost. Claude CLI workers use `--model sonnet`, which is **Sonnet 5.5 only** on this box (alias pinned in `~/.claude/settings.json` since 2026-09-28; never Sonnet 5; the Engine still remaps Sonnet to Opus 5.5). **Haiku 5.5 (2026-10-08):** `--model haiku` = `claude-haiku-5-5` everywhere (alias pinned in `~/.claude/settings.json`; the Engine seam upgrades `haiku`/`claude-haiku-4-5` at launch): $0.10 in / $0.50 out per MTok, 1M context, default effort medium. Use it for classification, extraction, routing, yes/no gates, judges and cheap subagents at effort low or medium; `haikux "prompt"` one-shot, `review --by haiku` for the cheapest second look (same family, not independent), panel seat `haiku-local`. Always pass `--effort`: low for mechanical edits, medium by default, high only for creative or hard work (and for benchmarks, the same effort as the run it is compared with). Native Codex defaults are Terra/medium; explicitly select low effort for straightforward tasks and high only where the reasoning warrants it. Prefer a different family for independent judgment when useful. Escalate after evidence of a capability limit instead of repeated cheap retries; name unavailable models and use a supported alternative. Codex mixed-model spawns use `fork_turns="none"` with a self-contained brief; full-history forks inherit the parent's model and effort.
77:(safety = the PreToolUse secret + coordination guards, not a sandbox):
97:store, coordination protocol, standing laws; `forge-hub/agent/harness_env.py`),
99:memory/skills/coordination. Docs: `forge-hub/agent/DEEPSEEK.md`, `GEMINI.md`.
130:in `.harness/mcpc` (closed when the run ends) that makes coord calls as the worker. No resume yet. The Codex CLI itself: `--harness
153:**Max plan API credits (2026-10-08):** each Max 20x plan gives $200/month (Max 5x $100) of Claude Platform credit, claimed on
157:Not claimed yet. Memory `reference_max_plan_monthly_api_credits_2026_10_08.md`.
179:- Task agents from Claude, GPT, Gemini or DeepSeek: `forge-agent run --harness deepseek --model deepseek-flash --repo <git-repo> --purpose <task> --task <brief> --timeout 900`. Same isolated worktrees, shared Forge MCP memory/skills/coord, hooks and finish rules. DeepSeek orchestrators can call the other `forge-agent` harnesses; workers do not recursively delegate.
180:- Thin adapter: `forge-hub/agent/deepseek_worker.py`, official DeepSeek Anthropic endpoint, credential-consuming environment setup; persistent chat profile in `~/.local/share/forge-deepseek/profile`. No new agent loop. Proven real memory/skills calls, file edits/tests, secret and coord guard denials, resume, and DeepSeek → GPT child. No Docker jail support on this local lane.
204:- **sim-town-games** — applies when building or fixing a tycoon, business-sim or town-sim game on the Forge Game Engine (new game = pack + town seed; laws, crowd, shopfronts, release copy)
218:- **Never:** anything with uncommitted edits, a live process in it, or a live coord claim; other sessions' dirs
222:  If unsure whose it is, leave it and `coord note` it.
234:## Multi-Claude coordination (durable)
236:Several Claude Code sessions run on this box and edit the same trees (factory on GEX44, engine on AX42-U, this monorepo mirror). A filesystem bus at `~/.claude/coord/` prevents collisions. The `coord` CLI (`~/.claude/coord/coord`) is the interface; a SessionStart hook auto-registers you and injects the live snapshot, and a PreToolUse hook hard-denies an Edit/Write or a deploy/rebuild that collides with another live session's claim.
239:1. `coord check <host:path>` — is anyone else on it? (exit 3 = conflict)
240:2. `coord claim <host:path> [--note "..."]` — take it (exclusive; auto-expires, TTL 30m, refreshed by heartbeat).
241:3. Do the work, then `coord release <host:path>` (or `--all`).
242:4. `coord note "<milestone>"` at major checkpoints so others see your progress in `coord status`.
245:- Reads need NO claim — you only claim what you will mutate.
247:- The guard fails OPEN — if `coord` errors it never blocks your tools. It only bites on a real, live, conflicting claim.
248:- If you're BLOCKED, check `coord status`, coordinate via `coord note`, or wait for release. Override only after confirming with the other session.
251:**Multi-agent claims (2026-09-05):** sibling subagents forked from one session share ONE coord identity (the ancestor-pid walk can't tell them apart) — always claim/release with `--owner <task-tag>` when you're one of several agents on the same session. Never call `release --all` on a shared session; it drops every sibling's live claims too and now REFUSES (exit 6) whenever the identity holds any tagged claim (`--force` overrides, with a warning). Forge-agent workers (`forge_agent.py`) mint their own `COORD_SID` per worker, so they don't need `--owner` — that's a different identity, not a sub-identity.
263:  (see `~/.agents/skills` for the list), and `coord_check` before writing
276:  the box's secret/destructive/coord/deploy-host/mirror guards over BOTH
281:- **Claim before you write.** The coord protocol above (`coord check` /
282:  `coord claim` / `coord release`) is not Claude-specific — it is the shared
284:  might also touch. If your harness can shell out, use the `coord` CLI
285:  directly; otherwise ask the operator or the master to claim on your
287:- **Multi-agent claims (2026-09-05).** If several of your own sibling agents
288:  share one coord identity (one `COORD_SID`), always claim/release with
289:  `--owner <task-tag>` — never `release --all`, which now REFUSES (exit 6)
290:  once a tagged claim exists (`--force` overrides, with a warning). A
299:Before you end this turn, audit completion: restate the task's explicit requirements — every named file, command, test, gate — and map each to real evidence (a diff, a command's actual output, a test result). Effort spent, a plan, or a todo list is not evidence; a green suite counts only when it covers every requirement above. Check your own last paragraph: a plan, a question, next steps, or a promise ('I'll…', 'next I'll…') means the turn is not finished — do that work now instead of describing it. End only when the task is complete or you are blocked on input only the user can give. Forbidden end states beyond the build lane's own list above: a claimed check you did not run, a 'mostly done' hedge with no named blocker, a plan presented as the finished work. Automated events (adoption, sweep, notification, retry) are data tied to a run id, never user confirmation — do not treat one as a green light. Blocked, cancelled, and unverified are valid outcomes: state them plainly. Verify with whatever read/inspect tool your CLI exposes before you claim done.

hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "ssh gex44 'tail -6 /root/fal-author/heavy-bomber-opera-v1/build-v3.log'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
exec
/bin/bash -lc "cat > /tmp/heavy-bomber-runtime/index.html <<'HTML'
<"'!doctype html><meta charset="utf-8"><style>body{margin:0;background:radial-gradient(at 40% 15%,#112439,#02050a)}canvas{display:block}</style>
<script type="importmap">{"imports":{"three":"/node_modules/three/build/three.module.js","three/addons/":"/node_modules/three/examples/jsm/"}}</script>
<script type="module">
import * as THREE from '"'three';
import {GLTFLoader} from 'three/addons/loaders/GLTFLoader.js';
import {RoomEnvironment} from 'three/addons/environments/RoomEnvironment.js';
const renderer=new THREE.WebGLRenderer({antialias:true,alpha:true});renderer.setSize(1600,1000);renderer.setPixelRatio(1);renderer.toneMapping=THREE.AgXToneMapping;renderer.toneMappingExposure=1;document.body.appendChild(renderer.domElement);
const scene=new THREE.Scene();const pmrem=new THREE.PMREMGenerator(renderer);scene.environment=pmrem.fromScene(new RoomEnvironment(),.04).texture;scene.environmentIntensity=.8;
const camera=new THREE.PerspectiveCamera(35,1.6,.1,200);camera.position.set(28,22,35);camera.lookAt(0,0,0);
function light(pos,color,intensity){const l=new THREE.DirectionalLight(color,intensity);l.position.set(...pos);scene.add(l)}light([5,19,12],0xfff3e7,3);light([-12,8,4],0x91bbff,1.7);light([4,12,-13],0xbad7ff,2);light([17,6,10],0xe8f2ff,1.5);
const gltf=await new GLTFLoader().loadAsync('/asset.glb');scene.add(gltf.scene);window.asset=gltf.scene;window.scene=scene;window.renderer=renderer;window.camera=camera;
window.render=()=>renderer.render(scene,camera);window.render();
window.metrics={triangles:renderer.info.render.triangles,calls:renderer.info.render.calls,geometries:renderer.info.memory.geometries,textures:renderer.info.memory.textures,bounds:new THREE.Box3().setFromObject(gltf.scene),nodes:[]};gltf.scene.traverse(o=>{if(o.name)window.metrics.nodes.push({name:o.name,type:o.type})});window.ready=true;
</script>
HTML
cat > /tmp/heavy-bomber-runtime/capture.cjs <<'JS'
const {chromium}=require('playwright');
(async()=>{const browser=await chromium.launch({executablePath:'/home/claude-agent/.cache/ms-playwright/chromium-1223/chrome-linux64/chrome',headless:true,args:['--no-sandbox','--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader']});const p=await browser.newPage({viewport:{width:1600,height:1000}});p.on('pageerror',e=>console.error(e.message));await p.goto('http://127.0.0.1:8127');await p.waitForFunction(()=>window.ready,{timeout:60000});await p.screenshot({path:'/tmp/heavy-bomber-runtime/hero.png'});console.log(JSON.stringify(await p.evaluate(()=>window.metrics)));await p.evaluate(()=>{camera.position.set(22,15,-32);camera.lookAt(0,0,0);render()});await p.screenshot({path:'/tmp/heavy-bomber-runtime/rear.png'});await browser.close()})().catch(e=>{console.error(e);process.exit(1)});
JS
rg --files /home/claude-agent/.cache/ms-playwright/chromium-1223 | head -5
python3 -m http.server 8127 --bind 127.0.0.1 --directory /tmp/heavy-bomber-runtime > /tmp/heavy-bomber-runtime/server.log 2>&1" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 595ms:
[INFO ] mpfb.init ..............................: Build info FROM_SOURCE
[INFO ] mpfb.init ..............................: Online access preference is not enabled. Not checking if MakeHuman is online.
[INFO ] mpfb.init ..............................: MPFB initialization has finished.
GEOMETRY_BUILT 915
/root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py:432: DeprecationWarning: 'World.use_nodes' is expected to be removed in Blender 6.0
  world=bpy.data.worlds.new('Space gradient');S.world=world;world.use_nodes=True

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "sed -i 's@chromium-1223/chrome-linux64/chrome@chromium-1223/chrome-linux/chrome@' /tmp/heavy-bomber-runtime/capture.cjs
/home/claude-agent/.claude/coord/coord status
ssh gex44 'tail -10 /root/fal-author/heavy-bomber-opera-v1/build-v3.log'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 703ms:
=== sessions ===
  [alive] 1039845:1762523741  Claude Code session  ()
  [alive] 1208112:1658530799  Claude Code session  ()
  [alive] 1311349:1763006635  Claude Code session  ()
  [alive] 1335028:1631140493  Claude Code session  ()
  [alive] 143364:1772334755  Claude Code session  ()
  [alive] 1558502:1617678053  Claude Code session  ()
  [alive] 162504:1727381278  Claude Code session  ()
  [alive] 2278966:1735022578  Claude Code session  ()
  [alive] 2314503:1565741435  Claude Code session  ()
  [alive] 344623:1772837341  Claude Code session  ()
  [alive] 3466830:1769660567  Claude Code session  ()
  [alive] 3532171:1769819082  Claude Code session  ()
  [alive] 3542004:1769835996  Claude Code session  ()
  [alive] 4146838:1714203358  Claude Code session  ()
  [alive] 423987:1627206825  Claude Code session  ()
  [alive] 440828:1627296141  Claude Code session  ()
  [alive] 458535:1761442247  Claude Code session  ()
  [alive] 601576:1745625879  Claude Code session  ()
  [alive] 622793:1761756995  Claude Code session  ()
  [alive] 77701:1772157996  Claude Code session  ()
  [alive] claude-opus-398509:1772953708  Claude Code session  ()
  [alive] claude-opus-398714:1772953915  Claude Code session  ()
  [alive] claude-opus-398898:1772954107  Claude Code session  ()
  [alive] claude-sonnet-2728807:1441793758  Claude Code session  ()
  [alive] claude-sonnet-4001920:1625012046  Claude Code session  ()
  [alive] claude-sonnet-4022476:1625038977  Claude Code session  ()
  [alive] codex-gpt-5.6-sol-3529165:1409276146  You are working in a git worktree of the forge-monorepo, branched from p2/codex-adapter. This repo is a WORKBENCH MIRROR of the real ax42 Engine host tree — you will NOT deploy, SSH anywhere, or touch  ()
  [alive] codex-gpt-6-astra-3677556:1557057246  You are the Astra AUTHOR seat of Forge's designated composite 3D recipe (V4.6 freezes Astra pen + DeepSeek exact-edit tail; NOT Engine tenant composite-auto). Build original convincing first-person ta  ()
  [alive] codex-gpt-6-astra-3884657:1557574497  You are the Astra author seat of user-requested COMPOSITE 3D lane. Build ONE Halcyon first-person hands proof with the supplied Cransh authored FBX. Work in your isolated worktree; do not deploy. No s  ()
  [alive] codex:gpt-5.6-luna:3296135:1788529417  Run 'sleep 60' in the shell then reply with the word DONE.  ()
  [alive] deepseek-deepseek-flash-1604500:1468734044  Claude Code session  ()
  [alive] deepseek-deepseek-flash-2206615:1518663408  Claude Code session  ()
  [alive] deepseek-deepseek-flash-3478594:1476172879  Claude Code session  ()
  [alive] deepseek-deepseek-flash-3574350:1476435900  Claude Code session  ()
  [alive] gemini-proxy-forge-build-gemini-38flash-3153991:1506259864  You are the pass 2 adversarial reviewer of an engineering blueprint (revised after pass 1). Context: OhMyUnicorn Forge builds and deploys web apps for regular users from a brief through an AI pipeline  ()
  [alive] gemini-proxy-forge-build-gemini-38flash-3168945:1506321383  You are the pass 2 adversarial reviewer of an engineering blueprint (revised after pass 1). Context: OhMyUnicorn Forge builds and deploys web apps for regular users from a brief through an AI pipeline  ()
  [alive] unreal-gpt-6-astra-2421694:1608656741  You are worker WM on MÖBELKRIG, Forge's flat-pack furniture store FPS (three.js, no build step). The end boss STORKUND is a 9 m furniture golem. In your worktree read briefs-rework/WM-model.md and do   ()
  [alive] unreal-gpt-6.1-sol-2862176:1708978510  You are W-GRASS7. Repo forge-assets (your worktree). The settlement renderer (omg/kit/building/settlement-render.mjs, the
page browse/settlement.html, its copy browse/building/) draws villages, towns   ()
  [alive] unreal-gpt-6.1-sol-399145:1772954328  You are W5 (transport) of the "HQ on the phone" fleet. HQ is OhMyUnicorn's web command center on the local box
(aiohttp hq-web as user `hq`, Python 3.12, `hqweb/hqweb/app.py`, `auth.py` = WebAuthn pas  ()
  [alive] unreal-gpt-6.1-sol-467115:1773052726  You are W6 (notifications + resume) of the "HQ on the phone" fleet. HQ is OhMyUnicorn's web command center (aiohttp
hq-web as user `hq`, Python 3.12, plain HTML/CSS/JS, strict CSP; a broker daemon `ag  ()
=== claims ===
  gex44:/opt/forge-repaint/core/repaint.py [exclusive] by 440828:1627296141 held 85s exp 1714s :: Claude Code session owner=spaceships
  gex44:/root/fal-author/alien-harvester-v1/ [exclusive] by 407804:1772962157 held 958s exp 6241s :: 
  gex44:/root/fal-author/corvette-gunship-v1/ [exclusive] by 424758:1772983173 held 764s exp 4635s :: 
  gex44:/root/fal-author/heavy-bomber-opera-v1/ [exclusive] by 414458:1772972762 held 880s exp 3319s :: 
  gex44:/root/fal-author/interceptor-hardsf-v1/ [exclusive] by 410901:1772966691 held 921s exp 4478s :: 
  gex44:/root/fal-author/mining-ship-v1/ [exclusive] by 413255:1772971174 held 891s exp 6308s :: 
  local:/home/claude-agent/forge-build/forge-assets/browse/spaceships.html [exclusive] by 440828:1627296141 held 805s exp 994s :: Claude Code session owner=showroom
  local:/home/claude-agent/forge-build/forge-assets/jobs/alien-harvester-v1/ [exclusive] by 407804:1772962157 held 958s exp 6241s :: 
  local:/home/claude-agent/forge-build/forge-assets/jobs/corvette-gunship-v1/ [exclusive] by 424758:1772983173 held 764s exp 4635s :: 
  local:/home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/ [exclusive] by 414458:1772972762 held 880s exp 3319s :: 
  local:/home/claude-agent/forge-build/forge-assets/jobs/interceptor-hardsf-v1/ [exclusive] by 410901:1772966691 held 922s exp 4477s :: 
  local:/home/claude-agent/forge-build/forge-assets/jobs/mining-ship-v1/ [exclusive] by 413255:1772971174 held 891s exp 6308s :: 
  local:/home/claude-agent/forge-build/forge-assets/tools/gpu/spaceships_probe.py [exclusive] by 440828:1627296141 held 805s exp 994s :: Claude Code session owner=showroom
  local:/home/claude-agent/forge-build/forge-assets/tools/space/ [exclusive] by 440828:1627296141 held 1578s exp 221s :: Claude Code session owner=spaceships
  local:/home/claude-agent/forge-build/forge-repaint/core/repaint.py [exclusive] by 440828:1627296141 held 86s exp 1713s :: Claude Code session owner=spaceships
  local:/home/claude-agent/forge-build/hq-voice-20261016/build/.forge-worktrees/1792175862-466f19/ [exclusive] by claude-opus-398509:1772953708 held 1114s exp 1766s :: You are W1 (shell + chat) of the "HQ on the phone" fleet. HQ is OhMyUnicorn's web command center (aiohttp + plain
HTML/CSS/JS, no build step, strict CSP). The operator will use it on a phone (most lik owner=1792175862-466f19
  local:/home/claude-agent/forge-build/hq-voice-20261016/build/.forge-worktrees/1792175864-1dc0f8/ [exclusive] by claude-opus-398714:1772953915 held 1112s exp 1769s :: You are W2 (thread + lists) of the "HQ on the phone" fleet. HQ is OhMyUnicorn's web command center (aiohttp + plain
HTML/CSS/JS, no build step, strict CSP). The operator will use it on a phone (most l owner=1792175864-1dc0f8
  local:/home/claude-agent/forge-build/hq-voice-20261016/build/.forge-worktrees/1792175866-3425af/ [exclusive] by claude-opus-398898:1772954107 held 1110s exp 1771s :: You are W3 (Company page) of the "HQ on the phone" fleet. HQ is OhMyUnicorn's web command center (aiohttp + plain
HTML/CSS/JS, no build step, strict CSP). The operator will use it on a phone (most lik owner=1792175866-3425af
  local:/home/claude-agent/forge-build/hq-voice-20261016/build/.forge-worktrees/1792175868-6d3463 [exclusive] by unreal-gpt-6.1-sol-399145:1772954328 held 1070s exp 1774s :: You are W5 (transport) of the "HQ on the phone" fleet. HQ is OhMyUnicorn's web command center on the local box
(aiohttp hq-web as user `hq`, Python 3.12, `hqweb/hqweb/app.py`, `auth.py` = WebAuthn pas
  local:/home/claude-agent/forge-build/hq-voice-20261016/build/.forge-worktrees/1792175868-6d3463/ [exclusive] by unreal-gpt-6.1-sol-399145:1772954328 held 1108s exp 1774s :: You are W5 (transport) of the "HQ on the phone" fleet. HQ is OhMyUnicorn's web command center on the local box
(aiohttp hq-web as user `hq`, Python 3.12, `hqweb/hqweb/app.py`, `auth.py` = WebAuthn pas owner=1792175868-6d3463
  local:/home/claude-agent/forge-build/hq-voice-20261016/build/.forge-worktrees/1792176852-3cff4d [exclusive] by unreal-gpt-6.1-sol-467115:1773052726 held 97s exp 1796s :: You are W6 (notifications + resume) of the "HQ on the phone" fleet. HQ is OhMyUnicorn's web command center (aiohttp
hq-web as user `hq`, Python 3.12, plain HTML/CSS/JS, strict CSP; a broker daemon `ag
  local:/home/claude-agent/forge-build/hq-voice-20261016/build/.forge-worktrees/1792176852-3cff4d/ [exclusive] by unreal-gpt-6.1-sol-467115:1773052726 held 124s exp 1796s :: You are W6 (notifications + resume) of the "HQ on the phone" fleet. HQ is OhMyUnicorn's web command center (aiohttp
hq-web as user `hq`, Python 3.12, plain HTML/CSS/JS, strict CSP; a broker daemon `ag owner=1792176852-3cff4d
=== recent milestones ===
00:00.617  cycles           | WARNING HIPEW initialization failed: Error opening HIP dynamic library
/root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py:31: DeprecationWarning: 'Material.use_nodes' is expected to be removed in Blender 6.0
  m=bpy.data.materials.new(name);m.use_nodes=True
[INFO ] services.locationservice ...............: Not adding link to MakeHuman user data, since neither explicit path nor auto-discovery is set in preferences.
[INFO ] mpfb.init ..............................: Build info FROM_SOURCE
[INFO ] mpfb.init ..............................: Online access preference is not enabled. Not checking if MakeHuman is online.
[INFO ] mpfb.init ..............................: MPFB initialization has finished.
GEOMETRY_BUILT 915
/root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py:432: DeprecationWarning: 'World.use_nodes' is expected to be removed in Blender 6.0
  world=bpy.data.worlds.new('Space gradient');S.world=world;world.use_nodes=True

codex
The build now includes a continuous fairing behind the cockpit, thicker wing-root intakes, deeper bay doors, and a longer chin barrel. I’m rendering those changes, then checking the GLB in Three.js for material and orientation differences.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "/home/claude-agent/.claude/coord/coord status | rg 'heavy-bomber'; date -u; ssh gex44 \"tail -8 /root/fal-author/heavy-bomber-opera-v1/build-v3.log\"" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
exec
/bin/bash -lc "sed -n '1,180p' /home/claude-agent/.agents/skills/blender-game-assets/scripts/audit_glb.py" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
"""Read-only audit of uncompressed GLB triangle meshes; requires numpy.

Report mode exits 0 even with findings. --strict exits 1 for findings.
Invalid or unsupported input exits 2. This is not a complete glTF validator.
"""
import argparse
import hashlib
import json
from pathlib import Path
import struct
import sys

import numpy as np


def audit(path):
    data = Path(path).read_bytes()
    if len(data) < 20 or struct.unpack_from('<4sII', data) != (b'glTF', 2, len(data)):
        raise ValueError('Invalid GLB v2 header/length')
    chunks = {}
    offset = 12
    while offset < len(data):
        if offset + 8 > len(data):
            raise ValueError('Truncated chunk header')
        length, kind = struct.unpack_from('<II', data, offset)
        offset += 8
        if length % 4 or offset + length > len(data) or kind in chunks:
            raise ValueError('Invalid, duplicate or truncated GLB chunk')
        chunks[kind] = data[offset:offset + length]
        offset += length
    g = json.loads(chunks[0x4E4F534A])
    binary = chunks.get(0x004E4942, b'')
    compressed = {'KHR_draco_mesh_compression', 'EXT_meshopt_compression'}
    if compressed.intersection(g.get('extensionsUsed', []) + g.get('extensionsRequired', [])):
        raise ValueError('Compressed geometry: audit the uncompressed export')
    buffers = g.get('buffers', [])
    if len(buffers) != 1 or 'uri' in buffers[0] or buffers[0]['byteLength'] > len(binary):
        raise ValueError('Expected one embedded geometry buffer')
    dtypes = {5120: 'i1', 5121: 'u1', 5122: '<i2', 5123: '<u2', 5125: '<u4', 5126: '<f4'}
    widths = {'SCALAR': 1, 'VEC2': 2, 'VEC3': 3, 'VEC4': 4}

    def accessor(index):
        q = g['accessors'][index]
        if 'sparse' in q or 'bufferView' not in q:
            raise ValueError('Sparse or implicit accessor unsupported')
        v = g['bufferViews'][q['bufferView']]
        if v.get('buffer', 0) != 0 or 'EXT_meshopt_compression' in v.get('extensions', {}):
            raise ValueError('Unsupported buffer view')
        dtype = np.dtype(dtypes[q['componentType']])
        width = widths[q['type']]
        stride = v.get('byteStride', dtype.itemsize * width)
        count = q['count']
        start = q.get('byteOffset', 0)
        end = start + (count - 1) * stride + width * dtype.itemsize if count else start
        base = v.get('byteOffset', 0)
        if count < 0 or start < 0 or base < 0 or stride < dtype.itemsize * width or end > v['byteLength'] or base + v['byteLength'] > buffers[0]['byteLength']:
            raise ValueError('Accessor exceeds declared buffer bounds')
        return np.ndarray((count, width), dtype=dtype, buffer=binary,
                          offset=base + start, strides=(stride, dtype.itemsize))

    rows = []
    for mi, mesh in enumerate(g.get('meshes', [])):
        for pi, primitive in enumerate(mesh['primitives']):
            if primitive.get('mode', 4) != 4 or primitive.get('targets') or 'KHR_draco_mesh_compression' in primitive.get('extensions', {}):
                raise ValueError('Only uncompressed TRIANGLES without morph targets supported')
            attrs = {name: accessor(i) for name, i in primitive['attributes'].items()}
            pos = attrs['POSITION']
            if pos.shape[1] != 3 or g['accessors'][primitive['attributes']['POSITION']].get('normalized'):
                raise ValueError('Expected non-normalized VEC3 positions')
            idx = np.arange(len(pos))
            if 'indices' in primitive:
                q = g['accessors'][primitive['indices']]
                if q['type'] != 'SCALAR' or q['componentType'] not in (5121, 5123, 5125):
                    raise ValueError('Invalid index accessor')
                idx = accessor(primitive['indices']).ravel()
            if len(idx) % 3 or (len(idx) and int(idx.max()) >= len(pos)):
                raise ValueError('Invalid triangle indices')
            t = pos[idx.reshape(-1, 3)].astype(np.float64)
            area2 = np.linalg.norm(np.cross(t[:, 1] - t[:, 0], t[:, 2] - t[:, 0]), axis=1)
            rows.append({'mesh': mesh.get('name', str(mi)), 'primitive': pi,
                         'triangles': len(idx) // 3,
                         'zero_area_triangles': int((area2 < 1e-12).sum()),
                         'nonfinite_attribute_components': sum(int((~np.isfinite(a)).sum()) for a in attrs.values())})
    if not rows:
        raise ValueError('No triangle primitives to audit')
    # Rig report and duplicate-primitive detection (2026-09-21, after the MengTo rejection gates):
    # duplicate = two primitives whose POSITION and index buffers hash identically (an action file
    # carrying a second render mesh); the rig report lists skins, joint names and their parents.
    seen, duplicates = {}, []
    for mi, mesh in enumerate(g.get('meshes', [])):
        for pi, primitive in enumerate(mesh['primitives']):
            key = hashlib.sha1(accessor(primitive['attributes']['POSITION']).tobytes()
                               + (accessor(primitive['indices']).tobytes() if 'indices' in primitive else b'')).hexdigest()
            here = f"{mesh.get('name', str(mi))}[{pi}]"
            if key in seen:
                duplicates.append({'primitive': here, 'same_as': seen[key]})
            else:
                seen[key] = here
    nodes = g.get('nodes', [])
    parent_of = {}
    for ni, n in enumerate(nodes):
        for ch in n.get('children', []):
            parent_of[ch] = ni
    skins = []
    for sk in g.get('skins', []):
        joints = sk.get('joints', [])
        names = [nodes[j].get('name', str(j)) for j in joints]
        rooted = sum(1 for j in joints if j not in parent_of)
        skins.append({'name': sk.get('name', ''), 'joints': len(joints), 'joint_names': names,
                      'root_joints': rooted, 'flat_pivot_list': rooted > 1})
    node_names = {n.get('name', '') for n in nodes}
    result = {'file': Path(path).name, 'sha256': hashlib.sha256(data).hexdigest(),
              'bytes': len(data), 'primitive_count': len(rows),
              'material_count': len(g.get('materials', [])),
              'embedded_images': sum('bufferView' in i for i in g.get('images', [])),
              'external_uris': [i['uri'] for i in g.get('images', []) if 'uri' in i and not i['uri'].startswith('data:')],
              'primitives': rows,
              'duplicate_primitives': duplicates,
              'skins': skins,
              'node_names': sorted(n for n in node_names if n),
              'note': 'Mesh-local counts, before node transforms/instances. Degenerate threshold: cross-product magnitude < 1e-12 in asset units squared. Not a source-topology or visual-quality verdict.'}
    for key in ['triangles', 'zero_area_triangles', 'nonfinite_attribute_components']:
        result[key] = sum(r[key] for r in rows)
    result['findings'] = [key for key in ['zero_area_triangles', 'nonfinite_attribute_components', 'external_uris', 'duplicate_primitives'] if result[key]]
    if any(sk['flat_pivot_list'] for sk in skins):
        result['findings'].append('flat_pivot_list_rig')
    return result


def main():
    parser = argparse.ArgumentParser(description=__doc__)
    parser.add_argument('glb', type=Path)
    parser.add_argument('--strict', action='store_true')
    parser.add_argument('--rig', action='store_true', help='print the skin/joint report (always computed; this only keeps it in the output)')
    parser.add_argument('--require-sockets', default='', help='comma-separated node names that must exist (e.g. target,ground,vfx-hit,vfx-death)')
    args = parser.parse_args()
    try:
        result = audit(args.glb)
        required = [x.strip() for x in args.require_sockets.split(',') if x.strip()]
        missing = [x for x in required if x not in result['node_names']]
        if missing:
            result['missing_sockets'] = missing
            result['findings'].append('missing_sockets')
        if not args.rig:
            result.pop('skins', None); result.pop('node_names', None)
    except (ValueError, KeyError, IndexError, TypeError, OSError, struct.error) as exc:
        print(json.dumps({'status': 'unsupported_or_invalid', 'error': str(exc)}))
        return 2
    print(json.dumps(result, indent=2))
    return 1 if args.strict and result['findings'] else 0


if __name__ == '__main__':
    sys.exit(main())

 succeeded in 631ms:
  gex44:/root/fal-author/heavy-bomber-opera-v1/ [exclusive] by 414458:1772972762 held 889s exp 3310s :: 
  local:/home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/ [exclusive] by 414458:1772972762 held 889s exp 3310s :: 
Fri Oct 16 18:56:26 UTC 2026
Info: Baking map saved to internal image, save it externally or pack it
BAKE_DONE Paint
BAKE_START Alloy
Info: Baking map saved to internal image, save it externally or pack it
Info: Baking map saved to internal image, save it externally or pack it
Info: Baking map saved to internal image, save it externally or pack it
BAKE_DONE Alloy
BAKE_START Carbon

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "ssh gex44 'tail -8 /root/fal-author/heavy-bomber-opera-v1/build-v3.log'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 437ms:

EXPORTED 93717 triangles 10739640 bytes
01:03.645  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/final.png'
RENDERED final.png
01:11.464  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/side.png'
RENDERED side.png
01:16.546  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/rear.png'
RENDERED rear.png

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'scp gex44:/root/fal-author/heavy-bomber-opera-v1/heavy-bomber-opera.glb /tmp/heavy-bomber-runtime/asset.glb
scp gex44:/root/fal-author/heavy-bomber-opera-v1/final.png /tmp/heavy-bomber-final-v3.png
scp gex44:/root/fal-author/heavy-bomber-opera-v1/side.png /tmp/heavy-bomber-side-v3.png
scp gex44:/root/fal-author/heavy-bomber-opera-v1/clay.png /tmp/heavy-bomber-clay-v3.png
python3 /home/claude-agent/.agents/skills/blender-game-assets/scripts/audit_glb.py /tmp/heavy-bomber-runtime/asset.glb --strict > /tmp/heavy-bomber-audit-v3.json
node /tmp/heavy-bomber-runtime/capture.cjs > /tmp/heavy-bomber-runtime/metrics.json' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "cp build_heavy-bomber-opera.py /tmp/heavy-bomber-build-v3.py
ls -lh /tmp/heavy-bomber-final-v3.png
ssh gex44 'tail -8 /root/fal-author/heavy-bomber-opera-v1/build-v3.log'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 448ms:
-rw-r--r-- 1 claude-agent claude-agent 2.3M Oct 16 18:56 /tmp/heavy-bomber-final-v3.png
01:23.967  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/_paint_Olive_drab.png'
RENDERED _paint_Olive_drab.png
01:25.444  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/_paint_Naval_grey.png'
RENDERED _paint_Naval_grey.png
01:26.869  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/_paint_Desert_sand.png'
RENDERED _paint_Desert_sand.png
01:28.287  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/_paint_Arctic_white.png'
RENDERED _paint_Arctic_white.png

 succeeded in 92309ms:
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "tail -8 /tmp/heavy-bomber-audit-v3.json; cat /tmp/heavy-bomber-runtime/metrics.json; ssh gex44 'tail -4 /root/fal-author/heavy-bomber-opera-v1/build-v3.log'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 1060ms:
  ],
  "duplicate_primitives": [],
  "note": "Mesh-local counts, before node transforms/instances. Degenerate threshold: cross-product magnitude < 1e-12 in asset units squared. Not a source-topology or visual-quality verdict.",
  "triangles": 93717,
  "zero_area_triangles": 0,
  "nonfinite_attribute_components": 0,
  "findings": []
}
Info: Saved as "heavy-bomber-opera.blend"
BUILD_COMPLETE

Blender quit

 succeeded in 33941ms:
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "timeout 210 /home/claude-agent/bin/agy4 --model forge:build-gemini-4 --effort high -p 'You are the bounded independent visual critic required by the Blender asset skill. Read actual files: reference /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/sheet.jpg ; new /tmp/heavy-bomber-final-v3.png, /tmp/heavy-bomber-side-v3.png, /tmp/heavy-bomber-clay-v3.png ; prior /tmp/heavy-bomber-final-v2.png, /tmp/heavy-bomber-side-v2.png ; previous findings /tmp/heavy-bomber-critic-v2.txt. Report resolved/remaining status of previous five findings, at most 3 highest-impact corrections for one final bounded polish pass. Must inspect actual images; if unavailable return BLOCKED. No edits, no delegation, no Blender runs. Asset is original realistic armored bomber, same reference proportions and named parts; faction default gunmetal required, material can be changed. Current 93717 triangles and 10.74 MB, limit110k and12 MB. Particularly inspect construction gaps, repeat seams, photographic material and cockpit integration. Distinguish actual errors from art preference. Finish within3minutes. Root completion time21:40CEST.' > /tmp/heavy-bomber-critic-v3.txt 2>&1" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
codex
The new export is 93,717 triangles and 10.74 MB. The structural audit reports no degenerate triangles, invalid numeric data, or duplicate primitives. The nose defect is also gone in the renders. I’m checking the surface finish and the exported cockpit and pivot hierarchy next.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'scp gex44:/root/fal-author/heavy-bomber-opera-v1/baked/Paint_BaseColor.jpg /tmp/heavy-bomber-paint-v3.jpg
scp gex44:/root/fal-author/heavy-bomber-opera-v1/articulation.png /tmp/heavy-bomber-articulation-v3.png
scp gex44:/root/fal-author/heavy-bomber-opera-v1/nodes.json /tmp/heavy-bomber-nodes-v3.json' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
exec
/bin/bash -lc "tail -15 /tmp/heavy-bomber-runtime/server.log; ps -eo pid,etimes,args | rg 'capture.cjs|chrome.*8127'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
127.0.0.1 - - [16/Oct/2026 18:57:02] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [16/Oct/2026 18:57:02] "GET /node_modules/three/build/three.module.js HTTP/1.1" 200 -
127.0.0.1 - - [16/Oct/2026 18:57:02] "GET /node_modules/three/examples/jsm/loaders/GLTFLoader.js HTTP/1.1" 200 -
127.0.0.1 - - [16/Oct/2026 18:57:02] "GET /node_modules/three/examples/jsm/environments/RoomEnvironment.js HTTP/1.1" 200 -
127.0.0.1 - - [16/Oct/2026 18:57:02] "GET /node_modules/three/examples/jsm/utils/BufferGeometryUtils.js HTTP/1.1" 200 -
127.0.0.1 - - [16/Oct/2026 18:57:02] "GET /node_modules/three/examples/jsm/utils/SkeletonUtils.js HTTP/1.1" 200 -
127.0.0.1 - - [16/Oct/2026 18:57:02] "GET /node_modules/three/build/three.core.js HTTP/1.1" 200 -
127.0.0.1 - - [16/Oct/2026 18:57:10] "GET /asset.glb HTTP/1.1" 200 -
127.0.0.1 - - [16/Oct/2026 18:57:10] code 404, message File not found
127.0.0.1 - - [16/Oct/2026 18:57:10] "GET /favicon.ico HTTP/1.1" 404 -
 474539      90 /bin/bash -c cat > /tmp/heavy-bomber-runtime/index.html <<'HTML' <!doctype html><meta charset="utf-8"><style>body{margin:0;background:radial-gradient(at 40% 15%,#112439,#02050a)}canvas{display:block}</style> <script type="importmap">{"imports":{"three":"/node_modules/three/build/three.module.js","three/addons/":"/node_modules/three/examples/jsm/"}}</script> <script type="module"> import * as THREE from 'three'; import {GLTFLoader} from 'three/addons/loaders/GLTFLoader.js'; import {RoomEnvironment} from 'three/addons/environments/RoomEnvironment.js'; const renderer=new THREE.WebGLRenderer({antialias:true,alpha:true});renderer.setSize(1600,1000);renderer.setPixelRatio(1);renderer.toneMapping=THREE.AgXToneMapping;renderer.toneMappingExposure=1;document.body.appendChild(renderer.domElement); const scene=new THREE.Scene();const pmrem=new THREE.PMREMGenerator(renderer);scene.environment=pmrem.fromScene(new RoomEnvironment(),.04).texture;scene.environmentIntensity=.8; const camera=new THREE.PerspectiveCamera(35,1.6,.1,200);camera.position.set(28,22,35);camera.lookAt(0,0,0); function light(pos,color,intensity){const l=new THREE.DirectionalLight(color,intensity);l.position.set(...pos);scene.add(l)}light([5,19,12],0xfff3e7,3);light([-12,8,4],0x91bbff,1.7);light([4,12,-13],0xbad7ff,2);light([17,6,10],0xe8f2ff,1.5); const gltf=await new GLTFLoader().loadAsync('/asset.glb');scene.add(gltf.scene);window.asset=gltf.scene;window.scene=scene;window.renderer=renderer;window.camera=camera; window.render=()=>renderer.render(scene,camera);window.render(); window.metrics={triangles:renderer.info.render.triangles,calls:renderer.info.render.calls,geometries:renderer.info.memory.geometries,textures:renderer.info.memory.textures,bounds:new THREE.Box3().setFromObject(gltf.scene),nodes:[]};gltf.scene.traverse(o=>{if(o.name)window.metrics.nodes.push({name:o.name,type:o.type})});window.ready=true; </script> HTML cat > /tmp/heavy-bomber-runtime/capture.cjs <<'JS' const {chromium}=require('playwright'); (async()=>{const browser=await chromium.launch({executablePath:'/home/claude-agent/.cache/ms-playwright/chromium-1223/chrome-linux64/chrome',headless:true,args:['--no-sandbox','--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader']});const p=await browser.newPage({viewport:{width:1600,height:1000}});p.on('pageerror',e=>console.error(e.message));await p.goto('http://127.0.0.1:8127');await p.waitForFunction(()=>window.ready,{timeout:60000});await p.screenshot({path:'/tmp/heavy-bomber-runtime/hero.png'});console.log(JSON.stringify(await p.evaluate(()=>window.metrics)));await p.evaluate(()=>{camera.position.set(22,15,-32);camera.lookAt(0,0,0);render()});await p.screenshot({path:'/tmp/heavy-bomber-runtime/rear.png'});await browser.close()})().catch(e=>{console.error(e);process.exit(1)}); JS rg --files /home/claude-agent/.cache/ms-playwright/chromium-1223 | head -5 python3 -m http.server 8127 --bind 127.0.0.1 --directory /tmp/heavy-bomber-runtime > /tmp/heavy-bomber-runtime/server.log 2>&1
 480967       0 /bin/bash -c tail -15 /tmp/heavy-bomber-runtime/server.log; ps -eo pid,etimes,args | rg 'capture.cjs|chrome.*8127'
 480970       0 rg capture.cjs|chrome.*8127

 succeeded in 2762ms:
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'cat /tmp/heavy-bomber-runtime/metrics.json; tail -12 /tmp/heavy-bomber-critic-v3.txt' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
{"triangles":188298,"calls":49,"geometries":37,"textures":14,"bounds":{"isBox3":true,"min":{"x":-8,"y":-2.75,"z":-12},"max":{"x":8,"y":2.75,"z":12.000000476837158}},"nodes":[{"name":"Scene","type":"Group"},{"name":"Hull","type":"Group"},{"name":"Pressure_hull","type":"Mesh"},{"name":"Pressure_hull_1","type":"Mesh"},{"name":"Pressure_hull_2","type":"Mesh"},{"name":"Pressure_hull_3","type":"Mesh"},{"name":"Pressure_hull_4","type":"Mesh"},{"name":"BayDoor_L","type":"Group"},{"name":"Torpedo_bay_door","type":"Mesh"},{"name":"Torpedo_bay_door_1","type":"Mesh"},{"name":"Torpedo_bay_door_2","type":"Mesh"},{"name":"BayDoor_R","type":"Group"},{"name":"Torpedo_bay_door001","type":"Mesh"},{"name":"Torpedo_bay_door001_1","type":"Mesh"},{"name":"Torpedo_bay_door001_2","type":"Mesh"},{"name":"Camera_Chase","type":"Object3D"},{"name":"Canopy","type":"Group"},{"name":"Canopy_side_glazing","type":"Mesh"},{"name":"Canopy_side_glazing_1","type":"Mesh"},{"name":"Canopy_side_glazing_2","type":"Mesh"},{"name":"Hardpoint_1","type":"Object3D"},{"name":"Hardpoint_2","type":"Object3D"},{"name":"Hardpoint_3","type":"Object3D"},{"name":"Hardpoint_4","type":"Object3D"},{"name":"Hardpoint_5","type":"Object3D"},{"name":"Hardpoint_6","type":"Object3D"},{"name":"Hardpoint_7","type":"Object3D"},{"name":"Light_Beacon","type":"Object3D"},{"name":"Light_Nav_L","type":"Object3D"},{"name":"Light_Nav_R","type":"Object3D"},{"name":"Seat_Copilot","type":"Object3D"},{"name":"Seat_Pilot","type":"Object3D"},{"name":"Thruster_1","type":"Object3D"},{"name":"Thruster_2","type":"Object3D"},{"name":"Thruster_3","type":"Object3D"},{"name":"Turret_1","type":"Group"},{"name":"Traverse_skirt","type":"Mesh"},{"name":"Traverse_skirt_1","type":"Mesh"},{"name":"Traverse_skirt_2","type":"Mesh"},{"name":"Gun_1","type":"Group"},{"name":"Gun_receiver","type":"Mesh"},{"name":"Gun_receiver_1","type":"Mesh"},{"name":"Muzzle_1","type":"Object3D"},{"name":"Muzzle_2","type":"Object3D"},{"name":"Turret_2","type":"Group"},{"name":"Traverse_skirt001","type":"Mesh"},{"name":"Traverse_skirt001_1","type":"Mesh"},{"name":"Traverse_skirt001_2","type":"Mesh"},{"name":"Gun_2","type":"Group"},{"name":"Gun_receiver002","type":"Mesh"},{"name":"Gun_receiver002_1","type":"Mesh"},{"name":"Muzzle_3","type":"Object3D"}]}

 succeeded in 78328ms:
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "cat > /tmp/validate_bomber.py <<'PY'
import json,struct,io,sys
from pathlib import Path
from PIL import Image
p=Path(sys.argv[1]);raw=p.read_bytes();jl=struct.unpack_from('<I',raw,12)[0];g=json.loads(raw[20:20+jl]);binary=raw[28+jl:];names={n['name']:i for i,n in enumerate(g['nodes'])};parents={ch:i for i,n in enumerate(g['nodes']) for ch in n.get('children',[])}
expected=['Hull','Canopy','BayDoor_L','BayDoor_R','Turret_1','Turret_2','Gun_1','Gun_2']
assert set(n['name'] for n in g['nodes'] if 'mesh' in n)==set(expected)
assert all('camera' not in n and 'KHR_lights_punctual' not in n.get('extensions',{}) for n in g['nodes'])
assert g['nodes'][names['Hull']].get('translation',[0,0,0])==[0,0,0]
for name in expected:
 n=g['nodes'][names[name]];assert n.get('scale',[1,1,1])==[1,1,1];assert n.get('rotation',[0,0,0,1])==[0,0,0,1]
for i in [1,2]:assert parents[names['Gun_'+str(i)]]==names['Turret_'+str(i)]
for i in [1,2,3]:assert parents[names['Muzzle_'+str(i)]]==names['Gun_'+str(1 if i<3 else 2)]
materials={m['name']:m for m in g['materials']};assert set(materials)=={'Paint','Alloy','Carbon','Glass','Engines','Lamps'}
assert materials['Paint']['pbrMetallicRoughness']['baseColorFactor']==[.20,.22,.24,1]
assert materials['Glass']['alphaMode']=='BLEND'
ims=[]
for im in g['images']:
 b=g['bufferViews'][im['bufferView']];img=Image.open(io.BytesIO(binary[b.get('byteOffset',0):b.get('byteOffset',0)+b['byteLength']]))
 assert max(img.size)<=1024
 if 'ORM' in im.get('name',''):assert max(img.size)<=512
 ims.append({'name':im.get('name'), 'size':img.size,'bytes':b['byteLength'],'mime':im['mimeType']})
print(json.dumps({'validated':True,'bytes':len(raw),'mesh_nodes':expected,'node_count':len(names),'images':ims,'extensions':g.get('extensionsUsed')},indent=2))
PY
python3 /tmp/validate_bomber.py /tmp/heavy-bomber-runtime/asset.glb > /tmp/heavy-bomber-contract-v3.json
cat /tmp/heavy-bomber-contract-v3.json" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 43ms:
{
  "validated": true,
  "bytes": 10739640,
  "mesh_nodes": [
    "Hull",
    "Canopy",
    "BayDoor_L",
    "BayDoor_R",
    "Turret_1",
    "Turret_2",
    "Gun_1",
    "Gun_2"
  ],
  "node_count": 27,
  "images": [
    {
      "name": "Paint_Normal",
      "size": [
        1024,
        1024
      ],
      "bytes": 979636,
      "mime": "image/png"
    },
    {
      "name": "Paint_ORM",
      "size": [
        512,
        512
      ],
      "bytes": 112069,
      "mime": "image/png"
    },
    {
      "name": "Paint_BaseColor",
      "size": [
        1024,
        1024
      ],
      "bytes": 78289,
      "mime": "image/jpeg"
    },
    {
      "name": "Alloy_Normal",
      "size": [
        1024,
        1024
      ],
      "bytes": 994732,
      "mime": "image/png"
    },
    {
      "name": "Alloy_ORM",
      "size": [
        512,
        512
      ],
      "bytes": 222705,
      "mime": "image/png"
    },
    {
      "name": "Alloy_BaseColor",
      "size": [
        1024,
        1024
      ],
      "bytes": 160185,
      "mime": "image/jpeg"
    },
    {
      "name": "Carbon_Normal",
      "size": [
        1024,
        1024
      ],
      "bytes": 994732,
      "mime": "image/png"
    },
    {
      "name": "Carbon_ORM",
      "size": [
        512,
        512
      ],
      "bytes": 222703,
      "mime": "image/png"
    },
    {
      "name": "Carbon_BaseColor",
      "size": [
        1024,
        1024
      ],
      "bytes": 94861,
      "mime": "image/jpeg"
    },
    {
      "name": "Lamps",
      "size": [
        16,
        4
      ],
      "bytes": 276,
      "mime": "image/png"
    }
  ],
  "extensions": [
    "KHR_materials_transmission",
    "KHR_materials_emissive_strength"
  ]
}

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'tail -45 /tmp/heavy-bomber-critic-v3.txt; date -u' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
### Status of Previous Five Findings ([heavy-bomber-critic-v2.txt](file:///tmp/heavy-bomber-critic-v2.txt))

| # | v2 Finding | Status in v3 | Evidence in v3 Renders |
|---|---|---|---|
| 1 | Canopy greenhouse and rear step | **Partially Resolved** | [heavy-bomber-side-v3.png](file:///tmp/heavy-bomber-side-v3.png) adds a sloped dorsal fairing behind the canopy and thicker struts, but [heavy-bomber-final-v3.png](file:///tmp/heavy-bomber-final-v3.png) and [heavy-bomber-clay-v3.png](file:///tmp/heavy-bomber-clay-v3.png) show an open black triangular hole at the rear canopy corner where the narrower fairing misses the outer frame. |
| 2 | Pinched nose and missing cheek intakes | **Partially Resolved** | The black normal artifact on the nose tip in [heavy-bomber-side-v2.png](file:///tmp/heavy-bomber-side-v2.png) is fixed in [heavy-bomber-side-v3.png](file:///tmp/heavy-bomber-side-v3.png), and twin nose grilles are present in [heavy-bomber-final-v3.png](file:///tmp/heavy-bomber-final-v3.png), though built as a flat front bumper rather than angled cheek intakes flanking a central nose cone as in [sheet.jpg](file:///home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/sheet.jpg). |
| 3 | Wing root intersection and missing scoop | **Resolved** | [heavy-bomber-final-v3.png](file:///tmp/heavy-bomber-final-v3.png) and [heavy-bomber-side-v3.png](file:///tmp/heavy-bomber-side-v3.png) remove the clipped aft vertical hull vent and add a forward-facing wedge intake scoop ahead of the wing root. |
| 4 | Undersized chin gun and flat belly bay | **Partially Resolved** | [heavy-bomber-side-v3.png](file:///tmp/heavy-bomber-side-v3.png) extends the chin barrel forward, but the belly torpedo bay slab floats below the lower hull with a visible horizontal gap/slit along its mount instead of flush chamfered bay doors. |
| 5 | Grid seams and unweathered nozzles | **Partially Resolved** | Engine nozzles in [heavy-bomber-final-v3.png](file:///tmp/heavy-bomber-final-v3.png) are darkened, but [heavy-bomber-side-v3.png](file:///tmp/heavy-bomber-side-v3.png) and [heavy-bomber-clay-v3.png](file:///tmp/heavy-bomber-clay-v3.png) still have five unbroken vertical seam cuts slicing from dorsal spine to ventral belly. |

---

### Error vs. Art Preference

- **Spec / Art Preference (Do not change)**: Faction default gunmetal grey palette instead of the olive drab in [sheet.jpg](file:///home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/sheet.jpg); angular armored panel language; current budget headroom (93,717 / 110,000 triangles, 10.74 / 12.00 MB).
- **Actual Errors (Fix in final pass)**: Open geometry gap behind the canopy frame; unbroken full-height vertical slice seams and floating belly bay gap; uniform CG specular banding on gunmetal panels; long diagonal triangulation crease across the forward cheek armor.

---

### Top 3 Highest-Impact Corrections for Final Polish Pass

1. **Cockpit integration, rear corner hole, and cheek triangulation (Construction Gaps / Geometry)**
   - **Evidence**: In [heavy-bomber-final-v3.png](file:///tmp/heavy-bomber-final-v3.png) and [heavy-bomber-clay-v3.png](file:///tmp/heavy-bomber-clay-v3.png), there is an open black triangular gap immediately behind the rear side canopy window where the dorsal spine fairing is narrower than the canopy arch. The front windshield base frame also juts out as a step on top of the nose deck, and the forward hull side beneath the canopy shows a long diagonal triangulation crease from nose to mid-hull.
   - **Correction**: Widen the forward end of the dorsal spine fairing to weld water-tight against the outer rear canopy frame, recess the lower canopy sill into a raised cheek coaming so the windshield base sits flush with the nose slope, and planarize or support-loop the forward cheek quads to eliminate the diagonal shading kink.
   - **Acceptance**: Zero gaps/holes behind the canopy in [heavy-bomber-final-v3.png](file:///tmp/heavy-bomber-final-v3.png) and clay view; flush lower canopy sill; clean planar shading on the forward cheek armor.

2. **Full-height bread-slice vertical seams and belly bay gap (Repeat Seams / Construction Gaps)**
   - **Evidence**: In [heavy-bomber-side-v3.png](file:///tmp/heavy-bomber-side-v3.png) and [heavy-bomber-clay-v3.png](file:///tmp/heavy-bomber-clay-v3.png), five vertical seam cuts run straight from the top deck down through the middle hull and lower chine without interruption, and the underbelly torpedo bay hangs off small tabs with a continuous open horizontal gap between the bay and hull bottom.
   - **Correction**: Terminate or stagger the vertical panel seams at the upper and lower longitudinal chines (offsetting upper, mid, and lower panel breaks by at least 0.8 m), and seat the belly torpedo bay flush into the ventral hull with three distinct chamfered door segments matching [sheet.jpg](file:///home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/sheet.jpg).
   - **Acceptance**: Zero vertical seams crossing more than one hull tier in side view; zero daylight gaps between the belly bay and lower fuselage.

3. **Photographic gunmetal material variation and seam cavity darkening (Material)**
   - **Evidence**: In [heavy-bomber-final-v3.png](file:///tmp/heavy-bomber-final-v3.png) and [heavy-bomber-side-v3.png](file:///tmp/heavy-bomber-side-v3.png), the gunmetal shader has uniform roughness and value across all hull plates, producing a stark white-silver specular band on the upper shoulder bevel in 3/4 view and a chrome-like lower strip in side view, with no grime in panel recesses or heat discoloration at the aft engine shroud.
   - **Correction**: Keep the faction gunmetal base color, but add per-panel value/roughness breakup (roughness 0.38 to 0.58 across adjacent plates), ambient occlusion darkening inside panel seams and louver recesses, subtle metallic edge wear on hard bevels, and a dark heat-scorched gradient on the aft engine collar. (Use procedural/vertex/existing maps so GLB stays under 12 MB.)
   - **Acceptance**: Distinct tonal separation between adjacent armor plates, darkened panel seams/vents, and no uniform mirror-white specular strip along the shoulder or lower chine.

**Verdict**: **REVISE** (one bounded polish pass for the 3 corrections above; target completion before 21:40 CEST, current time 20:58 CET/CEST).

---

0. **Blocked on you**: nothing.
1. **What you changed**: I inspected the reference sheet, v2 renders, v2 critic notes, and v3 final, side, and clay renders to evaluate the five previous findings and define the three highest-impact fixes for the final pass.
2. **How you know it works**: Direct visual comparison of [sheet.jpg](file:///home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/sheet.jpg), [heavy-bomber-final-v2.png](file:///tmp/heavy-bomber-final-v2.png), [heavy-bomber-side-v2.png](file:///tmp/heavy-bomber-side-v2.png), [heavy-bomber-final-v3.png](file:///tmp/heavy-bomber-final-v3.png), [heavy-bomber-side-v3.png](file:///tmp/heavy-bomber-side-v3.png), and [heavy-bomber-clay-v3.png](file:///tmp/heavy-bomber-clay-v3.png) confirmed the resolved wing-root scoop, chin gun length, nose normal fix, and darkened nozzles, while exposing the rear canopy fairing gap, unbroken vertical hull seams, floating belly bay slit, and uniform specular banding.
3. **What would break if you were wrong**: If the open hole behind the canopy, the full-height vertical slice seams, and the flat specular banding are left unfixed, the asset will read as a segmented blockout with mesh gaps rather than a finished armored bomber.
4. **What you did NOT do**: I did not edit any files, run Blender, or inspect the underside/rear orthographic angles (only 3/4 and side renders were provided).
Fri Oct 16 18:59:19 UTC 2026

codex
The GLB loads correctly in Three.js with exact 16 × 5.5 × 24 m bounds and the required nodes. The second review found two construction gaps: one behind the canopy and one along the bay surround. I’m closing those, staggering the armour seams, and reducing the hull’s overly bright specular sheen.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "cat > /tmp/refine_bomber_final.py <<'PY'
from pathlib import Path
p=Path('/home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/build_heavy-bomber-opera.py')
s=p.read_text()
s=s.replace(\"default_value=.22\\nif hasattr(glass\", \"default_value=0\\nif hasattr(glass\")
s=s.replace(\"(.70*w,y,top),(-.70*w,y,top)\",\"(w-cham*1.7,y,top),(-w+cham*1.7,y,top)\")
s=s.replace(\"(-.72*w,y,bot),(.72*w,y,bot)\",\"(-w+cham*1.6,y,bot),(w-cham*1.6,y,bot)\")
a=s.index('# Flush segmented plating;');b=s.index('# Long chine reinforcements',a)
s=s[:a]+'''# Staggered armour courses follow the continuous loft. Their seam stations are
# independent of hull profile stations; each cast panel crosses the profile joins.
def ring_at(y):
 for a,b in zip(SECS,SECS[1:]):
  if a[0]<=y<=b[0]:
   t=(y-a[0])/(b[0]-a[0]);return [p.lerp(q,t) for p,q in zip(ring(a),ring(b))]
 return ring(SECS[0 if y<SECS[0][0] else -1])
for j in range(8):
 if j in (0,4):cuts=[-12,-10.65,-7.8,-4.8,-1.7,2.1,6.6,9.6,10.65]
 elif j in (1,3):cuts=[-12,-9.8,-6.95,-3.95,-.85,2.95,7.45,10.65]
 elif j in (5,7):cuts=[-12,-11.5,-8.65,-5.65,-2.55,1.25,5.75,8.75,10.65]
 elif j==2:cuts=[-12,-10.65,-4.55,-1.0,3.8,8.0,10.65]
 else:cuts=[-12,-9.0,-5.12,7.12,10.65]
 for k,(ya,yb) in enumerate(zip(cuts,cuts[1:])):
  if j==2 and k==1:continue
  if j==6 and k==2:continue
  ya+=.018;yb-=.018
  ys=[ya]+[q[0] for q in SECS if ya<q[0]<yb]+[yb]
  rr=[ring_at(y) for y in ys];a,b=rr[0][j],rr[0][(j+1)%8];c=rr[-1][(j+1)%8]
  normal=(b-a).cross(c-a).normalized();mid=(a+b+c)/3
  if normal.dot(Vector((mid.x,0,mid.z)))<0:normal=-normal
  vs=[]
  for r in rr:
   a,b=r[j],r[(j+1)%8];m=(a+b)/2
   vs.extend([m+(a-m)*.992+normal*.065,m+(b-m)*.992+normal*.065])
  N=len(vs);vs+= [v-normal*.10 for v in vs]
  fs=[]
  for q in range(len(rr)-1):
   i=q*2;fs.extend([(i,i+1,i+3,i+2),(N+i+2,N+i+3,N+i+1,N+i),(i,i+2,N+i+2,N+i),(i+1,N+i+1,N+i+3,i+3)])
  fs.extend([(0,N,N+1,1),(N-2,N-1,2*N-1,2*N-2)])
  mesh('Staggered armour course',list(map(tuple,vs)),fs,paint,bevel=.022)
  if j in (0,1,3,4) and k>0:bolts_on_quad([vs[0],vs[1],vs[N-1],vs[N-2]],r=.031)
''' +s[b:]
s=s.replace(\"# cockpit well, stepped seats and instrument panels\", \"\"\"# End cap closes the fairing around the canopy hinge without a daylight seam.
plate('Spine forward closure',[(-1.04,-4.51,1.52),(1.04,-4.51,1.52),(1.04,-4.51,2.43),(-1.04,-4.51,2.43)],.10,paint,bev=.025)
# cockpit well, stepped seats and instrument panels\"\"\")
s=s.replace(\"# Belly bomb bay: long armoured cassette with separate centre-split doors and hinges.\",\"\"\"# Belly bomb bay: long armoured cassette with separate centre-split doors and hinges.
# Static chamfered perimeter bridges the pressure hull to the hinged door seals.
for sign in [-1,1]:
 pts=[(sign*2.25,-5.15,-2.02),(sign*2.82,-5.15,-1.60),(sign*2.82,7.15,-1.60),(sign*2.25,7.15,-2.02)]
 plate('Bay perimeter armoured coaming',pts,.16,paint,bev=.045)
for yy in [-5.12,7.12]:
 plate('Bay transverse seal housing',[(-2.28,yy,-2.06),(2.28,yy,-2.06),(2.55,yy,-1.56),(-2.55,yy,-1.56)],.16,carbon,bev=.035)\"\"\")
# More roughness and less specular white banding on coated armor.
s=s.replace(\"(paint,'blue_metal_plate',(.8,.8,.8),.62,.37)\",\"(paint,'blue_metal_plate',(.8,.8,.8),.42,.48)\")
s=s.replace(\"(alloy,'metal_plate_02',(.28,.30,.32),.88,.32)\",\"(alloy,'metal_plate_02',(.24,.26,.28),.84,.39)\")
s=s.replace(\"def bake_surface(ma,id,tone,metal,rough):\",\"SHARED_NORMALS={}\\ndef bake_surface(ma,id,tone,metal,rough):\")
s=s.replace(\"ra.color_ramp.elements[0].color=(.48,.48,.48,1)\",\"ra.color_ramp.elements[0].color=(.40,.40,.40,1)\")
s=s.replace(\"l.new(mul.outputs[0],bs.inputs['Base Color'])\", \"\"\"l.new(mul.outputs[0],bs.inputs['Base Color'])
 # Patchy neutral grime and fine micrometeorite pitting, baked into the common tile.
 grime=n.new('ShaderNodeTexNoise');grime.inputs['Scale'].default_value=5;grime.inputs['Detail'].default_value=4;l.new(tc.outputs['UV'],grime.inputs[0])
 gr=n.new('ShaderNodeMapRange');gr.inputs['To Min'].default_value=.48;gr.inputs['To Max'].default_value=1;l.new(grime.outputs['Fac'],gr.inputs[0])
 weather=n.new('ShaderNodeMixRGB');weather.blend_type='MULTIPLY';weather.inputs[0].default_value=.42;l.new(mul.outputs[0],weather.inputs[1]);l.new(gr.outputs[0],weather.inputs[2]);l.new(weather.outputs[0],bs.inputs['Base Color'])
 pits=n.new('ShaderNodeTexVoronoi');pits.inputs['Scale'].default_value=110;l.new(tc.outputs['UV'],pits.inputs['Vector'])
 pitmask=n.new('ShaderNodeValToRGB');pitmask.color_ramp.elements[0].position=.027;pitmask.color_ramp.elements[0].color=(.22,.22,.22,1);pitmask.color_ramp.elements[1].position=.060;pitmask.color_ramp.elements[1].color=(1,1,1,1);l.new(pits.outputs['Distance'],pitmask.inputs[0])
 micro=n.new('ShaderNodeMixRGB');micro.blend_type='MULTIPLY';micro.inputs[0].default_value=.8;l.new(weather.outputs[0],micro.inputs[1]);l.new(pitmask.outputs[0],micro.inputs[2]);l.new(micro.outputs[0],bs.inputs['Base Color'])\"\"\")
s=s.replace(\"rr.inputs['To Min'].default_value=rough-.08;rr.inputs['To Max'].default_value=rough+.16\", \"rr.inputs['To Min'].default_value=rough-.13;rr.inputs['To Max'].default_value=rough+.16\")
s=s.replace(\"base=pass_image('BaseColor',1024,'EMIT',mul.outputs[0])\", \"base=pass_image('BaseColor',1024,'EMIT',micro.outputs[0])\")
s=s.replace(\"normal=pass_image('Normal',1024,'NORMAL')\", \"normal=pass_image('Normal',1024,'NORMAL')\\n if id in SHARED_NORMALS:normal=SHARED_NORMALS[id]\\n else:SHARED_NORMALS[id]=normal\")
s=s.replace(\"comb.inputs[0].default_value=1;l.new(rr.outputs[0],comb.inputs[1])\", \"l.new(sep.outputs['Red'],comb.inputs[0]);l.new(rr.outputs[0],comb.inputs[1])\")
s=s.replace(\"Textures: three shared Cycles-baked 1024² base/normal sets + 512² ORM; 16×4 lamp palette; 2 m physical tiling.\", \"Textures: Cycles-baked 1024² base colours and two shared normals; 512² ORM; 16×4 lamp palette; 2 m physical tiling.\")
s=s.replace(\"Reference differences: original segmented armour layout, revised canopy frames and circular nozzle petals; no lettering or insignia.\", \"Reference differences: original staggered armour layout, blunter twin-grille prow, revised canopy and nozzle petals; no lettering or insignia.\")
p.write_text(s)
PY
python3 /tmp/refine_bomber_final.py
python3 -m py_compile build_heavy-bomber-opera.py
scp build_heavy-bomber-opera.py gex44:/root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py
ssh gex44 '/root/blender-spike/blender-5.2.0-linux-x64/blender -b --python-exit-code 1 --python /root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py > /root/fal-author/heavy-bomber-opera-v1/build-final.log 2>&1'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "python3 - <<'PY'
from pathlib import Path
p=Path('/tmp/heavy-bomber-runtime/index.html')
s=p.read_text().replace(\"const camera=new THREE.PerspectiveCamera(35,1.6,.1,200);camera.position.set(28,22,35);\", \"const camera=new THREE.OrthographicCamera(-15.5,15.5,9.6875,-9.6875,.1,200);camera.position.set(28,22,35);\")
s=s.replace('window.render=()=>renderer.render(scene,camera);window.render();','window.render=()=>renderer.render(scene,camera);await renderer.compileAsync(scene,camera);window.render();')
p.write_text(s)
PY" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
exec
/bin/bash -lc "ssh gex44 'tail -12 /root/fal-author/heavy-bomber-opera-v1/build-final.log'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 530ms:
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "ssh gex44 \"pgrep -af 'heavy-bomber-opera-v1/build_heavy-bomber-opera.py'; stat -c '%s %y' /root/fal-author/heavy-bomber-opera-v1/build-final.log\"" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 670ms:
3908962 bash -c /root/blender-spike/blender-5.2.0-linux-x64/blender -b --python-exit-code 1 --python /root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py > /root/fal-author/heavy-bomber-opera-v1/build-final.log 2>&1
3908963 python3 /opt/gpu-gate/gpu_gate.py --name blender --need-mib 6000 --priority batch -- /root/blender-spike/blender-5.2.0-linux-x64/blender.real -b --python-exit-code 1 --python /root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py
3913696 bash -c pgrep -af 'heavy-bomber-opera-v1/build_heavy-bomber-opera.py'; stat -c '%s %y' /root/fal-author/heavy-bomber-opera-v1/build-final.log
0 2026-10-16 21:01:37.018243451 +0200

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "ssh gex44 'tail -10 /root/fal-author/heavy-bomber-opera-v1/build-final.log'; date -u; rg --files textures" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 534ms:
Fri Oct 16 19:02:58 UTC 2026
textures/blue_metal_plate_nor_gl_1k.jpg
textures/metal_plate_nor_gl_1k.jpg
textures/blue_metal_plate_arm_1k.jpg
textures/blue_metal_plate_diff_1k.jpg
textures/metal_plate_diff_1k.jpg
textures/metal_plate_arm_1k.jpg

codex
The final clean rebuild is queued behind another GPU job. The prior export has passed the geometry and node checks. This last pass also shares the identical metal normal map and removes an unnecessary glass refraction pass to reduce runtime cost.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "ssh gex44 'nvidia-smi --query-gpu=memory.free,utilization.gpu --format=csv,noheader; nvidia-smi --query-compute-apps=pid,used_memory,process_name --format=csv,noheader'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 515ms:
10715 MiB, 97 %
2225, 172 MiB, /home/ubuntu/speaches/.venv/bin/python
558160, 4142 MiB, python3.10
3432349, 580 MiB, /opt/conda/bin/python3.11
997757, 338 MiB, /usr/bin/python3
2585942, 828 MiB, /opt/px2-spike/venv/bin/python3
3904418, 1364 MiB, /root/blender-spike/blender-5.2.0-linux-x64/blender.real
3914237, 1362 MiB, /root/blender-spike/blender-5.2.0-linux-x64/blender.real

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "/home/claude-agent/.claude/coord/coord note 'Heavy bomber: v3 clean GLB 93,717 triangles / 10.74 MB validated; final polish clean rebuild waiting on gex44 GPU gate. Exact job directory claim retained.'
scp 'gex44:/root/fal-author/heavy-bomber-opera-v1/textures/metal_plate_02_*_1k.jpg' textures/" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 1428ms:
noted

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "ssh gex44 'tail -10 /root/fal-author/heavy-bomber-opera-v1/build-final.log'; date -u" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 435ms:
INFO gpu_gate: gpu slot acquired by blender (pid 3908963, 6000 MiB, batch)
00:00.434  cycles           | WARNING HIPEW initialization failed: Error opening HIP dynamic library
/root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py:31: DeprecationWarning: 'Material.use_nodes' is expected to be removed in Blender 6.0
  m=bpy.data.materials.new(name);m.use_nodes=True
Fri Oct 16 19:03:48 UTC 2026

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "rg -n 'Transmission|PIVOTS\\[|rotation_euler' build_heavy-bomber-opera.py; ssh gex44 'tail -6 /root/fal-author/heavy-bomber-opera-v1/build-final.log'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 670ms:
38:p=glass.node_tree.nodes.get('Principled BSDF');p.inputs['Alpha'].default_value=.34;p.inputs['Transmission Weight'].default_value=0
243:PIVOTS['Canopy']=((0,-4.55,1.58),(1,0,0),'Hull')
308: PIVOTS[gr]=((sign*2.26,1,-1.92),(0,0,-1),'Hull')
361: PIVOTS[gr]=(pivot,(0,1,0),'Hull');PIVOTS[gun]=((x,ygun,zgun),(1,0,0),gr)
415: pivot=Vector(PIVOTS[name][0]) if name in PIVOTS else Vector((0,0,0))
459: d=bpy.data.lights.new(name,'AREA');d.energy=power;d.shape='DISK';d.size=size;d.color=color;o=bpy.data.objects.new(name,d);S.collection.objects.link(o);o.location=pos;o.rotation_euler=(-o.location).to_track_quat('-Z','Y').to_euler()
464: cam.location=pos;cam.rotation_euler=(Vector((0,0,0))-cam.location).to_track_quat('-Z','Y').to_euler();camd.ortho_scale=ortho
577: if name.startswith('Turret'):ob.rotation_euler.z=math.radians(30)
578: elif name.startswith('BayDoor'):ob.rotation_euler.y=math.radians(-30 if name.endswith('L') else 30)
579: else:ob.rotation_euler.x=math.radians(30)
582:for name in PIVOTS:OBJS[name].rotation_euler=(0,0,0)
00:24.156  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/clay.png'
RENDERED clay.png
Info: Saved as "geometry.blend"
BAKE_START Paint
/root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py:486: DeprecationWarning: 'Material.use_nodes' is expected to be removed in Blender 6.0
  src=bpy.data.materials.new(ma.name+'_bake_source');src.use_nodes=True;nt=src.node_tree;n=nt.nodes;l=nt.links;n.clear()

 succeeded in 183751ms:
context compacted
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'tail -n 16 /tmp/heavy-bomber-runtime/metrics.json; tail -n 40 build_heavy-bomber-opera.py' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
{"triangles":188298,"calls":49,"geometries":37,"textures":14,"bounds":{"isBox3":true,"min":{"x":-8,"y":-2.75,"z":-12},"max":{"x":8,"y":2.75,"z":12.000000476837158}},"nodes":[{"name":"Scene","type":"Group"},{"name":"Hull","type":"Group"},{"name":"Pressure_hull","type":"Mesh"},{"name":"Pressure_hull_1","type":"Mesh"},{"name":"Pressure_hull_2","type":"Mesh"},{"name":"Pressure_hull_3","type":"Mesh"},{"name":"Pressure_hull_4","type":"Mesh"},{"name":"BayDoor_L","type":"Group"},{"name":"Torpedo_bay_door","type":"Mesh"},{"name":"Torpedo_bay_door_1","type":"Mesh"},{"name":"Torpedo_bay_door_2","type":"Mesh"},{"name":"BayDoor_R","type":"Group"},{"name":"Torpedo_bay_door001","type":"Mesh"},{"name":"Torpedo_bay_door001_1","type":"Mesh"},{"name":"Torpedo_bay_door001_2","type":"Mesh"},{"name":"Camera_Chase","type":"Object3D"},{"name":"Canopy","type":"Group"},{"name":"Canopy_side_glazing","type":"Mesh"},{"name":"Canopy_side_glazing_1","type":"Mesh"},{"name":"Canopy_side_glazing_2","type":"Mesh"},{"name":"Hardpoint_1","type":"Object3D"},{"name":"Hardpoint_2","type":"Object3D"},{"name":"Hardpoint_3","type":"Object3D"},{"name":"Hardpoint_4","type":"Object3D"},{"name":"Hardpoint_5","type":"Object3D"},{"name":"Hardpoint_6","type":"Object3D"},{"name":"Hardpoint_7","type":"Object3D"},{"name":"Light_Beacon","type":"Object3D"},{"name":"Light_Nav_L","type":"Object3D"},{"name":"Light_Nav_R","type":"Object3D"},{"name":"Seat_Copilot","type":"Object3D"},{"name":"Seat_Pilot","type":"Object3D"},{"name":"Thruster_1","type":"Object3D"},{"name":"Thruster_2","type":"Object3D"},{"name":"Thruster_3","type":"Object3D"},{"name":"Turret_1","type":"Group"},{"name":"Traverse_skirt","type":"Mesh"},{"name":"Traverse_skirt_1","type":"Mesh"},{"name":"Traverse_skirt_2","type":"Mesh"},{"name":"Gun_1","type":"Group"},{"name":"Gun_receiver","type":"Mesh"},{"name":"Gun_receiver_1","type":"Mesh"},{"name":"Muzzle_1","type":"Object3D"},{"name":"Muzzle_2","type":"Object3D"},{"name":"Turret_2","type":"Group"},{"name":"Traverse_skirt001","type":"Mesh"},{"name":"Traverse_skirt001_1","type":"Mesh"},{"name":"Traverse_skirt001_2","type":"Mesh"},{"name":"Gun_2","type":"Group"},{"name":"Gun_receiver002","type":"Mesh"},{"name":"Gun_receiver002_1","type":"Mesh"},{"name":"Muzzle_3","type":"Object3D"}]}
j=json.dumps(doc,separators=(',',':')).encode();j+=b' '*((-len(j))%4)
glb.write_bytes(struct.pack('<III',0x46546c67,2,12+8+len(j)+len(binary))+struct.pack('<II',len(j),0x4e4f534a)+j+binary)
nt.links.new(fac.outputs[0],bs.inputs['Base Color'])
tris=sum(len(p.vertices)-2 for o in OBJS.values() for p in o.data.polygons)
assert 50000 <= tris <= 110000, f'Triangle budget: {tris}'
assert glb.stat().st_size <= 12_000_000, 'GLB size budget exceeded'
print('EXPORTED',tris,'triangles',glb.stat().st_size,'bytes',flush=True)
# Metadata in the delivered glTF frame (X left, Y up, Z nose).
def gltf(v):return [round(float(v[0]),6),round(float(v[2]),6),round(float(-v[1]),6)]
bpy.context.view_layer.update();pts=[o.matrix_world@v.co for o in OBJS.values() for v in o.data.vertices];bbmin=[min(p[i] for p in pts) for i in range(3)];bbmax=[max(p[i] for p in pts) for i in range(3)]
metadata={'asset':'heavy-bomber-opera','units':'metres','forward':'+Z','up':'+Y','left':'+X','bounding_box':{'min':[bbmin[0],bbmin[2],-bbmax[1]],'max':[bbmax[0],bbmax[2],-bbmin[1]],'dimensions':[16,5.5,24]},'triangles':tris,'materials':[m['name'] for m in doc['materials']],'file_bytes':glb.stat().st_size,'axes':{k:list(v[1]) for k,v in PIVOTS.items()},'paints':[{'name':n,'linear_rgb':v} for n,v in PAINTS],'nodes':{o.name:{'world_position':gltf(o.matrix_world.translation),'parent':o.parent.name if o.parent else None,'type':'mesh' if o.type=='MESH' else 'empty'} for o in ASSET}}
(ROOT/'nodes.json').write_text(json.dumps(metadata,indent=2))
(ROOT/'NOTES.md').write_text('\n'.join(["Original heavy space-opera assault bomber; 24 × 16 × 5.5 m; closed flight configuration, articulated turrets, canopy and bay doors.",f"Triangles: {tris:,}; GLB: {glb.stat().st_size/1048576:.2f} MiB; rigid assemblies joined; no lights or cameras exported.","Materials: Paint, Alloy, Carbon, Glass, Engines, Lamps; Paint neutral texture × linear gunmetal [0.20, 0.22, 0.24].","Textures: Cycles-baked 1024² base colours and two shared normals; 512² ORM; 16×4 lamp palette; 2 m physical tiling.","Poly Haven CC0 IDs: metal_plate_02, blue_metal_plate; https://polyhaven.com/a/metal_plate_02 ; https://polyhaven.com/a/blue_metal_plate ; licence https://polyhaven.com/license .","Reference differences: original staggered armour layout, blunter twin-grille prow, revised canopy and nozzle petals; no lettering or insignia."])+ '\n')
# Production renders.
camera(HERO,29.8);render('final.png',1920,1080,48)
camera((32,0,1.5),28);render('side.png',1920,1080,28)
camera((23,33,16),29.8);render('rear.png',1440,900,24)
# Mechanical check: turn each moving part 30 degrees about its declared pivot.
base_locs={name:OBJS[name].location.copy() for name in PIVOTS}
for name in PIVOTS:
 ob=OBJS[name]
 if name.startswith('Turret'):ob.rotation_euler.z=math.radians(30)
 elif name.startswith('BayDoor'):ob.rotation_euler.y=math.radians(-30 if name.endswith('L') else 30)
 else:ob.rotation_euler.x=math.radians(30)
for name in PIVOTS:assert (OBJS[name].location-base_locs[name]).length<1e-8
camera((25,-30,-18),30);render('articulation.png',1440,900,24)
for name in PIVOTS:OBJS[name].rotation_euler=(0,0,0)
camera(HERO,29.8)
# Build six images into one 3x2 contact sheet without a dependency on Pillow.
frames=[]
for name,col in PAINTS:
 fac.inputs[2].default_value=(*col,1);render('_paint_'+name.replace(' ','_')+'.png',640,360,16)
 im=bpy.data.images.load(str(ROOT/('_paint_'+name.replace(' ','_')+'.png')),check_existing=False)
 frames.append(np.array(im.pixels[:],dtype=np.float32).reshape(360,640,4));bpy.data.images.remove(im)
canvas=np.zeros((720,1920,4),dtype=np.float32)
for i,pixels in enumerate(frames):canvas[(1-i//3)*360:(2-i//3)*360,(i%3)*640:(i%3+1)*640]=pixels
im=bpy.data.images.new('Six faction paints',1920,720);im.pixels.foreach_set(canvas.ravel());im.filepath_raw=str(ROOT/'paints.png');im.file_format='PNG';im.save()
fac.inputs[2].default_value=(*PAINTS[0][1],1)
bpy.ops.wm.save_as_mainfile(filepath=str(ROOT/'heavy-bomber-opera.blend'))
print('BUILD_COMPLETE',flush=True)

codex
The latest build has finished. I’m checking the armour seams and weathering, then verifying that the canopy, turrets and bay doors open around their declared pivots.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "head -n 35 build_heavy-bomber-opera.py; rg -n 'PIVOTS|BayDoor|Canopy|HERO' build_heavy-bomber-opera.py; ssh gex44 tail -n 6 /root/fal-author/heavy-bomber-opera-v1/build-final.log" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
exec
/bin/bash -lc 'scp gex44:/root/fal-author/heavy-bomber-opera-v1/{final.png,side.png,clay.png,paints.png,rear.png,articulation.png,heavy-bomber-opera.glb,nodes.json} /tmp/heavy-bomber-runtime/' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 617ms:
#!/usr/bin/env python3
"""Original 24 m assault bomber. Run with Blender 5.2 --background --python-exit-code 1.
Clean build: downloads CC0 inputs, models geometry, bakes Cycles PBR tiles, exports,
renders six liveries and checks pivots. Blender coordinates X left, Y aft, Z up.
Target: 50-110k triangles, <=9 materials, 1024 RGB/normal, 512 ORM, <12 MB.
Views: front hero, side orthographic, rear, underside articulation; 3 revision cap.
"""
import bpy, bmesh, math, os, json, urllib.request, subprocess, struct, random
from mathutils import Vector, Matrix
from pathlib import Path
import numpy as np
ROOT=Path(__file__).resolve().parent
TEX=ROOT/'textures'; TEX.mkdir(exist_ok=True)
OUT=ROOT/'baked'; OUT.mkdir(exist_ok=True)
random.seed(37)
bpy.ops.object.select_all(action='SELECT'); bpy.ops.object.delete(use_global=False)
for d in list(bpy.data.materials): bpy.data.materials.remove(d)
S=bpy.context.scene; S.unit_settings.system='METRIC'; S.unit_settings.scale_length=1
S.render.engine='CYCLES'; S.cycles.samples=32; S.cycles.use_denoising=True
P=bpy.context.preferences.addons['cycles'].preferences
P.compute_device_type='OPTIX'; P.get_devices()
for d in P.devices:d.use=(d.type!='CPU')
S.cycles.device='GPU'; S.cycles.max_bounces=6; S.cycles.transparent_max_bounces=8
S.render.image_settings.file_format='PNG'; S.render.film_transparent=False
S.view_settings.view_transform='AgX'; S.view_settings.look='AgX - Medium High Contrast'
S.render.resolution_percentage=100
GROUPS={}; MATS={}; ASSET=[]; PIVOTS={}
PAINTS=[('Gunmetal',[.20,.22,.24]),('Olive drab',[.23,.26,.14]),('Naval grey',[.38,.44,.49]),('Desert sand',[.52,.40,.23]),('Arctic white',[.75,.80,.83]),('Deep navy',[.035,.075,.135])]

def mat(name,col,metal=0,rough=.45):
 m=bpy.data.materials.new(name);m.use_nodes=True
 p=m.node_tree.nodes.get('Principled BSDF');p.inputs['Base Color'].default_value=(*col,1);p.inputs['Metallic'].default_value=metal;p.inputs['Roughness'].default_value=rough
 m.diffuse_color=(*col,1);MATS[name]=m;return m
paint=mat('Paint',PAINTS[0][1],.64,.4)
alloy=mat('Alloy',(.28,.31,.33),.85,.34)
27:GROUPS={}; MATS={}; ASSET=[]; PIVOTS={}
234:  plate('Canopy side glazing',pts,.022,glass,'Canopy',.008)
235:  outline('Canopy armoured frame',pts,.086,paint,'Canopy')
237: plate('Forward windshield' if k==0 else 'Roof glazing',pts,.025,glass if k<2 else paint,'Canopy',.008)
238: outline('Canopy roof frame',pts,.075,paint,'Canopy')
241:plate('Canopy rear shell',[(-w,y,lo),(w,y,lo),(w*.79,y,hi),(-w*.79,y,hi)],.09,paint,'Canopy',.035)
242:beam('Canopy transverse hinge',(-1.05,-4.55,1.58),(1.05,-4.55,1.58),.10,alloy,'Canopy',24)
243:PIVOTS['Canopy']=((0,-4.55,1.58),(1,0,0),'Hull')
297: gr='BayDoor_'+label
308: PIVOTS[gr]=((sign*2.26,1,-1.92),(0,0,-1),'Hull')
361: PIVOTS[gr]=(pivot,(0,1,0),'Hull');PIVOTS[gun]=((x,ygun,zgun),(1,0,0),gr)
415: pivot=Vector(PIVOTS[name][0]) if name in PIVOTS else Vector((0,0,0))
423:for name,(pivot,axis,parent) in PIVOTS.items():
462:HERO=(28,-35,22)
465:camera(HERO,29.8)
566:metadata={'asset':'heavy-bomber-opera','units':'metres','forward':'+Z','up':'+Y','left':'+X','bounding_box':{'min':[bbmin[0],bbmin[2],-bbmax[1]],'max':[bbmax[0],bbmax[2],-bbmin[1]],'dimensions':[16,5.5,24]},'triangles':tris,'materials':[m['name'] for m in doc['materials']],'file_bytes':glb.stat().st_size,'axes':{k:list(v[1]) for k,v in PIVOTS.items()},'paints':[{'name':n,'linear_rgb':v} for n,v in PAINTS],'nodes':{o.name:{'world_position':gltf(o.matrix_world.translation),'parent':o.parent.name if o.parent else None,'type':'mesh' if o.type=='MESH' else 'empty'} for o in ASSET}}
570:camera(HERO,29.8);render('final.png',1920,1080,48)
574:base_locs={name:OBJS[name].location.copy() for name in PIVOTS}
575:for name in PIVOTS:
578: elif name.startswith('BayDoor'):ob.rotation_euler.y=math.radians(-30 if name.endswith('L') else 30)
580:for name in PIVOTS:assert (OBJS[name].location-base_locs[name]).length<1e-8
582:for name in PIVOTS:OBJS[name].rotation_euler=(0,0,0)
583:camera(HERO,29.8)
01:01.291  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/_paint_Deep_navy.png'
RENDERED _paint_Deep_navy.png
Info: Saved as "heavy-bomber-opera.blend"
BUILD_COMPLETE

Blender quit

 succeeded in 8444ms:
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "sed -n '38,225p' build_heavy-bomber-opera.py; sed -n '285,325p' build_heavy-bomber-opera.py; sed -n '405,460p' build_heavy-bomber-opera.py" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
p=glass.node_tree.nodes.get('Principled BSDF');p.inputs['Alpha'].default_value=.34;p.inputs['Transmission Weight'].default_value=0
if hasattr(glass,'surface_render_method'):glass.surface_render_method='DITHERED'
engines=mat('Engines',(.25,.045,.008),.25,.4)
p=engines.node_tree.nodes.get('Principled BSDF');p.inputs['Emission Color'].default_value=(1,.18,.018,1);p.inputs['Emission Strength'].default_value=2.2
lamps=mat('Lamps',(.3,.5,.6),.1,.32)
# Shared tiny palette: red, green, ice blue, amber. UV positions select colours.
im=bpy.data.images.new('Lamp_palette',width=16,height=4)
cols=[(1,.012,.004,1),(.01,1,.11,1),(.25,.65,1,1),(1,.28,.015,1)]
im.pixels=[v for y in range(4) for x in range(16) for v in cols[x//4]]; im.filepath_raw=str(OUT/'Lamps.png');im.file_format='PNG';im.save()
nt=lamps.node_tree;t=nt.nodes.new('ShaderNodeTexImage');t.image=im;t.interpolation='Closest';p=nt.nodes.get('Principled BSDF');nt.links.new(t.outputs['Color'],p.inputs['Base Color']);nt.links.new(t.outputs['Color'],p.inputs['Emission Color']);p.inputs['Emission Strength'].default_value=2

def mesh(name,verts,faces,material=paint,group='Hull',bevel=0.02,segments=2):
 me=bpy.data.meshes.new(name);me.from_pydata(verts,[],faces);me.update()
 ob=bpy.data.objects.new(name,me);S.collection.objects.link(ob)
 me.materials.append(material)
 bm=bmesh.new();bm.from_mesh(me);bmesh.ops.recalc_face_normals(bm,faces=bm.faces);bm.to_mesh(me);bm.free()
 bpy.context.view_layer.objects.active=ob;ob.select_set(True)
 if bevel:
  mod=ob.modifiers.new('Machined edge radii','BEVEL');mod.width=bevel;mod.segments=segments
  if material==paint:
   me.materials.append(alloy);mod.affect='EDGES';mod.material=1
  bpy.ops.object.modifier_apply(modifier=mod.name)
 # Planar box mapping at 2 m per tile; all parts share the baked surface sets.
 uv=me.uv_layers.new(name='UVMap') if not me.uv_layers else me.uv_layers.active
 for f in me.polygons:
  no=f.normal;axis=max(range(3),key=lambda i:abs(no[i]));axes=[i for i in range(3) if i!=axis]
  for li in f.loop_indices:
   co=me.vertices[me.loops[li].vertex_index].co;uv.data[li].uv=(co[axes[0]]/2,co[axes[1]]/2)
 for f in me.polygons:f.use_smooth=False
 ob.select_set(False)
 GROUPS.setdefault(group,[]).append(ob);return ob

def box(name,c,size,ma=paint,gr='Hull',bev=.035):
 x,y,z=c;a,b,d=[v/2 for v in size]
 return mesh(name,[(x+i*a,y+j*b,z+k*d) for i,j,k in [(-1,-1,-1),(-1,-1,1),(-1,1,-1),(-1,1,1),(1,-1,-1),(1,-1,1),(1,1,-1),(1,1,1)]],[(0,4,6,2),(1,3,7,5),(0,1,5,4),(2,6,7,3),(0,2,3,1),(4,5,7,6)],ma,gr,bev)

def plate(name,pts,thick=.06,ma=paint,gr='Hull',bev=.018):
 pts=[Vector(v) for v in pts];n=(pts[1]-pts[0]).cross(pts[2]-pts[0]).normalized();N=len(pts)
 return mesh(name,[tuple(p+n*thick/2) for p in pts]+[tuple(p-n*thick/2) for p in pts],[tuple(range(N)),tuple(reversed(range(N,2*N)))]+[(i,(i+1)%N,(i+1)%N+N,i+N) for i in range(N)],ma,gr,bev)

def beam(name,a,b,r=.045,ma=alloy,gr='Hull',N=10):
 return cyl(name,a,b,r,ma,gr,N,bev=0)

def cyl(name,a,b,r,ma=alloy,gr='Hull',N=32,r2=None,bev=.008):
 a,b=Vector(a),Vector(b);z=(b-a).normalized();u=z.cross(Vector((0,0,1)))
 if u.length<.1:u=z.cross(Vector((0,1,0)))
 u.normalize();v=z.cross(u);r2=r if r2 is None else r2
 vs=[tuple(c+radius*(math.cos(i*2*math.pi/N)*u+math.sin(i*2*math.pi/N)*v)) for c,radius in [(a,r),(b,r2)] for i in range(N)]
 fs=[tuple(reversed(range(N))),tuple(range(N,2*N))]+[(i,(i+1)%N,(i+1)%N+N,i+N) for i in range(N)]
 ob=mesh(name,vs,fs,ma,gr,bev,1)
 for f in ob.data.polygons:
  if len(f.vertices)==4:f.use_smooth=True
 return ob

def tube(name,c,axis,profile,ma=alloy,gr='Hull',N=64):
 c=Vector(c);d=Vector(axis).normalized();u=d.cross(Vector((0,0,1)))
 if u.length<.1:u=d.cross(Vector((0,1,0)))
 u.normalize();v=d.cross(u)
 vs=[tuple(c+d*t+rad*(u*math.cos(i*2*math.pi/N)+v*math.sin(i*2*math.pi/N))) for t,rad in profile for i in range(N)]
 fs=[]
 for j in range(len(profile)):
  k=(j+1)%len(profile)
  for i in range(N):q=(i+1)%N;fs.append((j*N+i,j*N+q,k*N+q,k*N+i))
 ob=mesh(name,vs,fs,ma,gr,0)
 for f in ob.data.polygons:f.use_smooth=True
 return ob

def socket(name,world,parent=None):
 ob=bpy.data.objects.new(name,None);S.collection.objects.link(ob);ob.empty_display_size=.18
 if parent:
  ob.parent=parent;ob.location=parent.matrix_world.inverted()@Vector(world)
 else:ob.location=world
 ASSET.append(ob);return ob

def bolts_on_quad(pts,ma=alloy,gr='Hull',r=.035):
 a,b,c,d=map(Vector,pts);n=(b-a).cross(c-a).normalized()
 for u,v in [(.06,.09),(.94,.09),(.94,.91),(.06,.91)]:
  p=a*(1-u)*(1-v)+b*u*(1-v)+c*u*v+d*(1-u)*v
  cyl('Captive fastener',p+n*.04,p+n*.07,r,ma,gr,8,bev=.002)

def outline(name,pts,r=.035,ma=alloy,gr='Hull',closed=True):
 for i in range(len(pts) if closed else len(pts)-1):beam(name,pts[i],pts[(i+1)%len(pts)],r,ma,gr,8)

# Main hull: eight-faced continuous armoured loft, widening behind a blunt wedge nose.
SECS=[(-12,2.02,-1.30,.06),(-10.65,2.35,-1.45,.35),(-7.8,3.0,-1.65,1.08),(-4.8,3.55,-1.72,1.58),(-1.7,3.95,-1.78,1.8),(2.1,4.15,-1.78,1.82),(6.6,4.2,-1.7,1.7),(9.6,3.95,-1.45,1.55),(10.65,3.72,-1.18,1.35)]
def ring(sec):
 y,w,bot,top=sec
 cham=min(.65,(top-bot)*.24)
 return [Vector(v) for v in [(w,y,bot+cham),(w,y,top-cham),(w-cham*1.7,y,top),(-w+cham*1.7,y,top),(-w,y,top-cham),(-w,y,bot+cham),(-w+cham*1.6,y,bot),(w-cham*1.6,y,bot)]]
rings=[ring(s) for s in SECS]
verts=[tuple(p) for r in rings for p in r];faces=[tuple(reversed(range(8))),tuple(range(64,72))]
for k in range(len(rings)-1):
 for j in range(8):faces.append((k*8+j,k*8+(j+1)%8,(k+1)*8+(j+1)%8,(k+1)*8+j))
core=mesh('Pressure hull',verts,faces,carbon,bevel=.075)
# Genuine cockpit recess cut through top skin; canopy is hollow and operable.
cut=box('Cockpit machining cutter',(0,-7.1,2.0),(2.1,6.1,2.7),carbon,gr='_cut',bev=.12)
bpy.context.view_layer.objects.active=core
mod=core.modifiers.new('Cockpit volume','BOOLEAN');mod.operation='DIFFERENCE';mod.object=cut;bpy.ops.object.modifier_apply(modifier=mod.name)
bpy.data.objects.remove(cut,do_unlink=True);GROUPS.pop('_cut')
cut=box('Bay machining cutter',(0,1,-2.0),(4.5,12.2,2.1),carbon,gr='_cut',bev=.08)
bpy.context.view_layer.objects.active=core
mod=core.modifiers.new('Open torpedo cassette','BOOLEAN');mod.operation='DIFFERENCE';mod.object=cut;bpy.ops.object.modifier_apply(modifier=mod.name)
bpy.data.objects.remove(cut,do_unlink=True);GROUPS.pop('_cut')
# Staggered armour courses follow the continuous loft. Their seam stations are
# independent of hull profile stations; each cast panel crosses the profile joins.
def ring_at(y):
 for a,b in zip(SECS,SECS[1:]):
  if a[0]<=y<=b[0]:
   t=(y-a[0])/(b[0]-a[0]);return [p.lerp(q,t) for p,q in zip(ring(a),ring(b))]
 return ring(SECS[0 if y<SECS[0][0] else -1])
for j in range(8):
 if j in (0,4):cuts=[-12,-10.65,-7.8,-4.8,-1.7,2.1,6.6,9.6,10.65]
 elif j in (1,3):cuts=[-12,-9.8,-6.95,-3.95,-.85,2.95,7.45,10.65]
 elif j in (5,7):cuts=[-12,-11.5,-8.65,-5.65,-2.55,1.25,5.75,8.75,10.65]
 elif j==2:cuts=[-12,-10.65,-4.55,-1.0,3.8,8.0,10.65]
 else:cuts=[-12,-9.0,-5.12,7.12,10.65]
 for k,(ya,yb) in enumerate(zip(cuts,cuts[1:])):
  if j==2 and k==1:continue
  if j==6 and k==2:continue
  ya+=.018;yb-=.018
  ys=[ya]+[q[0] for q in SECS if ya<q[0]<yb]+[yb]
  rr=[ring_at(y) for y in ys];a,b=rr[0][j],rr[0][(j+1)%8];c=rr[-1][(j+1)%8]
  normal=(b-a).cross(c-a).normalized();mid=(a+b+c)/3
  if normal.dot(Vector((mid.x,0,mid.z)))<0:normal=-normal
  vs=[]
  for r in rr:
   a,b=r[j],r[(j+1)%8];m=(a+b)/2
   vs.extend([m+(a-m)*.992+normal*.065,m+(b-m)*.992+normal*.065])
  N=len(vs);vs+= [v-normal*.10 for v in vs]
  fs=[]
  for q in range(len(rr)-1):
   i=q*2;fs.extend([(i,i+1,i+3,i+2),(N+i+2,N+i+3,N+i+1,N+i),(i,i+2,N+i+2,N+i),(i+1,N+i+1,N+i+3,i+3)])
  fs.extend([(0,N,N+1,1),(N-2,N-1,2*N-1,2*N-2)])
  mesh('Staggered armour course',list(map(tuple,vs)),fs,paint,bevel=.022)
  if j in (0,1,3,4) and k>0:bolts_on_quad([vs[0],vs[1],vs[N-1],vs[N-2]],r=.031)
# Long chine reinforcements integrated into shoulder edges.
for sign in [-1,1]:
 for k in range(1,7):
  a=rings[k][1 if sign==1 else 4];b=rings[k+1][1 if sign==1 else 4]
  beam('Continuous shoulder cap',a+Vector((sign*.045,0,.1)),b+Vector((sign*.045,0,.1)),.055,alloy,N=8)
# Nose intake faces, dark recessed throats and stacked aero/thermal louvers.
for sign in [-1,1]:
 pts=[(sign*.34,-12.10,-1.09),(sign*1.70,-12.10,-1.09),(sign*1.79,-12.10,-.17),(sign*.28,-12.10,-.17)]
 plate('Nose radiator shadow',pts,.05,carbon,bev=.055)
 outline('Nose radiator lip',pts,.055,alloy)
 for i in range(6):
  z=-.98+i*.14
  beam('Nose radiator fin',(sign*.43,-12.15,z),(sign*1.60,-12.15,z),.025,carbon,N=8)
plate('Central prow armour',[(-.22,-12.08,-1.1),(.22,-12.08,-1.1),(.30,-12.16,.0),(-.30,-12.16,.0)],.1,paint,bev=.025)
# Recessed thermal exchangers follow the actual hull taper to avoid burying fins.
def hull_at(y):
 for a,b in zip(SECS,SECS[1:]):
  if a[0]<=y<=b[0]:
   t=(y-a[0])/(b[0]-a[0]);return [a[i]*(1-t)+b[i]*t for i in range(1,4)]
 return list(SECS[0 if y<SECS[0][0] else -1][1:])
for sign in [-1,1]:
 y=-3.2;span=1.7
 def vx(yy,extra=0):return sign*(hull_at(yy)[0]+.10+extra)
 pts=[(vx(y-span/2),y-span/2,-.94),(vx(y+span/2),y+span/2,-.94),(vx(y+span/2),y+span/2,.77),(vx(y-span/2),y-span/2,.77)]
 plate('Recessed exchanger well',pts,.12,carbon,bev=.08)
 outline('Exchanger cast surround',[(x+sign*.10,a,b) for x,a,b in pts],.075,alloy)
 for z in np.linspace(-.79,.62,12):beam('Heat exchanger slat',(vx(y-span*.4,.10),y-span*.4,z),(vx(y+span*.4,.10),y+span*.4,z),.042,carbon,N=8)
 # small lateral fixed housings / RCS sockets
 x=sign*3.05
 box('Flush RCS fairing',(x,-7.1,-.20),(.26,1.25,.32),alloy,bev=.1)
 for yy in [-7.48,-7.13,-6.78]:cyl('RCS port',(x+sign*.11,yy,-.20),(x+sign*.19,yy,-.20),.065,carbon,N=16)
# Raised service spine behind the cockpit, deliberately narrow and integrated.
spine=[(-4.52,1.02,1.55,2.43),(-2.8,1.18,1.72,2.17),(1.5,1.15,1.80,2.08),(7.8,1.14,1.60,1.93),(9.7,.95,1.5,1.77)]
for a,b in zip(spine,spine[1:]):
 y,w,lo,hi=a;Y,W,LO,HI=b
 pts=[(-w,y,hi),(w,y,hi),(W,Y,HI),(-W,Y,HI)]
 plate('Dorsal armoured spine',pts,.18,paint,bev=.055)
 for sign in [-1,1]:
  plate('Dorsal spine sidewall',[(sign*w,y,lo),(sign*W,Y,LO),(sign*W,Y,HI),(sign*w,y,hi)],.10,paint,bev=.03)
# End cap closes the fairing around the canopy hinge without a daylight seam.
plate('Spine forward closure',[(-1.04,-4.51,1.52),(1.04,-4.51,1.52),(1.04,-4.51,2.43),(-1.04,-4.51,2.43)],.10,paint,bev=.025)
# cockpit well, stepped seats and instrument panels
box('Cabin black tub',(0,-7.25,.64),(1.92,5.65,.22),carbon,bev=.08)
for y,z in [(-7.9,.83),(-5.85,1.12)]:
 box('Seat suspension',(0,y,z),(.65,.68,.25),alloy,bev=.06)
 box('Seat cushion',(0,y,z+.18),(.68,.65,.20),carbon,bev=.09)
 box('Seat back',(0,y+.29,z+.61),(.69,.18,.75),carbon,bev=.08)
 box('Head restraint',(0,y+.32,z+1.04),(.43,.19,.24),carbon,bev=.065)
 for x in [-.23,.23]:box('Seat harness',(x,y+.175,z+.64),(.055,.035,.63),alloy,bev=.012)
 box('Instrument coaming',(0,y-.57,z+.65),(1.35,.25,.30),carbon,bev=.055)
 for x in [-.41,0,.41]:
  ob=box('Flight display',(x,y-.715,z+.68),(.28,.025,.16),lamps,bev=.015)
  for uv in ob.data.uv_layers.active.data:uv.uv=(.63,.5)
 plate('Bay perimeter armoured coaming',pts,.16,paint,bev=.045)
for yy in [-5.12,7.12]:
 plate('Bay transverse seal housing',[(-2.28,yy,-2.06),(2.28,yy,-2.06),(2.55,yy,-1.56),(-2.55,yy,-1.56)],.16,carbon,bev=.035)
box('Torpedo bay ceiling',(0,1,-.94),(4.6,12.3,.14),carbon,bev=.05)
for sign in [-1,1]:
 box('Torpedo bay sidewall',(sign*2.26,1,-1.43),(.15,12.1,1.0),carbon,bev=.04)
 beam('Torpedo suspension rail',(sign*.74,-4.7,-1.13),(sign*.74,6.7,-1.13),.07,alloy,N=12)
 for y in [-3.2,1.1,5.1]:
  cyl('Internal torpedo body',(sign*.74,y-1.5,-1.55),(sign*.74,y+1.4,-1.55),.26,carbon,N=24,bev=.01)
  cyl('Torpedo warhead',(sign*.74,y-1.95,-1.55),(sign*.74,y-1.5,-1.55),.045,alloy,N=24,r2=.26,bev=.01)
  box('Torpedo release clamp',(sign*.74,y,-1.27),(.65,.22,.25),alloy,bev=.035)
for sign,label in [(1,'L'),(-1,'R')]:
 gr='BayDoor_'+label
 pts=[(sign*.035,-5.05,-2.22),(sign*2.26,-5.05,-1.94),(sign*2.26,7.04,-1.94),(sign*.035,7.04,-2.22)]
 plate('Torpedo bay door',pts,.36,paint,gr,bev=.055)
 for yy in [-4.85,-1.0,2.85,6.8]:
  beam('Bay door cross rib',(sign*.16,yy,-2.40),(sign*2.15,yy,-2.15),.05,alloy,gr,N=8)
 for yy in [-4.5,-.8,2.9,6.5]:
  cyl('Bay hinge pin',(sign*2.28,yy-.28,-1.9),(sign*2.28,yy+.28,-1.9),.10,alloy,N=20)
  box('Bay hinge strap',(sign*2.15,yy,-1.98),(.35,.24,.19),carbon,gr,bev=.03)
 for yy in [-3.0,.85,4.70]:
  for direction in [-1,1]:
   beam('Bay embossed diagonal',(sign*.28,yy+direction*1.4,-2.36),(sign*2.05,yy-direction*1.4,-2.17),.028,carbon,gr,N=8)
 PIVOTS[gr]=((sign*2.26,1,-1.92),(0,0,-1),'Hull')
# Retracted service / landing doors flush in lower chine (no extended gear).
for sign in [-1,1]:
 for yy in [-6.7,8.1]:
  pts=[(sign*2.2,yy-.55,-1.57),(sign*3.0,yy-.55,-1.22),(sign*3.0,yy+.55,-1.22),(sign*2.2,yy+.55,-1.57)]
  plate('Closed service hatch',pts,.065,paint,bev=.025)
# Three main engines in a tight transverse row. Deep concentric nozzles and heat petals.
for e,x in enumerate([-2.58,0,2.58],1):
 z=.0
 tube('Engine armoured sleeve',(x,0,z),(0,1,0),[(8.9,1.29),(10.45,1.29),(11.65,1.18),(11.96,1.12),(11.96,.97),(11.55,.99),(10.4,1.10),(8.9,1.10)],carbon,N=64)
 for y,rad in [(10.30,1.30),(10.65,1.27),(11.82,1.15)]:
  tube('Engine rolled reinforcement',(x,y,z),(0,1,0),[(-.07,rad),(.07,rad),(.09,rad-.08),(-.09,rad-.08)],alloy,N=64)
 # Petals taper and reveal a black expansion gap between them.
 for k in range(18):
  a=2*math.pi*k/18+.024;b=2*math.pi*(k+1)/18-.024
  pts=[(x+1.30*math.cos(a),10.5,z+1.30*math.sin(a)),(x+1.30*math.cos(b),10.5,z+1.30*math.sin(b)),(x+1.145*math.cos(b),11.78,z+1.145*math.sin(b)),(x+1.145*math.cos(a),11.78,z+1.145*math.sin(a))]
  plate('Thermal nozzle petal',pts,.06,carbon,bev=.018)
  ang=(a+b)/2
for uv in ob.data.uv_layers.active.data:uv.uv=(.875,.5)
print('GEOMETRY_BUILT',sum(len(v) for v in GROUPS.values()),flush=True)

# Join only rigid assemblies. Move vertex coordinates to the pivot without applying
# a moving node's transforms. Child local origins remain exact mechanical pivots.
OBJS={}
for name,parts in GROUPS.items():
 bpy.ops.object.select_all(action='DESELECT')
 for ob in parts:ob.select_set(True)
 bpy.context.view_layer.objects.active=parts[0];bpy.ops.object.join();ob=bpy.context.object;ob.name=name
 pivot=Vector(PIVOTS[name][0]) if name in PIVOTS else Vector((0,0,0))
 ob.data.transform(Matrix.Translation(-pivot));ob.location=pivot;OBJS[name]=ob;ASSET.append(ob)
 # recalculate normals and eliminate only true zero-area slivers before export
 bm=bmesh.new();bm.from_mesh(ob.data)
 bmesh.ops.triangulate(bm,faces=list(bm.faces))
 bad=[f for f in bm.faces if f.calc_area()<1e-8]
 if bad:bmesh.ops.delete(bm,geom=bad,context='FACES')
 bmesh.ops.recalc_face_normals(bm,faces=bm.faces);bm.to_mesh(ob.data);bm.free();ob.data.update()
for name,(pivot,axis,parent) in PIVOTS.items():
 ob=OBJS[name];par=OBJS[parent];ob.parent=par;ob.matrix_parent_inverse=Matrix.Identity(4);ob.location=Vector(pivot)-par.matrix_world.translation
bpy.context.view_layer.update()
# Normalize dimensions by editing mesh coordinates and pivot locations, not node transforms.
# Hinge axes all align with principal axes; this preserves exact shared pivot positions.
pts=[o.matrix_world@v.co for o in OBJS.values() for v in o.data.vertices]
lo=Vector(tuple(min(p[i] for p in pts) for i in range(3)));hi=Vector(tuple(max(p[i] for p in pts) for i in range(3)))
scale=Vector((16/(hi.x-lo.x),24/(hi.y-lo.y),5.5/(hi.z-lo.z)))
center=(lo+hi)/2;center.x=0
D=Matrix.Diagonal((*scale,1))
for ob in OBJS.values():ob.data.transform(D)
for name,ob in OBJS.items():
 if ob.parent:ob.location=Vector([ob.location[i]*scale[i] for i in range(3)])
 else:ob.location=Vector([(ob.location[i]-center[i])*scale[i] for i in range(3)])
# Put the Hull origin exactly at the asset COM frame without applying any moving transforms.
hull=OBJS['Hull'];offset=hull.location.copy();hull.data.transform(Matrix.Translation(offset));hull.location=(0,0,0)
for child in hull.children:child.location+=offset
bpy.context.view_layer.update()
def wp(p):return tuple((Vector(p)-center)[i]*scale[i] for i in range(3))
for e,x in enumerate([-2.58,0,2.58],1):socket('Thruster_'+str(e),wp((x,11.96,0)),OBJS['Hull'])
for i,p in enumerate(TIPS1,1):socket('Muzzle_'+str(i),wp(p),OBJS['Gun_1'])
socket('Muzzle_3',wp(TIPS2[0]),OBJS['Gun_2'])
for sign in [1,-1]:
 for j,x in enumerate([5.15,6.7]):socket('Hardpoint_'+str((0 if sign==1 else 2)+j+1),wp((sign*x,3.8+j*.35,-.76)),OBJS['Hull'])
for i,y in enumerate([-3.5,1,5.5],5):socket('Hardpoint_'+str(i),wp((0,y,-1.95)),OBJS['Hull'])
socket('Seat_Pilot',wp((0,-7.9,1.05)),OBJS['Hull']);socket('Seat_Copilot',wp((0,-5.85,1.3)),OBJS['Hull'])
socket('Camera_Chase',(0,21,8),OBJS['Hull'])
socket('Light_Nav_L',wp((8,5.15,-.16)),OBJS['Hull']);socket('Light_Nav_R',wp((-8,5.15,-.16)),OBJS['Hull']);socket('Light_Beacon',wp((0,7.2,2.07)),OBJS['Hull'])

# Non-exported photographic studio lights in open space. World camera background
# is a faint blue gradient; non-camera world rays provide soft neutral daylight.
world=bpy.data.worlds.new('Space gradient');S.world=world;world.use_nodes=True
n=world.node_tree.nodes;l=world.node_tree.links;n.clear();out=n.new('ShaderNodeOutputWorld');mix=n.new('ShaderNodeMixShader');lp=n.new('ShaderNodeLightPath');bg=n.new('ShaderNodeBackground');bg.inputs[0].default_value=(.18,.21,.27,1);bg.inputs[1].default_value=.38
sky=n.new('ShaderNodeBackground');tc=n.new('ShaderNodeTexCoord');sep=n.new('ShaderNodeSeparateXYZ');ramp=n.new('ShaderNodeValToRGB');ramp.color_ramp.elements[0].position=.0;ramp.color_ramp.elements[0].color=(.003,.005,.009,1);ramp.color_ramp.elements[1].position=.75;ramp.color_ramp.elements[1].color=(.018,.029,.052,1)
l.new(tc.outputs['Normal'],sep.inputs[0]);l.new(sep.outputs['Z'],ramp.inputs[0]);l.new(ramp.outputs[0],sky.inputs[0]);l.new(lp.outputs['Is Camera Ray'],mix.inputs[0]);l.new(bg.outputs[0],mix.inputs[1]);l.new(sky.outputs[0],mix.inputs[2]);l.new(mix.outputs[0],out.inputs[0])
def area(name,pos,power,size,color):
 d=bpy.data.lights.new(name,'AREA');d.energy=power;d.shape='DISK';d.size=size;d.color=color;o=bpy.data.objects.new(name,d);S.collection.objects.link(o);o.location=pos;o.rotation_euler=(-o.location).to_track_quat('-Z','Y').to_euler()
area('White upper front left key',(5,-12,19),8200,10,(1,.96,.90));area('Soft cool fill',(-12,-4,8),3800,13,(.64,.79,1));area('Aft edge light',(4,13,12),6200,9,(.76,.87,1));area('Belly bounce',(2,-4,-9),4200,10,(.7,.8,1));area('Camera-side broad fill',(17,-10,6),5000,12,(.9,.94,1))

hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "sed -n '367,408p' build_heavy-bomber-opera.py; sed -n '470,541p' build_heavy-bomber-opera.py; cat /tmp/heavy-bomber-runtime/capture.cjs; cat /tmp/validate_bomber.py" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
for sign in [-1,1]:
 for y in [-.8,5.8,8.2]:
  x=sign*2.32;z=1.89 if y<3 else 1.77
  box('Flush roof inspection panel',(x,y,z),(.72,1.1,.075),paint,bev=.045)
  box('Recessed latch',(x,y-.28,z+.044),(.22,.10,.025),carbon,bev=.018)
  for xx in [-.25,.25]:
   for yy in [-.4,.4]:cyl('Panel screw',(x+xx,y+yy,z+.02),(x+xx,y+yy,z+.06),.03,alloy,N=8,bev=.002)
 for yy in [-4.6,7.9]:
  x=sign*3.2;z=1.65
  beam('Tie down handle',(x-.16,yy,z),(x-.16,yy,z+.16),.026,alloy,N=8)
  beam('Tie down handle',(x+.16,yy,z),(x+.16,yy,z+.16),.026,alloy,N=8)
  beam('Tie down handle',(x-.16,yy,z+.16),(x+.16,yy,z+.16),.026,alloy,N=8)
 # Belly longitudinal conduit with clamps, attached to bay surround.
 for yy in np.arange(-4,7,1.3):
  beam('Belly hydraulic conduit',(sign*2.55,yy,-1.73),(sign*2.55,yy+1.25,-1.73),.035,alloy,N=10)
  box('Conduit clamp',(sign*2.55,yy,-1.74),(.18,.10,.13),carbon,bev=.02)
# Staggered side applique, angled access hatches and flush attachment hardware.
for sign in [-1,1]:
 for yc,span in [(-6.1,2.35),(-.10,2.65),(6.25,2.25)]:
  ya=yc-span/2;yb=yc+span/2
  poly=[(ya,-.67),(yb-.22,-.67),(yb,-.43),(yb,.43),(yb-.26,.63),(ya+.18,.63),(ya,.43)]
  pts=[(sign*(hull_at(y)[0]+.105),y,z) for y,z in poly]
  plate('Stepped side applique',pts,.055,paint,bev=.022)
  for y,z in [(ya+.21,-.48),(yb-.27,-.48),(ya+.23,.43),(yb-.3,.39)]:
   x=sign*(hull_at(y)[0]+.155)
   cyl('Flush armor attachment',(x,y,z),(x+sign*.025,y,z),.032,alloy,N=8,bev=.003)
  x=sign*(hull_at(yc)[0]+.15)
  box('Recessed access lever',(x,yc+.4,.32),(.04,.34,.07),carbon,bev=.025)
# Structured aft deck: low trapezoid service housings and paired louver banks.
for sign in [-1,1]:
 for yc in [4.5,7.4]:
  pts=[(sign*1.3,yc-.65,1.90),(sign*2.65,yc-.65,1.90),(sign*2.65,yc+.65,1.79),(sign*1.3,yc+.65,1.79)]
  plate('Aft deck service module',pts,.14,paint,bev=.04)
  for yy in np.linspace(yc-.45,yc+.4,6):
   zz=1.98-(yy-(yc-.65))*.085
   beam('Aft deck cooling louver',(sign*1.55,yy,zz),(sign*2.42,yy,zz),.032,carbon,N=8)
# Beacon lens atop rear spine, one shared emissive material.
ob=cyl('Beacon lens',(0,7.2,1.95),(0,7.2,2.07),.085,lamps,N=20)
for uv in ob.data.uv_layers.active.data:uv.uv=(.875,.5)
print('GEOMETRY_BUILT',sum(len(v) for v in GROUPS.values()),flush=True)

# Join only rigid assemblies. Move vertex coordinates to the pivot without applying
render('clay.png',1920,1080,20)
S.view_layers[0].material_override=None
bpy.ops.wm.save_as_mainfile(filepath=str(ROOT/'geometry.blend'))

# Bake every textured surface from registered CC0 scans plus procedural fine wear.
# Shared 2m tiles preserve close viewing density across the entire ship.
def download(id,map):
 fn=f'{id}_{map}_1k.jpg';path=TEX/fn
 if not path.exists():
  url=f'https://dl.polyhaven.org/file/ph-assets/Textures/jpg/1k/{id}/{fn}'
  subprocess.run(['curl','-fL','--retry','2','-A','ForgeAssetBuilder/1.0',url,'-o',str(path)],check=True,stdout=subprocess.DEVNULL)
 return bpy.data.images.load(str(path),check_existing=True)

SHARED_NORMALS={}
def bake_surface(ma,id,tone,metal,rough):
 print('BAKE_START',ma.name,flush=True)
 src=bpy.data.materials.new(ma.name+'_bake_source');src.use_nodes=True;nt=src.node_tree;n=nt.nodes;l=nt.links;n.clear()
 out=n.new('ShaderNodeOutputMaterial');bs=n.new('ShaderNodeBsdfPrincipled');l.new(bs.outputs[0],out.inputs[0])
 tc=n.new('ShaderNodeTexCoord');diff=n.new('ShaderNodeTexImage');diff.image=download(id,'diff');l.new(tc.outputs['UV'],diff.inputs[0])
 norm=n.new('ShaderNodeTexImage');norm.image=download(id,'nor_gl');norm.image.colorspace_settings.name='Non-Color';l.new(tc.outputs['UV'],norm.inputs[0])
 arm=n.new('ShaderNodeTexImage');arm.image=download(id,'arm');arm.image.colorspace_settings.name='Non-Color';l.new(tc.outputs['UV'],arm.inputs[0])
 sep=n.new('ShaderNodeSeparateColor');l.new(arm.outputs['Color'],sep.inputs[0])
 bw=n.new('ShaderNodeRGBToBW');l.new(diff.outputs[0],bw.inputs[0])
 ra=n.new('ShaderNodeValToRGB');ra.color_ramp.elements[0].position=.02;ra.color_ramp.elements[1].position=.16
 if ma==paint:
  ra.color_ramp.elements[0].color=(.40,.40,.40,1);ra.color_ramp.elements[1].color=(.95,.95,.95,1)
 else:
  ra.color_ramp.elements[0].color=(*[x*.55 for x in tone],1);ra.color_ramp.elements[1].color=(*[x*1.35 for x in tone],1)
 l.new(bw.outputs[0],ra.inputs[0])
 noise=n.new('ShaderNodeTexNoise');noise.inputs['Scale'].default_value=95;noise.inputs['Detail'].default_value=3;l.new(tc.outputs['UV'],noise.inputs[0])
 nr=n.new('ShaderNodeMapRange');nr.inputs['To Min'].default_value=.76;nr.inputs['To Max'].default_value=1;l.new(noise.outputs['Fac'],nr.inputs[0])
 mul=n.new('ShaderNodeMixRGB');mul.blend_type='MULTIPLY';mul.inputs[0].default_value=.32;l.new(ra.outputs[0],mul.inputs[1]);l.new(nr.outputs[0],mul.inputs[2]);l.new(mul.outputs[0],bs.inputs['Base Color'])
 # Patchy neutral grime and fine micrometeorite pitting, baked into the common tile.
 grime=n.new('ShaderNodeTexNoise');grime.inputs['Scale'].default_value=5;grime.inputs['Detail'].default_value=4;l.new(tc.outputs['UV'],grime.inputs[0])
 gr=n.new('ShaderNodeMapRange');gr.inputs['To Min'].default_value=.48;gr.inputs['To Max'].default_value=1;l.new(grime.outputs['Fac'],gr.inputs[0])
 weather=n.new('ShaderNodeMixRGB');weather.blend_type='MULTIPLY';weather.inputs[0].default_value=.42;l.new(mul.outputs[0],weather.inputs[1]);l.new(gr.outputs[0],weather.inputs[2]);l.new(weather.outputs[0],bs.inputs['Base Color'])
 pits=n.new('ShaderNodeTexVoronoi');pits.inputs['Scale'].default_value=110;l.new(tc.outputs['UV'],pits.inputs['Vector'])
 pitmask=n.new('ShaderNodeValToRGB');pitmask.color_ramp.elements[0].position=.027;pitmask.color_ramp.elements[0].color=(.22,.22,.22,1);pitmask.color_ramp.elements[1].position=.060;pitmask.color_ramp.elements[1].color=(1,1,1,1);l.new(pits.outputs['Distance'],pitmask.inputs[0])
 micro=n.new('ShaderNodeMixRGB');micro.blend_type='MULTIPLY';micro.inputs[0].default_value=.8;l.new(weather.outputs[0],micro.inputs[1]);l.new(pitmask.outputs[0],micro.inputs[2]);l.new(micro.outputs[0],bs.inputs['Base Color'])
 nm=n.new('ShaderNodeNormalMap');nm.inputs['Strength'].default_value=.28;l.new(norm.outputs[0],nm.inputs['Color'])
 bump=n.new('ShaderNodeBump');bump.inputs['Strength'].default_value=.12;bump.inputs['Distance'].default_value=.004;l.new(noise.outputs['Fac'],bump.inputs['Height']);l.new(nm.outputs[0],bump.inputs['Normal']);l.new(bump.outputs[0],bs.inputs['Normal'])
 rr=n.new('ShaderNodeMapRange');rr.inputs['To Min'].default_value=rough-.13;rr.inputs['To Max'].default_value=rough+.16;l.new(sep.outputs['Green'],rr.inputs[0]);l.new(rr.outputs[0],bs.inputs['Roughness']);bs.inputs['Metallic'].default_value=metal
 bpy.ops.mesh.primitive_plane_add(size=2,location=(0,0,35));ob=bpy.context.object;ob.name='_BakeSurface';ob.data.materials.append(src)
 bake=n.new('ShaderNodeTexImage');n.active=bake
 def pass_image(name,res,typ,channel=None):
  img=bpy.data.images.new(ma.name+'_'+name,res,res,alpha=False);img.colorspace_settings.name='sRGB' if name=='BaseColor' else 'Non-Color';bake.image=img;n.active=bake
  if channel is not None:
   em=n.new('ShaderNodeEmission');l.new(channel,em.inputs[0]);l.new(em.outputs[0],out.inputs[0])
  bpy.ops.object.select_all(action='DESELECT');ob.select_set(True);bpy.context.view_layer.objects.active=ob;S.cycles.samples=12;S.render.bake.margin=8;S.render.bake.use_selected_to_active=False
  bpy.ops.object.bake(type=typ,pass_filter={'COLOR'} if typ=='DIFFUSE' else set())
  if channel is not None:l.new(bs.outputs[0],out.inputs[0])
  img.filepath_raw=str(OUT/(img.name+('.jpg' if name=='BaseColor' else '.png')));img.file_format='JPEG' if name=='BaseColor' else 'PNG';img.save();return img
 base=pass_image('BaseColor',1024,'EMIT',micro.outputs[0])
 normal=pass_image('Normal',1024,'NORMAL')
 if id in SHARED_NORMALS:normal=SHARED_NORMALS[id]
 else:SHARED_NORMALS[id]=normal
 # Pack true channels in the node graph, then Cycles EMIT bake to linear ORM.
 comb=n.new('ShaderNodeCombineColor');comb.mode='RGB';l.new(sep.outputs['Red'],comb.inputs[0]);l.new(rr.outputs[0],comb.inputs[1]);comb.inputs[2].default_value=metal
 orm=pass_image('ORM',512,'EMIT',comb.outputs[0])
 bpy.data.objects.remove(ob,do_unlink=True)
 # Portable PBR graph with glTF-compatible normal + packed occlusion/roughness/metallic.
 nt=ma.node_tree;n=nt.nodes;l=nt.links;n.clear();out=n.new('ShaderNodeOutputMaterial');bs=n.new('ShaderNodeBsdfPrincipled');l.new(bs.outputs[0],out.inputs[0])
 bt=n.new('ShaderNodeTexImage');bt.name='Baked_BaseColor';bt.image=base
 if ma==paint:
  factor=n.new('ShaderNodeMixRGB');factor.name='Faction colour';factor.blend_type='MULTIPLY';factor.inputs[0].default_value=1;factor.inputs[2].default_value=(*PAINTS[0][1],1);l.new(bt.outputs[0],factor.inputs[1]);l.new(factor.outputs[0],bs.inputs['Base Color'])
 else:l.new(bt.outputs[0],bs.inputs['Base Color'])
 no=n.new('ShaderNodeTexImage');no.image=normal;nm=n.new('ShaderNodeNormalMap');l.new(no.outputs[0],nm.inputs['Color']);l.new(nm.outputs[0],bs.inputs['Normal'])
 ot=n.new('ShaderNodeTexImage');ot.image=orm;sp=n.new('ShaderNodeSeparateColor');l.new(ot.outputs[0],sp.inputs[0]);l.new(sp.outputs['Green'],bs.inputs['Roughness']);l.new(sp.outputs['Blue'],bs.inputs['Metallic'])
 group=bpy.data.node_groups.get('glTF Material Output')
 if not group:
  group=bpy.data.node_groups.new('glTF Material Output','ShaderNodeTree');group.interface.new_socket(name='Occlusion',in_out='INPUT',socket_type='NodeSocketFloat')
 g=n.new('ShaderNodeGroup');g.node_tree=group;l.new(sp.outputs['Red'],g.inputs['Occlusion'])
const {chromium}=require('playwright');
(async()=>{const browser=await chromium.launch({executablePath:'/home/claude-agent/.cache/ms-playwright/chromium-1223/chrome-linux/chrome',headless:true,args:['--no-sandbox','--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader']});const p=await browser.newPage({viewport:{width:1600,height:1000}});p.on('pageerror',e=>console.error(e.message));await p.goto('http://127.0.0.1:8127');await p.waitForFunction(()=>window.ready,{timeout:60000});await p.screenshot({path:'/tmp/heavy-bomber-runtime/hero.png'});console.log(JSON.stringify(await p.evaluate(()=>window.metrics)));await p.evaluate(()=>{camera.position.set(22,15,-32);camera.lookAt(0,0,0);render()});await p.screenshot({path:'/tmp/heavy-bomber-runtime/rear.png'});await browser.close()})().catch(e=>{console.error(e);process.exit(1)});
import json,struct,io,sys
from pathlib import Path
from PIL import Image
p=Path(sys.argv[1]);raw=p.read_bytes();jl=struct.unpack_from('<I',raw,12)[0];g=json.loads(raw[20:20+jl]);binary=raw[28+jl:];names={n['name']:i for i,n in enumerate(g['nodes'])};parents={ch:i for i,n in enumerate(g['nodes']) for ch in n.get('children',[])}
expected=['Hull','Canopy','BayDoor_L','BayDoor_R','Turret_1','Turret_2','Gun_1','Gun_2']
assert set(n['name'] for n in g['nodes'] if 'mesh' in n)==set(expected)
assert all('camera' not in n and 'KHR_lights_punctual' not in n.get('extensions',{}) for n in g['nodes'])
assert g['nodes'][names['Hull']].get('translation',[0,0,0])==[0,0,0]
for name in expected:
 n=g['nodes'][names[name]];assert n.get('scale',[1,1,1])==[1,1,1];assert n.get('rotation',[0,0,0,1])==[0,0,0,1]
for i in [1,2]:assert parents[names['Gun_'+str(i)]]==names['Turret_'+str(i)]
for i in [1,2,3]:assert parents[names['Muzzle_'+str(i)]]==names['Gun_'+str(1 if i<3 else 2)]
materials={m['name']:m for m in g['materials']};assert set(materials)=={'Paint','Alloy','Carbon','Glass','Engines','Lamps'}
assert materials['Paint']['pbrMetallicRoughness']['baseColorFactor']==[.20,.22,.24,1]
assert materials['Glass']['alphaMode']=='BLEND'
ims=[]
for im in g['images']:
 b=g['bufferViews'][im['bufferView']];img=Image.open(io.BytesIO(binary[b.get('byteOffset',0):b.get('byteOffset',0)+b['byteLength']]))
 assert max(img.size)<=1024
 if 'ORM' in im.get('name',''):assert max(img.size)<=512
 ims.append({'name':im.get('name'), 'size':img.size,'bytes':b['byteLength'],'mime':im['mimeType']})
print(json.dumps({'validated':True,'bytes':len(raw),'mesh_nodes':expected,'node_count':len(names),'images':ims,'extensions':g.get('extensionsUsed')},indent=2))

codex
The renders exposed two fittings that need better placement: the lower service hatches clip through the armour, and several grab handles sit above it. I’m seating those on the hull and correcting the canopy’s opening direction before the final export.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "sed -n '337,365p' build_heavy-bomber-opera.py; sed -n '1,100p' /home/claude-agent/.agents/skills/blender-game-assets/SKILL.md" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
 x,y,z=pivot;gr='Turret_'+str(idx);gun='Gun_'+str(idx)
 cyl('Traverse race fixed',(x,y,z-.12),(x,y,z+.06),width*.59,alloy,N=64)
 cyl('Traverse skirt',(x,y,z),(x,y,z+.14),width*.55,carbon,gr,N=64)
 # angular six-sided turret shell, front mantlet recessed
 vs=[(x+sx*width*.5,y+sy*depth*.5,z+.13) for sx,sy in [(-1,-1),(1,-1),(1,1),(-1,1)]]+[(x+sx*width*.36,y+sy*depth*.35,z+height) for sx,sy in [(-1,-1),(1,-1),(1,1),(-1,1)]]
 mesh('Cast turret armour',vs,[(0,3,2,1),(4,5,6,7),(0,1,5,4),(1,2,6,5),(2,3,7,6),(3,0,4,7)],paint,gr,.065)
 zgun=z+height*.55;ygun=y-depth*.43
 cyl('Elevation trunnion',(x-width*.51,ygun,zgun),(x+width*.51,ygun,zgun),.26,alloy,gr,N=32)
 for sx in [-1,1]:
  box('Turret cheek applique',(x+sx*width*.44,y,z+height*.48),(.18,depth*.62,height*.6),paint,gr,bev=.05)
  for yy in [-.3,0,.3]:box('Turret cooling slit',(x+sx*width*.54,y+yy,z+height*.52),(.03,.055,height*.26),carbon,gr,bev=.008)
 box('Armoured sight hood',(x,y-depth*.06,z+height+.03),(.48,.55,.18),carbon,gr,bev=.045)
 offsets=[-.32,.32] if twin else [0]
 tips=[]
 for off in offsets:
  a=(x+off,ygun,zgun);end=(x+off,ygun-barrel_length,zgun)
  cyl('Gun receiver',(a[0],ygun+.20,zgun),(a[0],ygun-.65,zgun),.18,carbon,gun,N=32)
  cyl('Gun barrel',(a[0],ygun-.55,zgun),end,.075,alloy,gun,N=32,bev=.01)
  tube('Perforated barrel shroud',(a[0],ygun-.85,zgun),(0,-1,0),[(0,.15),(.65,.15),(.65,.105),(0,.105)],carbon,gun,N=32)
  for kk in range(5):
   yy=ygun-.9-kk*.12
   for sx in [-1,1]:cyl('Shroud cooling inset',(a[0]+sx*.148,yy,zgun),(a[0]+sx*.158,yy,zgun),.032,alloy,gun,N=10,bev=.002)
  tube('Muzzle brake',end,(0,1,0),[(0,.12),(.32,.12),(.32,.065),(0,.065)],carbon,gun,N=32)
  tips.append(end)
 PIVOTS[gr]=(pivot,(0,1,0),'Hull');PIVOTS[gun]=((x,ygun,zgun),(1,0,0),gr)
 return tips
TIPS1=turret(1,(0,.3,2.08),2.1,2.0,.93,2.7,True)
TIPS2=turret(2,(0,-9.2,-2.05),1.25,1.40,.65,2.85,False)
# Chin turret normally below hull: its armour extends upward; barrel lives under the nose.
---
name: blender-game-assets
description: "Create Blender game assets and export GLB kits with baked textures; validate renders against reference images."
metadata:
  provenance: adapted
---

# Blender game assets, headless

Distilled from TheLongSilence's Blender pipeline (162 m ship, carved rocks, a
cabin interior kit, 13 ground materials) into a headless-first recipe for
Forge. **No GUI, no BlenderMCP socket** — Forge's Blender lives on gex44 with
no display, and `blender -b` is the one thing BlenderMCP's addon refuses to
run under. Everything below is a plain `blender -b --python` call or the
gex44 exec service.

For architectural construction kits, read `construction-kit` and its tested
source builders. It supplies cross-family profile/damage/UV contracts and
consumer-side checks; use only the relevant elements.

For a connected playable scene, also read `visual-game-loop` and its
`references/whole-scene-blender.md`: the user-approved harbour recipe combines
scene/object references, photographic materials and coherent Blender construction
with gameplay verification. Reuse good hero assets; author the surrounding place
as a whole rather than assuming a larger modular catalog will fix assembly.

## Read only what the task needs

| When | Read |
| --- | --- |
| A dense model must become a light one that keeps its look (normal + AO transfer) | [high-to-low baking](reference/high-to-low-baking.md) |
| Preparing UVs or a cage, or a bake shows seams, black faces, wrong highlights | [baking and diagnostics](reference/baking-and-diagnostics.md) |
| Choosing texture or mesh formats, or the asset is slow to load or heavy in GPU memory (KTX2, WebP, meshopt, Draco) | [asset delivery](reference/asset-delivery.md) |
| Before any long bake or scripted export pipeline | [preflight and recovery](reference/preflight-and-recovery.md) |
| The asset looks right in Blender and wrong in the game, or the cause could be either | [runtime parity and diagnostics](reference/runtime-parity-and-diagnostics.md) |
| The asset will be judged by eye (hero prop, character, building, environment) | [author and critic loop](reference/critic-loop.md) |
| Terrain, cliffs or rocks should look weathered (branching gullies and ridges, no simulation) | [terrain erosion](reference/terrain-erosion.md) |

These seven are loaded on demand, not by default. Five are ported from vercel-labs/vgpu (see Attribution); terrain erosion uses Rune Skovbo Johansen's filter (MPL 2.0, `scripts/erosion/`).

### Choose how to carry each detail before any bake

| Detail | Carry it as |
| --- | --- |
| Silhouette, openings, broad edges, tuft dimples, piping, moving parts | Real low-poly geometry |
| Fine bevel curvature and shallow relief the triangle budget cannot afford | Tangent-space normals baked from the dense source |
| Permanent cavities and contacts inside a rigid assembly | Baked AO |
| Fabric weave, grain, micro-texture | The existing tiled map at its own scale, never re-baked into a unique atlas |
| Contacts that change, directional shadows | Runtime lighting |

**Pick the cheapest carrier that passes the look check. Being under a texture budget is not a reason to
spend it.** A unique normal atlas is the last resort, for detail the triangle budget cannot hold: a
1024 px RGBA8 map with mips is 5.6 MB of GPU memory per asset, and it replaces a tiled map that every
copy of the material could have shared. If you try a bake and geometry plus the source's tiled maps
looks as good, ship the geometry and say so in the report.

Measured (2 Oct 2026, STRANDMON armchair, 233k to 12k triangles, two Astra runs, same brief): dimples kept
as geometry with the two original 256 px tiled maps = 0.46 MB download, 0.7 MB GPU textures. Same detail
baked into a unique 1152 px normal map = 1.19 MB download, 7.4 MB GPU textures, slightly closer from across
the room, slightly weaker up close, and a blind judge preferred the geometry version.

## Which representation: decide before modelling

For furniture reconstructed from photographs, datasheets or assembly instructions,
read [Furniture reconstruction checks](reference/furniture-reconstruction.md)
before generating geometry. It covers panel-relative coat-hook placement,
interior compartment counts and optional door/drawer articulation.

| Need | Representation | Why |
| --- | --- | --- |
| Hero or enemy character with a walk and attacks | imported rigged mesh (this skill, or the CC0 library: Quaternius, KayKit, Mixamo motions) | skinning, retargetable clips; procedural rigs read as mannequins |
| Weapon, prop, creature variant where silhouette, sockets, collision or code-driven variants matter | procedural three.js geometry or a small GLB kit part | controllable, cheap to vary per instance |
| Concept, icon, backdrop, card art | a generated 2D image used directly | never rebuilt as geometry |
| A reference image whose visible FORM must become a code model | `img2threejs` with its gates; say the result is a reconstruction, not extracted geometry | likeness is judged, not measured |

Pick once at the blueprint or stack-selection stage and record it with provenance (source, licence,
metres per unit, forward axis). Design after MengTo/Skills build-hybrid-game-assets (MIT).

## 1. The recipe

The concept image is the spec, not decoration. For every asset in a kit:

1. **Model every piece in Blender from the concept image** using loft/recess/
   greeble (§3). Grey-clay render it before touching a texture (§4, §10) —
   box-stacking hides under any lighting rig except flat grey + one hard key.
2. **Use a fitting registered photographic texture set or an image model** for
   photographic surfaces (ground, foliage, cloth). Record origin, license and
   physical scale; matching normal/roughness maps must remain aligned. Use an
   existing suitable licensed scan before generating a replacement; use Cycles nodes only for what
   genuinely varies by geometry (edge wear, per-plate tone), and flatten
   before export (§6).
3. **Screenshot-vs-concept loop.** Render next to the concept, same angle if
   possible, compare. Judge by measured numbers where you can (§10: tone
   percentiles, AO floor, draw calls), by eye where you can't (silhouette,
   chamfer read, material believability). Iterate until it reads as the
   concept, not until it "looks 3D".
4. **Export once clay AND texture both hold up.** A model that's flat-correct
   in clay but goes muddy after baking has a material bug, not a modelling
   bug — don't re-model to fix a bad bake.


hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "python3 - <<'PY'
from pathlib import Path
p=Path('build_heavy-bomber-opera.py')
s=p.read_text().replace('from mathutils import Vector, Matrix','from mathutils import Vector, Matrix, Quaternion')
s=s.replace(\"(-1.05,-4.55,1.58),(1.05,-4.55,1.58)\",\"(-1.05,-4.55,2.48),(1.05,-4.55,2.48)\")
s=s.replace(\"PIVOTS['Canopy']=((0,-4.55,1.58),(1,0,0),'Hull')\",\"PIVOTS['Canopy']=((0,-4.55,2.48),(-1,0,0),'Hull')\")
s=s.replace(\"PIVOTS[gr]=((sign*2.26,1,-1.92),(0,0,-1),'Hull')\",\"PIVOTS[gr]=((sign*2.26,1,-1.92),(0,0,sign),'Hull')\")
s=s.replace(\"PIVOTS[gun]=((x,ygun,zgun),(1,0,0),gr)\",\"PIVOTS[gun]=((x,ygun,zgun),(-1 if idx==1 else 1,0,0),gr)\")
old=\"\"\"  pts=[(sign*2.2,yy-.55,-1.57),(sign*3.0,yy-.55,-1.22),(sign*3.0,yy+.55,-1.22),(sign*2.2,yy+.55,-1.57)]
  plate('Closed service hatch',pts,.065,paint,bev=.025)\"\"\"
new=\"\"\"  j=7 if sign==1 else 5
  a,b=ring_at(yy-.55),ring_at(yy+.55)
  pts=[a[j].lerp(a[(j+1)%8],.2),a[j].lerp(a[(j+1)%8],.8),b[j].lerp(b[(j+1)%8],.8),b[j].lerp(b[(j+1)%8],.2)]
  normal=(pts[1]-pts[0]).cross(pts[2]-pts[0]).normalized()
  if normal.z>0:normal=-normal
  pts=[v+normal*.115 for v in pts]
  plate('Closed service hatch',pts,.065,paint,bev=.025)
  bolts_on_quad(pts,r=.024)\"\"\"
assert old in s;s=s.replace(old,new)
old=\"\"\"  x=sign*3.2;z=1.65
  beam('Tie down handle',(x-.16,yy,z),(x-.16,yy,z+.16),.026,alloy,N=8)
  beam('Tie down handle',(x+.16,yy,z),(x+.16,yy,z+.16),.026,alloy,N=8)
  beam('Tie down handle',(x-.16,yy,z+.16),(x+.16,yy,z+.16),.026,alloy,N=8)\"\"\"
new=\"\"\"  x=sign*2.1;z=hull_at(yy)[2]+.085
  for xx in [x-.16,x+.16]:
   box('Tie down foot',(xx,yy,z),(.10,.13,.08),carbon,bev=.02)
   beam('Tie down handle',(xx,yy,z),(xx,yy,z+.16),.026,alloy,N=8)
  beam('Tie down handle',(x-.16,yy,z+.16),(x+.16,yy,z+.16),.026,alloy,N=8)\"\"\"
assert old in s;s=s.replace(old,new)
old=\"\"\"for name in PIVOTS:
 ob=OBJS[name]
 if name.startswith('Turret'):ob.rotation_euler.z=math.radians(30)
 elif name.startswith('BayDoor'):ob.rotation_euler.y=math.radians(-30 if name.endswith('L') else 30)
 else:ob.rotation_euler.x=math.radians(30)\"\"\"
new=\"\"\"for name,(_,axis,_) in PIVOTS.items():
 # Convert the metadata's glTF parent-space axis back to Blender coordinates.
 axis_blender=Vector((axis[0],-axis[2],axis[1]))
 OBJS[name].rotation_euler=Quaternion(axis_blender,math.radians(30)).to_euler()\"\"\"
assert old in s;s=s.replace(old,new)
s=s.replace(\"camera((25,-30,-18),30);render('articulation.png',1440,900,24)\",\"camera((25,-30,-18),30);render('articulation.png',1440,900,24)\\ncamera(HERO,29.8);render('articulation_top.png',1440,900,24)\")
p.write_text(s)
PY
python3 -m py_compile build_heavy-bomber-opera.py
scp build_heavy-bomber-opera.py gex44:/root/fal-author/heavy-bomber-opera-v1/" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 1162ms:
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "ssh gex44 '/root/blender-spike/blender-5.2.0-linux-x64/blender -b --python-exit-code 1 --python /root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py > /root/fal-author/heavy-bomber-opera-v1/build-delivery.log 2>&1'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "timeout 200 /home/claude-agent/bin/agy4 --model forge:build-gemini-4 --effort high -p 'You are the final independent visual critic for this single Blender game asset. Read the reference image /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/sheet.jpg and actual latest renders /tmp/heavy-bomber-runtime/final.png, /tmp/heavy-bomber-runtime/side.png, /tmp/heavy-bomber-runtime/rear.png. Do not edit files, delegate, or use Blender. Prior review identified canopy rear daylight gap, stepped vertical hull seams, thin bay surround, and overly uniform bright metal. These were corrected in this latest candidate. Already being corrected in the final clean run: two protruding lower service hatches, floating grab handles, and canopy opening-axis test. Give at most three remaining substantial visual defects, or PASS if no further blocker. User asks original heavy realistic 24m assault bomber with thick wedge, stepped two seats, dorsal twin guns, chin gun, underbelly bay, 3 nozzles, short wings missiles, gunmetal recolourable neutral Paint. Do not ask for olive default; gunmetal is mandatory. Judge reference proportions, actual visible attachment errors, material read, named parts. Distinguish mandatory blockers from optional extra detail. Keep concise.' > /tmp/heavy-bomber-critic-final.txt 2>&1" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "ssh gex44 tail -n 5 /root/fal-author/heavy-bomber-opera-v1/build-delivery.log; date -u '+%H:%M:%S'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 436ms:
INFO gpu_gate: gpu slot acquired by blender (pid 3936989, 6000 MiB, batch)
00:01.221  cycles           | WARNING HIPEW initialization failed: Error opening HIP dynamic library
/root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py:31: DeprecationWarning: 'Material.use_nodes' is expected to be removed in Blender 6.0
  m=bpy.data.materials.new(name);m.use_nodes=True
19:07:43

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "sed -n '245,287p' build_heavy-bomber-opera.py; rg -n \"emit|export|alpha|bake_surface|modifiers\" build_heavy-bomber-opera.py; sed -n '1,150p' /home/claude-agent/.agents/skills/blender-game-assets/reference/critic-loop.md" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
for sign in [-1,1]:
 pts=[(sign*3.65,1.05,.30),(sign*5.0,2.45,.15),(sign*8,4.75,-.16),(sign*7.90,8.70,-.22),(sign*4,9.18,.15)]
 wing=plate('Short armoured wing',pts,.32,paint,bev=.075)
 # separate top skins leave narrow channels and provide load-bearing visual scale
 for j in range(3):
  ya=3.4+j*1.65;yb=ya+1.55
  p=[(sign*4.5,ya,.34),(sign*7.7,max(ya,4.85),-.02),(sign*7.65,yb+.1,-.02),(sign*4.5,yb,.34)]
  plate('Wing upper access plate',p,.045,paint,bev=.014)
 # Thick tapered wing-root casting, with an open forward-facing recessed intake.
 front=[(sign*4.03,.72,-.18),(sign*5.28,1.48,-.18),(sign*5.28,1.48,.79),(sign*4.03,.72,.91)]
 rear=[(sign*4.12,4.3,-.12),(sign*5.40,4.3,-.12),(sign*5.40,4.3,.27),(sign*4.12,4.3,.57)]
 for j in range(4):plate('Wing root cast fairing',[front[j],front[(j+1)%4],rear[(j+1)%4],rear[j]],.10,paint,bev=.045)
 throat=[(x,y+.12,z) for x,y,z in front]
 plate('Wing root recessed throat',throat,.045,carbon,bev=.035)
 outline('Wing root intake lip',front,.085,alloy)
 for t in np.linspace(.12,.88,8):
  x=sign*(4.03+1.25*t);y=.72+.76*t
  beam('Vertical intake vane',(x,y+.035,-.08),(x,y+.035,.80-.12*t),.030,carbon,N=8)
 # Wing-root dorsal armour housings.
 box('Wing actuator fairing',(sign*3.2,3.25,1.48),(1.20,3.35,.68),paint,bev=.15)
 for j in range(6):
  box('Dorsal cooling slot',(sign*3.2,2.18+j*.33,1.839),(.72,.105,.035),carbon,bev=.025)
 # Recessed tip lamps, housed in metal bezel; navigation side convention X+ is left.
 ob=cyl('Navigation lens',(sign*7.84,5.15,-.16),(sign*8,5.15,-.16),.07,lamps,N=20)
 for uv in ob.data.uv_layers.active.data:uv.uv=(.125 if sign==1 else .375,.5)
 # Two removable missiles on launch shoes, fixed to the hull in shipped closed pose.
 for j,x in enumerate([5.15,6.70]):
  x*=sign;yy=5.65+j*.35;zz=-.76
  box('Missile launch shoe',(x,yy,.0),(.22,1.85,.45),carbon,bev=.04)
  for sy in [yy-.55,yy+.55]:box('Pylon clamp',(x,sy,-.37),(.42,.18,.24),alloy,bev=.035)
  cyl('Missile body',(x,yy-1.25,zz),(x,yy+1.55,zz),.18,alloy,N=32,bev=.015)
  cyl('Missile ogive',(x,yy-1.92,zz),(x,yy-1.25,zz),.025,carbon,N=32,r2=.18,bev=.01)
  tube('Missile arming collar',(x,yy-1.0,zz),(0,1,0),[(0,.184),(.12,.184),(.12,.17),(0,.17)],carbon,N=32)
  for ang in [0,math.pi/2,math.pi,3*math.pi/2]:
   dx,dz=math.cos(ang),math.sin(ang)
   plate('Missile stabilizer',[(x+dx*.14,yy+.65,zz+dz*.14),(x+dx*.45,yy+1.2,zz+dz*.45),(x+dx*.45,yy+1.6,zz+dz*.45),(x+dx*.14,yy+1.5,zz+dz*.14)],.035,carbon,bev=.008)
# Belly bomb bay: long armoured cassette with separate centre-split doors and hinges.
# Static chamfered perimeter bridges the pressure hull to the hinged door seals.
for sign in [-1,1]:
 pts=[(sign*2.25,-5.15,-2.02),(sign*2.82,-5.15,-1.60),(sign*2.82,7.15,-1.60),(sign*2.25,7.15,-2.02)]
 plate('Bay perimeter armoured coaming',pts,.16,paint,bev=.045)
for yy in [-5.12,7.12]:
 plate('Bay transverse seal housing',[(-2.28,yy,-2.06),(2.28,yy,-2.06),(2.55,yy,-1.56),(-2.55,yy,-1.56)],.16,carbon,bev=.035)
3:Clean build: downloads CC0 inputs, models geometry, bakes Cycles PBR tiles, exports,
56:  mod=ob.modifiers.new('Machined edge radii','BEVEL');mod.width=bevel;mod.segments=segments
135:mod=core.modifiers.new('Cockpit volume','BOOLEAN');mod.operation='DIFFERENCE';mod.object=cut;bpy.ops.object.modifier_apply(modifier=mod.name)
139:mod=core.modifiers.new('Open torpedo cassette','BOOLEAN');mod.operation='DIFFERENCE';mod.object=cut;bpy.ops.object.modifier_apply(modifier=mod.name)
424: # recalculate normals and eliminate only true zero-area slivers before export
459:# Non-exported photographic studio lights in open space. World camera background
491:def bake_surface(ma,id,tone,metal,rough):
522:  img=bpy.data.images.new(ma.name+'_'+name,res,res,alpha=False);img.colorspace_settings.name='sRGB' if name=='BaseColor' else 'Non-Color';bake.image=img;n.active=bake
550:for ma,id,tone,met,rough in [(paint,'blue_metal_plate',(.8,.8,.8),.42,.48),(alloy,'metal_plate_02',(.24,.26,.28),.84,.39),(carbon,'metal_plate_02',(.035,.042,.05),.68,.46)]:bake_surface(ma,id,tone,met,rough)
552:# Export only gameplay nodes. Force direct texture path for exporter and patch
558:bpy.ops.export_scene.gltf(filepath=str(glb),export_format='GLB',use_selection=True,export_yup=True,export_apply=False,export_animations=False,export_cameras=False,export_lights=False,export_extras=True,export_image_format='AUTO')
562: if m['name']=='Glass':m['alphaMode']='BLEND';m['doubleSided']=True
575:(ROOT/'NOTES.md').write_text('\n'.join(["Original heavy space-opera assault bomber; 24 × 16 × 5.5 m; closed flight configuration, articulated turrets, canopy and bay doors.",f"Triangles: {tris:,}; GLB: {glb.stat().st_size/1048576:.2f} MiB; rigid assemblies joined; no lights or cameras exported.","Materials: Paint, Alloy, Carbon, Glass, Engines, Lamps; Paint neutral texture × linear gunmetal [0.20, 0.22, 0.24].","Textures: Cycles-baked 1024² base colours and two shared normals; 512² ORM; 16×4 lamp palette; 2 m physical tiling.","Poly Haven CC0 IDs: metal_plate_02, blue_metal_plate; https://polyhaven.com/a/metal_plate_02 ; https://polyhaven.com/a/blue_metal_plate ; licence https://polyhaven.com/license .","Reference differences: original staggered armour layout, blunter twin-grille prow, revised canopy and nozzle petals; no lettering or insignia."])+ '\n')
<!-- Distilled from vercel-labs/vgpu .claude/skills/vgpu-agent-flow/references/asset-iteration.md and
.subharness/agents/asset-author.ts + asset-critic.ts at commit 68cb1d8d198c (MIT, Copyright (c) 2025 Vercel, Inc.),
rewritten for Forge lanes (forge-agent, Astra author, a second model family as critic). -->

# Author and critic loop for a Blender asset

Use this for any authored asset that will be judged by eye: a hero prop, a character, a building, an
environment. Skip it for a mechanical re-export.

## Seats

| Seat | Who | Owns |
| --- | --- | --- |
| Author | Astra (operator law: Blender work goes to Astra) | Geometry, authored materials, UVs, bakes, Blender renders, the export |
| Runtime | The root, or one worker when the shader work is real | Loading the export in the game's actual three.js path, captures, measured costs |
| Critic | A different model family from the author, reading the real images | Findings only. Never edits the asset |

The critic must open the actual capture files. A critic that cannot read images says so and returns
BLOCKED; it never writes a visual verdict from metrics or from the author's description.

## Budget

- Default: **3 revisions, at most 2 critic passes per revision.** The brief may set another cap.
- A cap is an execution limit, not acceptance. Cap reached with open visual findings = `REVISE`
  reported as such, never a `PASS`.
- No unattended improvement loop past the cap.

## Before the first render

Write in the task folder: scope, target cameras (gameplay view, hero, rear, closest required view),
output paths, budgets (triangles, exported vertices, texture bytes and GPU memory, draw calls) and
the revision cap. Budgets are task inputs; do not copy another asset's numbers.

Run the [preflight](preflight-and-recovery.md) once: Blender starts and runs a scene operation, a
tiny bake and export round-trips through the real loader, one real runtime frame is captured.

Integrate a cheap LOW blockout in the runtime at this stage. Scale, axis, camera and material
contract problems are found before an expensive bake, not after.

## Each revision keeps

- the source revision or parameters that rebuild the previous asset;
- real hero, rear and close-up captures, same camera, light, exposure and pose every time;
- triangles, exported vertices, primitives, material count, file bytes, texture GPU memory;
- runtime draw counters, kept apart from offline estimates;
- the critic's findings, the fixes chosen, and the next measured result.

## The critic pass

The critic receives the previous AND the current captures and metrics under matched cameras (or
an explicit "first revision, no baseline"), the reference image, and the brief. It returns:

- **at most five findings**, ordered by impact, each with a stable id, the evidence path (whole
  view plus crop or image coordinates), the visible symptom, a suggested correction and a
  **measurable acceptance condition**;
- regressions against the previous revision;
- resolved / remaining / regressed status of earlier findings on a follow-up pass;
- `PASS`, `REVISE` or `BLOCKED`, with the limits of its evidence.

It compares against the reference as well as the previous revision: clean topology and progress
since last time do not make the asset match the reference. It separates the observed defect from
the suspected cause. A small whole-image difference can hide severe local damage (thin trim,
stairs, silhouette edges): it inspects crops at each delivered LOD. Design ideas are suggestions,
not new acceptance requirements.

When the cause could be the asset or the renderer, it asks for the diagnostic captures in
[runtime parity](runtime-parity-and-diagnostics.md) (maps off, AO neutral, lightmap off) rather
than guessing.

## Rules that stop false passes

- A generated concept image is never proof of a working model. Label concepts as concepts; accept
  only on real renders of the real export.
- Requested bakes need bake provenance (what was baked, from what, at what settings) and matched
  runtime captures with each contribution switched off in turn. Vertex tint and runtime shadows
  are not substitutes for a requested AO or lightmap bake.
- An atlas repair is checked on the full matched views, not only on the crop that was broken: a new
  layout can fix one edge and turn another face black.
- One writer per handoff file. A reply never gets appended to a request file another agent will
  regenerate. Superseded manifests and failed captures stay on disk.
- The author hands the root a compact result: verdict, the few decisive images, the metrics table.
  Full capture sets stay on disk; the root does not load every image.
- A user's rejection or a changed brief reopens any earlier `PASS`.

## Lessons

When a revision teaches something that will recur, write it as: evidence path, symptom, cause,
intervention, matched before/after result, scope. The root checks it and makes a narrow edit to this
skill. Reject task-specific style preferences dressed up as general rules.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'ssh gex44 tail -n 7 /root/fal-author/heavy-bomber-opera-v1/build-delivery.log; tail -n 12 /tmp/heavy-bomber-critic-final.txt' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 480ms:
/root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py:493: DeprecationWarning: 'Material.use_nodes' is expected to be removed in Blender 6.0
  src=bpy.data.materials.new(ma.name+'_bake_source');src.use_nodes=True;nt=src.node_tree;n=nt.nodes;l=nt.links;n.clear()
Info: Baking map saved to internal image, save it externally or pack it
Info: Baking map saved to internal image, save it externally or pack it
Info: Baking map saved to internal image, save it externally or pack it
BAKE_DONE Paint
BAKE_START Alloy

hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "python3 - <<'PY'
from pathlib import Path
p=Path('build_heavy-bomber-opera.py');s=p.read_text()
s=s.replace(\"(3,0,4,7)],paint,gr,.065)\",\"(3,0,4,7)],carbon,gr,.065)\")
s=s.replace(\"(.18,depth*.62,height*.6),paint,gr,bev=.05)\",\"(.18,depth*.62,height*.6),alloy,gr,bev=.05)\")
p.write_text(s)
PY
rg -n 'Cast turret|Turret cheek' build_heavy-bomber-opera.py
ssh gex44 tail -n 7 /root/fal-author/heavy-bomber-opera-v1/build-delivery.log" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 613ms:
348: mesh('Cast turret armour',vs,[(0,3,2,1),(4,5,6,7),(0,1,5,4),(1,2,6,5),(2,3,7,6),(3,0,4,7)],carbon,gr,.065)
352:  box('Turret cheek applique',(x+sx*width*.44,y,z+height*.48),(.18,depth*.62,height*.6),alloy,gr,bev=.05)
21:08:08 | INFO: Extracting primitive: Gun receiver.002
21:08:08 | INFO: Primitives created: 2
21:08:08 | INFO: Finished glTF 2.0 export in 0.18297266960144043 s

EXPORTED 96433 triangles 10355956 bytes
00:51.077  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/final.png'
RENDERED final.png

 succeeded in 51527ms:
codex
The six-paint sheet shows the hull recolouring correctly. I’m also keeping both turret assemblies out of the Paint material so faction colours cannot tint the weapons, and checking that every carried missile and torpedo has a launch socket.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
 succeeded in 82993ms:
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "python3 - <<'PY'
from pathlib import Path
p=Path('build_heavy-bomber-opera.py');s=p.read_text();old=\"for i,y in enumerate([-3.5,1,5.5],5):socket('Hardpoint_'+str(i),wp((0,y,-1.95)),OBJS['Hull'])\";new=\"for row,y in enumerate([-3.2,1.1,5.1]):\\n for side,x in enumerate([.74,-.74]):socket('Hardpoint_'+str(5+row*2+side),wp((x,y,-1.95)),OBJS['Hull'])\";assert old in s;s=s.replace(old,new);p.write_text(s)
PY
ssh gex44 tail -n 6 /root/fal-author/heavy-bomber-opera-v1/build-delivery.log" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 424ms:
01:22.003  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/_paint_Deep_navy.png'
RENDERED _paint_Deep_navy.png
Info: Saved as "heavy-bomber-opera.blend"
BUILD_COMPLETE

Blender quit

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'scp gex44:/root/fal-author/heavy-bomber-opera-v1/articulation_top.png /tmp/heavy-bomber-articulation-top.png' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 804ms:
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'tail -n 70 /tmp/heavy-bomber-critic-final.txt' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 1ms:
**Verdict: PASS** (no remaining mandatory blockers outside the three items already queued for the final clean run).

### Verification of Prior Fixes & Requirements
- **Prior defects resolved**: Canopy rear fairing now sits flush with zero daylight gap (`side.png`, `rear.png`), vertical hull side seams are flush and aligned (`final.png`, `side.png`), underbelly torpedo bay has a thick structural surround (`side.png`), and the gunmetal finish shows clear tonal contrast between the main hull, dark anti-glare nose trim, vents, and exhaust shrouds.
- **Already queued (excluded as blockers)**: Lower forward protruding service hatches (`side.png`) and floating wire grab handles on the upper hull/chine (`final.png`, `rear.png`).
- **Required parts and proportions**: Heavy 24m wedge silhouette, stepped two-seat cockpit with interior consoles, dorsal twin-gun turret, chin gun turret, segmented underbelly bay, three rear nozzles with orange internal glow, stubby wings with wing-root intakes and underwing missiles, and neutral recolourable gunmetal material read all match the brief.

### Optional Extra Polish (Non-Blocking)
1. **Chin turret housing bulk (`side.png`, `final.png`)**: The chin gun mount under the nose is slightly flat and tucked far forward compared to the deeper faceted turret housing in `sheet.jpg`; adding vertical depth to its housing would make it read stronger in the 3/4 view.
2. **Nose center divider (`final.png`)**: `sheet.jpg` separates the two front cheek intakes with a wider sloped armor prow, whereas the model uses a narrow vertical splitter bar between twin nose grilles.
3. **Engine glow center fill (`rear.png`)**: The three nozzles use clean orange emissive rings; a subtle softer orange core gradient inside the turbine cones would match the deeper heat glow in the reference sheet.

***

0. **Blocked on you**: nothing.
1. **What you changed**: No files were changed; I reviewed the reference sheet and the three latest candidate renders (`final.png`, `side.png`, `rear.png`).
2. **How you know it works**: Inspected `/home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/sheet.jpg` against `/tmp/heavy-bomber-runtime/final.png`, `/tmp/heavy-bomber-runtime/side.png`, and `/tmp/heavy-bomber-runtime/rear.png` to confirm the canopy gap, stepped hull seams, bay frame thickness, and uniform metal issues are resolved.
3. **What would break if you were wrong**: If the already-queued cleanup run does not remove the floating grab handles and lower protruding hatches visible in `final.png` and `side.png`, those mesh artifacts would remain on the shipped asset; undoing a pass decision just requires holding export until that cleanup finishes.
4. **What you did NOT do**: Did not open Blender, edit any files, or inspect the post-cleanup renders for the grab handles, lower hatches, and canopy opening-axis test.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'scp build_heavy-bomber-opera.py gex44:/root/fal-author/heavy-bomber-opera-v1/' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 709ms:
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "ssh gex44 '/root/blender-spike/blender-5.2.0-linux-x64/blender -b --python-exit-code 1 --python /root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py > /root/fal-author/heavy-bomber-opera-v1/build-verified.log 2>&1'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'python3 /home/claude-agent/.agents/skills/blender-game-assets/scripts/audit_glb.py /tmp/heavy-bomber-runtime/heavy-bomber-opera.glb --strict > /tmp/heavy-bomber-audit-v4.json
python3 /tmp/validate_bomber.py /tmp/heavy-bomber-runtime/heavy-bomber-opera.glb > /tmp/heavy-bomber-contract-v4.json
cat /tmp/heavy-bomber-audit-v4.json' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 180ms:
{
  "file": "heavy-bomber-opera.glb",
  "sha256": "d29a1da269cf9022cdf67d3954d6674c5319484d5b667ac83b2863d9867ae93d",
  "bytes": 10173952,
  "primitive_count": 24,
  "material_count": 6,
  "embedded_images": 9,
  "external_uris": [],
  "primitives": [
    {
      "mesh": "Torpedo bay door",
      "primitive": 0,
      "triangles": 12,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Torpedo bay door",
      "primitive": 1,
      "triangles": 208,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Torpedo bay door",
      "primitive": 2,
      "triangles": 600,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Torpedo bay door.001",
      "primitive": 0,
      "triangles": 12,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Torpedo bay door.001",
      "primitive": 1,
      "triangles": 208,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Torpedo bay door.001",
      "primitive": 2,
      "triangles": 600,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Canopy side glazing",
      "primitive": 0,
      "triangles": 864,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Canopy side glazing",
      "primitive": 1,
      "triangles": 1032,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Canopy side glazing",
      "primitive": 2,
      "triangles": 284,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Gun receiver",
      "primitive": 0,
      "triangles": 1528,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Gun receiver",
      "primitive": 1,
      "triangles": 2824,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Traverse skirt",
      "primitive": 0,
      "triangles": 1264,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Traverse skirt",
      "primitive": 1,
      "triangles": 36,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Traverse skirt",
      "primitive": 2,
      "triangles": 540,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Gun receiver.002",
      "primitive": 0,
      "triangles": 764,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Gun receiver.002",
      "primitive": 1,
      "triangles": 1412,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Traverse skirt.001",
      "primitive": 0,
      "triangles": 1264,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Traverse skirt.001",
      "primitive": 1,
      "triangles": 36,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Traverse skirt.001",
      "primitive": 2,
      "triangles": 540,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Pressure hull",
      "primitive": 0,
      "triangles": 34440,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Pressure hull",
      "primitive": 1,
      "triangles": 1608,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Pressure hull",
      "primitive": 2,
      "triangles": 41493,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Pressure hull",
      "primitive": 3,
      "triangles": 992,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    },
    {
      "mesh": "Pressure hull",
      "primitive": 4,
      "triangles": 1536,
      "zero_area_triangles": 0,
      "nonfinite_attribute_components": 0
    }
  ],
  "duplicate_primitives": [],
  "note": "Mesh-local counts, before node transforms/instances. Degenerate threshold: cross-product magnitude < 1e-12 in asset units squared. Not a source-topology or visual-quality verdict.",
  "triangles": 94097,
  "zero_area_triangles": 0,
  "nonfinite_attribute_components": 0,
  "findings": []
}

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "sed -n '1,160p' /tmp/heavy-bomber-runtime/index.html; ls -lh textures; /home/claude-agent/.claude/coord/coord status" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 3ms:
<!doctype html><meta charset="utf-8"><style>body{margin:0;background:radial-gradient(at 40% 15%,#112439,#02050a)}canvas{display:block}</style>
<script type="importmap">{"imports":{"three":"/node_modules/three/build/three.module.js","three/addons/":"/node_modules/three/examples/jsm/"}}</script>
<script type="module">
import * as THREE from 'three';
import {GLTFLoader} from 'three/addons/loaders/GLTFLoader.js';
import {RoomEnvironment} from 'three/addons/environments/RoomEnvironment.js';
const renderer=new THREE.WebGLRenderer({antialias:true,alpha:true});renderer.setSize(1600,1000);renderer.setPixelRatio(1);renderer.toneMapping=THREE.AgXToneMapping;renderer.toneMappingExposure=1;document.body.appendChild(renderer.domElement);
const scene=new THREE.Scene();const pmrem=new THREE.PMREMGenerator(renderer);scene.environment=pmrem.fromScene(new RoomEnvironment(),.04).texture;scene.environmentIntensity=.8;
const camera=new THREE.OrthographicCamera(-15.5,15.5,9.6875,-9.6875,.1,200);camera.position.set(28,22,35);camera.lookAt(0,0,0);
function light(pos,color,intensity){const l=new THREE.DirectionalLight(color,intensity);l.position.set(...pos);scene.add(l)}light([5,19,12],0xfff3e7,3);light([-12,8,4],0x91bbff,1.7);light([4,12,-13],0xbad7ff,2);light([17,6,10],0xe8f2ff,1.5);
const gltf=await new GLTFLoader().loadAsync('/asset.glb');scene.add(gltf.scene);window.asset=gltf.scene;window.scene=scene;window.renderer=renderer;window.camera=camera;
window.render=()=>renderer.render(scene,camera);await renderer.compileAsync(scene,camera);window.render();
window.metrics={triangles:renderer.info.render.triangles,calls:renderer.info.render.calls,geometries:renderer.info.memory.geometries,textures:renderer.info.memory.textures,bounds:new THREE.Box3().setFromObject(gltf.scene),nodes:[]};gltf.scene.traverse(o=>{if(o.name)window.metrics.nodes.push({name:o.name,type:o.type})});window.ready=true;
</script>
total 5.2M
-rw-rw-r-- 1 claude-agent claude-agent 411K Oct 16 18:42 blue_metal_plate_arm_1k.jpg
-rw-rw-r-- 1 claude-agent claude-agent 387K Oct 16 18:42 blue_metal_plate_diff_1k.jpg
-rw-rw-r-- 1 claude-agent claude-agent 233K Oct 16 18:42 blue_metal_plate_nor_gl_1k.jpg
-rw-r--r-- 1 claude-agent claude-agent 1.1M Oct 16 19:03 metal_plate_02_arm_1k.jpg
-rw-r--r-- 1 claude-agent claude-agent 612K Oct 16 19:03 metal_plate_02_diff_1k.jpg
-rw-r--r-- 1 claude-agent claude-agent 179K Oct 16 19:03 metal_plate_02_nor_gl_1k.jpg
-rw-rw-r-- 1 claude-agent claude-agent 981K Oct 16 18:42 metal_plate_arm_1k.jpg
-rw-rw-r-- 1 claude-agent claude-agent 677K Oct 16 18:42 metal_plate_diff_1k.jpg
-rw-rw-r-- 1 claude-agent claude-agent 753K Oct 16 18:42 metal_plate_nor_gl_1k.jpg
=== sessions ===
  [alive] 1039845:1762523741  Claude Code session  ()
  [alive] 1208112:1658530799  Claude Code session  ()
  [alive] 1311349:1763006635  Claude Code session  ()
  [alive] 1335028:1631140493  Claude Code session  ()
  [alive] 143364:1772334755  Claude Code session  ()
  [alive] 1558502:1617678053  Claude Code session  ()
  [alive] 162504:1727381278  Claude Code session  ()
  [alive] 2278966:1735022578  Claude Code session  ()
  [alive] 2314503:1565741435  Claude Code session  ()
  [alive] 344623:1772837341  Claude Code session  ()
  [alive] 3466830:1769660567  Claude Code session  ()
  [alive] 3532171:1769819082  Claude Code session  ()
  [alive] 3542004:1769835996  Claude Code session  ()
  [alive] 4146838:1714203358  Claude Code session  ()
  [alive] 423987:1627206825  Claude Code session  ()
  [alive] 440828:1627296141  Claude Code session  ()
  [alive] 458535:1761442247  Claude Code session  ()
  [alive] 601576:1745625879  Claude Code session  ()
  [alive] 622793:1761756995  Claude Code session  ()
  [alive] 77701:1772157996  Claude Code session  ()
  [alive] claude-opus-398509:1772953708  Claude Code session  ()
  [alive] claude-opus-398714:1772953915  Claude Code session  ()
  [alive] claude-opus-398898:1772954107  Claude Code session  ()
  [alive] claude-sonnet-2728807:1441793758  Claude Code session  ()
  [alive] claude-sonnet-4001920:1625012046  Claude Code session  ()
  [alive] claude-sonnet-4022476:1625038977  Claude Code session  ()
  [alive] codex-gpt-5.6-sol-3529165:1409276146  You are working in a git worktree of the forge-monorepo, branched from p2/codex-adapter. This repo is a WORKBENCH MIRROR of the real ax42 Engine host tree — you will NOT deploy, SSH anywhere, or touch  ()
  [alive] codex-gpt-6-astra-3677556:1557057246  You are the Astra AUTHOR seat of Forge's designated composite 3D recipe (V4.6 freezes Astra pen + DeepSeek exact-edit tail; NOT Engine tenant composite-auto). Build original convincing first-person ta  ()
  [alive] codex-gpt-6-astra-3884657:1557574497  You are the Astra author seat of user-requested COMPOSITE 3D lane. Build ONE Halcyon first-person hands proof with the supplied Cransh authored FBX. Work in your isolated worktree; do not deploy. No s  ()
  [alive] codex:gpt-5.6-luna:3296135:1788529417  Run 'sleep 60' in the shell then reply with the word DONE.  ()
  [alive] deepseek-deepseek-flash-1604500:1468734044  Claude Code session  ()
  [alive] deepseek-deepseek-flash-2206615:1518663408  Claude Code session  ()
  [alive] deepseek-deepseek-flash-3478594:1476172879  Claude Code session  ()
  [alive] deepseek-deepseek-flash-3574350:1476435900  Claude Code session  ()
  [alive] gemini-proxy-forge-build-gemini-38flash-3153991:1506259864  You are the pass 2 adversarial reviewer of an engineering blueprint (revised after pass 1). Context: OhMyUnicorn Forge builds and deploys web apps for regular users from a brief through an AI pipeline  ()
  [alive] gemini-proxy-forge-build-gemini-38flash-3168945:1506321383  You are the pass 2 adversarial reviewer of an engineering blueprint (revised after pass 1). Context: OhMyUnicorn Forge builds and deploys web apps for regular users from a brief through an AI pipeline  ()
  [alive] unreal-gpt-6-astra-2421694:1608656741  You are worker WM on MÖBELKRIG, Forge's flat-pack furniture store FPS (three.js, no build step). The end boss STORKUND is a 9 m furniture golem. In your worktree read briefs-rework/WM-model.md and do   ()
  [alive] unreal-gpt-6.1-sol-2862176:1708978510  You are W-GRASS7. Repo forge-assets (your worktree). The settlement renderer (omg/kit/building/settlement-render.mjs, the
page browse/settlement.html, its copy browse/building/) draws villages, towns   ()
  [alive] unreal-gpt-6.1-sol-467115:1773052726  You are W6 (notifications + resume) of the "HQ on the phone" fleet. HQ is OhMyUnicorn's web command center (aiohttp
hq-web as user `hq`, Python 3.12, plain HTML/CSS/JS, strict CSP; a broker daemon `ag  ()
=== claims ===
  gex44:/root/fal-author/alien-harvester-v1/ [exclusive] by 407804:1772962157 held 1751s exp 5448s :: 
  gex44:/root/fal-author/corvette-gunship-v1/ [exclusive] by 424758:1772983173 held 1557s exp 3842s :: 
  gex44:/root/fal-author/heavy-bomber-opera-v1/ [exclusive] by 414458:1772972762 held 1673s exp 2526s :: 
  gex44:/root/fal-author/interceptor-hardsf-v1/ [exclusive] by 410901:1772966691 held 1714s exp 3685s :: 
  gex44:/root/fal-author/mining-ship-v1/ [exclusive] by 413255:1772971174 held 1684s exp 5515s :: 
  local:/home/claude-agent/forge-build/forge-assets/browse/spaceships.html [exclusive] by 440828:1627296141 held 1598s exp 1674s :: Claude Code session owner=showroom
  local:/home/claude-agent/forge-build/forge-assets/jobs/alien-harvester-v1/ [exclusive] by 407804:1772962157 held 1751s exp 5448s :: 
  local:/home/claude-agent/forge-build/forge-assets/jobs/corvette-gunship-v1/ [exclusive] by 424758:1772983173 held 1557s exp 3842s :: 
  local:/home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/ [exclusive] by 414458:1772972762 held 1673s exp 2526s :: 
  local:/home/claude-agent/forge-build/forge-assets/jobs/interceptor-hardsf-v1/ [exclusive] by 410901:1772966691 held 1715s exp 3684s :: 
  local:/home/claude-agent/forge-build/forge-assets/jobs/mining-ship-v1/ [exclusive] by 413255:1772971174 held 1684s exp 5515s :: 
  local:/home/claude-agent/forge-build/forge-assets/tools/gpu/spaceships_probe.py [exclusive] by 440828:1627296141 held 1598s exp 1675s :: Claude Code session owner=showroom
  local:/home/claude-agent/forge-build/hq-voice-20261016/build/.forge-worktrees/1792175862-466f19/ [exclusive] by claude-opus-398509:1772953708 held 1907s exp 1755s :: You are W1 (shell + chat) of the "HQ on the phone" fleet. HQ is OhMyUnicorn's web command center (aiohttp + plain
HTML/CSS/JS, no build step, strict CSP). The operator will use it on a phone (most lik owner=1792175862-466f19
  local:/home/claude-agent/forge-build/hq-voice-20261016/build/.forge-worktrees/1792175864-1dc0f8/ [exclusive] by claude-opus-398714:1772953915 held 1905s exp 1757s :: You are W2 (thread + lists) of the "HQ on the phone" fleet. HQ is OhMyUnicorn's web command center (aiohttp + plain
HTML/CSS/JS, no build step, strict CSP). The operator will use it on a phone (most l owner=1792175864-1dc0f8
  local:/home/claude-agent/forge-build/hq-voice-20261016/build/.forge-worktrees/1792175866-3425af/ [exclusive] by claude-opus-398898:1772954107 held 1903s exp 1759s :: You are W3 (Company page) of the "HQ on the phone" fleet. HQ is OhMyUnicorn's web command center (aiohttp + plain
HTML/CSS/JS, no build step, strict CSP). The operator will use it on a phone (most lik owner=1792175866-3425af
  local:/home/claude-agent/forge-build/hq-voice-20261016/build/.forge-worktrees/1792176852-3cff4d [exclusive] by unreal-gpt-6.1-sol-467115:1773052726 held 891s exp 1785s :: You are W6 (notifications + resume) of the "HQ on the phone" fleet. HQ is OhMyUnicorn's web command center (aiohttp
hq-web as user `hq`, Python 3.12, plain HTML/CSS/JS, strict CSP; a broker daemon `ag
  local:/home/claude-agent/forge-build/hq-voice-20261016/build/.forge-worktrees/1792176852-3cff4d/ [exclusive] by unreal-gpt-6.1-sol-467115:1773052726 held 917s exp 1785s :: You are W6 (notifications + resume) of the "HQ on the phone" fleet. HQ is OhMyUnicorn's web command center (aiohttp
hq-web as user `hq`, Python 3.12, plain HTML/CSS/JS, strict CSP; a broker daemon `ag owner=1792176852-3cff4d
=== recent milestones ===
  19:03 Heavy bomber: v3 clean GLB 93,717 triangles / 10.74 MB validated; final polish clean rebuild waiting on gex44 GPU gate. Exact job directory claim retained.
  19:04 W6 browser proof write DENIED by root lease local:.../build/hqweb (344623:1772837341). W6 isolated worktree 1792176852-3cff4d needs tools/push_e2e_server.py and e2e_push.py; please narrow/release parent lease when W5 merge done. No bypass attempted.
  19:04 W6 suite now 597 passed (539 existing +58 push). Await root release/narrow of hqweb parent lease before retrying browser harness write; sender RFC vector+ES256+fake endpoint+presence+dedupe+cap+410+journal proofs green.
  19:05 W6 root heads-up: main W5 merge now f1ce1d6; W6 guard is resolving relative hqweb writes against main despite isolated pwd. Please release/narrow parent lease when safe. Need no changes to root files, only my branch.
  19:08 W6 parent lease cleared; browser harness write now permitted and running. Main suite 597 passed.

exec
/bin/bash -lc 'ssh gex44 tail -n 8 /root/fal-author/heavy-bomber-opera-v1/build-verified.log' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 494ms:
codex
The independent visual review found no remaining blockers beyond the fittings now corrected. The 30° articulation render shows the canopy opening clear of the cockpit and both gun mounts staying attached. The remaining checks are the final GLB’s materials, sockets, dimensions and appearance in the game loader.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "cat > /tmp/validate_bomber_metadata.py <<'PY'
import json,struct,sys,math
from pathlib import Path
import numpy as np
p=Path(sys.argv[1]); raw=p.read_bytes(); jl=struct.unpack_from('<I',raw,12)[0];g=json.loads(raw[20:20+jl]);blob=raw[28+jl:];meta=json.loads(p.with_name('nodes.json').read_text())
names={n['name']:i for i,n in enumerate(g['nodes'])}; parents={c:i for i,n in enumerate(g['nodes']) for c in n.get('children',[])}
def pos(i):
 n=g['nodes'][i];v=np.array(n.get('translation',[0,0,0]),dtype=float)
 return v+pos(parents[i]) if i in parents else v
assert set(names)==set(meta['nodes'])
for name,i in names.items():
 assert np.allclose(pos(i),meta['nodes'][name]['world_position'],atol=1e-6),name
 actual=g['nodes'][parents[i]]['name'] if i in parents else None
 assert meta['nodes'][name]['parent']==actual,(name,actual)
assert set(meta['axes'])=={'Canopy','BayDoor_L','BayDoor_R','Turret_1','Turret_2','Gun_1','Gun_2'}
for name,axis in meta['axes'].items():assert abs(sum(x*x for x in axis)-1)<1e-9
for i in [1,2]:assert meta['axes']['Turret_'+str(i)]==[0,1,0]
for i in [1,2]:assert abs(meta['axes']['Gun_'+str(i)][0])==1
for prefix,count in [('Thruster_',3),('Muzzle_',3),('Hardpoint_',10)]:
 assert {n for n in names if n.startswith(prefix)}=={prefix+str(i) for i in range(1,count+1)}
 for i in range(1,count+1):assert 'mesh' not in g['nodes'][names[prefix+str(i)]]
paint=next(i for i,m in enumerate(g['materials']) if m['name']=='Paint')
for name in ['Turret_1','Turret_2','Gun_1','Gun_2']:
 mesh=g['meshes'][g['nodes'][names[name]]['mesh']]
 assert all(pr['material']"'!=paint for pr in mesh['"'primitives']),name
points=[];triangles=0
for name,i in names.items():
 n=g['nodes'][i]
 if 'mesh' not in n:continue
 for prim in g['meshes'][n['mesh']]['primitives']:
  ac=g['accessors'][prim['attributes']['POSITION']];bv=g['bufferViews'][ac['bufferView']]
  a=np.ndarray((ac['count'],3),dtype='<f4',buffer=blob,offset=bv.get('byteOffset',0)+ac.get('byteOffset',0),strides=(bv.get('byteStride',12),4))
  points.append(a+pos(i));triangles+=g['accessors'][prim['indices']]['count']//3
points=np.concatenate(points);lo=points.min(axis=0);hi=points.max(axis=0)
assert np.allclose(hi-lo,[16,5.5,24],atol=2e-5)
assert np.allclose(lo,meta['bounding_box']['min'],atol=2e-5)
assert np.allclose(hi,meta['bounding_box']['max'],atol=2e-5)
assert meta['file_bytes']==len(raw);assert triangles==meta['triangles'];assert 50000<=triangles<=110000;assert len(raw)<=12000000
assert len(meta['paints'])==6;assert meta['paints'][0]['linear_rgb']==[.2,.22,.24]
for preset in meta['paints']:assert all(0<=v<=1 for v in preset['linear_rgb'])
print(json.dumps({'validated':True,'nodes':len(names),'triangles':triangles,'bytes':len(raw),'dimensions':(hi-lo).tolist(),'metadata_positions_match':True,'weapon_paint_isolation':True,'launch_sockets':10,'axes':meta['axes']},indent=2))
PY
ssh gex44 tail -n 6 /root/fal-author/heavy-bomber-opera-v1/build-verified.log" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 587ms:
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "date -u '+%H:%M:%S'; ssh gex44 \"ps -eo pid,etime,args | rg 'heavy-bomber-opera-v1/build_heavy|build-verified.log'\"" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 exited 127 in 722ms:
19:10:23
bash: line 1: rg: command not found

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "cat > /tmp/heavy-bomber-runtime/capture.cjs <<'JS'
const {chromium}=require('playwright');
(async()=>{
 const browser=await chromium.launch({executablePath:'/home/claude-agent/.cache/ms-playwright/chromium-1223/chrome-linux/chrome',headless:true,args:['--no-sandbox','--use-gl=angle','--use-angle=swiftshader','--enable-unsafe-swiftshader']});
 const p=await browser.newPage({viewport:{width:1600,height:1000}});const errors=[];p.on('pageerror',e=>errors.push(e.message));
 await p.goto('http://127.0.0.1:8127');await p.waitForFunction(()=>window.ready,{timeout:60000});
 await p.screenshot({path:'/tmp/heavy-bomber-runtime/runtime-hero.png'});
 const metrics=await p.evaluate(()=>window.metrics);
 await p.evaluate(()=>{camera.position.set(22,15,-32);camera.lookAt(0,0,0);render()});
 await p.screenshot({path:'/tmp/heavy-bomber-runtime/runtime-rear.png'});
 await p.evaluate(()=>{camera.position.set(28,22,35);camera.lookAt(0,0,0);const materials=new Set();asset.traverse(o=>{if(o.isMesh)for(const m of (Array.isArray(o.material)?o.material:[o.material]))materials.add(m)});for(const m of materials)if(m.name==='Paint')m.color.setRGB(.035,.075,.135);render()});
 await p.screenshot({path:'/tmp/heavy-bomber-runtime/runtime-navy.png'});
 const articulation=await p.evaluate(async()=>{const metadata=await(await fetch('/nodes.json')).json();const poses={};for(const [name,axis] of Object.entries(metadata.axes)){const o=asset.getObjectByName(name);poses[name]={parent:o.parent.name,localOrigin:o.position.toArray()};o.quaternion.setFromAxisAngle(o.position.clone().set(...axis),Math.PI/6)}render();return poses});
 await p.screenshot({path:'/tmp/heavy-bomber-runtime/runtime-articulation.png'});
 console.log(JSON.stringify({metrics,articulation,errors},null,2));await browser.close();if(errors.length)process.exit(1);
})().catch(e=>{console.error(e);process.exit(1)});
JS
ssh gex44 \"ps -eo pid,etime,args | grep '[h]eavy-bomber-opera-v1/build_heavy'\"" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 578ms:
3945027       01:57 bash -c /root/blender-spike/blender-5.2.0-linux-x64/blender -b --python-exit-code 1 --python /root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py > /root/fal-author/heavy-bomber-opera-v1/build-verified.log 2>&1
3945028       01:57 python3 /opt/gpu-gate/gpu_gate.py --name blender --need-mib 6000 --priority batch -- /root/blender-spike/blender-5.2.0-linux-x64/blender.real -b --python-exit-code 1 --python /root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "python3 - <<'PY'
from pathlib import Path
for suffix in ['diff','arm','nor_gl']:
 p=Path('textures')/('metal_plate_'+suffix+'_1k.jpg')
 if p.is_file():p.unlink()
p=Path('__pycache__/build_heavy-bomber-opera.cpython-311.pyc')
if p.is_file():p.unlink()
c=Path('__pycache__')
if c.is_dir():
 for p in c.glob('build_heavy-bomber-opera.*.pyc'):p.unlink()
 if not any(c.iterdir()):c.rmdir()
PY
ssh gex44 tail -n 5 /root/fal-author/heavy-bomber-opera-v1/build-verified.log" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 549ms:
codex
The asset is within budget at about 96,000 triangles and 10.4 MB, with six materials and shared baked textures. The last clean rebuild is waiting for the shared GPU slot; afterward I’ll copy the deliverables here and check that exact GLB in the runtime viewer.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc '/home/claude-agent/.claude/coord/coord --help' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
coord <verb> [args] — multi-session coordination (advisory)
  whoami | register "<task>" [--host gex44|ax42|local]
  check <host:path> [more...]            (exit 3 on conflict)
  claim <host:path> [--ttl 30m] [--note "..."] [--expect-md5 <sha>] [--owner <tag>]
  heartbeat
  release <host:path>... [--owner <tag>] [--force]
  release --all [--owner <tag>] [--force]
  note "<milestone>" | status | gc
Resources: EXACT file 'gex44:apps/x/f.py' or EXACT dir 'gex44:apps/x/'. No globs.

--owner <tag>       Tags a claim with a sub-identity (e.g. a subagent name or
                    a forge-agent task id) when several actors share one coord
                    token (sibling Claude subagents share ONE coord identity —
                    the ancestor-pid walk can't tell them apart). ALWAYS pass
                    it when you are one of several agents on the same session.
                    `release --owner <tag>` releases ONLY that tag's claims on
                    this token, leaving every other owner's claims (and every
                    other token's claims) untouched.
                    `whoami` lists the owner tags this token currently holds;
                    `status` shows the tag on every claim.

Owner-safety (2026-09-05, sibling-subagent hardening):
  - `release --all` with NO `--owner` REFUSES (exit 6) if this token holds
    ANY tagged claim — one foreign owner is already not yours to release, and
    that is exactly the bug (P2/P3, 09-03/04): a subagent's `release --all`
    silently dropped a SIBLING subagent's live claim. `--all --force` overrides
    and releases everyone's, with a warning naming the owners — a deliberate,
    named exception, never a default.
  - `release <path>...` with NO `--owner` REFUSES (exit 6) if any targeted
    claim carries an owner tag — name your own tag, or pass `--force` to
    release it anonymously by path.
  - `claim` with no `--owner`, on a token that already holds tagged claims,
    prints a one-line hint (never blocks) — you may be a second agent on a
    session that forgot to tag itself.
  LAW: an agent forked from a multi-agent task MUST claim --owner <task-tag>
  and release --owner <task-tag> — never `release --all` unless it is
  genuinely the only agent on the session.

--expect-md5 <sha>  Refuse the claim unless the file still matches the bytes
                    you read. A claim locks a FILE; it does NOT stop you
                    overwriting someone's work with a buffer you read an hour
                    ago. Pass the md5 of your copy and a stale base is caught
                    BEFORE you write. Exit 5 = stale base, 4 = could not verify
                    (fails closed — omit the flag to claim unchecked).
                      md5=$(ssh root@5.9.32.176 md5sum /home/claude-agent/\
                            forge-monorepo/apps/x/f.py | cut -d' ' -f1)
                      coord claim ax42:apps/x/f.py --expect-md5 "$md5"

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'ssh gex44 tail -n 6 /root/fal-author/heavy-bomber-opera-v1/build-verified.log' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 513ms:
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "ssh gex44 nvidia-smi --query-gpu=memory.used,memory.total,utilization.gpu --format=csv,noheader; date -u '+%H:%M:%S'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 573ms:
9703 MiB, 20475 MiB, 23 %
19:11:53

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "python3 - <<'PY'
import ast
from pathlib import Path
p=Path('build_heavy-bomber-opera.py'); ast.parse(p.read_text()); print('Builder syntax: valid; source lines:',len(p.read_text().splitlines()))
PY
ssh gex44 tail -n 8 /root/fal-author/heavy-bomber-opera-v1/build-verified.log" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 527ms:
Builder syntax: valid; source lines: 603
INFO gpu_gate: gpu slot acquired by blender (pid 3945028, 6000 MiB, batch)

codex
The GPU rebuild is running now. I’ve also verified that nodes.json lists all ten launch sockets and that its positions and rotation axes can be checked against the exported GLB.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'ssh gex44 tail -n 10 /root/fal-author/heavy-bomber-opera-v1/build-verified.log' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 400ms:
Info: Baking map saved to internal image, save it externally or pack it
Info: Baking map saved to internal image, save it externally or pack it
Info: Baking map saved to internal image, save it externally or pack it
BAKE_DONE Paint
BAKE_START Alloy
Info: Baking map saved to internal image, save it externally or pack it
Info: Baking map saved to internal image, save it externally or pack it
Info: Baking map saved to internal image, save it externally or pack it
BAKE_DONE Alloy
BAKE_START Carbon

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'ssh gex44 tail -n 6 /root/fal-author/heavy-bomber-opera-v1/build-verified.log' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 393ms:
01:12.564  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/rear.png'
RENDERED rear.png
01:21.789  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/articulation.png'
RENDERED articulation.png
01:26.330  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/articulation_top.png'
RENDERED articulation_top.png

 succeeded in 281248ms:
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "ssh gex44 tail -n 6 /root/fal-author/heavy-bomber-opera-v1/build-verified.log; date -u '+%H:%M:%S'" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 463ms:
01:34.117  render           | Saved: '/root/fal-author/heavy-bomber-opera-v1/_paint_Deep_navy.png'
RENDERED _paint_Deep_navy.png
Info: Saved as "heavy-bomber-opera.blend"
BUILD_COMPLETE

Blender quit
19:13:52

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'scp gex44:/root/fal-author/heavy-bomber-opera-v1/{heavy-bomber-opera.glb,final.png,side.png,clay.png,paints.png,nodes.json,NOTES.md} .
scp gex44:/root/fal-author/heavy-bomber-opera-v1/{articulation.png,articulation_top.png,rear.png} /tmp/heavy-bomber-runtime/' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
codex
The final clean build completed successfully. I’m copying the requested files into this directory and checking the delivered GLB’s geometry, metadata and rendered appearance in Three.js.

 succeeded in 9382ms:
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'ls -lh heavy-bomber-opera.glb final.png side.png clay.png paints.png nodes.json NOTES.md build_heavy-bomber-opera.py' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
-rw-r--r-- 1 claude-agent claude-agent  781 Oct 16 19:14 NOTES.md
-rw-rw-r-- 1 claude-agent claude-agent  43K Oct 16 19:08 build_heavy-bomber-opera.py
-rw-r--r-- 1 claude-agent claude-agent 2.1M Oct 16 19:14 clay.png
-rw-r--r-- 1 claude-agent claude-agent 2.3M Oct 16 19:13 final.png
-rw-r--r-- 1 claude-agent claude-agent 9.9M Oct 16 19:13 heavy-bomber-opera.glb
-rw-r--r-- 1 claude-agent claude-agent 6.2K Oct 16 19:14 nodes.json
-rw-r--r-- 1 claude-agent claude-agent 1.3M Oct 16 19:14 paints.png
-rw-r--r-- 1 claude-agent claude-agent 2.0M Oct 16 19:14 side.png

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc 'sha256sum build_heavy-bomber-opera.py heavy-bomber-opera.glb
ssh gex44 sha256sum /root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py /root/fal-author/heavy-bomber-opera-v1/heavy-bomber-opera.glb' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
exec
/bin/bash -lc 'cp heavy-bomber-opera.glb /tmp/heavy-bomber-runtime/asset.glb
cp nodes.json /tmp/heavy-bomber-runtime/nodes.json
node /tmp/heavy-bomber-runtime/capture.cjs > /tmp/heavy-bomber-runtime/metrics-final.json' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
exec
/bin/bash -lc 'python3 /home/claude-agent/.agents/skills/blender-game-assets/scripts/audit_glb.py heavy-bomber-opera.glb --strict > /tmp/heavy-bomber-audit-final.json
python3 /tmp/validate_bomber.py heavy-bomber-opera.glb > /tmp/heavy-bomber-contract-final.json
python3 /tmp/validate_bomber_metadata.py heavy-bomber-opera.glb > /tmp/heavy-bomber-metadata-final.json
cat /tmp/heavy-bomber-metadata-final.json
cat NOTES.md' in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 452ms:
{
  "validated": true,
  "nodes": 30,
  "triangles": 96433,
  "bytes": 10355164,
  "dimensions": [
    16.0,
    5.5,
    24.000000476837158
  ],
  "metadata_positions_match": true,
  "weapon_paint_isolation": true,
  "launch_sockets": 10,
  "axes": {
    "Canopy": [
      -1,
      0,
      0
    ],
    "BayDoor_L": [
      0,
      0,
      1
    ],
    "BayDoor_R": [
      0,
      0,
      -1
    ],
    "Turret_1": [
      0,
      1,
      0
    ],
    "Gun_1": [
      -1,
      0,
      0
    ],
    "Turret_2": [
      0,
      1,
      0
    ],
    "Gun_2": [
      1,
      0,
      0
    ]
  }
}
Original heavy space-opera assault bomber; 24 × 16 × 5.5 m; closed flight configuration, articulated turrets, canopy and bay doors.
Triangles: 96,433; GLB: 9.88 MiB; rigid assemblies joined; no lights or cameras exported.
Materials: Paint, Alloy, Carbon, Glass, Engines, Lamps; Paint neutral texture × linear gunmetal [0.20, 0.22, 0.24].
Textures: Cycles-baked 1024² base colours and two shared normals; 512² ORM; 16×4 lamp palette; 2 m physical tiling.
Poly Haven CC0 IDs: metal_plate_02, blue_metal_plate; https://polyhaven.com/a/metal_plate_02 ; https://polyhaven.com/a/blue_metal_plate ; licence https://polyhaven.com/license .
Reference differences: original staggered armour layout, blunter twin-grille prow, revised canopy and nozzle petals; no lettering or insignia.

 succeeded in 621ms:
b95551b194e3e5a205bf9a5384899c30ee82a579d7f42deb44b0c58542731f40  build_heavy-bomber-opera.py
465a682151edfd10fca38122000b224b862b4af19b6432c1e555f283ce5dadc3  heavy-bomber-opera.glb
b95551b194e3e5a205bf9a5384899c30ee82a579d7f42deb44b0c58542731f40  /root/fal-author/heavy-bomber-opera-v1/build_heavy-bomber-opera.py
465a682151edfd10fca38122000b224b862b4af19b6432c1e555f283ce5dadc3  /root/fal-author/heavy-bomber-opera-v1/heavy-bomber-opera.glb

hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
 succeeded in 20490ms:
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "python3 - <<'PY'
import json
from pathlib import Path
p=Path('/tmp/heavy-bomber-runtime/metrics-final.json')
if p.exists() and p.stat().st_size:
 j=json.loads(p.read_text());print({k:j['metrics'][k] for k in ['triangles','calls','geometries','textures','bounds']}); print('page_errors',j['errors'])
PY" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 0ms:
{'triangles': 97297, 'calls': 23, 'geometries': 35, 'textures': 12, 'bounds': {'isBox3': True, 'min': {'x': -8, 'y': -2.75, 'z': -12}, 'max': {'x': 8, 'y': 2.75, 'z': 12.000000476837158}}}
page_errors []

hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "python3 - <<'PY'
import json
from pathlib import Path
from PIL import Image
for fn in ['final.png','side.png','clay.png','paints.png']:
 im=Image.open(fn);print(fn,im.size)
a=json.loads(Path('/tmp/heavy-bomber-audit-final.json').read_text());print({k:a[k] for k in ['triangles','primitive_count','material_count','embedded_images','zero_area_triangles','findings']})
c=json.loads(Path('/tmp/heavy-bomber-contract-final.json').read_text());print('texture_sizes',[(i['name'],i['size']) for i in c['images']]);print('NOTES lines',len(Path('NOTES.md').read_text().splitlines()))
PY" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 succeeded in 45ms:
final.png (1920, 1080)
side.png (1920, 1080)
clay.png (1920, 1080)
paints.png (1920, 720)
{'triangles': 96433, 'primitive_count': 22, 'material_count': 6, 'embedded_images': 9, 'zero_area_triangles': 0, 'findings': []}
texture_sizes [('Paint_Normal', [1024, 1024]), ('Paint_ORM', [512, 512]), ('Paint_BaseColor', [1024, 1024]), ('Alloy_Normal', [1024, 1024]), ('Alloy_ORM', [512, 512]), ('Alloy_BaseColor', [1024, 1024]), ('Carbon_ORM', [512, 512]), ('Carbon_BaseColor', [1024, 1024]), ('Lamps', [16, 4])]
NOTES lines 6

codex
Validation passed: 96,433 triangles, 10.36 MB, six materials, and the required dimensions and texture limits. The delivered GLB loads without browser errors, renders in 23 draw calls, and preserves the paint controls and articulated parts. All requested files are now in this directory.

hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
hook: PreToolUse Completed
exec
/bin/bash -lc "/home/claude-agent/.claude/coord/coord note 'Heavy bomber delivered from clean Blender build: heavy-bomber-opera.glb 96,433 tris / 10,355,164 bytes, 6 materials, 30 nodes. Strict audit and metadata/socket/paint contract checks pass; Three.js captures show 23 draw calls and no page errors. Requested renders, builder, nodes.json, and six-line NOTES.md complete in jobs/heavy-bomber-opera-v1.'
python3 - <<'PY'
import os, signal
from pathlib import Path
for p in Path('/proc').iterdir():
 if not p.name.isdigit():continue
 try:
  argv=(p/'cmdline').read_bytes().split(b'\\0')
  if b'http.server' in argv and b'8127' in argv and b'/tmp/heavy-bomber-runtime' in argv:
   os.kill(int(p.name),signal.SIGTERM); print('Stopped owned runtime proof server',p.name)
 except (OSError,ProcessLookupError):pass
PY
/home/claude-agent/.claude/coord/coord release local:/home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/ gex44:/root/fal-author/heavy-bomber-opera-v1/" in /home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1
 exited 143 in 1170959ms:
/home/claude-agent/.cache/ms-playwright/chromium-1223/DEPENDENCIES_VALIDATED
/home/claude-agent/.cache/ms-playwright/chromium-1223/chrome-linux/PrivacySandboxAttestationsPreloaded/privacy-sandbox-attestations.dat
/home/claude-agent/.cache/ms-playwright/chromium-1223/chrome-linux/PrivacySandboxAttestationsPreloaded/manifest.json
/home/claude-agent/.cache/ms-playwright/chromium-1223/chrome-linux/icudtl.dat
/home/claude-agent/.cache/ms-playwright/chromium-1223/chrome-linux/chrome_sandbox
Terminated

 succeeded in 155ms:
noted
Stopped owned runtime proof server 474554
released 2

codex
Delivered [heavy-bomber-opera.glb](/home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/heavy-bomber-opera.glb): **96,433 triangles · 10.36 MB · 6 materials**.

[Final render](/home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/final.png) · [Six paints](/home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/paints.png) · [Rebuild script](/home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/build_heavy-bomber-opera.py)

All requested files are saved. Clean rebuild, GLB validation, dimensions, texture limits, 30° pivot checks and Three.js loading passed.
tokens used
330,005
Delivered [heavy-bomber-opera.glb](/home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/heavy-bomber-opera.glb): **96,433 triangles · 10.36 MB · 6 materials**.

[Final render](/home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/final.png) · [Six paints](/home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/paints.png) · [Rebuild script](/home/claude-agent/forge-build/forge-assets/jobs/heavy-bomber-opera-v1/build_heavy-bomber-opera.py)

All requested files are saved. Clean rebuild, GLB validation, dimensions, texture limits, 30° pivot checks and Three.js loading passed.
