Skip to main content

Always know where you stand: Setting up a live status line in GitHub Copilot CLI

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…

Popular posts from this blog

Podman– Command execution failed with exit code 125

After updating WSL on one of the developer machines, Podman failed to work. When we took a look through Podman Desktop, we noticed that Podman had stopped running and returned the following error message: Error: Command execution failed with exit code 125 Here are the steps we tried to fix the issue: We started by running podman info to get some extra details on what could be wrong: >podman info OS: windows/amd64 provider: wsl version: 5.3.1 Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM Error: unable to connect to Podman socket: failed to connect: dial tcp 127.0.0.1:2655: connectex: No connection could be made because the target machine actively refused it. That makes sense as the podman VM was not running. Let’s check the VM: >podman machine list NAME         ...

Azure DevOps/ GitHub emoji

I’m really bad at remembering emoji’s. So here is cheat sheet with all emoji’s that can be used in tools that support the github emoji markdown markup: All credits go to rcaviers who created this list.

VS Code Planning mode

After the introduction of Plan mode in Visual Studio , it now also found its way into VS Code. Planning mode, or as I like to call it 'Hannibal mode', extends GitHub Copilot's Agent Mode capabilities to handle larger, multi-step coding tasks with a structured approach. Instead of jumping straight into code generation, Planning mode creates a detailed execution plan. If you want more details, have a look at my previous post . Putting plan mode into action VS Code takes a different approach compared to Visual Studio when using plan mode. Instead of a configuration setting that you can activate but have limited control over, planning is available as a separate chat mode/agent: I like this approach better than how Visual Studio does it as you have explicit control when plan mode is activated. Instead of immediately diving into execution, the plan agent creates a plan and asks some follow up questions: You can further edit the plan by clicking on ‘Open in Editor’: ...