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.1.tar.gz (19.4 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.1-py3-none-any.whl (31.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coreason_constitution-0.2.1.tar.gz
  • Upload date:
  • Size: 19.4 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.1.tar.gz
Algorithm Hash digest
SHA256 abdaca295798073bf54b509d1ddfb50cd3a5634aea35724bed15bc7eaaca6c41
MD5 9eb2bb303a55674c80219a898f4726c2
BLAKE2b-256 196f93896f48156bf8c75b18f3b8d7bd56b84b72ad8d19856c0240103b2852bd

See more details on using hashes here.

Provenance

The following attestation bundles were made for coreason_constitution-0.2.1.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.1-py3-none-any.whl.

File metadata

File hashes

Hashes for coreason_constitution-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2e16444792df14df0124075d91c680eb3db24b2e2c975a4709a8b4b3951b27bd
MD5 4f9e175b82944683af7760c76e3d47b2
BLAKE2b-256 b25fe321ec75d0c453eecbd59f9ba6e44a3e28d218afad734cdf710fd46de1f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for coreason_constitution-0.2.1-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