Stage 5 parses LLM output into list[BodySection] (Pydantic models) but
SQLAlchemy's JSONB column needs plain dicts. Added _serialize_body_sections()
helper that calls .model_dump() on each BodySection before DB write.
Fixes 'Object of type BodySection is not JSON serializable' errors.
- Expanded runs now show horizontal stage tabs (Segment→Extract→Classify→Synthesize→Embed)
- Each tab has status indicator dot (idle/running/done/error) with pulse animation
- Clicking a tab shows that stage's events with summary stats (LLM calls, tokens, duration)
- Error events auto-expanded with monospace error detail block
- Auto-selects the error stage or latest active stage on expand
- Renamed 'stale pages' to 'orphaned pages' in admin header
Runs as chrysopedia-mcp container in Docker Compose with direct DB, Redis,
Docker socket, and API access. Streamable HTTP transport on port 8097.
Clients connect via http://ub01:8097/mcp
Deletes all technique pages, versions, links, key moments, pipeline
events/runs, Qdrant vectors, and Redis cache while preserving creators,
videos, and transcript segments. Resets all video status to not_started.
Double-confirm dialog in the UI prevents accidental use.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Rewrote voice from third-person narrative ("Keota does X") to instructive
("Route the effect at 100% wet"). Body prose now reads like a lesson book.
- Hard rule: creator name appears in title/summary only, max once in body
(for quote attribution). Fixed JSON example that modeled heavy name usage.
- Added orientation-first section rhythm: brief definition before diving into
method, prevents run-on feel.
- Page minimum thresholds: 3+ sections, 400+ words, 3+ moments. Prevents
stub pages from thin categories.
- Strengthened merge guidance: prefer fewer rich pages over many stubs.
- Updated all examples to model instructive phrasing.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Drops prompt iteration cycles from 20-30 min to under 5 min by enabling
stage-isolated re-runs and offline prompt testing against exported fixtures.
Phase 1: Offline prompt test harness
- export_fixture.py: export stage 5 inputs from DB to reusable JSON fixtures
- test_harness.py: run synthesis offline with any prompt, no Docker needed
- promote subcommand: deploy winning prompts with backup and optional git commit
Phase 2: Classification data persistence
- Dual-write classification to PostgreSQL + Redis (fixes 24hr TTL data loss)
- Clean retrigger now clears Redis cache keys (fixes stale data bug)
- Alembic migration 011: classification_data JSONB column + stage_rerun enum
Phase 3: Stage-isolated re-run
- run_single_stage Celery task with prerequisite validation and prompt overrides
- _load_prompt supports per-video Redis overrides for testing custom prompts
- POST /admin/pipeline/rerun-stage/{video_id}/{stage_name} endpoint
- Frontend: Re-run Stage modal with stage selector and prompt override textarea
Phase 4: Chunking inspector
- GET /admin/pipeline/chunking/{video_id} returns topic boundaries,
classifications, and synthesis group breakdowns
- Frontend: collapsible Chunking Inspector panel per video
Phase 5: Prompt deployment & stale data cleanup
- GET /admin/pipeline/stale-pages detects pages from older prompts
- POST /admin/pipeline/bulk-resynthesize re-runs a stage on all completed videos
- Frontend: stale pages indicator badge with one-click bulk re-synth
Phase 6: Automated iteration foundation
- Quality CLI --video-id flag auto-exports fixture from DB
- POST /admin/pipeline/optimize-prompt/{stage} dispatches optimization as Celery task
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Each video now completes all stages (2→6) before the worker picks up the
next queued video. Previously, dispatching celery_chain for multiple videos
caused interleaved execution — nothing finished until everything went through
all stages. Now run_pipeline calls each stage function synchronously within
the same worker task, so videos complete linearly and efficiently.
Validation/quality-check sections can NEVER precede construction sections.
Added concrete wrong vs correct ordering example using the exact snare design
case that failed. Elevated from 'typically' guidance to non-negotiable rule.
Sections should mirror the actual production workflow: foundations before
finishing, construction before glue, sound sources before processing before
mix-bus treatment. Includes the test: 'would a producer follow these steps
in this sequence?' and a natural flow template (framework → construction →
combining/refining → quality checks).