Unlock Full Agentic AI Tokenomics
Inside GitHub Copilot
An accidental discovery turned into a lightweight open-source superpower: drop a single pure-Python script into ~/.copilot/instructions/, run it from your terminal at the end of the day to log 29 telemetry columns into tokenomics-CCYYMMDD.csv with zero LLM token usage, or flip TOKENOMICS_SWITCH: ON whenever you want a live ## Tokenomics preview table inside GitHub Copilot Chat.
Why Developers & Engineering Leaders Love It
Built using only local files GitHub Copilot already writes to your user directory.
⚡ Zero Token Usage by Default
Run python update-ghcp-tokenomics.py from your terminal at the end of the day to sync all daily sessions into tokenomics-CCYYMMDD.csv while consuming 0 LLM tokens and 0 AIU credits.
🎛️ Opt-In Live Chat Preview (Default: OFF)
First-time deployment keeps TOKENOMICS_SWITCH: OFF in global.instructions.md. Want a live ## Tokenomics table in GHCP Chat after every prompt? Run --on anytime (uses a small fraction of cached tokens).
🔄 Multi-Turn Settlement Accuracy
Agentic turns invoke multiple tools before finishing. update-ghcp-tokenomics.py automatically reconciles previous turns across all daily sessions whose final tool-call usage settled after the response rendered.
Interactive Modular Switch Preview
Default deployment starts OFF (Zero Token Usage in chat). Click the switch below to preview opting into live in-chat ## Tokenomics tables:
## Record and report daily tokenomics at the end of execution - **Tokenomics Tracking Switch**: `TOKENOMICS_SWITCH: OFF` (Default) - **Switch Rule**: In-chat display skipped -> 0 EXTRA CHAT TOKENS
# End-of-Day Terminal / CLI Sync (0 Tokens Consumed): $ python ~/.copilot/instructions/update-ghcp-tokenomics.py CSV_PATH: .../tokenomics-20261024.csv (All daily turns synced at 0 token cost!)
Step-by-Step Setup Guide (Zero Token Usage First!)
Type your Windows / macOS username below to personalize all commands before copying:
Download update-ghcp-tokenomics.py into your .copilot/instructions folder
Run this one-liner in PowerShell (Windows) or Terminal (macOS/Linux) to save the zero-dependency script in your user directory:
New-Item -ItemType Directory -Force "C:\Users\YourAliasName\.copilot\instructions" | Out-Null Invoke-WebRequest -Uri "https://raw.githubusercontent.com/ShahabName/GetGHCPTokenomics/main/update-ghcp-tokenomics.py" ` -OutFile "C:\Users\YourAliasName\.copilot\instructions\update-ghcp-tokenomics.py"
Run from Terminal / CLI at the End of the Day (0 Tokens Consumed!)
GitHub Copilot automatically records every prompt's telemetry locally in ~/.copilot/session-state/<session-id>/events.jsonl. Run this command in your workspace terminal at the end of the day (or anytime on demand) to generate/update your 29-column tokenomics-CCYYMMDD.csv without consuming a single LLM token:
# Sync all Copilot sessions from today into tokenomics-CCYYMMDD.csv (0 tokens consumed!) python "C:\Users\YourAliasName\.copilot\instructions\update-ghcp-tokenomics.py" # Optional: also print the latest turn's ## Tokenomics Markdown table in your terminal python "C:\Users\YourAliasName\.copilot\instructions\update-ghcp-tokenomics.py" --markdown
Add the Modular Snippet to global.instructions.md (Default State: OFF)
Open C:\Users\YourAliasName\.copilot\instructions\global.instructions.md in VS Code and paste the modular snippet below. Notice that TOKENOMICS_SWITCH: OFF is the default so your chat prompts consume 0 extra tokens until you choose to enable in-chat preview:
## Record and report daily tokenomics at the end of execution - **Tokenomics Tracking Switch**: `TOKENOMICS_SWITCH: OFF` *(Default: `OFF` for zero token usage in chat — run `python "C:\Users\YourAliasName\.copilot\instructions\update-ghcp-tokenomics.py"` in your terminal at the end of the day to update `tokenomics-CCYYMMDD.csv` with 0 tokens consumed. Change to `ON` or run `--on` if you want a live `## Tokenomics` preview table in GHCP Chat at the end of each prompt, which consumes a small fraction of tokens)* - **Switch Rule**: Before recording or reporting tokenomics, check `TOKENOMICS_SWITCH` above. If it is set to `OFF`, skip running `update-ghcp-tokenomics.py`, do not create or modify `tokenomics-CCYYMMDD.csv` during the chat turn, and omit the `## Tokenomics` section from the response. When `TOKENOMICS_SWITCH: ON`, at the end of every prompt or task execution, record the prompt's tokenomics and AIC/AIU consumption in today's daily CSV file in the workspace root (`tokenomics-CCYYMMDD.csv`, where `CCYYMMDD` is the current date in `YYYYMMDD` format, such as `tokenomics-20261024.csv`) and display a summary in the final response. - Check whether `tokenomics-CCYYMMDD.csv` exists in the current workspace root directory with the following 29 header columns: ```csv timestamp_utc,session_id,challenge_or_task,turn_index,sequence_id,initiator,router_model,source_model,model_display_name,reasoning_effort,api_calls_count,user_prompt_multiplier,total_request_multiplier_cost,total_input_tokens,uncached_input_tokens,cache_read_tokens,cache_write_tokens,output_tokens,reasoning_tokens,tool_schema_tokens,cache_hit_ratio_pct,total_nano_aiu,total_aiu_credits,duration_ms,ttft_ms,tools_invoked,finish_reason,ai_credits_status,prompt_summary ``` - If `tokenomics-CCYYMMDD.csv` does not exist yet, create it with the 29 header columns above. - If `tokenomics-CCYYMMDD.csv` already exists, append the latest prompt turn tokenomics data from `C:\Users\YourAliasName\.copilot\session-state\<session-id>\events.jsonl` (and refresh any previous turn in the session whose final tool-call usage settled after the prior turn). You can run `python "C:\Users\YourAliasName\.copilot\instructions\update-ghcp-tokenomics.py"` to perform this check, creation, and append automatically. - At the end of every prompt response (immediately above `## Files`), include a `## Tokenomics` section showing the tokenomics usage data recorded in `tokenomics-CCYYMMDD.csv` (model, API calls, input/cache/output/reasoning tokens, cache hit %, total NanoAIU, total AIU/AIC credits, duration, and a clickable link to `[tokenomics-CCYYMMDD.csv](C:/full/absolute/path/to/tokenomics-CCYYMMDD.csv)` using its absolute filesystem path with `/` separators). ## Preserve default VS Code chat output - Recording tokenomics (`update-ghcp-tokenomics.py`) and appending `## Tokenomics` and `## Files` are strictly additive and must **never** replace, suppress, or alter VS Code's normal chat response or built-in tool defaults. - Always display the complete user-facing explanation, analysis, or report in the chat response, with `## Tokenomics` and `## Files` appended at the end.
Enable Live ## Tokenomics Preview in GHCP Chat (--on) When You Want It
Want a live ## Tokenomics table of major token usage fields (Model, API Calls, Input/Cached/Output/Reasoning Tokens, Cache Hit %, NanoAIU, AIU Credits, Duration & clickable CSV link) at the end of every prompt in GitHub Copilot Chat? Turn it ON yourself anytime! Note: Live in-chat preview uses a small fraction of tokens per prompt (1 prompt-cached tool call + ~200 output tokens to render the table, with 0 extra user prompt multiplier).
# Turn ON live ## Tokenomics preview table in GHCP Chat (consumes a fraction of tokens) python "C:\Users\YourAliasName\.copilot\instructions\update-ghcp-tokenomics.py" --on # Turn OFF live in-chat preview anytime (back to default 0-token CLI mode) python "C:\Users\YourAliasName\.copilot\instructions\update-ghcp-tokenomics.py" --off # Check current switch status (OFF by default) python "C:\Users\YourAliasName\.copilot\instructions\update-ghcp-tokenomics.py" --status
Interactive 29-Column Telemetry Schema Explorer
Filter the 29 columns captured in tokenomics-CCYYMMDD.csv by telemetry domain:
| # | Column Name | Category | What It Measures |
|---|