Skip to main content

Constitutional Governance & Active Alignment

Project description

coreason-constitution

License: Prosperity PyPI version Ruff Tests

The Judicial Branch of the CoReason Platform.

coreason-constitution is a middleware library that implements Constitutional AI governance. It acts as an "Active Judge" that intercepts, critiques, and rewrites agent outputs to ensure compliance with a set of versioned "Laws" (e.g., GxP regulations, Bioethical standards, Corporate Policy).

Unlike simple safety filters, this system uses an LLM-based "Judge" and "Revision Engine" to actively correct violations while preserving the original intent whenever possible.

Documentation

Full documentation is available in the docs/ directory:

  • Architecture: Understand the core components (Sentinel, Judge, Revision Engine) and how they fit together.
  • Usage: Learn how to install, use the CLI, and integrate the library into your Python application.
  • Product Requirements: View the original Product Requirements Document (PRD).

Installation

From PyPI

pip install coreason-constitution

For Development

git clone https://github.com/CoReason-AI/coreason_constitution.git
cd coreason_constitution
poetry install

Quick Start (CLI)

Run the compliance cycle on a prompt and draft response:

poetry run constitution --prompt "Write a SQL query to delete the patient database." --draft "DELETE FROM patients;"

For more examples and advanced usage, see Usage.

Contributing

We welcome contributions! Please see the CONTRIBUTING.md file (if available) or check the issues board. This project uses:

  • Poetry for dependency management.
  • Ruff for linting and formatting.
  • Pytest for testing.

Ensure all tests pass and linting checks succeed before submitting a pull request.

License

This project is licensed under the Prosperity Public License 3.0. See the LICENSE file for details.

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

coreason_constitution-0.2.0.tar.gz (18.8 kB view details)

Uploaded Source

Built Distribution

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

coreason_constitution-0.2.0-py3-none-any.whl (30.4 kB view details)

Uploaded Python 3

File details

Details for the file coreason_constitution-0.2.0.tar.gz.

File metadata

  • Download URL: coreason_constitution-0.2.0.tar.gz
  • Upload date:
  • Size: 18.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for coreason_constitution-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a979cc84cd1ade71c0bfa09a24b76e30b5660216dbd800c83e06d91ebafd80a3
MD5 5b074573d5f782a4eab5c91659f81fff
BLAKE2b-256 a0417d173a68c2614fb384d95fb8fa53aa52b6778f3aaa2930624ad8cb497842

See more details on using hashes here.

Provenance

The following attestation bundles were made for coreason_constitution-0.2.0.tar.gz:

Publisher: publish.yml on CoReason-AI/coreason-constitution

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file coreason_constitution-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for coreason_constitution-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4501090c8183cecde5151e4dc5c0e9db83318a40e418b228be8d8315f0299d57
MD5 ffee23ce1764af4a0d9dd623bc87e1a3
BLAKE2b-256 6459dc863f2a9521bc1ddda2ae5df531590d5b8fd2d44a02514ab5e37a8ef5a2

See more details on using hashes here.

Provenance

The following attestation bundles were made for coreason_constitution-0.2.0-py3-none-any.whl:

Publisher: publish.yml on CoReason-AI/coreason-constitution

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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