feat: Implement ai_blueprint.md Steps 1 & 2 — bible-tracking merge and character voice profiles
Step 1 (Bible-Tracking Merge):
- Added merge_tracking_to_bible() to story/bible_tracker.py — merges character
tracking state and lore back into bible dict after each chapter, making
blueprint_initial.json the single persistent source of truth.
- Integrated in cli/engine.py after each chapter's update_tracking + update_lore_index
calls so the persisted bible is always up-to-date.
Step 2 (Character-Specific Voice Profiles):
- story/writer.py: write_chapter now checks bp['characters'] for a voice_profile on
the POV character before falling back to the prebuilt_persona cache.
- story/style_persona.py: refine_persona() accepts pov_character=None; when a POV
character with a voice_profile is supplied it refines that profile's bio instead of
the global author_details bio.
- cli/engine.py: refine_persona call now passes ch.get('pov_character') so per-chapter
persona refinement targets the correct voice.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -168,8 +168,19 @@ def write_chapter(chap, bp, folder, prev_sum, tracking=None, prev_content=None,
|
||||
|
||||
pov_char = chap.get('pov_character', '')
|
||||
|
||||
# Use pre-loaded persona if provided (avoids re-reading sample files every chapter)
|
||||
if prebuilt_persona is not None:
|
||||
# Check for character-specific voice profile (Step 2: Character Voice Profiles)
|
||||
character_voice = None
|
||||
if pov_char:
|
||||
for char in bp.get('characters', []):
|
||||
if char.get('name') == pov_char and char.get('voice_profile'):
|
||||
vp = char['voice_profile']
|
||||
character_voice = f"Style/Bio: {vp.get('bio', '')}\nKeywords: {', '.join(vp.get('keywords', []))}"
|
||||
utils.log("WRITER", f" -> Using voice profile for POV character: {pov_char}")
|
||||
break
|
||||
|
||||
if character_voice:
|
||||
persona_info = character_voice
|
||||
elif prebuilt_persona is not None:
|
||||
persona_info = prebuilt_persona
|
||||
else:
|
||||
persona_info = build_persona_info(bp) or "Standard, balanced writing style."
|
||||
|
||||
Reference in New Issue
Block a user