Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions content/manuals/ai/sandboxes/agents/claude-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ prompt from a file with `-- "$(cat prompt.txt)"`.
To create a [mountless sandbox](../usage.md#choose-a-workspace), use
`sbx create` without a workspace path, then attach by name.

## Preserve conversations after sandbox removal

To keep Claude Code conversations when you remove and recreate a local sandbox,
add its session mixin when creating the sandbox. See
[Preserve Claude Code and Codex conversations](../customize/use-kits.md#preserve-claude-code-and-codex-conversations)
for commands and steps to resume a conversation.

## Authentication

For the default Anthropic models, Claude Code requires either an Anthropic
Expand Down
7 changes: 7 additions & 0 deletions content/manuals/ai/sandboxes/agents/codex.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ $ sbx run codex
To create a [mountless sandbox](../usage.md#choose-a-workspace), use
`sbx create` without a workspace path, then attach by name.

## Preserve conversations after sandbox removal

To keep Codex conversations when you remove and recreate a local sandbox,
add its session mixin when creating the sandbox. See
[Preserve Claude Code and Codex conversations](../customize/use-kits.md#preserve-claude-code-and-codex-conversations)
for commands and steps to resume a conversation.

## Authentication

For the default OpenAI models, `sbx run codex` prompts you to authenticate on
Expand Down
37 changes: 37 additions & 0 deletions content/manuals/ai/sandboxes/customize/use-kits.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,43 @@ discarded when the sandbox stops.
For how to preserve storage when changing a kit, see
[Configure the volume](author/patterns.md#configure-the-volume).

### Preserve Claude Code and Codex conversations

For local sandboxes, add a session mixin to keep conversations after removing
and recreating the sandbox, including when you use `--rm`. Choose the mixin
that matches your agent:

{{< tabs >}}
{{< tab name="Claude Code" >}}

```console
$ sbx run --rm docker.io/docker/sbx-kit-claude:2.1.267 \
--kit sbx/claude-sessions:1.0.0
```

{{< /tab >}}
{{< tab name="Codex" >}}

```console
$ sbx run --rm docker.io/docker/sbx-kit-codex:0.155.1 \
--kit sbx/codex-sessions:1.0.0
```

{{< /tab >}}
{{< /tabs >}}

Start a conversation, then enter `/exit`. Run the same command again from the
same project directory and enter `/resume` inside the agent to select the saved
conversation.

The mixins use host directories managed by Docker Sandboxes to store session
state. They don't share conversations with Claude Code or Codex running directly
on your host. Include the session mixin each time you recreate the sandbox.

To choose a host directory, see [Choose directories for kit host mounts](#choose-directories-for-kit-host-mounts).
The sandbox mount paths are `/home/agent/claude-history` for Claude Code and
`/home/agent/codex-history` for Codex.

## Restrict kit sources

[`kit.allowedSources`](../configuration/settings.md#kitallowedsources) controls
Expand Down