Codex Link
Codex Link is a VS Code extension that makes it easier to send selections, files, and folders into the official Codex - OpenAI's coding agent extension.
It does not replace Codex chat. It adds faster entry points on top of the official Codex extension so you can move context into Codex with fewer steps.
Source repository: github.com/lcwlucky/codex-link-vscode-plugin

What This Extension Does
Codex Link adds these entry points:
- An inline
Add to Codex (⌥⌘L) CodeLens above a selected text range on macOS, or Add to Codex (Ctrl+Alt+L) on other platforms
- An editor title action named
Add to Codex
- Explorer context menu actions named
Add to Codex for files and folders
- A dedicated
Codex Link sidebar with:
Open Codex
Add Current File to Codex
Pick Files or Folder for Codex
- a sidebar action for reliably picking files or folders for Codex
- a drop zone for best-effort drag and drop when your VS Code environment supports it
Behind the scenes, Codex Link delegates to the public commands exposed by the official Codex extension:
chatgpt.addToThread
chatgpt.addFileToThread
Requirements
You must install and enable the official Codex extension first:
Codex - OpenAI's coding agent
- extension id:
openai.chatgpt
Codex Link depends on that extension. If it is missing or disabled, Codex Link will show an install or enable prompt instead of sending content.
Installation
There are two common ways to install Codex Link.
Option 1: Install from VS Code Marketplace
- Open VS Code.
- Open the Extensions view.
- Search for
Codex Link.
- Click
Install.
- Make sure the official
Codex - OpenAI's coding agent extension is also installed and enabled.
Option 2: Install from a .vsix file
- Open VS Code.
- Open the Extensions view.
- Click the
... menu in the top-right corner of the Extensions view.
- Choose
Install from VSIX....
- Select the
.vsix package for Codex Link.
- Reload VS Code if prompted.
Quick Start
After both Codex Link and the official Codex extension are installed:
- Open a local project folder in VS Code.
- Open a local file.
- Select a block of code.
- Click
Add to Codex.
- Codex should open and receive the selected context.
If you prefer not to select text manually, use the file, folder, or sidebar actions described below.
Detailed Usage Guide
1. Send a selected code block to Codex
Use this when you want to send only part of a file.
Default shortcut:
- macOS:
Cmd+Option+L
- Windows / Linux:
Ctrl+Alt+L
You can change this shortcut in VS Code Keyboard Shortcuts. The inline CodeLens label keeps showing the default shortcut text and does not dynamically reflect user-customized keybindings.
Steps:
- Open a local file, an untitled scratch file, or a VS Code JSON settings editor.
- Select a single contiguous block of text.
- Look for the inline
Add to Codex CodeLens above the selection.
- Click it.
What happens:
- Codex Link calls the official Codex selection command
- Codex receives the selected file range as thread context
Notes:
- This works in local
file documents, untitled documents, and VS Code JSON settings editors such as settings.json
- This action supports one non-empty selection at a time
- If you have multiple selections, Codex Link will reject the action
2. Send the current file from the editor title bar
Use this when you already have a file open and want a persistent button without selecting text.
Steps:
- Open a local file.
- Look at the editor title bar.
- Click
Add to Codex.
What happens:
- Codex Link sends the current file to Codex using the official file command
3. Send a file from the Explorer
Use this when you want to add a whole file from the file tree.
Steps:
- Open the Explorer view.
- Right-click a file.
- Click
Add to Codex.
What happens:
- Codex Link sends that file path to Codex
4. Send a folder from the Explorer
Use this when you want Codex to know about a folder without expanding every file manually.
Steps:
- Open the Explorer view.
- Right-click a folder.
- Click
Add to Codex.
What happens:
- Codex Link sends the folder path to Codex
- Codex Link does not enumerate folder contents itself
- Codex can then read from that folder on demand
The sidebar is useful when you want a dedicated handoff panel.
How to open it:
- Look at the left Activity Bar in VS Code.
- Click the
Codex Link icon.
The sidebar contains four main actions.
Open Codex
Use this when you just want to focus the official Codex sidebar.
Add Current File to Codex
Use this when the active editor already contains the file you want to send.
Steps:
- Open a local file.
- Open the
Codex Link sidebar.
- Click
Add Current File to Codex.
Pick Files or Folder for Codex
Use this when you want to add files or folders through the OS file picker.
Steps:
- Open the
Codex Link sidebar.
- Click
Pick Files or Folder for Codex.
- Select one or more files or folders.
- Confirm the picker dialog.
What happens:
- Codex Link sends each selected resource to Codex
- Codex Link then opens the Codex sidebar
Use this only if drag and drop from the VS Code Explorer works in your environment.
Steps:
- Open the
Codex Link sidebar.
- Drag a file or folder from the VS Code Explorer.
- Drop it into the drop zone.
Important limitation:
- Drag and drop support is best-effort
- VS Code Explorer drag and drop may not provide usable data to the webview in some environments
- External OS drag and drop may vary by platform and VS Code behavior
Recommended fallback:
- Use
Pick Files or Folder for Codex
What Happens When Codex Is Missing
If the official Codex extension is not installed:
- Codex Link shows an error message
- Codex Link offers an
Install Codex action
If the official Codex extension is installed but disabled:
- Codex Link shows an error message asking you to enable it
Current Limitations
- Only local
file resources are supported
- Only a single non-empty text selection shows the inline CodeLens action
- Selection handoff supports local files, untitled editors, and VS Code JSON settings editors
- Folder contents are not expanded by Codex Link itself
- Drag and drop is best-effort and is not guaranteed to work identically across all VS Code environments
- Codex Link cannot inject custom UI into the official Codex chat input itself
Troubleshooting
I clicked Add to Codex, but nothing happened
Check these items:
- Confirm the official
openai.chatgpt extension is installed
- Confirm that extension is enabled
- Confirm you are working in a supported editor such as a local file, an untitled document, or a VS Code JSON settings editor
- Try
Open Codex from the Codex Link sidebar
- Try reloading the VS Code window
The inline selection action does not appear
Check these items:
- Make sure the file is a local file
- For JSON settings files, make sure you are editing the text document itself, not the Settings UI
- Make sure the selection is not empty
- Make sure you only have one selection range
- Try changing the selection once more to refresh the CodeLens
Try this:
- Drag from the VS Code Explorer instead of the OS file manager
- Use
Pick Files or Folder for Codex, which is the recommended reliable path
I only see install prompts
That means Codex Link can run, but the official Codex extension is missing or disabled. Install or enable openai.chatgpt first.
Manual Verification Checklist
Use this checklist before packaging or publishing:
- Install and enable the official
openai.chatgpt extension.
- Open a local file.
- Select a single contiguous range and confirm the inline
Add to Codex CodeLens appears.
- Click the CodeLens and confirm Codex receives the selected range.
- Confirm the editor title action
Add to Codex appears.
- Right-click a file in Explorer and confirm
Add to Codex appears and works.
- Right-click a folder in Explorer and confirm
Add to Codex appears and adds only the folder path context.
- Open the
Codex Link sidebar and test:
Open Codex
Add Current File to Codex
Pick Files or Folder for Codex
- drag and drop from the VS Code Explorer if your environment supports it
- Disable or uninstall
openai.chatgpt and confirm install guidance appears.
Internal Command IDs
These command ids are stable inside this project:
codexBridge.addSelectionToChat
codexBridge.addResourceToChat
codexBridge.installCodexDependency
codexBridge.openCodex
codexBridge.addCurrentFileToChat
codexBridge.pickFilesOrFoldersToChat