Expose Codex skill path environment variables (and Claude-compatible aliases) during plugin skill execution

Open 💬 0 comments Opened Jul 28, 2026 by jtsternberg

What variant of Codex are you using?

App/CLI

What feature would you like to see?

Summary

When executing a tool call originating from a plugin skill, Codex should expose the skill and plugin installation paths as environment variables.

Proposed variables:

CODEX_SKILL_DIR
CODEX_PLUGIN_ROOT

For compatibility with the existing Claude plugin ecosystem, Codex should also expose aliases with identical values:

CLAUDE_SKILL_DIR
CLAUDE_PLUGIN_ROOT

Codex's documentation can recommend the CODEX_* names while supporting the Claude-prefixed aliases for cross-agent compatibility.

---

Motivation

Plugin skills frequently need to execute bundled scripts or access bundled resources.

For example:

bash "${CLAUDE_SKILL_DIR}/scripts/thing.sh"

Claude Code exposes these variables automatically for skill tool calls.

Codex currently does not expose an equivalent during skill execution, leaving plugin authors without a mechanical way to locate their own bundled resources.

The same plugin may be installed in any of these locations:

~/Code/my-plugin/plugins/example/skills/foo
~/.claude/plugins/cache/<marketplace>/<plugin>/<version>/skills/foo
~/.codex/plugins/cache/<marketplace>/<plugin>/<version>/skills/foo

Hardcoding paths is therefore incorrect.

---

Current workaround

The only portable solution today is to ask the model to resolve the absolute directory containing SKILL.md, for example:

SKILL_DIR="${CLAUDE_SKILL_DIR:-<absolute directory containing this SKILL.md>}"
bash "$SKILL_DIR/scripts/thing.sh"

This works surprisingly well because Codex already provides the model with the skill's location.

However, path resolution is fundamentally deterministic data, not model reasoning.

Replacing a mechanical operation with model judgment creates unnecessary opportunities for intermittent failures and makes plugins more difficult to maintain.

---

This affects more than shell scripts

Bundled resources appear in several forms:

  • shell commands invoking bundled scripts
  • instructions to read bundled reference files
  • permission patterns
  • documentation containing plugin-relative paths
  • future tooling built around plugin-relative resources

A runtime mechanism for resolving the active skill directory would benefit all of these patterns.

---

Codex already has the required information

From the current source, Codex already:

  • resolves the canonical absolute path to every SKILL.md
  • resolves the containing plugin root
  • validates that plugin skills remain inside that root
  • renders those locations into model context so the agent can locate the skill

The missing capability is simply exposing that existing information to tool invocations.

---

Why provide Claude-compatible aliases?

Codex has intentionally adopted many conventions from the existing Claude plugin ecosystem, making numerous plugins portable with little or no modification.

Supporting the existing Claude environment variable names would continue that compatibility story while allowing Codex to establish its own preferred naming.

This is not about making Anthropic's naming canonical.

Rather, it allows:

  • existing Claude plugins to work in Codex with fewer modifications
  • plugin authors to maintain a single source of truth
  • users to migrate between Claude Code and Codex more easily
  • the broader plugin ecosystem to become more portable

Codex documentation can recommend:

CODEX_SKILL_DIR
CODEX_PLUGIN_ROOT

while treating

CLAUDE_SKILL_DIR
CLAUDE_PLUGIN_ROOT

as compatibility aliases.

---

Proposed behavior

When a tool call is executed while following a plugin skill:

CODEX_SKILL_DIR=/absolute/path/to/plugin/skills/example
CODEX_PLUGIN_ROOT=/absolute/path/to/plugin

CLAUDE_SKILL_DIR=/absolute/path/to/plugin/skills/example
CLAUDE_PLUGIN_ROOT=/absolute/path/to/plugin

The Claude-prefixed variables would simply alias the corresponding CODEX_* variables.

Outside plugin skill execution, these variables could remain unset.

---

Expected result

Plugin authors could write:

bash "${CODEX_SKILL_DIR}/scripts/example.sh"

or

bash "${CLAUDE_SKILL_DIR}/scripts/example.sh"

and both would resolve mechanically to the same location.

This eliminates the need for model-resolved filesystem paths, reduces maintenance burden for cross-agent plugins, and improves portability across the existing plugin ecosystem with a minimal runtime change.

Additional information

_No response_

View original on GitHub ↗