Skip to content

Add load-cache-data agent skill for inspecting session file cache#161

Merged
rajbos merged 5 commits intomainfrom
copilot/add-local-cache-agent-skill
Jan 31, 2026
Merged

Add load-cache-data agent skill for inspecting session file cache#161
rajbos merged 5 commits intomainfrom
copilot/add-local-cache-agent-skill

Conversation

Copy link
Contributor

Copilot AI commented Jan 30, 2026

Adds agent skill to access and display the last 10 entries from the session file cache stored in VS Code globalState, enabling iteration with real data structures during development.

Implementation

New skill: .github/skills/load-cache-data/

  • SKILL.md: Cache structure documentation, runtime access patterns, management methods
  • load-cache-data.js: CLI tool with --last N, --json, --help options
  • README.md: Quick reference guide

Cache Structure

interface SessionFileCache {
  tokens: number;
  interactions: number;
  modelUsage: { [model: string]: { inputTokens: number; outputTokens: number } };
  mtime: number;
  usageAnalysis?: {
    toolCalls: { total: number; byTool: { [name: string]: number } };
    modeUsage: { ask: number; edit: number; agent: number };
    contextReferences: { file: number; selection: number; /* ... */ };
    mcpTools: { total: number; byServer: {}; byTool: {} };
  };
}

Runtime Access

// In extension context
const cache = context.globalState.get<Record<string, SessionFileCache>>('sessionFileCache');
const entries = Object.entries(cache || {})
  .sort((a, b) => (b[1].mtime || 0) - (a[1].mtime || 0))
  .slice(0, 10);

Usage

node .github/skills/load-cache-data/load-cache-data.js          # last 10 entries
node .github/skills/load-cache-data/load-cache-data.js --last 5 # last 5 entries
node .github/skills/load-cache-data/load-cache-data.js --json   # JSON output

Note: Script generates example data since VS Code's globalState is only accessible through extension API at runtime. Documentation provides patterns for real cache access.

Original prompt

Add a new agent skill similar to the rest that loads the last 10 rows from the local cache so we can iterate with real data


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 30, 2026 19:29
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Co-authored-by: rajbos <6085745+rajbos@users.noreply.github.com>
Copilot AI changed the title [WIP] Add agent skill to load last 10 rows from local cache Add load-cache-data agent skill for inspecting session file cache Jan 30, 2026
@rajbos rajbos marked this pull request as ready for review January 31, 2026 12:44
@rajbos rajbos enabled auto-merge January 31, 2026 12:44
@rajbos rajbos merged commit 1ad7141 into main Jan 31, 2026
14 checks passed
@rajbos rajbos deleted the copilot/add-local-cache-agent-skill branch January 31, 2026 12:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments