Skip to content

feat(narrator): scene_render tool for visual scene extraction via tool call#46

Merged
slabgorb merged 1 commit intomainfrom
feat/20-5-scene-render-tool
Apr 2, 2026
Merged

feat(narrator): scene_render tool for visual scene extraction via tool call#46
slabgorb merged 1 commit intomainfrom
feat/20-5-scene-render-tool

Conversation

@slabgorb
Copy link
Copy Markdown
Owner

@slabgorb slabgorb commented Apr 2, 2026

Summary

Implement scene_render tool to move visual scene description extraction from JSON schema documentation in the narrator prompt to a validated tool call. The narrator creates a scene description (creative judgment), the tool validates and structures it (tier, mood, tags enums), and assemble_turn merges it into the ActionResult.

Acceptance Criteria

  1. scene_render tool accepts subject, tier, mood, tags and returns VisualScene JSON
  2. ✅ Tier, mood, and tags validated against their enums
  3. ✅ Subject text passed through as-is (narrator's creative judgment)
  4. ✅ Narrator prompt documents the tool instead of the JSON field schema
  5. assemble_turn merges into ActionResult
  6. ✅ OTEL span with subject text and tier for GM panel visibility

Implementation

  • New src/tools/scene_render.rs module with SceneTier/VisualMood/VisualTag enums and validate_scene_render() function
  • Tool call parser integration — scene_render match arm calls validate_scene_render()
  • ToolCallResults extended with visual_scene field, assemble_turn wires override logic
  • Narrator prompt updated to remove visual_scene JSON schema (~100 tokens)
  • All error paths emit tracing::warn! events for OTEL observability
  • 30 tests covering validation, enum coverage, parser integration, assembler wiring

Design Notes

  • Visual scene extraction follows the same tool-based pattern as set_mood/set_intent (story 20-2)
  • Subject description is free text from the narrator with 1-100 char constraint (creative judgment unconstrained)
  • Enums use #[non_exhaustive] per CLAUDE.md rule chore(sprint): mark stories 1-1 and 1-6 as done #2
  • All validators use case-insensitive enum parsing

Test Coverage

  • All 30 tests passing, full suite clean (557 tests)
  • AC coverage complete: validator, enums, passthrough, wiring, OTEL spans
  • Wiring tests verify tool_call_parser integration and assemble_turn output
  • Test files in: crates/sidequest-agents/tests/scene_render_story_20_5_tests.rs

Quality Checks

  • Build green, no code smells
  • All CLAUDE.md rules enforced: #[non_exhaustive], validated constructors, tracing on error paths, doc comments
  • Reviewed: all 9 specialists cleared (type design, security, simplicity)

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@slabgorb slabgorb merged commit 2ec3c2c into main Apr 2, 2026
@slabgorb slabgorb deleted the feat/20-5-scene-render-tool branch April 5, 2026 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant