matrx-mandate-scan
The ONE Mandate reference scanner. It finds every place code reaches for platform intelligence — through a Mandate carrier or around it — reports the result to the database in one frozen contract, and screams (never blocks) when something is unresolved, unmeasured, or bypassing the mandate system.
Built for the Mandate Declaration & Usage Reporting program
(common-docs/projects/mandate-declaration-reporting/), lane L2.
Install / run
# from any repo, no checkout needed
uvx --from matrx-mandate-scan==0.1.0 matrx-mandate-scan check
# inside the aidream workspace (vendored via [tool.uv.sources])
uv run matrx-mandate-scan scan --root aidream --root packages/matrx-ai
Commands
| Command | What it does |
|---|---|
scan |
Contract-v1 JSON on stdout, the red human report on stderr. |
report |
scan, then submit through mandate.submit_scan_report(jsonb) and file every red finding into ops.system_error (source_app='mandate-scan'). |
check |
The release-path command: scan + report + reconcile. |
explain <file:line> |
What the scanner sees at one location, and why. |
--self-test |
The built-in RED→GREEN fixture suite. Runs from a uvx install. |
Every command exits 0 unless --strict is passed. That is ruling D23:
a mandate check is loud and non-blocking; --strict exists for humans and for
the scheduled remediation task, never for a release script.
What counts as a reference
Classification is by carrier, never by the word or the path. A dotted
string is a mandate key only where a carrier puts it — so consumerId = "extend.chat" is not a reference and never becomes one.
Python carriers:
declare_mandate/declare_generated_mandate/declare_mandated_agent→declarationdeclare_mandate_family(prefix, members=...)→family_declaration, oneconstantper resolvable member,dynamic_familywhen the iterable is computedresolve_mandate→resolution;run_mandate→executionrun_mandated(Cls)/Cls.run()→execution- a
NamedAgentsubclassmandate_key(includingtype(name, (NamedAgent,), {...})) →declaration seed_agent_id=<uuid>inside adeclare_*→seed_holder@mandate_passthrough/MandateKeyParam→passthrough, with the caller attributed when it lives in the same module
Config carriers (JSON / YAML / TOML) — the property name is the carrier:
mandate_key, mandateKey, defaultMandateKey, fallback_mandate_key.
Anything else that merely looks key-shaped is unclassified and advisory.
Keys resolve through literals, module and function constants (UPPER or not),
attribute constants, f-strings, + concatenations, ternaries (both branches
become real references), tuple/list loop members, aliases, literal-container
subscripts, and one level of analyzable module-local wrapper function.
An argument that resolves to none of those → finding UNRESOLVED_KEY, plus
an unresolved-flagged reference: D21 says unreachable is a flag, never a
filter, so nothing is ever dropped from the inventory.
Bypass detection and the ratchet
Importing a provider SDK (anthropic, openai, groq, google.genai,
google.generativeai, litellm, xai, ollama, cohere, mistralai) or
naming a provider host, anywhere outside
packages/matrx-ai/matrx_ai/providers/** and the one D10-approved module
(conversation_labeler.py), is a bypass reference. The exact standalone
RAG default embedding adapter (packages/matrx-rag/matrx_rag/embeddings.py) is
also an approved provider adapter: it is injected through EmbeddingProvider,
does not select a Mandate holder, and is independently ratcheted by
scripts/check_raw_llm_clients.py. No broader matrx-rag exemption exists.
- in the
--baselinefile →CONVERSION_PENDING(flagconversion_pending) - not in it →
NEW_BYPASS(D20: no new ones) - a dynamic import that hides its target →
UNRESOLVED_IMPORT
--write-baseline regenerates the file and refuses to write a larger one.
No entry in the baseline is an approved class; every one is a defect awaiting
conversion.
Coverage is mandatory output
Every file is scanned or listed with a reason (generated, test_fixture,
parse_error, unsupported_language). Any parse_error makes the package
verification_status = incomplete and files an UNMEASURED finding.
Reference identity
sha256(repo_slug · package_path · file_path · symbol · occurrence_n · reference_type · mandate_key_or_prefix).
repo_slug is always the repo the scan ran in, resolved from
git remote get-url origin through the platform.repo mirror in
matrx_mandate_scan/repo.py. An unknown remote is UNMEASURED, never a
guessed slug — a folder name is not a repo identity.
Boundaries
Per docs/packages/PACKAGE_DOCTRINE.md, this package imports neither
aidream nor matrx-orm. It carries the AST walkers that used to live in
scripts/audit_mandate_wiring.py and
aidream/services/mandates/code_truth.py; those two modules now import them
from here, so there is exactly one definition of "what a carrier looks like".
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 matrx_mandate_scan-0.1.3.tar.gz.
File metadata
- Download URL: matrx_mandate_scan-0.1.3.tar.gz
- Upload date:
- Size: 84.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
883a92c548f29ccc4a1f4af1dbef55fb6186176421d1bf266463d8975e42420b
|
|
| MD5 |
a88ad50d1bb317d29abfa2fd24d803df
|
|
| BLAKE2b-256 |
0c6c7f9287e2b6bad6904f8adf490e8ab2a2ba29adf94d7ee3ba3eef291f8cd0
|
Provenance
The following attestation bundles were made for matrx_mandate_scan-0.1.3.tar.gz:
Publisher:
publish-package.yml on AI-Matrix-Engine/aidream
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
matrx_mandate_scan-0.1.3.tar.gz -
Subject digest:
883a92c548f29ccc4a1f4af1dbef55fb6186176421d1bf266463d8975e42420b - Sigstore transparency entry: 2795395166
- Sigstore integration time:
-
Permalink:
AI-Matrix-Engine/aidream@db06ae61d0bfa4e24836dc715617d4ca34a22c69 -
Branch / Tag:
refs/tags/matrx-mandate-scan/v0.1.3 - Owner: https://github.com/AI-Matrix-Engine
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-package.yml@db06ae61d0bfa4e24836dc715617d4ca34a22c69 -
Trigger Event:
push
-
Statement type:
File details
Details for the file matrx_mandate_scan-0.1.3-py3-none-any.whl.
File metadata
- Download URL: matrx_mandate_scan-0.1.3-py3-none-any.whl
- Upload date:
- Size: 79.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
808b2f16b655345242de763ac179a02092bf818c1e9ef906a4e6c9be32721c57
|
|
| MD5 |
f01c4b5284ee35ceaa7375e690451b2d
|
|
| BLAKE2b-256 |
83c3be4f1eceff7a674e5373e5880986a3ea6a053944e855e4ee4d800e32d584
|
Provenance
The following attestation bundles were made for matrx_mandate_scan-0.1.3-py3-none-any.whl:
Publisher:
publish-package.yml on AI-Matrix-Engine/aidream
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
matrx_mandate_scan-0.1.3-py3-none-any.whl -
Subject digest:
808b2f16b655345242de763ac179a02092bf818c1e9ef906a4e6c9be32721c57 - Sigstore transparency entry: 2795395173
- Sigstore integration time:
-
Permalink:
AI-Matrix-Engine/aidream@db06ae61d0bfa4e24836dc715617d4ca34a22c69 -
Branch / Tag:
refs/tags/matrx-mandate-scan/v0.1.3 - Owner: https://github.com/AI-Matrix-Engine
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-package.yml@db06ae61d0bfa4e24836dc715617d4ca34a22c69 -
Trigger Event:
push
-
Statement type: