OpenViking icon indicating copy to clipboard operation
OpenViking copied to clipboard

session commit recursively summarizes messages.jsonl via generic file summary

Open dddgogogo opened this issue 8 months ago • 2 comments

Summary

During session commit, OpenViking recursively enqueues the session temp directory into SemanticQueue, which causes messages.jsonl (the archived session transcript) to be summarized via the generic file-summary prompt and sent to the configured VLM (ov-llm).

From a production usage perspective, this looks wasteful and low-value:

  • it re-sends large chunks of already-known chat history to the model,
  • increases token cost and latency,
  • adds load to ov-llm,
  • and does not seem to provide meaningful additional retrieval value for messages.jsonl specifically.

What I observed

The current flow appears to be:

  1. session.commit() archives current messages.
  2. It enqueues session / user / agent temp trees into SemanticQueue with recursive=True.
  3. SemanticProcessor walks files and summarizes them.
  4. messages.jsonl is treated as a generic text file and goes through semantic.file_summary.
  5. The resulting prompt is literally:
Please generate a summary for the following file:

【File Name】
messages.jsonl

【File Content】
...

At runtime this produced repeated ov-llm requests containing historical session transcript content from messages.jsonl.

Why this seems problematic

messages.jsonl is not a normal user document. It is already the canonical session transcript / archive. Summarizing it again as a generic file seems to duplicate work already covered by:

  • session structured summary / compression,
  • memory extraction,
  • and directory-level semantic generation.

So the current behavior feels like a side effect of the generic recursive semantic pipeline, rather than an intentional high-value feature for session archives.

Question

Is this behavior intentional?

If yes, what retrieval / indexing benefit is expected from generating a generic file summary for messages.jsonl after every commit?

Suggestion

Possible options:

  • skip messages.jsonl in semantic file-summary generation,
  • or special-case session archive files so they do not go through generic file summarization,
  • or make this behavior configurable.

I think this would reduce unnecessary VLM traffic and make session commit cheaper / faster in production.

dddgogogo avatar Mar 12 '26 21:03 dddgogogo

Thanks for the report. Traced through the code and confirmed the issue.

Root cause: session.commit() enqueues the session temp directory into SemanticQueue with recursive=True. SemanticDagExecutor processes all files uniformly, so messages.jsonl goes through two steps:

  1. VLM file summary — serves as intermediate input for generating the archive directory's .overview.md / .abstract.md. This step is necessary.
  2. Vectorization — after file summary, _file_summary_task calls _vectorize_single_file() to embed messages.jsonl individually. This step is redundant.

messages.jsonl is the raw session transcript and doesn't need to be vectorized on its own. Valuable content is already extracted as memories into user/agent directories and vectorized there independently.

Fix direction: Skip vectorization for messages.jsonl in _file_summary_task, while keeping the file summary generation (needed as input for directory overview).

qin-ctx avatar Mar 13 '26 04:03 qin-ctx

I traced this to SemanticDagExecutor._file_summary_task() in openviking/storage/queuefs/semantic_dag.py.

Current behavior vectorizes every file after summary generation, which means messages.jsonl inside session archives gets embedded as a standalone file even though its summary is mainly needed as input for the archive/directory overview. That makes the transcript get indexed twice in practice: once through the archive-level semantic node and again as a raw file.

I tested a narrow fix direction: keep summary generation for messages.jsonl, but skip standalone file vectorization only when the parent URI is under viking://session/.... Directory-level overview/vectorization stays unchanged, and normal files in the same archive still vectorize normally.

I also added a focused regression test for:

  • archive directory still vectorized
  • regular files still vectorized
  • messages.jsonl not vectorized as a standalone file

Local isolated test passed.

yash27-lab avatar Mar 14 '26 23:03 yash27-lab