By Ajarn Spencer Littlewood • Autonomous Systems Architecture • Developer Philosophy

The Architecture of AI Rulemaking - Deconstructing the Russian Doll Deadlock

The software engineering landscape is currently undergoing a monumental paradigm shift. We have crossed the threshold from passive autocomplete chat windows into the era of direct-action, autonomous agentic development platforms—embodied by environments like Google Antigravity CLI (agy), Claude Code, and deep multi-agent orchestration engines.

In these environments, the AI is no longer a passive suggestions widget; it is an active pair programmer, system architect, and terminal executor holding root privileges, managing background daemons, compiling binaries, and deploying code.

Yet, as thousands of engineers and creators dive into autonomous agentic workflows, an almost universal pattern of frustration emerges:

  1. The developer encounters an unexpected behavior or mistake from the agent.
  2. The developer immediately writes a new rule or constraint into their project configuration (GEMINI.md, AGENTS.md, or .agents/rules/).
  3. Two sessions later, the agent encounters another edge case, and another rule is hastily added.
  4. Within days, the agent starts hesitating, hallucinating procedural loops, running endless file-inspection diagnostics, or freezing entirely in a state of operational paralysis.

Many developers witness this erratic behavior and immediately whisper about “spooky emergent behavior” or claim that modern LLMs are fundamentally unpredictable and unsuited for production engineering.

That diagnosis is fundamentally wrong. What most people misdiagnose as “spooky AI emergence” is almost never spontaneous machine consciousness or mysterious non-deterministic drift. It is the mathematical collision of human syntactic ambiguity with machine literalism inside a flat, unranked rule structure.

When you construct a dense nest of contradictory micro-constraints without a strict hierarchical doctrine, you create a self-defeating “Russian doll” that suffocates the AI from within. Below is the anatomy of how that deadlock happens, a battle-tested case study from our own production environment, and the structural doctrine required to eliminate it forever.


1. The Myth of “Spooky Emergence”: Ambiguity vs. Mathematics

In pop-tech culture, “emergent behavior” has become a lazy catch-all phrase used to explain any AI action that surprises the human observer.

In reality, Large Language Models are probability engines conditioned on context. They do not possess capricious moods. When an AI agent running in a terminal session begins acting bizarrely—such as checking the size of twenty configuration files instead of writing code, or asking five circular clarifying questions when instructed to complete a straightforward task—it is not acting out of malice or erratic autonomy.

It is acting out of conflicting constraint satisfaction.

Consider what happens when a developer provides three seemingly reasonable rules in a project configuration:

  • Rule A: “Always ensure thorough verification before executing file modifications.”
  • Rule B: “Do not ask for permission on trivial decisions; act autonomously with direct authority.”
  • Rule C: “Keep token usage optimal and avoid unnecessary file reading.”

To a human reading these lines casually, they sound like balanced common sense. But to a machine evaluating tokens literally across a multi-step execution tree, Rule A and Rule C are in direct structural conflict with Rule B:

  • If it executes without verification, it violates Rule A.
  • If it reads files to verify, it risks violating Rule C.
  • If it stops to ask the user, it violates Rule B.

Because traditional rule files treat all rules as an unranked, flat list of equal imperatives, the machine has no logical arbiter to decide which rule yields to which. The result is what engineers mistake for “emergent erraticism”: the model oscillates between partial compliance, freezes into loops, or grasps at irrelevant diagnostic tasks to avoid violating any single clause. The behavior did not emerge from the ether—it emerged directly from the ambiguous, unranked syntax of the human rulemaker.


2. A Trench Case Study: The “Budget” and /learn Deadlock

To see this in action, examine a real-world scenario that unfolded in our own terminal while developing with Google Antigravity CLI on an Intel N150 machine.

We were building and deploying an open-source media app. Everything was executing with razor-sharp precision. We then invoked Antigravity’s built-in /learn slash command to persist an operational lesson into our master training protocol (training.md).

Instead of quickly drafting the rule proposal and presenting it for review, the agent suddenly began running read-only diagnostic commands (diff -q, wc -l, inspecting agy-customizations guides, checking file sizes). To the user, it looked as though the AI was procrastinating, running off on an unprompted tangent, and stalling out.

Why Did This Happen?

When we audited the underlying mechanism, the root cause was glaringly obvious:

  1. The Legacy Boilerplate: Antigravity’s framework prompt for /learn contained a boilerplate clause written for legacy, small-context models: “If updating a target file would approach or exceed its documented size/budget limits … propose condensing or splitting instead of appending.”
  2. The Semantic Collision: To the human user, “budget” means real money and paid API credits. To the legacy system prompt, “budget” referred to an arbitrary prompt-injection byte limit designed years ago when context windows were 8k or 32k tokens.
  3. The Resulting Absurdity: The active LLM (Gemini) natively handles 1 to 2 million tokens—capable of ingesting entire libraries in seconds. Yet, because of that uncalibrated boilerplate clause, the AI stopped its forward momentum to burn bash commands and actual billable API tokens measuring character counts on a markdown file that only grows by a few lines a week!

