Skip to main content

Stellarminds Open Compliance Protocol — defeasible logic engine, machine-readable regulations, and W3C Verifiable Credentials for autonomous compliance

Project description

Stellarminds Open Compliance Protocol -- a defeasible-logic compliance engine with machine-readable regulations and W3C Verifiable Credentials.

SM LOCP lets autonomous agents observe their operational state, check it against regulatory theories expressed in defeasible logic, and produce cryptographic compliance proofs as W3C Verifiable Credentials.

Features

  • Defeasible Logic Engine -- strict rules, defeasible rules, and defeaters with priority-based conflict resolution and skeptical reasoning.
  • Machine-Readable Regulations (MRR) -- JSON format for encoding regulatory conditions, applicability, and certification metadata.
  • W3C Verifiable Credentials -- Ed25519-signed compliance proofs with StatusList2021 revocation support.
  • Regime Providers -- pluggable provider interface so any regulatory domain can be modelled and composed.
  • JSON Theory Loader -- convert MRR policies into defeasible theories automatically.

Installation

pip install git+https://github.com/Sharathvc23/sm-locp.git

Quick Start

from sm_locp import (
    Literal,
    RegulatoryTheoryBuilder,
    VCGenerator,
    ComplianceCredentialSubject,
)

# Build a theory
theory = (
    RegulatoryTheoryBuilder("WAREHOUSE")
    .defeasible("D1", ["operator_certified"], "permitted", priority=5)
    .defeater("X1", ["cert_expired"], "~permitted")
    .fact("operator_certified")
    .build()
)

# Query
result = theory.query(Literal.parse("permitted"))
print(result.derived)  # True

# Generate a Verifiable Credential
generator = VCGenerator("did:web:example.com", private_key_b64="<base64-key>")
subject = ComplianceCredentialSubject(
    id="did:web:example.com",
    rule_id="D1",
    status="COMPLIANT",
    confidence=result.confidence,
)
credential = generator.generate(subject)
print(credential.to_json())

MRR Format

Policies are expressed as JSON with conditions, applicability filters, and certification metadata:

{
  "rule_id": "ws-forklift-cert",
  "agency": "WAREHOUSE_SAFETY",
  "title": "Forklift Operator Certification",
  "version": "1.0.0",
  "conditions": [
    {"field": "operator.certification_valid", "operator": "==", "value": true, "required": true},
    {"field": "operator.training_hours", "operator": ">=", "value": 40, "required": true}
  ],
  "certification": {"self_certifiable": true, "proof_format": "verifiable_credential", "ttl_seconds": 86400}
}

Verifiable Credentials

from sm_locp import MRRLoader, MRREvaluator, VCGenerator

loader = MRRLoader(policies_path="./policies", validate_schema=False)
evaluator = MRREvaluator(loader)
result = evaluator.evaluate("ws-forklift-cert", state)

generator = VCGenerator("did:web:issuer.example", private_key_b64)
credential = generator.generate_from_evaluation(result)

Custom Regime

from sm_locp import BaseRegimeProvider, DefeasibleTheory, RegulatoryTheoryBuilder

class MyRegime(BaseRegimeProvider):
    @property
    def regime_id(self) -> str:
        return "my-regime"

    @property
    def jurisdiction(self) -> str:
        return "US"

    @property
    def domain(self) -> str:
        return "environmental"

    def build_theory(self) -> DefeasibleTheory:
        return (
            RegulatoryTheoryBuilder("ENV")
            .strict("S1", ["emissions_exceeded"], "violation")
            .defeasible("D1", ["has_waiver"], "exempt", priority=5)
            .defeater("X1", ["waiver_expired"], "~exempt")
            .build()
        )

Related Packages

Package Description
sm-bridge NANDA-compatible registry endpoints, AgentFacts models, and delta sync
sm-airlock Attribute-level capability restriction for agent plugins
sm-enclave Speculative execution sandbox with staged side effects and commit/discard
sm-model-provenance Model identity, versioning, and provenance metadata
sm-model-governance Cryptographic model approval with Ed25519 signatures and quorum
sm-model-integrity-layer Policy verification, attestation, and integrity checks

License

MIT


First published: 2026-04-15 | Last modified: 2026-04-15

Personal research contributions aligned with Project NANDA standards. Stellarminds.ai

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

sm_locp-0.2.1.tar.gz (110.2 kB view details)

Uploaded Source

Built Distribution

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

sm_locp-0.2.1-py3-none-any.whl (45.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sm_locp-0.2.1.tar.gz
  • Upload date:
  • Size: 110.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sm_locp-0.2.1.tar.gz
Algorithm Hash digest
SHA256 d10e41b6fbbe6944d7aca89c809d6e46fa1a1760113b987c55d215acd54bceb2
MD5 7da90ad2d515f8096b8fbf939715df39
BLAKE2b-256 f22eeb7e74a0a2d3a65562420502b311a1171083c257d7388110b5a60191a60b

See more details on using hashes here.

Provenance

The following attestation bundles were made for sm_locp-0.2.1.tar.gz:

Publisher: release.yml on Sharathvc23/sm-locp

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

File details

Details for the file sm_locp-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: sm_locp-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 45.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sm_locp-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4be89a2a186fa3cec8c141fbc47fd565e544615be7f85c8fb35544e98d07be96
MD5 b570d89cc51d627799576b5ae6dccffe
BLAKE2b-256 fe68ad49b81d5b66f63ff86685a951bc1941c4c2339633c7788fc080d089310c

See more details on using hashes here.

Provenance

The following attestation bundles were made for sm_locp-0.2.1-py3-none-any.whl:

Publisher: release.yml on Sharathvc23/sm-locp

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