Repository navigation
perf: 受信箱の束の見出しの固定の注意文を、同じ会話の2回目以降は参照に畳む - #5390
Merged
Merged
Conversation
人間の束・同じ担当の報告の束・混合の束(見出しと同じ担当の塊の注意)・外部の同じ中身の束の 固定の注意文を DigestSessionDelta.fixed() で畳む。件数・担当名・時刻・本文は毎回出す。 参照には「最後まで読んでから判断する」等の要点と「同じ注意が会話の上にある」を残す。 全文へ戻る条件(compaction・会話の変化・観測なし・押し込めなかった回)は既存のまま。 畳む id は束の種類ごとに別。
This was referenced Oct 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
目的
クローンの費用の大半はキャッシュ読み(毎ターン文脈に積まれ、以後のターンで読み直され続ける文字数)。受信箱の束ねの本文(人間の束・同じ担当の報告の束・混合の束・外部の同じ中身の束)の見出しの固定の注意文が、束のたびに全文で積まれていた。既存の畳み込み(
DigestSessionDelta.fixed。同じ会話の 2 回目以降は短い参照、要約で潰れたら全文へ戻る)を、この注意文にも使う。変更(clone.ts、新規 clone-batch-heading-fold.test.ts)
fixed()で畳む(batch-human-heading-guide・batch-report-heading-guide・batch-mixed-heading-guide・batch-mixed-report-run-notice・batch-external-same-content-warning)。NO_FOLDなので、既存の呼び出しは全文のまま。managerReportBatchPrompt・externalBatchPrompt・ManagerReportMessageを export した。効く量(何を測ったか)
fixture(本文 1 文字・2 件の束)で、2 回目のプロンプト全体の字数。「前」は今回の id だけ畳まず既存の畳みは効かせた場合:
効きは小さい(1 束あたり約 25〜45 字)。 固定の注意文そのものが 55〜85 字と短く、要点を残した参照との差が小さいため。1 回の読み直し(約 15 万トークン)に対しては 0.1% 未満で、トークン換算・本番での束の頻度は未測定。判断の材料を落とさないことを優先した結果で、これ以上削るには文言の短縮が要り、AGENTS.md:45 の「移すだけ」に反する。
倒れ側
2 回目以降は注意の全文が会話の上にしか無くなる(参照に要点は残してある)。最初の全文が要約で消えた場合は、既存の仕組みで全文へ戻る(倒れ側は全文)。混合の束で塊が複数あるとき、同じ prompt 内の 2 つ目以降の塊の注意も全文(控えは prompt を入れた後に確定するため)。
確認
build・typecheck・lint・format:check と
pnpm testの packages・apps・scripts が通っている(packages 15693 件・apps 7791 件・scripts 1679 件)。新規 21 件: 5 種類の束それぞれで、1 回目は全文・2 回目は参照(可変部は毎回出る)/入力が入らなかった回の次は全文/compaction 後は全文/控えを渡さなければ毎回全文、と種類をまたいで id が混ざらないこと。DigestSessionDelta の実物を使った純関数の試験で、人間の束が呼び出し側で commit される配線は読んで確かめただけ(統合試験では未確認)。docs
docs/ と AGENTS.md に該当記述は無い(grep)。変更していない。