Built for the Global AI Hackathon with Qwen Cloud · Track 2
Foreshadow icon

Foreshadow

Your near-miss, tomorrow's safety film.

An agent film crew that turns real incident reports into 90-second cinematic safety films — budgeted, QC'd, provenance-signed.

zsh — foreshadow
$ replaying forklift at $4 (offline, zero keys) spent $2.7051 of $4.00 invariants I1-I4 PASS

Edy Cu · foreshadow.edycu.dev

The ledger line

$2.71 vs $15,000

One safety film, made by an agent crew under a hard budget — versus a conventional production quote and a 6–8 week wait. That $2.71 is the real ledger total for forklift@$4, not a slogan.

The problem

Nobody watches the 2009 training video.

A warehouse safety manager files the third forklift near-miss this quarter. Corporate's answer is a stock actor in a stock warehouse. The next one won't be a near-miss.

$5–15k
per commissioned safety video
6–8 wks
turnaround — the incident is stale by then
0
films made from the company's own incidents

The solution

Drop in Tuesday's report. Screen it Thursday.

A crew of Qwen agents — Screenwriter, Line Producer, Art Department, DP, QC Critic, Narrator — makes the film from your incident, under a hard dollar budget, and signs the receipts.

8 Qwen surfaces 1 bill 90s film
foreshadow.edycu.dev
Foreshadow hero — your near-miss, tomorrow's safety film

How it works

An 11-stage pipeline with a wallet in the middle.

foreshadow render · replay · verify pipeline worker — Python 3.12 · SQLite · fixtures/cache ingest ECIES seal screenplay shot plan Line Producer knapsack + kill switch render 3 tiers QC ≤1 retry/demote stitch edit list publish sign manifest FakeQwen (default) deterministic · offline · zero keys LiveQwen — DASHSCOPE_API_KEY qwen3.7-max · qwen-image-2.0-pro wan2.7-i2v · qwen3-vl-plus · cosyvoice Ed25519 Merkle manifest verify: I1–I4 · 1-byte tamper fails

Live demo — real CLI output

Replay, then try to tamper with it.

1
one command, zero keys
foreshadow replay --incident forklift
$ foreshadow replay --incident forklift [ done] screenplay (beats=3, title=Aisle Seven) [ done] budget_alloc (mix=hero:3 conn:3 kb:2) [ done] qc (rejected=0, reviewed=6) [ done] publish (leaves=36) spent $2.7051 of $4.00 merkle root 4a7e3aa0bd296923… invariants I1-I4 PASS committed cache: byte-identical
2
cryptographic verify — tamper 1 byte, it fails
foreshadow verify film.mp4 manifest.json
[PASS] signature Ed25519 544aa661… [PASS] merkle_root recomputed 4a7e3aa0… [PASS] I4 36 artifact hashes re-verified [PASS] I2 spent $2.71 <= budget $4.00 [PASS] I3 rejected clips outside the cut VERIFICATION PASS # flip one byte of any artifact: [FAIL] I4_artifact_hashes → exit 1
3
QC rejection: chemical shot C4, 1 retry, excluded from cut

Key features

The budget is the product.

Line Producer knapsack allocator

Tiers every shot by narrative weight × cost, logs every demotion as priced regret, kill-switch at 2.5× budget.

budgetherofilm $quality
$21$1.3249.8%
$43$2.7178.4%
$86$3.3192.0%

forklift sweep · docs/BENCH.md · reproduce: foreshadow bench

Ed25519 + Merkle provenance

Safety films become evidence — every artifact hash rolls into a signed root; invariants I1–I4 are tested, including 1-byte tamper.

Grounded QC loop

A VL critic rejects shots that miss their safety intent — one corrective retry, or demote; rejected clips provably never reach the cut.

Why only Qwen Cloud

Take Qwen out and the demo dies.

Without one platform, this is four vendors, an async render queue, and a cross-vendor cost normalizer — and the single-bill ledger that is the demo becomes impossible.

Track 2 asks for quality under a limited budget. We made the constraint the signature feature.

Qwen surfaceWithout it
qwen3.7-max + thinkingsecond LLM vendor
qwen-image-2.0-proMidjourney account + style hacks
wan2.7-i2v / wan2.6-flashRunway + no cheap tier = no ladder
qwen3-vl-plus QCa GPT-V-class vendor just for review
cosyvoice-v3-plusan ElevenLabs subscription
Batch API −50%fan-out costs 2×

Shipped — built solo in six days

Everything claimed is green. Offline.

421
tests passing
100%
line coverage, socket-guarded
36
signed Merkle leaves per film
3
seed incidents, byte-identical replay
5-stage CI: quality → security → build → offline verify → gate CodeQL + TruffleHog + pip-audit bench sweep $2/$4/$8 committed playable offline animatic (preview) deployed on Alibaba Function Compute ☁️

Deployed live on Alibaba Function Compute (managed python3.10) — /verify replays the signed ledger and re-verifies the Ed25519/Merkle chain in the cloud, /run replays the pipeline, /health is up. Honest scope: graded artifact runs on deterministic FakeQwen; live image/video/TTS surfaces are payload-complete behind DASHSCOPE_API_KEY. It says so in the README.

The ask

Run the replay. Try to break the signature.

Two minutes, zero keys, zero network. If one byte is wrong, it will tell you.

judge path — offline
$ git clone https://github.com/edycutjong/foreshadow $ ./.venv/bin/pytest # 421 passed $ foreshadow replay --incident forklift

foreshadow.edycu.dev · github.com/edycutjong/foreshadow · Edy Cu

QR code placeholder linking to the Foreshadow repository
EC
Edy Cu
solo builder · design → crypto → CI
Speaker notes
01 / 10
←/→ nav · ESC grid · P notes · C contrast · Cmd+P → PDF