What local environments are
A local environment tells Tadle Code X how to set up a new worktree for a project: a setup script, a cleanup script, and actions you can run from a chat.
Create or change one
- In Settings, choose “Environments”, under “Coding”. If you’re connected to other computers over SSH, first pick the computer in the sidebar. “All settings” means this computer.
- Under “Select a project”, choose + beside a project to add an environment. To change one, choose “View” beside it, then “Edit local environment”. Use “Add project” if the project isn’t listed.
- Give it a name, and fill in what you need:
- Setup script: runs in the new worktree’s copy of the project when a worktree is created. It can use
CODEX_SOURCE_TREE_PATH, your project’s folder, andCODEX_WORKTREE_PATH, the new worktree’s. - Cleanup script: runs before a worktree is deleted.
- Actions: commands you can run from a chat, added with “Add action”.
- Setup script: runs in the new worktree’s copy of the project when a worktree is created. It can use
- Save. Saving a new environment selects it for that project on that computer.
The app saves each environment as a file in the project, in .codex/environments/, so it can be committed and shared like any other file. The list also shows environments in the folders above the project, up to the repository’s root. The app has no button to delete an environment: delete its file.
Choose the environment a chat uses
Until an environment is selected, no setup runs, even if the project has an environment file. To pick one, open the chat’s summary panel and, under “Environment”, choose the “Choose environment” button, or “Change environment” in its actions menu. In a worktree chat this changes that worktree’s environment only.
When the scripts run
- The setup script runs when a worktree is created with an environment selected: when you fork a chat into a new worktree. It doesn’t run for a chat in your own checkout, or for a permanent worktree.
- It runs without asking, as a program on your computer under your account, with your login shell’s environment variables, except the app’s own settings and model provider keys. Any failing command stops it. The new chat shows its progress.
- If it fails, you can choose “Edit environment” or “Retry”, and, once the worktree exists, “Continue anyway” or “Auto-fix”.
- The cleanup script runs before a worktree is deleted. If it fails, the worktree isn’t deleted.
- Actions run in the chat’s terminal, in the project folder. They’re under “Environment” in the chat’s summary panel: choose an action’s run button, or pick one from the actions menu. Adding an action there saves it and runs it at once.
Before you select one
- An environment file holds scripts that run on your computer. Read it before you select it, and again after you pull changes: every new worktree runs it as it reads at that moment.
- If the selected file is removed, the app switches to the project’s default environment, which you may not have read.
- Don’t export secrets from a setup script. The app keeps exported values in plain text in the worktree’s git data and gives them to its new chats and terminals.
Back to the documentation.