Codex for Visual Studio 2022 brings the Codex CLI into Microsoft Visual Studio so that you can chat with the Codex agent, run guided commands, review diffs, and interact with MCP tools without leaving the editor.
Unofficial project: CodexVS22 is community maintained and is not an official product of Anthropic or Microsoft. The extension is under active development and APIs may change.
- Actively developed with frequent in-progress checkpoints.
- Requires the Codex CLI to be installed locally.
- Expect rough edges while release tasks in
todo-release.mdremain open.
- AI chat tool window with full conversation history and code selection context.
- Diff review and patch application workflow with approval gates.
- Execution console for running shell commands through Codex with optional WSL routing.
- MCP (Model Context Protocol) tool discovery, invocation, and prompt insertion helpers.
- Persistent solution scoped settings plus import/export for sharing configurations.
- Telemetry hooks (opt in) for tracking prompt and tool usage.
- Modular MVVM layout splits chat, diff, exec, approvals, and MCP workflows across dedicated view-models coordinated by a shared session store.
- A lightweight session coordinator mediates Codex CLI events, updating stores that drive the tool window without code-behind access.
- Services wrap VS SDK access (workspace, telemetry, approvals) so the UI binds strictly to observable state.
- Detailed diagrams for chat, diff, and exec pipelines live in
docs/architecture-diagrams.md.
flowchart LR
CLI[Codex CLI]
Coordinator[Session Coordinator]
Chat[Chat Transcript VM]
Diff[Diff Review VM]
Exec[Exec Console VM]
MCP[MCP Tools VM]
Approvals[Approvals VM]
CLI --> Coordinator
Coordinator --> Chat
Coordinator --> Diff
Coordinator --> Exec
Coordinator --> MCP
Coordinator --> Approvals
Chat --> Approvals
Diff --> Approvals
Exec --> Approvals
- Visual Studio 2022 version 17.6 or newer with the Visual Studio extension development workload.
- Codex CLI installed and available on
PATH, or configure the absolute path in the Options page. - Optional: Windows Subsystem for Linux if you prefer to run the CLI inside WSL.
- Download the latest
.vsixpackage from the releases page. - Double-click the package to launch the Visual Studio extension installer.
- Restart Visual Studio after the installer completes.
- Open the Codex tool window via
Tools -> Open Codex.
- Authenticate: use the Login button in the Codex tool window (runs
codex login). - Send context: right-click a selection and choose Add to Codex chat to preload snippets.
- Adjust settings: visit
Tools -> Options -> Codexfor CLI path, approval modes, sandbox policy, and default models. - Try prompts: insert predefined prompts from the prompt palette or create your own.
- Settings support per-solution overrides stored alongside the
.slnfile. - WSL integration shells out to
wsl.exe -- codex ...when enabled. - MCP servers are declared in
codex.json; use the tool window refresh action after editing the file. - Execution safeguards route through approval workflows; see
PROMPTS.txtfor built-in command templates. - Telemetry and session persistence toggles live under
Tools -> Options -> Codex; seedocs/telemetry-diagnostics-plan.mdanddocs/session-persistence-plan.mdfor policy details.
# Restore dependencies
msbuild CodexVS22.sln /t:Restore
# Build the VSIX (Release configuration recommended)
msbuild CodexVS22.sln /p:Configuration=ReleaseGenerated artifacts land in bin/ and can be installed by double-clicking the resulting .vsix.
- Unit tests reside in
CodexVS22.Testsand can be executed withdotnet test. - Integration validation relies on manual smoke tests noted in
RELEASE_CHECKLIST_v0.1.0.mdandPOST_TEST_SUMMARY_v0.1.0.md.
We split the refactored tool window into clear modules. When opening an issue or pull request, mention the relevant area and ping the listed doc owners.
| Area | Maintainers & Contact Doc | Primary Specs |
|---|---|---|
| Chat transcript & streaming | See docs/chat-viewmodel-design.md (maintained by Chat leads) |
Chat VM, session store integration |
| Diff review & patch apply | See docs/diff-module-plan.md |
Diff pipeline, approvals, VS diff services |
| Exec console | See docs/exec-module-plan.md |
Exec MVVM + ANSI pipeline |
| MCP tools & prompts | See docs/mcp-module-plan.md |
Tool discovery, prompt palettes |
| Session persistence | See docs/session-persistence-plan.md |
Resume cache, autosave cadence |
| Telemetry & diagnostics | See docs/telemetry-diagnostics-plan.md |
Event names, privacy toggles |
| Options & onboarding docs | See docs/options-integration-plan.md and docs/docs-onboarding-plan.md |
Options store, onboarding checklist |
Check docs/docs-onboarding-plan.md for the latest onboarding checklist, coding standards, and writing guidelines.
Contributions are welcome. Please:
- Open an issue to discuss significant feature ideas.
- Follow the provided issue templates for bug reports and feature requests.
- Submit pull requests using the template to document testing and rationale.
CodexVS22 aims to mirror the official VS Code extension where practical. The current parity status, gaps, and Windows-only items are tracked in parity-report.md. Key differences today include WPF-only UI flows, Visual Studio diff services, and session persistence that is unique to this extension.
See docs/troubleshooting.md for guidance on streaming hiccups, diff apply failures, exec console issues, and resume diagnostics. The guide links back to the relevant refactor plans so you can jump straight to the owning module.
- File issues on the GitHub tracker.
- Check the
/docsdirectory for build logs, release notes, and troubleshooting guides. - Discussions and Q&A can happen via GitHub Discussions (if enabled) or by opening an issue.
This repository is provided under the Apache License 2.0 (see LICENSE). The VSIX package also includes the project-specific EULA.md; consult both documents before redistribution.