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.
Metadata
Release files for subagent-delegation-contract 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| subagent_delegation_contract-0.1.0.tar.gz | 23.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| subagent_delegation_contract-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 37.5 kB
Release files / subagent_delegation_contract-0.1.0.tar.gz
| Download URL | subagent_delegation_contract-0.1.0.tar.gz |
|---|---|
| Size | 23.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f49cfa6661fa3ab9ff8c473c70d65fc08fa583c6a5b2a6d6718d563e63e41cab
|
|
BLAKE2b-256 checksum How to use checksums |
55aaff70a6a02fff358d0a8bd6a532da59d46b8ad6d17b15316c98ba10f49e24
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / subagent_delegation_contract-0.1.0-py3-none-any.whl
| Download URL | subagent_delegation_contract-0.1.0-py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b69a2a8754bb776c93ea715ba7f48880386d102a086629071e7bb1d2791f7bce
|
|
BLAKE2b-256 checksum How to use checksums |
1f591e5d5ebfba9fe2e9b5deea9b74df523302890427f5e36fac0ba045d41a57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|