Reference runner for Command Scope Contract
Project description
CSC — Command Scope Contract
CSC is a protocol for bounded shell and CLI execution by AI agents.
CSC is complementary to MCP, not a replacement for it.
It exists to remove ambient authority from agentic execution.
Instead of giving an agent raw shell access, CSC requires the agent to submit a structured command contract that declares:
- what it wants to run
- why it wants to run it
- where it wants to run it
- what it needs to read
- what it may write
- whether it needs network access
- whether it needs secrets
- what kind of effect it may cause
- how long it may run
A trusted policy layer evaluates the contract. If allowed, a constrained executor runs it and emits a verifiable, signed receipt.
Why CSC exists
Shell is useful because it is universal, composable, and token-efficient.
Shell is dangerous because it often carries too much implicit power.
CSC keeps the flexibility of shell while making scope, policy, and execution evidence explicit.
Execution model
agent -> command contract -> policy gate -> constrained executor -> execution receipt
Status
v0.1 — hardened mode available
The reference runner implements the full CSC v0.1 protocol:
- Stage 1a — Protocol complete: spec frozen, conformance suite, policy schema with structured reason codes, receipt field semantics
- Stage 1b — Hardened defaults: fail-closed executor, path enforcement, resource limits, capped output capture, adversarial test suite
- Stage 2 — First hardened mode: Linux sandbox (bubblewrap + setpriv + prlimit), Ed25519 receipt signing, approval artifacts with replay prevention, end-to-end integration tests
- Stage 3 — Production candidate (in progress): release infrastructure, CI gates, security process, pilot validation
Bounded production claim
CSC hardened mode is safe enough for bounded production use in Linux-based, filesystem-bounded local/CI execution workflows without network access, under the documented trust assumptions and deployment constraints.
See docs/deployment-modes.md for security claims by mode and docs/production-readiness-gate.md for the formal release gate.
Deployment modes
| Mode | Platform | Security boundary | Receipt signing |
|---|---|---|---|
| Local | Any | Pre-launch validation only | Optional |
| Hardened | Linux only | Kernel-enforced (bwrap namespaces) | Mandatory |
Local mode is for development, testing, and demos. Hardened mode is for CI/CD pipelines and production-like workflows where execution integrity matters.
See docs/deployment-modes.md for full details.
Design goals
- Keep shell composability.
- Remove raw arbitrary shell by default.
- Make intent and scope explicit before execution.
- Let trusted policy decide.
- Emit signed receipts for audit and provenance.
- Enforce boundaries with the kernel, not just Python.
- Stay small enough to implement and adopt quickly.
Non-goals
CSC does not attempt to replace:
- container isolation (CSC uses it as the enforcement layer)
- IAM
- workflow engines
- semantic validation of task correctness
- prompt injection defenses at every layer
CSC is an execution-boundary protocol.
Core objects
- CommandContract — what the agent wants to run
- PolicyDecision — whether it may run (with structured reason codes)
- ExecutionReceipt — what actually happened (signed in hardened mode)
- ApprovalArtifact — human authorization for sensitive operations
v0.1 rules
- argv arrays only
- no raw shell strings
- no
bash -lc,sh -c,eval,python -c,node -eby default - explicit read/write/network/env/secret scope
- default deny on omitted capabilities
- bounded runtime
- signed receipts in hardened mode
Quickstart
pip install -e ".[dev]"
# Check a contract against a policy (no execution)
csc check examples/contracts/git-status.json examples/policies/dev-readonly.yaml
# Run a contract (local mode)
csc run examples/contracts/git-status.json examples/policies/dev-readonly.yaml
# Run in hardened mode (Linux, requires bwrap/setpriv/prlimit)
csc run contract.json policy.yaml \
--mode hardened \
--sign --signing-key key.pem --key-id prod-01
# Verify a signed receipt
csc verify-receipt receipt.json --public-key pub.pem --key-id prod-01
Documentation
- Spec v0.1 — protocol specification
- Deployment Modes — local vs hardened, security claims
- Key Management — signing key lifecycle
- Threat Model — threat classes and mitigations
- Security Targets — claims matrix by mode
- Production Readiness Gate — formal release checklist
- Policy Packs — organizational policy conventions
- Reason Codes — structured decision reason registry
- Security Policy — vulnerability reporting
Contributing
Contributions welcome. See CONTRIBUTING.md and start with docs/spec-v0.1.md and schemas/.
License
Apache-2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file csc_runner-0.5.0.tar.gz.
File metadata
- Download URL: csc_runner-0.5.0.tar.gz
- Upload date:
- Size: 123.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e482c4db1d41b072eb013da05addf1ea38381701e2abb0116f8921a140c8a207
|
|
| MD5 |
1ddc00e882b0374eb4384353a3edbbd5
|
|
| BLAKE2b-256 |
46bc47541d972bb8246ef5d4c04225aa31909b4c336db601d7783ca593a7b7d0
|
Provenance
The following attestation bundles were made for csc_runner-0.5.0.tar.gz:
Publisher:
release.yml on madeinplutofabio/command-scope-contract
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
csc_runner-0.5.0.tar.gz -
Subject digest:
e482c4db1d41b072eb013da05addf1ea38381701e2abb0116f8921a140c8a207 - Sigstore transparency entry: 1173120650
- Sigstore integration time:
-
Permalink:
madeinplutofabio/command-scope-contract@2ea68ba0da695d841157d205aa2d02be056cd083 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/madeinplutofabio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2ea68ba0da695d841157d205aa2d02be056cd083 -
Trigger Event:
push
-
Statement type:
File details
Details for the file csc_runner-0.5.0-py3-none-any.whl.
File metadata
- Download URL: csc_runner-0.5.0-py3-none-any.whl
- Upload date:
- Size: 38.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d78990540c114d881a21a910720e8f6e34a55f46c88d7c8c6625ec370e351a5e
|
|
| MD5 |
c176ed662d200b8d1003be23238cc441
|
|
| BLAKE2b-256 |
114a946069e25ef55d133e82e9a355b7e12e7a96abd49934a61ec956410351b1
|
Provenance
The following attestation bundles were made for csc_runner-0.5.0-py3-none-any.whl:
Publisher:
release.yml on madeinplutofabio/command-scope-contract
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
csc_runner-0.5.0-py3-none-any.whl -
Subject digest:
d78990540c114d881a21a910720e8f6e34a55f46c88d7c8c6625ec370e351a5e - Sigstore transparency entry: 1173120675
- Sigstore integration time:
-
Permalink:
madeinplutofabio/command-scope-contract@2ea68ba0da695d841157d205aa2d02be056cd083 -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/madeinplutofabio
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2ea68ba0da695d841157d205aa2d02be056cd083 -
Trigger Event:
push
-
Statement type: