Skip to content

feat: Current-session context buffer — searchable archive of compressed messages #2667

@simplenamebox-ops

Description

@simplenamebox-ops

Problem

During long sessions, context compression removes older messages. Once compressed, those messages are:

  1. Gone from active context (can't be referenced)
  2. Not in MEMORY.md (requires explicit extraction)
  3. Not searchable via session_search (only indexes past sessions)

This creates a "forgetfulness" gap mid-conversation. The agent cannot recall what was discussed earlier in the same session.

Example:

User discusses topic X at 09:30. By 15:30, context compression has removed those messages. If the user asks "what did we say about X earlier?", the agent cannot answer — the context is gone, and session_search won't help because the session hasn't ended yet.

Proposed Solution

A current-session buffer — a rolling archive of messages that were compressed out:

Features:

  1. Searchable mid-session — tool that queries the buffer:
  2. Lighter than MEMORY.md — not facts, just raw message history
  3. Auto-cleanup — buffer is discarded when session ends (already in session_search)
  4. Token-efficient — stored as text, not in active context

Implementation options:

Option Storage Query
A. SQLite temp table SQL LIKE or FTS5
B. Append-only log grep/ripgrep
C. Reuse session DB Extend SessionDB with table FTS5

Related

Alternative: Extend session_search

Current only indexes completed sessions. Could extend it to:

  1. Index current session in real-time
  2. Include "current session" results with a flag

But this changes session_search semantics and may not want all transient messages indexed permanently.


Use case: I lost context from 3 hours ago in this conversation. User asked "what did we discuss about Tavily?" and I couldn't recall because compression had already removed those messages from my context window.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/agentCore agent loop, run_agent.py, prompt buildertype/featureNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions