How to stop LLM agents from losing critical setup parameters when switching dev environments?
You start a task on a laptop, then move it to a git worktree, a dev container or a cloud session, and the agent no longer knows the stack name, the region or the deploy command it used an hour ago. This page follows the question in its title: where should each kind of setup information live so that it arrives with you? It reads the documentation of Claude Code, OpenAI Codex, Cursor, GitHub Copilot cloud agent, Gemini CLI, Devin Desktop and the Dev Containers specification, plus one practitioner's article, and it is worth reading on if you switch environments and want to know what each vendor says travels and what does not. The sources were read on 28 November 2026.
TL;DR
- This page's reading: setup parameters can be missing in a new environment when rules, environment-specific values and learned facts are mixed together in a place that the vendor says does not carry over. (Claude Code cloud environments) (Cursor Cloud Agents setup)
- Cursor distinguishes installation, startup commands, and task instructions; Codex distinguishes required guidance from memories. (Cursor Cloud Agents setup) (Codex memories)
- This page's advice, not a vendor rule: commit working rules, declare parameters in the environment's configuration, put secrets in its secret store, keep parameters and secrets out of memory, and never leave a required rule only in memory.
Why do setup parameters get lost when you switch environments?
Three terms first, because the rest of the page uses them in these senses.
Instruction file. An instruction file is a persistent text file that gives an agent working rules or project guidance (Claude Code memory, Codex AGENTS.md).
Environment configuration. Environment configuration is the set of files and settings that declare one environment's parameters, variables and preparation steps (Cursor Cloud Agents setup, devcontainer.json reference).
Agent memory. Agent memory is stored context from earlier work that an agent can use in later work (Codex memories).
The documentation identifies different boundaries. These are the vendors' descriptions, not a shared persistence contract.
- A cloud session starts from the repository. Anthropic: “Cloud sessions start from a fresh clone of your repository. Anything you commit to the repo is available. Anything you’ve installed or configured only on your own machine isn’t available in the session.” (Claude Code cloud environments)
- Git ignores files that setup may need. OpenAI: “Since Handoff uses Git operations, any files that are part of your .gitignore file won’t move with the chat unless Codex copies them into a local managed worktree with .worktreeinclude.” It adds: “Use this for files Git intentionally ignores, such as .env, .env.local, or config/secrets.json.” The exception is specifically a local managed worktree. (Codex Git worktrees)
- A worktree has a separate directory. OpenAI: “Since worktrees run in different directories than your local chats, your project might not be fully set up and might be missing dependencies or files that aren’t checked into your repository.” (Codex local environments)
- A saved Build is not a running shell. Cursor: “Builds preserve disk state only. Running processes, exported shell variables, and in-memory caches don't continue into an agent run.” (Cursor Cloud Agents setup) A variable exported in a Build's install step is therefore not in the agent run that follows.
- Container variables have a rebuild boundary. The Dev Containers specification: “containerEnv will set the variable on the Docker container itself, so all processes spawned in the container will have access to it. But it will also be static for the life of the container - you must rebuild the container to update the value.” (devcontainer.json reference) A
containerEnvvalue you change indevcontainer.jsondoes not reach a container that is already running until it is rebuilt. - Automatic notes have their own scope. Anthropic: “Auto memory is machine-local. All worktrees and subdirectories within the same git repository share one auto memory directory. Files are not shared across machines or cloud environments.” (Claude Code memory)
A practitioner example shows why placement deserves attention without demonstrating a failure. Saravanan Natarajan's Part Two: Context Engineering: From a Local PoC to the Cloud Integration, published 10 October 2026, describes continuing a project in another development environment and supplying the agent with project-specific guidance. (The address of the article contains "part-one"; the live title says "Part Two".)
Under “Useful Context for the Vibration PoC:”, the article lists “Use stack vibration-poc-dev” next to “Do not commit credentials”. Its list of what AGENTS.md and a Cursor rule tell the model includes “Stack name: vibration-poc-dev” and “EnvironmentName: dev”. The author already keeps AWS_REGION and VIBRATION_TABLE in a generated .env, and the article says “.env is project-local runtime configuration.” It also says “AGENTS.md is a broadly recognized repository instruction file for coding agents.” (the Medium article)
The article separates context, instructions and constraints and reports no loss of parameters. It is an illustration of a parameter sitting beside rules, not an error attributed to the author. Both placements can be intentional. In the article's own words they are two kinds of file: a project-local runtime configuration and a repository instruction file.
What goes in instruction files, what goes in environment configuration, and what goes in memory?
The separation is practical. Cursor says:
Keep long-running processes out of install. Put Docker, databases, tunnels, and dev servers in startup commands. You can also add instructions in AGENTS.md for services an agent only needs for specific tasks.
OpenAI gives a separate boundary for recall:
Keep required team guidance in AGENTS.md or checked-in documentation. Treat memories as a helpful recall layer, not as the only source for rules that must always apply.
Anthropic directs standing instructions to CLAUDE.md or --append-system-prompt and describes settings as JSON keys that change Claude Code's behaviour. It also states: “Claude treats CLAUDE.md files and auto memory as context. They aren't enforced configuration.” (Claude Code settings) (Claude Code memory)
Gemini CLI is a counter-example to any universal separation rule. Its memory tool edits Markdown files directly. Shared instructions go into repository GEMINI.md files, private project notes into a private memory folder, and cross-project preferences into ~/.gemini/GEMINI.md. It explicitly lists “Storing frequently used aliases or system configurations.” as a memory use. (Gemini CLI memory)
This page's advice, not a vendor rule: keep active setup parameters in environment configuration rather than recall. Keep secrets in the environment's secret store. Commit required rules to the instruction file. This gives the pre-switch review a declared place to check for each item.
For the file-level companion, see CLAUDE.md, AGENTS.md, and Cursor rules.
Where does each AI coding tool keep these three layers?
The columns use the definitions above. They describe locations and loading rules, not equivalent feature sets.
| Client | Instructions | Environment configuration | Memory |
|---|---|---|---|
| Claude Code | CLAUDE.md files (Claude Code memory) | Variables under env in settings.json (Claude Code environment variables) | Notes Claude writes from corrections and preferences (Claude Code memory) |
| OpenAI Codex | AGENTS.md files before work (Codex AGENTS.md) | Personal and project config.toml (Codex basic configuration) | Under the Codex home directory (Codex memories) |
| Cursor | Project rules, .mdc files in .cursor/rules, and AGENTS.md (Cursor rules) | Cloud Agents only: .cursor/environment.json (Cursor Cloud Agents setup) | not documented on the pages read (28 November 2026) |
| GitHub Copilot cloud agent | .github/copilot-instructions.md (Copilot repository instructions) | copilot-setup-steps.yml for GitHub Actions sessions (Copilot agent environment) | Repository facts and personal coding preferences (Copilot Memory) |
| Gemini CLI | GEMINI.md context files (Gemini CLI context files) | Automatically loaded .env files (Gemini CLI configuration) | Direct edits to Markdown memory files (Gemini CLI memory) |
| Devin Desktop (formerly Windsurf) | Persistent Devin Local rules (Devin Local customizations) | n/a | n/a |
| Dev containers | n/a, outside the spec | devcontainer.json metadata and settings (devcontainer.json reference) | n/a |
| Mnemoverse (memory service) | “Put the rules into whichever file or settings field your tool reads as standing instructions.” (our agent-memory page) | Local server: the API key sits in the client's config file (“The key lives in your config file, not in the host app's session.”) (our MCP server page) | Memories are shared across tools on one account: “Yes, when each tool connects to the same Mnemoverse account.” (the answer to the question of whether Claude Desktop can share memory with Cursor, Claude Code and ChatGPT; ChatGPT needs the published plugin) (our Claude apps page) Our memory rules end: “Never store passwords, API keys, payment data, MFA codes, government IDs, or health records.” (our agent-memory page) |
For Devin Desktop this table uses only the Devin Local customizations page; the rename from Windsurf is stated on our own agent-memory page.
Mnemoverse is a memory service, not a coding client, so its first two cells say where its own material goes in another tool.
Claude Code
Use CLAUDE.md for persistent instructions. (Claude Code memory) Direct AGENTS.md support has conditions: “Reading AGENTS.md directly requires Claude Code v2.1.277 or later.” By default, it also requires no CLAUDE.md or CLAUDE.local.md in the working directory or above. Otherwise, put an @AGENTS.md import in an adjacent CLAUDE.md. (Claude Code memory)
Settings have separate scopes:
- User:
~/.claude/settings.json. - Shared project:
.claude/settings.json, committed for teammates. - Local project:
.claude/settings.local.json; add it to.gitignoreif you create it yourself.
Variables go under env and are read directly regardless of how Claude Code launches. Shared project variables can be checked into source control. (Claude Code environment variables) The documentation's .env read restriction is an example deny rule you add yourself, not a blanket default. (Claude Code settings)
Cloud sessions read only some settings. (Claude Code settings) Cloud variables use .env format. A Bash setup script runs before Claude Code launches; its needed values belong in the script itself. For preferences outside a shared repository, in an Anthropic-hosted environment a setup script can write ~/.claude/CLAUDE.md. (Claude Code cloud environments)
Auto memory consists of notes Claude writes from corrections and preferences. (Claude Code memory)
OpenAI Codex
Codex reads AGENTS.md before work and layers global guidance with project overrides. (Codex AGENTS.md) Personal settings live in ~/.codex/config.toml; project overrides use .codex/config.toml and load only for trusted projects. (Codex basic configuration)
Use config.toml for durable settings. OpenAI assigns environment variables to shell-scoped overrides, automation secrets, installer behaviour, or diagnostics. (Codex environment variables)
shell_environment_policy controls variables passed to spawned commands. OpenAI recommends explicit values and keyed filters, with this default:
ignore_default_excludes defaults to true, so Codex doesn’t automatically remove variable names containing KEY, SECRET, or TOKEN.
(Codex advanced configuration)
Setup scripts run when Codex creates a worktree for a new chat. (Codex local environments) For needed ignored files in a local managed worktree, review .worktreeinclude. (Codex Git worktrees)
Current cloud environments have an install script. Environment variables reach programs directly; network secrets use proxy substitution for HTTPS requests to allowed domains. OpenAI says sharing the environment shares these requirements, not your personal credentials, and also that environment-owned credentials and prepared files should be reviewed before sharing. Saved state does not replace source control. (Codex cloud environments)
Codex Cloud (Legacy), which OpenAI plans to deprecate, has a different contract. (Codex cloud environments) It supports Code Review and Linear and GitHub integrations. Variables last through setup and the agent phase; secrets are available only to setup scripts and are removed before the agent phase. AGENTS.md supplies project lint and test commands. (Codex Cloud (Legacy))
Local memories are off by default and stored under the Codex home directory. (Codex memories) The configuration setting is features.memories. (Codex configuration reference)
Cursor
Project rules are version-controlled .mdc files in .cursor/rules. User Rules apply across projects. Cursor supports AGENTS.md in the project root and subdirectories. (Cursor rules)
For Cloud Agents, the environment includes cloned repositories, dependencies, secrets, startup commands, and network access. You can commit .cursor/environment.json. Cursor runs its install script when creating a Build and directs repeatable preparation steps there. Cloud Agents also read AGENTS.md. (Cursor Cloud Agents setup)
GitHub Copilot cloud agent
Repository-wide instructions use .github/copilot-instructions.md. AGENTS.md files can appear anywhere in the repository; the nearest takes precedence. Alternatively, use a single root CLAUDE.md or GEMINI.md. (Copilot repository instructions)
.github/workflows/copilot-setup-steps.yml runs preparation before Copilot starts, but only for GitHub Actions sessions, not cloud sandboxes. The workflow must be on the default branch. (Copilot agent environment)
Dedicated Agents secrets and variables supply the environment, including setup scripts. In a cloud sandbox, only secrets are available, not variables. (Copilot secrets and variables)
Copilot Memory distinguishes repository facts shared with collaborators from personal, non-sensitive preferences, approval requirements, and reusable workflows. (Copilot Memory)
Gemini CLI
Context files hold reusable instructions. Global defaults use ~/.gemini/GEMINI.md. Another filename, including AGENTS.md, requires context.fileName; it is not the default name. (Gemini CLI context files)
Keep the .env descriptions separate:
- The configuration page says, “The CLI automatically loads environment variables from an .env file.” It also says, “If still not found, it looks for ~/.env (in the user’s home directory).” (Gemini CLI configuration)
- The authentication page, which is about setting up authentication, says, “Gemini CLI automatically loads variables from the first .env file it finds, searching up from the current directory, then in your home directory’s .gemini/.env”. (Gemini CLI authentication)
These excerpts are not a combined search order. The configuration page describes environment variables as suitable for API keys and settings that change between environments. (Gemini CLI configuration) Memory edits and routing follow the Markdown scopes described above. (Gemini CLI memory)
Devin Desktop (formerly Windsurf)
The Devin Local customizations page covers rules, skills, plugins, MCP servers, and hooks. Rules enter the agent's context at the start of every session. (Devin Local customizations)
Its filename contract is explicit: “AGENTS.md, AGENTS.local.md (for personal rules you keep out of version control), and AGENT.md are all read as always-on rules.” (Devin Local customizations)
Dev containers
A development container defines the environment used before deployment. (Dev Containers overview) devcontainer.json supplies its metadata and settings. containerEnv applies to the container; remoteEnv applies to the supporting tool or its subprocesses, not the whole container. (devcontainer.json reference)
features selects Dev Container Features and options. postCreateCommand finalizes creation-time setup; cloud services can use it with user-specific secrets and permissions. (devcontainer.json reference)
Anthropic describes dev containers as isolated environments shared across a team and directs variables needed by every Claude Code session in the container to containerEnv. (Claude Code dev containers)
Where should secrets go?
Read each delivery mechanism separately. A secret store does not imply that the agent process cannot receive the secret.
- Codex: “Don’t store secrets in memories.” (Codex memories) Current cloud network secrets give programs placeholders; a proxy substitutes credentials for allowed destinations without putting the raw credential in a local process or file. (Codex cloud environments)
- Copilot: memories containing detected secrets are rejected, and the agent is instructed not to store sensitive or confidential information. (Copilot Memory) Configured secrets become environment variables, except
COPILOT_MCP_entries reserved for MCP servers. Secret values are masked in session logs. (Copilot secrets and variables) - Claude Code: shared cloud environment variables are readable by environment users; Anthropic warns against putting secrets there. Network secrets, a feature of Anthropic-hosted environments, let Claude call an API without seeing its key. (Claude Code cloud environments) Its dev-container guidance says to avoid mounting host SSH or cloud credentials and prefer repository-scoped or short-lived tokens. (Claude Code dev containers)
- Cursor: cloud secrets become environment variables, and environment-scoped secrets apply to every repository in that environment. (Cursor Cloud Agents setup) Snapshots can retain included
.env.localfiles; Cursor recommends the Secrets tab for security and management. Its Cloudflare Access instructions put service-token values in Cursor Secrets. (Cursor Cloud Agents setup)
For Mnemoverse, our memory rules include the line “Never store passwords, API keys, payment data, MFA codes, government IDs, or health records.” (our agent-memory page) See also a credential the LLM never sees and why agents ask about secrets.
What to check before you switch environments
Use this as a review checklist, not a claim about automatic transfer:
- List the parameters the work depends on. Assign each to one of three homes: a rule in the instruction file, a non-secret value in environment configuration, or a secret in the secret store. Memory is not one of the three homes.
- Commit required working rules to the instruction file. Check the destination client's loading conditions.
- Declare non-secret parameters and preparation steps in the relevant configuration:
settings.jsonunderenv(a Claude Code cloud session reads only some settings, so check the cloud environment's own variables there),config.toml,environment.json,copilot-setup-steps.yml, ordevcontainer.json. - For a local managed Codex worktree, list needed ignored files in
.worktreeinclude. (Codex Git worktrees) - Keep secrets in the destination environment's secret store. Review who and what can receive them.
- Start a fresh session in the destination. Ask the agent to name each required non-secret parameter and its source. For secrets, ask it to identify the delivery mechanism, not print the value.
The last step is a check, not a promise: it does not guarantee that an agent will report its sources correctly or that the environment is fully configured.
What this page does not claim
Each client is described in its own documentation on the date in Sources; these pages change often, and several have moved to new addresses. “Not documented on the pages read” means the pages read, not that the feature does not exist. This page describes documentation read, not behaviour tested, and reports no performance figures for any tool. The Medium article is a practitioner's account, not vendor documentation.
Common questions
How to stop LLM agents from losing critical setup parameters when switching dev environments?
Put each kind of setup information in a layer that travels to the new environment. This page's advice, not a vendor rule: commit working rules to an instruction file, declare parameters in the destination environment's configuration, and keep secrets in that environment's secret store. Do not leave a required rule only in memory, which is the advice of the Codex memories page. In the new environment, start a fresh session and ask the agent to name each parameter and where it came from.
How can I keep my developer environment choices synced across multiple AI programming assistants?
Share one committed AGENTS.md, subject to each client's own condition, and keep the actual environment choices in each client's own environment files. Codex reads AGENTS.md files before doing any work. Cursor supports it in the project root and subdirectories, and its Cloud Agents read it. Devin Local reads it as an always-on rule. Copilot accepts the file anywhere in the repository, with the nearest one taking precedence. Gemini CLI reads another file name only when context.fileName names it. Claude Code reads it directly only from version 2.1.277 and, by default, only when no CLAUDE.md or CLAUDE.local.md exists in the working directory or above, and a setting can change this; otherwise an @AGENTS.md import in CLAUDE.md does the job.
Should environment variables go in AGENTS.md?
This page's advice is no: use AGENTS.md to explain how to get setup values, and put non-secret values in the environment's own configuration and secrets in its secret store. Cursor draws a related line for processes: long-running services go in startup commands, and AGENTS.md can hold instructions for services an agent needs only for specific tasks.
Why doesn't my .env file follow my agent into a new worktree or cloud session?
Codex gives .env as an example of a file Git intentionally ignores, and says files in .gitignore do not move with a Handoff unless Codex copies them into a local managed worktree with .worktreeinclude, which is not a general transfer between environments. Claude Code cloud sessions start from a fresh clone of the repository, so anything configured only on your own machine is not in the session.
Can agent memory hold setup parameters and secrets?
This page's advice is not to put setup parameters or secrets in memory. It is not a universal vendor rule: Gemini CLI lists "Storing frequently used aliases or system configurations." as a memory use. On secrets, Codex says "Don't store secrets in memories." and Copilot rejects memories in which a secret is detected. Our memory rules include the line "Never store passwords, API keys, payment data, MFA codes, government IDs, or health records."
Sources
Anthropic, Claude Code. Read 28 November 2026: Memory, Settings, Environment variables, Cloud environments, Dev containers.
OpenAI, Codex. Read 28 November 2026: AGENTS.md, Basic configuration, Advanced configuration, Environment variables, Configuration reference, Local environments, Git worktrees, Current cloud environments, Codex Cloud (Legacy), Memories.
Cursor. Read 28 November 2026: Rules, Cloud Agents setup.
GitHub, Copilot cloud agent. Read 28 November 2026: Repository instructions, Agent environment, Secrets and variables, Copilot Memory.
Gemini CLI. Read 28 November 2026: Context files, Configuration, Authentication, Memory.
Devin Desktop. Read 28 November 2026: Devin Local customizations.
Dev Containers specification. Read 28 November 2026: Overview, JSON reference.
Mnemoverse, our documentation. Read 28 November 2026: Agent-memory rules, MCP server configuration, Sharing memory across applications.
Practitioner account, Saravanan Natarajan. Read through the author's RSS feed on 28 November 2026: Part Two: Context Engineering: From a Local PoC to the Cloud Integration.
Related
- CLAUDE.md, AGENTS.md, and Cursor rules
- Which tools support AGENTS.md?
- A credential the LLM never sees
- Agent memory across ChatGPT and coding tools
- Claude Code persistent memory
- MCP servers that share state across IDEs
- Agent-memory instructions
Who wrote this. Mnemoverse publishes this page and is one of the rows in its table, so we are an interested party. Every behaviour is quoted or paraphrased from the vendor's own documentation on the date in Sources, ours included. Send corrections through contact.
Edward Izgorodin · Mnemoverse · 29 November 2026
Sources were read on 28 November 2026; the page describes them as of that date.
