Skip to content

Chat history is cut at 40 messages / 24k chars without a marker or summary before compaction #1468

Description

@maxnoller

Problem

Each turn sends at most 40 stored messages (MAX_HISTORY_MESSAGES, src/gateway/gateway-chat-service.ts:201, 1662-1665), further cut to 24,000 characters by dropping whole oldest turns (src/session/token-efficiency.ts:4, 190-238). Nothing in the prompt indicates that earlier turns were removed; the drop counts only go to an audit event. HEAD_TAIL_TRUNCATED_MARKER is used for per-message truncation only.

No summary exists until session compaction fires, which happens at 200 stored messages or roughly 70k estimated tokens (src/config/config.ts:709-711, session-maintenance.ts:337-390). Between message 41 and compaction, older context is simply absent. The only bridge is "Relevant Memory Recall": at most 5 snippets of 220 characters (src/memory/memory-service.ts:286, 368) drawn from previous compaction summaries and audio transcripts, so it is empty for a session that has never been compacted. Those [mem:N] citations are chat recall, not files, but the model presents them as evidence of "memory".

Proposed fix

  • Insert an explicit "[earlier N turns omitted]" marker when turns are dropped.
  • Run a lightweight rolling summary once the 40-message window is exceeded, or align the compaction threshold with the prompt window.
  • Label recall snippets as "chat recall" in the prompt so the model does not cite them as saved memory.

Source: HybridClaw Reliability Assessment (2026-09-03, read-only audit against v0.29.1), re-verified against main v0.30.0.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority/P1High Priority — depth work

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions