Skip to main content

Explainable autonomous execution policy engine for OpenClaw workflows

Project description

OpenClaw Alignment

Explainable autonomous execution policy engine for low-touch, auditable agent execution

English (Primary) | Chinese (Simplified)

2.0.0 Highlights

  • Policy lifecycle: hint -> candidate -> confirmed -> suspended -> archived
  • Canonical local storage: .openclaw_memory/policy/
  • Policy-first supervision CLI: openclaw-align policy ...
  • Stable Python API for confirmation, policy storage, and Markdown conversion/export
  • Optional Phase 3 extras remain available through openclaw-alignment[phase3]

Installation

PyPI

python3 -m pip install openclaw-alignment

Optional Phase 3 extras:

python3 -m pip install "openclaw-alignment[phase3]"

Source checkout

git clone https://github.com/412984588/openclaw-alignment.git
cd openclaw-alignment
python3 -m pip install -e ".[dev]"

CLI Entry Points

  • openclaw-align: primary console entry point
  • openclaw-alignment: compatibility console alias
  • python -m openclaw_align: module entry point

Initialize policy memory and inspect the current lifecycle state:

openclaw-align init
openclaw-align analyze
openclaw-align policy status
openclaw-align policy recent

init provisions:

  • .openclaw_memory/policy/rules.json
  • .openclaw_memory/policy/playbooks.json
  • .openclaw_memory/policy/policy_events.jsonl
  • .openclaw_memory/USER.md
  • .openclaw_memory/SOUL.md
  • .openclaw_memory/AGENTS.md

Low-frequency supervision commands:

openclaw-align policy status
openclaw-align policy recent
openclaw-align policy risky
openclaw-align policy suspended
python -m openclaw_align policy status

Public Python API

The lib package exposes the supported policy-facing surface:

from lib import (
    ConfirmationAPI,
    PolicyEvent,
    PolicyStore,
    Playbook,
    Rule,
    MarkdownToPolicyConverter,
    PolicyToMarkdownExporter,
    create_api,
)
  • ConfirmationAPI / create_api: runtime confirmation and feedback loop integration
  • PolicyStore: canonical policy asset persistence
  • Rule, Playbook, PolicyEvent: public policy models
  • MarkdownToPolicyConverter: convert Markdown memory into policy assets
  • PolicyToMarkdownExporter: export canonical policy assets back to Markdown

Verification

python3 -m pytest tests/ -v
python3 scripts/check_docs_consistency.py
python3 -m ruff check lib tests scripts
python3 -m openclaw_align policy status
openclaw-align policy status

Core Modules

  • lib/policy_models.py: canonical Rule, Playbook, and PolicyEvent models
  • lib/policy_store.py: canonical PolicyStore and policy asset persistence
  • lib/policy_resolution.py: scope inference and precedence resolution
  • lib/confirmation.py: runtime truth loop, event recording, and feedback application
  • lib/promotion.py: promotion gates for candidate -> confirmed
  • lib/demotion.py: suspension, reactivation, and archive gates
  • lib/learner.py: weak-hint derivation and strong-evidence aggregation
  • lib/api.py: stable confirmation API surface
  • lib/cli.py: initialization, status, supervision, export, and inspection commands
  • lib/environment.py: interaction environment
    • State: State data class (17 dimensions)
    • Action: Action data class (11 dimensions)
  • lib/contracts.py: single source of truth for state and action dimensions

Optional Phase 3 Modules

  • lib/distributed_trainer.py
  • lib/hyperparameter_tuner.py
  • lib/monitoring.py
  • lib/performance_optimizer.py

Test Coverage

  • Total Tests: 169
  • Local Validation: python3 -m pytest tests/ -v
  • Coverage Areas: policy lifecycle promotion and suspension, scope precedence, public surface hard cut, canonical policy storage, CLI supervision, confirmation policy, RL core, optional Phase 3 modules, and docs/contract drift guards

Release and Versioning

  • Versioning: SemVer
  • Current release line: 2.x
  • Release runbook: RELEASING.md / RELEASING.zh-CN.md
  • Changelog: CHANGELOG.md

Documentation

  • Architecture: docs/architecture.md
  • Reward model: docs/reward-model.md
  • Configuration: docs/configuration.md
  • Optional dependencies: docs/phase3-optional-deps.md
  • Contributing: CONTRIBUTING.md
  • Security: SECURITY.md
  • Support: SUPPORT.md

License

MIT

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

openclaw_alignment-2.0.0.tar.gz (219.0 kB view details)

Uploaded Source

Built Distribution

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

openclaw_alignment-2.0.0-py3-none-any.whl (90.1 kB view details)

Uploaded Python 3

File details

Details for the file openclaw_alignment-2.0.0.tar.gz.

File metadata

  • Download URL: openclaw_alignment-2.0.0.tar.gz
  • Upload date:
  • Size: 219.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for openclaw_alignment-2.0.0.tar.gz
Algorithm Hash digest
SHA256 10c8140bde4167a1e30e9522e8d1d78b163040d88af0904e5f089654841224d8
MD5 1470c97603b9e465140ef461bd3e9189
BLAKE2b-256 a7dc90a9cd1f7b6a1d3c1b8e3be30eabe38777506d70738477ebc9b13ab66f57

See more details on using hashes here.

File details

Details for the file openclaw_alignment-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for openclaw_alignment-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ee2cff49c913d22440634969546a2fe76533eb01469cca4aae1c3a91ee97f81f
MD5 aaa91d8621bc1b8271b805b8a866489a
BLAKE2b-256 90e9c57b4ae507cb5d4c87b76ec16f113a83764a22cb210f77579aa102ceb966

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