Mention at Codex
Press cmd+alt+k in VSCode and the current file, or the selected line range, appears as a Codex mention in your linked terminal.
Install
Marketplace install:
- Install
Mention at Codex from the VSCode Marketplace once a published slug exists.
Build from source:
- Run
pnpm install.
- Run
pnpm run build.
- Open the repo in VSCode.
- Press
F5 to launch an Extension Development Host.
Usage
- Install the extension.
- Open a new terminal in VSCode after the extension activates.
- Run
codex in that terminal.
- If prompted, run
Mention at Codex: Setup Codex Integration.
- If it does not link immediately, send your first prompt in Codex.
- Wait for the status bar to show linked
Codex.
- Press
cmd+alt+k on macOS or ctrl+alt+k on Linux and Windows.
Mention output:
- No selection:
@path/to/file
- Single-line selection:
@path/to/file#L10
- Multi-line selection:
@path/to/file#L10-20
The mention is typed into Codex without pressing Enter. Focus moves to the linked Codex terminal.
How Linking Works
The extension injects MENTION_AT_CODEX_SESSION into new VSCode terminals. When Codex starts, its hook runs ~/.config/mention-at-codex/hook.js on macOS and Linux, or the matching %APPDATA%\\mention-at-codex\\hook.js path on Windows. It writes a small local handshake file there. The extension watches that folder, matches the process chain back to the right VSCode terminal, then keeps one linked Codex target in memory.
The extension asks before editing ~/.codex/hooks.json. It overwrites only its own integration entry and leaves other user hooks alone.
Switching The Linked Codex
Only one Codex terminal is linked at a time.
To switch the link while another Codex is still alive, type ide inside the Codex terminal you want to bind. That runs the global ide skill and triggers a manual rebind.
Caveats
- Node.js must be available on
PATH.
- Codex sessions that were already running before the extension injected the session env var cannot auto-link. Restart Codex in a new terminal after enabling the extension.
- Unusual wrapper stacks such as
tmux, direnv, nested shells, or similar tooling may confuse the PID walker. The hook captures up to 6 parent hops and prefers name-based Codex detection, but edge cases can still happen. If they do, run node resources/hook.js session-start and include the output in an issue.
- Untitled files are intentionally ignored until saved.
Privacy
Everything stays on your machine.
- The extension writes
~/.codex/hooks.json only after asking.
- Handshake files live in
~/.config/mention-at-codex/.
- The hook writes handshake files with mode
0600 where the OS supports it.
Commands
Mention at Codex: Insert At-Mentioned
Mention at Codex: Setup Codex Integration
Mention at Codex: Uninstall Codex Integration
Mention at Codex: Show Logs
Uninstall
- Run
Mention at Codex: Uninstall Codex Integration.
- Uninstall the extension from VSCode.