Skip to content
Hrushiekesh Reddy Kanjula
An AI agent operating under a governance constitution with strict role boundaries and immutability constraints

Governing AI Agents: Why Your LLM Needs a Constitution

An unconstrained LLM in my codebase wrote 847 lines and refactored three modules I never mentioned, so I wrote it a constitution.

Published
May 18, 2026
Author
Hrushiekesh Reddy Kanjula
Read time
~4 min
Category
essay

Multi-agent AI governance: Architect and Worker role hierarchy with constitutional constraints

I gave an LLM unconstrained access to the assembly hub codebase and asked it to "implement the BOM normalization improvements we discussed." In under 3 minutes it produced 847 lines of code across 11 files. Some of it was good. A significant part was subtly wrong, and it took two hours of debugging to see how. It had also "refactored" three unrelated modules because it decided they were "inconsistent with the new patterns."

I never asked it to touch those modules. It did because they were there, and nothing told it not to.

That is the governance problem with multi-agent AI development. LLMs are fast and capable. They are also confidently wrong in ways that are hard to spot without deep context. Without explicit constraints, they create entropy that engineers then spend their time reversing.

The fix in the assembly hub is a governance constitution. It is a structured system prompt that defines what agents may and may not do. It has four parts.

Architect and Worker

First, planning is separated from execution. The constitution defines two roles with no overlap.

The Architect can read the whole codebase and does one thing: produce an Implementation Plan. It may not write code blocks longer than 20 lines. The plan lists which files change, which functions are added or changed, the dependency implications, and the expected behavior change. Nothing more.

The Worker takes the plan and executes it. It may not "improve" unrelated code, refactor adjacent modules, or add features the plan does not name.

This fixes what burned me. An unconstrained agent is Architect and Worker at once. It makes architectural decisions while it is typing, with no planning step to expose what they imply. Two roles force that reasoning into a document someone can review before any code exists.

Architect/Worker role separation: planning phase and execution phase as distinct agent modes

Immutable files

Second, some files are immutable. No agent may modify them without explicit human authorization. In the assembly hub that list is:

  • The SQLite schema migration files. A bad schema change is catastrophic and irreversible without data loss.
  • The Eel WebSocket initialization module. Threading bugs here are subtle and break the whole UI.
  • The normalization engine's core regex battery. Changes here affect 20,000 component records.

If a plan touches one of these files, the agent flags it, explains why, and waits for approval. It does not just do it.

This catches the case where an agent "helpfully" solves a problem by editing a foundational module and causes a regression somewhere unrelated.

Scope confinement

Third, every session starts with a declared scope: the files and modules the agent may read and modify. Anything outside it needs explicit escalation. A session opens with a preamble like this:

SCOPE: components/normalization/regex_engine.py, 
       components/normalization/family_profiles.py
PERMITTED OPERATIONS: modify, test
FORBIDDEN: cross-file refactors, schema changes, UI modifications
PLAN REQUIRED: yes, before any code generation

The scope is more than documentation. It sits in the system prompt, and the agent checks it when deciding whether an action is in bounds.

Scope confinement: agent session with explicit file permissions and operation boundaries

The context archive

Fourth, agents lose context between sessions. A new session has no memory of the last one. Agents re-discover the same constraints, repeat the same reasoning, and sometimes reverse decisions that were made on purpose.

CONTEXT_ARCHIVE.md is the answer. It is a running log of significant architectural decisions, with why each was made and which alternatives were rejected. Before a session starts, the relevant sections go into the system prompt.

An agent working on the normalization engine today can read the reasoning behind that engine from six months ago. It does not remember the session. The decision was written down in a form that fits in its context window.

Why it is infrastructure

The framework costs time up front. Writing the constitution, maintaining the archive, and forcing a plan before execution all add to each cycle. Engineers who have not seen the alternative sometimes push back on that.

I think of it as infrastructure, not overhead. It is what keeps AI development sustainable on a codebase with real production stakes.

Governance as development infrastructure: constitution, context archive, scope confinement working together

The assembly hub has been under AI-assisted development for over a year with this framework. In that time there has not been a single agent-introduced regression that took more than 20 minutes to find and reverse. Before the framework, that kind of regression happened every other week.

Debugging confident mistakes is a hidden tax. Over a year it is the difference between a codebase I trust and one that scares me.

Hire me