Nomos Software Physics Engine - Kinematics, Continuous Collision Detection & Phase Ballistics Specification
Role: Autonomous Open-Core Software Architect
Objective: Formulate and codify the first-principles computational physics of software development (AST Mass, Shannon Entropy Viscosity, Multi-Worktree Continuous Collision Detection, and 2PC Atmospheric Re-entry). Ground all telemetry and ergonomic representations in mathematical computer science, graph theory, and control systems.
1. Problem Statement & First-Principles Grounding#
1.1 The Category Error: Code Is Machinery, Not Paint#
As established in the foundational Nomos Software Physics formulation (The Physics of Software: Why Code is Not Paint), software development is governed by the structural physics of computation rather than the subjective curation of paint on canvas.
When autonomous coding agents operate under generative friction approaching zero, the cognitive cost of unverified code approaches infinity:
Without continuous, physical constraints, agents drift into un-indexed loops, semantic signature collisions, and state-space combinatorial explosions. Post-hoc verification at merge time is fundamentally too late—it detects catastrophic failures only after massive cognitive energy has been dissipated.
1.2 Separation of Substrate Physics from Ergonomic Telemetry#
To maintain uncompromising realism and avoid metaphor degradation:
- The Software Physics Engine (Open-Core Substrate): Pure Go mathematical calculations and CUE declarative schemas evaluating AST graph metrics, Shannon information entropy, directed call-graph reachability, and capability leases.
- The Air Traffic Control Interface (HMI / Presentation Layer): The ergonomic telemetry projection (
nomos telemetry) that visualizes these underlying physics vectors (altimeters, radar blips, airway corridors) for human architects. The visualization never replaces the math; it merely renders it at human-perceptual speed.
2. The 7 Laws of Software Physics#
| Law # | Law Name | Physical Counterpart | Substrate Mechanical Invariant |
|---|---|---|---|
| 1 | The Dual-Core Inversion Law | Aerodynamic Airframe vs. Pilot | Substrate Go core enforces flight laws; Tier 1 agent is a bounded cognitive craft under indirect control. |
| 2 | The Non-Verbal Proof Law | Conservation of Mass & Momentum | Zero trust in textual claims; code mass, entropy, and collision vectors are calculated from AST and git invariants. |
| 3 | The Hermetic Worktree Law | Isolated Flight Corridors | Mutations occur strictly inside transient isolated worktrees; trunk main is physically immutable. |
| 4 | The Single Source of Truth Law | Unified Spacetime Metric | All physics telemetry compiles against exactly one CUE schema (intent/contracts/cue/physics.cue). |
| 5 | The Zero-Hardcoded-Path Law | Relativistic Reference Frames | Symbol coordinates and paths resolve dynamically relative to transient worktree roots. |
| 6 | The Canonical Singularity Law | Conservation of Energy | Exactly one canonical tensor for mass, drag, and collision; zero duplicate metrics or shadow state. |
| 7 | The Fail-Closed Pre-Flight Law | Atmospheric Re-entry Envelope | Any DoD gate failure triggers an immediate wave-off and restoration of the clean baseline (git checkout -- <file>). |
3. Mathematical Formulations#
SOFTWARE PHYSICS TENSOR
│
┌───────────────────┬───────────────┴───────────────┬───────────────────┐
▼ ▼ ▼ ▼
1. FILE MASS 2. VISCOSITY & DRAG 3. CONTINUOUS 4. 2PC RE-ENTRY
& INERTIA (Shannon Entropy) COLLISION ENVELOPE
(McCabe/AST) (Information) (CCD Graphs) (42 DoD Gates)3.1 Kinematics, File Mass & Inertia#
In software physics, a source file or package possesses Inertia not because of its byte count on disk, but because of its AST cardinality, decision branching, and topological coupling.
Mass Metric:#
For any source file , its physical mass is defined as:
Where:
- : Physical non-blank lines of code.
- : Total McCabe Cyclomatic Complexity of all functions in .
- : Total node cardinality in the Tree-sitter abstract syntax tree.
- : Number of external callers and external module dependencies.
- Standard default weighting coefficients: .
Mutation Momentum & Kinetic Energy:#
Let represent the editing velocity (AST mutations per second).
- Momentum:
- Kinetic Energy:
High-mass files moving at high velocity have immense cognitive inertia; attempting to mutate them without braking controls introduces severe risk of catastrophic structural failure.
3.2 Cognitive Drag, Viscosity & Shannon Information Entropy#
When source code exhibits high disorder, scattered naming, or structural redundancy, it creates cognitive drag that degrades both human comprehension and LLM attention allocation.
Shannon Token Entropy ::">#
For a set of lexical tokens in file :
Where is the empirical probability of token .
Structural Viscosity ::">#
Code viscosity combines information entropy with sliding-window structural duplication:
Where is computed via rolling Rabin-Karp hashes over sliding token windows of size .
Aerodynamic Drag Force ::">#
The drag force opposing clean cognitive traversal through the codebase is:
Files with trigger immediate refactoring advisories prior to task release.
3.3 Continuous Collision Detection (CCD) in Multi-Agent Topologies#
Standard version control (Git) relies on discrete, post-hoc line collision detection at merge time. If two agents modify distinct files, Git reports zero conflicts even if Agent A alters a public API that Agent B depends on.
In game physics, Continuous Collision Detection (CCD) eliminates the "tunneling problem" by sweeping bounding volumes through time. In software physics, Nomos executes Continuous Collision Detection across concurrent agent worktrees.
The Worktree Mutation Hull:#
For any active transient worktree executing task , the engine maintains an active Mutation Hull :
The Real-Time Collision Tensor ::">#
Between any two concurrent worktrees and :
Collision Threat Levels:#
┌──────────────────────┬───────────────────────────────────────────┬───────────────────────────────────────┐
│ Threat Level │ Mathematical Condition │ Substrate Action │
├──────────────────────┼───────────────────────────────────────────┼───────────────────────────────────────┤
│ GREEN (Clear) │ C(W_i, W_j) = ∅ ∧ FilesTouched ∩ Files = ∅│ Unconstrained parallel flight │
│ YELLOW (Advisory) │ FilesTouched(W_i) ∩ FilesTouched(W_j) ≠ ∅ │ Proximity warning to both agents │
│ RED (Collision Imminent) │ C(W_i, W_j) ≠ ∅ │ Immediate TCAS alert & lock resolution│
└──────────────────────┴───────────────────────────────────────────┴───────────────────────────────────────┘When a RED collision is detected while agents are typing, the substrate alerts the orchestrator before either agent attempts to commit.
3.4 The 60Hz Telemetry Loop & Nyquist-Shannon Sampling#
According to the Nyquist-Shannon sampling theorem, to prevent aliasing and control-loop divergence, the monitoring feedback loop must sample at more than twice the maximum frequency of environmental disturbance:
If an autonomous coding agent generates AST mutations at 2Hz (tokens streaming into buffer), the substrate must evaluate AST invariants, type checking, and boundary constraints at sub-second intervals (, targeting 60Hz frame intervals for telemetry streaming).
This high-frequency loop ensures the agent stays strictly within its Controllable Basin of Attraction, preventing compounding hallucinations.
3.5 Two-Phase Commit (2PC) Atmospheric Re-entry#
Trunk branch main represents the pristine surface of production reality. Merging a transient worktree is modeled as an atmospheric re-entry maneuver:
- Pre-Flight Entry Vector: Phase transitions from
EDITtoREVIEW. CapBAC leases freeze further file mutations. - The DoD Thermal Shield:
nomos verifyruns all Definition of Done quality gates against the worktree AST. - Aerodynamic Wave-Off (Revert Invariant): If any single gate fails (), the landing is aborted immediately. The worktree executes:
No scorched earth or damaged state touchesgit checkout -- <file>main. - Touchdown & Release Receipt: If all DoD quality gates pass cleanly, atomic 2PC merges the worktree to
mainand writes a cryptographic release receipt to Git Notes (refs/notes/nomos/releases).
4. Cross-Plane Transduction Matrix#
| Intent Physical Vector | Substrate Engine Package | Telemetry Protocol & Radar Projection |
|---|---|---|
| AST Mass & Inertia | substrate/src/nomos/modules/telemetry/ast_mass.go |
Mass gauge & inertia vector in nomos telemetry |
| Shannon Entropy Drag | substrate/src/nomos/modules/audit/entropy.go |
Atmospheric density & drag HUD indicator |
| Continuous Collision (CCD) | substrate/src/nomos/modules/workspace/collision.go |
Real-time TCAS radar blips & airway vector conflicts |
| High-Frequency Phase Loop | substrate/src/nomos/modules/sys/watcher.go |
60Hz WebSocket JSON telemetry frame |
| 2PC Re-entry Touchdown | substrate/src/nomos/modules/task/lifecycle_release.go |
Runway landing receipt in Git Notes |
5. Table-Driven Verification Vectors#
| Vector ID | Physical Invariant | Input Workspace State | Expected Verdict |
|---|---|---|---|
TC-PHY-01 |
AST Mass & Complexity | File LOC > 400 or function cyclomatic complexity > 15 |
FAIL (Mass budget exceeded) |
TC-PHY-02 |
Continuous Collision (CCD) | Disjoint file sets across parallel worktrees () | PASS (GREEN clear parallel flight) |
TC-PHY-03 |
Continuous Collision (CCD) | Overlapping symbol/file mutation () | WARN/BLOCK (RED collision alert) |
TC-PHY-04 |
2PC Atmospheric Re-entry | Any of the 42 DoD gates exits non-zero during nomos task sync |
FAIL (Wave-off; trunk main untouched) |
6. Definition of Done & Verification Boundary#
- Declarative CUE schema enforced in
intent/contracts/cue/physics.cuewith closed#PhysicsFrameand#CollisionVectortypes. - All 42 DoD quality gates pass cleanly via
nomos verify. - Zero shims, zero placeholders, and strict adherence to the 7 Laws of the Nomos Open-Core Protocol.
Nomos