Agent Session Router — VS Code Extension

Automatically archive your AI coding sessions. Discovers conversations from
Copilot Chat, DeepSeek, Continue, Cline, Cody, Aider, Gemini Antigravity,
and more — exports them as searchable Markdown files into your
Agent Sessions archive.
🎉 Live on the Marketplace — v0.2.0 is published and ready for daily use:
marketplace.visualstudio.com/items?itemName=avidullu.agent-session-router.
116 tests, 8 agent sources, cross-platform CI (Windows/macOS/Linux).
Quick Start
Option 1: Install from the VS Code Marketplace (Recommended)
Open the Marketplace listing
and click Install, or from a terminal:
code --install-extension avidullu.agent-session-router
Then run Agent Session Router: Export All Sessions from the Command Palette
(Ctrl+Shift+P).
Option 2: Install from VSIX
- Download the latest
.vsix from Releases
- Install:
code --install-extension agent-session-router-0.2.0.vsix --force
- Reload VS Code (
Ctrl+Shift+P → "Developer: Reload Window")
Option 3: Build from Source
git clone https://github.com/avidullu/agent-session-router.git
cd agent-session-router
npm ci
npm run compile
npm test # verify: 116 tests pass on Node 22+
npx @vscode/vsce package -o agent-session-router.vsix
code --install-extension agent-session-router.vsix --force
Press F5 in VS Code to launch the Extension Development Host instead of installing.
🤖 For AI Agents — Agentic Installation
If you're an AI coding agent setting this up for a user, run the agentic
installation script. It handles everything and prints the exact next steps:
# macOS / Linux / WSL
chmod +x scripts/agentic-install.sh
./scripts/agentic-install.sh --auto-watch --output-dir "$HOME/Projects/Agent Sessions/archive"
# Windows PowerShell
.\scripts\agentic-install.ps1 -AutoWatch -OutputDir "$env:USERPROFILE\Projects\Agent Sessions\archive"
The script will: verify Node.js ≥ 20, install dependencies, compile, run the
test suite, package the .vsix, install into VS Code, and print the
recommended settings.
After the script completes, tell the user:
Reload VS Code (Ctrl+Shift+P → "Developer: Reload Window"), then
run Agent Session Router: Export All Sessions from the Command Palette.
What It Does
Your AI coding sessions are scattered across VS Code's internal storage. This
extension finds them all, extracts the conversations, and saves them as local
Markdown files that the Agent Sessions hub can index.
- Discover — scan VS Code for sessions from 8+ agents
- Extract — parse raw session data into structured conversation transcripts
- Export — render as Markdown files compatible with the Agent Sessions archive
- Auto-Export — optionally monitor for new sessions and export them automatically
- Pluggable — add support for any AI agent by dropping 2 files
Supported Agents
| Agent |
Source |
Status |
| GitHub Copilot Chat |
VS Code extension |
✅ Native chat JSONL + current SQLite + legacy JSONL |
| DeepSeek V4 |
VS Code extension |
✅ Full support |
| Continue.dev |
VS Code extension |
✅ Discover + Extract |
| Cline |
VS Code extension |
✅ Discover + Extract |
| Cody (Sourcegraph) |
VS Code extension |
✅ Discover + Extract |
| Aider |
VS Code extension |
✅ Discover + Extract |
| Gemini Antigravity |
VS Code extension + IDE |
✅ Discover + Extract |
| Tabby, Codeium, Amazon Q |
VS Code extensions |
✅ Via generic globalStorage |
| Z.AI, Grok, Claude, Gemini (LM API) |
VS Code native chat |
✅ Provider-aware native chat JSONL |
| OpenAI ChatGPT |
Via Codex CLI |
✅ Via Codex extractor |
New agents are auto-discovered on the next scan — no configuration needed.
Testing & Quality
| Metric |
Value |
| Total tests |
116 on Node 22+ (0 failures) |
| Unit tests (coverage suite) |
86 |
| Contract conformance |
6 |
| Router-index tests |
6 |
| Router export outcome tests |
10 |
| Smoke tests |
6 |
| CI matrix |
Windows, macOS, Linux × Node 20, 22 |
| Linting |
ESLint (TypeScript) — 0 errors |
| Formatting |
Prettier — enforced in CI |
npm test # Full suite: contract + index + coverage + smoke
npm run lint:check # ESLint (0 errors)
npm run format:check # Prettier check
npm run ci:check # All gates: lint → format → compile → test
Commands
Open the Command Palette (Ctrl+Shift+P) and type "Agent Session Router":
| Command |
Description |
| Discover Sessions |
Scan and list all discoverable agent sessions |
| Export All Sessions |
Export all discovered sessions to Markdown |
| Export Selected Session |
Pick a specific session file to export |
| Set Output Directory |
Choose where to save exported session files |
| Show Configuration |
Display current extension settings |
| Start Watching |
Begin auto-exporting sessions as they complete |
| Stop Watching |
Stop the auto-export watcher |
| Export Diagnostic Bundle |
Package logs + source samples for debugging |
| Reset State |
Clear all cached exports |
Configuration
All settings are under the agentSessionRouter namespace.
{
// Output directory for rendered Markdown files.
// Use "Set Output Directory" command to pick a folder interactively.
"agentSessionRouter.outputDir": "~/Projects/Agent Sessions/archive",
// Per-source toggles (any discoverer kind works — pluggable)
"agentSessionRouter.sources": {
"copilot_chat": { "enabled": true },
"deepseek_request_dump": { "enabled": true },
"gemini_antigravity": { "enabled": true },
},
// Auto-export watcher
"agentSessionRouter.watch.enabled": false,
"agentSessionRouter.watch.debounceMs": 5000,
// Optional exact Windows profile roots to include from Remote WSL.
// Profiles are never enumerated automatically.
"agentSessionRouter.windowsProfileRoots": ["C:\\Users\\your-name"],
// Max age of sessions to export
"agentSessionRouter.maxSessionAge": "90d",
}
FAQ
The Agent Sessions Python tool handles CLI tools (Claude Code, Codex CLI,
Gemini CLI, Grok CLI). This extension handles VS Code extensions (Copilot Chat,
DeepSeek, Continue, Cline, etc.). Together they give you complete coverage of all
your AI coding sessions.
Where are my exported sessions saved?
To a configurable directory (default: auto-detected ~/Projects/Agent Sessions/archive/).
Use the Set Output Directory command to change it. Files follow the Agent Sessions
archive contract — they're ready to be indexed by the hub.
In the Agent Sessions hub repo, rendered Markdown files are local-only by
default. The router also writes .router-index.jsonl; the hub merges that
sidecar into tracked metadata (archive/index.jsonl and archive/INDEX.md) on
the next python tools/agent_archive.py export --all.
Does it support Copilot's current session-store.db?
Yes. Current Copilot Chat keeps sessions in
globalStorage/github.copilot-chat/session-store.db. The router opens the live
WAL-backed database read-only, exports each logical session independently, and
uses a per-session content revision so one changed conversation does not create
false cache hits for its siblings.
When the extension runs in Remote WSL, it can also discover an existing Windows
VS Code user store. It uses the current USERPROFILE when available, plus exact
profile roots explicitly listed in agentSessionRouter.windowsProfileRoots
(for example, C:\\Users\\your-name or /mnt/c/Users/your-name). It never
enumerates every profile under /mnt/c/Users, preventing another Windows
user's conversations from entering your archive.
SQLite-store ingestion needs a VS Code extension host with Node.js 22.5 or
newer. Current VS Code releases satisfy that requirement. On older extension
hosts, legacy Copilot transcript/debug JSONL discovery continues to work and the
Output panel reports why the SQLite store was skipped.
What is the recommended daily routine?
- Run Agent Session Router: Set Output Directory and select the Agent
Sessions repository's
archive directory.
- Run Agent Session Router: Export All Sessions once.
- Run Agent Session Router: Auto-Export — Monitor for New Sessions. The
command persists the watcher setting, so it starts again with VS Code.
- In the Agent Sessions repository, run
agent-sessions export followed by
agent-sessions status whenever you want to refresh and inspect the catalog.
The watcher updates .router-index.jsonl as it exports, so watched and manually
selected sessions enter the same hub-ingestion path as a full export.
The default resolver recognizes common Projects, lowercase projects, and
Siva/infra/agent-sessions checkouts. Headless or managed setups can set
AGENT_SESSIONS_HOME to the Agent Sessions repository root.
Does this extension upload my sessions anywhere?
No. All processing happens locally on your machine. Sessions are read from VS Code's
internal storage, parsed, and written as local Markdown files. Nothing is sent over the network.
How do I add support for a new AI agent?
Drop two files into src/discoverers/ and src/extractors/, recompile, and restart.
See the Adding Custom Agents section below. No core edits needed.
The watcher isn't auto-exporting my sessions. What's wrong?
- Check the Output panel (
View → Output → "Agent Session Router") for [watcher] events
- Ensure
agentSessionRouter.watch.enabled is true
- The watcher only exports sessions that are modified after it starts
- Run Export Diagnostic Bundle to collect logs for debugging
Can I use this without the Agent Sessions repo?
Yes. The extension writes standalone Markdown files. You can read them directly.
The Agent Sessions repo adds indexing, search, and a knowledge baseline — entirely optional.
What's the difference between "antigravity" and "antigravity-ide"?
Both are Gemini-powered AI coding tools. The extension auto-detects which variant
you use and handles both transparently. You don't need to configure anything.
How do I update the extension?
git pull origin master
npm ci
npm run compile
npx @vscode/vsce package -o agent-session-router.vsix
code --install-extension agent-session-router.vsix --force
Or run ./scripts/agentic-install.sh again — it's idempotent.
Adding Custom Agents
The extension is pluggable — users can add support for any AI coding agent
without modifying core files. Just drop two files into the right folders.
Recipe (2 files, zero core edits)
1. Discoverer — src/discoverers/my-agent.ts — tells the extension WHERE to find session files:
import { registerDiscoverer } from './index';
import { DiscoveredSession } from '../types';
import * as fs from 'fs';
import * as path from 'path';
async function* discoverMyAgent(): AsyncIterable<DiscoveredSession> {
const dir = path.join(process.env.USERPROFILE || '~', '.my-agent', 'sessions');
if (!fs.existsSync(dir)) return;
for (const file of fs.readdirSync(dir)) {
if (!file.endsWith('.json')) continue;
const fp = path.join(dir, file);
yield {
sourceName: 'my-agent',
sourceKind: 'my_agent',
filePath: fp,
sessionId: file.replace('.json', ''),
sizeBytes: fs.statSync(fp).size,
mtimeMs: fs.statSync(fp).mtimeMs,
};
}
}
registerDiscoverer('my_agent', () => discoverMyAgent());
2. Extractor — src/extractors/my-agent.ts — tells the extension HOW to parse session files:
import { registerExtractor } from './index';
import { ExtractedSession } from '../types';
import * as fs from 'fs';
function extractMyAgent(filePath: string): ExtractedSession {
const raw = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
return {
metadata: { session_id: raw.id },
messages: raw.conversation.map((m: any) => ({
role: m.speaker === 'human' ? 'user' : 'assistant',
text: m.text,
timestamp: m.timestamp,
})),
};
}
registerExtractor('my_agent', extractMyAgent);
3. Compile and reload — that's it. Config toggles work automatically:
"agentSessionRouter.sources": { "my_agent": { "enabled": true } }
The extension produces Markdown files matching the Agent Sessions contract:
# deepseek-vscode / {session-id}
## Metadata
- Source: `deepseek-vscode`
- Kind: `deepseek_request_dump`
- Source file: `/path/to/source.json`
- SHA-256: `abc123...`
Diagnostics & Debugging
All operations log to the Agent Session Router output channel
(View → Output → select "Agent Session Router" from the dropdown).
Run Export Diagnostic Bundle to package logs + source samples + config
into a portable folder for sharing with support or attaching to a GitHub issue.
License
MIT — see LICENSE.