1. editor.py — Fix rewrite_chapter_content to use model_writer (was model_logic).
Chapter rewrites now use the creative writing model, not the cheaper analysis model.
2. editor.py — evaluate_chapter_quality now uses keep_head=True so the evaluator
sees the chapter opening (engagement hook, sensory anchoring) as well as the
ending; long chapters no longer scored on tail only.
3. editor.py — Consistency analysis sampling upgraded to head+middle+tail (was
head+tail), giving the LLM a complete view of each chapter's events.
4. writer.py — max_attempts is now adaptive: climax/resolution chapters
(position >= 0.75) receive 3 refinement attempts; others keep 2.
5. writer.py — Polish-skip threshold tightened from 0.012 to 0.008 (1 filter
word per 125 words vs. 1 per 83 words), so more borderline drafts are cleaned.
6. style_persona.py — Persona validation sample increased from 200 to 400 words
for more reliable voice quality assessment.
Version bumped: 3.0 → 3.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix: chapter quality evaluation now uses model_logic (free Pro) instead of model_writer (Flash).
The model that wrote the chapter was also scoring it, causing circular, lenient grading.
- Increase max_attempts in write_chapter from 2 to 3 for more refinement passes per chapter.
- Update auto model selection prompt (ai/setup.py) to prioritize quality over budget framing:
free/preview/exp models preferred by capability (Pro > Flash, 2.5 > 2.0 > 1.5), not just cost.
Writer role now allowed to use best free Flash/Pro preview — not restricted to basic Flash only.
- Bump version to 3.0.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Root cause: Consumer(huey, workers=1, worker_type='thread', loglevel=20)
raised TypeError on every app start because Huey 2.6.0 does not accept
a `loglevel` keyword argument. The exception was silently caught and only
printed to stdout, so the consumer never ran and all tasks stayed 'queued'
forever — causing the 'Preparing environment / Waiting for logs' hang.
Fixes:
- web/app.py: Remove invalid `loglevel=20` from Consumer(); configure
Huey logging via logging.basicConfig(WARNING) instead. Add persistent
error logging to data/consumer_error.log for future diagnosis.
- core/config.py: Replace emoji print() calls with ASCII-safe equivalents
to prevent UnicodeEncodeError on Windows cp1252 terminals at import time.
- core/config.py: Update VERSION to 2.9 (was stale at 1.5.0).
- ai_blueprint.md: Bump to v2.10, document root cause and fixes.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- writer.py: Dynamic character injection — only POV + beat-named characters
are sent to the writer prompt, eliminating token waste and hallucinations
from characters unrelated to the current scene.
- writer.py: Smart tail truncation — prev_content trimmed to last 1,000 tokens
(the actual chapter ending) instead of a blind 2,000-token head slice,
preserving the exact hand-off point for continuity.
- writer.py: Scene state injected into char_visuals — current_location,
time_of_day, and held_items now surfaced per relevant character in prompt.
- bible_tracker.py: update_tracking expanded to record current_location,
time_of_day, and held_items per character after each chapter.
- core/config.py: VERSION bumped 1.4.0 → 1.5.0.
- README.md: Story Generation section and tracking_characters.json schema
updated to document new context optimization features.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>