Skip to main content

Reference-grade DBL implementation: deterministic governance over non-deterministic execution.

Project description

ENSdg

tests PyPI Python

Executable Normative Semantics for Deterministic Governance

ensdg exists to make the DBL papers executable, testable, and falsifiable. It defines the normative upper bound of the DBL model in code. ENSdg was previously developed under the working name "dbl-reference". The rename reflects the stabilized scope and role as a semantic anchor.

This repository is not a product, framework, SDK, or integration layer.


What this repository is

ensdg serves exactly three purposes:

  1. Executable reference model
    A minimal implementation of the DBL axioms with no discretionary behavior.

  2. Invariant oracle
    A canonical baseline against which other DBL-based systems can be validated.

  3. Semantic anchor
    A fixed point that prevents drift as higher-level tooling evolves.

If another implementation disagrees with ensdg, either the implementation is wrong or the papers are.


Normative guarantees

The following properties are normative and enforced by structure and tests:

  • Append-only, totally ordered event stream V
  • Event kinds: INTENT, DECISION, EXECUTION, PROOF
  • DECISION primacy: only DECISION events are normative
  • Governance consumes authoritative inputs only
  • Pre-execution decision: DECISION precedes EXECUTION for the same correlation_id
  • Normative replay depends exclusively on DECISION events
  • Observational non-interference: EXECUTION and PROOF events cannot affect normative state

These guarantees correspond directly to the axioms and claims of the DBL papers. For the precise boundary of what is normative vs observational, see docs\normative_bounds.md.


What this repository is not

ensdg intentionally does not provide:

  • Policy languages or DSLs
  • Workflow engines or orchestration
  • Network, infrastructure, or side effects
  • Adaptive, learning, or feedback-driven policies
  • Production-grade persistence or scalability
  • UI, UX, or convenience abstractions

Anything that introduces implicit normativity is explicitly out of scope. The example_* modules are test fixtures only.


Position in the DBL ecosystem

ensdg is intentionally small and strict. Other repositories may build around it without extending its scope.

  • dbl-core / kernel-logic
    Define execution primitives and invariants.
    ensdg assumes these as given.

  • dbl-vlog
    Event stream and persistence abstractions.
    ensdg aligns conceptually but does not provide storage backends.

  • dbl-main
    Integration and composition layer.
    Real-world wiring, adapters, and domain runners belong there.
    dbl-main SHOULD be validated against ensdg.

Educational repositories (dbl-tutorial, dbl-simple) may trade strictness for clarity, but MUST NOT weaken DBL invariants.


How this repository is used

Typical uses:

  • Validate that a DBL-based system preserves:
    • DECISION primacy
    • pre-execution decision ordering
    • observational non-interference
    • normative replay equivalence
  • Detect semantic drift during refactors or evolution
  • Ground DBL discussions in executable semantics rather than interpretation

This repository answers one question only:

What does DBL mean under a minimal, interference-free implementation?


Validation workflow

Use this repo to validate an external DBL system:

  1. Export the system's event stream as JSONL.
  2. Run ensdg --mode validate to check invariants.
  3. Run ensdg --mode replay to compute the normative projection.
  4. Run ensdg --mode replay --digest to compute the normative digest.
  5. Compare projections/digests across runs to confirm stability.

CLI contract (normative)

The CLI is a validator/oracle surface, not a runtime or integration API. Any deviation is a bug unless the DBL papers changed. InvariantError and ReplayError are normative validator errors; AdmissionRejected is demo-only and non-normative.

Modes

  • --mode demo
    Emits a minimal valid DBL event stream (JSONL).
  • --mode replay
    Emits the normative replay projection (single JSON object), unless --digest is set.
  • --mode validate
    Emits nothing on success unless --digest is set.

Exit codes

Code Name Meaning
0 RC_OK Success
2 RC_USAGE Argument or usage error
3 RC_PARSE Invalid JSON/JSONL input
4 RC_INVARIANT Invariant violation
5 RC_REPLAY Replayability failure
6 RC_ADMISSION Demo admission rejected

On failure:

  • stdout MUST be empty
  • stderr MUST contain exactly one prefixed error line

Normative replay projection

Replay emits:

{"decisions": {"<correlation_id>": "<ALLOW|DENY>"}}

Richer projections are allowed elsewhere, but they MUST be reducible to this form for equivalence checks.

Normative digest

The normative digest is computed over:

{
  "decisions": {
    "<correlation_id>": {
      "decision": "<ALLOW|DENY>",
      "policy_version": "<int>",
      "authoritative_digest": "<sha256>"
    }
  }
}

Boundary configuration is excluded by definition. Differences in rationale or execution artifacts are observational only.

Stability

This repository is stable by design.

Changes should be rare and only justified by explicit changes to the DBL papers themselves.

References

Execution Without Normativity - A Minimal Theory of Deterministic Execution and Observation
https://github.com/lukaspfisterch/execution-without-normativity

Deterministic Boundary Layers - Governing Non-Deterministic Execution
https://github.com/lukaspfisterch/dbl-paper

Stability policy

This repository is a specification anchor and regression oracle. It is intentionally small, strict, and stable.

It is not intended as a runtime dependency for production systems. Changes should be rare and justified by explicit changes to the DBL papers or dbl-core invariants.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ensdg-0.4.0.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ensdg-0.4.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file ensdg-0.4.0.tar.gz.

File metadata

  • Download URL: ensdg-0.4.0.tar.gz
  • Upload date:
  • Size: 17.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for ensdg-0.4.0.tar.gz
Algorithm Hash digest
SHA256 35a62b6b1cf58da13d02c3e23118178e880f821a6b32eea9b8bcabcccc75ef19
MD5 66fac01c62719ded0d20ad4f6eb16842
BLAKE2b-256 75e86dc86f943b8791944f3632bb53d657355dfea6ec571e93035015998b3ac6

See more details on using hashes here.

File details

Details for the file ensdg-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: ensdg-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for ensdg-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 30532efe0952ea8bcccc02c9db6692f39442c314660f340254037b9dc13b0b04
MD5 018d41c2df6d23dac2b224b9e638abb5
BLAKE2b-256 8012040f1556d1d3667c1914eba887372e4b82f63830c5fda6b243391c9a5382

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page