Skip to main content

GitHub Copilot CLI

Whatโ€‹

Display GitHub Copilot CLI session information including the current AI model, token usage, and workspace details. Shows a visual gauge of context window usage and formatted token/duration information for monitoring your Copilot CLI session.

This segment integrates with GitHub Copilot CLI's statusline functionality to provide real-time session data in your prompt.

For setup instructions, see Change your prompt.

Sample Configurationโ€‹

{
"type": "copilot_cli",
"style": "diamond",
"leading_diamond": "๎‚ถ",
"trailing_diamond": "๎‚ด",
"foreground": "#111111",
"background": "#fee898",
"template": " ๎ฐž {{ .Model.DisplayName }} ๏‹ {{ .TokenGauge }} "
}

Template (info)โ€‹

default template
\uec1e {{ .Model.DisplayName }} \uf2d0 {{ .TokenGauge }}

Optionsโ€‹

NameTypeDefaultDescription
gauge_marked_charstringโ–ฐCharacter used for filled blocks in gauge visualizations
gauge_unmarked_charstringโ–ฑCharacter used for empty blocks in gauge visualizations

Propertiesโ€‹

NameTypeDescription
.CWDstringCurrent working directory
.SessionIDstringUnique identifier for the Copilot CLI session
.SessionNamestringCustom session name; empty when absent
.TranscriptPathstringPath to the session transcript directory
.ModelModelAI model information
.WorkspaceWorkspaceWorkspace directory information
.RemoteRemoteRemote connection state
.VersionstringCopilot CLI version
.UsernamestringAuthenticated username; empty when absent
.CostCostDuration and line-change information
.ContextWindowContextWindowToken usage information
.TokenUsagePercentPercentagePercentage of context window used (0-100)
.TokenGaugestringGauge showing remaining context capacity using configured characters (e.g., โ–ฐโ–ฐโ–ฐโ–ฑโ–ฑ)
.TokenGaugeUsedstringGauge showing used context capacity using configured characters (e.g., โ–ฐโ–ฐโ–ฑโ–ฑโ–ฑ)
.RemainingPercentPercentagePercentage of context window remaining (0-100)
.RemainingTokensCountintNumber of remaining context window tokens; 0 when context window size is unknown
.FormattedTokensstringHuman-readable token count (e.g., "1.2K", "15.3M")
.FormattedDurationstringTotal session duration (e.g., "2m 5s")
.FormattedAPIDurationstringAPI wait time (e.g., "0m 45s")

Model Propertiesโ€‹

NameTypeDescription
.IDstringTechnical model identifier
.DisplayNamestringHuman-readable model name (e.g., "claude-sonnet-4.6 (medium)")

Workspace Propertiesโ€‹

NameTypeDescription
.CurrentDirstringCurrent working directory

Remote Propertiesโ€‹

NameTypeDescription
.ConnectedboolWhether a remote connection is active

Cost Propertiesโ€‹

NameTypeDescription
.TotalDurationMSDurationMSTotal session duration in milliseconds (formats as "Xm Ys")
.TotalAPIDurationMSDurationMSTime spent waiting for API responses (formats as "Xm Ys")
.TotalLinesAddedintLines of code added in the session
.TotalLinesRemovedintLines of code removed in the session
.TotalPremiumRequestsintNumber of premium model requests made in the session

ContextWindow Propertiesโ€‹

NameTypeDescription
.ContextWindowSize*intMaximum context window size; nil when unknown
.UsedPercentage*float64Percentage used (0-100); nil when unknown
.RemainingPercentage*float64Percentage remaining (0-100); nil when unknown
.RemainingTokens*intRemaining token count; nil when unknown
.CurrentContextTokensintTokens in the current active context
.TotalInputTokensintTotal input tokens used in the session
.TotalOutputTokensintTotal output tokens generated in the session
.TotalCacheReadTokensintTotal tokens read from cache
.TotalCacheWriteTokensintTotal tokens written to cache
.TotalReasoningTokensintTotal reasoning tokens used in the session
.TotalTokensintGrand total of all tokens used in the session
.LastCallInputTokensintInput tokens for the most recent API call
.LastCallOutputTokensintOutput tokens for the most recent API call

Percentage Methodsโ€‹

The Percentage type (returned by .TokenUsagePercent, .RemainingPercent) provides additional methods for direct use in templates:

MethodReturnsDescription
.GaugestringVisual gauge showing remaining capacity using hardcoded โ–ฐ/โ–ฑ characters
.GaugeUsedstringVisual gauge showing used capacity using hardcoded โ–ฐ/โ–ฑ characters
.StringstringNumeric percentage value (e.g., "75")
Custom gauge characters

Use .TokenGauge and .TokenGaugeUsed instead of the raw .Percentage methods above โ€” they respect the gauge_marked_char and gauge_unmarked_char options.

How it worksโ€‹

The oh-my-posh copilot command reads GitHub Copilot CLI's session JSON from stdin, caches the parsed data, then renders your configured prompt. Copilot CLI sends a fresh JSON payload on every statusline refresh.

The segment is only visible when Copilot CLI is actively providing session data.