codex-environment

Installation
SKILL.md

Codex Environment

Use this skill when the user asks about Codex Local Environments, worktree setup scripts, cleanup scripts, Codex actions, .codex/environments/environment.toml, CODEX_WORKTREE_PATH, CODEX_SOURCE_TREE_PATH, or making a worktree ready to run.

What We Learned

  • Codex app Local Environments are project config, not one-off terminal commands.
  • The shareable config lives at .codex/environments/environment.toml at the project root.
  • Setup scripts run when Codex creates a new worktree for a new thread.
  • Cleanup scripts run before Codex cleans up the worktree.
  • Actions appear in the Codex app top bar and run in the integrated terminal.
  • Worktrees only contain checked-in files, so ignored files like .env must be copied or recreated by setup.
  • Prefer short setup/cleanup entries that call versioned project scripts instead of long inline shell.
  • Keep executable entrypoints in scripts/, for example scripts/worktree-up and scripts/worktree-down.
  • Keep .codex focused on Codex config; keep operational logic in scripts/.
  • Do not commit secrets. It is fine for setup to copy ignored env files locally.
  • For projects with local databases, setup should create a worktree-specific DB name and rewrite the copied .env to point to it.
  • Cleanup should drop only the worktree-specific databases and remove copied local env files.
  • Use CODEX_SOURCE_TREE_PATH for the original project checkout and CODEX_WORKTREE_PATH for the new worktree when available.
Installs
1
GitHub Stars
224
First Seen
Jun 9, 2026
codex-environment — melvynx/aiblueprint