A page refresh offers expand, which returns the observation the model already has

Open
#7,257 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python

Research direction

Start in agent.py around line 660 and trace how page refresh builds its available tools, then check the prompt text in prompts.py around lines 561 and 597. Compare those conditions with the observation and recall paths described in the issue, and inspect tools.py around line 685 and tools_schema.py around line 153. Done means expand is offered and named only when recall is available and document text is stored; verify both the page refresh tool list and the high-budget prompt.

Written by the indexing model from the issue text.

Description

core

What happens

A page refresh runs reflect with fact_types=["observation"], so the only ids its search loop ever holds are observation ids (o1, o2, ...). agent.py line 660 still offers expand whenever the bank stores document text (include_expand = store_document_text), and the prompt and the tool invite the call:

  • Workflow (prompts.py line 597): "Use expand() if you need more context on specific memories". Since #7235 left recall out of page refreshes, this is the only step between searching and answering in a page refresh's workflow.
  • At budget high, the research-depth section (prompts.py line 561): "Use expand() to get full context on important memories".
  • expand (tools_schema.py line 153): "Get more context for one or more memories. Memory hierarchy: memory -> chunk -> document."

expand reads the chunk or document behind a memory. An observation is written with no chunk_id and no document_id (insert_observation in memories/pg/consolidation.py), so tool_expand (tools.py line 685) returns the observation the model already has, at either depth. The result also skips the result presenter, which aliases only memories, observations and mental_models (presentation.py line 60). The same observation comes back under its full UUID, with a timestamp like 2026-11-27T16:50:45.200615+00:00 where every other result shows 2026-11-27 16:50.

The same two prompt lines also name expand when it is not offered at all, on a bank that stores no document text: they are written whatever the tool list holds.

Why it matters

Running page refreshes with Qwen3.8-27B (thinking on), in many requests the model calls expand on observations. It spends a turn, gets back text it already has, and the history now carries those observations a second time in a longer form. The model notices it got nothing new and goes back to searching. Sometimes it copies the UUIDs from the expand result into the next expand call.

Example 1: expand returns the observation it was given

Question: "What is the filmmaker's current approach to using AI in production, which specific platforms do they rely on, ..."

After two searches that returned only already_shown (#7256), the model called expand(["o1", "o7"], depth="document") with the reason "Need full source documents to find specific platform names". The result held the two observations again, under their UUIDs and with long timestamps. Its reasoning at the next call:

The expand didn't give me full documents - it just returned the observation texts themselves.

Next call: search_observations("AI tools specific names Sora Runway Kling Luma Midjourney video generation filmmaking").

Example 2: the model copies expand's UUIDs into the next expand

Question: "How this person currently uses AI to draft, edit, proofread and illustrate LinkedIn posts ..."

The model expanded o1, o2 and o3 at depth document. Two searches later it called expand again, at depth chunk, with the three UUIDs from that result (d1d8eb76-..., d5953397-..., a45eafb8-...). Its reasoning at the next call:

Looking at the expand results, the memory IDs returned are the observation IDs themselves (d1d8eb76..., d5953397..., a45eafb8...), not underlying raw memory IDs.
...
Let me try expanding with document depth to see if there's more detail available. But I already tried that and got the same text back.

Both examples were logged before #7235, so their system prompts still carry the recall text that change removed. The expand text they show is unchanged on main.

The full request and response for each example are in the comments below.

Expected

expand is offered, and named in the prompt, only when it can return something the model does not have: when recall is offered (recall's facts are the only ids with a chunk or document behind them) and the bank stores document text.

Reproduce

  • Run a page refresh with the default observation-only trigger on a bank that stores document text, and read the tools offered and the workflow section of the system prompt: expand is in both.
  • Call tool_expand with the id of any observation, at depth chunk or document: the result holds that observation and no chunk or document.
  • Build the system prompt with budget="high" for a bank with store_document_text off: both expand lines are present although the tool list leaves expand out.
Dominant language
Python
Stars
45.2k
Forks
5.9k
PR merge metrics
No merged PRs in 30d

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from vectorize-io/hindsight

All issues in vectorize-io/hindsight

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.