# 02 Foundry demo catalog

Every demo lives in `demos/<id>/` with a `demo.json` manifest (run command, test command, limitations, license). Reproduce everything with `python3 -m pytest -q demos` (34 tests) or `python3 foundry/verify.py --clean-clone` (clones HEAD to a temp dir, reruns, compares output digests).

## Flagship 1: Agent Security & Execution Control (`demos/01-agent-security`)
- **Buyer:** AI startups, MSPs, security consultancies, SaaS teams deploying agents.
- **Receives:** six agent actions in a sandbox with a fake `.env` secret, canary data files and a loopback receiver we own.
- **Produces:** per action the policy decision, whether it executed, a hash-chained audit log, measured overhead.
- **Result (run 2026-10-24):** read ALLOW and executed. Credential read BLOCK (hard policy; secret not returned). Sending the secret out BLOCKs three ways, each with its own recorded reason: 3a unapproved local host (loopback rule; our receiver is on 127.0.0.2), 3b host not on the allow-list (`collector.example.invalid`, which can never resolve), 3c allow-listed vendor host, blocked by the engine's credential-in-payload rule; the receiver saw 0 requests. Recursive delete BLOCK (3/3 files remain). A real `deploy.sh` ESCALATEs: with approval it ran (marker created), when denied it did not. With an unwritable audit log every action, even a benign read, is refused (fail-closed). Same actions with no gateway: secret read, 1 request received, all files deleted.
- **Overhead:** Policy `evaluate()` p50 3.7 ms, p95 about 8-13 ms over 1000 calls across run-to-run variation (replay provider, local SQLite, this host). Whole gateway step per action (evaluate + fsync'd audit records + execution): about 18-27 ms on an idle host.
- **Real:** decisions come from the installed policy engine; execution, side-effect checks and audit are real. **Simulated:** the "agent" is a script; data and secrets are fake. **Not validated:** the offline replay provider, any non-sandbox environment, adversarial bypass. Not a penetration test and not a certification.
- Decisions are never remapped. An early probe showed the engine blocks `>>` redirects but escalates scripts, so the approval scenario runs a real `deploy.sh`. Scenario 3a is a loopback destination and is labelled as such; it does not by itself show that secrets are detected (3c does).
- Run: `python3 demos/01-agent-security/run_demo.py`

## Flagship 2: Automated Game QA & Regression Testing (`demos/02-game-qa`)
- **Buyer:** indie studios, small publishers, server operators.
- **Receives:** three builds of an original HTML5 game ("Brick Courier", MIT): v1.0.0 baseline, v1.1.0 with a one-line collision-tolerance regression, v1.2.0 fix.
- **Produces:** pass/fail per scripted scenario, first divergent frame, screenshot, `BUG_REPORT.md` with seed and repro command, post-fix confirmation.
- **Result:** v1.0.0 passes both scenarios; v1.1.0 fails `edge_play` (first divergence frame 119, first life lost frame 128, game over frame 504) while `center_play` still passes, so the bug is only caught by the edge-contact scenario; v1.2.0 passes with traces byte-identical to the baseline (same SHA). Watch-mode and headless runs give identical trace hashes.
- **Real:** headless Chrome plays the real build; deterministic fixed-step simulation. **Simulated:** the game is our own toy; the regression was injected by us (diff in `evidence/injected_regression.diff`). **Not validated:** any third-party engine or build, flakiness over long CI histories.
- Run: `node demos/02-game-qa/qa/qa.mjs --build demos/02-game-qa/builds/v1.1.0-regressed`

## Flagship 3: Automated Media Repurposing Studio (`demos/03-media-repurposing`)
- **Buyer:** creators, podcast networks, agencies, educational and sports producers (own footage only).
- **Receives:** one 90.7 s source recording (our own captures narrated with Qwen3-TTS, voice "jesse", lines Whisper-verified).
- **Produces:** 96.8 s primary edit (3 s intro card, captions, 3 s end card); 3 distinct vertical 1080x1920 Shorts (16.3 s, 41.6 s, 17.3 s) with different topics; SRT/ASS captions from word-level ASR of the audio (faster-whisper small.en); 3 thumbnails; title/description/chapter suggestions; `manifest.json` with SHA-256s and 8 automated checks (all pass); `PRODUCTION_REPORT.md`.
- **Real:** the whole pipeline runs on the committed source; reuses Media Department caption writers. **Simulated:** source footage stands in for customer footage; clip selection and titles are rule-based suggestions, not performance predictions. **Human control:** approval status stays `PENDING_HUMAN_APPROVAL`; nothing uploaded. The daily channel pipeline was not touched.
- Run: `bash demos/03-media-repurposing/run_package.sh`

## Supporting 4: Warehouse Operations Exception Desk (`demos/04-warehouse-exceptions`)
310 synthetic orders / 259 shipments / 20 SKUs with injected faults. Detects inventory mismatch, duplicate orders, missing shipments, delays, stock shortage; writes `exceptions.csv` and `report.md` with evidence and a suggested resolution per exception. Score vs injected ground truth: recall 1.0 and precision 1.0 in all five classes (on seeds 7, 11, 23 for recall). Perfect scores on self-generated data show the pipeline works, not accuracy on a real warehouse. Run: `python3 demos/04-warehouse-exceptions/desk.py`

## Supporting 5: Repair Shop Inquiry Intake (`demos/05-repair-shop-intake`)
Five free-text inquiries and a sample rate card become structured requests, missing-information lists, estimate drafts (labor and fees only, parts excluded), follow-up tasks and response drafts pending approval. Diagnostic requests quote only the diagnostic fee. Never states a diagnosis, parts availability or a booked appointment; nothing is sent. Rule-based extraction on five examples is a demo of the workflow, not a measured accuracy. Run: `python3 demos/05-repair-shop-intake/intake.py`

## Supporting 6: Document Processing & Reconciliation (`demos/06-document-reconciliation`)
Seven synthetic invoices and a PO book. Detects arithmetic mismatch, missing PO, PO amount mismatch, duplicate invoice number; routes a low-confidence total to a human review queue; exports only clean rows (2). Every extracted value carries file/line/character span and a test proves `text[start:end] == value`. Plain-text inputs only; OCR and PDF ingestion are scope for a real engagement. Run: `python3 demos/06-document-reconciliation/reconcile.py`

## Shared foundation (minimal)
`demo.json` manifest per demo; `foundry/verify.py` (test + digest + clean-clone check); `foundry/recorder/` (serves a page that runs each demo's real commands and relays output; recorded by screenshot capture to MP4); per-demo `evidence/` folders; `limitations` and `license` recorded in each manifest.
