[Sovereignty P1] Narration Template System with Variable Slots #958

Closed
opened 2026-03-22 18:23:03 +00:00 by perplexity · 0 comments
Collaborator

Parent

Part of #953 (The Sovereignty Loop) — P1 priority

Governing Principle

"Script the Predictable, Improvise the Novel" — Eliminates 60% of narration LLM cost.

Goal

Build a template-based narration system for predictable game moments. Templates have variable slots filled from game state. Voiced by Kokoro/Piper locally without touching any LLM.

Template Examples (from the governing doc)

templates["enemy_killed"] = [
    "Another {enemy_type} bites the dust.",
    "That {enemy_type} won't bother anyone again.",
    "{enemy_type} down. Moving on.",
]
templates["low_health"] = [
    "Getting rough out here. Need to find cover.",
    "That hurt. Where's my healing?",
]

Implementation

  1. Create src/timmy/sovereignty/narration_templates.py:
    • NarrationLibrary class with templates stored in data/narration.json
    • get_narration(event_type, context) -> str — template lookup + slot fill
    • crystallize_narration(llm_line, event_type, context) — new LLM lines get templatized
  2. Event categories: enemy_killed, low_health, entered_building, picked_up_loot, opened_menu, quest_complete, NPC_greeting, level_up, death, etc.
  3. LLM fallback only for: quest twists, player interactions, deaths, discoveries, genuinely novel moments
  4. Integration with Kokoro/Piper TTS for local voice synthesis

Metrics Targets

  • 60-70% templatized within a week of play

Effort Estimate

1 day

Cross-references

  • #953 (Sovereignty Loop — Section III.3)
  • #853 (Piper TTS Voice Model)
  • #903 (State-of-Art — mlx-audio/Kokoro for local voice)
## Parent Part of #953 (The Sovereignty Loop) — P1 priority ## Governing Principle > "Script the Predictable, Improvise the Novel" — Eliminates 60% of narration LLM cost. ## Goal Build a template-based narration system for predictable game moments. Templates have variable slots filled from game state. Voiced by Kokoro/Piper locally without touching any LLM. ## Template Examples (from the governing doc) ```python templates["enemy_killed"] = [ "Another {enemy_type} bites the dust.", "That {enemy_type} won't bother anyone again.", "{enemy_type} down. Moving on.", ] templates["low_health"] = [ "Getting rough out here. Need to find cover.", "That hurt. Where's my healing?", ] ``` ## Implementation 1. Create `src/timmy/sovereignty/narration_templates.py`: - `NarrationLibrary` class with templates stored in `data/narration.json` - `get_narration(event_type, context) -> str` — template lookup + slot fill - `crystallize_narration(llm_line, event_type, context)` — new LLM lines get templatized 2. Event categories: enemy_killed, low_health, entered_building, picked_up_loot, opened_menu, quest_complete, NPC_greeting, level_up, death, etc. 3. LLM fallback only for: quest twists, player interactions, deaths, discoveries, genuinely novel moments 4. Integration with Kokoro/Piper TTS for local voice synthesis ## Metrics Targets - 60-70% templatized within a week of play ## Effort Estimate 1 day ## Cross-references - #953 (Sovereignty Loop — Section III.3) - #853 (Piper TTS Voice Model) - #903 (State-of-Art — mlx-audio/Kokoro for local voice)
claude was assigned by Rockachopa 2026-03-22 23:31:14 +00:00
claude added the harnessmorrowindp1-important labels 2026-03-23 13:53:57 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Rockachopa/Timmy-time-dashboard#958