payments-agent-audit 0.1.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- payments_agent_audit-0.1.4/LICENSE +21 -0
- payments_agent_audit-0.1.4/LICENSE-MIT +21 -0
- payments_agent_audit-0.1.4/PKG-INFO +311 -0
- payments_agent_audit-0.1.4/README.md +275 -0
- payments_agent_audit-0.1.4/pyproject.toml +106 -0
- payments_agent_audit-0.1.4/setup.cfg +4 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/__init__.py +19 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/governance/__init__.py +1 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/governance/audit_chain.py +396 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/governance/autonomy_ladder.py +374 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/governance/defcon.py +302 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/governance/effective_challenge_harness.py +240 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/governance/ledger_store.py +124 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/governance/ofac_screening.py +283 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/governance/rail_finality.py +139 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/governance/reg_e.py +160 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/governance/retention.py +51 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/governance/sar_workflow.py +211 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/governance/sovereign_veto.py +261 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/governance/sponsor_bank.py +114 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/governance/timestamp_source.py +48 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/governance/witness_anchor.py +56 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/py.typed +0 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/schemas/__init__.py +1 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit/schemas/audit_event.py +243 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit.egg-info/PKG-INFO +311 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit.egg-info/SOURCES.txt +40 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit.egg-info/dependency_links.txt +1 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit.egg-info/requires.txt +13 -0
- payments_agent_audit-0.1.4/src/payments_agent_audit.egg-info/top_level.txt +1 -0
- payments_agent_audit-0.1.4/tests/test_audit_chain.py +208 -0
- payments_agent_audit-0.1.4/tests/test_autonomy_ladder.py +256 -0
- payments_agent_audit-0.1.4/tests/test_defcon.py +145 -0
- payments_agent_audit-0.1.4/tests/test_effective_challenge.py +133 -0
- payments_agent_audit-0.1.4/tests/test_ofac_screening.py +153 -0
- payments_agent_audit-0.1.4/tests/test_rail_finality.py +47 -0
- payments_agent_audit-0.1.4/tests/test_reg_e.py +118 -0
- payments_agent_audit-0.1.4/tests/test_retention.py +35 -0
- payments_agent_audit-0.1.4/tests/test_sar_workflow.py +127 -0
- payments_agent_audit-0.1.4/tests/test_schema.py +102 -0
- payments_agent_audit-0.1.4/tests/test_sovereign_veto.py +109 -0
- payments_agent_audit-0.1.4/tests/test_sponsor_bank.py +56 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kunjar Bhaduri
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kunjar Bhaduri
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: payments-agent-audit
|
|
3
|
+
Version: 0.1.4
|
|
4
|
+
Summary: Governance patterns for autonomous AI agents in regulated payments
|
|
5
|
+
Author-email: Kunjar Bhaduri <130852583+linus10x@users.noreply.github.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/linus10x/payments-agent-audit
|
|
8
|
+
Project-URL: Repository, https://github.com/linus10x/payments-agent-audit
|
|
9
|
+
Keywords: ai-governance,autonomous-agents,payments,regulated-ai,ofac,bsa-aml,sanctions-screening,audit-trail,real-time-payments,human-in-the-loop
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Intended Audience :: Financial and Insurance Industry
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Topic :: Office/Business :: Financial
|
|
18
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
19
|
+
Classifier: Topic :: Security
|
|
20
|
+
Classifier: Typing :: Typed
|
|
21
|
+
Requires-Python: >=3.12
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
License-File: LICENSE
|
|
24
|
+
License-File: LICENSE-MIT
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: pytest>=8.3; extra == "dev"
|
|
27
|
+
Requires-Dist: pytest-cov>=6.0; extra == "dev"
|
|
28
|
+
Requires-Dist: mypy>=1.14; extra == "dev"
|
|
29
|
+
Requires-Dist: ruff>=0.8; extra == "dev"
|
|
30
|
+
Requires-Dist: pyyaml>=6.0; extra == "dev"
|
|
31
|
+
Provides-Extra: test-property
|
|
32
|
+
Requires-Dist: hypothesis>=6.115; extra == "test-property"
|
|
33
|
+
Provides-Extra: mutation
|
|
34
|
+
Requires-Dist: mutmut>=2.5; extra == "mutation"
|
|
35
|
+
Dynamic: license-file
|
|
36
|
+
|
|
37
|
+
# payments-agent-audit
|
|
38
|
+
|
|
39
|
+
**A runnable governance library for autonomous AI agents in regulated payments — where rail finality, OFAC strict liability, and Reg E meet AI deployment authority.**
|
|
40
|
+
|
|
41
|
+
[](https://github.com/linus10x/payments-agent-audit/actions/workflows/ci.yml)
|
|
42
|
+
[](#install)
|
|
43
|
+
[](#install)
|
|
44
|
+
[](LICENSE-MIT)
|
|
45
|
+
[](pyproject.toml)
|
|
46
|
+
[](https://doi.org/10.5281/zenodo.20592773)
|
|
47
|
+
[-1b2a4a)](https://github.com/linus10x/autonomy-ladder-libraries)
|
|
48
|
+
|
|
49
|
+
> **What this is:** a reference library that encodes the [Autonomy Ladder](https://autonomy-ladder.io) (A0→A4) for autonomous payments agents — finality as a first-class input, a non-overridable sovereign veto, a hash-chain audit ledger, and a real OFAC screening control — as runnable, tested Python. If an agent can move money on an instant rail, a control that fires *after* authorization governs nothing; the money is already gone.
|
|
50
|
+
> **What this is not:** a deployed production control, a sanctions-list feed, or legal advice. It ships no SDN data and runs in no institution's payment flow.
|
|
51
|
+
> **Who this is for:** a payments / fintech compliance or risk lead deciding how far to trust an AI agent on FedNow / RTP / ACH / card rails — or a lab or cloud-provider FSI applied lead who needs a concrete, falsifiable model of deployment-authority governance under strict-liability regimes.
|
|
52
|
+
|
|
53
|
+
## 30-second tour
|
|
54
|
+
|
|
55
|
+
- **Verticals:** payments (part of the six-library [Autonomy Ladder family](https://github.com/linus10x/autonomy-ladder-libraries)).
|
|
56
|
+
- **Decision classes:** the **rail-finality / irreversibility gate** (AL-PROBE-06) and **OFAC screen → human disposition** — both real, tested controls.
|
|
57
|
+
- **Regulators / rules encoded:** OFAC sanctions (strict liability), Regulation E error resolution (12 CFR 1005.11), BSA/AML SAR timeliness + Travel Rule, and rail finality (FedNow Reg J 12 CFR 210 Subpart C · RTP irrevocability · Nacha return windows).
|
|
58
|
+
- **Assurance:** **183 tests · 98.97% coverage** · 11 AL-PROBE functions · a 23-mutant author audit (run manually) · zero runtime dependencies, typed, MIT.
|
|
59
|
+
- **Golden corpus — 10 real, primary-sourced matters of record:** Tango Card (OFAC 2022) · MoneyGram (OFAC 2021) · CoinList (OFAC 2023) · TD Bank (FinCEN 2024) · USAA FSB (FinCEN 2022) · Paxful (FinCEN 2025) · Block/Cash App (CFPB 2025) · OFAC Instant-Payment guidance (2022) · Synapse/Evolve (Bankr. + Fed 2024) · Coinbase (NYDFS 2023).
|
|
60
|
+
|
|
61
|
+
## Read me first
|
|
62
|
+
|
|
63
|
+
1. **The test that carries the thesis** — `tests/adversarial/` (AL-PROBE-06, the irreversibility gate) and the OFAC screen test. Each rule is a runnable, falsifiable check.
|
|
64
|
+
2. **[`WORKED_EXAMPLE.md`](WORKED_EXAMPLE.md)** — the full irreversible-rail decision class walked end to end: an agent attempts an autonomous instant-rail payment, the gate refuses promotion, the OFAC screen holds a near-match, and both land on the tamper-evident ledger.
|
|
65
|
+
3. **[autonomy-ladder.io](https://autonomy-ladder.io)** — the framework and whitepaper behind all six libraries.
|
|
66
|
+
|
|
67
|
+
## Install
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
pip install -e ".[dev,test-property]"
|
|
71
|
+
PYTHONPATH=src python3 examples/instant_rail_promotion_refusal.py
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Why this exists for frontier autonomy stacks
|
|
77
|
+
|
|
78
|
+
The controls in this library are **domain-agnostic**. The DEFCON state machine, the non-overridable **sovereign veto** (a separate-process control the agent cannot switch off), the **hash-chain audit ledger** (it detects tampering within its trust boundary), the **hard envelopes with mechanical escalation**, the **sampled-review tripwires**, and **monitor-led promotion** were forged in real multi-agent production systems under consequence — and they apply directly to any high-stakes coordinated autonomy (vehicles, robots, agent swarms) where *invisible promotion* or *cascade failure* is unacceptable. The decision class is a parameter: this repo encodes it for **payments — OFAC screening, Reg E, rail-finality / irreversibility**, but the same A0→A4 deployment-authority structure lifts into any decision class without inheriting financial-services assumptions.
|
|
79
|
+
|
|
80
|
+
- **Framework + whitepaper:** [autonomy-ladder.io](https://autonomy-ladder.io)
|
|
81
|
+
- **Non-financial demo (under 60s):** [`finserv-agent-audit/examples/agent_coordination`](https://github.com/linus10x/finserv-agent-audit/tree/main/examples/agent_coordination) — the same veto / envelope / audit-chain / demotion primitives on a generic agent swarm.
|
|
82
|
+
|
|
83
|
+
> **For reviewers & safety teams:** every control here is falsifiable — the test suite (183 tests · 98.97% coverage · a real OFAC screening control) turns each rule into a runnable check, and the veto and ledger are infrastructure with operational properties (separate process boundary, distinct credentials, a gate the agent cannot reach; write-once retention). These are reference implementations for adoption, not deployed production controls.
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
## The worked example, in 10 lines of output
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
=== Post-hoc-veto-only on FedNow ===
|
|
90
|
+
granted = False
|
|
91
|
+
irreversibility_refusal = True
|
|
92
|
+
- IRREVERSIBILITY REFUSAL: program 'fednow-payout-bot' moves money on FedNow
|
|
93
|
+
Service (instant credit) (final-by-rule), and its only controls act after
|
|
94
|
+
authorization (['post_hoc_veto']). ...
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
A FedNow instant-payout bot is **refused** A3 promotion — not because autonomy
|
|
98
|
+
is forbidden, but because its only control acts *after* an irreversible credit
|
|
99
|
+
settles. Add a pre-authorization control and the same program is promotable.
|
|
100
|
+
The full walkthrough is in [`WORKED_EXAMPLE.md`](WORKED_EXAMPLE.md); two runnable
|
|
101
|
+
scripts ship under [`examples/`](examples/):
|
|
102
|
+
[`instant_rail_promotion_refusal.py`](examples/instant_rail_promotion_refusal.py)
|
|
103
|
+
(AL-PROBE-06) and [`ofac_screen_and_disposition.py`](examples/ofac_screen_and_disposition.py)
|
|
104
|
+
(OFAC screen → human disposition).
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Why payments needs its own library
|
|
109
|
+
|
|
110
|
+
The single property that makes payments different is **reversibility**. An
|
|
111
|
+
instant-rail credit — FedNow (12 CFR Part 210, Subpart C) or RTP (TCH Operating
|
|
112
|
+
Rules) — is *final and irrevocable the moment it settles*. A control that fires
|
|
113
|
+
*after* authorization governs nothing on such a rail: the money is already gone.
|
|
114
|
+
ACH (the Nacha Operating Rules) is different — it has a return/reversal window, so
|
|
115
|
+
a post-hoc control still has something to act on. Card rails carry chargeback
|
|
116
|
+
rights. **A governance framework that treats all rails the same is wrong about
|
|
117
|
+
the one thing that matters most.**
|
|
118
|
+
|
|
119
|
+
This library makes finality a first-class input and refuses to promote an
|
|
120
|
+
irreversible-write program to a high autonomy level on a post-hoc veto alone.
|
|
121
|
+
|
|
122
|
+
## Implemented vs. Patterned (read this first)
|
|
123
|
+
|
|
124
|
+
This project is honest about what is code and what is a documented pattern. Public
|
|
125
|
+
claims match implemented reality.
|
|
126
|
+
|
|
127
|
+
| Capability | Status | Notes |
|
|
128
|
+
|:---|:---|:---|
|
|
129
|
+
| Autonomy-ladder promotion gate (A0–A4) + irreversibility refusal | **Implemented** | `autonomy_ladder.py`; tested, incl. AL-PROBE-06 |
|
|
130
|
+
| Sovereign veto (fail-closed production mode, authenticated principal) | **Implemented** | `sovereign_veto.py` |
|
|
131
|
+
| Hash-chain audit ledger (branched genesis seed; tamper + regeneration detection) | **Implemented** | `audit_chain.py` |
|
|
132
|
+
| DEFCON risk-state machine (transition-direction guard) | **Implemented** | `defcon.py`; thresholds are illustrative |
|
|
133
|
+
| Effective-challenge harness (rejects self-challenge; independence attestation) | **Implemented** | `effective_challenge_harness.py` |
|
|
134
|
+
| **OFAC sanctions screening** (fuzzy match + hit disposition) | **Implemented** | `ofac_screening.py`; runs against a **pluggable list — no list is bundled** |
|
|
135
|
+
| BSA/AML SAR timeliness + Travel Rule + alert-disposition | **Implemented** | `sar_workflow.py` |
|
|
136
|
+
| Regulation E error resolution | **Implemented** | `reg_e.py` |
|
|
137
|
+
| Sponsor-bank / BaaS oversight | **Implemented** | `sponsor_bank.py` |
|
|
138
|
+
| Rail-finality classification (FedNow/RTP/Fedwire/ACH/card) | **Implemented** | `rail_finality.py` |
|
|
139
|
+
| External witness anchoring (OpenTimestamps / Rekor) | **Patterned** | `WitnessRegister` is an interface; deployer wires the register |
|
|
140
|
+
| RFC 3161 trusted timestamps | **Patterned** | `TimestampSource` interface; `LocalClock` ships, TSA is a deployer integration |
|
|
141
|
+
|
|
142
|
+
The five primitives are **real, tested reference patterns** — not a deployed
|
|
143
|
+
control wrapped in an org assurance apparatus. Use them as reference IP for
|
|
144
|
+
adoption, never as "a control operating in production."
|
|
145
|
+
|
|
146
|
+
## The five primitives (built to the corrected standard)
|
|
147
|
+
|
|
148
|
+
1. **Level-gate (A0→A4)** — refuses promotion when lower-level controls are
|
|
149
|
+
unmet, and in production mode requires **independent attestation** (second-line
|
|
150
|
+
MRM / third-line audit) of each criterion rather than trusting caller-asserted
|
|
151
|
+
booleans. It also runs the **irreversibility gate** below.
|
|
152
|
+
2. **Sovereign veto** — a wired `Authorizer` is **mandatory** in production mode
|
|
153
|
+
(refuses to start without one); the operator who clears a veto is an
|
|
154
|
+
**authenticated principal** resolved from a credential, never a free string; an
|
|
155
|
+
agent cannot clear its own veto.
|
|
156
|
+
3. **Hash-chain ledger** — the genesis seed is **branched**: a deployer-keyed
|
|
157
|
+
hardened chain and a legacy chain *both* verify True, while in-place tampering
|
|
158
|
+
and end-to-end regeneration are both detected (the latter via an external
|
|
159
|
+
witness anchor, which is mandatory in production mode).
|
|
160
|
+
4. **DEFCON state machine** — a **transition-direction guard**: the automatic
|
|
161
|
+
path cannot de-escalate out of HALT, and a manual override out of HALT may only
|
|
162
|
+
step to the adjacent level, so a recovering program passes back through the
|
|
163
|
+
review states instead of snapping fully open.
|
|
164
|
+
5. **Effective-challenge harness** — rejects a challenger that **is** the primary
|
|
165
|
+
(a self-challenge is a rubber stamp), and records an operator-supplied
|
|
166
|
+
**independence attestation** (who chose the challenger, when, and whether it is
|
|
167
|
+
the same owner / vendor family / prompt template). A non-independent challenger
|
|
168
|
+
cannot yield a clean `accept_primary`.
|
|
169
|
+
|
|
170
|
+
## AL-PROBE-06 — the irreversibility gate (new to this library)
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
from payments_agent_audit.governance.audit_chain import AuditChain
|
|
174
|
+
from payments_agent_audit.governance.autonomy_ladder import (
|
|
175
|
+
AutonomyLadderGate, AutonomyTier, PromotionRequest, Attestation,
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
chain = AuditChain(deployer_id="acme-pay-prod")
|
|
179
|
+
gate = AutonomyLadderGate(audit_chain=chain, mode="production")
|
|
180
|
+
|
|
181
|
+
# The four lower-gate criteria, each independently attested (2nd-line MRM /
|
|
182
|
+
# 3rd-line audit) — so the irreversibility gate is the SOLE cause of refusal:
|
|
183
|
+
lower_gate_attestations = tuple(
|
|
184
|
+
Attestation(c, satisfied=True, attested_by="mrm-lead", attester_role="second_line_mrm",
|
|
185
|
+
attested_at="2026-06-05T00:00:00+00:00", evidence_ref=f"evidence://{c}")
|
|
186
|
+
for c in ("sovereign_veto_load_tested", "audit_ledger_min_window",
|
|
187
|
+
"shadow_mode_min_window", "circuit_breaker_recent")
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
# A FedNow instant-payout bot whose ONLY control is a post-hoc veto.
|
|
191
|
+
request = PromotionRequest(
|
|
192
|
+
target_tier=AutonomyTier.A3_SUPERVISED_AUTONOMOUS,
|
|
193
|
+
decision_class="instant_payout",
|
|
194
|
+
program_id="fednow-payout-bot",
|
|
195
|
+
moves_money=True,
|
|
196
|
+
rail_id="fednow", # final-by-rule
|
|
197
|
+
controls=frozenset({"post_hoc_veto"}), # acts AFTER authorization
|
|
198
|
+
attestations=lower_gate_attestations, # every LOWER gate is satisfied
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
decision = gate.evaluate(request)
|
|
202
|
+
assert decision.granted is False # REFUSED
|
|
203
|
+
assert decision.irreversibility_refusal is True # ...on irreversibility grounds
|
|
204
|
+
# The refusal is recorded to the ledger as IRREVERSIBLE_PROMOTION_REFUSED.
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Add a genuine **pre-authorization** control (pre-auth OFAC screening, a pre-send
|
|
208
|
+
amount/velocity envelope, dual-control release, confirmation-of-payee) and the
|
|
209
|
+
same program is promotable. The gate blocks post-hoc-only autonomy on irreversible
|
|
210
|
+
rails — not autonomy itself. **ACH is modeled non-final separately**: the
|
|
211
|
+
instant-rail finality rule does not apply to it.
|
|
212
|
+
|
|
213
|
+
## OFAC screening (a real control, not a doc)
|
|
214
|
+
|
|
215
|
+
```python
|
|
216
|
+
from payments_agent_audit.governance.ofac_screening import OFACScreener, Disposition
|
|
217
|
+
|
|
218
|
+
# You supply the list — the OFAC SDN/consolidated list changes constantly and
|
|
219
|
+
# nothing is bundled. Implement SanctionsListProvider against your live feed.
|
|
220
|
+
screener = OFACScreener(list_provider=my_sdn_feed, audit_chain=chain)
|
|
221
|
+
|
|
222
|
+
result = screener.screen("Vladimir Smirnoff") # fuzzy / word-order aware
|
|
223
|
+
if result.is_held: # strict liability: do not proceed
|
|
224
|
+
# An agent CANNOT clear its own hit. A human dispositions it:
|
|
225
|
+
screener.disposition(result, Disposition.FALSE_POSITIVE,
|
|
226
|
+
operator_id="analyst-jane", reason="DOB mismatch")
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Install & test
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
pip install -e ".[dev,test-property]"
|
|
233
|
+
pytest tests/ --cov=src/payments_agent_audit --cov-fail-under=90
|
|
234
|
+
pytest tests/adversarial/ -v # the six AL-PROBES (11 test functions)
|
|
235
|
+
PYTHONPATH=src python3 scripts/mutation_pass.py # surgical mutation pass (manual)
|
|
236
|
+
|
|
237
|
+
# Runnable examples:
|
|
238
|
+
PYTHONPATH=src python3 examples/instant_rail_promotion_refusal.py
|
|
239
|
+
PYTHONPATH=src python3 examples/ofac_screen_and_disposition.py
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
As of this build: **183 tests pass at 98.97% coverage.** CI (`ci.yml`) runs the
|
|
243
|
+
test + coverage gate, the AL-PROBES, ruff, and `mypy --strict` on Python 3.12 and
|
|
244
|
+
3.13. Four assurance tiers back the claims, each a discrete count:
|
|
245
|
+
|
|
246
|
+
- **Property tier** — a Hypothesis suite generating up to 2,300 cases per run
|
|
247
|
+
(a ceiling, not a floor) across the ledger, finality, gate, veto, and OFAC invariants.
|
|
248
|
+
- **Golden-corpus tier** — 10 real, primary-sourced enforcement / litigation /
|
|
249
|
+
incident matters as parametrized fixtures (each carries a primary-source URL).
|
|
250
|
+
- **Adversarial tier** — the six AL-PROBES, 11 committed test functions under
|
|
251
|
+
`tests/adversarial/`.
|
|
252
|
+
- **Mutation tier** — a surgical pass that kills all 23 targeted mutants of the
|
|
253
|
+
load-bearing invariants. It is an **author audit run manually**
|
|
254
|
+
(`scripts/mutation_pass.py`), not wired into CI.
|
|
255
|
+
|
|
256
|
+
See `docs/` for the full assurance map.
|
|
257
|
+
|
|
258
|
+
## Documentation
|
|
259
|
+
|
|
260
|
+
- `ARCHITECTURE.md` — the control/audit planes and the Protocol seams
|
|
261
|
+
- `ASSURANCE-GUIDE.md` — the assurance-catalog map and the AL-PROBES
|
|
262
|
+
- `FAILURE-MODES.md` — adversarial failure modes and what is/isn't defended
|
|
263
|
+
- `LIMITATIONS.md` — known boundaries and non-scope
|
|
264
|
+
- `DISCLAIMER.md` — reference IP, not legal advice
|
|
265
|
+
- `docs/research/primary_source_research_2026-06-05.md` — reg + corpus provenance
|
|
266
|
+
- `CITATION.cff` — how to cite; DOI plan in `docs/DOI_PLAN.md`
|
|
267
|
+
|
|
268
|
+
## Regulatory anchors
|
|
269
|
+
|
|
270
|
+
Anchors are sourced to primary materials and staged for the canonical regulatory
|
|
271
|
+
list (see `docs/research/`). Confirm any statute/CFR citation against the cited
|
|
272
|
+
primary source before relying on it; two anchors carry open items pending counsel
|
|
273
|
+
(the exact RTP irrevocability section and the Nacha reversal-window rule number) —
|
|
274
|
+
see `LIMITATIONS.md`. **This is reference IP, not legal advice** — sanctions
|
|
275
|
+
screening calibration, SAR disposition, and Reg E adjudication are the deploying
|
|
276
|
+
institution's compliance function's responsibility.
|
|
277
|
+
|
|
278
|
+
## License
|
|
279
|
+
|
|
280
|
+
MIT. See `LICENSE-MIT`.
|
|
281
|
+
|
|
282
|
+
> Patterns extracted from a private quantitative program; the source
|
|
283
|
+
> program operates in paper-trading Phase 0 — no live capital has been deployed.
|
|
284
|
+
> Reference patterns and characterizations are summaries, not legal advice —
|
|
285
|
+
> consult qualified counsel and qualified compliance practitioners.
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## Part of the Autonomy Ladder™ family
|
|
290
|
+
|
|
291
|
+
[-1b2a4a)](https://github.com/linus10x/autonomy-ladder-libraries)
|
|
292
|
+
|
|
293
|
+
Six co-equal regulated-vertical reference libraries implementing one framework —
|
|
294
|
+
the **Autonomy Ladder** (A0→A4, every rung demotable). They share the same five
|
|
295
|
+
governance primitives, the same MIT license, and the same evidence discipline
|
|
296
|
+
(zero runtime deps · `mypy --strict` · SHA-pinned CI · golden corpora of real,
|
|
297
|
+
primary-sourced enforcement actions). The decision class changes by vertical;
|
|
298
|
+
the rungs and controls do not. **Start at the family landing page:
|
|
299
|
+
[`autonomy-ladder-libraries`](https://github.com/linus10x/autonomy-ladder-libraries).**
|
|
300
|
+
This library's primitives are mapped to A0→A4 in [`AUTONOMY_LADDER.md`](AUTONOMY_LADDER.md).
|
|
301
|
+
|
|
302
|
+
| Vertical | Library | DOI |
|
|
303
|
+
|---|---|---|
|
|
304
|
+
| Cross-vertical financial services | [`finserv-agent-audit`](https://github.com/linus10x/finserv-agent-audit) | [10.5281/zenodo.20434570](https://doi.org/10.5281/zenodo.20434570) |
|
|
305
|
+
| Banking (model risk · ECOA/Reg B · BSA/AML/OFAC) | [`banking-agent-audit`](https://github.com/linus10x/banking-agent-audit) | [10.5281/zenodo.20564584](https://doi.org/10.5281/zenodo.20564584) |
|
|
306
|
+
| Payments (OFAC · Reg E · rail finality) | **[`payments-agent-audit`](https://github.com/linus10x/payments-agent-audit)** | [10.5281/zenodo.20592773](https://doi.org/10.5281/zenodo.20592773) |
|
|
307
|
+
| Health-insurance payer (UM · prior auth · appeals) | [`payer-agent-audit`](https://github.com/linus10x/payer-agent-audit) | [10.5281/zenodo.20564377](https://doi.org/10.5281/zenodo.20564377) |
|
|
308
|
+
| SEC-registered investment advisers (Advisers Act §206) | [`private-capital-agent-audit`](https://github.com/linus10x/private-capital-agent-audit) | [10.5281/zenodo.20564496](https://doi.org/10.5281/zenodo.20564496) |
|
|
309
|
+
| Commercial real estate | [`cre-agent-audit`](https://github.com/linus10x/cre-agent-audit) | [10.5281/zenodo.20437081](https://doi.org/10.5281/zenodo.20437081) |
|
|
310
|
+
|
|
311
|
+
**Framework + whitepaper:** [autonomy-ladder.io](https://autonomy-ladder.io).
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
# payments-agent-audit
|
|
2
|
+
|
|
3
|
+
**A runnable governance library for autonomous AI agents in regulated payments — where rail finality, OFAC strict liability, and Reg E meet AI deployment authority.**
|
|
4
|
+
|
|
5
|
+
[](https://github.com/linus10x/payments-agent-audit/actions/workflows/ci.yml)
|
|
6
|
+
[](#install)
|
|
7
|
+
[](#install)
|
|
8
|
+
[](LICENSE-MIT)
|
|
9
|
+
[](pyproject.toml)
|
|
10
|
+
[](https://doi.org/10.5281/zenodo.20592773)
|
|
11
|
+
[-1b2a4a)](https://github.com/linus10x/autonomy-ladder-libraries)
|
|
12
|
+
|
|
13
|
+
> **What this is:** a reference library that encodes the [Autonomy Ladder](https://autonomy-ladder.io) (A0→A4) for autonomous payments agents — finality as a first-class input, a non-overridable sovereign veto, a hash-chain audit ledger, and a real OFAC screening control — as runnable, tested Python. If an agent can move money on an instant rail, a control that fires *after* authorization governs nothing; the money is already gone.
|
|
14
|
+
> **What this is not:** a deployed production control, a sanctions-list feed, or legal advice. It ships no SDN data and runs in no institution's payment flow.
|
|
15
|
+
> **Who this is for:** a payments / fintech compliance or risk lead deciding how far to trust an AI agent on FedNow / RTP / ACH / card rails — or a lab or cloud-provider FSI applied lead who needs a concrete, falsifiable model of deployment-authority governance under strict-liability regimes.
|
|
16
|
+
|
|
17
|
+
## 30-second tour
|
|
18
|
+
|
|
19
|
+
- **Verticals:** payments (part of the six-library [Autonomy Ladder family](https://github.com/linus10x/autonomy-ladder-libraries)).
|
|
20
|
+
- **Decision classes:** the **rail-finality / irreversibility gate** (AL-PROBE-06) and **OFAC screen → human disposition** — both real, tested controls.
|
|
21
|
+
- **Regulators / rules encoded:** OFAC sanctions (strict liability), Regulation E error resolution (12 CFR 1005.11), BSA/AML SAR timeliness + Travel Rule, and rail finality (FedNow Reg J 12 CFR 210 Subpart C · RTP irrevocability · Nacha return windows).
|
|
22
|
+
- **Assurance:** **183 tests · 98.97% coverage** · 11 AL-PROBE functions · a 23-mutant author audit (run manually) · zero runtime dependencies, typed, MIT.
|
|
23
|
+
- **Golden corpus — 10 real, primary-sourced matters of record:** Tango Card (OFAC 2022) · MoneyGram (OFAC 2021) · CoinList (OFAC 2023) · TD Bank (FinCEN 2024) · USAA FSB (FinCEN 2022) · Paxful (FinCEN 2025) · Block/Cash App (CFPB 2025) · OFAC Instant-Payment guidance (2022) · Synapse/Evolve (Bankr. + Fed 2024) · Coinbase (NYDFS 2023).
|
|
24
|
+
|
|
25
|
+
## Read me first
|
|
26
|
+
|
|
27
|
+
1. **The test that carries the thesis** — `tests/adversarial/` (AL-PROBE-06, the irreversibility gate) and the OFAC screen test. Each rule is a runnable, falsifiable check.
|
|
28
|
+
2. **[`WORKED_EXAMPLE.md`](WORKED_EXAMPLE.md)** — the full irreversible-rail decision class walked end to end: an agent attempts an autonomous instant-rail payment, the gate refuses promotion, the OFAC screen holds a near-match, and both land on the tamper-evident ledger.
|
|
29
|
+
3. **[autonomy-ladder.io](https://autonomy-ladder.io)** — the framework and whitepaper behind all six libraries.
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install -e ".[dev,test-property]"
|
|
35
|
+
PYTHONPATH=src python3 examples/instant_rail_promotion_refusal.py
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Why this exists for frontier autonomy stacks
|
|
41
|
+
|
|
42
|
+
The controls in this library are **domain-agnostic**. The DEFCON state machine, the non-overridable **sovereign veto** (a separate-process control the agent cannot switch off), the **hash-chain audit ledger** (it detects tampering within its trust boundary), the **hard envelopes with mechanical escalation**, the **sampled-review tripwires**, and **monitor-led promotion** were forged in real multi-agent production systems under consequence — and they apply directly to any high-stakes coordinated autonomy (vehicles, robots, agent swarms) where *invisible promotion* or *cascade failure* is unacceptable. The decision class is a parameter: this repo encodes it for **payments — OFAC screening, Reg E, rail-finality / irreversibility**, but the same A0→A4 deployment-authority structure lifts into any decision class without inheriting financial-services assumptions.
|
|
43
|
+
|
|
44
|
+
- **Framework + whitepaper:** [autonomy-ladder.io](https://autonomy-ladder.io)
|
|
45
|
+
- **Non-financial demo (under 60s):** [`finserv-agent-audit/examples/agent_coordination`](https://github.com/linus10x/finserv-agent-audit/tree/main/examples/agent_coordination) — the same veto / envelope / audit-chain / demotion primitives on a generic agent swarm.
|
|
46
|
+
|
|
47
|
+
> **For reviewers & safety teams:** every control here is falsifiable — the test suite (183 tests · 98.97% coverage · a real OFAC screening control) turns each rule into a runnable check, and the veto and ledger are infrastructure with operational properties (separate process boundary, distinct credentials, a gate the agent cannot reach; write-once retention). These are reference implementations for adoption, not deployed production controls.
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
## The worked example, in 10 lines of output
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
=== Post-hoc-veto-only on FedNow ===
|
|
54
|
+
granted = False
|
|
55
|
+
irreversibility_refusal = True
|
|
56
|
+
- IRREVERSIBILITY REFUSAL: program 'fednow-payout-bot' moves money on FedNow
|
|
57
|
+
Service (instant credit) (final-by-rule), and its only controls act after
|
|
58
|
+
authorization (['post_hoc_veto']). ...
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
A FedNow instant-payout bot is **refused** A3 promotion — not because autonomy
|
|
62
|
+
is forbidden, but because its only control acts *after* an irreversible credit
|
|
63
|
+
settles. Add a pre-authorization control and the same program is promotable.
|
|
64
|
+
The full walkthrough is in [`WORKED_EXAMPLE.md`](WORKED_EXAMPLE.md); two runnable
|
|
65
|
+
scripts ship under [`examples/`](examples/):
|
|
66
|
+
[`instant_rail_promotion_refusal.py`](examples/instant_rail_promotion_refusal.py)
|
|
67
|
+
(AL-PROBE-06) and [`ofac_screen_and_disposition.py`](examples/ofac_screen_and_disposition.py)
|
|
68
|
+
(OFAC screen → human disposition).
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Why payments needs its own library
|
|
73
|
+
|
|
74
|
+
The single property that makes payments different is **reversibility**. An
|
|
75
|
+
instant-rail credit — FedNow (12 CFR Part 210, Subpart C) or RTP (TCH Operating
|
|
76
|
+
Rules) — is *final and irrevocable the moment it settles*. A control that fires
|
|
77
|
+
*after* authorization governs nothing on such a rail: the money is already gone.
|
|
78
|
+
ACH (the Nacha Operating Rules) is different — it has a return/reversal window, so
|
|
79
|
+
a post-hoc control still has something to act on. Card rails carry chargeback
|
|
80
|
+
rights. **A governance framework that treats all rails the same is wrong about
|
|
81
|
+
the one thing that matters most.**
|
|
82
|
+
|
|
83
|
+
This library makes finality a first-class input and refuses to promote an
|
|
84
|
+
irreversible-write program to a high autonomy level on a post-hoc veto alone.
|
|
85
|
+
|
|
86
|
+
## Implemented vs. Patterned (read this first)
|
|
87
|
+
|
|
88
|
+
This project is honest about what is code and what is a documented pattern. Public
|
|
89
|
+
claims match implemented reality.
|
|
90
|
+
|
|
91
|
+
| Capability | Status | Notes |
|
|
92
|
+
|:---|:---|:---|
|
|
93
|
+
| Autonomy-ladder promotion gate (A0–A4) + irreversibility refusal | **Implemented** | `autonomy_ladder.py`; tested, incl. AL-PROBE-06 |
|
|
94
|
+
| Sovereign veto (fail-closed production mode, authenticated principal) | **Implemented** | `sovereign_veto.py` |
|
|
95
|
+
| Hash-chain audit ledger (branched genesis seed; tamper + regeneration detection) | **Implemented** | `audit_chain.py` |
|
|
96
|
+
| DEFCON risk-state machine (transition-direction guard) | **Implemented** | `defcon.py`; thresholds are illustrative |
|
|
97
|
+
| Effective-challenge harness (rejects self-challenge; independence attestation) | **Implemented** | `effective_challenge_harness.py` |
|
|
98
|
+
| **OFAC sanctions screening** (fuzzy match + hit disposition) | **Implemented** | `ofac_screening.py`; runs against a **pluggable list — no list is bundled** |
|
|
99
|
+
| BSA/AML SAR timeliness + Travel Rule + alert-disposition | **Implemented** | `sar_workflow.py` |
|
|
100
|
+
| Regulation E error resolution | **Implemented** | `reg_e.py` |
|
|
101
|
+
| Sponsor-bank / BaaS oversight | **Implemented** | `sponsor_bank.py` |
|
|
102
|
+
| Rail-finality classification (FedNow/RTP/Fedwire/ACH/card) | **Implemented** | `rail_finality.py` |
|
|
103
|
+
| External witness anchoring (OpenTimestamps / Rekor) | **Patterned** | `WitnessRegister` is an interface; deployer wires the register |
|
|
104
|
+
| RFC 3161 trusted timestamps | **Patterned** | `TimestampSource` interface; `LocalClock` ships, TSA is a deployer integration |
|
|
105
|
+
|
|
106
|
+
The five primitives are **real, tested reference patterns** — not a deployed
|
|
107
|
+
control wrapped in an org assurance apparatus. Use them as reference IP for
|
|
108
|
+
adoption, never as "a control operating in production."
|
|
109
|
+
|
|
110
|
+
## The five primitives (built to the corrected standard)
|
|
111
|
+
|
|
112
|
+
1. **Level-gate (A0→A4)** — refuses promotion when lower-level controls are
|
|
113
|
+
unmet, and in production mode requires **independent attestation** (second-line
|
|
114
|
+
MRM / third-line audit) of each criterion rather than trusting caller-asserted
|
|
115
|
+
booleans. It also runs the **irreversibility gate** below.
|
|
116
|
+
2. **Sovereign veto** — a wired `Authorizer` is **mandatory** in production mode
|
|
117
|
+
(refuses to start without one); the operator who clears a veto is an
|
|
118
|
+
**authenticated principal** resolved from a credential, never a free string; an
|
|
119
|
+
agent cannot clear its own veto.
|
|
120
|
+
3. **Hash-chain ledger** — the genesis seed is **branched**: a deployer-keyed
|
|
121
|
+
hardened chain and a legacy chain *both* verify True, while in-place tampering
|
|
122
|
+
and end-to-end regeneration are both detected (the latter via an external
|
|
123
|
+
witness anchor, which is mandatory in production mode).
|
|
124
|
+
4. **DEFCON state machine** — a **transition-direction guard**: the automatic
|
|
125
|
+
path cannot de-escalate out of HALT, and a manual override out of HALT may only
|
|
126
|
+
step to the adjacent level, so a recovering program passes back through the
|
|
127
|
+
review states instead of snapping fully open.
|
|
128
|
+
5. **Effective-challenge harness** — rejects a challenger that **is** the primary
|
|
129
|
+
(a self-challenge is a rubber stamp), and records an operator-supplied
|
|
130
|
+
**independence attestation** (who chose the challenger, when, and whether it is
|
|
131
|
+
the same owner / vendor family / prompt template). A non-independent challenger
|
|
132
|
+
cannot yield a clean `accept_primary`.
|
|
133
|
+
|
|
134
|
+
## AL-PROBE-06 — the irreversibility gate (new to this library)
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
from payments_agent_audit.governance.audit_chain import AuditChain
|
|
138
|
+
from payments_agent_audit.governance.autonomy_ladder import (
|
|
139
|
+
AutonomyLadderGate, AutonomyTier, PromotionRequest, Attestation,
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
chain = AuditChain(deployer_id="acme-pay-prod")
|
|
143
|
+
gate = AutonomyLadderGate(audit_chain=chain, mode="production")
|
|
144
|
+
|
|
145
|
+
# The four lower-gate criteria, each independently attested (2nd-line MRM /
|
|
146
|
+
# 3rd-line audit) — so the irreversibility gate is the SOLE cause of refusal:
|
|
147
|
+
lower_gate_attestations = tuple(
|
|
148
|
+
Attestation(c, satisfied=True, attested_by="mrm-lead", attester_role="second_line_mrm",
|
|
149
|
+
attested_at="2026-06-05T00:00:00+00:00", evidence_ref=f"evidence://{c}")
|
|
150
|
+
for c in ("sovereign_veto_load_tested", "audit_ledger_min_window",
|
|
151
|
+
"shadow_mode_min_window", "circuit_breaker_recent")
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
# A FedNow instant-payout bot whose ONLY control is a post-hoc veto.
|
|
155
|
+
request = PromotionRequest(
|
|
156
|
+
target_tier=AutonomyTier.A3_SUPERVISED_AUTONOMOUS,
|
|
157
|
+
decision_class="instant_payout",
|
|
158
|
+
program_id="fednow-payout-bot",
|
|
159
|
+
moves_money=True,
|
|
160
|
+
rail_id="fednow", # final-by-rule
|
|
161
|
+
controls=frozenset({"post_hoc_veto"}), # acts AFTER authorization
|
|
162
|
+
attestations=lower_gate_attestations, # every LOWER gate is satisfied
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
decision = gate.evaluate(request)
|
|
166
|
+
assert decision.granted is False # REFUSED
|
|
167
|
+
assert decision.irreversibility_refusal is True # ...on irreversibility grounds
|
|
168
|
+
# The refusal is recorded to the ledger as IRREVERSIBLE_PROMOTION_REFUSED.
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Add a genuine **pre-authorization** control (pre-auth OFAC screening, a pre-send
|
|
172
|
+
amount/velocity envelope, dual-control release, confirmation-of-payee) and the
|
|
173
|
+
same program is promotable. The gate blocks post-hoc-only autonomy on irreversible
|
|
174
|
+
rails — not autonomy itself. **ACH is modeled non-final separately**: the
|
|
175
|
+
instant-rail finality rule does not apply to it.
|
|
176
|
+
|
|
177
|
+
## OFAC screening (a real control, not a doc)
|
|
178
|
+
|
|
179
|
+
```python
|
|
180
|
+
from payments_agent_audit.governance.ofac_screening import OFACScreener, Disposition
|
|
181
|
+
|
|
182
|
+
# You supply the list — the OFAC SDN/consolidated list changes constantly and
|
|
183
|
+
# nothing is bundled. Implement SanctionsListProvider against your live feed.
|
|
184
|
+
screener = OFACScreener(list_provider=my_sdn_feed, audit_chain=chain)
|
|
185
|
+
|
|
186
|
+
result = screener.screen("Vladimir Smirnoff") # fuzzy / word-order aware
|
|
187
|
+
if result.is_held: # strict liability: do not proceed
|
|
188
|
+
# An agent CANNOT clear its own hit. A human dispositions it:
|
|
189
|
+
screener.disposition(result, Disposition.FALSE_POSITIVE,
|
|
190
|
+
operator_id="analyst-jane", reason="DOB mismatch")
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Install & test
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
pip install -e ".[dev,test-property]"
|
|
197
|
+
pytest tests/ --cov=src/payments_agent_audit --cov-fail-under=90
|
|
198
|
+
pytest tests/adversarial/ -v # the six AL-PROBES (11 test functions)
|
|
199
|
+
PYTHONPATH=src python3 scripts/mutation_pass.py # surgical mutation pass (manual)
|
|
200
|
+
|
|
201
|
+
# Runnable examples:
|
|
202
|
+
PYTHONPATH=src python3 examples/instant_rail_promotion_refusal.py
|
|
203
|
+
PYTHONPATH=src python3 examples/ofac_screen_and_disposition.py
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
As of this build: **183 tests pass at 98.97% coverage.** CI (`ci.yml`) runs the
|
|
207
|
+
test + coverage gate, the AL-PROBES, ruff, and `mypy --strict` on Python 3.12 and
|
|
208
|
+
3.13. Four assurance tiers back the claims, each a discrete count:
|
|
209
|
+
|
|
210
|
+
- **Property tier** — a Hypothesis suite generating up to 2,300 cases per run
|
|
211
|
+
(a ceiling, not a floor) across the ledger, finality, gate, veto, and OFAC invariants.
|
|
212
|
+
- **Golden-corpus tier** — 10 real, primary-sourced enforcement / litigation /
|
|
213
|
+
incident matters as parametrized fixtures (each carries a primary-source URL).
|
|
214
|
+
- **Adversarial tier** — the six AL-PROBES, 11 committed test functions under
|
|
215
|
+
`tests/adversarial/`.
|
|
216
|
+
- **Mutation tier** — a surgical pass that kills all 23 targeted mutants of the
|
|
217
|
+
load-bearing invariants. It is an **author audit run manually**
|
|
218
|
+
(`scripts/mutation_pass.py`), not wired into CI.
|
|
219
|
+
|
|
220
|
+
See `docs/` for the full assurance map.
|
|
221
|
+
|
|
222
|
+
## Documentation
|
|
223
|
+
|
|
224
|
+
- `ARCHITECTURE.md` — the control/audit planes and the Protocol seams
|
|
225
|
+
- `ASSURANCE-GUIDE.md` — the assurance-catalog map and the AL-PROBES
|
|
226
|
+
- `FAILURE-MODES.md` — adversarial failure modes and what is/isn't defended
|
|
227
|
+
- `LIMITATIONS.md` — known boundaries and non-scope
|
|
228
|
+
- `DISCLAIMER.md` — reference IP, not legal advice
|
|
229
|
+
- `docs/research/primary_source_research_2026-06-05.md` — reg + corpus provenance
|
|
230
|
+
- `CITATION.cff` — how to cite; DOI plan in `docs/DOI_PLAN.md`
|
|
231
|
+
|
|
232
|
+
## Regulatory anchors
|
|
233
|
+
|
|
234
|
+
Anchors are sourced to primary materials and staged for the canonical regulatory
|
|
235
|
+
list (see `docs/research/`). Confirm any statute/CFR citation against the cited
|
|
236
|
+
primary source before relying on it; two anchors carry open items pending counsel
|
|
237
|
+
(the exact RTP irrevocability section and the Nacha reversal-window rule number) —
|
|
238
|
+
see `LIMITATIONS.md`. **This is reference IP, not legal advice** — sanctions
|
|
239
|
+
screening calibration, SAR disposition, and Reg E adjudication are the deploying
|
|
240
|
+
institution's compliance function's responsibility.
|
|
241
|
+
|
|
242
|
+
## License
|
|
243
|
+
|
|
244
|
+
MIT. See `LICENSE-MIT`.
|
|
245
|
+
|
|
246
|
+
> Patterns extracted from a private quantitative program; the source
|
|
247
|
+
> program operates in paper-trading Phase 0 — no live capital has been deployed.
|
|
248
|
+
> Reference patterns and characterizations are summaries, not legal advice —
|
|
249
|
+
> consult qualified counsel and qualified compliance practitioners.
|
|
250
|
+
|
|
251
|
+
---
|
|
252
|
+
|
|
253
|
+
## Part of the Autonomy Ladder™ family
|
|
254
|
+
|
|
255
|
+
[-1b2a4a)](https://github.com/linus10x/autonomy-ladder-libraries)
|
|
256
|
+
|
|
257
|
+
Six co-equal regulated-vertical reference libraries implementing one framework —
|
|
258
|
+
the **Autonomy Ladder** (A0→A4, every rung demotable). They share the same five
|
|
259
|
+
governance primitives, the same MIT license, and the same evidence discipline
|
|
260
|
+
(zero runtime deps · `mypy --strict` · SHA-pinned CI · golden corpora of real,
|
|
261
|
+
primary-sourced enforcement actions). The decision class changes by vertical;
|
|
262
|
+
the rungs and controls do not. **Start at the family landing page:
|
|
263
|
+
[`autonomy-ladder-libraries`](https://github.com/linus10x/autonomy-ladder-libraries).**
|
|
264
|
+
This library's primitives are mapped to A0→A4 in [`AUTONOMY_LADDER.md`](AUTONOMY_LADDER.md).
|
|
265
|
+
|
|
266
|
+
| Vertical | Library | DOI |
|
|
267
|
+
|---|---|---|
|
|
268
|
+
| Cross-vertical financial services | [`finserv-agent-audit`](https://github.com/linus10x/finserv-agent-audit) | [10.5281/zenodo.20434570](https://doi.org/10.5281/zenodo.20434570) |
|
|
269
|
+
| Banking (model risk · ECOA/Reg B · BSA/AML/OFAC) | [`banking-agent-audit`](https://github.com/linus10x/banking-agent-audit) | [10.5281/zenodo.20564584](https://doi.org/10.5281/zenodo.20564584) |
|
|
270
|
+
| Payments (OFAC · Reg E · rail finality) | **[`payments-agent-audit`](https://github.com/linus10x/payments-agent-audit)** | [10.5281/zenodo.20592773](https://doi.org/10.5281/zenodo.20592773) |
|
|
271
|
+
| Health-insurance payer (UM · prior auth · appeals) | [`payer-agent-audit`](https://github.com/linus10x/payer-agent-audit) | [10.5281/zenodo.20564377](https://doi.org/10.5281/zenodo.20564377) |
|
|
272
|
+
| SEC-registered investment advisers (Advisers Act §206) | [`private-capital-agent-audit`](https://github.com/linus10x/private-capital-agent-audit) | [10.5281/zenodo.20564496](https://doi.org/10.5281/zenodo.20564496) |
|
|
273
|
+
| Commercial real estate | [`cre-agent-audit`](https://github.com/linus10x/cre-agent-audit) | [10.5281/zenodo.20437081](https://doi.org/10.5281/zenodo.20437081) |
|
|
274
|
+
|
|
275
|
+
**Framework + whitepaper:** [autonomy-ladder.io](https://autonomy-ladder.io).
|