Feature Request: Use /clear and /compact within prompts

Resolved 💬 4 comments Opened Jul 14, 2025 by SEOTrafficAI Closed Jan 7, 2026

I realized that claude code fills its context unnecessarily when I run sequential tasks which can be fully separated into distinct steps. It would be useful, if we could write commands like /clear and /compact within our prompts.

Example Prompt:

Step 1: Do task A
/clear
Step 2: Do task B
/clear
Step 3: Do task C

So what claude code does RIGHT NOW when working on Step 3 is: It keeps the context from Step 1 and Step 2 and "wastes" tokens / electricity etc...

Sometimes of course a long context window is needed and wanted, but for some tasks, a steerable "context cut off" system would be highly useful (I mean tasks where a subsequent task does NOT need to know any information from a task which ran before).

So my suggestion would be to introduce a kind of "prompt driven context management" approach.

Hope this idea is useful!

View original on GitHub ↗

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