Small, deterministic control primitives for software systems. Testable, auditable bricks.
Most software control logic is implicit, buried in application code, and impossible to audit independently. These primitives make control decisions explicit, testable, and portable. Each one is a standalone brick: no frameworks, no runtime dependencies, no hidden state. If your system needs a verifiable stop condition, a gated authority check, or a deterministic posture classifier, you can drop one in and test it in isolation.
A three-state deterministic machine.
| State | Meaning |
|---|---|
| GREEN | Normal / proceed |
| AMBER | Warning / caution |
| RED | Terminal / halt |
Invariants:
- RED is terminal. No advance, no reset.
- No skipping backwards (RED -> GREEN forbidden).
- Invalid transitions raise
ValueError. - No global state. No time logic. No optimisation.
Interface:
from stop_machine import State, StopMachine
m = StopMachine() # starts GREEN
m.advance() # -> AMBER
m.advance() # -> RED (terminal)
m.state # State.REDAn evidence-ordered access gate. Monotonic, deterministic, pure.
| Level | Value |
|---|---|
| NONE | 0 |
| USER | 1 |
| OWNER | 2 |
| ADMIN | 3 |
Invariants:
- required_level is fixed at construction.
- check() is pure: same inputs produce same output.
- Evidence ordering is total and monotonic.
- No side effects. No logging. No state mutation.
Interface:
from authority_gate import Evidence, Decision, AuthorityGate
gate = AuthorityGate(Evidence.OWNER)
gate.check(Evidence.ADMIN) # Decision.ALLOW
gate.check(Evidence.USER) # Decision.DENYA deterministic posture classifier. Detects whether a text claim is a hard invariant (wall) or a cost curve (slope).
| Posture | Meaning |
|---|---|
| HARD_INVARIANT | Fundamental limit / wall |
| COST_CURVE | Engineering tradeoff / slope |
| EDGE | Ambiguous / needs clarification |
Invariants:
- Pure phrase matching + regex. No ML. No randomness.
- Symmetric scoring: +0.25 hard, -0.25 cost, +0.15 quantification.
- Negation handling: 2-word window.
- No external dependencies beyond
re.
Interface:
from invariant_litmus import classify, Posture
r = classify("Shannon limit provides an upper bound")
r.posture # Posture.HARD_INVARIANT
r.score # 0.5
r.signals # [("hard", "shannon limit"), ("hard", "upper bound")]pip install pytest
pytest test_stop_machine.py test_authority_gate.py test_invariant_litmus.py -vDeterministic, hash-bound commit authority gate — stdlib-only, no network, no new governance primitives.
- Location:
/commit_gate/ - Proves: determinism (byte-identical output across runs) + drift-fail (reachability expansion without contract revision is rejected)
- Release:
commit_gate-v0.1.0 - CI:
commit_gate_ci.yml(Python 3.10/3.11/3.12 matrix) - Proof: Determinism + drift-fail validated across Python 3.10/3.11/3.12.
/prometheus is an observability-only island. It must not be imported by any execution path, gate, or pipeline code. It observes and reports; it cannot allow, hold, deny, or silence anything.
Apache 2.0
This repo uses a spec-first workflow for runtime governance.
The canonical runtime governance geometry is defined in:
docs/LVTECH_RUNTIME_GEOMETRY_v0.1.md— Canonical specdocs/LVTECH_RUNTIME_GEOMETRY_DIAGRAM_v0.1.md— Mermaid diagramdocs/LVTECH_RUNTIME_GEOMETRY_TEST_MATRIX_v0.1.md— NON_EXEC test matrixdocs/HANDOFF_PERPLEXITY.md— AI assistant builder instructions
It describes:
- State-space regions (A–E)
- Deterministic gates (G1–G4)
- A one-way commit boundary
- Fail-closed failure posture
- Evidence and audit requirements
When you use Perplexity or another assistant on this repo:
- Point it at the geometry spec.
- Ask it to propose docs, diagrams, and NON_EXEC test matrices first.
- Only after HUMAN review, ask for executable code that implements the geometry without changing its invariants.
See docs/HANDOFF_PERPLEXITY.md for full builder instructions.