Skip to main content

GUPP & NDI

Two foundational principles govern how Gas Town handles the inherent chaos of multi-agent AI coordination: the Gas Town Universal Propulsion Principle (GUPP) and Nondeterministic Idempotence (NDI).


The Gas Town Universal Propulsion Principle (GUPP)

Every operation in Gas Town must move the system forward or leave it unchanged. No operation should move the system backward.

GUPP is the single most important design principle in Gas Town. It means:

  • Crashes cannot lose work. If an agent crashes mid-task, all completed steps are persisted in the molecule. A fresh agent resumes from the last checkpoint via the hook.
  • Retries are safe. Running an operation twice produces the same result as running it once (or advances further).
  • Partial completion is valid. A half-finished convoy is better than no progress at all.
  • State always moves forward. Bead statuses go open → in_progress → done. They never go backward.

GUPP in Practice

Before crash:     load-context [done] → branch-setup [done] → implement [in_progress]
After restart: load-context [done] → branch-setup [done] → implement [in_progress]
↑ resumes here

The molecule tracks step completion in the beads database. When a fresh polecat picks up the work via its hook, it reads the molecule state and continues from exactly where the crashed agent left off.

Why GUPP Matters

Without GUPP, multi-agent systems are fragile. A crash at the wrong moment could:

  • Leave the git worktree in an inconsistent state
  • Lose track of what was already done
  • Cause the next agent to redo expensive work
  • Create merge conflicts from duplicate effort

GUPP eliminates these failure modes by design.


Nondeterministic Idempotence (NDI)

Operations may produce different outputs each time, but the system state after execution is equivalent.

NDI is the practical companion to GUPP. AI agents are inherently nondeterministic — ask Claude to implement the same feature twice and you will get different code. NDI acknowledges this reality and works with it rather than against it.

What NDI Means

  • Same intent, different implementation. Two agents implementing "add input validation" will write different code. Both are valid if they pass tests.
  • Retry safety with variation. If a test step fails and the agent retries, it may fix the problem differently. The molecule only cares that the step reaches done.
  • State equivalence, not bit equality. After running implement, the worktree contains a valid implementation. It does not matter that a retry produced different variable names.

NDI vs. Traditional Idempotence

Traditional IdempotenceNondeterministic Idempotence
f(x) = f(f(x)) alwaysf(x) and g(x) both reach valid end state
Same output every timeDifferent output, equivalent result
Deterministic operationsAcknowledges AI nondeterminism
Exact replayForward-only progress

NDI in Practice

Consider a polecat working on bead gt-a1b2c (add input validation):

Run 1:  Implements validation with Joi library
Tests pass → step marked done

Run 2: (after crash and restart)
Step already marked done → skipped
Agent continues to next step

If the agent had crashed during implementation (before marking done):

Run 1:  Starts implementing with Joi, crashes at 60%
Step still marked in_progress

Run 2: Fresh agent reads step, sees in_progress
Implements with Zod instead (different but valid)
Tests pass → step marked done

The second run produced different code, but the system state (valid implementation, passing tests) is equivalent. This is NDI.


The Nudge Workaround

Sometimes an agent gets stuck — looping on a failed test, unable to resolve a merge conflict, or confused by ambiguous requirements. Gas Town uses nudges as the escape hatch.

What is a Nudge?

A nudge is a synchronous message from a human or higher-level agent that interrupts the current agent's execution with new context or instructions.

# Human nudges a stuck polecat
gt nudge polecat-3 "The test failure is a known flaky test. Skip it with --skip-flaky flag."

# Mayor nudges a witness that's reporting false positives
gt nudge witness-myapp "The API is intentionally returning 503 during migration. Ignore health check failures for 30 minutes."

When to Use Nudges

Nudges are appropriate when:

  • An agent is stuck in a retry loop
  • New information changes the requirements
  • A human wants to steer an agent's approach
  • An upstream dependency was resolved and the agent should retry

Nudges and GUPP

Nudges respect GUPP — they provide new information that enables forward progress, but never instruct an agent to undo completed work. A nudge says "try this approach instead," not "go back and redo what you did."

Nudges and NDI

Nudges are a natural fit for NDI. After a nudge, the agent may take a completely different approach to the current step. The output will differ from what it would have produced without the nudge, but the end state (step completed, tests passing) is equivalent.


GUPP + NDI Together

The two principles work in concert:

ScenarioGUPPNDI
Agent crashes mid-stepCompleted steps preserved, resume from checkpointFresh agent may implement differently
Test failureStep stays in_progress, agent retriesRetry may use different fix strategy
Merge conflictConflict resolution step activatesAgent resolves differently than predecessor would have
Human nudgeSystem moves forward with new contextNew approach produces different but equivalent output
Full restartAll molecule state preserved in beadsNew session continues with its own implementation style

Together, GUPP and NDI make Gas Town resilient to the fundamental unpredictability of AI agents while ensuring that work always progresses toward completion.

How GUPP & NDI Are Implemented

These principles are not just abstract ideals -- they are enforced by specific Gas Town primitives:

PrimitiveGUPP RoleNDI Role
HooksPersist work assignment across crashesFresh agent picks up where predecessor left off
MoleculesTrack step completion as permanent stateSteps marked done are never re-executed, regardless of implementation differences
BeadsForward-only status progressionDifferent agents may close the same bead via different approaches
GatesPause without losing progressGate resolution may trigger different downstream execution
RigsGit worktrees provide durable filesystem stateEach polecat worktree is independent
  • Hooks -- The primary mechanism that makes GUPP possible: hooks persist across all session boundaries
  • Molecules & Formulas -- Molecules implement GUPP through step-level checkpointing in the beads database
  • Beads -- Bead status progression is a direct expression of GUPP's forward-only rule
  • Gates -- Gates enable GUPP-compliant async waits: the system pauses without losing state
  • The MEOW Stack -- GUPP and NDI apply at every layer of the MEOW abstraction model