Skip to main content

Harness- and domain-neutral Bayesian tool-call governance — a pure wire consumer of the Credence engine (credence-skin). Run credence-governor-daemon to serve it on :8787.

Project description

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_COMMANDCREDENCE_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}.

Tests

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

License

AGPL-3.0-or-later.

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

credence_governor_core-0.7.0.tar.gz (74.8 kB view details)

Uploaded Source

Built Distribution

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

credence_governor_core-0.7.0-py3-none-any.whl (70.2 kB view details)

Uploaded Python 3

File details

Details for the file credence_governor_core-0.7.0.tar.gz.

File metadata

  • Download URL: credence_governor_core-0.7.0.tar.gz
  • Upload date:
  • Size: 74.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.6

File hashes

Hashes for credence_governor_core-0.7.0.tar.gz
Algorithm Hash digest
SHA256 36bb2d7333a12d07af293d79c9a10420ab89fde3d942ba45878487212f95c42a
MD5 f3b3af0a9d9c77ebc7e95bf0a03068f6
BLAKE2b-256 77fdbd7e3fa8b9b02ded484d196fd94bc07d92531cc24942dd8e74c2ae2531ed

See more details on using hashes here.

File details

Details for the file credence_governor_core-0.7.0-py3-none-any.whl.

File metadata

File hashes

Hashes for credence_governor_core-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6071d62d3e2910e9d6d88e60a358d3615da80e2338adf6c334af58457b551754
MD5 297e2a911b5c261e0c9525aac86b185f
BLAKE2b-256 bcb1f1839b1164f75c123419527387ddb600616a2f6f472b60d298f50c3f3081

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