From 20bf338e82854dfab85e8ed79ed853602f2dfb27 Mon Sep 17 00:00:00 2001 From: David Baity <158404677+MazakTheDwarf@users.noreply.github.com> Date: Fri, 17 Apr 2026 19:44:29 -0400 Subject: [PATCH] sprint 81: fix chapter filename interpolation, chapter_polish deadlock, Loop 2 CLM dispatch, project.yml data - book_chapter.yml: add mini-package step after SELF-CHECK to extract chapter_number/chapter_ref before document steps run. Without this every chapter was saved as Chapter_chapter-number_draft.md. Also add source_step to both document steps so they read from correct prior step. - DocumentStepHandler.cs (C#): add source_step support (template change depends on this). - chapter_roundtable.yml: remove broken depends_on from chapter_polish spawn that caused deadlock (Polish: {chapter_ref_prev} never exists for ch-01, blocking all polish tasks). - project_index.yml: Loop 2 CLM dispatch -- when book is complete, enqueue marketing_campaign to crimson_leaf_marketing/book-marketing-agency. - project.yml files: fill in name, goal, genre, lead_author for all 3 CLP projects. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- templates/book_chapter.yml | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/templates/book_chapter.yml b/templates/book_chapter.yml index 456c543e..9f8e1802 100644 --- a/templates/book_chapter.yml +++ b/templates/book_chapter.yml @@ -293,9 +293,26 @@ steps: Start the chapter directly with the chapter title and first line. No preamble or commentary within the chapter text. - # Commit chapter draft now -- last_text() = self-check output (step 2). Must come before - # PASS 3 think so the character-state extraction does not overwrite last_text(). + # Extract chapter_number and chapter_ref from the PASS 1 chapter text before any document + # steps run. Without this, {chapter_number}/{chapter_ref} are unresolved at document time + # and filenames become "Chapter_chapter-number_draft.md" (slug-cleaned literal key names). + # source_step: 1 = PASS 1 output, which begins "Chapter N: Title". Cheap call (max_tokens: 150). + - type: package + source_step: 1 + max_tokens: 150 + hint: | + The chapter draft above starts with a chapter title line such as "Chapter 5: Some Title". + Extract: + - chapter_number: the plain chapter number as a string (e.g. "5") + - chapter_ref: zero-padded two-digit format (e.g. "ch-05" for chapter 5) + schema: + chapter_number: string + chapter_ref: string + + # Commit chapter draft now. chapter_number is in ContextVars from the package step above. + # source_step: 2 = SELF-CHECK output (step 2); required because LastText() now = package JSON. - type: document + source_step: 2 filename: "Chapter_{chapter_number}_draft" primary_deliverable: true strip_before_marker: "---BEGIN CHAPTER---" @@ -416,14 +433,15 @@ steps: - type: rag_write asset_id: "character-state" - source_step: 4 # PASS 3 character-state extraction; explicit to avoid last_text() falling back to chapter text + source_step: 5 # PASS 3 character-state extraction; explicit to avoid last_text() falling back to chapter text max_chars: 4000 - type: document + source_step: 5 filename: "character-state-{chapter_ref}" - type: package - source_step: 4 # PASS 3 -- character-state extraction (compact, describes permanent changes) + source_step: 5 # PASS 3 -- character-state extraction (compact, describes permanent changes) max_tokens: 4000 hint: | The draft chapter has been written, self-checked, and committed.