Skip to content

Instantly share code, notes, and snippets.

@thgaskell
Last active November 18, 2025 03:38
Show Gist options
  • Select an option

  • Save thgaskell/1dd81608834aedddf655e19efd40550d to your computer and use it in GitHub Desktop.

Select an option

Save thgaskell/1dd81608834aedddf655e19efd40550d to your computer and use it in GitHub Desktop.
Purge your Claude Code context window

Purge your Claude Code context window

Claude Code v2.0.43

Removes all system tools from the context window. Not very useful on its own, but it's a good starting point when developing Subagents. This helps to reclaim up to ~14k tokens (~7%) from the context window.

AskUserQuestion does not appear to be loaded when using --print (-p) flag for non-interactive mode.

Before

> /context
  ⎿  
      Context Usage
     ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛀ ⛀ ⛶   claude-haiku-4-5-20251001 · 16k/200k tokens (8%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ System prompt: 2.5k tokens (1.3%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ System tools: 13.4k tokens (6.7%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ Messages: 8 tokens (0.0%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛶ Free space: 184k (92.0%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶

     SlashCommand Tool · 0 commands
     └ Total: 864 tokens

After

> /context
  ⎿  
      Context Usage
     ⛁ ⛀ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   claude-haiku-4-5-20251001 · 2k/200k tokens (1%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ System prompt: 1.8k tokens (0.9%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛁ Messages: 8 tokens (0.0%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶   ⛶ Free space: 198k (99.1%)
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶
     ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶

Tools available to Claude

Source: https://docs.claude.com/en/docs/claude-code/settings#tools-available-to-claude

Claude Code has access to a set of powerful tools that help it understand and modify your codebase:

Tool Description Permission Required
Bash Executes shell commands in your environment Yes
Edit Makes targeted edits to specific files Yes
Glob Finds files based on pattern matching No
Grep Searches for patterns in file contents No
NotebookEdit Modifies Jupyter notebook cells Yes
NotebookRead Reads and displays Jupyter notebook contents No
Read Reads the contents of files No
SlashCommand Runs a custom slash command Yes
Task Runs a sub-agent to handle complex, multi-step tasks No
TodoWrite Creates and manages structured task lists No
WebFetch Fetches content from a specified URL Yes
WebSearch Performs web searches with domain filtering Yes
Write Creates or overwrites files Yes
Tools missing from official documentation (generated by Claude)
Tool Description Permission Required
AskUserQuestion Asks the user questions during execution with multiple choice options No
BashOutput Retrieves output from a running or completed background bash shell No
ExitPlanMode Exits plan mode after presenting an implementation plan No
KillShell Kills a running background bash shell (managed by Claude Code) by its ID No
Skill Executes a skill within the main conversation No
{
"permissions": {
"allow": [],
"deny": [
"Read",
"Write",
"Edit",
"AskUserQuestion",
"Bash",
"BashOutput",
"ExitPlanMode",
"Glob",
"Grep",
"KillShell",
"NotebookEdit",
"Skill",
"SlashCommand",
"Task",
"TodoWrite",
"WebFetch",
"WebSearch"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment