Metadata-Version: 2.5
Name: mandate-gate
Version: 0.1.0
Summary: The gate core of the decision ledger Applied Identities is building: classify a tool call against a hash-pinned class map, extract bound argument values, ask the ledger in the fixed order (Passport first, ledger second; fail closed at M1 and above) and read its answers. No network, no credential, no argument value logged.
Project-URL: Repository, https://github.com/applied-identities/mandate-gate
License-Expression: Apache-2.0
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Requires-Python: >=3.11
Description-Content-Type: text/markdown

# mandate-gate (Python)

The gate core of the decision ledger Applied Identities is building. `import mandate_gate`. Standard library only; Python 3.11 or later.

The gate classifies a tool call against a hash-pinned class map, extracts the bound argument values, checks authority in the fixed order (Passport first, ledger second; fail closed at M1 and above), asks the ledger through a client the adapter supplies and reads its answers. It opens no connection, holds no credential and never logs an argument value. The contract is `SPEC.md` at the repository root; every behaviour is a vector in `vectors/`, run by this implementation and the JavaScript one alike.

```python
import mandate_gate as mg

class_map = mg.load_class_map(open("class_map.json", "rb").read(), pinned_sha256)
gate = mg.Gate(class_map, ledger_client, passport="hook")

g = gate.extract(tool_name, args, passport="granted")
if g["action"] == "govern":
    r = gate.reserve(g, transaction_id)
    ...  # settle or release after the act; escalate and bound_retry around an approval
```

Tests: `PYTHONPATH=src python -m unittest discover -s tests`.

Licence: Apache-2.0.
