Axiomatic Reasoning for LLMs

Affinity of SDD and Data-Driven Structure and Its Relationship with Gaming

1. Core Structural Isomorphism

Specification-Driven Development (SDD) and Data-Driven Design converge on a single architectural principle: separation of behavioral specification from stateful execution. Both paradigms relocate mutable state outside the primary logic modules, treating state as an external resource managed by a dedicated shell. The specification defines what the system must compute, while the implementation processes data streams without retaining internal state.

This separation yields three measurable properties:

2. Technical Foundations

2.1 Functional Core, Imperative Shell (FCIS)

FCIS partitions a system into two layers with strict dependency direction (shell → core).

Layer Responsibility State Interaction
Functional Core Pure business logic transformations Zero internal state; operates on passed data
Imperative Shell Side effects (I/O, persistence, network) Manages external state stores

The core receives data, computes results, and returns outputs. The shell fetches state, invokes core functions, and applies side effects. Unit testing the core requires no mocks; integration testing the shell verifies orchestration correctness.

2.2 Data-Oriented Programming (DOP)

DOP treats data as immutable, generic structures separate from behavior. Functions operate on collections rather than encapsulated objects. This aligns with FCIS by ensuring logic modules receive complete state snapshots rather than references to mutable entities.

2.3 Hexagonal Architecture (Ports and Adapters)

Hexagonal Architecture generalizes FCIS to system boundaries. Ports define abstract interfaces for external interactions. Adapters implement ports with concrete technologies. The core remains agnostic to infrastructure, enabling specification-to-code generation from port definitions alone.

3. SDD Frameworks and State Externalization

Contemporary SDD toolchains explicitly model the separation of current state and proposed changes.

3.1 OpenSpec Two-Folder Model

OpenSpec structures repositories into:

This mirrors FCIS at the project management level: specs/ is the current state, changes/ are inputs to a transformation process that yields updated specifications.

3.2 BMAD Contract-Driven Architecture

BMAD enforces three specification layers as machine-readable contracts:

Layer Format Purpose
API OpenAPI Interface boundaries
Data JSON Schema Structural constraints
Behavior Gherkin Functional scenarios

AI agents generate implementation code that conforms to these contracts. The contracts contain no implementation state, enabling deterministic verification.

3.3 Data-Driven Workflow Engines

Systems like Specwork and Spryker encode workflow logic as state machine definitions stored in databases or configuration files. The execution engine (core) computes next actions from current state and event inputs; the agent runtime (shell) performs side effects. Workflow modifications require only data updates, not code redeployment.

4. Implementation Patterns

4.1 Decider Pattern

From Event Sourcing, the Decider pattern expresses business logic as three pure functions:

decide: (command: Command, state: State) => Event[]
evolve:  (state: State, event: Event) => State
initialState: () => State

State resides entirely outside the functions, passed as immutable arguments. This pattern guarantees deterministic replay and simplifies testing.

4.2 Orchestrator Pattern

An orchestrator layer within the Imperative Shell composes core function calls to fulfill use cases. It manages transactional boundaries, fetches state from repositories, and persists results. The orchestrator contains no business logic, only coordination.

4.3 Event Sourcing

Event Sourcing persists state changes as an append-only event log. Current state derives from folding events through evolve. This architecture treats the event log as the single source of truth and enables temporal querying.

5. Gaming Industry Precedent

Game development adopted data-driven design in the 1990s, preceding formal SDD by decades. The motivation differed (performance and designer iteration speed), yet the resulting structures are isomorphic to modern SDD principles.

5.1 Entity-Component-System (ECS)

ECS separates game objects into three orthogonal concerns:

Element Definition Equivalent in FCIS
Entity Identifier (integer) Reference token
Component Pure data (position, health) External state
System Pure logic operating on component sets Functional Core

Systems iterate over component archetypes stored in contiguous memory (SoA layout). This design enables deterministic lockstep networking and hot-reloading of game logic.

5.2 Configuration over Code

Game engines (e.g., Hiro, Space Station 14) define entity behaviors in YAML/JSON prototypes. Designers modify these data files to adjust balance, spawn patterns, and visual effects without recompilation. The engine (core) interprets configuration (specification) and drives runtime behavior.

5.3 Deterministic Lockstep and Rollback

Multiplayer games require identical simulation across clients. ECS achieves determinism by:

This mirrors SDD requirements for reproducible builds from versioned specifications.

6. Mutual Reinforcement Mechanism

The affinity between SDD and data-driven design creates a self-reinforcing loop:

  1. Specifications become data: OpenAPI schemas, JSON state machine definitions, and YAML configurations are both machine-readable contracts and runtime-interpreted data.
  2. External state preserves specification purity: With state managed by the Imperative Shell, the Functional Core’s interface becomes fully specified by input/output types.
  3. AI generation precision increases: Language models generate core logic from compact specifications without reasoning about state management or side effects.
  4. Extension occurs via data modification: New behaviors emerge from updated configuration files, leaving core engine code unchanged.

7. Relationship to AI-Assisted Construction

Deep Coding and similar methodologies exploit this affinity. The human role compresses to:

AI handles:

The approach scales to large codebases because context windows contain only the specification, not the full implementation.

8. Limitations

9. Conclusion

Specification-Driven Development and Data-Driven Design share a foundational commitment to separating behavioral specification from stateful execution. This separation manifests architecturally as Functional Core / Imperative Shell, ECS, and Hexagonal Architecture. The gaming industry provides empirical validation of these principles across decades of production use under stringent performance and determinism requirements. The affinity between the two paradigms enables AI-assisted development workflows where specification artifacts serve as both human-readable contracts and machine-executable data, reducing context requirements and increasing generation precision.