Skip to content
InvariantEngine
2026-05-14 by Joshua Couto

InvariantEngine: Session Integrity Management for Long-Running Agentic Systems

An introduction to InvariantEngine's core thesis: session integrity as a runtime concern for long-running agentic systems.

session-integrityarchitectureoverview
Research context: This essay examines a problem or possible design. It does not describe the product's current implementation. See What works today for implemented behavior and current limits.

Introduction

Across long-running engineering work, an agent’s understanding of a project can drift from approved project state. This is not necessarily a failure of any individual component.

InvariantEngine proposes that session integrity—the continuous alignment between an agent’s working state and the project’s governed memory—is a runtime concern that requires dedicated architectural support.

The Drift Problem

Consider an agent working on a complex project across multiple sessions. In session one, the team rejects an architectural approach after careful evaluation. In session twelve, the agent’s context window has long since lost that decision. Retrieval may surface related documents, but the specific rejection and its reasoning may not be retrieved with sufficient fidelity. The agent re-proposes the rejected approach, and without a mechanism to detect this, the system accepts it.

This is not a hypothetical failure. It is a predictable consequence of systems that lack governed memory and runtime validation.

Session Integrity as Architecture

InvariantEngine’s target architecture formalizes session integrity as a distinct layer. That proposed universal layer would route selected governed actions through validation against:

  • Durable memory that persists across sessions
  • Negative Memory that would record rejections and blocked paths
  • Invariants that encode project constraints
  • Source grounding that traces claims to evidence
  • Drift scoring that estimates session degradation risk

The complete universal runtime layer is not implemented. The private-alpha product currently demonstrates a narrower human-governed repository-improvement workflow with bounded evidence, deterministic diagnosis, structured planning and packet lineage, result review, execution feedback, and separately approved memory.

Design Principles

InvariantEngine is built on several core principles:

AI output is a proposal, not truth. Every agent output must be validated before it is accepted. The system does not trust the agent’s output by default.

Memory is governed, not cached. Changes to durable memory require a structured proposal, review, and approval workflow. No agent can unilaterally modify the project’s governed record.

Rejection is knowledge. Recording what was rejected is as important as recording what was approved. Negative Memory remains proposed; rejected proposals and contradiction review state do not become Negative Memory today.

Evaluation can be multi-perspective. No critic should be treated as authoritative. Review Councils remain a proposed extension and are not part of the current workflow.

Drift risk can be made inspectable. Implemented Hallucination Gauge v0 produces a deterministic read-only operational signal. It does not detect hallucinations, prove truth, or intervene automatically.

Conclusion

InvariantEngine does not claim to solve hallucinations or replace all AI safety work. It formalizes session integrity as a specific, addressable runtime concern and provides an architecture for managing it. The specifications published alongside this essay define each primitive in detail, including runtime behavior, failure modes, and open questions.