Freshware · Interactive Workbook
MDX Source Edition Residual Systems & Verified Compilation Learning Center & Videos
Part I–II · Develop & Align · Chapter 01

Developing Constraints: Alignment, Ubiquitous Language, and Examples

Why making code generation cheap shifts the entire engineering bottleneck upstream to alignment, shared naming, and executable examples.

Reading time: 9 min Interactive: Pre-Build Alignment Checklist Source: src/content/chapters/01-develop-and-align.mdx

When code generation drops toward zero cost and minutes per pull request, software teams discover an uncomfortable asymmetry: writing code was never the hardest part of building software.

Maggie Appleton named this failure mode “Zero Alignment.” Before coding agents, implementation moved slowly enough that teams naturally accumulated alignment through the middle of a project — hallway debates, issue threads, draft reviews, and senior engineers questioning edge cases while typing. Once agents collapse the middle from weeks into minutes, the engineering graph mutates into:

weak alignment  --->  near-instant build  --->  overloaded verification

The pull request becomes the place where teams discover they never agreed on what a “Canonical Bill” was, whether credits negate line totals, or which locations share an account map. A PR diff is far too late in the lifecycle to discover domain misunderstandings.

Domain-Driven Design as Semantic Compression

Eric Evans introduced Domain-Driven Design (DDD) to stop software engineers and business operators from talking past each other. Two DDD primitives turn out to be even more valuable when coding agents enter the room:

  1. Ubiquitous Language (CONTEXT.md): Naming every core concept consistently across plain-English operator playbooks, spec packs, TypeScript interfaces, and SQLite tables is not pedantic bureaucracy — it is prompt compression. When a human and an agent both mean the exact same entity by Golden Pin, Canonical Bill, and Settlement Batch, ambiguity evaporates and token overhead plunges.
  2. Bounded Contexts and Anti-Corruption Layers (ACLs): An accounting core should never care how a beverage distributor draws its PDF table or what field names an external ledger REST API prefers this quarter. Placing an Anti-Corruption Layer at the context edge turns messy external drift into an isolated mapping problem.

Behavior-Driven Development Without the Glue Tax

Dan North and Gojko Adzic’s Behavior-Driven Development (BDD) and Specification by Example solved a crucial insight: abstract requirements hide edge cases, whereas concrete input/output examples expose them immediately.

Where classic BDD struggled was the glue-code tax. Maintaining brittle regular-expression step definitions across thousands of Gherkin feature files often cost more than maintaining the production application itself.

Freshware keeps BDD’s core strength — concrete, human-readable examples — while discarding the fragile step-runner machinery:

  • Operators document real edge cases directly inside plain-English playbooks accompanied by annotated example inputs.
  • Engineers freeze historical ground-truth input/output pairs as Golden Pins.
  • Verification compares compiled behavior directly against those frozen examples in zero-side-effect dry runs.

The Pre-Build Constraint Development Loop

Matt Pocock’s alignment skills workflow translates these ideas into a concrete discipline any engineer or agent harness can execute before writing production modules:

  1. Map Foggy Work (/wayfinder): When a request is still a weather system (“automate multi-venue invoice intake”), do not write implementation code. Generate investigation tickets to inspect real failure logs, upstream rate limits, and boundary edge cases first.
  2. Interrogate Decisions (/grill-with-docs): Force the agent to read existing architecture records and CONTEXT.md, resolve every discoverable fact autonomously, and ask one human decision question at a time until ambiguous behavior is pinned down.
  3. Freeze the Destination (/to-spec): Distill the resolved conversation into intent, invariants, seams, and explicit non-goals.
  4. Slice Safely (/to-tickets): Break wide migrations into dependency-ordered vertical slices or expand-contract phases so tests stay green at every step.

Lauren Tan’s Enforcement Ladder: Prose Last

Once a team develops constraints through grilling and examples, a fatal trap awaits: dumping 300 prose rules into a giant instruction file (AGENTS.md). As Lauren Tan and Steve Yegge observed, agents copy patterns they see in nearby code far more strongly than they obey negative prose lists, and contradictory instructions induce “overfencing” hesitation.

Freshware pushes every developed constraint as far down the Enforcement Ladder as possible:

Enforcement RungMechanismExample ConstraintReliability
1. Types & API BoundariesCompiler makes invalid states unrepresentableBranded Cents integer type; mounted oracle roots marked read-only at tool boundaryHighest (enforced at build/call)
2. Static & Formal ChecksCustom AST linters, schema checks, TLA+ /statechartVerify no bill transitions directly from failed to synced without verifiedHigh (zero-cost pre-merge gate)
3. Behavioral Dry-RunsGolden Pins & brownfield oracles (chmod a-w)Replay 24 historical supplier invoices with zero ledger mutationsHigh (proves semantic equivalence)
4. Prose Rules (Last Resort)Short docs/specs/ & AGENTS.md“Ask a human before amending regional beverage container deposit rules”Reserve strictly for human judgment

Jarred Sumner’s lesson from building an ahead-of-time JavaScript compiler underscores why Rung 3 matters most: “As soon as you rewrite the tests, you can no longer trust the verification oracle.” Whenever possible, keep existing Golden Pins and brownfield regression suites strictly read-only to the agent rewriting the implementation.

With language, boundaries, and examples aligned, the next question is physical rather than linguistic: how do we test whether those Bounded Contexts actually survive chaotic real-world shocks?