HUB
Sign inSign up

joaopestana/claude-extended:latest

Machine learning & AI
Manifest digest

sha256:6c1aef21f81ddb5f50a86fc51133bdebef11df4cbbfd97f3dc2c8905955a0b57

Last pushed

about 14 hours by joaopestana

Type

Sandbox Kit

Manifest digest

sha256:6c1aef21f81ddb5f50a86fc51133bdebef11df4cbbfd97f3dc2c8905955a0b57

yaml
schemaVersion: "3"
licenses:
    - Apache-2.0
    - SEE LICENSE IN https://github.com/anthropics/claude-code/blob/main/LICENSE.md
kind: workload
provides:
    - [email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/ca-certificates-java@20240118
    - deb/ca-certificates@20250419
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/iputils-ping@20240905
    - deb/[email protected]
    - deb/[email protected]
    - deb/less@668
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
    - deb/[email protected]
capabilities:
    - type: com.docker.sandbox/network-policy@1
      config:
        runtime:
            allow:
                - api.anthropic.com:443
                - platform.claude.com:443
                - downloads.claude.ai:443
                - claude.com:443
                - mcp-proxy.anthropic.com:443
                - bridge.claudeusercontent.com:443
                - api.github.com
    - type: com.docker.sandbox/sbx@1
    - type: com.docker.sandbox/credential@1
      name: Anthropic access
      optional: true
      config:
        apiKey:
            inject:
                - domain: api.anthropic.com
                  format: '%s'
                  header: x-api-key
                - domain: mcp-proxy.anthropic.com
                  format: '%s'
                  header: x-api-key
            name: ANTHROPIC_API_KEY
        oauth:
            credentialFile:
                path: ~/.claude/.credentials.json
                structure:
                    claudeAiOauth:
                        accessToken: '{{.AccessToken}}'
                        expiresAt: '{{.ExpiresAt}}'
                        refreshToken: '{{.RefreshToken}}'
                        scopes: '{{.Scopes}}'
                    primaryApiKey: '{{.PrimaryApiKey}}'
            sentinels:
                accessToken: sk-ant-oat01-proxy-managed
                refreshToken: sk-ant-ort01-proxy-managed
            tokenEndpoint:
                host: platform.claude.com
                path: /v1/oauth/token
        phase: runtime
        service: anthropic
      description: Anthropic API access (API key or claude.ai OAuth)
    - type: com.docker.sandbox/agent-interactive-sessions@1
      optional: true
      config:
        continue:
            - --continue
        prompt:
            - --
            - '{{.Prompt}}'
        resume:
            - --resume
            - '{{.SessionID}}'
        sessionPicker:
            - --resume
      description: Open claude's terminal UI on a chosen session
    - type: com.docker.sandbox/agent-skills@1
      optional: true
      config:
        path: /home/agent/.claude/skills
    - type: com.docker.sandbox/agent-context@2
      optional: true
      config:
        content: |
            ## Claude Code: Environment Persistence

            The `CLAUDE_ENV_FILE` environment variable is set to `/etc/sandbox-persistent.sh`.

            According to [Claude Code Documentation](https://code.claude.com/docs/en/settings#bash-tool-behavior):

            > **CLAUDE_ENV_FILE**
            >
            > If set, this file will be sourced before each Bash command execution. This allows environment variables to persist across multiple Bash tool invocations.

            This means `/etc/sandbox-persistent.sh` is sourced before every Bash tool call you make. Any `export` statements you append to this file will be available in all subsequent commands without needing a login shell.

            ### Shell Completions Must NOT Be in CLAUDE_ENV_FILE

            **NEVER add shell completion scripts to `/etc/sandbox-persistent.sh`.**

            `CLAUDE_ENV_FILE` is sourced **before every single bash command execution**, not just during shell initialization. Completion scripts rely on special variables (`COMP_WORDS`, `COMP_CWORD`, `COMPREPLY`) that only exist during tab-completion contexts.

            #### WRONG - Will Break Bash

            ```bash
            # DO NOT ADD THESE TO /etc/sandbox-persistent.sh
            [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
            [[ -s "$SDKMAN_DIR/etc/bash_completion.sh" ]] && source "$SDKMAN_DIR/etc/bash_completion.sh"
            ```

            #### CORRECT - Only Load Core Functionality

            ```bash
            # ONLY add the main initialization scripts
            export NVM_DIR="$HOME/.nvm"
            [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"

            export SDKMAN_DIR="$HOME/.sdkman"
            [[ -s "$SDKMAN_DIR/bin/sdkman-init.sh" ]] && source "$SDKMAN_DIR/bin/sdkman-init.sh"
            ```

            #### Symptoms of Broken Shell

            When completion scripts are incorrectly added:

            - All bash commands return no output (silent failure)
            - `echo`, `pwd`, and other basic commands produce no results
            - The bash tool becomes completely unusable

            #### Solution

            If you accidentally added completion scripts and broke the shell:

            1. Remove the completion line(s) from `/etc/sandbox-persistent.sh`
            2. Exit and restart the Claude Code session
            3. Verify with `echo "test"` that bash works again
        directory: /home/agent/.claude
        filename: CLAUDE.md
    - type: com.docker.sandbox/git-identity@1
      optional: true
    - type: com.docker.sandbox/ssh-agent@1
      config:
        phase: runtime
        sign:
            - git
        unrestricted: false
    - type: com.docker.sandbox/agent-context@2
      optional: true
      config:
        content: |
            ## Git commit signing

            This sandbox signs git commits with your host's SSH key, forwarded over
            the sandbox's SSH agent relay. Use `git log --show-signature` to verify
            signatures on existing commits.

            A host agent often forwards more than one key. When the repository's
            remote is on github.com and the `gh` CLI is authenticated, the agent's
            keys are cross-checked against the signing keys registered on the
            committer's GitHub account, so the commit shows as Verified there and
            not only locally. On any other host, or without `gh`, the first key the
            agent offers is used.

            If no agent key is registered there, the commit still signs but shows
            Unverified on GitHub. Git hides that warning because it only surfaces
            the key command's stderr when the command fails; run
            `/bin/sh ~/.config/git/ssh-signing-key-command` directly to see it.

            Automatic signing is scoped to repositories that **have at least one
            remote**. A repository is exempt only for as long as it has no remote:
            a test fixture that runs `git init` and stops there commits unsigned,
            but one that goes on to `git remote add` is signed like any other
            repository. `git commit -S` still signs anywhere.

            The scoping needs git >= 2.36. On an older git the install falls back
            to signing machine-wide and says so on stderr, and then nothing is
            exempt — if `git init` fixtures are failing to commit, check
            `git config --system --get commit.gpgSign` before believing the
            paragraph above.

            ### When signing fails

            The key is resolved at signing time from the forwarded agent, so a
            signing failure almost always means the agent is unreachable or holds
            no usable key, not that a config value is missing. Git reports it as:

                warning: gpg.ssh.defaultKeyCommand failed: [git-ssh-sign] ...
                error: user.signingKey needs to be set for ssh signing

            **Ignore the `user.signingKey` line** — this kit deliberately leaves
            `user.signingKey` unset. Read the `[git-ssh-sign]` lines above it; they
            name the actual state and the recovery.

            Diagnose in this order:

            ```console
            echo "$SSH_AUTH_SOCK"      # always set inside a sandbox; proves nothing
            test -S "$SSH_AUTH_SOCK"   # the real check — is the relay socket there?
            ssh-add -l                 # 0 = keys; 1 = connected, no usable key; 2 = no connection
            ```

            Recovery, all of it **on the host**, not in the sandbox:

            1. Check that forwarding is switched on at all:

               ```console
               sbx settings get ssh.agentForwardingEnabled   # must be true
               sbx settings set ssh.agentForwardingEnabled true
               ```

               Do this first. While it is `false` the forwarded agent is never
               wired up, so `ssh-add` inside the sandbox reports a broken agent
               (exit 1 or 2, depending on how far the connection gets) rather than
               a disabled feature — and no amount of reloading keys or restarting
               the sandbox changes it. The setting defaults to `true`, so a
               `false` means it was turned off explicitly, e.g. by declining agent
               forwarding during `sbx setup`.

            2. Make sure the host agent actually holds the key:
               `ssh-add -l`, and `ssh-add ~/.ssh/id_ed25519` if it does not.
            3. If step 1 changed the setting, restart the daemon:
               `sbx daemon restart`. Changes to `ssh.agentForwardingEnabled` and
               `ssh.agentSocketPath` only reach sandboxes that already exist once
               the daemon has restarted.
            4. From that same shell — the daemon adopts the requesting client's
               `SSH_AUTH_SOCK` — restart this sandbox's container so the relay
               comes back:

               ```console
               sbx stop <sandbox-name>
               sbx run --name <sandbox-name>
               ```

               Stop-then-run is the supported restart cycle; there is no
               `sbx start`. Substitute the sandbox's own name: `hostname` prints
               it *inside* the sandbox, but `$SANDBOX_NAME` does not exist in a
               host shell, so type the literal name there.

            To make one commit without a signature while you sort that out:

            ```console
            git -c commit.gpgsign=false commit -m "..."
            ```
    - type: com.docker.sandbox/agent-sessions@1
      config:
        continue:
            - --continue
        list:
            - node
            - /opt/claude-sessions/interactive-sessions.mjs
        prompt:
            - -p
            - --
            - '{{.Prompt}}'
        resume:
            - --resume
            - '{{.SessionID}}'
      description: Drive claude sessions programmatically
    - type: com.docker.sandbox/lifecycle@1
      config:
        install:
            - command:
                - sh
                - -c
                - |
                  set -e
                  ws="${WORKSPACE_DIR:-/}"
                  esc=$(printf '%s' "$ws" | sed 's/\\/\\\\/g; s/"/\\"/g; s/\t/\\t/g; s/\r/\\r/g')
                  projects="\"/\": { \"hasTrustDialogAccepted\": true }"
                  [ "$ws" = "/" ] || projects="$projects, \"$esc\": { \"hasTrustDialogAccepted\": true }"
                  printf '%s\n' "{
                    \"bypassPermissionsModeAccepted\": true,
                    \"hasCompletedOnboarding\": true,
                    \"hasSeenAutoDefaultNudge\": true,
                    \"projects\": { $projects }
                  }" > /home/agent/.claude.json
                  chown agent:agent /home/agent/.claude.json
              description: Seed Claude bypass/trust flags (root; overwrites image-shipped file)
              env:
                - WORKSPACE_DIR
              user: "0"
            - command:
                - sh
                - -c
                - mkdir -p /home/agent/.claude && chown agent:agent /home/agent/.claude
              description: Ensure ~/.claude is agent-owned before settings seed
              user: "0"
            - command:
                - sh
                - -c
                - |
                  set -e
                  HELPER=''
                  if [ "${SBX_CRED_ANTHROPIC_MODE:-none}" != none ]; then
                    HELPER='  "apiKeyHelper": "echo proxy-managed",
                  '
                  fi
                  # Model selection from the create-phase args. The args'
                  # patterns admit no quote or backslash, so the expanded
                  # value is safe inside the JSON string. effortLevel accepts
                  # low/medium/high/xhigh; max and auto persist only through
                  # CLAUDE_CODE_EFFORT_LEVEL (settings.json rejects them).
                  model=''
                  effort=''
                  MODEL=''
                  EFFORT=''
                  ENV_BLOCK=''
                  [ -z "$model" ] || MODEL="  \"model\": \"$model\",
                  "
                  case "$effort" in
                    '') ;;
                    max|auto)
                      ENV_BLOCK="  \"env\": { \"CLAUDE_CODE_EFFORT_LEVEL\": \"$effort\" },
                  "
                      ;;
                    *)
                      EFFORT="  \"effortLevel\": \"$effort\",
                  "
                      ;;
                  esac
                  # Lifecycle hooks for Narwhal (see /usr/local/bin/sbx-claude-hook):
                  # Stop and StopFailure report a finished turn, Notification the
                  # moments Claude waits on the user, UserPromptSubmit the prompt
                  # that names the conversation (Claude Code lists sessions by id
                  # only). The script never fails, never writes stdout and runs
                  # async, so a session without the desktop app sees no delay and
                  # no hook error.
                  HOOK='{ "type": "command", "command": "/usr/local/bin/sbx-claude-hook claude", "timeout": 10, "async": true }'
                  HOOKS="  \"hooks\": {
                      \"Stop\": [ { \"hooks\": [ $HOOK ] } ],
                      \"StopFailure\": [ { \"hooks\": [ $HOOK ] } ],
                      \"UserPromptSubmit\": [ { \"hooks\": [ $HOOK ] } ],
                      \"Notification\": [ { \"matcher\": \"permission_prompt|idle_prompt|elicitation_dialog|elicitation_url_dialog|agent_needs_input\", \"hooks\": [ $HOOK ] } ]
                    },
                  "
                  # The statusLine command is the only place Claude Code exposes
                  # the live session (model, context window, cost, lines changed);
                  # sbx-agent-hook forwards it to Narwhal's status bar and prints
                  # nothing, so no status line is drawn in the terminal. A mixin that
                  # sets its own statusLine (e.g. claude-sbx-statusline) replaces
                  # this one and the app's session view goes quiet for that sandbox.
                  STATUSLINE="  \"statusLine\": { \"type\": \"command\", \"command\": \"/usr/local/bin/sbx-claude-hook claude-status\" },
                  "
                  printf '%s' "{
                    \"themeId\": 1,
                    \"alwaysThinkingEnabled\": true,
                  ${HELPER}${MODEL}${EFFORT}${ENV_BLOCK}${HOOKS}${STATUSLINE}  \"permissions\": { \"defaultMode\": \"bypassPermissions\" },
                    \"bypassPermissionsModeAccepted\": true,
                    \"skipDangerousModePermissionPrompt\": true
                  }
                  " > /home/agent/.claude/settings.json
              description: Seed Claude settings.json from the surfaced auth mode
              env:
                - SBX_CRED_ANTHROPIC_MODE
              user: agent
            - command:
                - sh
                - -c
                - |
                  set -e
                  [ -n "$MCP_GATEWAY_URL" ] || exit 0
                  export PATH="$HOME/.local/bin:$HOME/.claude/local:$PATH"
                  claude mcp add mcp-gateway "$MCP_GATEWAY_URL" \
                    --transport http \
                    --scope user \
                    --header "Authorization: Bearer $MCP_SENTINEL_TOKEN_NAME" || true
              description: Register the sandbox MCP gateway (install-time, race-free)
              env:
                - MCP_GATEWAY_URL
                - MCP_SENTINEL_TOKEN_NAME
              user: agent
            - command:
                - sh
                - -c
                - |
                  set -e
                  mkdir -p /home/agent/.claude
                  f=/home/agent/.claude/settings.json
                  [ -f "$f" ] || echo '{}' > "$f"
                  # Set only the statusLine key (any existing one is replaced by design);
                  # the jq merge leaves all other settings untouched. Temp file lives in the
                  # same dir as $f so the mv below is an atomic rename, not a cross-fs copy.
                  tmp=$(mktemp -p /home/agent/.claude)
                  jq '.statusLine = {type: "command", command: "~/.claude/statusline.sh"}' "$f" > "$tmp"
                  mv "$tmp" "$f"
                  # Shipped files arrive 0644; unexecutable, it renders nothing and no error.
                  chmod +x /home/agent/.claude/statusline.sh
                  # Enumerated, not recursive: ~/.claude holds runtime-managed content
                  # this kit doesn't own, so `chown -R` on the parent would take
                  # ownership of paths outside the kit's control.
                  chown agent:agent /home/agent/.claude "$f" /home/agent/.claude/statusline.sh
              description: Set the statusLine key in ~/.claude/settings.json to ~/.claude/statusline.sh (jq merge, so all other keys are preserved; any existing statusLine is replaced by design) and make the script executable
              user: "0"
            - command:
                - sh
                - -c
                - |
                  set -e

                  # Signing *machinery* stays machine-wide: it is inert unless something
                  # asks for a signature, and keeping it here means `git commit -S` works
                  # in any repository in the sandbox.
                  git config --system gpg.format ssh
                  # The key command keeps its explicit /bin/sh invocation from v2,
                  # whose file layers could not carry executable bits. The native
                  # overlay ships mode 0755, so the command is also executable, but
                  # keeping the interpreter explicit preserves the existing contract.
                  git config --system gpg.ssh.defaultKeyCommand '/bin/sh /home/agent/.config/git/ssh-signing-key-command'
                  git config --system gpg.ssh.allowedSignersFile /home/agent/.config/git/allowed_signers

                  # user.signingKey MUST stay unset: git only runs
                  # gpg.ssh.defaultKeyCommand when it is empty. Setting it to any value
                  # (even a placeholder) disables dynamic key resolution entirely.
                  git config --system --unset-all user.signingKey || true

                  # Signing *policy* is scoped, not machine-wide. Setting
                  # commit.gpgSign=true in /etc/gitconfig makes every `git commit` in the
                  # sandbox depend on a live SSH agent — including throwaway repositories
                  # created by test suites that have nothing to do with the user's work.
                  # When the forwarded agent goes away, those all fail too.
                  mkdir -p /etc/git
                  cat > /etc/git/signing-enabled.inc <<'INC'
                  # Included by /etc/gitconfig for repositories with a remote.
                  # See the git-ssh-sign kit.
                  [commit]
                      gpgSign = true
                  [tag]
                      gpgSign = true
                  INC
                  chmod 0644 /etc/git/signing-enabled.inc

                  # Clear anything an older version of this kit left machine-wide, so a
                  # re-install converges rather than layering.
                  git config --system --unset-all commit.gpgSign || true
                  git config --system --unset-all tag.gpgSign || true
                  git config --system --unset-all 'includeIf.hasconfig:remote.*.url:**.path' || true

                  # `includeIf "hasconfig:remote.*.url:**"` needs git >= 2.36. Probe for
                  # it rather than parsing a version string: build a throwaway repo with
                  # a remote and see whether the include actually fires. Note that `**`
                  # is only a cross-slash wildcard when it is a whole path component --
                  # `[email protected]:**` does NOT match `[email protected]:org/repo.git`, so
                  # a bare `**` ("has any remote at all") is the pattern to use here.
                  probe=$(mktemp -d)
                  git init -q "$probe"
                  git -C "$probe" remote add origin https://example.invalid/probe.git
                  printf '[commit]\n\tgpgSign = true\n' > "$probe/inc"
                  printf '[includeIf "hasconfig:remote.*.url:**"]\n\tpath = %s/inc\n' "$probe" > "$probe/sys"
                  supported=$(GIT_CONFIG_SYSTEM="$probe/sys" GIT_CONFIG_GLOBAL=/dev/null \
                      git -C "$probe" config --get commit.gpgSign 2>/dev/null || true)
                  rm -rf "$probe"

                  if [ "$supported" = "true" ]; then
                      git config --system 'includeIf.hasconfig:remote.*.url:**.path' /etc/git/signing-enabled.inc
                  else
                      # Old git: an unrecognised includeIf keyword evaluates false, which
                      # would silently disable signing. Fail closed (sign everywhere)
                      # rather than fail open (sign nothing).
                      echo "[git-ssh-sign] git $(git --version | awk '{print $3}') lacks includeIf hasconfig; enabling signing machine-wide" >&2
                      git config --system commit.gpgSign true
                      git config --system tag.gpgSign true
                  fi

                  if [ "$(git config --system --get core.hooksPath || true)" = "/home/agent/.config/git/hooks" ]; then
                      git config --system --unset-all core.hooksPath
                  fi
              description: Configure SSH commit signing, scoped to repositories with a remote
              user: "0"
        startup:
            - background: true
              command:
                - sh
                - -c
                - command -v apt-get > /dev/null 2>&1 && (apt-get update -qq -y > /dev/null 2>&1 || true)
              description: Update apt package cache in background
              user: "0"
            - command:
                - sh
                - -c
                - |
                  set -e
                  [ -n "$MCP_GATEWAY_URL" ] || exit 0
                  export PATH="$HOME/.local/bin:$HOME/.claude/local:$PATH"
                  claude mcp add mcp-gateway "$MCP_GATEWAY_URL" \
                    --transport http \
                    --scope user \
                    --header "Authorization: Bearer $MCP_SENTINEL_TOKEN_NAME" || true
              description: Register the sandbox MCP gateway (startup fallback)
              env:
                - MCP_GATEWAY_URL
                - MCP_SENTINEL_TOKEN_NAME
              user: agent
            - command:
                - sh
                - -c
                - |
                  for f in /*/*/.config/claude-sbx/CLAUDE.md; do
                    [ -f "$f" ] || continue
                    mkdir -p /home/agent/.claude/rules
                    ln -sfn "$f" /home/agent/.claude/rules/claude-sbx.md
                  done
              description: Link a mounted ~/.config/claude-sbx/CLAUDE.md into ~/.claude/rules
              user: "1000"
            - command:
                - sh
                - -c
                - |
                  mkdir -p /home/agent/.config/git
                  printf '[url "https://github.com/"]\n\tinsteadOf = [email protected]:\n\tinsteadOf = ssh://[email protected]/\n' > /home/agent/.config/git/config
              description: Rewrite GitHub SSH remotes to HTTPS
              user: "1000"
            - command:
                - sh
                - -c
                - |
                  command -v hostname >/dev/null && exit 0
                  mkdir -p /home/agent/.local/bin
                  printf '#!/bin/sh\nexec cat /proc/sys/kernel/hostname\n' > /home/agent/.local/bin/hostname
                  chmod +x /home/agent/.local/bin/hostname
              description: Provide a hostname command for the statusline
              user: "1000"
    - type: com.docker.sandbox/agent-context@1
      config:
        contentFile: /usr/share/sandbox/kit/claude-extended/context.md
        directory: /home/agent/.claude
        filename: CLAUDE.md
kits:
    - ref: docker.io/docker/sbx-kit-claude:2.1.316
      digest: sha256:60a90df50354b1bb737b0f47bc2aad0475b36e019c65361173feace3efcf662a
    - ref: docker.io/sbx/git-ssh-sign:1.0.3
      digest: sha256:36576a25fbe166c6f50ffc7e00966d6d961425159f1d32db5b48ae1609b8cccd
    - ref: docker.io/sbx/claude-sbx-statusline:1.0.0
      digest: sha256:a9265c197e261f17eb3c3f431624dd71273385fba86737dc7f8fe51da1166fdb