Code walkthrough · Coding agents

Run Claude Code on your repository in Chalk Sandboxes

This demo shows how to deploy a reusable provisioner for a Git checkout with Claude Code, GitHub CLI, and tmux. Follow the setup, launch, and reconnect steps below; this page is a code walkthrough and does not start a live browser session.

From a fresh checkout to a session you can reconnect to

Read the three steps, then open the deployment code. A new launch creates a fresh checkout; attaching reconnects to an existing sandbox and its tmux session.

  1. 01

    Prepare a checkout

    A deployed Python function creates a sandbox, installs Claude Code and GitHub CLI, and clones your repository's main branch. Typed arguments let each developer choose the memory they need.

  2. 02

    Start Claude

    chalk sandbox start calls the provisioner and opens Claude in the checkout. Git author settings and repository trust are ready before the session starts.

  3. 03

    Come back to the same work

    tmux keeps the session running when you detach. Reattach to the same sandbox and continue with the existing terminal, files and agent context.

Built on Chalk

Chalk provides the sandbox runtime, provisioner function, resource settings, and credential substitution. The example chooses the repository, configures the developer tools, and uses tmux for reconnectable sessions.

  • Prepare a repository environment

    The provisioner creates a Chalk sandbox image with Claude Code, GitHub CLI, and tmux. It clones the chosen repository and configures the Git author before opening the agent.

  • Bind credentials to their hosts

    The sandbox receives credential placeholders for GitHub CLI and Claude authentication. Chalk substitutes real headers for the configured hosts. This development example permits general outbound traffic; it is not a network allowlist demo.

  • Keep a session available

    The example uses tmux inside the sandbox so detaching does not end Claude or remove the checkout. Reattach to the same sandbox to continue the existing work.

  • Choose resources and release them

    The provisioner accepts a memory argument and sets the sandbox CPU allocation. Detaching leaves those resources running; push the changes you need, then terminate the sandbox when finished.

Deploy your own

Configure the provisioner, then launch Claude

Start with Setup and deploy. Replace the repository and Git author identity in the provisioner, and save the GitHub and Claude credentials as Chalk secrets in the environment that runs the function.

The sample requests 2 CPUs and 16 GiB of memory on a Chalk host. The launch command calls the deployed provisioner, waits for cloning, and opens Claude in the checkout.

Detaching keeps the sandbox running. Use the attach command to continue the same work; push your changes before terminating. Use a Chalk Volume for files that must outlive a sandbox.

Coding sandbox setup guide
chalk login

# Save credentials in the environment where the function will run.
# These commands prompt for the secret values.
chalk secret set GITHUB_TOKEN
claude setup-token
chalk secret set CLAUDE_CODE_OAUTH_TOKEN

# Save the Provisioner tab as coding_agent_sandbox.py.
# Replace your-org/your-repo and the Git author identity first.
uv run --script coding_agent_sandbox.py

chalk sandbox start coding_agent_sandbox --tmux -- claude

Give coding agents a prepared workspace

Configure the repository, developer tools, and credentials your coding sessions need. Talk to an engineer about running them in Chalk Sandboxes.