Skip to main content

credence-governor-core

The harness- and domain-neutral Bayesian tool-call governance core for credence-governor — a pure wire consumer of the Credence engine (credence-skin). It carries no probabilistic code: all inference runs server-side in the engine, reached over the protocol-versioned JSON-RPC skin wire; this package only extracts features from a neutral event and drives proceed / block / ask decisions.

What's in it

  • schema.py — the harness-neutral contract: AgentToolEvent, Session, Message. Every adapter translates its native events into these shapes.
  • features/ + safety.py — the single source of truth for feature & taint extraction (waste loops, repetition, taint-flow, exfil chains). Adapters carry none of this; they send a Session and the daemon extracts.
  • session.py (BrainSession) — boots the warm beliefs and drives the engine's structure_bma / structure_observe / structure_decide / routing_* verbs.
  • daemon.py — the HTTP surface: POST /decide (synchronous, for subprocess-hook adapters), POST /sensor + GET /signals (SSE, for in-process plugins), /report, /ready. stdlib http.server; one lock serialises engine calls.
  • data/ — "coding-ness" as data: the bdsl/ feature schema + utility, the brain/*.counts.json warm beliefs, and profiles/. Swappable.

Install & run

Zero-config — with docker or podman on PATH, the daemon auto-runs the published engine image (ghcr.io/gfrmin/credence-skin:latest); no env vars needed:

pip install credence-governor-core   # pulls the engine's wire client (credence-skin-client)
credence-governor-daemon             # zero-config: auto-runs the engine via docker/podman

With uv — no separate install step. The package is credence-governor-core but the console script is credence-governor-daemon, so the --from is required (uvx otherwise looks for a PyPI package matching the command name):

# one-off / ephemeral — re-resolves each run (cached after the first):
uvx --from credence-governor-core credence-governor-daemon

# persistent — installs `credence-governor-daemon` onto PATH (~/.local/bin):
uv tool install credence-governor-core
credence-governor-daemon

Prefer uv tool install for a long-lived service, and required if you use an adapter's opt-in autostart — it spawns the bare credence-governor-daemon, which must be on PATH (an ephemeral uvx install is not). uvx is ideal for a quick "spin it up to test". Either way uv supplies only the Python host; the engine still comes from docker/podman (or the overrides below).

Overrides (resolution order: CREDENCE_SKIN_COMMAND → CREDENCE_ENGINE_DIR → zero-config):

# prod: pin the engine image by digest (reproducible) — highest precedence
CREDENCE_SKIN_COMMAND="docker run --rm -i ghcr.io/gfrmin/credence-skin@sha256:<digest>" \
  credence-governor-daemon
# dev engine: a local checkout of the Credence engine
CREDENCE_ENGINE_DIR=/path/to/credence credence-governor-daemon

The daemon listens on http://127.0.0.1:8787 by default (CREDENCE_GOVERNOR_HOST / CREDENCE_GOVERNOR_PORT). Every adapter is a fail-open silent no-op until this daemon answers on :8787 — verify with curl -s localhost:8787/ready.

POST /decide {tool_name, input, session:{cwd, project_root, messages}} → {action, features, event_id}.

Raw-event capture (opt-in)

The observation log stores only the extracted features of each decision, so when the extractor gains a feature, past traffic cannot be re-derived. Set CREDENCE_GOVERNOR_CAPTURE=1 (or a path) to additionally capture the raw (tool_name, input, session) of each governed call to ~/.credence-governor/raw_events.jsonl — a re-extractable corpus a later feature-engineering pass folds in as benign negatives (training.capture_corpus.load_capture). Off by default (raw sessions carry file contents + commands). String fields over CREDENCE_GOVERNOR_CAPTURE_MAXLEN (default 1 MB — a runaway-size guard, not a privacy cap; truncated records are excluded from the fold since they would re-extract to different features) are cut. Non-causal: capture never feeds a belief or a decision.

Tests

python -m pytest tests -q   # parity tests; no engine needed (pure extractor/manifest code)

License

AGPL-3.0-or-later.

Metadata

Release files for credence-governor-core 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for credence-governor-core 0.10.0
File Size Uploaded Provenance Actions
credence_governor_core-0.10.0.tar.gz 98.8 kB Without provenance Details for credence_governor_core-0.10.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for credence-governor-core 0.10.0
File Interpreter ABI Platform Actions
credence_governor_core-0.10.0-py3-none-any.whl Python 3 none any Details for credence_governor_core-0.10.0-py3-none-any.whl

Total release size: 188.2 kB

Release files / credence_governor_core-0.10.0.tar.gz

Download URL credence_governor_core-0.10.0.tar.gz
Size 98.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ea83011ec0184c4ea6cdf204c27070e1b47c22841022b188dab8091fc0f8209d
BLAKE2b-256 checksum
How to use checksums
17abc9c89c33bfcd0333b09512ef9fe35ad0c7878cff6eaf5485917381cc6be6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / credence_governor_core-0.10.0-py3-none-any.whl

Download URL credence_governor_core-0.10.0-py3-none-any.whl
Size 89.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb90793a80ddca336ad8c5258cf35614fd6468223b6ebdc6b6a1323ede5cfbdb
BLAKE2b-256 checksum
How to use checksums
8d02add8475561a4a4a5950d7d3488fc8382062d20e854606f92ae033b83c59c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for credence-governor-core 0.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page