Bootstrap: sections cannot reuse budget that recent memories leave unused

オープン
#54 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
18/100
issue の種類
リファクタリング
明瞭さ
おおむね明確
活発さ
活発
技術スタック
javascript, typescript
領域
backend, search

調査の方向性

Start in src/search.ts, in the else branch of the GET /Memory/bootstrap handler where renderBootstrapSections runs before recent is packed. Compare the two packing shapes the issue describes and read the orientationShare reservation logic in summary-tree before choosing one. Done means a bootstrap with a registered section and few recent memories fills the budget with section items, and heavy recent use still gets its current share.

索引モデルが issue の本文から書いたものです。

説明

Problem

GET /Memory/bootstrap packs in this order: pinned, needsReview, contributed sections, recent, relevant (src/search.ts, the else branch that calls renderBootstrapSections). A section is rendered with budgetChars = budget - used before recent is loaded and packed, so it cannot know how much room recent will actually use.

A section that wants to leave room for recent memories therefore has to reserve a fixed share. summary-tree 0.2.1 (HarperFast/summary-tree#5) caps orientation at orientationShare (default 0.5) of budgetChars. When recent memories are few or short, that reserved half goes unused and the bootstrap returns less than the budget allows.

Measured on the summary-tree eval at a 2,000-char budget: orientation covers 8 of 30 topics with the fixed share, against 16 of 30 when it could take the whole remaining budget.

Proposed direction

Let a section's unused reservation flow back, or let leftover budget flow to sections, instead of each section guessing a fixed share. Two shapes to compare:

  1. Pack recent before rendering sections. Load and pack recent (perhaps capped at a share of the budget), then render sections with the true remainder. Cost: sections can no longer render concurrently with the recent load, which adds latency to every bootstrap that has a section.
  2. Render sections with a soft and a hard budget. Sections return items in priority order; the server packs section items up to the soft share, packs recent, then packs further section items into whatever is left. Keeps the concurrency, but changes the section render contract (items must be ordered and individually droppable, which the per-item fits check already assumes).

Whichever shape is chosen, the per-item framing overhead from HarperFast/agent-memory#50 (itemOverheadChars) still applies.

Acceptance

  • With a section registered and few recent memories, the bootstrap fills the budget with section items rather than leaving the section's reserved share empty.
  • With many recent memories, recent still gets the share it gets today.
  • summary-tree can drop or relax orientationShare once this lands.
主要言語
JavaScript
スター
0
フォーク
0
平均マージ
20時間 29分
マージ済み PR(30日)
28

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

HarperFast/agent-memory のほかの issue

HarperFast/agent-memory の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。