Introduction
Friday, 4:03 PM.
An AI code assistant opens a pull request: “Add pagination to
GET /api/users.”
The diff looks reasonable. CI passes. You merge it.
Saturday morning, your mobile app is down. The assistant introduced a
contract drift: limit became a string in one place and an
integer everywhere else. Your type checker never saw it, because the
mismatch lived in a JSON surface.
Three engineers spend the weekend rolling back and rebuilding confidence.
--- a/openapi.json
+++ b/openapi.json
@@ -312,7 +312,7 @@
"limit": {
- "type": "integer"
+ "type": "string"
}Now the same scenario, but with Software Development as Code (SDaC).
The assistant proposes the same change. This time, the gate runs before merge.
$ make validate-api-change
Schema validation FAILED: /api/users - 'limit' must be integer, got string
Blocking merge.The CI gate catches it in 8 seconds. Nobody’s weekend is ruined. That’s the difference.
SDaC is Control Theory applied to stochastic generation. It pivots the industry conversation from tweaking instructions to Context Architecture: structured context, deterministic gates, and verifiable loops that you can debug. The goal is not a smarter assistant. The goal is a safer process.
SDaC shifts your work from typing syntax to shaping changes: scoping the work, defining constraints, and reviewing small diffs that are already bounded by validators. Review throughput becomes the bottleneck, so the system must keep diffs small and scoped.
At its core, SDaC treats every artifact as code: it lives in version control, and changes arrive as diffs. Every diff is gated by deterministic validators before it becomes real.
This book will equip you to engineer systems where automated Effectors reliably enhance your codebase. You’ll learn to build an initial, verifiable loop, understand the principles that make it robust, and then scale and govern it to ensure safety and auditability in production.
Start reading Friday, ship it Monday.
Who this book is for
This book is for senior engineers and platform architects who want mechanisms, not hype: deterministic context, hard gates, and auditable loops that survive production. It is for people shipping GenAI systems and discovering that ad-hoc instructions do not scale.
If you want to build immediately, start with Part I. It gives you a working loop first, then we earn the theory by explaining why it works.
SDaC Quickstart (Read this first)
This book is not about using AI inside CI. It’s about turning the software development lifecycle (SDLC) itself into a compiled artifact — Software Development as Code.
CI compiles the program. SDaC compiles the development of the program.
Why now (economics)
SDaC becomes practical once the economics of automation change. Foundation code that used to be prohibitively expensive to write and maintain—schemas, extractors, validators, runners—can now be generated and iterated cheaply under strict contracts.
In parallel, models can take on SDLC tasks that were historically human-bound because they were primarily linguistic (planning decomposition, review summarization, heuristic classification, doc drafting).
Models reduce scaffolding cost, but governance and review remain the irreducible cost.
Scrum, Waterfall, Kanban, and every other process are ultimately control loops: they define how work is selected, shaped into units, executed, inspected, and fed back into the next decision. The difference is that these loops are usually enforced by meetings, rituals, and social contracts.
SDaC compiles the loop itself into executable artifacts: Sensors choose work, Effectors produce candidate diffs, Validators score evidence, and governance gates control what is admitted to the codebase.
The category (for skeptics)
CI is a gate on artifacts humans already produced. SDaC is the claim that the production of those artifacts becomes versioned, executable, reviewable code: code, tests, docs, plans, reviews, releases, and even the workflow itself.
A useful ladder:
- Code: the product.
- CI: automate checks on submitted code
(
build/test/lint). - CD / Infrastructure as Code: automate shipping and environments.
- Process as Code: encode how work happens (policies, checklists, required evidence).
- Engineering as Code: orchestrate the SDLC as an executable system (Effectors + Validators + Ledger + Governance).
- Self-evolving system (optional): the process layer can change itself — but only through controlled, audited pathways (Immutable Infrastructure + gates).
In SDaC terms, CI becomes one Validator inside a broader machine.
The litmus test
If someone says “this is just CI,” ask:
- Can you recreate the team’s engineering behavior (planning → implementation → review → tests → release → postmortem → docs) from the repo + compute?
- Are the rules (contracts, validators, policies, merge criteria, risk thresholds) first-class, versioned, and enforceable?
- Is the model an assistant, or an Effector inside a constrained machine?
If the answer is “no, humans are still the engine,” it’s CI-adjacent automation. If “yes, humans are operators of an executable system,” that’s SDaC.
Start here (one loop, one gate)
Go to Chapter 1 and run MVF v0 (“Quick Bootstrap”). Run
make all. You should see a small diff and a deterministic
PASS/FAIL gate.
Minimum vocabulary for the first pass:
- Terrain: what runs.
- Map: a versioned intent surface derived from Terrain.
- Ledger: evidence (diffs + validator output).
- Sensor: read-only measurement that emits structured signals and targets.
- Effector: proposes a patch.
- Validator: returns
PASS/FAIL. - Loop: Effector → Validator → commit only if PASS.
The Compiler’s Manifesto
Software Development as Code
Central Dogma
Quickstart defines the category. This manifesto defines the stances.
- We do not optimize for “smart” models; we optimize for converging systems.
AI is a stochastic engine. We do not negotiate with it. We constrain it.
A GenAI system works in production when three things hold at once:
It carries a clear Mission Object—durable intent and constraints teams can name, version, and test.
It resists entropy as models, data, and people change.
It adapts through a repeatable ratchet of feedback and revision, not heroic one-off instructions.
When any of these slip, you get demo-ware: great on stage, unpredictable in production. SDaC keeps intent intact by designing the Context Architecture, wiring Effectors into small Pipelines, and wrapping everything in an Immune System.
You can keep the whole system in your head as one chain:
Mission Object (Map) → Context Architecture → Effectors → Immune System → Ouroboros Protocol
If you only learn one skill from this book, make it this: turn intent into artifacts you can diff and validate.
The Meta-Patterns
These are the stances that make the mechanisms compose.
1) Don’t Chat, Compile
Chat is for ideation. Production work is an artifact you can version
and rerun: a Mission Object (YAML/JSON) plus a deterministic runner
(make, scripts) that produces a diff and a Decision
Trace.
Rule: if it isn’t in a file, it isn’t an instruction. It’s just a vibe.
2) Physics is Law
If a change fails Physics, it does not exist. Physics is binary and fast: schemas, linters, tests, and architectural constraints (dependency direction, protected surfaces).
If you allow “just this once” exceptions, autonomy will scale the exception faster than you can review it.
3) Recursion
The same gates apply to human and automated changes. Scheduled maintenance turns entropy signals into Missions and runs them through the same Validators. No privileged mode.
The Goal
Build a factory where intent (the Map) is systematically converted into reality (the Terrain) through verifiable loops (the Ouroboros Protocol) guarded by hard constraints (the Immune System) and recorded in an immutable Ledger, with a Decision Trace that explains why each diff exists.
- If it cannot be verified, it does not ship.
- If it cannot be reproduced, it does not exist.
Where the concepts live (don’t memorize)
You don’t need to swallow the full canon up front. The terms are introduced where they become useful:
- Chapter 1: Map, Terrain, Ledger, Effector, Validator (MVF v0: a loop you can run).
- Chapter 2: The Deterministic Sandwich (Prep → Model → Validation).
- Chapter 3: Validators → Immune System (Physics you can enforce).
- Chapter 4: Stochastic Drift (measure it, budget it, reduce it).
- Chapter 5: The Ouroboros Protocol + Attractors + circuit breakers (debug convergence).
- Chapter 6: Context Architecture + Context Graph + Branching Factor + Skeleton-First Rule (slice deterministically).
- Chapters 7–9: Mission Objects, Map-Updaters, Dream (scale the loop into a system).
- Chapters 10–12: Immutable Infrastructure + governance at machine speed (protect graders and blast radius).
- Chapter 13: Hofstadter Bridge (optional limit case).
- Appendix D: glossary + translation guide.
The Oath
We buy down uncertainty with constraints, logs, and tests. We treat language as a contract. We do not ship vibes. We ship verifiable state.
We do not trust the model. We trust the loop.
Start Friday. Ship it Monday.
A Guided Ascent (Don’t Memorize This)
You do not need to memorize the canon up front. The terms arrive in the order you need them.
| Where you are | What you do | Canon terms that matter |
|---|---|---|
| Introduction | Adopt the mental model | Mission Object, Map/Terrain, Stochastic Drift, Context Architecture |
| Part I | Build a working loop | spec / generator / checker → Map / Terrain / Ledger, Effector, Validator |
| Part II | Understand why it works | Stochastic Drift, Ouroboros Protocol, Circuit Breakers, Context Graph |
| Part III–IV | Scale and govern safely | Mission Object, Judge, Adaptation State Machine, Map-Updaters, Immutable Infrastructure |
| Part V | Optional limit cases | Hofstadter Bridge |
If you want a dependency graph and a week-by-week build ladder, jump to Appendix A.
The Canon of Truth
In any automated system that modifies itself, establishing a clear hierarchy of truth—what we call the “canon”—is paramount. Without it, an AI could update documentation that contradicts code, or vice versa, leading to subtle, undetectable drift. SDaC introduces a tiered canon, where each tier represents a different level of authority and deterministic verifiability.
Changes here ripple to lower tiers. The “physics” of your
system. | | Tier 2 | Structured Configuration, Domain
Models, README.md | Derived, but
Authoritative. Human-readable, but often machine-checked
against Tier 1. Defines intent. | | Tier 3 |
General Documentation, UI Text, Release Notes | Derived,
Non-Authoritative. Needs to be consistent with higher tiers,
but doesn’t dictate them. Explains the system. |
Our goal is to ensure that any AI-generated change, particularly in lower tiers, is always consistent with and verifiable against the higher, more deterministic tiers. This tiered canon forms the foundation for our deterministic context and validation gates.
A Note on Substrate
While the principles of SDaC are universal, this book uses a
concrete, accessible substrate for its examples: standard files, Git for
version control, make for orchestrating effects, and Python
for scripting. This combination provides a practical, widely understood
environment to demonstrate the core concepts. The patterns and
architectures you’ll learn are designed to be stack-agnostic, easily
portable to other languages, build systems, and VCS platforms. Appendix
C includes validator recipes for other stacks (for example
TypeScript/Node). The focus is on the engineering principles, not the
specific tooling.
Prerequisites (Assumed Knowledge)
This book assumes you’re already comfortable with day-to-day software engineering.
You should be able to:
- Use a terminal and run commands like
make,python3, andgit. - Read a diff and understand what will change before it merges.
- Interpret Validator output (lint errors, schema failures, failing Immune System cases).
- Read and edit plain-text files (Markdown, JSON/YAML, configuration).
You do not need:
- ML theory, model training, or GPU tooling.
- Control theory beyond the intuition we build as we go.
About the author
I’m Jóhann Haukur Gunnarsson, a systems architect and senior software engineer. I’ve built and operated reliability-critical systems, including in finance, where failure modes are not theoretical and audit trails matter.
If you want to continue the conversation, you can reach me at:
- Email: johannhaukur@gmail.com
- LinkedIn: https://www.linkedin.com/in/jhaukur/
I chose the Files/Git/make/Python substrate because it’s
ubiquitous, has no compile step, and exposes deterministic control
surfaces that both Humans and Agents can drive.