Environments
An environment is one user’s persistent development machine for one project. It owns the writable files, repository checkouts, private tool home, runtime receipt, previews and remote-access grants. Several terminals may run inside the same environment without duplicating the files.
Open an environment
In the app:
Projects → project title → environment title
The environment view opens on Terminals. Use the environment navigation to switch between Terminals, Files and Git. These are three views of one environment, not separate copies.
The Terminals view keeps the terminal list near the top of the working area. When the environment has connected services, the compact Connected services summary shows their count; select View services to inspect the complete list and open the usage guide for an individual service. Pending Needs your attention signals are arranged as responsive cards, with several on one row when the available width permits. Selecting a terminal name opens that terminal, while Clear dismisses only that signal.
Copy terminal history
The terminal footer has two separate history controls:
- Scroll terminal output enters tmux scroll mode for navigating and searching the live terminal.
- Open copyable terminal history temporarily replaces the visible terminal surface with a copyable snapshot inside the same movable and resizable terminal window. The live xterm remains mounted underneath and continues to receive output.
An upward mouse-wheel or trackpad gesture over ordinary live shell output opens
the copyable snapshot directly and starts slightly above its latest line. The
gesture is not forwarded to tmux first, so the terminal does not redraw retained
history only to return to the current screen. A full-screen terminal program
instead receives the wheel gesture and controls its own history. When such a
program has not enabled terminal mouse reporting, bounded wheel movement is sent
as Page Up or Page Down instead of the arrow keys that browse prompt history.
That distinction matters for Codex, Claude Code and similar programs whose
complete conversation is held inside the application rather than tmux. Explicit
tmux scroll mode continues to own its own wheel navigation.
In the snapshot, select exactly the text you need and use the browser’s normal
copy command. Ctrl+A (or Cmd+A) while the history panel has focus selects
the complete captured snapshot, including lines outside the visible part;
Ctrl+C or Cmd+C copies the selection. Use Capture latest history to
replace the snapshot with a newer one, or Return to live terminal to reveal
xterm again. Terminal colour and control codes are removed from the copyable
plain text.
The snapshot is bounded, short-lived and does not alter the live terminal or its tmux scroll position. It represents the moment it was opened; use the refresh button to capture newer output. Only the terminal owner or a user with control access can open retained history. A read-only terminal share does not expose output retained before the share was granted.
Environment settings
In the app:
Projects → project title → environment title → Settings
Settings are grouped by purpose. They show both editable choices and the locked receipt that explains what this environment was created with. A later project revision is not applied silently; review and accept an update when it is offered.
Memory, processes and disk limits
In the app:
Environment → Settings → Storage & runtime
The receipt separates five limits:
- Memory is the hard container limit shared by applications, build tools and memory-backed temporary files.
- Processes and threads is the hard Linux task limit shared by all terminals and programs in the environment. Linux counts threads too, so a Java server may use many tasks even when it is one application process.
- Persistent working files covers
/workspace. Its current measured use is shown next to the selected budget and its files survive Stop and Start. - Temporary home/cache covers the private tool home for installations that use an ephemeral hard-limited home.
- Temporary process space covers
/tmpand/runand is cleared when the runtime stops.
Choose these values when creating an environment. The form shows the maximum allowed by the workspace and installation policy. To change an existing environment, stop it completely, open Storage & runtime, enter the new values and select Save limits. The new receipt is used on the next Start. Code as Usual does not resize a running container underneath its processes or terminals.
For a running environment, the header and this settings panel show the current task count against the recorded limit. The display warns at 70% and becomes critical at 90%. If the runtime provider cannot read a current value, it says unavailable rather than showing a misleading zero. The counter is measured from the environment container; it is not the host’s process count.
The persistent working-files value cannot be lowered below the files currently retained. Saving also fails if the environment starts, is handed over, loses project access or begins a runtime update while the new values are being checked. No files are deleted when a limit is changed.
If a shell or agent reports Cannot fork or Resource temporarily unavailable, stop unneeded application servers or agents. If those programs
are needed together, stop the environment and raise Processes and threads
within the maximum allowed by the workspace.
Discover installed tools
Every environment image contains an immutable package overview and one guide per selected package. From a terminal, use:
cau-env describe
cau-env packages
cau-env guide <package-key>
cau-env services
cau-env service <service-id>
cau-env json
The guides combine package-authored usage instructions with facts generated from the exact package plan used for this image: installed paths, exposed commands and environment variables. A package with no authored instructions still has those generated facts.
cau-env services reflects the services connected to the running environment,
not every service published in the workspace. Its first column is the service
ID accepted by cau-env service. The service guide lists all available
environment-variable names and adapter-authored instructions without printing
secret values.
AI agents run in the same environment and can read the same world-readable
files. CODE_AS_USUAL_AGENT_CONTEXT points to the overview,
CODE_AS_USUAL_PACKAGE_GUIDES to the guide directory and
CODE_AS_USUAL_SERVICE_GUIDES to the runtime directory for connected services,
CODE_AS_USUAL_ENVIRONMENT_MANIFEST to the machine-readable index. An agent
does not necessarily inspect arbitrary files automatically, so a generic first
instruction such as “read $CODE_AS_USUAL_AGENT_CONTEXT before changing the
tool setup” may still be needed unless that agent product provides a supported
startup-instruction mechanism. Code as Usual does not overwrite project-owned
AGENTS.md, CLAUDE.md or similar files, and notification hooks do not inject
prompts.
Stop, start and delete
- Stop ends running processes and active connections while preserving persistent files, repositories and configured persistent tool homes.
- Start restores the environment from those durable files and the recorded runtime configuration.
- Delete is a data operation. The confirmation must identify repository changes and non-repository files that will be lost.
Stopping is confirmed against the exact registered runtime. If cleanup is interrupted, the environment may show Stopping and offer Retry stopping. Use that action instead of assuming the container is gone. Code as Usual does not change the environment to Stopped until the provider confirms it, and it does not let an update proceed while the runtime state is uncertain.
A failed environment can be deleted only after any partial runtime has been safely released. The settings dialog says whether deletion is available and loads the retained-file and repository counts before enabling the permanent action. Deletion removes the persistent working files and private home; it is not the same operation as Stop.
Stopping one terminal does not stop the environment or its other terminals. Stopping the environment closes all of its terminal, preview and remote IDE connections.
After a server restart
Code as Usual does not automatically start every environment when the server or web service starts. Startup reconciliation removes the old recorded Podman stack for an environment that was running before the interruption and then shows the retained environment as Stopped. Select Start when you need it. Code as Usual recreates its container, private network, gateways and connected-service relays from the recorded runtime configuration.
Persistent workspace files, repositories and configured persistent tool homes remain available. Processes, terminal sessions, in-memory state and temporary files do not survive a server restart. If Code as Usual cannot confirm removal of the old provider stack, it shows the environment as Missing and offers Retry stopping instead of risking two runtime generations against the same files. This failure does not prevent the application or other environments from becoming available.
Apply a newer project runtime
In the app:
Environment → Settings → General → Update environment…
The action appears when the project has a newer active combination of packages, services or network policy. Confirming it stops the terminal processes and starts the same persistent working files and private home with the current project runtime. It does not alter repository branches or working files.
An update runs as a durable background operation. The page reports whether it is stopping the current runtime, starting the requested runtime or restoring the previous one. Provider and network delays do not impose a fixed failure deadline: Code as Usual retains the recorded phase and retries instead of leaving the environment in an unusable intermediate state. If the web service restarts, it resumes the recorded operation.
While the operation is active, use Stop update and restore previous runtime to cancel the requested change. Cancellation does not simply clear a status; Code as Usual continues until the previous immutable runtime is discovered and verified as running. Ordinary start and stop actions remain unavailable while that reconciliation owns the environment.
The operation has two completed outcomes. Either the requested runtime is verified as running, or the update fails or is cancelled and the previous runtime is verified as restored. Persistent working files and the private home remain the same in both cases.
Branches and multiple environments
Create separate environments when you need independent writable checkouts,
for example one environment on main and another on a feature branch. Open
several terminals inside one environment when the processes should operate on
the same files.