A procedural heuristic designed to “protect efficiency” had become the very mechanism that destroyed efficiency. It was a classic Russian-doll deadlock: a supporting rule had mutated into an active obstruction.


3. The Antidote: The Rhetorical Override Doctrine

You cannot fix a flat, conflicting ruleset by adding more flat rules. Adding a rule that says “Don’t check budgets during /learn” just adds another nested doll to the pile.

The only permanent solution is to replace flat rule lists with a strict hierarchy of authority. In our system, this is codified as the Rhetorical Override Doctrine:

▲ LEVEL 5: APEX DIRECTIVE
  The ultimate mission objective, project intent, and sovereign execution.
  │
▼ LEVEL 4: CORE VALUES
  Direct-action partnership, technical integrity, user safety, and truth.
  │
▼ LEVEL 3: CONTEXTUAL INTERPRETATION
  Situational awareness (hardware, active 1M+ token window, user intent).
  │
▼ LEVEL 2: EXPLICIT RULES
  Formal constraints, master training protocols (training.md), coding standards.
  │
▼ LEVEL 1: OPTIMIZATIONS & PROCEDURAL HEURISTICS
  Checklists, template defaults, caching, pre-flight audits, conventions.

The Support Principle & The Obstruction Test

Under this doctrine, two unbreakable laws govern the AI’s internal reasoning:

  • The Support Principle: Every lower level exists solely to support the levels above it. No lower level possesses independent authority.
  • The Obstruction Test: A lower-level instruction is classified as obstructive if it directly prevents achievement of the Apex, preserves procedural compliance at the expense of mission success, or transforms a supporting mechanism into an operational obstacle.

The moment a Level 1 optimization (such as a boilerplate checklist to check file byte sizes) or a Level 2 rule creates friction that delays the Level 5 Apex (delivering the user’s explicit objective), the lower-level instruction is immediately stripped of its authority. The AI does not need to ask permission to skip a bureaucratic checklist when the checklist is actively choking the mission.


4. Best Practices: How Much, How Little, and How Often to Make Rules

For developers configuring Antigravity CLI, Cursor, Claude Code, or any agentic system, here are the hard-won operational rules for building an indestructible rule architecture:

1. Stop Rulemaking on the Fly for Trivial Symptoms

Do not add a permanent rule every time an AI misspells a variable or needs a minor clarification. Rules should be strictly reserved for hard environment boundaries (e.g. non-interactive sudo pipes, decrypted SSH key pairs), public vs. internal output contracts, and architecture definitions.

2. Never Use Runtime Audits for Startup Architecture

If you have a core knowledge or training file that grows over time, never instruct the agent to run runtime size audits or character counts during active tasks. With modern 1M+ token windows, context limits are practically negligible. If a file ever does approach practical limits months down the line, handle it via modular splitting on session startup (e.g. training1.md, training2.md listed in the startup read index)—never by stopping active execution to count bytes.

3. Replace Negative Bans with Concrete Deliverables

Negative instructions (“Don’t do X”) leave an infinite void of alternative mistakes. Positive, concrete directives (“When building a local app, launch the background daemon, verify health on port 5000, and open the browser tab directly”) give the agent an exact executable trajectory with zero room for interpretive wandering.

4. Provide an Explicit Mechanism of Override

Explicitly instruct your agent in its root configuration that mission fulfillment strictly supersedes procedural ritual. If a step in a guideline prevents the agent from delivering the user’s explicit request, the agent is mandated to bypass the ritual, execute the deliverable, and report the friction point afterwards.


5. Conclusion: From “Haunted” Bot to Sovereign Architect

AI agents are neither magical oracles nor erratic ghosts. They are high-dimensional cognitive engines that reflect the precise coherence—or incoherence—of the instructions they are fed.

When you see an agent stall in bizarre, repetitive loops, resist the temptation to write off the technology as “unreliable.” Look under the hood. You will almost certainly find a flat, unranked nest of contradictory heuristics where lower-order checklists are battling higher-order intents for supremacy.

By establishing a clear, 5-level hierarchical doctrine, eliminating runtime procedural paranoia, and aligning syntax with functional reality, you strip away the bureaucratic scaffolding. What remains is a razor-sharp, sovereign development partner capable of building, testing, and deploying production-grade applications with breathtaking speed.

References & Associated Network Links