If you spend serious time in GitHub Copilot CLI, you've probably had that moment. You're deep in a session, things are moving fast, and suddenly you hit context compaction out of nowhere. The /context and /usage commands help, but they interrupt your flow. What if the information was just there, all the time, without you having to ask?
That's exactly where the statusline command can help: a persistent, live bar at the bottom of your CLI session that shows whatever your script prints — token usage, context percentage, current model, cost estimates, session duration, and more.
Once it's running, it looks something like this:
█████░░░░░ 50% 64.0k/128.0k | ✱ Sonnet 4.5 | ~$0.04 | ⏱️ 00:12:34
This guide walks you through the full setup from scratch, including a "hello world" sanity check. In a follow-up post we’ll tweak the result to example above.
Status: Custom status line support requires experimental features enabled in Copilot CLI. You can enable these with
/experimental on
Option 1 – Tweak the default status line in Copilot CLI
Start Copilot CLI, then use the built-in command to open the status line configuration:
/statusline
Now you can enable multiple elements in your status line. For example, we’ll add information about the context window size and daily quota:
Our statusline now looks like this:
Option 2: Create a custom status line
That’s a good starting point. But if these tweaks above are not sufficient, you can choose custom from the list.
Now we can configure a custom command that will be executed. To configure this command, go to %USERPROFILE%/.copilot/settings.json and add the statusLine configuration:
{
"statusLine": {
"type": "command",
"command": "statusline.cmd"
}
}
PowerShell scripts aren't directly executable on Windows, so we’ll use an intermediate statusline.cmd that invokes our Powershell script:
pwsh -NoProfile -ExecutionPolicy Bypass -File "%~dp0statusline-script.ps1"
Use pwsh (PowerShell 7+) rather than powershell.exe — it starts significantly faster, which matters because Copilot CLI will time out your script if it takes too long.
-NoProfile is also essential — without it, PowerShell loads your full profile on every single status line update, adding noticeable latency.
Start with a sanity check
Before building anything real, confirm the wiring works with the simplest possible script:
Write-Host "Hello from PowerShell status line!"
Run /restart inside Copilot CLI. If you see the message in the status bar after your next prompt, everything is connected correctly. This one-liner separates configuration problems from script problems — worth doing before going further.
Inspect what Copilot actually sends
Copilot CLI pipes a JSON payload to your script via stdin after each model response. To see exactly what you're working with in your version of the CLI, temporarily replace the script with this:
#Requires -Version 7
$payload = $input | ConvertFrom-Json
Write-Host "Payload: $($payload | ConvertTo-Json -Compress)"
Restart and run a prompt. The full JSON will appear in the status bar. This payload is your data source for everything that you want to show.
Conclusion
The /statusline custom command is a small feature with a high leverage ratio. Once it's running, you stop thinking about context and cost and just work. The setup is roughly four steps: enable experimental features, open /statusline to toggle the custom option, wire up the config, write a simple test script, then you are ready to build the real thing.
We’ll continue tomorrow…