sources-ledger
The registry of what's been clipped. Answers "have I already made shorts from this video?" and "where did a reaped source come from?" without decoding opaque work/<sha1> hashes.
Usage
sources-ledger.sh sync # rebuild work/sources.json from work/ + output/
sources-ledger.sh record <id> # upsert one source (pipeline end-of-run / reap)
sources-ledger.sh show # print the registry
Output: work/sources.json
An array, newest-ingested first, one entry per source that has an ingest.json:
{
"id": "ac3763ad4c",
"slug": "we-broke-into-mrbeast-s-studio",
"title": "We Broke Into MrBeast's Studio",
"url": "https://www.youtube.com/watch?v=y8K6QazBqrY",
"uploader": null,
"duration_sec": 5726.174,
"ingested": "2026-06-01",
"shorts": [ { "name": "....mp4", "grade": 72, "tier": "GOLD", "path": "output/<slug>/....mp4" } ],
"shorts_count": 3,
"status": "active",
"reaped": null,
"work_bytes": 2782512345
}
slugis computed identically tostart.sh(kebab of the source title, falling back to the work id) so it mapswork/<id>→output/<slug>/.statusisreapedoncesource.mp4is gone or a.reapedmarker exists (written byreap-source); otherwiseactive.shortsreads each deliveredoutput/<slug>/*.mp4and its co-located*.grade.json.
bd memory
record also upserts a keyed memory (--key source-<id>) summarizing the source + how to re-ingest, best-effort (skipped if bd is absent). Keyed, so re-runs update in place rather than duplicating.
Where it runs
- Pipeline end-of-run —
start.shcallssources-ledger.sh record <id>after a source's shorts are saved, so the registry is always current. reap-sourcecallsrecord <id>after reaping to flipstatus→reaped, then a finalsync.- Standalone —
syncbackfills the whole registry from existingwork/dirs.