Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

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от 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:

  • .json files: Standard VS Code Copilot Chat session files
  • .jsonl files: 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:

  1. Workspace Storage: {VSCode User Path}/workspaceStorage/{workspace-id}/chatSessions/*.json
  2. Global Storage (Legacy): {VSCode User Path}/globalStorage/emptyWindowChatSessions/*.json
  3. Copilot Chat Extension Storage: {VSCode User Path}/globalStorage/github.copilot-chat/**/*.json
  4. Copilot CLI Sessions: ~/.copilot/session-state/*.jsonl
  5. JetBrains IDE Copilot Sessions: ~/.copilot/jb/{conversationId}/partition-{n}.jsonl
  6. Gemini CLI Sessions: ~/.gemini/tmp/{project}/chats/session-*.jsonl
  7. 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 (respects XDG_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:

  1. Accepts raw file content along with callbacks for token estimation and model detection.
  2. Supports both .json (Copilot Chat) and .jsonl (CLI/agent) formats, including delta-based JSONL streams.
  3. Counts interactions (user messages), input tokens, and output tokens while grouping by model.
  4. Uses estimateTokensFromText() (in src/extension.ts) for character-to-token estimation.

Model Detection Logic: getModelFromRequest()

Location: src/extension.ts

  • Primary: request.result.metadata.modelId
  • Fallback: parses request.result.details for 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 in metadata.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-4o matches key gpt-4o

Caching Strategy

Cache Structure: SessionFileCache

Location: `src/

Полный SKILL.md на GitHub

Установить 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), без исполняемых скриптов.

Похожие скиллы

Сравнить copilot-log-analysis с