1. The principle
The LLM builds. Code runs. A model is extraordinary at turning intent into code, and expensive, slow and variable when it is asked the same routine question a million times. The Compile-Once Architecture moves the model to the one place it is strongest, writing and testing programs, and keeps it out of the path of routine work.
Three consequences follow. Routine answers become deterministic: the same input gives the same answer. Cost per call falls to the cost of running ordinary code. And every automated function has an owner, a version, tests and a readable rule, which is what auditors, regulators and boards ask for.
2. The five parts
2.1 Data Sphere
A bounded domain of an organisation's data, such as Claims, Payments or Patients, reached only through a contract. The contract holds a connection reference to the source systems, a schema, data-quality rules, access rules and the owners. Source systems stay where they are; spheres are views with rules, kept fresh as data flows in. A capsule may read only the sphere it is bound to, and data is not copied across spheres.
2.2 The Forge
The build environment, and the only place a model runs. It receives a request in plain language against one sphere, reads that sphere's contract, drafts a program, drafts tests (golden cases, edge cases and permission cases), runs them in a sandbox, checks the program's data access against the contract and presents the result to a named owner for approval. The Forge also regenerates capsules when a rule or a contract changes.
2.3 Capsule
One business function as a small, sealed, deterministic program bound to one sphere: a lookup, a rules check, a calculation, a match, a monitor or an extraction. A capsule ships with a manifest stating what it does, which sphere and contract version it reads, its inputs and outputs, its tests, its owner, its version and that it makes no model calls at run time. Where a task needs perception (reading a scanned form, classifying an image), a capsule may wrap a small, local, versioned model, declared in the manifest and tested like everything else.
2.4 Capsule Exchange
The organisation's internal catalogue of capsules: an app store for business functions. Teams discover and install capsules instead of raising tickets. Every listing shows the owner, version, tests, usage and dependencies, so duplicates are visible and unused capsules can be retired.
2.5 Constellation
A composition of capsules across spheres that completes a bigger job, such as triaging a first notice of loss or clearing a cross-border payment. The Forge writes the composition and its tests once. Each run is plain code that calls the capsules in order, records every step, and hands decisions that need judgement to a person.
3. Lifecycle
- Request. A person states a need in plain language against one sphere.
- Forge. The model drafts the program and its tests from the sphere's contract.
- Prove. Tests run in a sandbox; data access is checked; a named owner approves.
- Publish. The capsule and its manifest enter the Exchange with a version.
- Run. Ordinary code serves every call, with logs and metrics.
- Observe. Usage, failures, latency and drift are visible per capsule.
- Change. A new rule or a new contract version triggers regeneration and retesting; the previous version stays available for rollback.
- Retire. Capsules without an owner or without usage are retired from the Exchange.
4. Run-time properties
- Deterministic: the same input gives the same answer, which makes results reproducible and explainable.
- No model calls: routine work does not send records to a model, which reduces cost, latency and data exposure. Declared small local models are the only exception.
- Fast and cheap: milliseconds per call at the cost of ordinary compute.
- Bounded: each capsule reads one sphere through its contract and nothing else.
- Portable: many capsules can run on premises, at the edge or offline.
5. Governance
Every capsule has a named owner, a manifest, tests that must pass before every deployment, a version history and a rollback path. Every constellation records its steps and the point where a person decides. Contracts are versioned; a contract change is a controlled event that triggers regeneration of the capsules bound to it. The Exchange is the inventory of automated functions, which gives risk, audit and compliance teams one place to look.
The architecture does not by itself make an organisation compliant with any law or standard. It makes the evidence easier to produce: what each automated function does, what data it uses, who approved it and whether its behaviour can be reproduced.
6. Where it fits, and where it doesn't
Before any automated request, ask which of three tools it needs:
- A program when the answer follows rules from known data: eligibility, limits, matching, calculations, monitoring. Build a capsule.
- Search when the answer is a passage that already exists in documents. Show the source; don't paraphrase it.
- A model when the question is open, the language is messy or judgement is involved: explaining a complaint, drafting a reply, summarising a case. Route it to a model on purpose, with a person accountable for the outcome.
Most volume in large organisations is routine, which is why the first category is usually the largest.
7. Maturity model
Prompts everywhere
Models answer routine questions directly; no owners, no tests, costs grow with usage.
First Forge
One team uses a model to generate and test programs for its own backlog.
Contracts
The first Data Spheres have versioned contracts; capsules are bound to them.
Exchange
Capsules are listed, owned and installed across departments; tickets for routine functions fall.
Constellations
End-to-end jobs run as composed capsules, with people at defined decision points.
Group scale
Capsules are reused across business units and countries; acquired companies are mapped to existing contracts and gain the catalogue quickly.
8. Anti-patterns
- Model creep: a model call slips back into a capsule's run path "just for this edge case". Declare it, test it, or route the case to a person.
- Sphere bypass: a capsule reads a source system directly instead of through the contract.
- Orphan capsules: capsules without an owner keep running. Retire them.
- Catalogue sprawl: near-duplicate capsules multiply. Merge them using usage data.
- Untested regeneration: a contract changes and capsules are regenerated without the old tests passing.
- Rubber-stamp approval: owners approve without reading tests. Make the review small and specific.
9. Glossary
- Contract: the versioned definition of a sphere: connection reference, schema, rules, access, owners.
- Manifest: the document that ships with a capsule: purpose, sphere, inputs, outputs, tests, owner, version, run-time model use.
- Regeneration: rebuilding a capsule through the Forge after a rule or contract change, followed by the full test suite.
- Decision point: the step in a constellation where a person decides.
10. Credit, licence and citation
The Compile-Once Enterprise is a concept and architecture by Muthukumar Subramanian. This text is published under CC BY 4.0: you may share and adapt it with attribution. The specification schemas and code are under the MIT licence.
Cite as: Subramanian, M. (2026). The Compile-Once Enterprise: an architecture for the agent era (v0.1). https://muthu4all.github.io/compile-once-enterprise/