Problem
When Sage's Codex thread accumulates too much context, users see this error:
Codex ran out of room in the model's context window. Start a new conversation or clear earlier history before retrying.
Currently, the only way to clear history is to manually delete files:
rm -rf ~/.sage/YOUR-PROJECT-PATH/threads/
rm -rf ~/.sage/YOUR-PROJECT-PATH/reviews/
This is not discoverable and breaks the user's flow.
Proposed Solution
Add a keyboard shortcut (e.g., N for "new thread") that:
- Deletes the current session's thread metadata (
~/.sage/{project}/threads/{sessionId}.json)
- Optionally clears the review cache (
~/.sage/{project}/reviews/{sessionId}.json)
- Creates a fresh Codex thread
- Shows a confirmation message like
✓ Thread reset - starting fresh
Suggested UX
- Shortcut:
N (available from the running screen)
- Confirmation: Optional prompt "Reset thread and start fresh? (y/n)" to prevent accidental resets
- Feedback: Brief status message confirming the reset
Implementation Notes
Key files:
src/ui/App.tsx - Add keyboard handler in useInput
src/lib/threads.ts - Add deleteThreadMetadata() function (or use existing delete logic)
src/lib/review-cache.ts - Optionally clear cached reviews
The thread deletion logic already exists for edge cases (see thread-persistence.md documentation).
Additional Context
This came up from a user in Discord who hit the context limit and didn't know how to recover.
Problem
When Sage's Codex thread accumulates too much context, users see this error:
Currently, the only way to clear history is to manually delete files:
This is not discoverable and breaks the user's flow.
Proposed Solution
Add a keyboard shortcut (e.g.,
Nfor "new thread") that:~/.sage/{project}/threads/{sessionId}.json)~/.sage/{project}/reviews/{sessionId}.json)✓ Thread reset - starting freshSuggested UX
N(available from the running screen)Implementation Notes
Key files:
src/ui/App.tsx- Add keyboard handler inuseInputsrc/lib/threads.ts- AdddeleteThreadMetadata()function (or use existing delete logic)src/lib/review-cache.ts- Optionally clear cached reviewsThe thread deletion logic already exists for edge cases (see
thread-persistence.mddocumentation).Additional Context
This came up from a user in Discord who hit the context limit and didn't know how to recover.