feat: add creative direction file and score replay#44
Conversation
Two new pipeline inputs: --direction <file> for creative briefs that influence DirectorScore generation, and --score <path> for replaying from a saved score.json (skips research, director, and critic stages). Direction is free-form markdown injected into the creative director prompt. Score replay populates all closure bindings (score, config, costBreakdown) and runs cost estimation with accurate replay pricing.
Server validates direction (10KB byte limit) and score (DirectorScore schema). Worker threads both to runPipeline. Web UI adds direction textarea with character counter and score file input in Advanced panel.
28 new tests across 3 new test files + 1 extended: - direction-file.test.ts: file validation, binary detection, empty guard - score-replay.test.ts: Zod validation, replay cost estimation - server-direction-score.test.ts: API validation, byte-based size checks - cost-estimator.test.ts: replay mode zeroes LLM base costs
Sample direction file demonstrating mood, visual style, scene ideas, script notes, and music preferences for the --direction flag.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@claude review |
|
Claude finished @tsensei's task in 3m 9s —— View job Code Review
SummaryThe implementation is clean and well-architected. Both features integrate naturally into the existing pipeline. Below are the findings, ordered by severity. Issues Found[Medium] Score replay with unknown archetype crashes the job silentlyFiles: The server validates a replayed score with // src/config/archetype-registry.ts:36-38
if (!config) {
throw new Error(`Unknown archetype: ${name}. Available: ${Object.keys(ARCHETYPES).join(", ")}`);
}A user can send Fix: Validate the archetype against the registry at the server layer: Fix this → [Low]
|
- Validate replayed score's archetype against registry in both server (400 for unknown archetype) and CLI (exit with clear error). Prevents silent job failures when score.json references a removed archetype. - Remove dead replayScorePath field from RunLog (declared but never set). - Fix web UI direction counter to use byte length (TextEncoder) matching the server's Buffer.byteLength check. Prevents CJK text from hitting the server 10KB limit while the UI shows it under the character limit.
Review ResponseFixed (3 issues)
Not fixing (design decisions)Direction injection tests are type-only: This is intentional. The direction text is injected via string interpolation into the LLM user message. Testing the actual prompt construction would require either (a) mocking the LLM and capturing the prompt argument, which couples the test to internal prompt format, or (b) an integration test with a real LLM call, which is expensive. The type-level tests verify the interface contract (direction is accepted as an option). The actual prompt injection is simple string concatenation ( Direction+score conflict silencing not tested at CLI/worker level: The silencing logic is 2 lines ( |
|
@claude review |
|
Claude finished @tsensei's task in 1m 52s —— View job Code Review
SummaryAll three issues from the previous review are correctly resolved. The implementation is clean and ready to land. Previous Issues — Verification[Medium] Archetype validation ✅ Fixed correctly in both paths:
[Low] [Low] Character counter vs byte limit ✅ Fixed. New Observations[Nit] Unnecessary type cast in server archetype validationFile: getArchetype((result.data as { archetype: string }).archetype);
[Nit] Archetype registry check has no dedicated unit test
[UX note] Silent rejection on over-limit pasteThe What's Working Well
|
Summary
Two new pipeline features that unblock the growing OpenReels community:
Creative Direction File (
--direction <file>)generateDirectorScoreandreviseDirectorScorepromptsdirectionfield), and web UI (textarea with character counter)Score Replay (
--score <path>)score.jsonto skip research, director, and critic stagesscore,config,costBreakdown) for downstream stageslog.jsonSupporting changes:
examples/direction-brief.mdTest Coverage
Tests: 395 → 423 (+28 new)
Pre-Landing Review
Pre-Landing Review: No issues found.
Documentation
8 docs site pages updated for v0.18.0:
docs/getting-started/cli.mdx: added--directionand--scoreflags to table + usage examplesdocs/getting-started/quickstart.mdx: added direction and replay CLI examplesdocs/getting-started/web-ui.mdx: added Creative Direction textarea and Replay from Score to Advanced panel docsdocs/api/rest.mdx: addeddirectionandscorefields to POST /api/v1/jobs body table + error codesdocs/pipeline/overview.mdx: added Score Replay and Creative Direction sections with alternate pipeline flowdocs/pipeline/creative-director.mdx: added direction injection and score replay sectionsdocs/pipeline/research.mdx: added "Skipping during replay" sectiondocs/pipeline/critic.mdx: added "Skipping during replay" sectionTest plan
🤖 Generated with Claude Code