Status: Phases 0–6 built + the ops console; running locally. Two domains on one engine: AML (Elliptic++ + real OFAC) and fraud (IEEE-CIS, 590k card transactions). Data layers with sanity gates, frozen temporal splits per domain, 18 deterministic tools (58 tests, hand-computed fixtures), per-domain high-recall XGBoost alerting (fraud dev queue: 50,009 alerts @ 92.3% FP), the full LangGraph loop with HITL interrupt/resume, citation-checked reports, cross-case Reflexion memory, domain-parametric prompts, and the SSE ops console (
make serve).First fraud dev eval (20 cases, gpt-4o): cleared 9 of 18 false positives (50% review load cut) with 0 of 2 true positives cleared; overturn correctness 9/9; step recall 0.917, zero wasted calls; zero hallucinated claims in 105 report sentences. Dev numbers, small n, reported as counts. Next (CLAUDE.md §11): robustness (§5), security + red-team (§4), the Regulator Pack — then the ONE-SHOT holdout.
Dev-split calibration story (3 real gpt-4o eval runs, 20 cases each):
run scorer FP load cut TPs wrongly cleared overturn correctness 1 v1 92.9% (13/14) 1/6 ✗ 92.9% 2 v2 (pass-through blocks clear) 0% ✗ 0/4 ✓ — (rubber stamp) 3 v3 (measured) 38.9% (7/18) 0/2 ✓ 100% (7/7) Run 1's miss (a 98.7% pass-through relay) motivated a pass-through guard; run 2 showed it destroyed all clearing value; measurement on train labels revealed the ratio fires on 96.9% of ALL Bitcoin transactions (lift 1.03x) — a plausible intuition, falsified by data, demoted to descriptive evidence (tools/typologies.py preserves the story). Across all 60 real investigations: step recall 0.99–1.00, zero wasted calls, zero budget breaches, zero hallucinated claims in 264 report sentences. Dev numbers, small n, reported as counts. Cloud deploy + the ONE-SHOT holdout run remain, deliberately last.
An ML model (XGBoost) flags suspicious entities — with the ~90%+ false-positive rate real AML systems live with. FraudAnalyst's LLM agent adjudicates each alert the way a compliance analyst does — pulling transaction neighborhoods, measuring proximity to known illicit activity, screening real OFAC sanctions, detecting laundering typologies — and decides: true positive (escalate) or false positive (clear), with a cited, human-approved evidence trail. The LLM plans and narrates but never produces a fact or a number; deterministic, tested graph tools do the knowing. Value is proven on a frozen held-out alert queue with real labels: how much false-positive review load it cuts with recall preserved, whether its overturns of the ML score are correct, and — co-primary — trajectory evaluation: did it take the right investigative steps, not just reach a lucky verdict.
(Data honesty: no public labeled bank-fraud graph exists, so the substrate is Elliptic — a real, investigator-labeled Bitcoin transaction graph — plus real OFAC sanctions. This is a financial-crime adjudication system; Bitcoin is the substrate, not the point.)
uv sync # environment
cp .env.example .env # add your OpenAI key (real mode)
make data # download + ingest + verify all datasets
uv run python -m fraudanalyst.evaluation.splits # freeze the firewall (once, refuses re-run)
uv run python -m fraudanalyst.detection.train # train + freeze the detection model
uv run python -m fraudanalyst.app.cli queue --build # raise alerts → case queue
make test # the clerks are tested or they're not trusted
uv run python -m fraudanalyst.app.cli investigate --next # watch one live investigation
uv run python -m fraudanalyst.app.cli review <case_id> --decision approve # the human gate
make eval # grade the dev split
# FRAUDANALYST_FAKE_LLM=1 prefixed to any command runs the deterministic scripted
# LLM — full pipeline, zero spend (plumbing tests only; stamped NOT-A-RESULT)The dashboard ships as one self-contained image. It bakes only the demo-safe
data subset — the processed models, features, graph, and the pre-run case and
checkpoint databases the console replays. .dockerignore cuts the ~2.9 GB of raw
datasets (rebuilt by make data, never needed at runtime), the eval labels and
holdout splits (label hygiene, §4.4), and .env (no secret enters the image).
docker build -t fraudanalyst . # builds where data/processed exists
docker run -p 8000:8000 fraudanalyst # → http://localhost:8000The container defaults to demo mode (FRAUDANALYST_DEMO=1, §4.6): a read-only
replay of pre-run held-out cases and red-team examples. Mutating endpoints
(/investigate, /screen, /decision) return 403, so a reachable container
cannot be spammed into spending the OpenAI budget — and demo mode makes no LLM call,
so no OpenAI key is required. The governance board reports two controls as
unproven in a demo image (raw-data hash-pinning and the feature-matrix pin need
the raw datasets make data rebuilds) — an honest degradation the board states
rather than faking a green tick (§8.12).
Cloud deploy. Because the datasets are gitignored, a platform cannot build the
image from the repo — build locally, then ship the built image. A fly.toml
is included; after fly auth login and claiming an app name:
fly deploy --local-only --image fraudanalystAny registry works the same way: docker push the local image, point the platform
at it. The VM needs ~1 GB RAM (lazy-loaded parquets peak well under that).
Everything ships as one installable package, fraudanalyst/.
| Path | What it is |
|---|---|
CLAUDE.md |
The engineering spec: what, why, principles, phases. Read first. |
fraudanalyst/config.py |
All paths, caps, seeds, sanity-gate constants. Nothing is hardcoded elsewhere. |
fraudanalyst/domains.py |
The platform seam: a domain = tools + required steps + scorer + labels + entity noun. |
fraudanalyst/ingestion/ |
download → parse → precompute; sanity gates against published counts. |
fraudanalyst/detection/ |
XGBoost detection model — raises the alerts the agent adjudicates; an input, never a competitor. |
fraudanalyst/rules/ |
Case queue + provisional/secondary alert rules (no AI). |
fraudanalyst/tools/ |
The "clerks": deterministic, tested, the ONLY source of facts. |
fraudanalyst/security/ |
The guards (§4): injection screen, egress allowlist. Not tools — the agent can't call them. |
fraudanalyst/resilience.py |
§5: bounded retries + circuit breakers. Robustness is not security; the split is deliberate. |
fraudanalyst/agent/ |
LangGraph loop: plan → act → observe → reflect → score → report → human gate. |
fraudanalyst/audit/ |
Identity envelope + append-only hash-chained log. If it isn't logged, it didn't happen. |
fraudanalyst/evaluation/ |
THE SPINE: adjudication value + recall-cost + trajectory + grounding + red-team, frozen holdout. |
fraudanalyst/app/ |
Thin surfaces: cli.py, api.py + static/dashboard.html. Zero investigation logic. |
prompts/ |
Versioned prompts (behavior is versioned like artifacts; a new version is a NEW FILE). |
tests/ |
Hand-computed fixtures; label-hygiene and fail-open enforcement. |
artifacts/runs/ |
Eval outputs, incl. the spent one-shot holdout. Gitignored → not recoverable from git. |
- Elliptic++ (Bitcoin transactions + wallets, labeled illicit/licit by real investigators) — the answer key that makes capability provable.
- OFAC SDN (US Treasury) — real sanctioned entities incl. real crypto addresses; the sanctions screen is genuine, not simulated.
The two deliberately don't join (Elliptic is anonymized) — a labeled backtesting graph plus a live screening feed is how production AML is actually built (CLAUDE.md §1).
- The fraud detection model is deliberately modest — PR-AUC 0.552 on base
features. Kaggle winners reach ~0.945 AUC on IEEE-CIS, but the bulk of that
gain comes from UID target-aggregation: building card identities and letting
the model memorize which cards are fraudulent across the train/test overlap.
Under this repo's temporal split that technique is entity memorization —
the same disease as the transductive leakage we caught in our own AML
precompute (CLAUDE.md §8.1), wearing a leaderboard medal. Feature engineering
was spent where it makes evidence truthful (the
card_uidentity key for card-history/velocity/link tools), not where it makes a detection number bigger. The FP-heavy queue the modest model raises is the realistic operating condition — and adjudicating it is the product. A causalmodel_v2(strictly backward-looking per-card aggregates) is a documented, seam-safe upgrade if runway allows. - Dev numbers are small-n (20-case runs; counts reported, never bare percentages). The frozen holdout is spent once, at the end, on the final system.
- AML proximity alerts fire zero times on dev — under the causal precompute, no labeled dev entity has a graph path to train-split illicit activity. That is a data truth about Elliptic (graph structure is barely load-bearing; see §8.1), reported rather than hidden.
- No variance run yet (phase 8): single-pass dev numbers; nondeterminism is not yet quantified. No spend kill-switch yet either — live runs are attended.