[{"content":"","date":"December 3, 2026","externalUrl":null,"permalink":"/tags/agentic-ai/","section":"Tags","summary":"","title":"Agentic-Ai","type":"tags"},{"content":"","date":"December 3, 2026","externalUrl":null,"permalink":"/categories/architecture/","section":"Categories","summary":"","title":"Architecture","type":"categories"},{"content":"","date":"December 3, 2026","externalUrl":null,"permalink":"/tags/architecture/","section":"Tags","summary":"","title":"Architecture","type":"tags"},{"content":"Welcome to Quasicode. This is a chronicle of indie game development built with Godot 4 and accelerated by a hybrid agentic AI pair programmer.\nHere, I document the reality of building games alongside AI agents—from high-level scene architecture and state machines to local LLM-assisted shaders, math recipes, and honest devlogs.\nThe Core Premise # Godot 4 (GDScript \u0026amp; C#): Lean, node-driven, git-friendly game development. Agentic Pair Programming: Treating AI models as a multi-tier virtual dev team—cloud architects paired with local sub-agents. Honest Devlogs: Practical breakdowns of mechanics, prompt strategies, technical triumphs, and lessons learned. ","date":"December 3, 2026","externalUrl":null,"permalink":"/","section":"Building Games with Agentic Code Assistance","summary":"Welcome to Quasicode. This is a chronicle of indie game development built with Godot 4 and accelerated by a hybrid agentic AI pair programmer.\nHere, I document the reality of building games alongside AI agents—from high-level scene architecture and state machines to local LLM-assisted shaders, math recipes, and honest devlogs.\n","title":"Building Games with Agentic Code Assistance","type":"page"},{"content":"","date":"December 3, 2026","externalUrl":null,"permalink":"/categories/","section":"Categories","summary":"","title":"Categories","type":"categories"},{"content":"","date":"December 3, 2026","externalUrl":null,"permalink":"/categories/devlog/","section":"Categories","summary":"","title":"Devlog","type":"categories"},{"content":"","date":"December 3, 2026","externalUrl":null,"permalink":"/tags/gdscript/","section":"Tags","summary":"","title":"GDScript","type":"tags"},{"content":"","date":"December 3, 2026","externalUrl":null,"permalink":"/tags/godot-4/","section":"Tags","summary":"","title":"Godot 4","type":"tags"},{"content":"","date":"December 3, 2026","externalUrl":null,"permalink":"/posts/","section":"Posts","summary":"","title":"Posts","type":"posts"},{"content":"","date":"December 3, 2026","externalUrl":null,"permalink":"/tags/state-machines/","section":"Tags","summary":"","title":"State Machines","type":"tags"},{"content":"","date":"December 3, 2026","externalUrl":null,"permalink":"/tags/static-typing/","section":"Tags","summary":"","title":"Static Typing","type":"tags"},{"content":"","date":"December 3, 2026","externalUrl":null,"permalink":"/tags/","section":"Tags","summary":"","title":"Tags","type":"tags"},{"content":"Right after I finished breaking up my root simulation script, a tiny crash inside _draw() annoyed me enough to audit the rest of the codebase: a dynamic .get() call had returned null instead of a boolean, and GDScript only complained halfway through a playtest.\nIf you let an LLM write GDScript without explicit rules, it almost always falls back on two habits: untyped Dictionary blobs for state, and dynamic .get() / .call() lookups between nodes. While you\u0026rsquo;re moving fast, that feels convenient. A few days later, typos in string keys fail silently and rename refactors miss dynamic calls completely.\nDuring Round 2 of my cleanup, I cracked down on both—enforcing static typing and explicit enum state machines across the project.\nReplacing Dictionary Blobs with Typed Classes and State Machines # The worst offender was the building slot model. Every slot lived as an untyped Dictionary mixing string keys (\u0026quot;status\u0026quot;, \u0026quot;stalled_reason\u0026quot;, \u0026quot;building\u0026quot;, \u0026quot;build_progress\u0026quot;, \u0026quot;owner\u0026quot;) with stream-reservation keys. One typo in \u0026quot;STALLED\u0026quot; or \u0026quot;COMPUTE\u0026quot; and a build would silently hang with no parse error.\nSwapping that dictionary out for a small statically typed RefCounted class (StructureSlot, ~170 lines) with an explicit enum state machine wiped out that whole class of bugs immediately:\n# BEFORE: Untyped Dictionary + stringly-typed status/reason keys var slot: Dictionary = { \u0026#34;building\u0026#34;: \u0026#34;REACTOR\u0026#34;, \u0026#34;status\u0026#34;: \u0026#34;STALLED\u0026#34;, \u0026#34;stalled_reason\u0026#34;: \u0026#34;COMPUTE\u0026#34;, \u0026#34;build_progress\u0026#34;: 0.45, \u0026#34;powered\u0026#34;: true, } if String(slot.get(\u0026#34;status\u0026#34;, \u0026#34;\u0026#34;)) == \u0026#34;STALLED\u0026#34; and String(slot.get(\u0026#34;stalled_reason\u0026#34;, \u0026#34;\u0026#34;)) == \u0026#34;COMPUTE\u0026#34;: ... # AFTER: Typed RefCounted model with explicit FSM class_name StructureSlot extends RefCounted enum State { EMPTY, AWAITING_SUPPLY, CONSTRUCTING, STALLED_COMPUTE, ACTIVE, RECYCLING } enum Category { SURFACE, ORBITAL } var index: int = 0 var category: Category = Category.SURFACE var structure_id: String = \u0026#34;\u0026#34; var state: State = State.EMPTY var build_progress: float = 0.0 var powered: bool = true Once every valid state is an enum, impossible flag combinations (like is_building = true and is_active = true) simply can\u0026rsquo;t happen. I rolled the same pattern out across building slots, remote hacking/capture, territory control, research, incoming hazards, and UI modes:\nRipping Out Dynamic Lookups Between UI and Simulation # Early on, my UI panels held untyped Node references to the simulation and poked at it with dynamic .get(), .set(), and .call() lookups.\nCounting those calls across scripts/ turned into a handy health check: they dropped from 459 before the refactor, down to 113 after the domain ownership pass, and finally to 3 after Round 2 cleanup (-99.3%). Now UI panels hold statically typed references and call real methods, so renamed properties fail at parse time instead of mid-match.\nKeeping the AI Sticking to Static Types # I didn\u0026rsquo;t even need to change Godot\u0026rsquo;s default [debug] warning settings in project.godot. Three simple workflow habits did the work:\nOne clear rule in AGENTS.md: \u0026ldquo;Explicitly type all variables, function arguments, and return types; avoid untyped Dictionaries for domain state.\u0026rdquo; Headless compile gate: Running godot --headless --quit --check-only on every .tscn before committing catches parse and type errors in a couple of seconds. Local standards review: My local bin/ollama-gen --review-standards pass flags untyped declarations, dynamic .call() fallbacks, and raw state dictionaries before a PR is opened—using zero cloud tokens (covered in Beyond Basic MCP). By the Numbers # 99.3%\nFewer Dynamic Lookups\nRoot sim.get() / sim.set() / sim.call() calls dropped from 459 → 113 → 3. 166 LOC\nTyped Slot Model\nReplaced untyped 10-key Dictionary blobs with a single RefCounted FSM class. 5+\nExplicit Enum FSMs\nEliminated scattered boolean/string flags across slots, combat, research, hazards, and UI. Next Up # Once the codebase was split into 40 cleanly typed scripts, I wanted a way to actually see the structure—and verify the refactor visually. That led me to build a zero-dependency interactive architecture map in Python.\n","date":"December 3, 2026","externalUrl":null,"permalink":"/posts/teaching-ai-agents-godot-type-system/","section":"Posts","summary":"Right after I finished breaking up my root simulation script, a tiny crash inside _draw() annoyed me enough to audit the rest of the codebase: a dynamic .get() call had returned null instead of a boolean, and GDScript only complained halfway through a playtest.\n","title":"Teaching AI Agents to Respect Godot's Type System","type":"posts"},{"content":"","date":"November 30, 2026","externalUrl":null,"permalink":"/tags/game-design/","section":"Tags","summary":"","title":"Game Design","type":"tags"},{"content":"Most online discussions about AI in game development seem stuck at two extremes: either \u0026ldquo;one prompt made me a full 3D RPG\u0026rdquo; hype, or \u0026ldquo;AI code is useless slop\u0026rdquo; dismissal. Neither looks anything like what I actually experience building games in Godot 4 every week.\nThe mindset that actually works sits squarely in the middle: this is AI-assisted game development, not AI game development.\nSitting in the Game Director\u0026rsquo;s Chair # When I started this blog with The Virtual Studio, I framed the shift as moving from typing every line of boilerplate myself to acting as a game director guiding a small, fast—and occasionally literal-minded—studio.\nThat distinction matters because hands-off \u0026ldquo;vibe coding\u0026rdquo; (\u0026ldquo;build me a space strategy game with combat, logistics, and research\u0026rdquo;) falls apart almost immediately. Any detail you leave vague, a coding agent will quietly invent on its own, and most of the time its guess won\u0026rsquo;t match what\u0026rsquo;s in your head. If you handed the same one-sentence brief to 100 human developers, you\u0026rsquo;d get 100 completely different games. Agents behave the exact same way—just faster.\nMy job hasn\u0026rsquo;t disappeared; it\u0026rsquo;s moved upstream into defining clear goals, setting hard constraints, and judging the result with a player\u0026rsquo;s eyes.\nDesign First, Interrogate Early, and Keep Docs Alive # The fastest way I\u0026rsquo;ve found to burn tokens and patience is jumping straight into Godot before the design is settled. Whenever I skip straight to implementation on a half-formed mechanic, I end up spending three times as long unwinding wrong assumptions.\nInstead, I force the ambiguity out before any GDScript gets written, using the outer-loop process from Outer Loop, Inner Loop:\nInterrogate the spec (grill-with-docs): I have the agent interview me one decision at a time against my existing project docs so edge cases, failure states, and UI flows get settled upfront instead of guessed mid-build. Lock down terminology (domain-modeling): Keeping a GLOSSARY.md and short ADRs stops the agent from inventing three different names for the same mechanic across different sessions. Visualise before coding: For anything spatial—like a controller radial menu or a dense HUD layout—a rough visual mockup, colour palette, or throwaway prototype scene communicates ten times more clearly than three paragraphs of prose. Keep docs in sync: Every time a mechanic or visual direction changes during playtesting, I update the design docs and living codebase map—and use writing-for-agents to turn any recurring agent mistake into a one-line guardrail in AGENTS.md. Making AI Use Godot Like a Human # One of the sharpest lessons I\u0026rsquo;ve learned working with LLMs in Godot 4 is that left to themselves, coding agents don\u0026rsquo;t use the engine the way humans do.\nIf you just hand an agent a feature spec with no structural constraints, its default habit is to create one master scene and spawn everything—nodes, meshes, entire UI layouts—procedurally inside giant scripts, dumping files together and stuffing the screen with far more UI text and clutter than you asked for. That works fine for the AI, right up until you open the Godot editor to nudge a camera angle or adjust a container and realise there\u0026rsquo;s nothing in the SceneTree to click on.\nKeeping the project editable by a human takes explicit guardrails:\nUse Godot\u0026rsquo;s real .tscn scenes, nodes, and custom Resources instead of code-generating whole hierarchies. Keep scripts single-responsibility and organised cleanly by domain. Pull in targeted GodotPrompter inner-loop skills per ticket (scene-organization, resource-pattern, gdscript-patterns, component-system, state-machine) alongside strict AGENTS.md rules. Pause periodically to run improve-codebase-architecture when a file starts sprawling—like when my own root simulation script quietly blew past 2,700 lines before I broke it apart. Keeping the project legible to a human isn\u0026rsquo;t nostalgia. It\u0026rsquo;s what lets you jump into the editor, inspect a node\u0026rsquo;s properties, or make a 10-second manual tweak yourself instead of spending five minutes prompting around it.\nConcrete Goals Over Vibes (and Why Engine Literacy Still Matters) # Over dozens of tickets, five communication habits have consistently separated clean first-pass implementations from frustrating loops:\nGoal prompts, not vibe prompts: Asking to \u0026ldquo;make the shield feel punchier\u0026rdquo; leaves the agent guessing between colour, timing, glow, or camera shake. Asking to \u0026ldquo;replace the flickering segments with a slow expanding ring that fades in and out gently when idle, and pulses noticeably faster when the shield is under load\u0026rdquo; gives it a concrete behaviour to build—and then you can dial the exact speed once you see it moving. One objective at a time: Bundling a new mechanic, a layout tweak, and a shader change into one prompt makes debugging miserable. When something breaks, you want to know immediately which single change caused it. Define what \u0026ldquo;done\u0026rdquo; looks like: Give concrete pass/fail criteria instead of open-ended wishes—exact state transitions, viewport margins, or minimum font sizes. Hand over exact context: Give exact res:// paths, method signatures, and numeric defaults so the agent doesn\u0026rsquo;t have to guess where an asset lives or what a function is called. Keep learning Godot and GDScript: Asking to \u0026ldquo;put the modal on a dimmed ColorRect backdrop with MOUSE_FILTER_STOP so clicks don\u0026rsquo;t bleed through, and reuse our StyleBoxFlat focus ring\u0026rdquo; gets much cleaner results than \u0026ldquo;add a controller-friendly popup.\u0026rdquo; Those first four habits are what tickets-for-local-llm (my derivative of Matt Pocock\u0026rsquo;s to-tickets) automates for me at scale. Every ticket is scoped to a single vertical slice with concrete file anchors, statically typed signatures, numeric defaults, and explicit test assertions—so whether a frontier cloud model or a local GPU model executes it, there\u0026rsquo;s no room to guess.\nAnd that fifth point—engine literacy—is the multiplier people underestimate most. Understanding Godot doesn\u0026rsquo;t become obsolete when you use AI; it\u0026rsquo;s how you catch performance traps the AI completely misses (like an invisible BackBufferCopy quietly copying the framebuffer every frame and burning half a millisecond for nothing), and it\u0026rsquo;s how you know when opening the Inspector beats another round-trip with an agent.\nThe First Playable Build Is the Starting Line # An AI agent can get you to a running build remarkably quickly, and that first build is almost always rough around the edges: sluggish controls, awkward spacing, subtle edge-case physics bugs, or UI that clashes with the rest of the screen. That isn\u0026rsquo;t a failure of the workflow—that\u0026rsquo;s where the real game development begins.\nTo keep that iteration loop tight without breaking what already works, I pair live editor feedback (godot-mcp) with a few steady checks:\ntdd + godot-testing + headless bin/test: Catching logic and layout regressions in seconds before I even launch the game (and auditing those tests whenever the AI leans on brittle mocks). Local two-axis code-review: Running bin/ollama-gen --review-standards and --review-spec against every diff so typing discipline and spec fidelity don\u0026rsquo;t quietly erode. Hands-on playtesting: Because agents are great at assembling scenes and writing GDScript, and terrible at feeling whether a mechanic is satisfying, whether a HUD reads cleanly at 1280×800, or whether a loop is actually fun. At the end of the day, the tool doesn\u0026rsquo;t replace the craft. Stay in the director\u0026rsquo;s chair, stay fluent in Godot, keep every slice small and concrete, and treat the first playable build as the starting line rather than the finish.\n","date":"November 30, 2026","externalUrl":null,"permalink":"/posts/game-director-not-vibe-coder-ai-godot/","section":"Posts","summary":"Most online discussions about AI in game development seem stuck at two extremes: either “one prompt made me a full 3D RPG” hype, or “AI code is useless slop” dismissal. Neither looks anything like what I actually experience building games in Godot 4 every week.\n","title":"Game Director, Not Vibe Coder: What Actually Works in AI-Assisted Godot Dev","type":"posts"},{"content":"","date":"November 30, 2026","externalUrl":null,"permalink":"/tags/indie-dev/","section":"Tags","summary":"","title":"Indie Dev","type":"tags"},{"content":"","date":"November 30, 2026","externalUrl":null,"permalink":"/tags/prompting/","section":"Tags","summary":"","title":"Prompting","type":"tags"},{"content":"","date":"November 30, 2026","externalUrl":null,"permalink":"/categories/workflow/","section":"Categories","summary":"","title":"Workflow","type":"categories"},{"content":"","date":"November 30, 2026","externalUrl":null,"permalink":"/tags/workflow/","section":"Tags","summary":"","title":"Workflow","type":"tags"},{"content":"","date":"November 29, 2026","externalUrl":null,"permalink":"/tags/refactoring/","section":"Tags","summary":"","title":"Refactoring","type":"tags"},{"content":"By Day 3 of my five-day strategy game sprint, adding a small gameplay tweak had started feeling strangely sluggish. Every ticket seemed to touch the same giant root simulation script—which had quietly blown past 2,700 lines inside a 27-script project.\nWhen you ship features quickly with coding agents, the easiest thing for a model to do is tack one more method, one more dictionary, and one more flag onto the root node. Keeping everything in one file is simpler for the model to track while implementing a ticket, right up until the file gets so big that every change fights the weight of it.\nOnce I had cleaned up my test suite, I used improve-codebase-architecture (paired with Godot\u0026rsquo;s component-system and state-machine patterns from Outer Loop, Inner Loop) to break that monolith apart across two refactor passes.\nSigns the Root Script Had Gone Too Far # Three things made it obvious I had to stop adding features and split the script up:\nPass-through wrappers everywhere: UI panels were calling methods on the root script that did nothing except forward the call to an internal array or helper. Duplicated UI state: Panels were keeping their own cached copies of simulation state, leading to annoying sync bugs whenever a mechanic changed. Copy-pasted type checks: Almost every logistics, combat, and power function branched on whether a target was a planet or a station, followed by defensive dynamic method checks. Splitting the Refactor Into Two Passes # Asking an AI to \u0026ldquo;refactor this 2,700-line script into clean modules\u0026rdquo; in one shot is a fast way to end up with broken scenes and half-wired signals. Splitting the work into two passes kept every step small, reviewable, and green under headless tests:\nRound 1: Pull Subsystems Out # In Round 1, I kept the existing methods on the root script as thin wrappers so callers wouldn\u0026rsquo;t all break at once, and pulled subsystems out one ticket at a time. Across both rounds, 15 focused modules (roughly 85 to 900 lines each) took ownership of their own domains:\nSimulation \u0026amp; Domain Modules: Logistics, Hazard Defence, System Generation, Combat, Power Network, Shared Node Base Class, Typed Slot State Machine, Camera Control, Research, and Window Prediction. Rendering \u0026amp; UI Modules: World Map Renderer, Target Panel, Slot Panel, Stream Renderer, and UI Style Helper. Sure enough, the very next day, new power-network and rival-AI features pushed the root script back up by ~60 lines. That\u0026rsquo;s why Round 2 mattered.\nRound 2: Delete the Wrappers \u0026amp; Dead Prototypes # Once UI panels and subsystems talked directly to each other through typed references, the old root wrappers had no reason to exist:\nDeleted 110 pass-through wrapper functions from the root script in a single cleanup pass (0 lines added), bringing it cleanly under 1,000 lines. Deleted 9 dead prototype files (prototype scenes, scripts, tests, and metadata) so abandoned experiments wouldn\u0026rsquo;t pollute future AI searches. Collapsing Repeated Branching with One Base Class # One of the cleanest wins in Round 2 was adding a small shared base class (NetworkNode, ~220 lines) for both planets and stations. Before that, every coordinator repeated the same branching and dynamic fallback:\n# BEFORE: Every coordinator branched on concrete node types + dynamic .get()/.call() func can_dispatch_supply(target: Node2D, faction_id: int) -\u0026gt; bool: var is_active: bool = false if target is PlanetNode: var p := target as PlanetNode is_active = p != central_star and (p.is_colonized or p.owner_faction == faction_id) elif target is StationNode: var s := target as StationNode is_active = s.has_station and s.owner_faction == faction_id if not is_active: return false var eligible: bool = not target.has_method(\u0026#34;is_belt_eligible\u0026#34;) or bool(target.call(\u0026#34;is_belt_eligible\u0026#34;)) return eligible # AFTER: Polymorphic base contract (NetworkNode) shared by PlanetNode \u0026amp; StationNode func can_dispatch_supply(target: Node2D, faction_id: int) -\u0026gt; bool: var host := target as NetworkNode if host == null or host == central_star: return false return host.can_receive_supply(faction_id) and host.is_belt_eligible() Replacing repeated type-checks with one small base class shrinks both the code and the context the AI has to read next time I add another node type.\nBy the Numbers # -65.0%\nRoot Script Shrink\n2,703 LOC → 1,476 LOC (Round 1) → 946 LOC (Round 2). 15\nFocused Modules\nTotal scripts grew cleanly from 27 → 40 cohesive GDScript files. 110\nWrappers Deleted\nPass-through facade functions removed in a single Round 2 cleanup pass. Next Up # With the root script cut by 65%, the next glaring mess was the hundreds of untyped dictionaries and dynamic .get() / .call() lookups still scattered across those 40 scripts. That\u0026rsquo;s what I tackled next.\n","date":"November 29, 2026","externalUrl":null,"permalink":"/posts/taming-the-god-object-godot-ai-refactor/","section":"Posts","summary":"By Day 3 of my five-day strategy game sprint, adding a small gameplay tweak had started feeling strangely sluggish. Every ticket seemed to touch the same giant root simulation script—which had quietly blown past 2,700 lines inside a 27-script project.\n","title":"Taming the God Object: Using AI to Decompose a Growing Godot Simulation","type":"posts"},{"content":"Midway through my five-day strategy game sprint, I was gearing up to break apart a bloated 2,700+ line root simulation script. Before touching it, I glanced at my test runner: 42 headless test suites and more than 1,800 passing assertions (running on a lightweight custom headless GDScript runner, though everything here applies equally to GUT or gdUnit4).\nI thought I was safe to refactor aggressively. Then I actually opened a few of the test files my AI agents had written over the previous few days.\nA surprising chunk of them weren\u0026rsquo;t testing the game at all. They were testing mocks, hardcoded theme colours, and raw internal dictionaries—the exact kind of tests that stay green right up until you touch the architecture, and then shatter all at once in a wall of false failures.\nWhy AI Test Counts Can Mislead You # In my earlier posts on local GPUs and direct-to-disk generation, I talked about how quickly my RTX 4070 Ti can spit out unit tests. When a test file takes a few seconds to generate, it\u0026rsquo;s easy to mistake a high assertion count for a good safety net.\nWhen you ask a model to write tests for a feature, its main goal is getting green checkmarks quickly. If your production class doesn\u0026rsquo;t expose a clean setup method, the model won\u0026rsquo;t pause and add one—it will poke private fields directly, stuff raw dictionaries into internal arrays, or copy exact hex colours straight out of your theme script.\nThe Anti-Patterns I Kept Finding # Auditing 21 test files before starting the refactor turned up the same patterns across the repo:\nBrittle UI \u0026amp; Theme Assertions # Models love asserting on exact pixel borders, font sizes, and hex strings copied straight from the theme builder. One theme test had grown past 80 lines checking exact styling values, so every minor visual tweak broke it. Replacing those with structural and contrast checks cut it down to around 35 lines:\n# BAD: Breaks on every visual polish tweak assert_eq(stylebox.border_width_left, 1) assert_true(stylebox.bg_color.is_equal_approx(Color(\u0026#34;0d1c26f5\u0026#34;))) assert_eq(theme.get_font_size(\u0026#34;font_size\u0026#34;, \u0026#34;ActionBtn\u0026#34;), 10) # GOOD: Tests structural contract \u0026amp; semantic contrast assert_true(theme.get_stylebox(\u0026#34;panel\u0026#34;, \u0026#34;PrimaryCard\u0026#34;) is StyleBoxFlat) assert_gt(cyan_fill.bg_color.b, cyan_fill.bg_color.r) # cyan stays cool-toned assert_gt(amber_fill.bg_color.r, amber_fill.bg_color.b) # amber stays warm-toned Raw-Dictionary Mocks Skipping Real Code # Across the logistics, combat, economy, and recycling suites, tests were mutating internal slots dictionaries directly instead of activating buildings through a public method. That bypassed activation side effects and guaranteed every test would break the moment I replaced those dictionaries with a typed class:\n# BAD: Bypasses activation hooks and breaks when dict becomes a typed class node.slots[0][\u0026#34;building\u0026#34;] = \u0026#34;REACTOR\u0026#34; node.slots[0][\u0026#34;status\u0026#34;] = \u0026#34;ACTIVE\u0026#34; node.slots[0][\u0026#34;build_progress\u0026#34;] = 1.0 # GOOD: Exercises the real public domain API assert_true(node.activate_slot(0, \u0026#34;REACTOR\u0026#34;)) Faking Entities by Nulling Internal Fields # To set up edge cases, the AI would sometimes grab an existing object and null out internal fields to fake a different entity type—like taking a moon and clearing its parent reference to pretend it was an isolated planet:\n# BAD: Mutates a moon into a fake planet by nulling internal fields var fake_planet := sim.asteroids[0] fake_planet.parent_body = null # GOOD: Uses a real planet from the generated system var target_planet := sim.planets[2] Real Bugs the Audit Caught Before the Refactor # Cleaning up those 21 suites didn\u0026rsquo;t just make the refactor safer—it flushed out three real bugs in the game code:\nColonising a planet or building a station didn\u0026rsquo;t always initialise its faction owner automatically. Clearing all slots on a body wasn\u0026rsquo;t firing deactivation hooks for active extractors. Host classes didn\u0026rsquo;t expose a clean public method to activate a slot with all of its side effects—which is why the AI had fallen back to mutating raw dictionaries in the first place. That last one stuck with me: awkward AI tests are often pointing at an awkward production API. Whenever a model has to reach into private fields to arrange a test, adding a small public helper on the class usually fixes both.\nBy the Numbers # 21 / 42\nTest Suites Audited\nHalf the test suite tightened up before touching the root simulation script. 86 → 34\nLOC on Brittle UI Test\nHardcoded hex colours and pixel borders replaced with behavioural checks. 3\nReal Production Bugs\nHidden state-initialisation and cleanup bugs surfaced during the audit. Next Up # With the test suite exercising real public APIs instead of mocks, I finally felt safe breaking up that 2,700+ line root simulation script—which is up next.\n","date":"November 26, 2026","externalUrl":null,"permalink":"/posts/auditing-ai-written-godot-tests/","section":"Posts","summary":"Midway through my five-day strategy game sprint, I was gearing up to break apart a bloated 2,700+ line root simulation script. Before touching it, I glanced at my test runner: 42 headless test suites and more than 1,800 passing assertions (running on a lightweight custom headless GDScript runner, though everything here applies equally to GUT or gdUnit4).\n","title":"Auditing AI-Written Godot Tests: Fixing Brittle Mocks Before a Refactor","type":"posts"},{"content":"","date":"November 26, 2026","externalUrl":null,"permalink":"/tags/tdd/","section":"Tags","summary":"","title":"TDD","type":"tags"},{"content":"","date":"November 26, 2026","externalUrl":null,"permalink":"/tags/testing/","section":"Tags","summary":"","title":"Testing","type":"tags"},{"content":"","date":"November 24, 2026","externalUrl":null,"permalink":"/tags/devlog/","section":"Tags","summary":"","title":"Devlog","type":"tags"},{"content":"On Sunday evening I sat down and played a full match of my Godot 4 space strategy game from start to finish for the first time. A rival AI expanded across the outer planets, an incoming space hazard forced me to scramble point defences, and half my outposts browned out mid-battle because I hadn\u0026rsquo;t built enough local power generation.\nFive days of coding earlier, none of that existed together as a real game loop.\nIn my previous post, I walked through how I pair Matt Pocock\u0026rsquo;s workflow skills with GodotPrompter. This week was the first real stress test of that setup—and the honest takeaway is that moving fast with AI is easy; stopping the codebase from collapsing under its own weight by Day 3 is the actual job.\nHow the Five Days Actually Played Out # Day 1 — Making It a Game: Up until now I mostly had planets, orbits, and building placement. Day 1 was about giving the player something to fight over: factions, territory capture, recycling buildings for salvage, temporary combat boosts, a win-condition megaproject, and splitting the HUD into cleaner palettes.\nDay 2 — Hazards, UI Experiments \u0026amp; Live Tuning: Moons were adding too much micromanagement, so I folded them into planetary bonus modifiers instead. I also got tired of fighting layout bugs inside the live HUD, spun up a throwaway 2-column UI prototype, and promoted it into production once it felt right. By the evening I had a live Tuning Deck modal for tweaking numbers mid-match, plus incoming space hazards and defensive interceptors.\nDay 3 — The Debt Came Due: By mid-week the root simulation script had blown past 2,700 lines, and my test suite had grown fast enough that I didn\u0026rsquo;t fully trust it anymore. I forced myself to stop adding features, audited 21 test files (which immediately turned up three real bugs), and ran a first refactoring pass pulling eight subsystems out into their own scripts. Once the ground felt solid again, I added point-defence grids, spent an hour iterating on orbital barrier VFX, wired up remote hacking and a rival AI, and sketched out a radial controller menu.\nDay 4 — Replacing the Economy Mid-Flight: The old banked-energy pool was boring to play—you just hoarded a big number and forgot about it. Replacing it with a live local power network (where lower-priority buildings automatically brown out when demand beats supply, cushioned by battery buffers) immediately made expansion feel much tenser. Right after that, I started a second cleanup pass: deleting the old energy pool completely, replacing untyped building dictionaries with a typed slot state machine, and ripping out hundreds of dynamic root lookups.\nDay 5 — Deleting Stuff \u0026amp; Benchmarking: The quietest day, and probably the most satisfying. I unified planets and stations behind a shared base class, deleted 110 pass-through wrapper functions and 9 dead prototype files, and ran an interleaved benchmark pass that cut warm UI refresh time by more than half.\nWhat Stopped the Project Turning Into Soup # Moving that fast with coding agents feels great right up until the AI starts contradicting yesterday\u0026rsquo;s design. A few simple habits saved me all week:\nShort ADRs for design decisions: I now have 25 ADRs in the repo (three from this week covering the power network, compute capacity, and moon modifiers). Writing down why a mechanic works a certain way stops an agent from quietly reverting it two tickets later. A glossary backed by a dumb bash linter: Models love inventing synonyms (\u0026quot;power\u0026quot; vs. \u0026quot;energy\u0026quot;, \u0026quot;home base\u0026quot; vs. \u0026quot;cradle\u0026quot;). I keep 82 canonical terms in GLOSSARY.md and run a tiny grep -rnE pre-merge script that flags legacy/drift terms automatically. Deleting replaced mechanics immediately: Leaving an old economy system in the repo \u0026ldquo;just in case\u0026rdquo; poisons every future AI search. When the live power network went in, I deleted pooled_energy across 36 files (+581 / -378 lines) in the same push. Same with pooled_compute the moment live compute reservations worked. Calling time-out myself: Not once did an agent suggest pausing feature work to audit tests, break up a god script, or benchmark frame times. Every stabilisation break had to be my call. By the Numbers # 115\nCommits in 5 Days\n+18,635 / -6,227 lines across 196 files—nearly a third as many lines deleted as added. 30\nTickets Shipped\nSmall, verifiable vertical slices from core combat to power networks and refactoring. 1,834\nPassing Assertions\n42 headless test suites and 251 test functions keeping refactors honest. 82\nGlossary Terms\nBacked by 25 ADRs and a zero-tolerance pre-merge naming linter. How It Plays Now \u0026amp; What\u0026rsquo;s Next # For the first time, the game actually has a real rhythm—expanding out, juggling local power brownouts, intercepting hazards, and racing the rival AI. That said, plenty is still rough: the mouse-first HUD still feels cramped on smaller screens, and controller support doesn\u0026rsquo;t exist yet beyond a design doc.\nBefore I tackle Steam Deck and gamepad playtesting, I\u0026rsquo;m going to write up a few of the engineering deep dives from this week—starting next with what I found when I actually audited 21 of my AI-written test files.\n","date":"November 24, 2026","externalUrl":null,"permalink":"/posts/shipping-strategy-game-loop-5-days-ai/","section":"Posts","summary":"On Sunday evening I sat down and played a full match of my Godot 4 space strategy game from start to finish for the first time. A rival AI expanded across the outer planets, an incoming space hazard forced me to scramble point defences, and half my outposts browned out mid-battle because I hadn’t built enough local power generation.\n","title":"Five Days to a Playable Strategy Loop (and Keeping the Code From Imploding)","type":"posts"},{"content":"","date":"November 22, 2026","externalUrl":null,"permalink":"/tags/ollama/","section":"Tags","summary":"","title":"Ollama","type":"tags"},{"content":"In my last two posts, I covered the hardware tiering and token economics behind my hybrid cloud/local Godot 4 \u0026ldquo;Virtual Studio\u0026rdquo;. Once the plumbing was solid—frontier cloud reasoning paired with fast local Gemma 4 endpoints via bin/ollama-gen—I ran straight into the next bottleneck: process discipline.\nLeft to its own devices, even the smartest coding agent exhibits two opposite failure modes when building a game:\nWithout engineering process skills, it jumps straight into writing code from a vague prompt, builds shallow coupled modules, skips tests, and drifts away from the original requirements. Without Godot-specific domain skills, it applies generic web/OOP habits to a scene-tree engine—fighting node lifecycles, wiring brittle get_node() paths instead of signals, hallucinating Godot 3 APIs, or writing untestable scripts tightly coupled to _process(). The unlock for me has been treating agent skills as a two-layer system:\nThe Outer Loop (Matt Pocock\u0026rsquo;s Skills): Language-agnostic software engineering discipline—interrogating requirements, designing deep modules, slicing work into crisp tickets, driving red-green-refactor cycles, and reviewing diffs against standards and specs. The Inner Loop (GodotPrompter Skills): Engine-idiomatic execution—Godot 4 scene organisation, custom Resource data containers, GDScript static-typing patterns, GUT/gdUnit4 testing mechanics, and Godot-specific debugging. Here is the exact workflow, which skills I use at each stage, how I resolve overlaps between the two libraries, and how the whole pipeline connects back to my hybrid cloud/local Ollama setup.\n1. The Architecture: Outer Loop vs. Inner Loop # Rather than dumping 60+ skills into every conversation and hoping the agent picks the right one, I separate responsibilities cleanly into two concentric loops:\nThe cloud model stays in charge of the outer loop—architectural reasoning, cross-file seams, and human alignment. Whenever a task drops into engine implementation, the inner loop pulls in just the relevant GodotPrompter skills, and hands bounded boilerplate, unit tests, and two-axis diff reviews down to my local Ollama endpoints (ollama-pc and ollama-mac).\n2. The Skill Roster: What Runs Where # The Outer Loop: Matt Pocock\u0026rsquo;s Engineering Skills # These skills govern how I think, plan, and verify—regardless of whether I am writing GDScript, TypeScript, or Terraform:\nStage Skill(s) What It Actually Does in My Workflow Discovery research, prototype Investigates Godot 4.x APIs or design questions against primary sources, or spins up a throwaway spike to sanity-check whether a mechanic or state model feels right before committing. Alignment grill-with-docs Relentlessly interviews me one decision at a time while cross-referencing my project docs and specs before any code is written, walking down the design tree so edge cases are settled up front instead of mid-implementation. Architecture domain-modeling, codebase-design, improve-codebase-architecture Sharpens ubiquitous terminology (GLOSSARY.md, ADRs), forces deep modules with clean seams, and refactors sprawling single-file scripts into reusable modules and state machines—preventing the classic indie-game trap of a 1,200-line Player.gd god script. Work Slicing tickets-for-local-llm (my derivative of Matt\u0026rsquo;s to-tickets) Splits the design into vertical, independently testable tickets, enriching each with exact file anchors, method signatures, numeric defaults, and test cases so a 12B local model can execute them reliably. Execution tdd Enforces strict red-green-refactor vertical slices rather than dumping 400 lines of untested gameplay code and trying to bolt tests on afterwards. Verification code-review, pr Runs a two-axis review (Standards + Spec) against the git diff, then drafts a clean, structured PR body once everything is green. Meta-Loop writing-for-agents Whenever an agent makes a repeatable mistake, I use this skill to tighten AGENTS.md or update local skill instructions concisely without bloating the prompt. The Inner Loop: GodotPrompter as a Modular Skill Library # For Godot 4 specifics, I use the GodotPrompter skill library. Because there are dozens of Godot skills available, I treat them as three distinct tiers pulled in on demand:\nEngine Lifecycle Skills: godot-brainstorming, godot-testing, godot-debugging, godot-code-review, godot-grill. Language \u0026amp; Architecture Foundations: gdscript-patterns, gdscript-advanced, scene-organization, component-system, resource-pattern, event-bus, dependency-injection. Feature \u0026amp; Domain Recipes: state-machine, ability-system, inventory-system, physics-system, player-controller, godot-ui, hud-system, save-load, shader-basics, etc. 3. Resolving the Overlap: The Strict Handoff Rule # If you install both Matt Pocock\u0026rsquo;s skills and GodotPrompter side by side, you immediately notice four direct collisions:\nConcern Matt Pocock Skill GodotPrompter Skill Pre-build interrogation grill-with-docs godot-grill Test-driven development tdd godot-testing Code review code-review godot-code-review Bug investigation diagnosing-bugs godot-debugging Leaving that ambiguity unresolved causes unpredictable agent behaviour—sometimes the agent runs a generic review and misses a Godot signal leak; other times it runs a Godot-only checklist and forgets to check the ticket\u0026rsquo;s acceptance criteria.\nMy rule is a strict handoff:\nMatt Pocock\u0026rsquo;s skills own high-level and cross-cutting work: grill-with-docs, domain-modeling, codebase-design, improve-codebase-architecture, tickets-for-local-llm (my derivative of Matt\u0026rsquo;s to-tickets), code-review, and pr. GodotPrompter skills take over for engine-specific execution: godot-testing (when writing GUT/gdUnit4 suites), godot-debugging (when tracing signals, remote trees, or physics/frame-order bugs), plus the relevant architecture and feature skills (gdscript-patterns, resource-pattern, state-machine, etc.) for the ticket at hand. Even where Matt\u0026rsquo;s code-review owns the outer two-axis structure (Standards + Spec), the Standards prompt inside my local bin/ollama-gen --review-standards script encodes the repo\u0026rsquo;s Godot 4 rules (static typing, signal cleanup, tab indentation, avoiding untyped Variant leaks). That way, there is one review workflow with zero duplication.\n4. End-to-End Walkthrough: Building a Resource-Based Ability System # To make this concrete, here is how a representative Godot 4 gameplay feature—a Resource-based Character Ability System (data-driven abilities with cooldowns, mana/stamina cost, cast states, and HUD binding)—moves through the pipeline from raw idea to merged PR.\nPhase 1: Discovery \u0026amp; Grilling (Cloud — Outer Loop) # Optional Spike (prototype / research): If I am unsure how Godot 4.3+ handles custom Resource duplication per-instance vs. shared references, I run a quick research pass or throwaway prototype. Interrogation (grill-with-docs): I invoke grill-with-docs to cross-check my existing project docs and force every open design question into the open one at a time: Can abilities be interrupted mid-cast? Are cooldowns driven by _physics_process delta or SceneTreeTimer? Does the HUD poll the ability runner, or subscribe via typed signals? Are buffs/modifiers in scope for v1, or deferred? Phase 2: Architecture \u0026amp; Local-Ready Slicing (Cloud — Outer Loop) # Domain \u0026amp; Module Seams (domain-modeling + codebase-design): Lock terminology (AbilityData vs. AbilitySlot vs. AbilityRunner). Draw a deep module seam: AbilityRunner exposes a tiny public surface (try_cast(id), get_cooldown_ratio(id), and typed signals ability_cast, cooldown_updated) while hiding state transitions and timer bookkeeping internally. Ticket Slicing (tickets-for-local-llm, derived from Matt\u0026rsquo;s to-tickets): Instead of one giant \u0026ldquo;Implement Ability System\u0026rdquo; issue, the cloud orchestrator slices it into 3–4 vertical tickets: Ticket 1: AbilityData custom Resource + validation unit tests. Ticket 2: AbilityRunner cooldown \u0026amp; cost logic + state transitions. Ticket 3: EventBus / HUD cooldown bar binding. Because each ticket uses tickets-for-local-llm, it includes exact file paths, GDScript method signatures with static types, numeric defaults, and concrete test assertions—giving my local 12B Gemma 4 model everything it needs to succeed without guessing. Phase 3: Engine Implementation (Inner Loop — Cloud + Local Ollama) # Skill Loading (Just-in-Time): For Ticket 2, the agent loads only the inner-loop skills relevant to that slice: godot-testing, gdscript-patterns, resource-pattern, and ability-system (or state-machine). Red-Green-Refactor (tdd + godot-testing): Red: The cloud orchestrator delegates test generation directly to disk on my RTX 4070 Ti: bin/ollama-gen -p \u0026#34;Write GUT unit tests for AbilityRunner cooldowns and insufficient resource rejection per Ticket #42...\u0026#34; -o tests/test_ability_runner.gd Cloud context impact: ~15 tokens (Wrote 94 lines to tests/test_ability_runner.gd (7.2s)). Green: Implement AbilityRunner following gdscript-patterns (strict static typing, class_name, typed signals, zero hardcoded get_node() paths), then run pre-filtered tests: bin/test | grep -E \u0026#34;(Running test suite|Results:|FAIL|ERROR|ALL TEST SUITES PASSED)\u0026#34; Debug (if needed): If a test fails because of a subtle Godot lifecycle quirk (e.g., call_deferred timing or an orphan node warning in GUT), I hand off strictly to godot-debugging rather than letting the agent guess blindly. Phase 4: Review, Ship \u0026amp; Tighten the Loop (Local + Cloud — Outer Loop) # Local Two-Axis Code Review (code-review via bin/ollama-gen): bin/ollama-gen --review-standards bin/ollama-gen --review-spec 42 Both axes run locally on ollama-pc in ~15 seconds for zero cloud tokens, checking Godot 4 coding standards on one axis and Ticket #42\u0026rsquo;s acceptance criteria on the other. PR Creation (pr): Once both reviews report CLEAN and tests pass, pr drafts a concise PR summary tied back to the ticket. Continuous Improvement (writing-for-agents): If the local model repeatedly forgot to type Array[AbilityData] or leaked a test node, I don\u0026rsquo;t just fix the code—I use writing-for-agents to add a one-line guardrail to AGENTS.md so the mistake never recurs. 5. Five Real-World Lessons (and Gotchas) # Combining two large skill ecosystems with a hybrid cloud/local setup wasn\u0026rsquo;t frictionless. Five lessons stood out quickly:\n1. Fighting the Massive Single-File God Script # One of the biggest issues I\u0026rsquo;ve faced with coding models in Godot is their strong gravity toward massive single-file codebases. Left unchecked, an agent will happily pile movement, combat, cooldowns, animation hooks, and UI updates into one 1,000+ line script because keeping everything in a single file is easier for the model to track in the moment.\nThe fix has been running improve-codebase-architecture explicitly whenever a script starts bloating, paired with targeted Godot prompts to extract state machines (state-machine) and reusable modules (component-system, resource-pattern, scene-organization). Guiding the refactor with those concrete structural targets—rather than a vague \u0026ldquo;clean this up\u0026rdquo;—consistently breaks monoliths into small, composable, independently testable Godot scenes and scripts.\n2. Skill Overlap Causes Trigger Ambiguity # When both grill-with-docs and godot-grill, or code-review and godot-code-review, live in your global skills folder, an agent will occasionally invoke the wrong one—or worse, load both and waste thousands of tokens reconciling two conflicting checklists. Documenting the strict handoff rule explicitly in AGENTS.md (and your global user rules) eliminates the guesswork.\n3. Loading Too Many Skills Bloats the Context Window # GodotPrompter has 50+ skills. Treating them as always-on instructions is a fast way to burn cloud quota and confuse a 32k-context local model. Keep the outer loop lean, and load Godot domain skills per ticket—an inventory ticket only needs inventory-system, resource-pattern, and godot-testing, not shader-basics or xr-development.\n4. Standard Tickets Fail on 12B Local Models # High-level human tickets (\u0026ldquo;Add cooldown tracking to abilities and wire it to the HUD\u0026rdquo;) work fine for a frontier cloud model, but a local 12B model (gemma4-it-qat-32k) will hallucinate file paths, invent method names, or mismatch signal signatures. Using tickets-for-local-llm as the bridge between codebase-design (cloud) and bin/ollama-gen (local) is what makes local delegation reliable: concrete file anchors, exact signatures, numeric defaults, and explicit edge-case tests remove the ambiguity before the local model ever runs.\n5. Close the Loop with writing-for-agents # Skills aren\u0026rsquo;t static documentation; they are executable engineering habits. Every time a Godot 4 footgun slips through—like forgetting queue_free() on dynamically instantiated test fixtures or misusing await with freed nodes—investing two minutes with writing-for-agents to patch AGENTS.md pays dividends on every subsequent ticket.\n6. Key Takeaways # Separate Process from Domain: Matt Pocock\u0026rsquo;s skills give your agent software-engineering discipline (the outer loop); GodotPrompter gives it engine fluency (the inner loop). You need both, and they work best when their boundaries are explicit. Use Strict Handoffs on Overlaps: Don\u0026rsquo;t let overlapping skills compete. Assign high-level planning, design, and two-axis review to the outer loop, and hand off cleanly to Godot-specific skills for engine testing, debugging, and scene architecture. Design Tickets for the Model That Will Execute Them: Pairing codebase-design on a cloud model with tickets-for-local-llm turns your local GPU into a reliable implementation and review workhorse without burning frontier token budgets. Are you layering general engineering skills with engine-specific skills in your own agentic workflow? Let me know what combinations—or skill collisions—you\u0026rsquo;ve run into in the comments below!\n","date":"November 22, 2026","externalUrl":null,"permalink":"/posts/outer-loop-inner-loop-godot-ai-skills/","section":"Posts","summary":"In my last two posts, I covered the hardware tiering and token economics behind my hybrid cloud/local Godot 4 “Virtual Studio”. Once the plumbing was solid—frontier cloud reasoning paired with fast local Gemma 4 endpoints via bin/ollama-gen—I ran straight into the next bottleneck: process discipline.\n","title":"Outer Loop, Inner Loop: Combining Matt Pocock's Engineering Skills with GodotPrompter for Agentic Game Dev","type":"posts"},{"content":"","date":"November 22, 2026","externalUrl":null,"permalink":"/tags/skills/","section":"Tags","summary":"","title":"Skills","type":"tags"},{"content":"In my previous post, I shared how I connected a desktop gaming PC (ollama-pc) and a headless Mac mini (ollama-mac) over my home LAN using the Model Context Protocol (MCP) to offload GDScript maths, shaders, and unit tests from metered frontier cloud models.\nOn paper, the architecture was a triumph. In practice, after running a full weekend of intensive ticket-driven development on my Godot 4 project, I discovered that how an agent communicates with local models matters just as much as where those models run.\nWhile debugging stalls, timeouts, and a surprisingly stubborn cloud token burn rate, I uncovered three subtle failure modes in local LLM tooling—and built a lightweight CLI pattern that cut my remaining cloud transcript bloat by over 90%.\n1. The Core Problem: The Hidden Economics of Agentic Loops # Frontier cloud models excel at multi-file system design, cross-repository reasoning, and interactive problem solving. However, inside an autonomous agentic loop (such as Antigravity or Claude Code), token consumption compounds exponentially across three hidden traps:\nContext Accumulation: Every turn appends to the conversation transcript. A 2,000-token tool response generated on Turn 3 is re-read and billed as input tokens on Turn 4, Turn 5, Turn 6, and Turn 20. The \u0026ldquo;Double-Echo\u0026rdquo; Anti-Pattern: When a cloud orchestrator uses a standard MCP model-to-model tool call to generate code: The agent calls ollama_generate to draft a 150-line test suite (~2,000 tokens). The MCP server returns those 2,000 tokens into the cloud agent\u0026rsquo;s context history. The cloud agent immediately calls write_file(\u0026quot;tests/test_feature.gd\u0026quot;, code)—echoing the exact same 2,000 tokens a second time in its tool arguments. The Result: The exact same 2,000 lines of code now exist twice in the cloud transcript (once as tool output, once as tool input). On every subsequent step of the task, that 4,000-token block is repeatedly re-sent and billed as cloud input tokens. Sub-Agent Token Burn: Running a two-axis code review at the end of a ticket (Standards Review + Specification Review) typically spawns two cloud research sub-agents. Each sub-agent reads the diff, repository rules, and calling scripts, burning 15,000 to 30,000 cloud tokens per ticket just to verify tab indentation, static typing, and acceptance criteria. 2. The Evolved Hardware \u0026amp; Model Lineup # After stress-testing my local endpoints against real Godot 4.x GDScript tasks and automated diff reviews, I standardised both LAN nodes on Google\u0026rsquo;s quantised Gemma 4 instruction-tuned models:\nEndpoint Hardware Active Model Context Window Role ollama-pc RTX 4070 Ti (12GB VRAM) gemma4-it-qat-32k:latest (12B) 32k Tier 1 (Fastest): Code generation, unit tests, two-axis code reviews, maths recipes ollama-mac Mac mini M6 (24GB Unified) gemma4:12b-it-qat (12B) 64k Tier 2 (Medium): Large diffs (\u0026gt;500 lines), multi-file logs, larger test suites Why did I move ollama-pc away from qwen3.5-32k? That brings me directly to the debugging journey.\n3. The Debugging Journey: Three Subtle Roadblocks # Getting local models to cooperate reliably with an automated agentic harness required diagnosing three non-obvious failure modes across samplers, MCP adapters, and Ollama\u0026rsquo;s streaming API.\nA. The Infinite \u0026lt;think\u0026gt; Loop and Presence Penalty # Symptom: MCP calls to ollama-pc consistently timed out after 3 minutes (context deadline exceeded). Root Cause: My initial qwen3.5-32k Modelfile had presence_penalty: 1.5 configured to discourage repetitive code boilerplate. However, for models that use internal chain-of-thought (\u0026lt;think\u0026gt; blocks), penalising token repetition mid-thought breaks the sampler\u0026rsquo;s reasoning loop. The model spiralled into runaway self-correction inside its \u0026lt;think\u0026gt; block until it hit the 3-minute client timeout. Fix: Switched ollama-pc to gemma4-it-qat-32k:latest with zero presence penalty, dropping generation latency to a rock-solid 6–12 seconds. B. The MCP JSON Grammar Sampler Deadlock # Symptom: Asking the MCP server for GDScript or Python code resulted in mysterious deadlocks or completely blank responses. Root Cause: The official @modelcontextprotocol/server-ollama adapter had two issues: it attempted strict JSON schema validation and defaulted its format parameter to \u0026quot;json\u0026quot;. Under the hood in llama.cpp, passing \u0026quot;format\u0026quot;: \u0026quot;json\u0026quot; activates a strict context-free grammar sampler that only permits valid JSON tokens ({, \u0026quot;, :, etc.). When the prompt asks for a Godot script starting with extends Node, the grammar sampler rejects the code tokens, causing generation to stall or emit empty strings. Fix: Switched the underlying MCP package from @modelcontextprotocol/server-ollama to ollama-mcp, and explicitly pass \u0026quot;format\u0026quot;: \u0026quot;markdown\u0026quot; (or omit JSON formatting) on all code generation calls. C. Updating the MCP Configuration (mcp_config.json) # To reflect the package switch and streamlined configuration, I updated my MCP config (~/.gemini/antigravity-cli/mcp_config.json). The updated setup replaces @modelcontextprotocol/server-ollama with ollama-mcp, stripping away the rigid JSON-enforcing environment variables while pointing directly at my dedicated hardware endpoints over the LAN:\n{ \u0026#34;mcpServers\u0026#34;: { \u0026#34;ollama-pc\u0026#34;: { \u0026#34;command\u0026#34;: \u0026#34;npx\u0026#34;, \u0026#34;args\u0026#34;: [\u0026#34;-y\u0026#34;, \u0026#34;ollama-mcp\u0026#34;], \u0026#34;env\u0026#34;: { \u0026#34;OLLAMA_HOST\u0026#34;: \u0026#34;http://\u0026lt;PC LOCAL IP\u0026gt;:11434\u0026#34; } }, \u0026#34;ollama-mac\u0026#34;: { \u0026#34;command\u0026#34;: \u0026#34;npx\u0026#34;, \u0026#34;args\u0026#34;: [\u0026#34;-y\u0026#34;, \u0026#34;ollama-mcp\u0026#34;], \u0026#34;env\u0026#34;: { \u0026#34;OLLAMA_HOST\u0026#34;: \u0026#34;http://\u0026lt;MAC LOCAL IP\u0026gt;:11434\u0026#34; } } } } This cleaner configuration avoids the grammar lockup traps of the older adapter and provides reliable tool calling for the orchestrator.\nD. The Separate thinking Field in Ollama 0.40+ # Symptom: Streaming code reviews from local models returned empty text despite running on the GPU for 20 seconds. Root Cause: Modern reasoning models in Ollama 0.40+ emit internal reasoning tokens under a distinct \u0026quot;thinking\u0026quot; key in each streaming JSON chunk, while emitting \u0026quot;response\u0026quot;: \u0026quot;\u0026quot; until the thinking phase finishes. When num_predict was set too low (for example, 1024), the model consumed its entire token allocation inside \u0026quot;thinking\u0026quot; before emitting a single character into \u0026quot;response\u0026quot;. Fix: Bumped num_predict to 4096 and updated my streaming client to handle full generation budgets properly. 4. The Solution: Two Architectural Changes That Save 90% of Tokens # Innovation 1: Direct-to-Disk Generation (Eliminating \u0026ldquo;Double-Echo\u0026rdquo;) # Instead of round-tripping generated code through the cloud agent\u0026rsquo;s context window via MCP, I created a lightweight repository CLI helper (bin/ollama-gen -o \u0026lt;path\u0026gt;) that queries the local Ollama endpoints directly, strips markdown code fences automatically, and writes the result straight to disk:\n99.7%\nTranscript Reduction\nCloud transcript impact per file drops from 4,000+ tokens to just 12 confirmation tokens. 0\nCloud Review Tokens\nTwo-axis Standards \u0026amp; Spec code reviews run entirely on the local RTX 4070 Ti in ~15s. 6–12s\nGeneration Latency\nFast local inference with Gemma 4 QAT with zero presence-penalty timeouts. By piping the local GPU\u0026rsquo;s output directly to the filesystem and returning only a single confirmation line to the cloud orchestrator, the cloud model never has to ingest or echo the raw boilerplate. If a test fails, the cloud agent inspects only the relevant lines rather than carrying every draft in its permanent conversation memory.\nInnovation 2: Local Two-Axis Code Reviews # Before any ticket is closed, changes are reviewed along two axes: Standards (Godot 4 syntax, strict tabs, static typing, architectural boundaries, and domain glossary compliance) and Spec (comparing the git diff against the GitHub issue\u0026rsquo;s acceptance criteria).\nThe Old Way: Spawn two cloud research sub-agents (~15,000 to 30,000 cloud tokens per ticket). The New Way: Run local CLI review commands directly on ollama-pc: bin/ollama-gen --review-standards bin/ollama-gen --review-spec \u0026lt;ticket_number\u0026gt; bin/ollama-gen automatically extracts the current git diff, pulls the issue specification via gh issue view, queries the RTX 4070 Ti over the LAN in ~15 seconds, and prints either concrete violations or CLEAN. Cloud Tokens Used: 0. 5. Evolving the Agent Rules (~/.antigravity.md) # A tool is only useful if your coding agent actually remembers to use it. I updated my global agent instructions (~/.antigravity.md) with three strict mandates:\nDirect-to-Disk by Default: Instructs the agent to use bin/ollama-gen -o \u0026lt;path\u0026gt; whenever generating standalone files or test suites. Local-First Code Reviews: Replaces cloud review sub-agents with --review-standards and --review-spec. Pre-Filtered Test Logs: Prohibits dumping raw 500-line bin/test outputs into cloud context, requiring bin/test | grep -E ... instead. The Complete ~/.antigravity.md Configuration # # Sub-Agent Delegation Rules (Hybrid Local/Cloud) You have access to local LLM sub-agents via configured Ollama MCP servers (`ollama-pc`, `ollama-mac`) and the repo CLI helper `bin/ollama-gen`. To conserve cloud context, token limits, and quota, delegate tasks according to the following guidelines. --- ## High-Leverage Quota Optimization Workflows ### 1. Direct-to-Disk Code Generation (Eliminate \u0026#34;Double-Echo\u0026#34;) - **The Problem:** Calling an MCP tool (`ollama_generate`) returns the entire code snippet into the cloud conversation history, and then calling `write_file` echoes the exact same code a second time in tool arguments. That double-sized block is billed as input tokens on every subsequent turn. - **The Solution:** Use `bin/ollama-gen -o \u0026lt;path\u0026gt;` to generate directly to disk: ```bash bin/ollama-gen -p \u0026#34;Write test suite for...\u0026#34; -o tests/test_new_feature.gd ``` - **Result:** The cloud context only receives `Wrote 120 lines to tests/test_new_feature.gd (6.8s)`. Zero code bloat in cloud history. - Automatically strips markdown code fences so the file contains clean, ready-to-run code. ### 2. Local-First Code Reviews (Eliminate Cloud Review Sub-Agents) - Instead of spawning two cloud `research` subagents per ticket for Standards and Spec reviews, run them locally via `bin/ollama-gen`: ```bash # Standards Review (checks git diff against Godot 4 \u0026amp; repo standards) bin/ollama-gen --review-standards # Spec Review (checks git diff against GitHub issue spec or text) bin/ollama-gen --review-spec \u0026lt;ticket_number_or_spec_text\u0026gt; ``` - Reviews run on `ollama-pc` in ~10–25s and output concise, bulleted findings or `CLEAN`. - Saves 15,000–30,000 cloud tokens per ticket. ### 3. Pre-Filter Test Logs \u0026amp; Command Outputs - Never dump raw 500-line `bin/test` progress into context. Filter output: ```bash bin/test | grep -E \u0026#34;(Running test suite|Results:|FAIL|ERROR|ALL TEST SUITES PASSED)\u0026#34; ``` - If an error trace is long, let `ollama-pc` isolate the root cause before ingesting. --- ## Division of Responsibilities ### Keep on Cloud (Yourself): - Multi-file architectural planning, whole-project refactoring, and complex Godot scene/architecture debugging. - Final code integration, validation, and executing final `edit_file` / `write_file` adjustments. - Cross-file dependency analysis, tool orchestration, and direct user interaction. ### Handoff to Local Ollama Endpoints: - Generating standalone functions, math recipes, shaders, or boilerplate GDScript / C# classes. - Writing unit tests, mock data structures, or test fixtures (via `bin/ollama-gen -o \u0026lt;path\u0026gt;`). - Two-axis code reviews (`--review-standards` and `--review-spec`). - Summarizing long error logs, stack traces, or profiling captures. --- ## Available Endpoints \u0026amp; Active Models | Endpoint / MCP Server | Active Model | Active Context Window | Relative Speed | Host \u0026amp; Hardware | | :--- | :--- | :--- | :--- | :--- | | **`ollama-pc`** | `gemma4-it-qat-32k:latest` (12B) | **32,768 tokens** (32k) | **Fastest** | `http://192.168.0.2:11434` (RTX 4070 Ti 12GB) | | **`ollama-mac`** | `gemma4:12b-it-qat` (12B) | **65,536 tokens** (64k) | **Medium** | `http://192.168.0.173:11434` (Mac mini M6 24GB Unified RAM) | --- ## Endpoint Selection Strategy (Speed-First with Context Gating) Select local endpoints strictly in speed order (`pc` \u0026gt; `mac`), based on context required: 1. **Tier 1 — `ollama-pc` (Primary / Default):** - **Criteria:** Context required is \u0026lt;= **32k tokens**. - **Use cases:** Rapid function generation, unit tests, code reviews, shader code, math helpers. - **CLI flag:** `-e pc` (default). 2. **Tier 2 — `ollama-mac` (Medium-Context Fallback):** - **Criteria:** Context required is \u0026gt; **32k tokens** and \u0026lt;= **64k tokens**. - **Use cases:** Larger diffs (\u0026gt;500 lines), multi-file logs, larger test suites. - **CLI flag:** `-e mac`. 3. **Tier 3 — Cloud Agent (Yourself):** - **Criteria:** Context exceeds 64k tokens, tasks requiring multi-file workspace tools, or cross-cutting architectural reasoning. 6. Key Takeaways # Keep the Brain in the Cloud, the Muscle on Local Metal: Use frontier cloud models for system-level planning, architectural coordination, and complex scene integrations. Let local GPUs grind out unit tests, boilerplate syntax, and diff reviews. Never Echo Generated Code in Tool Calls: If an orchestrator requests code from a local sub-model, pipe it straight to disk. Writing directly to the filesystem and returning only a status line to the cloud agent prevents conversational history bloat. Watch Your Grammar and Presence Samplers: Beware of default \u0026quot;format\u0026quot;: \u0026quot;json\u0026quot; constraints in MCP adapters when generating source code, and zero out presence penalties on reasoning models so their \u0026lt;think\u0026gt; blocks don\u0026rsquo;t spiral into timeouts. Have you hit the \u0026ldquo;Double-Echo\u0026rdquo; token trap or wrestled with MCP grammar samplers in your own local LLM setup? Let me know in the comments below!\n","date":"November 9, 2026","externalUrl":null,"permalink":"/posts/hybrid-local-cloud-ai-coding/","section":"Posts","summary":"In my previous post, I shared how I connected a desktop gaming PC (ollama-pc) and a headless Mac mini (ollama-mac) over my home LAN using the Model Context Protocol (MCP) to offload GDScript maths, shaders, and unit tests from metered frontier cloud models.\n","title":"Beyond Basic MCP: Eliminating 'Double-Echo' Token Bloat and Debugging Local Ollama Endpoints","type":"posts"},{"content":"","date":"November 9, 2026","externalUrl":null,"permalink":"/tags/cost-optimization/","section":"Tags","summary":"","title":"Cost Optimization","type":"tags"},{"content":"","date":"November 9, 2026","externalUrl":null,"permalink":"/tags/hardware/","section":"Tags","summary":"","title":"Hardware","type":"tags"},{"content":"","date":"November 9, 2026","externalUrl":null,"permalink":"/tags/mcp/","section":"Tags","summary":"","title":"MCP","type":"tags"},{"content":"","date":"November 9, 2026","externalUrl":null,"permalink":"/tags/python/","section":"Tags","summary":"","title":"Python","type":"tags"},{"content":"If you spend any time on tech social media, the discourse around \u0026ldquo;agentic AI coding\u0026rdquo; is dominated by enterprise-scale teams boasting about autonomous sweeps over million-token codebases.\nFor commercial startups with investor runway, a £400 monthly API bill for continuous Claude 3.5 Sonnet or OpenAI reasoning tokens is just a rounding error on engineering payroll.\nFor me, this is not my job. It is not even a part-time job. It is a hobby.\nI build games in the evenings and on weekends. It is a creative haven after a long workday. And nothing kills the joy of a hobby faster than two insidious realities of commercial cloud APIs:\nSurprise Token Bills: A single automated agent getting stuck in a tool-calling retry loop can burn through £25 of frontier reasoning tokens in forty-five minutes. Quota Wall Lockouts: Hitting an arbitrary \u0026ldquo;Rate Limit Exceeded\u0026rdquo; or \u0026ldquo;Weekly Token Quota Depleted\u0026rdquo; right when you finally sit down on a Saturday morning with a hot cup of coffee to work on your game. To make agentic game development sustainable for solo creators, we need a disciplined economic strategy: the Hybrid Local/Cloud Architecture.\nHere is how I use an existing desktop gaming GPU, Ollama, and the Model Context Protocol (MCP) to offload the vast majority of coding workloads, keeping cloud token usage minimal, response times instantaneous, and costs firmly at zero.\nThe Trap: Feeding the Whole World to Frontier Cloud Models # The intuitive way people start with AI coding agents is simple: plug your editor into a top-tier frontier model, point it at your repository root, and let it rip.\nThis works reasonably well for small scripts, but as your Godot project grows, you run into what I call Context Inflation Syndrome:\nThe Cloud-Only Token Spiral\nThe Request: You ask the cloud agent to implement orbital mechanics and build a comprehensive test suite. Context Accumulation: Across multiple turns of reading calling scripts, generating implementations, drafting test fixtures, and fixing edge cases, conversation history quickly balloons to 12,000 to 20,000 tokens per turn. The Metered Re-send: Because every subsequent turn re-sends the entire accumulated conversation history, even minor tweaks to a formula burn through metered cloud tokens rapidly. Over an afternoon of iterative prototyping, repeating this multi-turn cycle across several subsystems can easily consume millions of tokens.\nBeyond the financial cost, dumping whole-codebase context into an LLM often produces worse code. Models get distracted by unrelated classes, hallucinate deprecated Godot 3 syntax found in older helper files, or over-complicate simple maths problems to match global architecture they did not need to see.\nThe Gamer Advantage: Put Your Idle GPU to Work # If you play modern PC games, you almost certainly already own the single most valuable asset in modern AI: a dedicated GPU with modern VRAM.\nMy primary development machine is a laptop running Godot 4 and the Antigravity CLI. Rather than running hot, battery-draining local inference directly on the laptop while simultaneously running Godot playtests, both of my Ollama servers are remote, living on dedicated hardware across my home network:\nRemote Primary Engine (Gaming PC): A desktop PC with a dedicated GPU delivering blistering generation speeds (80-110 tokens per second). Well as blistering as I can get. Remote Medium-Context Engine (Mac mini): A headless mac mini providing double the context capacity for larger multi-function classes and longer test suites. This arrangement keeps my development laptop completely cool, quiet, and responsive, with zero CPU or GPU contention while Godot compiles and runs, while heavy matrix multiplication runs over low-latency Gigabit LAN.\nHere is the hardware division across my local network:\nEndpoint / MCP Server Active Model Context Window Relative Speed Host \u0026amp; Hardware ollama-pc qwen3.5-32k:latest (9B) 32,768 tokens (32k) Fastest (80–110 t/s) Remote PC\nNvidia RTX 4070 Ti (12GB) ollama-mac gemma4:12b-it-qat (12B) 65,536 tokens (64k) Medium Remote Mac mini M6\n24GB Unified RAM Running remotely over the LAN, qwen3.5:9b on the RTX 4070 Ti responds with near-zero latency, zero API metering, and zero internet dependency.\nConnecting the Pieces: The Model Context Protocol (MCP) # To let a frontier cloud agent (the orchestrator) communicate seamlessly with local Ollama instances from my laptop, we use the Model Context Protocol (MCP).\nMCP provides a standardized JSON-RPC interface that exposes remote local models as callable tools to the agent. Because both Ollama nodes live on my home LAN, the MCP configuration on my laptop simply routes tool calls to their respective local IP addresses:\n{ \u0026#34;mcpServers\u0026#34;: { \u0026#34;ollama-pc\u0026#34;: { \u0026#34;command\u0026#34;: \u0026#34;npx\u0026#34;, \u0026#34;args\u0026#34;: [\u0026#34;-y\u0026#34;, \u0026#34;@modelcontextprotocol/server-ollama\u0026#34;], \u0026#34;env\u0026#34;: { \u0026#34;OLLAMA_HOST\u0026#34;: \u0026#34;http://\u0026lt;PC LOCAL IP\u0026gt;:11434\u0026#34;, \u0026#34;DEFAULT_MODEL\u0026#34;: \u0026#34;qwen3.5:9b\u0026#34;, \u0026#34;CONTEXT_WINDOW\u0026#34;: \u0026#34;32768\u0026#34; } }, \u0026#34;ollama-mac\u0026#34;: { \u0026#34;command\u0026#34;: \u0026#34;npx\u0026#34;, \u0026#34;args\u0026#34;: [\u0026#34;-y\u0026#34;, \u0026#34;@modelcontextprotocol/server-ollama\u0026#34;], \u0026#34;env\u0026#34;: { \u0026#34;OLLAMA_HOST\u0026#34;: \u0026#34;http://\u0026lt;MAC LOCAL IP\u0026gt;:11434\u0026#34;, \u0026#34;DEFAULT_MODEL\u0026#34;: \u0026#34;gemma4:12b-it-qat\u0026#34;, \u0026#34;CONTEXT_WINDOW\u0026#34;: \u0026#34;65536\u0026#34; } } } } With this configured, the frontier model does not need to execute every code draft itself. Instead, it acts as a tech lead, dispatching self-contained programming tickets to local workers based on required context and speed.\nThe Division of Responsibilities # The secret to making this hybrid setup reliable is establishing strict rules of engagement. You must know exactly what belongs on the cloud and what should be delegated locally:\nTask Category Assigned Tier Why Delegate Here? Multi-file Architecture \u0026amp; Refactoring Cloud Frontier Requires deep holistic reasoning across multiple interconnected nodes, scenes, and global game state. Cross-file Seam Decisions \u0026amp; Tool Calling Cloud Frontier Orchestrating workspace tools, editing files on disk, validation, and managing git commits. Pure Maths Recipes \u0026amp; Orbit Calculations Local PC (ollama-pc) Self-contained, deterministic, zero repo context required. Instant response with RTX GPU speed. GUT / Unit Test Generation Local PC (ollama-pc) Drafting repetitive test fixture permutations, edge cases, and assert statements. Large Classes \u0026amp; Multi-function Scripts Local Mac (ollama-mac) Prompts requiring \u0026gt;32k tokens that benefit from the Mac mini\u0026rsquo;s 64k context capacity. Log \u0026amp; Crash Dump Summarization Local Mac (ollama-mac) Ingesting massive 40k–50k token engine debug dumps without blowing cloud context quotas. Custom Shaders (Visual/Text) Local PC (ollama-pc) Isolated mathematical algorithms and GLSL/Godot shader code with zero scene dependencies. Endpoint Selection Strategy: Speed-First with Context Gating # To prevent bottlenecks, the orchestrator selects local endpoints strictly in speed order (ollama-pc \u0026gt; ollama-mac), provided the required context size fits within the endpoint\u0026rsquo;s active context window:\n1 Tier 1: ollama-pc (Primary / Default) Criteria: Context required is ≤ 32k tokens.\nHardware: Dedicated Nvidia RTX 4070 Ti (12GB VRAM) running qwen3.5:9b. Use Cases: Rapid function generation, unit tests, shader recipes, maths helpers, boilerplate classes. Advantage: Fastest response time (80-110 tokens/sec) on dedicated GPU compute with zero API cost. 2 Tier 2: ollama-mac (Medium-Context Fallback) Criteria: Context required is \u0026gt; 32k tokens and ≤ 64k tokens.\nHardware: Mac mini M6 (24GB Unified RAM) running gemma4:12b-it-qat. Use Cases: Larger classes, moderately long logs, multi-function scripts, larger test suites. Advantage: Double the context window of ollama-pc with consistent Apple Silicon throughput. 3 Tier 3: Cloud Agent (Frontier Orchestrator) Criteria: Context exceeds 64k tokens, or tasks requiring multi-file workspace tools and cross-cutting architectural reasoning.\nRole: Tech lead, tool coordinator, whole-project refactoring, and code validation. Advantage: Maximum reasoning capacity, reserved exclusively for tasks that justify metered cloud tokens. A Concrete Example: Delegating Keplerian Orbit Maths # Let us look at how this plays out during a real development session in Godot 4.\nSuppose we need to calculate the vis-viva equation to determine orbital velocity and transfer burn requirements between two celestial bodies.\nOf course, the cloud model still needs to inspect the calling architecture (for example, reading celestial_body.gd or orbit_controller.gd) to understand existing coordinate frames and method signatures. That initial file read might take 2,000 to 3,000 tokens of cloud context.\nThe divergence is what happens next:\nWithout delegation: The cloud model generates the class, drafts 10 unit test cases, fixes edge cases, and re-reads the growing conversation thread across multiple turns, consuming 10,000 to 15,000 metered cloud tokens for the full lifecycle. With delegation: The cloud model acts as a tech lead. It extracts the isolated mathematical requirement, writes a concise 200-token specification, and delegates the raw code generation and unit test authoring to ollama-pc. 1. The Cloud Orchestrator\u0026rsquo;s Delegated Request # Tool Call: ollama-pc.generate_code Model: qwen3.5:9b Prompt: \u0026#34;Write a pure static GDScript 4.3 helper class named `OrbitalMechanics`. Requirements: 1. Static function `calculate_orbital_speed(mu: float, r: float, a: float) -\u0026gt; float` implementing the Vis-Viva equation: v = sqrt(mu * (2/r - 1/a)). 2. Static function `calculate_synodic_period(p1: float, p2: float) -\u0026gt; float` implementing: 1 / abs(1/p1 - 1/p2). Handle edge case where p1 == p2 (return INF). 3. Include strict static typing and brief Godot docstrings. 4. No external dependencies, no node references.\u0026#34; 2. The Local GPU Output (~0.8 seconds on RTX 4070 Ti) # class_name OrbitalMechanics extends RefCounted ## Calculates the orbital speed of a body using the Vis-Viva equation. ## [param mu]: Standard gravitational parameter (G * M) in m^3/s^2. ## [param r]: Current distance from central body center in meters. ## [param a]: Semi-major axis of the orbit in meters (a \u0026gt; 0 for ellipse). static func calculate_orbital_speed(mu: float, r: float, a: float) -\u0026gt; float: assert(r \u0026gt; 0.0, \u0026#34;Orbital radius must be positive.\u0026#34;) assert(a \u0026gt; 0.0, \u0026#34;Semi-major axis must be positive.\u0026#34;) var specific_energy: float = (2.0 / r) - (1.0 / a) return sqrt(maxf(0.0, mu * specific_energy)) ## Calculates the synodic period between two co-planar orbiting bodies. ## [param p1]: Orbital period of body 1 in seconds. ## [param p2]: Orbital period of body 2 in seconds. static func calculate_synodic_period(p1: float, p2: float) -\u0026gt; float: if is_equal_approx(p1, p2): return INF var freq_diff: float = absf((1.0 / p1) - (1.0 / p2)) if is_zero_approx(freq_diff): return INF return 1.0 / freq_diff 3. The Integration Step # The cloud orchestrator receives this clean snippet, reviews the mathematical assertions, and writes it directly to scripts/orbital_mechanics.gd using its local workspace file tool. In a follow-up local prompt, ollama-pc generates 10 exhaustive GUT unit tests in under two seconds.\nCloud tokens spent: ~2,500 tokens (reading the calling interface once, dispatching the spec, and integrating the final file). Local tokens spent: ~2,500 tokens (generating the class, handling edge cases, and drafting unit test fixtures locally for £0.00). Net result: Over 70% of metered cloud output generation and conversational retry tokens are offloaded to your local GPU, preserving cloud quotas for high-level systems design. Why \u0026ldquo;Context Isolation\u0026rdquo; Actually Improves Quality # One of the biggest surprises of this workflow is that local sub-agents often write cleaner code than frontier models when stripped of repo noise.\nWhen you pass an LLM a 40-file context dump, its attention mechanism is diluted across hundreds of irrelevant functions, old architectural remnants, and styling quirks.\nBy strictly enforcing Context Isolation:\nZero Hallucination Cross-Talk: The local model cannot pull in obsolete node paths or outdated signal names from other scenes because it never saw them. Deterministic Inputs and Outputs: The prompt defines explicit types, inputs, and edge cases, forcing the model to produce mathematically rigorous, decoupled code. Instant Automated Unit Tests: Because the generated module is a pure RefCounted or static class with no engine tree dependencies, a second local prompt can instantly spit out 10 exhaustive GUT unit tests in under two seconds. Conclusion: Sustainable AI for the Solo Creator # Agentic AI tools are transforming software engineering, but commercial toolmakers design their pricing models for enterprise software budgets, not weekend game designers.\nIf you are a solo developer building games for the sheer love of the craft:\nDo not treat frontier cloud models as your only hammer. Put your remote home hardware to work. An RTX GPU or headless Mac mini running Ollama over your local network handles 70% of your daily programming needs while keeping your development laptop cool and fast. Use MCP to build a hybrid team. Let the expensive frontier model act as the architect who designs the seams, while your local GPU acts as the tireless intern writing pure maths, unit tests, and boilerplate. You get all the speed and leverage of an agentic workflow, while keeping your monthly API bill as low as possible and your weekend momentum uninterrupted.\nWhat does your local dev setup look like? Have you experimented with Ollama or local LLMs in Godot? Drop a comment below!\n","date":"November 8, 2026","externalUrl":null,"permalink":"/posts/local-gpu-agentic-dev-costs/","section":"Posts","summary":"If you spend any time on tech social media, the discourse around “agentic AI coding” is dominated by enterprise-scale teams boasting about autonomous sweeps over million-token codebases.\nFor commercial startups with investor runway, a £400 monthly API bill for continuous Claude 3.5 Sonnet or OpenAI reasoning tokens is just a rounding error on engineering payroll.\n","title":"The Hobbyist's Guide to Agentic Dev: How Local GPUs and MCP Prevent Cloud Token Bankruptcy","type":"posts"},{"content":"","date":"November 8, 2026","externalUrl":null,"permalink":"/tags/gamedev/","section":"Tags","summary":"","title":"Gamedev","type":"tags"},{"content":"","date":"November 8, 2026","externalUrl":null,"permalink":"/tags/godot/","section":"Tags","summary":"","title":"Godot","type":"tags"},{"content":"","date":"November 8, 2026","externalUrl":null,"permalink":"/tags/indie/","section":"Tags","summary":"","title":"Indie","type":"tags"},{"content":"For years, game development has been considered one of the steepest mountains in software engineering. As a solo developer, you aren\u0026rsquo;t just writing code but you are the systems architect, physics engineer, tools programmer, level designer, and animator rolled into one.\nThe ambition often outpaces the clock.\nOver the past year, however, a quiet revolution has taken place in developer tooling. We have moved far beyond simple tab-autocomplete and single-line code suggestions into the era of agentic code assistance, autonomous AI agents capable of planning across multiple files, reasoning about node trees, writing test suites, and performing comprehensive code reviews.\nQuasicode is my public workspace and devlog documenting what happens when a software engineer pairs with an agentic \u0026ldquo;Virtual Studio\u0026rdquo; to build games from scratch.\nWhy Godot 4 is the Sweet Spot # When choosing an engine for AI-assisted development, your tooling must speak the same language as your agents. While Unreal and Unity are powerhouses, Godot 4 possesses a set of superpowers uniquely suited to agentic pair programming:\nHuman-Readable Text Files: In Godot, scenes (.tscn) and resources (.tres) are plain text. AI agents can inspect node hierarchies, instantiate components, and configure export properties directly in diffs without corrupting binary blobs. Explicit Node \u0026amp; Signal Architecture: Godot’s strict separation of concerns, nodes handling behavior, signals managing communication upward, and resources encapsulating data, mirrors the modular patterns that LLMs handle best. GDScript \u0026amp; C# Duality: GDScript allows for lightning-fast prototyping of game mechanics, while C# provides static type safety and high performance when systems deepen. Instant Startup \u0026amp; Zero Bloat: Godot launches in milliseconds, allowing rapid test-play cycles and instant feedback on code changes. The \u0026ldquo;Virtual Studio\u0026rdquo; Workflow: Cloud Meets Local # A common mistake with AI code assistance is treating every model like a single monolithic chatbot. In reality, different coding tasks require fundamentally different models, latencies, and contexts.\nMy workflow operates as a hybrid multi-tier Virtual Studio:\nBy offloading isolated functions, vector math recipes, and test cases to dedicated local sub-agents, iteration remains instantaneous and cost-free, reserving frontier cloud reasoning for whole-scene architecture and tricky physics debugging.\nThe Rules of Engagement # Can an AI build a game by itself? No, and that isn\u0026rsquo;t the goal.\nTrue \u0026ldquo;game feel\u0026rdquo;, mechanical nuance, thematic coherence, and the emotional pacing of play can only come from human taste and playtesting. The AI doesn\u0026rsquo;t know if a jump curve feels snappy or sluggish until a human hands it the feedback: \u0026ldquo;The gravity scale feels floaty; tighten the apex hang-time and add coyote frames.\u0026rdquo;\nThe rules of engagement for this devlog are simple:\nNo Magic Prompting: Every mechanic breakdown will show the actual architecture, code diffs, and prompt constraints used. Post-Mortems on Hallucinations: When the agent suggests deprecated Godot 3 APIs or creates subtle signal memory leaks, we analyze why it happened and how to guard against it. Playable Progress: Documenting real prototypes that run in the engine and on the web. What’s Coming Next # In the upcoming posts, I\u0026rsquo;ll be sharing:\nArchitecting a Headless Simulation Core: Decoupling pure deterministic orbital simulation state from Godot 4\u0026rsquo;s scene tree so agentic coding agents can write, run, and verify unit test suites in milliseconds without rendering overhead. Orbital Vector Math \u0026amp; Local LLM Offloading: How we delegate Keplerian motion math and transfer window equations to local LLMs (via Ollama) while maintaining strict prompt boundaries to prevent math hallucinations. Connecting the Headless Core to the Visual Engine: Designing clean signal-driven seams between headless simulation models and Godot\u0026rsquo;s visual tactical map, custom shaders, and UI. If you are an engineer exploring game systems, an orbital strategy enthusiast, or an indie creator curious about disciplined, test-driven AI workflows, welcome aboard!\n","date":"November 8, 2026","externalUrl":null,"permalink":"/posts/the-virtual-studio/","section":"Posts","summary":"An introduction to Quasicode, the hybrid cloud/local agentic workflow, and why Godot 4 is the sweet spot for modern AI-assisted indie game development.","title":"The Virtual Studio: Building Games with Godot 4 and Agentic AI","type":"posts"},{"content":"","date":"November 8, 2026","externalUrl":null,"permalink":"/tags/virtual-studio/","section":"Tags","summary":"","title":"Virtual-Studio","type":"tags"},{"content":"Hi, I\u0026rsquo;m David Watson.\nI am a software engineer and infrastructure engineer exploring the craft of indie game development with a modern focus: treating advanced AI coding agents not as autocomplete widgets or gimmick generators, but as an active, collaborative virtual engineering team.\nQuasicode is my digital workshop and devlog documenting this experiment in real time.\nThe Line in the Sand: Code vs. Assets # A foundational principle of Quasicode is maintaining a strict, non-negotiable boundary between engineering assistance and creative work:\nAgentic AI for Code Only: Coding agents are used strictly for software engineering, architecting systems, drafting shaders, solving complex vector and orbital math equations, generating boilerplate, and authoring rigorous unit tests under continuous human direction and review. 100% Human-Crafted Assets: All visual art, 2D sprites, 3D models, textures, animations, UI styling, sound effects, music, and world lore are entirely human-made (or sourced from human artists with explicit licensing). No generative AI art, audio, or voice synthesis models are used for game assets. Human Taste \u0026amp; Direction: An AI model cannot judge whether a mechanic feels snappy, satisfying, or emotionally resonant. Game design, mechanical tuning, pacing, and overall creative vision remain solely driven by human hands and iterative playtesting. The Vision: The Virtual Studio # Building games as a solo indie developer has traditionally meant bearing every discipline alone. Systems architecture, math formulations, engine plumbing, data schemas, and endless test loops.\nBy combining:\nHigh-level Cloud Models for architectural planning, deep module design, and complex scene composition, Local On-Premise LLMs (via Ollama on dedicated hardware) for rapid math helpers, shaders, mechanics boilerplate, and unit testing, I operate what I call a Virtual Studio, a disciplined pairing workflow where human systems architecture and creative direction are accelerated by autonomous coding sub-agents.\nThe Stack # Game Engine: Godot 4 (GDScript \u0026amp; C#). Godot\u0026rsquo;s text-based .tscn and .tres file formats make it exceptionally well-suited for version control and AI navigation. Agentic Tooling: Hybrid local/cloud multi-agent orchestration, custom engine skill prompts, and strict context gating. Testing \u0026amp; Tooling: Headless simulation testing, deterministic logic models, and automated test runners. What You’ll Find Here # This site isn\u0026rsquo;t about hype or \u0026ldquo;generate a whole game with one prompt\u0026rdquo; shortcuts. It is an honest, hands-on technical chronicle:\nDevlogs \u0026amp; Post-Mortems: What worked, what failed, and the reality of debugging agent-authored code. Agentic Workflows: How to structure prompts, skills, and context windows so agents write clean, idiomatic Godot code without hallucinating deprecated APIs. Systems \u0026amp; Simulation Engineering: Deep-dives into deterministic simulation models, orbital and vector math, graph networks, and decoupled engine architectures. Tooling \u0026amp; Infrastructure: Technical breakdowns of our local and cloud agent pairing setup. Connect # If you\u0026rsquo;re exploring game systems, building with Godot, or curious about disciplined, test-driven agentic workflows, I\u0026rsquo;d love to connect:\nEmail: david [at] quasicode.co.uk ","date":"November 8, 2026","externalUrl":null,"permalink":"/about/","section":"Building Games with Agentic Code Assistance","summary":"Hi, I’m David Watson.\nI am a software engineer and infrastructure engineer exploring the craft of indie game development with a modern focus: treating advanced AI coding agents not as autocomplete widgets or gimmick generators, but as an active, collaborative virtual engineering team.\n","title":"About Me \u0026 Quasicode","type":"page"}]