Claude Code cmds Context Clear Resume Compact

Posted on Friday, May 8, 2026


 


In this post I am going to be going over a few Claude commands /context, /clear, /resume,  and /compact


/context

Start up Claude

 

  > claude

 

Let me ask a simple question

 

  > What is the temperature in Tokyo

 

 



Now if you run

 

  > /context

 

 



Oops looks like I have a font issue.  There should be some glyphs here but my font has some issues…

Ok after a few fixes in FontForge… I got it fixed

 

Now what does this all mean?

Well first what is context?
The context can be thought of as a meeting with several people adding to the conversation.  With too many people talking Claude can lose focus on your actual task and performance can degrade.  If we have too little context Claude can hallucinate.

Let’s go bit by bit…


In the upper right I can see I am using Claude Sonnet 4.6
I have 16K tokens in the context out of a total possible of 200K tokens.


This section shows you the estimated token usage in the context by type.  There are other types missing here like MCP and Custom Agents ( in my particular case)
You can see that my Skills has 781 tokens


This section is just a quick visual of the space used.
In this case it’s a 10x10 grid and we can visually see how much is taken what.  Most of this is empty since I have not done much in this conversation.
You can even see the Messages, what I have typed this session and what claude has responded, is only 8 tokens. 

This can be a helpful tool to see what is taking up your context.

 


/clear

The /clear command is used to empty the  entire conversation history from the context window.  It’s a reset if you will so you can start a new conversation without the confusing the conversation with the last conversation (Context switching).  This can prevent “Hallucinations” based on the information from past conversations.

OK let’s do it and see what happens.

If ran a few queries to fill up the context with a few more messages.  Let me run /context again to see its current state.

 

  > /context

 

 


Now you can see we are at 9.9K tokens

Now run /clear

 

  > /clear

 

 


Then if I check the /context again

 

  > /context

 

 


I can see its almost back down to 0.   Well, it’s a 110 tokens.

 

/resume

After you use /clear and remove the message from the context you can get them back.

Every time you get or receive a message in Claude that message is written to a JSON file.  In fact it is written to a JSONL file (see what is JSONL https://jsonltools.com/what-is-jsonl  [1]). 

This file is in the ~/.claude/projects/-<DIR-PATH>/ directory.  Where the DIR-PATH is the folder path but with - replacing /.  So /home/patman/Desktop/stuff would become home-patman-Desktop-stuff.   In that folder are the message.json files for each session you ran in that directory.


Each with a unique ID.

So what is the current one?  One easy way to find it is to run the /status command

 

  > /status

 

 


There is the current session ID.
I could use this to grep that file if I wanted to.

 

Now if I run /resume

 

  > /resume

 

 

I will get a list of past saved message sessions in order.  You can see their size and how old they are.

You will only see message context that are tied to your current directory.

You can use the up and down arrow keys.  Then choose one.

Now you have your old messages back in context.

 

/compact

The /compact command will read the entire current conversation history all your messages and claudes replies that are in context and generates a high quality summary of the key points, decisions, and code.

It basically replaces the verbose conversation with the key points and highlights to reduce the space your messages are taking in the context.

This will not delete the information stored in the .jsonl file (so its possible to get it back)

Now /compact is not perfect it may not summarize how you want so you may want to interact with Claude to compact it in a better fashion than just using the /compact command.

But let’s give it a go and see what happens.

 

  > /context

 

 


12.6K tokens

 

  > /compact

 

 


 

  > /context

 

 

Now its 1.4K

Now a good video that goes into a little more depth I found is
Master Context in Claude Code in 5 Minutes https://youtu.be/I1EGbrH5Xdk?si=CCFYfVARBZifWfw8 [2]

 

 

References

[1]       What is JSONL
             
https://jsonltools.com/what-is-jsonl
            Accessed 05/2026
[2]       Master Context in Claude Code in 5 Minutes
             
https://youtu.be/I1EGbrH5Xdk?si=CCFYfVARBZifWfw8
            Accessed 05/2026

 

 

 

 

 


No comments:

Post a Comment