A VS Code extension that implements an intelligent chat participant @dspy inside Copilot Chat, using DSPy-style reasoning loops to provide more reliable and structured code assistance.
Yu enhances your development workflow by adding a @dspy chat participant that uses structured reasoning loops (plan → draft → critique → revise) to provide more reliable code completions and refactoring suggestions. The extension leverages Ax (TypeScript DSPy) to orchestrate multi-step LLM conversations through the VS Code Language Model API.
- Structured Reasoning: Uses DSPy-style patterns to reduce hallucinations and improve code quality
- Context-Aware: Automatically collects relevant code context from your editor
- Streaming Responses: Real-time markdown output with "Insert to Editor" actions
- Extensible: Built to be composable and adaptable to new AI providers
- 🤖 @dspy Chat Participant: Invoke from Copilot Chat for structured assistance
- 📋 Multi-Step Process: Responses include Plan, Draft, Critique, and Final sections
- 🎯 Smart Context: Automatically uses selected code or current file as context
- ⚡ Quick Actions: "Insert to Editor" button to apply final code snippets
- 🔄 Ax Pipeline: Uses
@ax-llm/axfor structured LLM orchestration
- 💭 Conversation Memory: Remember findings and instructions across chat turns
- 🔍 Extended Context: Integration with docs and repository context
- 🚀 Proactive Suggestions: Intelligent next-step recommendations
- 🏠 Local Runners: Support for local DSPy (Python) execution
- See roadmap for more details.
- VS Code 1.103.0 or higher
- Access to VS Code's Language Model API (varies by organization/subscription)
-
Clone and install dependencies:
npm install
-
Compile and package the extension:
npm run package
-
Install the extension in VS Code:
- Open VS Code
- Press
Ctrl+Shift+P(Windows/Linux) orCmd+Shift+P(macOS) - Type "Extensions: Install from VSIX..." and select the generated
.vsixfile
-
Open Copilot Chat in VS Code
-
Type
@dspyfollowed by your request, for example:@dspy Refactor this function to be more efficient @dspy Add error handling to this code @dspy Explain what this code does and suggest improvements -
The
@dspyparticipant will respond with structured reasoning steps -
Use the "Insert to Editor" button to apply the final code suggestions
src/
├── extension.ts # Main extension entry point
└── test/
└── extension.test.ts # Extension tests
docs/
├── prd.md # Product Requirements Document
└── todos.md # Development TODO list
# Development
npm run compile # Compile TypeScript, check types, lint, and build
npm run watch # Run development mode with file watching
npm run package # Create production build for publishing
# Quality Assurance
npm run check-types # Run TypeScript type checking
npm run lint # Run ESLint
npm run test # Run VS Code extension tests
# Watch Commands
npm run watch:esbuild # Watch for changes and rebuild with esbuild
npm run watch:tsc # Watch for TypeScript changes
npm run watch-tests # Watch for test file changes- Ensure tasks. and launch.json are configured in
.vscode - Build: npm run compile
- Run: “Run Extension (Watch)” config
- In the Dev Host: open Copilot Chat → @dspy hello
- See streamed ack + “dspy” Output channel logs
🛠 Custoom Development Instructions for local setup Claude Code + Claude Code Router + Task-Master-ai
# Ensure Claude Code is running
ccr status # Check if Claude Code Router is running
ccr start # Run development mode with file watching
# Launching Claude Code (in separate terminal tab)
ANTHROPIC_BASE_URL=http://localhost:3456 ANTHROPIC_API_KEY=any-string-is-ok npx @anthropic-ai/claude-code
# Taskmaster
source .env # Ensure API keys are loaded and available as env variables
tm list # List tasks
task-master expand --id=3 # Expand task 3
task-master set-status --id=3 --status=done # Expand task 3The extension follows a modular architecture:
- Extension Layer: Registers the chat participant and manages context collection
- Ax Pipeline: Uses structured signatures for plan/draft/critique orchestration
- VS Code LM Adapter: Bridges Ax with the VS Code Language Model API
- UI Integration: Handles streaming responses and quick actions
- Target: ES2022
- Module: Node16
- Strict mode enabled
- Source maps enabled
- TypeScript naming conventions
- Code quality enforcement (curly braces, equality checks, semicolons)
- VS Code 1.103.0+
- Access to VS Code Language Model API
- Node.js for development
- No Python runtime required (Ax runs in TypeScript/JavaScript)
Phase: Early Development - MVP in Progress
The project scaffold is complete with:
- ✅ VS Code extension structure
- ✅ Basic command registration
- ✅ TypeScript configuration
- ✅ Build and test pipeline
- ✅ Task Master integration
- ⏳ Chat participant implementation
- ⏳ Ax pipeline integration
- ⏳ VS Code LM API integration
See docs/todos.md for detailed progress tracking.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run
npm run lintandnpm run test - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ using Claude Code