Menu
Dev.to #architecture·June 4, 2026

Governance Models for AI Coding Agents: City-State vs. Federation Architectures

This article compares two distinct architectural governance models for AI coding agents: the 'city-state' (dgov) and the 'federation' (author's stack). It highlights their contrasting metaphors (legal vs. scientific audit), how they approach plan definition and execution, and their respective strengths in areas like claim-versus-reality settlement and multi-repository policy enforcement. The comparison reveals convergent evolution in mechanisms like declarative task units, fail-closed validation, and forwarded failure memory, pointing to core architectural principles for agent systems.

Read original on Dev.to #architecture

Two Architectures for AI Coding Agent Governance

The article delves into two distinct governance architectures for AI coding agents, developed independently by different teams: dgov and the author's own stack. Both systems aim to orchestrate AI agents for code generation and review but employ different fundamental metaphors and architectural philosophies, leading to complementary strengths and weaknesses. dgov uses a legal metaphor, focusing on a 'constitution' with strict enforcement, while the author's stack uses a scientific audit metaphor, emphasizing claims, refutation, and evidence.

The City-State Model: dgov's Deterministic Kernel

dgov, described as a 'deterministic kernel for multi-agent orchestration via git worktrees,' embodies a 'city-state' model. Its architecture centers around a single repository with a local governor. Key architectural features include:

  • Legal Metaphor: Utilizes concepts like a 'governor charter,' 'standard operating procedures as statute,' 'case law' (append-only ledger entries), and 'ConstitutionalViolation' error types.
  • Plan as Directly Dispatchable TOML: Plans are TOML trees compiled to a DAG, with each task containing prompts, file claims (create, edit, read), dependencies, test commands, roles, and iteration budgets. Compilation is fail-closed.
  • Merciless Claim-vs-Reality Settlement: At settlement, dgov rigorously diffs actual worktree changes against declared file claims. Unclaimed paths or reads outside scope reject merges. This is a critical strength for ensuring agent adherence to declared intentions.
  • Semantic Settlement Layer: Performs AST-level analysis of integration candidates (e.g., text conflicts, concurrent edits, signature drift) before merging, with a detailed failure taxonomy.
  • Pure Function Kernel: The kernel is a pure function from state and event to new state, event-sourced to SQLite, ensuring deterministic and replayable runs.

The Federation Model: Author's Audit Stack

The author's stack adopts a 'federation' model, designed for broader, multi-repository governance. Its philosophy is rooted in scientific audit and refutation. Key architectural distinctions include:

  • Scientific Audit Metaphor: Plans are 'claims' that validators attempt to 'refute.' Completion requires 'evidence' and a control plane evaluates policies across many repositories.
  • Plan as Reviewable Artefact: Plans contain contracts (acceptance criteria, constraints, failure modes, artifacts) but no prompts. They are designed to be *refuted* (e.g., critical path calculation, artifact ownership) before execution.
  • Decentralized Review: Leverages multiple independent reviewers (different LLMs) to productively disagree, a core design principle.
  • Multi-Repository Control Plane: Designed for policy packs and requirement profiles applied across a fleet of repositories, providing a federation layer that dgov lacks.
  • Symbol-Granularity Claim-vs-Reality: While not integrated into the plan runtime yet, a separate version-control layer records symbols touched in each episode, providing finer-grained claim-vs-reality binding than dgov's file granularity.

Convergent Evolution and Key Takeaways

Despite their differences, both systems independently arrived at several core mechanisms, suggesting these are fundamental architectural components for AI agent governance:

  • Declarative task units with explicit dependencies
  • File claims per task as a precondition for safe parallelism
  • Fail-closed validation before execution
  • Topological ordering of tasks
  • Per-task verification commands
  • An append-only event history
  • Failure memory carried forward into future attempts
💡

Architectural Lesson

The article highlights that when independent builders converge on similar mechanisms, these mechanisms likely represent essential solutions to inherent problems in the domain. For AI coding agent governance, features like file claims, fail-closed gates, and forwarded failure memory appear to be critical architectural pillars.

AI agentsgovernanceorchestrationsystem architecturesoftware engineeringdistributed systemsautomationLLM development

Comments

Loading comments...