Bläddra i källkod

chore(core): architect writeFoundationFiles 加布局分支 debug log

新建书或 reviseFoundation 落盘时,往 logger.info 输出一行记录本次走的是
phase5 还是 legacy 分支、storyFrame/volumeMap 字符数、roles 数量。

用途:当用户发现建书后磁盘只有 story_bible.md 没有 outline/ 时,看这行
能直接判断是 LLM 没按新 prompt 输出(走 legacy 分支)还是 writeFoundationFiles
本身的问题,不用读代码排查。

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
fanghanjun 6 månader sedan
förälder
incheckning
4aa3e667e6
1 ändrade filer med 9 tillägg och 0 borttagningar
  1. 9 0
      packages/core/src/agents/architect.ts

+ 9 - 0
packages/core/src/agents/architect.ts

@@ -534,6 +534,15 @@ Rules:
     const roles = output.roles ?? [];
     const isPhase5Output = storyFrame.trim().length > 0;
 
+    // debug: 让排查时能一眼看出 LLM 按哪套格式输出、落到哪套文件布局。
+    // 如果用户新建书后发现只有 story_bible.md / 没有 outline/,看这行日志能
+    // 确认是 LLM 没按新 prompt 输出(走了 legacy 分支),而不是 writeFoundationFiles
+    // 本身的 bug。
+    this.ctx.logger?.info(
+      `[architect] writeFoundationFiles layout=${isPhase5Output ? "phase5" : "legacy"} ` +
+      `storyFrame=${storyFrame.length}chars volumeMap=${volumeMap.length}chars roles=${roles.length}`,
+    );
+
     if (isPhase5Output) {
       // book_rules 的 YAML frontmatter 提取后拼到 story_frame.md 顶部,作为权威位置。
       const { frontmatter: bookRulesFrontmatter, body: bookRulesBody } =