Skip to main content

Explainable autonomous execution policy engine for ClawPolicy workflows

Project description

ClawPolicy

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

English (Primary) | Chinese (Simplified)

3.0.1 Highlights

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

Installation

PyPI

python3 -m pip install clawpolicy

Optional Phase 3 extras:

python3 -m pip install "clawpolicy[phase3]"

Source checkout

git clone https://github.com/DZMing/clawpolicy.git
cd clawpolicy
python3 -m pip install -e ".[dev]"

CLI Entry Points

  • clawpolicy: primary console entry point
  • python -m clawpolicy: module entry point

Initialize policy memory and inspect the current lifecycle state:

clawpolicy init
clawpolicy analyze
clawpolicy policy status
clawpolicy policy recent

init provisions:

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

Low-frequency supervision commands:

clawpolicy policy status
clawpolicy policy recent
clawpolicy policy risky
clawpolicy policy suspended
python -m clawpolicy policy status

Public Python API

The clawpolicy package exposes the supported policy-facing surface:

from clawpolicy 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 clawpolicy policy status
clawpolicy 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: 183
  • 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: 3.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

clawpolicy-3.0.1.tar.gz (221.7 kB view details)

Uploaded Source

Built Distribution

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

clawpolicy-3.0.1-py3-none-any.whl (90.5 kB view details)

Uploaded Python 3

File details

Details for the file clawpolicy-3.0.1.tar.gz.

File metadata

  • Download URL: clawpolicy-3.0.1.tar.gz
  • Upload date:
  • Size: 221.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for clawpolicy-3.0.1.tar.gz
Algorithm Hash digest
SHA256 376b08f80572d8c1896612d5363ba8474f5e531810ecb3e7da914d32cd1576bb
MD5 3ea4f2ee3f05c84d45ce6a3ba654e30c
BLAKE2b-256 f517fa6e3ab59177a654f0ab6e4f8f229fefb1bdb7e21dbccdd12542883de2d9

See more details on using hashes here.

File details

Details for the file clawpolicy-3.0.1-py3-none-any.whl.

File metadata

  • Download URL: clawpolicy-3.0.1-py3-none-any.whl
  • Upload date:
  • Size: 90.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for clawpolicy-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8f49aa1dabb89466b398af08160a240ec7b6c15368bda6966fd3d802d64a6942
MD5 396350e2f9ed66f91078cf33a1436980
BLAKE2b-256 bde221f1b291040e4f74c44bc57531de1aa9a43c9564c6269aadc560aa6742b3

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