Internal (private)
TypeScript · Node.js · Claude API · Claude Code (headless) · SQLite · Playwright · Vitest
LLM content pipelines
Multi-stage pipelines that sweep sources, score ideas with an LLM, put a person in the loop and render finished posts.
The problem
Producing research-backed social content daily means reading far more than anyone can, picking the few ideas worth making, and turning each into a post that is accurate and on-brand, without the model inventing facts or the bill growing with every rerun.
Key decisions
- A person picks; models never publish
- The sweep and scoring stages write a daily markdown menu, and nothing moves forward until an operator ticks items. Drafts still need approval at the end.
- Validate, then allow one repair turn
- Model output is checked against a schema; on failure the output and the error go back once, and a second failure fails the stage instead of looping.
- Deterministic gates behind the model's self-check
- Code-level checks back up the model; for example, every number in a brief must also appear in the caption.
- Cache every stage by input hash
- A stage-run ledger keyed by entity, stage and input hash means a failed render never re-runs the expensive model stages; per-stage token limits and a double-spend guard cap cost.
- Behaviour from configuration, not branches
- Each brand is a folder of voice, visual and policy files whose capability flags decide which stages run; a test checks the engine has no brand-specific code.
What I built
- A daily sweep of feeds, research papers and podcasts (episode matching, word-timed captions with a speech-to-text fallback, LLM clip picks), resumable stage by stage with atomic writes and per-stage cost tracking.
- A multi-stage generation engine (analyze, ideate, write, art-direct, images, render, QA, draft) with a SQLite job queue and model tiers per stage.
- Slide rendering in a real browser at 1080×1350 with bundled fonts, because image models can't set type reliably.
Verification
- About 257 test cases (Vitest) for the sweep pipeline and about 169 for the generation engine, with no network calls and a fake model binary for the headless runs.
Links
Private repository: happy to walk through the code in an interview.