Slash commands (/exit, /clear, /status) should not appear in model context window on session resume

Resolved 💬 3 comments Opened May 12, 2026 by a031070 Closed Jun 11, 2026

Problem

When resuming a session with --resume, all slash commands from previous sessions appear in the context window. These commands carry no semantic value for the model but consume tokens and clutter the conversation history.

Screenshot from a real session after resume:

<img width="1282" height="623" alt="Image" src="https://github.com/user-attachments/assets/056a1622-1801-4ef3-88c0-02e1627525e8" />

/clear → (no content)
/exit → See ya!

This becomes especially noticeable in multi-session workflows — for example, when exploring different directions on a project by forking sessions (opening multiple sessions from the same base). Switching between sessions means accumulating many /exit, /clear, and similar commands in the resumed context, none of which are useful to the model.

Proposed solution

Two complementary changes:

  1. At write time — don't record pure slash commands (/exit, /clear, /status, /help, etc.) to JSONL session history at all
  2. At load time — filter them out during --resume for backward compatibility with already-saved sessions

Together these keep the context clean without requiring any flags from the user.

Alternative

A --resume --clean flag that filters slash commands on demand, preserving current behavior as the default.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