|
Fix context loss: ensure system prompt is always present in LLM context
Replaced `if not session.context:` with a role-based check so the system message is inserted whenever it is absent — not just for brand-new sessions. Root cause: backward-compat sessions (context column was empty) had their context initialised from session.messages, which never contains a system message. The old check (`if not session.context:`) saw a non-empty list and skipped the system prompt, so every subsequent request ran without it — Navi had no persona and no profile instructions. Also add context_token_count field to Session (follow-up for token counter fix — persistence wiring comes in next commit). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
|---|
|
|
| navi/core/agent.py |
|---|
| navi/core/session.py |
|---|