Skip to main content
Change the working directory for subsequent commands in the current session.

Examples

contree cd /app
contree run -- ls           # runs in /app
contree cd /etc
contree cat os-release      # reads /etc/os-release
contree cd                  # reset to sandbox default

Help output

$ contree cd —help
usage: contree cd [-h] [path]

Change the working directory in the current session.

Sets the session’s cwd used by subsequent commands (run, ls, cat).
Relative paths are resolved against the current cwd. Without an
argument, prints the current working directory.

The path is validated against the image filesystem via the inspect API.

positional arguments:
path Target directory

options:
-h, —help show this help message and exit

for coding agents:
mutates local session cwd pointer
validates path exists in image via inspect API

agent note:
Before using this command in an automated workflow, read:
contree agent

Behavior

cd stores the path in the session state. Subsequent run, ls, cat, and cp commands resolve relative paths against it. cd without arguments resets to the sandbox’s default working directory.
cd does not validate that the path exists in the sandbox. Errors surface only when the next command uses the invalid path.