Skip to content

Memory #6

@petecallaghans

Description

@petecallaghans

Session exists for your chat. So the SDK should be resuming with full history each time. The "forgetting" might be because:

  1. Context window fills up — old messages get evicted by the SDK when history gets too long
  2. Session gets invalidated — restarts or crashes wipe the SDK-side session
  3. Session ID changes — if the SDK returns a new ID, old history is lost

Here's what you can do to improve it:

File: src/gateway.ts

The session resume is already wired up. The issue is likely context window overflow on long sessions. Two things to add:

  1. Log when session ID changes — so you can see if sessions are being silently replaced
  2. Inject recent conversation summary into system prompt — as a fallback when SDK history gets evicted

For option 2, the simplest approach:

In src/memory.ts, add a conversation log that appends each user message + bot response summary to a file like data/conversation_{chatId}.log. Keep last ~20 exchanges. Load it into the system prompt alongside soul/memory.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions