Skip to content
| Marketplace
Sign in
Visual Studio Code>Machine Learning>Codex LinkNew to Visual Studio Code? Get it now.
Codex Link

Codex Link

changwen.luo

|
183 installs
| (0) | Free
A lightweight bridge that helps your editor work more smoothly with the official Codex agent extension.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

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

Codex Link demo

What This Extension Does

Codex Link adds these entry points:

  • An Add to Codex CodeLens above the selected range
  • An editor title action named Add Current File to Codex
  • A terminal context action named Add Terminal Selection 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

  1. Open VS Code.
  2. Open the Extensions view.
  3. Search for Codex Link.
  4. Click Install.
  5. Make sure the official Codex - OpenAI's coding agent extension is also installed and enabled.

Option 2: Install from a .vsix file

  1. Open VS Code.
  2. Open the Extensions view.
  3. Click the ... menu in the top-right corner of the Extensions view.
  4. Choose Install from VSIX....
  5. Select the .vsix package for Codex Link.
  6. Reload VS Code if prompted.

Quick Start

After both Codex Link and the official Codex extension are installed:

  1. Open a local project folder in VS Code.
  2. Open a local file.
  3. Select a block of code.
  4. Click Add to Codex.
  5. 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 keeps showing the default shortcut text and does not dynamically reflect user-customized keybindings.

Steps:

  1. Open a local file, an untitled scratch file, or a VS Code JSON settings editor.
  2. Select a single contiguous block of text.
  3. Look for the Add to Codex CodeLens above the selection.
  4. Click it, or use the Cmd+Option+L / Ctrl+Alt+L shortcut.

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
  • To reduce flicker during word-level search/navigation, single-line selections without whitespace only show Add to Codex when their trimmed length is at least 50 characters by default

Selection visibility setting:

Add this to settings.json if you want shorter or longer single-line expressions to trigger the inline actions:

{
  "codexLink.minSingleLineSelectionLength": 12
}

This setting only affects single-line selections without whitespace. Multi-line selections and single-line selections that already contain whitespace still always show the action.

2. Send a terminal selection to Codex

Use this when the context you want to share is terminal output or a command snippet instead of editor text.

Default shortcut while terminal focus is active:

  • macOS: Cmd+Option+L
  • Windows / Linux: Ctrl+Alt+L

Steps:

  1. Focus an integrated terminal in VS Code.
  2. Select a block of terminal text.
  3. Right-click and choose Add Terminal Selection to Codex, or use the terminal shortcut.

What happens:

  • Codex Link copies the current terminal selection
  • Codex Link writes that text to a temporary file with a short name such as fish-1 or fish-2
  • The temporary file starts with terminal metadata such as the terminal name, working directory, and capture time so Codex can treat it as terminal output instead of an ordinary note
  • Codex Link sends that temporary file to Codex as an attachment-style context item

Notes:

  • This path is best-effort because VS Code does not expose a stable extension API for reading terminal selections directly
  • The bridge uses the system clipboard to capture the terminal selection before creating the temporary file
  • If terminal copy does not place any text on the clipboard, Codex Link will show an error instead of sending stale empty content
  • The resulting attachment UI is controlled by the official Codex extension, so it may not look exactly like Cursor's terminal context chip
  • Codex Link cleans up old terminal capture temp files automatically using codexLink.terminalCaptureRetentionHours and codexLink.terminalCaptureMaxFiles, which default to 24 hours and 100 files

3. 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:

  1. Open a local file.
  2. Look at the editor title bar.
  3. Click Add Current File to Codex.

What happens:

  • Codex Link sends the current file to Codex using the official file command

4. Send a file from the Explorer

Use this when you want to add a whole file from the file tree.

Steps:

  1. Open the Explorer view.
  2. Right-click a file.
  3. Click Add to Codex.

What happens:

  • Codex Link sends that file path to Codex

5. Send a folder from the Explorer

Use this when you want Codex to know about a folder without expanding every file manually.

Steps:

  1. Open the Explorer view.
  2. Right-click a folder.
  3. 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

6. Use the Codex Link sidebar

The sidebar is useful when you want a dedicated handoff panel.

How to open it:

  1. Look at the left Activity Bar in VS Code.
  2. 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:

  1. Open a local file.
  2. Open the Codex Link sidebar.
  3. 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:

  1. Open the Codex Link sidebar.
  2. Click Pick Files or Folder for Codex.
  3. Select one or more files or folders.
  4. Confirm the picker dialog.

What happens:

  • Codex Link sends each selected resource to Codex
  • Codex Link then opens the Codex sidebar

Drag and drop into the sidebar

Use this only if drag and drop from the VS Code Explorer works in your environment.

Steps:

  1. Open the Codex Link sidebar.
  2. Drag a file or folder from the VS Code Explorer.
  3. 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 Add to Codex CodeLens
  • Selection handoff supports local files, untitled editors, and VS Code JSON settings editors
  • Terminal selection handoff is best-effort and depends on terminal copy updating the system clipboard
  • 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:

  1. Confirm the official openai.chatgpt extension is installed
  2. Confirm that extension is enabled
  3. Confirm you are working in a supported editor such as a local file, an untitled document, or a VS Code JSON settings editor
  4. Try Open Codex from the Codex Link sidebar
  5. Try reloading the VS Code window

The inline selection action does not appear

Check these items:

  1. Make sure the file is a local file
  2. For JSON settings files, make sure you are editing the text document itself, not the Settings UI
  3. Make sure the selection is not empty
  4. Make sure you only have one selection range
  5. Try changing the selection once more to refresh the CodeLens

Terminal selection did not send the expected text

Try this:

  1. Re-select the terminal text and run Add Terminal Selection to Codex again
  2. Confirm the terminal selection can be copied normally in your VS Code environment
  3. Check whether another app or extension is interfering with the system clipboard
  4. If the terminal path remains unreliable, paste the terminal snippet into an untitled editor and use the regular selection action
  5. Look for a new temporary attachment in Codex whose file name looks like fish-1 or terminal-1

Drag and drop into the sidebar does not work

Try this:

  1. Drag from the VS Code Explorer instead of the OS file manager
  2. 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:

  1. Install and enable the official openai.chatgpt extension.
  2. Open a local file.
  3. Select a single contiguous range and confirm the Add to Codex CodeLens appears above the selection.
  4. Click the CodeLens and confirm Codex receives the selected range.
  5. Confirm the editor title action Add Current File to Codex appears.
  6. Right-click a file in Explorer and confirm Add to Codex appears and works.
  7. Right-click a folder in Explorer and confirm Add to Codex appears and adds only the folder path context.
  8. 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
  9. Select terminal text and confirm Add Terminal Selection to Codex works from the terminal context menu or shortcut.
  10. Disable or uninstall openai.chatgpt and confirm install guidance appears.

Internal Command IDs

These command ids are stable inside this project:

  • codexBridge.addSelectionToChat
  • codexBridge.addTerminalSelectionToChat
  • codexBridge.addResourceToChat
  • codexBridge.installCodexDependency
  • codexBridge.openCodex
  • codexBridge.addCurrentFileToChat
  • codexBridge.pickFilesOrFoldersToChat
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft