The 3pwr engine
This directory is the 3Powers engine — the Python package (threepowers) that provides the 3pwr
command: the deterministic gate runner, the oracle-independence checks, and the signed trust spine. It is
distributed as a uv tool.
New to 3Powers? Start with the top-level README and docs. This file is for working on the engine itself.
Install & develop
# Install the CLI from source (from the repo root)
uv tool install ./engine
# Engine dev environment + the checks it must always pass
cd engine
uv sync --extra dev
uv run pytest # test suite
uv run ruff check . # lint
uv run mypy src # types
Python 3.11+ is required. Entry point: threepowers.cli:main, exposed as the 3pwr console script. Every
command and flag is documented in docs/cli-reference.md.
Module map
src/threepowers/
Trust spine (High-risk tier — held to ≥95% `diff_coverage` + mutation):
canonical.py # deterministic hashing
keys.py # Ed25519 key generation + loading
ledger.py # append-only, hash-chained, signed verdict ledger
verify.py # offline recompute of the chain + signatures
Verdict & gate engine:
verdict.py # the normalized verdict + canonical gate order
gates.py # the cheapest-first gate runner
adapters.py # declarative per-language adapter loading/invocation
conformance.py # the spec_conformance trace (+ defect regression, tier test-layers)
covdiff.py # the diff_coverage gate
mutation.py # mutation-testing gate
scanners.py # SAST / dependency / secret scanners
gaming.py # gate_gaming detection
design.py # design-oracle gates (visual / a11y / contract)
scope.py # task requirement-ID + file-scope discipline
Oracle independence:
oracle.py # seal / record / verify / headless dispatch
Lifecycle, orchestration & feedback:
lifecycle.py # per-spec stage, derived from the ledger
orchestrate.py # `3pwr run` — the whole-lifecycle loop
workkind.py # deterministic work-kind + tier inference
characterize.py # brownfield: reconstruct a spec + characterization tests
deviations.py # signed, reversible gate exceptions + emergency path
observe.py # production signals, NFR coverage, agent-action log
provenance.py # build provenance + SBOM signing, deploy gate
evals.py # prompt/constitution eval set
deps.py # third-party version drift check
CLI & config:
cli.py # argparse command surface (see docs/cli-reference.md)
config.py # settings, risk tiers, roles
Tests live in tests/, with tests/integration/ and tests/e2e/ layers alongside the unit tests.
Mutation testing (the High-risk proof)
The trust-spine modules are held to the strictest tier. Mutation runs via mutmut, scoped to those
modules:
(cd .. && 3pwr gate run --path engine --adapter python \
--spec specs/002-engine-trust-spine/spec.md --tier High-risk --mutation --no-ledger \
--paths engine/src/threepowers/canonical.py engine/src/threepowers/keys.py \
engine/src/threepowers/ledger.py engine/src/threepowers/verify.py)
Adding a language adapter
The core assumes no language. To add one, write a declarative adapter.yaml under
../.3powers/adapters/<lang>/ per
../.3powers/adapters/CONTRACT.md. The TypeScript, Python, and Go
adapters are working references — no changes to this engine should be needed.
Self-application
The engine gates its own code. Keep it green under its own gates (ruff + mypy + pytest, plus
3pwr gate run --path engine), and hold the trust-spine modules to the High-risk bar. See
CONTRIBUTING.md and docs/STATUS.md.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file 3powers-1.0.0.tar.gz.
File metadata
- Download URL: 3powers-1.0.0.tar.gz
- Upload date:
- Size: 628.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a17430d4e619243c1a897445b894451daa5398709d9c379a143c2cf6c25c6bf2
|
|
| MD5 |
f467d11ce510284eaf5149fe94594173
|
|
| BLAKE2b-256 |
d25366ea4aca23948239086569393c9b9918e4d3fb747cdb02cce12e3cb7a009
|
Provenance
The following attestation bundles were made for 3powers-1.0.0.tar.gz:
Publisher:
release.yml on VerzCar/3powers
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
3powers-1.0.0.tar.gz -
Subject digest:
a17430d4e619243c1a897445b894451daa5398709d9c379a143c2cf6c25c6bf2 - Sigstore transparency entry: 2217574180
- Sigstore integration time:
-
Permalink:
VerzCar/3powers@b90ae2984e9f10ec2a3c6508a51deb640794cca9 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/VerzCar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b90ae2984e9f10ec2a3c6508a51deb640794cca9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file 3powers-1.0.0-py3-none-any.whl.
File metadata
- Download URL: 3powers-1.0.0-py3-none-any.whl
- Upload date:
- Size: 402.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b98d10fcf2825d1aef1180b19f75ad07c657ed1a7407ec0fd0b182a2ab57154
|
|
| MD5 |
06a72b1a539f5dc1d08f5e8b8708f50a
|
|
| BLAKE2b-256 |
eef64e0d8228735e229eefc3520f3aa2f4df22f24cc7e98501a1495f9a41cdff
|
Provenance
The following attestation bundles were made for 3powers-1.0.0-py3-none-any.whl:
Publisher:
release.yml on VerzCar/3powers
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
3powers-1.0.0-py3-none-any.whl -
Subject digest:
1b98d10fcf2825d1aef1180b19f75ad07c657ed1a7407ec0fd0b182a2ab57154 - Sigstore transparency entry: 2217574196
- Sigstore integration time:
-
Permalink:
VerzCar/3powers@b90ae2984e9f10ec2a3c6508a51deb640794cca9 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/VerzCar
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@b90ae2984e9f10ec2a3c6508a51deb640794cca9 -
Trigger Event:
push
-
Statement type: