Skip to content

Reference Implementation

Terng Dechanon edited this page Jul 23, 2026 · 1 revision

Reference Implementation

A small, dependency-free Python implementation that exists to prove the standards are implementable and self-consistent — not to be your production runtime.

📦 reference/python/

Run it

cd reference/python
python demo.py               # 3-agent workflow, executing live
python conformance_test.py   # 18 invariant checks
python -m pytest -q          # the same checks, under pytest

Python 3.9+. No dependencies. No API key. No model.

What's inside

Module Implements
genesis_gos/task_state.py GTS-1 Task StateTaskState, Status, GTSViolation
genesis_gos/permission.py GPS-2 PermissionGrant, evaluate, Verdict
genesis_gos/orchestrator.py GOP-3 OrchestrationOrchestrator, Agent, LoopGuard
conformance_test.py the 18 checks, each mapped to a named invariant
demo.py the QUICKSTART workflow, actually running

Every check asserts

check() records, prints, and asserts. This matters: without the assert, the test_* functions would return normally even when an invariant was violated, and pytest would report green on a broken implementation. A violated invariant now fails the run in both modes.

Proven on every major platform

CI runs the suite on Linux, macOS, and Windows across Python 3.9 / 3.11 / 3.12 — nine combinations per push, plus JSON Schema validation and a filename-hygiene gate.

Windows is included deliberately: console encoding (cp1252 vs UTF-8) has broken this suite before. A standard that only demonstrably holds on its author's machine is not a standard.

Using it as a conformance oracle

Building an implementation in another language? Port the 18 checks. When your implementation and the reference disagree on a lifecycle or gate question, the reference — and behind it Conformance — is the tie-breaker.

Implementations in any language are welcome; see Contributing.

What it is not

Not production infrastructure. Storage is in-memory, there is no persistence layer, no concurrency control, and no network. The value is legibility: you can read the whole thing in one sitting and see exactly how each invariant is enforced.

Clone this wiki locally