Harness Engineering: Keeping AI-Generated Code Correct and Coherent
Harness engineering is the practice of surrounding AI-assisted code generation with deterministic tooling, agent-based review, and periodic entropy checks to keep AI-generated code correct and coherent over time. Originating from Birgitta Boeckeler's article on martinfowler.com, the concept adapts the test harness idea to enforce not just functional correctness but also architectural decisions, naming conventions, and security constraints. The framework comprises three components: context engineering (maintaining a HARNESS.md knowledge base for the AI), architectural constraints (verification slots using deterministic tools or agent reviews), and garbage collection (scheduled checks for accumulating entropy). The plugin implements these in three enforcement loops—advisory, strict, and investigative—and adds a self-improving dimension where the harness learns from its own operational history.
The harness does not trust the programmer. It verifies.