copilot-log-analysis
БесплатноБез исполняемых скриптовНе проверенAnalyzing GitHub Copilot session log files to extract token usage, model information, and interaction data. Use when working with session files, understanding…
от rajbos★ 127 звёзд на GitHubОб этом скилле
Copilot Log Analysis Skill
This skill documents the methods and approaches used by the AI Engineering Fluency extension to analyze Copilot session log files. These files contain chat sessions, token usage, and model information.
Overview
The extension analyzes two types of log files:
.jsonfiles: Standard VS Code Copilot Chat session files.jsonlfiles: Copilot CLI/Agent mode sessions, JetBrains IDE Copilot Chat sessions, Claude Code sessions, Gemini CLI sessions, Antigravity sessions, and other ecosystem adapters (one JSON event per line)
Session File Discovery
Key Method: getCopilotSessionFiles()
Location: src/extension.ts (via SessionDiscovery)
Helper Methods: getVSCodeUserPaths(), scanDirectoryForSessionFiles()
This method discovers session files across all VS Code variants and locations:
Supported VS Code Variants:
- VS Code (Stable)
- VS Code Insiders
- VS Code Exploration
- VSCodium
- Cursor
- VS Code Server/Remote
File Locations Checked:
- Workspace Storage:
{VSCode User Path}/workspaceStorage/{workspace-id}/chatSessions/*.json - Global Storage (Legacy):
{VSCode User Path}/globalStorage/emptyWindowChatSessions/*.json - Copilot Chat Extension Storage:
{VSCode User Path}/globalStorage/github.copilot-chat/**/*.json - Copilot CLI Sessions:
~/.copilot/session-state/*.jsonl - JetBrains IDE Copilot Sessions:
~/.copilot/jb/{conversationId}/partition-{n}.jsonl - Gemini CLI Sessions:
~/.gemini/tmp/{project}/chats/session-*.jsonl - Antigravity Sessions:
~/.gemini/antigravity/brain/{session-uuid}/.system_generated/logs/transcript.jsonl
Format difference: items 1-3 are .json files (VS Code Copilot Chat; one JSON document per file). Items 4-7 are .jsonl files (CLI/agent style; one JSON event per line, not a single JSON document).
Platform-Specific Paths:
- Windows:
%APPDATA%/{Variant}/User - macOS:
~/Library/Application Support/{Variant}/User - Linux:
~/.config/{Variant}/User(respectsXDG_CONFIG_HOME) - Remote/Server:
~/.vscode-server/data/User,~/.vscode-server-insiders/data/User
Helper Method: getVSCodeUserPaths()
Location: src/extension.ts
Returns all possible VS Code user data paths for different variants and platforms.
Helper Method: scanDirectoryForSessionFiles()
Location: src/extension.ts
Recursively scans directories for .json and .jsonl session files.
Field Extraction Methods
Parsing and Token Accounting: parseSessionFileContent()
Location: src/sessionParser.ts
Purpose: Parses session files and returns tokens, interactions, model usage, and editor type-safe model IDs.
How it works:
- Accepts raw file content along with callbacks for token estimation and model detection.
- Supports both
.json(Copilot Chat) and.jsonl(CLI/agent) formats, including delta-based JSONL streams. - Counts interactions (user messages), input tokens, and output tokens while grouping by model.
- Uses
estimateTokensFromText()(insrc/extension.ts) for character-to-token estimation.
Model Detection Logic: getModelFromRequest()
Location: src/extension.ts
- Primary:
request.result.metadata.modelId - Fallback: parses
request.result.detailsfor known model patterns - Detected patterns: GPT-3.5-Turbo, GPT-4 family (4, 4.1, 4o, 4o-mini, 5, o3-mini, o4-mini), Claude Sonnet (3.5, 3.7, 4), Gemini (2.5 Pro, 3 Pro, 3 Pro Preview); defaults to
gpt-4 - Display name mapping in
getModelDisplayName()adds variants such as GPT-5 family, Claude Haiku, Claude Opus, Gemini 3 Flash, Grok, and Raptor when present inmetadata.modelId.
Editor Type Detection: getEditorTypeFromPath()
Location: src/extension.ts
Purpose: Determines which VS Code variant created the session file.
Detection patterns:
- Contains
/.copilot/jb/→'JetBrains'(must be checked BEFORE the Copilot CLI rule below since both live under~/.copilot/) - Contains
/.copilot/session-state/→'Copilot CLI' - Contains
/code - insiders/→'VS Code Insiders' - Contains
/code - exploration/→'VS Code Exploration' - Contains
/vscodium/→'VSCodium' - Contains
/cursor/→'Cursor' - Contains
.vscode-server-insiders/→'VS Code Server (Insiders)' - Contains
.vscode-server/→'VS Code Server' - Contains
/code/→'VS Code' - Default →
'Unknown'
Token Estimation Algorithm
Character-to-Token Conversion: estimateTokensFromText()
Location: src/extension.ts
Approach: Uses model-specific character-to-token ratios
- Default ratio: 0.25 (4 characters per token)
- Model-specific ratios loaded from
src/tokenEstimators.json - Formula:
Math.ceil(text.length * tokensPerChar)
Model matching:
- Checks if model name includes the key from tokenEstimators
- Example:
gpt-4omatches keygpt-4o
Caching Strategy
Cache Structure: SessionFileCache
Location: `src/
Установить copilot-log-analysis в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл copilot-log-analysis?
Analyzing GitHub Copilot session log files to extract token usage, model information, and interaction data. Use when working with session files, understanding the extension's log analysis methods, or debugging token tracking issues.
Как установить скилл copilot-log-analysis?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл copilot-log-analysis запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
от Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
от Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
от Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
от Anthropic