Skip to content

refactor: replace AI summary with rotation-based context#38

Open
oil-oil wants to merge 2 commits into
mainfrom
refactor/replace-summary-with-rotation-context
Open

refactor: replace AI summary with rotation-based context#38
oil-oil wants to merge 2 commits into
mainfrom
refactor/replace-summary-with-rotation-context

Conversation

@oil-oil

@oil-oil oil-oil commented Mar 31, 2026

Copy link
Copy Markdown
Owner

Summary

  • 移除 SUMMARY_MODEL 每日摘要生成机制,改为基于字符预算的轮转上下文管理
  • 新增 buildPastDaysTranscript:从 state.messages 按天构建完整的历史 transcript,预算 15k 字符,超出则从最旧的天开始丢弃,每天始终保留结构化事件头(夜晚出局/投票结果)
  • 简化 buildTodayTranscript:移除基于 dailySummaries 的压缩逻辑,仅保留 last words 优先 + 滑动窗口
  • 各阶段 transcript 字符限制大幅提升(DaySpeech 2k→8k, Vote 10k→20k, Night 2.2k→6k, Badge 1.5k→4k)
  • 移除 generateDailySummaryextractVoteDataFromDayMessagescheckNeedsMidDaySummarymaybeGenerateDailySummary 及所有调用点

效果

  • 每天少一次 SUMMARY_MODEL API 调用,降低延迟和成本
  • AI 玩家获得更丰富的实际发言上下文,推理质量应提升
  • 过去几天信息以轮转方式保留,不会完全失忆

Test plan

  • 完整游戏流程测试(多天制游戏,确认跨天信息正确显示)
  • 验证第 2 天+ AI 发言能引用前几天的具体发言内容
  • 确认投票/死亡等结构化信息在 history 中正确展示
  • 压力测试:4-5 天长局,确认上下文不会超出模型限制

🤖 Generated with Claude Code

…management

Remove the SUMMARY_MODEL-based daily summary generation and replace it with a
simpler rotation mechanism that includes actual past-day transcripts within a
character budget (~15k chars for history). Oldest days are dropped first when
the budget is exceeded, while structured event headers (deaths, vote results)
are always preserved.

This eliminates an extra LLM call per day transition, reduces latency, and
gives AI players access to richer context (actual speech rather than compressed
summaries). Per-phase transcript limits are also significantly increased.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Mar 31, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
wolfcha Ready Ready Preview, Comment Apr 1, 2026 10:06am

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant