Session exists for your chat. So the SDK should be resuming with full history each time. The "forgetting" might be because:
- Context window fills up — old messages get evicted by the SDK when history gets too long
- Session gets invalidated — restarts or crashes wipe the SDK-side session
- 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:
- Log when session ID changes — so you can see if sessions are being silently replaced
- 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.
Session exists for your chat. So the SDK should be resuming with full history each time. The "forgetting" might be because:
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:
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.