hindsight icon indicating copy to clipboard operation
hindsight copied to clipboard

A delta refresh takes up facts the page does not ask for; the length rewrite cuts far below the budget; nothing caps refresh tasks

Open Cosmonaut79 opened this issue 2 weeks ago • 0 comments

Seen on a self-hosted Hindsight 1.2.1 (API image by digest) and checked against main at 31d5556 (19 Nov 2026). Paths are under hindsight_api/; line numbers are those of the 1.2.1 image. Model: Qwen/Qwen3.5-397B-A17B-FP8 behind an OpenAI-compatible API, reasoning effort "none". No decision model is configured.

Three findings about mental-model refreshes, from two days of reading refreshed pages against their bank.

1. Without a decision model, a delta refresh puts new facts on pages they do not answer

  • Setting: 14 mental models in one bank, all mode: delta, fact_types: ["observation"], no tags, so all read the same observations. Two new notes had brought 31 new observations.
  • Result of one refresh of all 14, one after the other: 11 changed. Read against their questions, 8 got a section or block that does not answer the page's question, taken from a note about another subject. Three pages for which nothing was relevant returned no operation, rightly. A run the same morning had done the same to 4.
  • The prompts forbid it. The delta system prompt says content that does not help answer TOPIC "is OFF-TOPIC and should be removed", and that {"operations": []} is the expected answer when the new facts "are off-topic for it" (engine/reflect/prompts.py 1206 to 1207, 1325 to 1327). The refresh context says "ONLY include content that directly answers the topic query" (1494 to 1498). With this model the rules did not hold: its replies were add_section and append_block operations for those facts.
  • Why every page sees every fact: the supporting facts are what the refresh's searches find among the memories recorded since the last refresh, and a small batch is found by the searches of nearly every page. The one filter by page is the delta gate (engine/memory_engine.py 18191 to 18262), and it needs a decision model.
  • Detail is lost as well. Where a replace_block rewrote a block from the new facts, figures and names of the old block that the new facts did not repeat were gone (5 of the 14 pages), although the prompt asks for the smallest operation.

What would help: a relevance step that needs no decision model. For example, ask the LLM first which of the new memories change the answer to TOPIC and pass only those on; or make each operation name the supporting fact it rests on and why that fact answers TOPIC, and drop operations that cannot.

2. The length rewrite cuts far below the budget, and changes meaning

engine/reflect/agent.py 2098 to 2200 (_rewrite_to_length_budget): an answer over the model's max_tokens goes to a second call, "Shorten the user's document so it fits within the requested token budget. ... drop lower-priority detail", with "Target budget: N tokens".

max_tokens Written, characters Stored after the rewrite
4,096 16,306 (about a tenth over) 5,696
5,000 18,561 (just over) 10,140
5,000 29,197 9,889
  • The call is not told how far over the document is. It cut 65 % where about 11 % was needed. A page a little over its budget is stored at a third of its size; a page a little under is stored whole.
  • It hardens hedged statements. "The records contain no evidence of X" was stored as "There are no X".
  • Nothing shows that it ran. There is a log line for a refused rewrite, none for an accepted one, and no field on the refresh's outcome. It is visible only as a second reflect-scope row in llm_requests.

What would help: give the rewrite the document's token count beside the target; keep the original when the rewrite lands far below the budget (over budget is already a reported outcome); log an accepted rewrite and record the size before and after on the refresh.

3. Nothing caps how many refresh tasks run at once

  • The scheduled scan submits every due mental model in one pass (engine/maintenance.py 694 to 776), and a deletion queues a refresh for every mental model that cites a removed memory (engine/memory_engine.py 21499 to 21579). The worker then runs as many as it has free slots.
  • HINDSIGHT_API_WORKER_<TYPE>_RESERVED_SLOTS is a floor, not a cap (config.py 1074 to 1130), and no setting limits refresh_mental_model tasks. HINDSIGHT_API_MENTAL_MODEL_REFRESH_LLM_MAX_CONCURRENT limits their LLM calls, not the tasks; eight refreshes behind one permit still exceed a per-minute rate limit (#6674).
  • Workaround in use: reserve every slot but one for other task types (HINDSIGHT_API_WORKER_RETAIN_RESERVED_SLOTS=7 with 10 slots, 2 of them for consolidation), so that the shared pool, the only place a refresh can run, has one slot. On a copy, 4 refreshes queued within 0.03 s were then claimed strictly one after the other, and a retain was claimed beside the first. Its price: every task type without a reservation shares that one slot.

What would help: a ceiling per task type, or a limit on how many refreshes one scan submits.

Related

  • #5574: delta pages grow past max_tokens. Facts the page does not ask for are one way they grow. Its comments describe the same rewrite leaving a page over budget with another model; here it cuts too much.
  • #6315: batching the delta gate's questions. The gate is what section 1 lacks without a decision model.
  • #6674: refreshes that start together and the rate limit.
  • On main at 31d5556 the prompts, _rewrite_to_length_budget and the reservation logic read as in 1.2.1.

Cosmonaut79 avatar Nov 19 '26 09:11 Cosmonaut79