# Show Claude Code context usage in the status line

> One setting that displays your agent's context percentage, so you know when to clear before history compresses.

Source: https://fullbytedeveloper.com/blog/context-bar
Published here: 2026-11-09

Your coding agent's context fills up quietly. When it gets close to the limit, Claude Code summarizes older history to make room, and details can go. A live gauge tells you before that happens.

## Use the slash command

Type this in Claude Code [1]:

```text
/statusline show model name and context percentage with a progress bar
```

Claude Code writes the script into `~/.claude/` and updates your settings. Approve the file edit prompts when they appear.

You should see the model name and context percentage in the status line.

## Add the line by hand

If you have `jq` installed, add this to `~/.claude/settings.json` [1]:

```json title="~/.claude/settings.json"
{
  "statusLine": {
    "type": "command",
    "command": "jq -r '\"[\\(.model.display_name)] \\(.context_window.used_percentage // 0)% context\"'"
  }
}
```

You should see output like `[Sonnet] 87% context` when your session is running.

## Check the percentage before each task

My rule, not a built-in limit: past about 80%, finish the step you are on, then `/clear` before the next task. That keeps history from compressing mid-task.

The percentage counts input tokens only [2]. It can be empty early in a session. The `// 0` in the jq line shows 0% until there is data.

I ran the jq line on sample JSON (no live session): 42 in, `[Sonnet] 42% context` out; 87 in, `[Sonnet] 87% context` out.

Your status line now shows context usage. Clear when it climbs past 80% to keep full history for your current task.

Send this to the friend whose Claude Code forgets details halfway through a long session.

## Sources

1. [Claude Code docs: status line](https://code.claude.com/docs/en/statusline)
2. [Claude Code docs: costs](https://code.claude.com/docs/en/costs)
