Feature request: add a local /open slash command for URLs and workspace files in Codex CLI
What variant of Codex are you using?
CLI
What feature would you like to see?
I would like Codex CLI to provide a built-in local /open slash command for explicitly opening URLs and local workspace paths with the system opener.
Suggested MVP behavior:
/open .opens the current session working directory./open <relative-or-absolute-path>opens a local file or directory./open <http-or-https-url>opens the URL in the system browser./open <file-url>resolves the localfile://URL and opens the target path.
This would be useful when Codex creates or references local artifacts during a session, such as generated HTML reports, images, screenshots, logs, Markdown files, or output directories. Today the user often has to leave the TUI or ask Codex to run a shell command such as open, xdg-open, or start, which adds friction and can unnecessarily involve the agent/tool execution flow.
The command should be a local user action, not a model turn. It should not submit a message to the model or mutate the conversation context.
Proposed safety and scope boundaries for the initial version:
- Only run when explicitly invoked by the user through the slash command.
- Do not execute shell strings; use argv or platform-native opener APIs to avoid shell injection.
- Allow only local filesystem paths and
http:///https://URLs by default. - Reject unsupported URL schemes with a clear error.
- Treat remote workspace paths as out of scope for the MVP unless there is already a safe local mapping.
- Do not try to infer “the current generated file” automatically in the MVP. A future follow-up could add
/open recentor an artifact picker if Codex has a reliable artifact model for that.
Additional information
I searched for existing issues and PRs and did not find an existing Codex CLI /open slash command proposal or implementation.
Related but distinct:
- #28209 asks for opening an image externally from Codex App. This proposal is for a CLI slash command, but the underlying workflow is similar: users want a direct way to open local artifacts created or referenced by Codex.
2 Comments
Implemented a candidate fix on my fork:
https://github.com/openai/codex/compare/main...Nicolas0315:codex:codex/tui-open-command?expand=1
Summary:
/open <path-or-url>as a local TUI slash command, not a model turn.http:///https://URLs, and localfile://URLs.file://URLs with query/fragment suffixes.explorer.exe,open,xdg-open) and does not execute shell strings.Verification:
just fmt,git diff --check,cargo check --manifest-path codex-rs/Cargo.toml -p codex-tui,just test -p codex-tui open_command,just test -p codex-tui certain_commands_are_available_during_taskall passed.git diff --check,cargo check --manifest-path codex-rs/Cargo.toml -p codex-tui, and both focused tests passed.c38b2e9ba69cb57d197c6e5ba78b5e52ae0870f9, patch apply, andgit diff --checkpassed; Rust test/build run was stopped after a long timeout while linking/buildingcodex-tuitest artifacts.git diff --checkpassed;cargo checkis blocked by the host linker misconfiguration where/usr/bin/link.exeis GNU coreutilslinkinstead of MSVClink.exe.git diff --checkpassed; Rust execution is blocked becausecargo/rustcare zero-byte stubs in/c/Users/ogosh/work/.cargo/bin.git diff --checkpassed; Rust execution is blocked becausecargo/rustcare not installed.I poked around the TUI a bit and I think this would slot in pretty naturally. Slash
commands get dispatched in
chatwidget/slash_dispatch.rs, and a bunch of them alreadyrun fully locally without ever hitting the model or touching the conversation, which is
exactly what you're asking for.
/diffis basically the template: it grabs the sessioncwd, does its thing, and drops the result into the history as a cell.
/opencould workthe same way, and since the cwd is already sitting on the widget,
/open .and relativepaths would resolve without any extra plumbing.
The URL side is almost free.
webbrowseris already a dependency and there's an existingOpenUrlInBrowserevent that opens the link and reports back success/failure as a localmessage, so
http/https(and afile://you'd want to hand to the browser) don't needany new opening code.
The one thing that's genuinely missing is opening a local file or directory with its
default app.
webbrowserwon't do it (it only launches browsers), and the per-OS openerthe desktop deep-link uses isn't reusable here either, since it's hardwired to launch the
desktop app and doesn't even have a Linux path. So that's the real gap: a cross-platform
"open this path with whatever app handles it," Linux included.
For that I'd just pull in a small argv-based opener crate like
open, which goes throughopen/start/xdg-openwith argv instead of a shell string. That handles theno-shell-injection requirement on its own and covers all three platforms in one call.
URLs stay on the existing
webbrowserpath. Net result is one new dependency doing onlythe part nothing else covers, and the URL handling stays on code that's already battle-
tested.
For an MVP I'd keep it to roughly what you listed:
/open <url>to the browser,/open <file://...>resolved to a path,/open .and relative/absolute paths against thesession cwd, reject any other scheme with a clear error, and explicitly leave out remote
workspaces and any "open the latest generated file" magic for now. Tests would mirror the
existing slash-command ones (path resolution, file-url handling, bad scheme, missing path)
without actually spawning anything in CI, plus regenerating the slash-popup snapshot.
Really the only open question is whether you're fine taking on one more dependency for the
opener, the alternative being hand-rolling the per-OS process spawning yourself, which the
crate already does correctly. Happy to put up a PR if that'd be welcome, otherwise feel
free to take the sketch and run with it.