vscode-agent-todos
Copilot instructions39 starsChanged 17 months agoMITView on GitHub
This extension provides VS Code agent mode with todo management tools through MCP (Model Context Protocol) and an integrated VS Code tree view. It enables AI assistants to proactively track tasks during development workflows with support for subtasks, priorities, auto-injection into Copilot instructions. For more details: The extension uses a consolidated event pattern to prevent performance issues: Key Requirements:
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
Show its rules and text
We split this copilot-instructions.md into the rules it gives an agent
60 rules. About 0 are common, 42 are distinctive, and 18 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈42
Distinctive · estimate
This author's own choices. Worth a look.
18
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
ALWAYS plan changes using detailed todos
- Very specific: line 14
ALWAYS keep .github/copilot-instructions.md up-to-date with the latest architecture and coding standards, addressing any drifts in …
- Distinctive: line 15
ALWAYS validate changes by running compile and test commands!
- Distinctive: line 16
NEVER proactively create documentation files (\*.md) or README files.
- Distinctive: line 17
NEVER make changes backwards compatible unless explicitly requested by the User.
- Distinctive: line 18
NEVER create one-off scripts to test changes.
- Very specific: line 143
Always use the single onDidChange event that provides both todos and title
- Distinctive: line 144
Never create or use separate events for different properties
- Distinctive: line 145
All managers (TodoManager, StandaloneTodoManager) must implement the same event interface
- Distinctive: line 149
All state changes use enhanced hash-based deduplication with version tracking to handle edge cases:
- Distinctive: line 243
Single Consolidated Event Pattern: - Never create separate events for different properties
- Distinctive: line 244
Empty State Transitions: - Always force sync when todo count changes between 0 and n
- Distinctive: line 245
Promise-Based Sync: - Use promise queuing to prevent race conditions
- Distinctive: line 253
Use strict TypeScript with proper type definitions
- Distinctive: line 255
Follow VS Code extension conventions with proper disposable cleanup
- Distinctive: line 256
Use consolidated event pattern for state management (never separate events)
- Very specific: line 260
Use vscode.lm.registerMcpServerDefinitionProvider() for MCP server integration
- Very specific: line 263
Use vscode.ThemeIcon for consistent iconography
- Distinctive: line 266
Use conditional menu items with different titles/icons to show toggle states (checkbox-style)
- Very specific: line 267
Use workbench.action.chat.open with agent mode to integrate with VS Code's chat functionality
- Very specific: line 304
All storage implementations follow ITodoStorage interface:
- Very specific: line 390
Always use z.object({}) for empty schemas, never plain {}
- Very specific: line 391
Use proper Zod schemas from getTodoWriteZodSchema() for complex inputs
- Very specific: line 392
Ensure Zod is initialized before tool registration via initialize()
- Very specific: line 421
Use case-insensitive filtering with startsWith() for better UX
- Very specific: line 424
No manual capability registration needed - handled by setResourceRequestHandlers()
- Distinctive: line 478
All active MCP sessions receive updated tool definitions
- Distinctive: line 479
No server restart required for configuration changes
- Distinctive: line 486
Always hidden when auto-inject is enabled (todos available in instructions)
- Distinctive: line 511
When the todo list is empty, VS Code displays a welcome view with helpful content:
- Distinctive: line 547
Note on Auto-Inject: When enabled, todos are exported to the markdown file on every change.
- Distinctive: line 598
Use try/catch blocks around VS Code API calls
- Distinctive: line 600
Delete/clear operations execute immediately without confirmation dialogs for better UX
- Distinctive: line 608
Always force sync on empty transitions
- Distinctive: line 609
Use immediate refresh (0ms debounce) for empty state changes
- Distinctive: line 610
Test empty state transitions explicitly in your code
- Distinctive: line 614
When implementing sync between managers:
- Distinctive: line 630
Use version tracking for forced updates
- Distinctive: line 636
Use adequate timeouts (300-500ms) for sync operations
- Distinctive: line 638
Create isolated instances for each test to avoid state pollution
- Distinctive: line 642
When debugging MCP/tree view sync problems:
- Distinctive: line 644
Add comprehensive logging at each sync step
- Distinctive: line 647
Check for proper event subscription before triggering changes
- Distinctive: line 648
Verify storage initialization in test environments
- Distinctive: line 652
Never store sensitive data in todo items
- Distinctive: line 654
Use VS Code's built-in confirmation dialogs for destructive actions
- Very specific: line 663
Use suite() for test grouping instead of describe()
- Very specific: line 664
Use test() for individual test cases instead of it()
- Distinctive: line 665
Always import test framework functions from VS Code test runner, not Mocha directly
- Distinctive: line 688
Test extension activation/deactivation lifecycle
- Distinctive: line 689
Verify MCP server and tool operations
- Distinctive: line 690
Test tree view data updates and refresh behavior
- Very specific: line 697
Use suite() for logical test grouping
- Very specific: line 698
Use setup() and teardown() for test lifecycle management
- Distinctive: line 700
Test both success and error scenarios
- Distinctive: line 716
When adding new telemetry events:
- Very specific: line 718
Use TelemetryManager.trackEvent(name, properties, measurements) in your code
- Very specific: line 719
CRITICAL: Update telemetry.json with the new event definition including name, description, properties, and measurements
- Distinctive: line 720
Follow existing patterns for privacy-safe event names and properties
- Very specific: line 722
Important: Keep telemetry.json in sync with actual telemetry events in the code.
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Project Overview
This extension provides VS Code agent mode with todo management tools through MCP (Model Context Protocol) and an integrated VS Code tree view. It enables AI assistants to proactively track tasks during development workflows with support for subtasks, priorities, auto-injection into Copilot instructions.
For more details:
- Main README - Feature overview and usage
- MCP Server Documentation - Server architecture, protocol details, and completion support
- MCP TypeScript SDK
IMPORTANT:
- ALWAYS plan changes using detailed todos
- ALWAYS keep
.github/copilot-instructions.mdup-to-date with the latest architecture and coding standards, addressing any drifts in implementation! - ALWAYS validate changes by running compile and test commands!
- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.
- NEVER make changes backwards compatible unless explicitly requested by the User.
- NEVER create one-off scripts to test changes.
Architecture
graph TB
subgraph VSCodeExtension[VS Code Extension]
EXT[Extension Entry<br/>extension.ts]
TM[TodoManager<br/>Singleton]
TTP[TodoTreeProvider]
TDP[TodoDecorationProvider]
SM[SubtaskManager<br/>Static Methods]
TV[TodoValidator<br/>Static Methods]
PM[PerformanceMonitor<br/>Static Class]
end
subgraph StorageLayer[Storage Layer]
ITS[ITodoStorage<br/>Interface]
WSS[WorkspaceStateStorage<br/>Default]
IMS[InMemoryStorage<br/>Testing/Standalone]
end
subgraph ExportLayer[Export Layer]
CIM[CopilotInstructionsManager<br/>Write-only Export]
SCW[StandaloneCopilotWriter<br/>Write-only Export]
end
subgraph MCPIntegration[MCP Integration]
MCP[TodoMCPServerProvider]
MCPS[TodoMCPServer<br/>HTTP/SSE]
TT[TodoTools<br/>read/write handlers]
TS[TodoSync<br/>Bidirectional]
STM[StandaloneTodoManager<br/>Singleton]
subgraph SessionMgmt[Session Management]
TRM[Transports Map]
SRM[Servers Map]
STR[StreamableHTTPServerTransport]
end
end
subgraph ExternalInterfaces[External Interfaces]
VSC[VS Code API]
CI[todos.instructions.md]
MC[MCP Clients<br/>AI Assistants]
MCPAPI[VS Code MCP API]
end
%% Core initialization
EXT --> TM
EXT --> TTP
EXT --> TDP
EXT --> MCP
%% Storage configuration
TM --> WSS
STM --> IMS
WSS -.-> ITS
IMS -.-> ITS
MCP --> WSS
%% UI and decorations
TTP --> VSC
TDP --> VSC
TM --> TTP
TM --> TDP
%% View events
TM -.->|onShouldOpenView| EXT
TM -.->|onDidChange| TTP
%% Export to markdown (write-only)
TM -.->|auto-inject writes| CIM
CIM -->|write-only| CI
STM -.->|auto-inject writes| SCW
SCW -->|write-only| CI
%% MCP server setup
MCP --> MCPS
MCP --> MCPAPI
MCPS --> TT
MCPS --> STR
STR --> TRM
STR --> SRM
%% Bidirectional sync
MCP --> TS
TS <--> TM
TS <--> STM
%% Tool handling
TT --> STM
TT --> TS
%% External communication
MC <-->|HTTP POST/GET/SSE| MCPS
%% Utility usage
TM --> SM
TM --> TV
TM -.-> PM
STM --> TVPerformance Optimizations
Event System Architecture
The extension uses a consolidated event pattern to prevent performance issues:
// CORRECT: Single consolidated event
todoManager.onDidChange((change) => {
// Handle both todo and title changes
updateTreeView(change.todos);
updateTitle(change.title);
});
// WRONG: Never use separate events (causes cascade loops)
// todoManager.onDidChangeTodos(...) // DO NOT USE
// todoManager.onDidChangeTitle(...) // DO NOT USEKey Requirements:
- Always use the single
onDidChangeevent that provides both todos and title - Never create or use separate events for different properties
- All managers (TodoManager, StandaloneTodoManager) must implement the same event interface
Change Deduplication
All state changes use enhanced hash-based deduplication with version tracking to handle edge cases:
private fireConsolidatedChange(): void {
const isEmptyTransition = // ... detect empty transitions
const currentHash = JSON.stringify({
todos: this.todos,
title: this.title,
version: isEmptyTransition ? ++this.updateVersion : this.updateVersion
});
if (currentHash !== this.lastUpdateHash || isEmptyTransition) {
this.lastUpdateHash = currentHash;
this.onDidChangeEmitter.fire({ todos: this.todos, title: this.getTitle() });
}
}Key Features:
- Version field increments on empty transitions to force updates
- Empty transitions (0→n or n→0 todos) always trigger immediate updates
- Prevents deduplication from blocking critical UI updates
Debouncing Strategy
Components use optimized debounce timings with special handling for empty transitions:
- Tree View Updates: 50ms debounce (immediate for empty transitions)
- File Operations: 500ms debounce to batch rapid changes
- MCP Sync: 0ms for empty transitions, 10ms otherwise
TodoSync Improvements
The bidirectional sync mechanism includes:
// Promise-based synchronization to handle concurrent updates
private syncPromise: Promise<void> | null = null;
// Proper race condition handling
if (this.syncPromise) {
await this.syncPromise; // Wait for in-progress sync
}Key Features:
- Promise-based sync queue prevents race conditions
- Version tracking ensures sync order consistency
- Comprehensive logging for debugging sync issues
- Empty transition detection forces immediate sync
Async Initialization
MCP server initialization is non-blocking to prevent extension startup delays:
// Initialize MCP server asynchronously
setImmediate(async () => {
await mcpProvider.ensureServerStarted();
});File Operation Queueing
File writes are queued to prevent concurrent access issues:
private async writeWithQueue(todos: TodoItem[], title?: string): Promise<void> {
if (this.writeInProgress) {
this.pendingWrite = { todos, title };
return;
}
this.writeInProgress = true;
try {
await this.performWrite(todos, title);
// Process any pending write
if (this.pendingWrite) {
const pending = this.pendingWrite;
this.pendingWrite = null;
await this.writeWithQueue(pending.todos, pending.title);
}
} finally {
this.writeInProgress = false;
}
}Critical Implementation Patterns
ALWAYS follow these patterns to avoid sync issues:
- Single Consolidated Event Pattern - Never create separate events for different properties
- Empty State Transitions - Always force sync when todo count changes between 0 and n
- Promise-Based Sync - Use promise queuing to prevent race conditions
- Hash-Based Deduplication - Include version tracking for forced updates
- Proper Test Context - Initialize with mock storage to avoid "context not initialized" errors
Coding Standards
TypeScript Patterns
- Use strict TypeScript with proper type definitions
- Implement singleton pattern for
TodoManager(seesrc/todoManager.ts) - Follow VS Code extension conventions with proper disposable cleanup
- Use consolidated event pattern for state management (never separate events)
VS Code API Usage
- Use
vscode.lm.registerMcpServerDefinitionProvider()for MCP server integration - Implement
vscode.TreeDataProvider<T>for tree views - Register
vscode.FileDecorationProviderfor todo item styling - Use
vscode.ThemeIconfor consistent iconography - Handle tree view badges with
TreeView.badgefor task counts - Move toggle actions to overflow menus using grouped menu items without
navigationgroup - Use conditional menu items with different titles/icons to show toggle states (checkbox-style)
- Use
workbench.action.chat.openwith agent mode to integrate with VS Code's chat functionality - Set context keys with
vscode.commands.executeCommand('setContext', key, value)for conditional UI visibilityagentTodos.hasTodos- Set to true when todo list has items, false when empty (controls clear button visibility)
File Organization
src/
├── extension.ts # Main activation/deactivation
├── todoManager.ts # Singleton state management
├── todoTreeProvider.ts # Tree view implementation
├── subtaskManager.ts # Subtask handling
├── copilotInstructionsManager.ts # Auto-inject sync
├── todoValidator.ts # Input validation
├── types.ts # Shared interfaces
├── storage/
│ ├── ITodoStorage.ts # Storage interface
│ ├── WorkspaceStateStorage.ts # Default VS Code storage
│ └── InMemoryStorage.ts # Memory-based storage
├── utils/
│ └── performance.ts # Performance monitoring utility
└── mcp/
├── mcpProvider.ts # VS Code MCP integration
├── server.ts # HTTP/SSE server
├── standalone.ts # Standalone entry point
├── standaloneTodoManager.ts # Standalone manager singleton
├── todoSync.ts # Bidirectional sync
├── types.ts # MCP-specific types
├── standaloneCopilotWriter.ts # Standalone markdown writer
└── tools/
└── todoTools.ts # MCP tool implementationsRequired Patterns
Storage Pattern
All storage implementations follow ITodoStorage interface:
// Example usage with any storage implementation
const storage: ITodoStorage = new WorkspaceStateStorage(context);
await storage.save(todos, title);
const { todos, title } = await storage.load();Available implementations:
WorkspaceStateStorage- VS Code workspace state (default)InMemoryStorage- Temporary in-memory storage (standalone mode)
Export Pattern
The instructions file is treated as a write-only export destination, not a storage backend:
// VS Code mode: Uses CopilotInstructionsManager
if (autoInjectEnabled) {
await copilotInstructionsManager.updateInstructionsWithTodos(todos, title);
}
// Standalone mode: Uses StandaloneCopilotWriter
if (autoInjectEnabled) {
await standaloneCopilotWriter.updateInstructionsWithTodos(todos, title);
}Important: The markdown file is NEVER read back. Todo data flows in one direction only: from storage → markdown file.
MCP Server Provider
// Register MCP server provider (not individual tools)
const mcpProvider = new TodoMCPServerProvider(context);
const mcpDisposable = vscode.lm.registerMcpServerDefinitionProvider(
"todos-mcp-provider",
mcpProvider
);
context.subscriptions.push(mcpDisposable);
// MCP server handles tool registration internally
export class TodoMCPServerProvider
implements vscode.McpServerDefinitionProvider
{
async provideServerDefinition(): Promise<McpServerDefinition> {
return {
command: "node",
args: [serverPath, `--workspace-root=${workspaceRoot}`],
transport: { type: "stdio" as const },
};
}
}MCP Tool Schema Requirements
CRITICAL: The MCP SDK registerTool() API requires proper Zod schemas, not plain JavaScript objects:
// ❌ WRONG - Causes "keyValidator._parse is not a function" error
sessionTools.todoReadTool = server.registerTool(
"todo_read",
{
title: "Check Todos",
description: this.buildReadDescription(subtasksEnabled),
inputSchema: {} // Plain object - WRONG!
},
async () => await this.handleRead()
);
// ✅ CORRECT - Use proper Zod schemas
sessionTools.todoReadTool = server.registerTool(
"todo_read",
{
title: "Check Todos",
description: this.buildReadDescription(subtasksEnabled),
inputSchema: this.getEmptyZodSchema() // Returns z.object({})
},
async () => await this.handleRead()
);Key Requirements:
- Always use
z.object({})for empty schemas, never plain{} - Use proper Zod schemas from
getTodoWriteZodSchema()for complex inputs - Ensure Zod is initialized before tool registration via
initialize()
MCP Resource Completion Pattern
Resource completions provide auto-suggestion capabilities for parameterized URIs like todos://{slug}:
// ✅ CORRECT: Resource with completion callback
server.setResourceRequestHandlers({
[ResourceTemplates.archive.uriTemplate]: {
read: async (request) => {
// Resource read handler
},
complete: {
slug: async (input) => {
// Auto-completion for {slug} parameter
const query = input.argument?.value?.toString().toLowerCase() || '';
const slugs = TodoManager.getArchivedListSlugs();
return slugs
.filter(slug => slug.toLowerCase().startsWith(query))
.map(value => ({ value }));
}
}
}
});Key Features:
- Completion callbacks are defined per URI parameter (e.g.,
{slug}) - Use case-insensitive filtering with
startsWith()for better UX - Return array of
{ value: string }objects for completion options - SDK automatically registers completion capability when ResourceTemplates with complete callbacks are present
- No manual capability registration needed - handled by
setResourceRequestHandlers()
Dynamic Configuration Updates
The MCP server supports dynamic configuration updates without requiring server restart:
// Configuration changes are broadcast to all active sessions
todoManager.onDidChangeConfiguration((config) => {
server.broadcastUpdate({
type: 'configuration-changed',
config: {
autoInject: config.autoInject,
enableSubtasks: config.enableSubtasks
}
});
});
// CRITICAL: VS Code workspace configuration changes must also update MCP server
const configDisposable = vscode.workspace.onDidChangeConfiguration((e) => {
if (e.affectsConfiguration('agentTodos') && this.server) {
const config = vscode.workspace.getConfiguration('agentTodos');
this.server.broadcastUpdate({
type: 'configuration-changed',
config: {
autoInject: config.get<boolean>('autoInject', false),
enableSubtasks: config.get<boolean>('enableSubtasks', true),
autoInjectFilePath: config.get<string>('autoInjectFilePath', '.github/instructions/todos.instructions.md')
},
timestamp: Date.now()
});
}
});
// Todo changes also trigger tool updates for conditional visibility
todoManager.onDidChange((change) => {
server.broadcastUpdate({
type: 'todos-updated',
todos: change.todos,
title: change.title
});
});
// Server re-registers handlers for all sessions on config/todo change
private updateAllSessionHandlers(): void {
for (const [sessionId, server] of this.servers) {
this.registerHandlers(server);
}
}Key Features:
- Tool schemas update immediately when settings change
- All active MCP sessions receive updated tool definitions
- No server restart required for configuration changes
- Subtasks can be enabled/disabled dynamically via VS Code settings
- FIXED: VS Code settings changes now properly propagate to MCP server tools
todo_readtool dynamically appears/disappears based on todo list state:- Hidden when todo list is empty (unless in standalone mode)
- Appears when todos are added
- Disappears again when all todos are removed
- Always hidden when auto-inject is enabled (todos available in instructions)
Tree View Pattern
// Always implement both TreeDataProvider and TreeItem
export class TodoTreeDataProvider
implements vscode.TreeDataProvider<TodoTreeItem>
{
private _onDidChangeTreeData = new vscode.EventEmitter<
TodoTreeItem | undefined | null | void
>();
readonly onDidChangeTreeData = this._onDidChangeTreeData.event;
getTreeItem(element: TodoTreeItem): vscode.TreeItem {
return element;
}
getChildren(element?: TodoTreeItem): Thenable<TodoTreeItem[]> {
/* implementation */
}
}Welcome View Pattern
When the todo list is empty, VS Code displays a welcome view with helpful content:
"viewsWelcome": [
{
"view": "agentTodos",
"contents": "No todos yet. Start by planning your tasks.\n\n[Start Planning](command:agentTodos.startPlanning)\n\nOr add todos using the language model tools available in your AI assistant.",
"when": "!agentTodos.hasTodos"
}
]This provides a clean empty state with:
- Clear messaging about the empty state
- A button to start planning that opens VS Code's chat
- Instructions for using the language model tools
- Automatic visibility controlled by the
agentTodos.hasTodoscontext key
Package.json Contributions
See package.json for full configuration:
- MCP Server Definition Providers: Register with
mcpServerDefinitionProviders - Views: Specify in
explorercontainer withid,name,icon - Commands: Define with
command,title,iconfields including:agentTodos.startPlanning- Opens chat with planning prompt for empty stateagentTodos.runTodo- Opens chat to continue with a specific todo- Task management commands (add, delete, toggle status)
- Configuration commands (auto-inject, auto-open view)
- Configuration: Settings under
agentTodos.*namespace including:agentTodos.autoInject- Enable write-only export to copilot instructions fileagentTodos.autoInjectFilePath- Configurable file path for auto-injection (default:.github/instructions/todos.instructions.md)agentTodos.autoOpenView- Automatically open todo view when list changesagentTodos.enableSubtasks- Enable subtasks feature
Note on Auto-Inject: When enabled, todos are exported to the markdown file on every change. The file is NEVER read back - it's a one-way export only. Todo data is always stored in WorkspaceStateStorage (VS Code) or InMemoryStorage (standalone).
Data Models
See src/types.ts for complete type definitions:
TodoItem- Main todo structure with status, priority, subtasks, and detailsSubtask- Nested task structureTodoWriteInput- Input schema for todo_write toolArchivedTodoList- Archive structure with id, title, todos, archivedAt timestamp, and slug
Archive Management Patterns
Archive Creation Timing
CRITICAL: Archives are only created when title changes to a different non-empty value:
// Archive is created when title changes from one value to another
manager.setTodos(todos, "Project Alpha"); // No archive (initial set)
manager.setTodos(todos, "Project Beta"); // Archives "Project Alpha"
manager.setTodos(todos, "Project Beta"); // No archive (same title)Key Rules:
- Archives are NEVER created on initial title setting
- Archives are ONLY created when title changes to a different value
- Empty todo lists are NOT archived regardless of title changes
- Archive creation includes all current todos at the time of title change
Slug Generation
Archives use URL-safe slugs generated from titles:
// Examples of slug generation
"Project Alpha" → "project-alpha"
"User Authentication System" → "user-authentication-system"
"API v2.0 Migration" → "api-v20-migration"Slug Rules:
- Lowercase conversion
- Special characters removed or converted to hyphens
- Unique slugs generated for duplicate titles (e.g., "project-alpha-2")
- Used in
todos://{slug}URI pattern for MCP resources
Error Handling
- Validate all language model tool inputs before processing
- Return descriptive error messages via
LanguageModelTextPart - Use try/catch blocks around VS Code API calls
- Dispose of resources properly in
deactivate() - Delete/clear operations execute immediately without confirmation dialogs for better UX
Best Practices for MCP Sync
Handle Empty State Transitions
Empty transitions (0→n or n→0 todos) require special handling:
- Always force sync on empty transitions
- Use immediate refresh (0ms debounce) for empty state changes
- Test empty state transitions explicitly in your code
Async Operation Patterns
When implementing sync between managers:
// Use promise-based sync to prevent race conditions
private syncPromise: Promise<void> | null = null;
// Wait for in-progress operations
if (this.syncPromise) {
await this.syncPromise;
}Event Deduplication
Prevent event loops with proper deduplication:
- Use version tracking for forced updates
- Compare state hashes before firing events
- Log state transitions for debugging
Testing Async Code
- Use adequate timeouts (300-500ms) for sync operations
- Initialize test context properly with mock storage
- Create isolated instances for each test to avoid state pollution
Debugging Sync Issues
When debugging MCP/tree view sync problems:
- Add comprehensive logging at each sync step
- Log state transitions with counts:
${previousCount} -> ${currentCount} - Include operation versions in logs for tracking order
- Check for proper event subscription before triggering changes
- Verify storage initialization in test environments
Security Notes
- Never store sensitive data in todo items
- Validate input schemas strictly in language model tools
- Use VS Code's built-in confirmation dialogs for destructive actions
Testing Strategy
Test Framework Requirements
IMPORTANT: VS Code Extension Testing Patterns
- NEVER use
describe()andit()functions - VS Code extension tests usesuite()andtest()from the@vscode/test-cliframework - Use
suite()for test grouping instead ofdescribe() - Use
test()for individual test cases instead ofit() - Always import test framework functions from VS Code test runner, not Mocha directly
// CORRECT: VS Code extension test pattern
import * as assert from 'assert';
suite('Extension Test Suite', () => {
test('should activate extension', () => {
// Test implementation
assert.ok(true);
});
});
// WRONG: Standard Mocha pattern (causes "describe is not defined" errors)
describe('Extension Test Suite', () => { // DO NOT USE
it('should activate extension', () => { // DO NOT USE
// This will fail in VS Code extension tests
});
});Test Coverage Areas
- Test extension activation/deactivation lifecycle
- Verify MCP server and tool operations
- Test tree view data updates and refresh behavior
- Validate todo state persistence across sessions
- Storage implementation compliance with ITodoStorage
- End-to-end MCP integration tests
Test File Organization
- Use
suite()for logical test grouping - Use
setup()andteardown()for test lifecycle management - Initialize mock objects and clean up resources properly
- Test both success and error scenarios
See test files in src/test/ for examples.
Telemetry Implementation
The extension includes optional privacy-preserving telemetry using Application Insights.
For Developers
- TelemetryManager: Centralized service in
src/telemetryManager.ts- handles all telemetry operations with privacy filters - Configuration: Requires
APPLICATIONINSIGHTS_CONNECTION_STRINGenvironment variable (disabled by default in development) - Privacy-first: Automatically filters sensitive data (content, paths, tokens) and only collects anonymized usage patterns
Adding New Events
When adding new telemetry events:
- Use
TelemetryManager.trackEvent(name, properties, measurements)in your code - CRITICAL: Update
telemetry.jsonwith the new event definition including name, description, properties, and measurements - Follow existing patterns for privacy-safe event names and properties
Important: Keep telemetry.json in sync with actual telemetry events in the code. This file documents all collected data for transparency.
See telemetry.json for complete details on events collected.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

