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:

@echo off
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         ...

Cache stampede: when our cache turned against us

While investigating some performance issues, we ran into an ASP.NET Core API that cached a fairly expensive aggregation query for 60 seconds. Under normal load, that was fine: one request rebuilds the cache, everyone else reads from it. Under peak load, dozens of requests would arrive in that same expiry window, all see a cache miss, and all fire the same expensive query in parallel. The database didn't like that. That was the moment when our caching layer stopped helping and started hurting. A burst of requests comes in at the same time, all miss the cache, and all go hammer the database or the downstream API at once. That's a cache stampede . The cache was supposed to protect our backend, and for a few hundred milliseconds it did the opposite. Why this happens IMemoryCache.GetOrCreate (and its async sibling) looks like it protects you, but it doesn't add any locking on its own. Look at the naive version: public async Task<Report> GetReportAsync(string key) ...

A complex system designed from scratch never works

A few years ago, I worked as an architect on a big mainframe rewrite. I still count it as one of my failures. Not because the technology was wrong, but because I couldn't convince the management team to simplify the approach. Years later, the organization is still struggling to get the new system up and running. I left the project at the time, because I couldn't put my name behind an approach that would take very long and cost a lot of money without a working system to show for it along the way. Gall’s Law That memory keeps coming back to me, because it's a textbook case of Gall's Law playing out in real life. Gall's Law , from John Gall's Systemantics , states it plainly: A complex system that works is invariably found to have evolved from a simple system that worked. A complex system designed from scratch never works, and it cannot be patched to make it work. You have to start over with a simple system that works. What does that mean in practice,...