| name | project-context |
| description | Background knowledge about the Agent Lens VS Code extension architecture. Preloaded by agents for project context. |
| user-invocable | false |
Agent Lens โ Project Architecture
VS Code extension that visualizes AI agent workflows across GitHub Copilot, Claude Code, and OpenAI Codex.
Tech stack
TypeScript, Lit 3, D3.js 7 + d3-dag, Vitest 3, esbuild, js-yaml
Source structure
src/
extension.ts โ Activation, command registration, watchers
models/ โ Interfaces: Agent, Skill, Session, Graph, Metrics
parsers/ โ Session discovery and parsing (pure functions)
sessionProvider.ts โ SessionProvider interface (all providers implement this)
copilotProvider.ts โ GitHub Copilot session discovery
claudeProvider.ts โ Claude Code session discovery
codexProvider.ts โ OpenAI Codex CLI session discovery
agentParser.ts โ Agent frontmatter + handoff parsing
skillParser.ts โ Skill frontmatter parsing
frontmatterParser.ts โ YAML frontmatter extraction
discovery.ts โ Glob-based agent/skill file discovery
sessionRegistry.ts โ Coordinates providers, dedupes, watches changes
detectors.ts โ Agent/skill detection helpers
analyzers/
graphBuilder.ts โ Agents + skills โ DAG with handoff edges
metricsCollector.ts โ Token usage, agent/model/tool/skill counts
views/
treeProvider.ts โ Sidebar tree (agents, skills, actions)
graphPanel.ts โ Graph webview panel controller
metricsPanel.ts โ Metrics webview panel controller
sessionPanel.ts โ Session explorer panel controller
webview/
graph.ts โ D3 graph visualization (Lit custom element)
layout.ts โ D3-DAG Sugiyama layout algorithm
metrics.ts โ Metrics dashboard webview
session.ts โ Session explorer (timeline)
Key patterns
- Parsers are pure functions โ no side effects, easy to test
- SessionProvider interface โ implement to add new agent sources
- Webview โ extension โ message passing via postMessage/onDidReceiveMessage
- Panel controllers (
src/views/*Panel.ts) manage webview lifecycle
- Models define all shared types in
src/models/
Build commands
npm run build โ Build extension + webview
npm test โ Run all tests (vitest)
npx vitest run <path> โ Run a single test file
npm run build:ext โ Build extension only
npm run build:webview โ Build webview only
Graph model types
NodeKind: agent, skill, builtin-agent, claude-agent
EdgeKind: handoff, tool-call, skill-use
Conventions
- Conventional Commits (
feat(scope):, fix(scope):, etc.)
- TDD: red-green-refactor
- Tests co-located:
*.test.ts next to source files
- Branch per issue, merge via PR