Skip to main content

subagent-delegation-contract

Signed, zero-dependency delegation contracts for preserving parent-to-subagent task fidelity in Python coding workflows.

Install

python -m venv .venv
. .venv/bin/activate
pip install -e .

Quick start

subagent-delegation-contract encode --task "refactor auth" \
  --scope-read "src/auth/**" --scope-write "src/auth/**" \
  --scope-forbid "*.env" --secret "$DELEGATION_SECRET" --output contract.json
subagent-delegation-contract bind --contract contract.json --subagent-id child-001 --secret "$DELEGATION_SECRET"
subagent-delegation-contract verify --contract contract.json --secret "$DELEGATION_SECRET"
subagent-delegation-contract validate pre --contract contract.json --tool write_file \
  --args '{"path":"src/auth/login.py"}' --secret "$DELEGATION_SECRET"

The package also supports python -m subagent_delegation_contract. Legacy plugin hook shims remain in plugins/subagent-delegation-contract/scripts/ and translate --mode=create|bind|verify|decode|pre|post|verify-output|audit to the package CLI.

Scope glob syntax

* and ? match within one path component; ** crosses directory separators. A bare directory pattern covers its descendants. scope.forbid takes precedence over read and write permissions. Empty read/write lists mean that mode is unconstrained.

Drift detection

validate_pre blocks forbidden tools and arguments and out-of-scope reads/writes. validate_post checks forbidden result content and output-schema types. validate_output checks the final payload. Missing and extra schema fields generate warnings; declared type mismatches are denied. JSONL audit records and a blast-radius report are available through --audit-log and audit.

Limitations

  • Enforcement is in-process; callers must invoke the checks at tool boundaries.
  • There is no remote attestation or distributed trust mechanism.
  • HMAC-SHA256 uses a symmetric secret: both signer and verifier must know it; it is not asymmetric signing.
  • This release does not provide JavaScript runtime bindings.

License

MIT; see LICENSE.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

subagent_delegation_contract-0.1.0.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

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

subagent_delegation_contract-0.1.0-py3-none-any.whl (14.2 kB view details)

Uploaded Python 3

File details

Details for the file subagent_delegation_contract-0.1.0.tar.gz.

File metadata

File hashes

Hashes for subagent_delegation_contract-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f49cfa6661fa3ab9ff8c473c70d65fc08fa583c6a5b2a6d6718d563e63e41cab
MD5 c110f1d658bbbf282c94f6830f2ee7e2
BLAKE2b-256 55aaff70a6a02fff358d0a8bd6a532da59d46b8ad6d17b15316c98ba10f49e24

See more details on using hashes here.

File details

Details for the file subagent_delegation_contract-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for subagent_delegation_contract-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b69a2a8754bb776c93ea715ba7f48880386d102a086629071e7bb1d2791f7bce
MD5 dec3b35cc75bfbad0b2d738edc90785e
BLAKE2b-256 1f591e5d5ebfba9fe2e9b5deea9b74df523302890427f5e36fac0ba045d41a57

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 Sentry Error logging StatusPage Status page