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 and Governance Microservice 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, run the server, use the CLI, and integrate the library.
  • Requirements: System and Python dependencies.
  • Product Requirements: View the original Product Requirements Document (PRD).

Governance Microservice (New)

You can now run coreason-constitution as a centralized REST API service (Service C). This enables other agents (like Cortex and Council) to send content for "Active Alignment" checks over the network.

Start the Server:

uvicorn coreason_constitution.server:app --host 0.0.0.0 --port 8000

See Usage for API details.

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.3.0.tar.gz (20.6 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.3.0-py3-none-any.whl (32.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: coreason_constitution-0.3.0.tar.gz
  • Upload date:
  • Size: 20.6 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.3.0.tar.gz
Algorithm Hash digest
SHA256 aee5cedc6051222d9ae9f376ec279f95df997a58d100c2bd687899455125ec20
MD5 7f5c9d61e9d29df29290ddd9587e98e7
BLAKE2b-256 e670316e35655f5c43134dd787be45886c7dc1801c79449bb180d893783e2eda

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for coreason_constitution-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16db49c88cf3139cb0e1a27250dbc54e7a5a43c549ce1197f8dd398517e33832
MD5 eea4916d3d38afdcd212b0d0e5d5b648
BLAKE2b-256 54daddb24c6def9daee56bf8bda4a7b8f8b31d01b1d913513d3372a4baadf5f0

See more details on using hashes here.

Provenance

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