Просмотр исходного кода

fix(writer): inject all writing methodology in governed mode

Removed !governed guards from 9 writing methodology modules that
were previously skipped in v2 governed mode:

- buildAntiAIExamples / buildEnglishAntiAIRules (AI-tell prevention)
- buildCharacterPsychologyMethod / buildEnglishCharacterMethod
- buildSupportingCharacterMethod (anti-NPC flat characters)
- buildReaderPsychologyMethod (reader immersion / empathy)
- buildEmotionalPacingMethod (emotional rhythm control)
- buildImmersionTechniques (five-sense, visualization, familiarity)
- buildGoldenChaptersRules (黄金三章 — first 3 chapters special rules)
- buildPreWriteChecklist (self-check before writing)

These modules define HOW to write (methodology), while chapterIntent
defines WHAT to write (goals/constraints). They don't conflict —
governed mode was incorrectly assuming chapterIntent covers both.

All 520 tests pass.
Ma 7 месяцев назад
Родитель
Сommit
e32bbec54f

+ 4 - 4
packages/core/src/__tests__/writer-prompts.test.ts

@@ -31,7 +31,7 @@ const GENRE: GenreProfile = {
 };
 
 describe("buildWriterSystemPrompt", () => {
-  it("demotes always-on methodology blocks in governed mode", () => {
+  it("includes writing methodology blocks in governed mode", () => {
     const prompt = buildWriterSystemPrompt(
       BOOK,
       GENRE,
@@ -49,9 +49,9 @@ describe("buildWriterSystemPrompt", () => {
 
     expect(prompt).toContain("## 输入治理契约");
     expect(prompt).toContain("卷纲是默认规划");
-    expect(prompt).not.toContain("## 六步走人物心理分析");
-    expect(prompt).not.toContain("## 读者心理学框架");
-    expect(prompt).not.toContain("## 黄金三章规则");
+    // Writing methodology is now always injected regardless of mode
+    expect(prompt).toContain("六步走人物心理分析");
+    expect(prompt).toContain("黄金三章");
   });
 
   it("uses target-range wording when a length spec is provided", () => {

+ 11 - 11
packages/core/src/agents/writer-prompts.ts

@@ -45,8 +45,8 @@ export function buildWriterSystemPrompt(
         buildEnglishCoreRules(book),
         buildGovernedInputContract("en", governed),
         buildLengthGuidance(resolvedLengthSpec, "en"),
-        !governed ? buildEnglishAntiAIRules() : "",
-        !governed ? buildEnglishCharacterMethod() : "",
+        buildEnglishAntiAIRules(),
+        buildEnglishCharacterMethod(),
         buildGenreRules(genreProfile, genreBody),
         buildProtagonistRules(bookRules),
         buildBookRulesBody(bookRulesBody),
@@ -55,7 +55,7 @@ export function buildWriterSystemPrompt(
         fanficContext ? buildFanficCanonSection(fanficContext.fanficCanon, fanficContext.fanficMode) : "",
         fanficContext ? buildCharacterVoiceProfiles(fanficContext.fanficCanon) : "",
         fanficContext ? buildFanficModeInstructions(fanficContext.fanficMode, fanficContext.allowedDeviations) : "",
-        !governed ? buildEnglishPreWriteChecklist(book, genreProfile) : "",
+        buildEnglishPreWriteChecklist(book, genreProfile),
         outputSection,
       ]
     : [
@@ -63,13 +63,13 @@ export function buildWriterSystemPrompt(
         buildCoreRules(resolvedLengthSpec),
         buildGovernedInputContract("zh", governed),
         buildLengthGuidance(resolvedLengthSpec, "zh"),
-        !governed ? buildAntiAIExamples() : "",
-        !governed ? buildCharacterPsychologyMethod() : "",
-        !governed ? buildSupportingCharacterMethod() : "",
-        !governed ? buildReaderPsychologyMethod() : "",
-        !governed ? buildEmotionalPacingMethod() : "",
-        !governed ? buildImmersionTechniques() : "",
-        !governed ? buildGoldenChaptersRules(chapterNumber) : "",
+        buildAntiAIExamples(),
+        buildCharacterPsychologyMethod(),
+        buildSupportingCharacterMethod(),
+        buildReaderPsychologyMethod(),
+        buildEmotionalPacingMethod(),
+        buildImmersionTechniques(),
+        buildGoldenChaptersRules(chapterNumber),
         bookRules?.enableFullCastTracking ? buildFullCastTracking() : "",
         buildGenreRules(genreProfile, genreBody),
         buildProtagonistRules(bookRules),
@@ -79,7 +79,7 @@ export function buildWriterSystemPrompt(
         fanficContext ? buildFanficCanonSection(fanficContext.fanficCanon, fanficContext.fanficMode) : "",
         fanficContext ? buildCharacterVoiceProfiles(fanficContext.fanficCanon) : "",
         fanficContext ? buildFanficModeInstructions(fanficContext.fanficMode, fanficContext.allowedDeviations) : "",
-        !governed ? buildPreWriteChecklist(book, genreProfile) : "",
+        buildPreWriteChecklist(book, genreProfile),
         outputSection,
       ];