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
Metadata
Release files for sm-locp 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sm_locp-0.2.1.tar.gz | 110.2 kB | With provenance | Details for sm_locp-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sm_locp-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for sm_locp-0.2.1-py3-none-any.whl |
Total release size: 156.1 kB
Release files / sm_locp-0.2.1.tar.gz
| Download URL | sm_locp-0.2.1.tar.gz |
|---|---|
| Size | 110.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d10e41b6fbbe6944d7aca89c809d6e46fa1a1760113b987c55d215acd54bceb2
|
|
BLAKE2b-256 checksum How to use checksums |
f22eeb7e74a0a2d3a65562420502b311a1171083c257d7388110b5a60191a60b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.
Transparency logRelease files / sm_locp-0.2.1-py3-none-any.whl
| Download URL | sm_locp-0.2.1-py3-none-any.whl |
|---|---|
| Size | 45.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4be89a2a186fa3cec8c141fbc47fd565e544615be7f85c8fb35544e98d07be96
|
|
BLAKE2b-256 checksum How to use checksums |
fe68ad49b81d5b66f63ff86685a951bc1941c4c2339633c7788fc080d089310c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.
Transparency logSecurity for sm-locp 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for sm_locp-0.2.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.