Skip to content

Add keyboard shortcut to reset Codex thread (clear history) #14

@HenryQuillin

Description

@HenryQuillin

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:

  1. Deletes the current session's thread metadata (~/.sage/{project}/threads/{sessionId}.json)
  2. Optionally clears the review cache (~/.sage/{project}/reviews/{sessionId}.json)
  3. Creates a fresh Codex thread
  4. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions