The Invariant Card & Technical Glossary
The Invariant Card & Technical Glossary#
This chapter is the substrate's pocket constitution. The card is the set of laws an agent is not permitted to renegotiate. The glossary is the type system for talking about those laws without lexical drift.
An axiom states why the universe is bounded. An invariant is the wall the process hits. A gate is the compiled predicate that raises the wall. A capability is the affine token that authorizes a single step inside the wall. A receipt is the signed artifact that the step occurred and that the wall still stands.
If a term does not land in one of those five layers, it is commentary. Commentary is not load-bearing.
The One-Page Invariant Card#
Seven laws. One sentence each. No aliases, no softenings, no "should."
| # | Law | Statement |
|---|---|---|
| 1 | Topological Symmetry | The compiled harness must encode the same discrete phase topology the agent reasons in; a mismatched state machine is phase leakage by construction. |
| 2 | Non-Verbal Proof | Correctness is an exit code from compiled AST analyzers and green test traces, never a model's self-report. |
| 3 | Ambient State Isolation | Plane trunks are physically read-only; all mutation executes inside ephemeral, single-task git worktrees that are torn down after two-phase commit. |
| 4 | Single-Path SSoT | Every contract has exactly one compiled Go source of truth; every other plane receives a SHA-256 byte-parity projection, never a second author. |
| 5 | Epistemic Distrust | Every agent mutation is Byzantine until 2PC verification against binary Definition-of-Done gates; polite agreement is a zero-value signal. |
| 6 | Zero-Alias | Each capability has exactly one bijective name; aliases dilute token probability mass and induce stochastic branching. |
| 7 | Cognitive Inversion | The compiled Go runtime owns the lifecycle state machine; the LLM is a bounded heuristic subroutine invoked with ephemeral CapBAC step and token budgets. |
Pin this card. The remainder of the handbook is commentary on how these seven sentences become os.Exit(1).
Lifecycle the card implies, and that the engine actually runs:
TRIAGE → SPEC → PLAN → EDIT → REVIEW → SYNC → LEARNThe LLM does not traverse this graph. The engine does. The LLM is called from a node, under a token that dies when the node exits.
The Five-Layer Stack#
| Layer | Ontological role | Failure mode | Typical locus |
|---|---|---|---|
| I. Axioms | Foundational premise; assumed, not executed | Logical incoherence, flawed derivation | Vault handbooks, AGENTS.md, protocol schemas |
| II. Invariants | Mechanized boundary anchored to one artifact | Build panic, mutation rejection, phase abort | Compiled Go (nomos verify, zero_alias.go, lock.go) |
| III. Gates | Boolean predicates that raise the boundary | exit 1, FATAL JSON, blocked transition |
AST analyzers, pre-commit hooks, 2PC, DoD suite |
| IV. Capabilities | Affine, non-transferable authority for one (task_id, phase) |
Token exhaustion, phase-lock, denied syscall | CapBAC tokens, step/token budgets, tier routing |
| V. Receipts | Cryptographic evidence that a transition occurred under the above | Missing note, hash mismatch, unsigned release | Ed25519 Git Notes (refs/notes/agent), SHA-256 parity proofs |
Core rule. An axiom that has no invariant is a sermon. An invariant that has no gate is a comment. A gate that issues no receipt is an anecdote.
Layer I — Axioms#
Axioms are not code. They are the premises from which code is not allowed to deviate. Nomos derives every constraint from this set. The seven laws on the card are the operational subset; the entries below are the full ontological bed.
Axiom of Topological Symmetry. The harness underneath the agent must mirror the state topology of the agent's reasoning loop. If the agent thinks in TRIAGE → … → LEARN, the engine must refuse any other walk.
Axiom of Dual-Core Division. The Intent Core (Yang) explores, designs, and refactors; the Substrate Core (Yin) enforces, verifies, and guarantees. Stochastic reasoning and deterministic execution never occupy the same layer.
Axiom of Non-Verbal Proof. We never ask an LLM if code is correct. We compile it, verify AST invariants, and run tests through deterministic Go binaries. Self-reported success is discarded.
Axiom of Topological Slicing. Cognitive size is the early-warning indicator; domain and layer separation is the structural remedy. Files exceeding ~400 lines or Cognitive Debt Score > 65 must be sliced across sibling modules without destructive omission. Tasks must not span conflicting architectural planes.
Axiom of Canonical Singularity (Zero-Alias Law). Every capability possesses strictly one canonical, bijective representation. Command aliases, convenience shortcuts, and redundant shims are purged.
Axiom of Epistemic Distrust (Verification Asymmetry). State transitions require non-verbal proof: exit code 0 and verified AST invariants. Commit authorization requires 2PC against the binary DoD suite before a worktree may merge into a plane trunk.
Axiom of Ambient State Isolation (Hermetic Worktree Law). Protected trunks are physically read-only. Active mutations occur strictly inside ephemeral, single-task worktrees (worktrees/<repo>-<task>).
Axiom of Non-Destructive Refactoring (AST Preservation). Under context-window pressure, models truncate, stub, or comment out working code. Modularization must never be achieved by omission. Gates verify AST symbol parity, exported signatures, and comment density across sibling files.
Axiom of Unified Schema Transduction (Single-Path SSoT). Any contract maintained in multiple languages will drift. Every contract has exactly one compiled Go SSoT. Downstream consumers receive projected, hash-verified mirrors.
Axiom of Dynamic Ecosystem Discovery (Zero-Hardcoded-Path). No physical workspace path or repository identity may exist as a string literal. Filesystem boundaries, repository mappings, and worktree roots resolve at runtime via config.LoadGlobalConfig().
Axiom of Total Reification (Zero-Implicit). Implicit context, ambient environment variables, and hidden default fallbacks are hallucination vectors. Every dependency, parameter, tool argument, and execution invariant is declared in an AST, SQLite schema, or task manifest.
Axiom of Binary Diagnostics (Silent Metric). Advisory warnings are ambiguous signals: agents either ignore critical debt or burn budget "fixing" notices. Evaluation is PASS or FATAL structured JSON. Never conversational prose.
Axiom of Deterministic Ephemerality (Anti-Accretion). Unversioned local state is contamination. Every mutation phase executes against a worktree whose input boundary is hash-pinned to a clean commit and whose output collapses to a single verifiable diff.
Axiom of Bidirectional Verifiability (Specification-First). Verification predicates, invariant schemas, and contract gates precede execution. An agent cannot enter EDIT without a deterministic gate that fails on current state and passes only on correct completion.
Axiom of Non-Contamination. Cross-plane contamination is forbidden. Substrate never authors Intent. Membrane never queries raw Substrate tables. Intent is inert until Substrate compiles its satisfaction to exit code 0.
Axiom of Cognitive Inversion. Control flow is inverted relative to 2024–2026 agent loops. The compiled engine drives the lifecycle; the model is a co-processor, not a controller.
Harness Over Model. Intelligence without invariants is liability; invariants without intelligence is rigidity. The harness is the physical totem. The model is not.
Layer II — Invariants#
An invariant is the physical, executable manifestation of an axiom, anchored to a single source artifact. Where an axiom states why, an invariant is the wall.
SSoT Invariant. One artifact is canonical. All other representations are projections. Drift between projection and source is a hard failure, not a merge conflict.
Four-Plane Topology. Strict domain separation, mapped 1-to-1 onto workstations, repositories, and plane-aligned trunks:
| Plane | Mandate | Artifacts | Currency | Trunk |
|---|---|---|---|---|
| Intent | What the system is intended to be | Specs, handbooks, contracts | Markdown, JSON/YAML schemas | intent |
| Substrate | What the system proves it is | Compiled Go, AST gates, SQLite state machine | Binaries, AST nodes, exit codes, hashes | substrate |
| Membrane | Perceptual transduction | SvelteKit SSR, telemetry, visualization | DOM, shaders, WebSocket frames | membrane |
| Infra | Hermetic execution ground | NixOS, cgroups, supervisors | namespaces, nix closures, units | infra |
Plane-Aligned Trunks. Generic trunks (main, master, develop) are abolished. Each repository's trunk is its plane. Long-lived staging branches violate Deterministic Ephemerality.
Hermetic Worktree Invariant. Pre-commit hooks physically block edits on trunks. Active execution is confined to worktrees/<repo>-<task>. Lifecycle: Scaffold → Sandboxed TDD → Machine DoD → 2PC Atomic Release → Teardown. Zero residual state.
Zero-Alias Invariant. CLI flags, command hierarchies, and tool schemas are bijective. Duplicate names fail compilation of the contract schema (zero_alias.go class of checks).
Cognitive Firewall. Workspace is locked read-only during non-mutation phases (PLAN, SPEC, REVIEW). Mutation capability exists only inside the task worktree, and only in EDIT.
Total Reification Invariant. No ambient fallbacks. Missing explicit declaration is a schema error, not a default.
AST Preservation Invariant. Refactors must preserve symbol parity, exported signatures, and docstring density (≥ 10%). Incomplete stubs are rejected, not "followed up later."
Hash-Pinned Input Boundary. A worktree that cannot name its parent commit hash is invalid before the first edit.
Layer III — Gates#
Gates are compiled predicates. They do not advise. They evaluate to boolean and, on failure, refuse the transition.
Non-Verbal Proof Gate. AST static analyzers plus test runner. Representative thresholds (the numbers are the law, not a style guide):
- cyclomatic complexity
< 15 - docstring density
≥ 10% - import boundary closures (no illegal cross-plane or cross-package imports)
- 100% green test traces
Failure → exit 1 → phase transition blocked. The agent cannot negotiate.
Definition of Done (DoD). The binary suite (historically 39 gates) that must all return PASS before 2PC will consider a worktree mergeable. Partial green is red.
Pre-Commit Trunk Lock. Hooks reject any mutation whose target is a plane trunk. The only legal write path is the worktree.
Two-Phase Commit (2PC) Release Gate. Prepare: DoD + AST + tests inside the sandbox. Commit: atomic fast-forward into the plane trunk, then teardown. Abort: worktree remains isolated; trunk is untouched.
Binary Diagnostic Schema. Gate output is structured JSON { "status": "PASS" | "FATAL", ... }. Narrative linter prose is not a gate.
Import Boundary Gate. Compiler-enforced closure of plane and package edges. Membrane must not import Substrate internals. Substrate must not author Intent documents.
Bidirectional Spec Gate. EDIT is unreachable until a failing predicate exists for the claimed change. Generation without a failing gate is unconstrained generation.
Cognitive Size Gate. File length and Cognitive Debt Score trip slicing requirements. The gate fails closed: oversized modules do not merge.
Projection Parity Gate. Downstream membranes and docs must match the Go SSoT at SHA-256 byte parity. "Semantically equivalent" is not a predicate.
Layer IV — Capabilities#
Capabilities are substructural. They are not roles, not API keys, and not ambient authority. They are affine tokens: usable once, in one phase, for one task, then gone.
CapBAC (Capability-Based Access Control). Tokens bound to (task_id, phase). Discrete step and token depletion per lifecycle phase. Exhaustion terminates the stochastic loop (cybernetic damping) without poisoning the next phase.
MutationCapability. Issued only in EDIT, only against the task worktree. Absent in PLAN, SPEC, REVIEW. Possession is checked by the engine, not by the model.
Step Budget / Token Budget. Finite counters on the CapBAC token. The model is a stochastic ALU with a cycle limit. Runaway loops die by arithmetic, not by plea.
Cognitive Co-Processor. The LLM is a bounded, ephemeral heuristic function called by the Go harness. It does not own the repository, the shell, or the state machine.
Tier 1 — Orchestrator (Conscious Architect). Frontier model invoked for PLAN, SPEC, REVIEW, architectural decomposition, and human PO negotiation. Strategic, not mechanical.
Tier 2 — Swarm (Headless Mechanical Solver). Turn-bounded TDD workers (nomos code) on local open-weight SLMs inside transient worktrees. High velocity, no trunk authority, no ambient shell.
Declarative Domain Routing. ~/.nomos/data/config.yaml maps domains (planning, code_generation, adversarial_audit) onto tiers, models, and fallback escalation. Routing is configuration, not prompt folklore.
SLM. Compact open-weight models (7B–32B class) on local GPU silicon. Zero marginal token tax, no codebase egress. Used where gates, not the model, carry correctness.
Cognitive Yield Ratio (CYR). CYR = ΔComplexity / Tokens. Distinguishes verified architectural work from context thrashing. A metric, not a gate; gates remain binary.
Model Downgrade Paradox. Unconstrained prompt agents require frontier-scale models to imitate compilers. Agents under a Substrate Core execute on cheap/fast models or local SLMs at identical DoD parity, because the compiler is not being impersonated.
Conduit. Local browser bridge / MCP provider: programmatic access to DOM, network, accessibility tree. A capability surface, not a second SSoT.
Layer V — Receipts#
A receipt is evidence that a transition happened under the preceding four layers. Without a receipt, the transition is hearsay.
Release Receipt. Ed25519-signed artifact attached to Git Notes (refs/notes/agent) at 2PC commit. Binds: task id, phase, parent commit, result diff hash, DoD vector, capability id, signer.
SHA-256 Byte-Parity Proof. Cryptographic identity between SSoT and a projection (Membrane docs, generated bindings, published handbook pages). Semantic similarity is not a receipt.
Worktree Teardown Receipt. Evidence that the ephemeral worktree was destroyed after merge or abort. Residual directories are invariant violations, not leftovers.
Phase-Exit Receipt. Structured record that a lifecycle node exited with PASS or FATAL, including remaining CapBAC budget. Enables LEARN without re-trusting the model's narrative of what it did.
LEARN Distillation. After Substrate execution, control inverts once: empirical facts discovered in the worktree are written back into Intent as durable law. The receipt of LEARN is an Intent patch that itself must pass Non-Verbal Proof on the next cycle. Entropy is allowed to decrease only through this channel.
Compact Index#
| Term | Layer | One-line denotation |
|---|---|---|
| Nomos | Substrate | Compiled Go deterministic engineering OS for autonomous coding agents |
| Dual-Core | Axiom | Intent (Yang, stochastic) ⊥ Substrate (Yin, deterministic) |
| Cognitive Inversion | Axiom / Card | Engine drives lifecycle; LLM is a bounded subroutine |
| Non-Verbal Proof | Axiom / Gate / Card | Exit code 0 from binaries; speech is not evidence |
| Zero-Alias | Axiom / Invariant / Card | One name ↔ one capability |
| Ambient State Isolation | Axiom / Invariant / Card | Trunks read-only; mutation in ephemeral worktrees |
| Single-Path SSoT | Axiom / Invariant / Card | One compiled Go contract; SHA-256 projections only |
| Epistemic Distrust | Axiom / Card | Treat mutations as Byzantine until 2PC+DoD |
| Topological Symmetry | Axiom / Card | Harness topology ≡ reasoning topology |
| Four-Plane Topology | Invariant | Intent / Substrate / Membrane / Infra, non-contaminating |
| Plane-Aligned Trunk | Invariant | intent | substrate | membrane | infra |
| Hermetic Worktree | Invariant | worktrees/<repo>-<task>, 2PC, teardown |
| Cognitive Firewall | Invariant | Read-only outside EDIT |
| Total Reification | Axiom / Invariant | Nothing implicit; no ambient defaults |
| Binary Diagnostics | Axiom / Gate | PASS | FATAL JSON only |
| DoD | Gate | Binary all-pass suite before merge |
| 2PC | Gate | Atomic sandbox → trunk; else abort |
| CapBAC | Capability | Affine (task_id, phase) token with budgets |
| MutationCapability | Capability | Write authority, EDIT ∩ worktree only |
| Tier 1 / Tier 2 | Capability | Orchestrator vs sandboxed TDD swarm |
| CYR | Capability (metric) | ΔComplexity / Tokens |
| Release Receipt | Receipt | Ed25519 Git Note on 2PC |
| Parity Proof | Receipt | SHA-256 identity of projection to SSoT |
| LEARN | Receipt / loop | Substrate facts distilled into Intent under proof |
Usage#
Quote the card in AGENTS.md. Compile the invariants. Wire the gates to os.Exit(1). Issue capabilities that expire. Refuse any merge that cannot produce a receipt.
If an agent argues with a gate, the agent is wrong. That is the entire handbook, compressed.