Sign inSign up

sbx/claude-mem-kit:20260828-2121f50cbf929602a6f0305feed51acb3f872980

Manifest digest

sha256:d8eca588f3de54264a19636bc4a0da4bbf38cb73364b7062b206cfaee34ebfe0

Last pushed

19 days by dockerpublicbot

Type

Sandbox Kit

Manifest digest

sha256:d8eca588f3de54264a19636bc4a0da4bbf38cb73364b7062b206cfaee34ebfe0

yaml
schemaVersion: "2"
kind: mixin
name: claude-mem
displayName: claude-mem (persistent memory)
description: 'Persistent context across Claude Code sessions: captures session activity into SQLite+FTS5, compresses with the Agent SDK, and injects relevant memory at session start. Tracks the latest claude-mem release.'
requires:
    agent: claude
agentInstructions:
    content: |
        ## claude-mem

        Persistent memory is active: session activity is captured into a local
        SQLite database under `~/.claude-mem/` and relevant context is injected
        at session start. Search past sessions with the mem-search skill or the
        mcp-search MCP tools. The worker (viewer UI + live activity stream) runs
        on port 37700 (publish with `sbx ports <sandbox> --publish 37700/tcp`
        to browse from the host). Telemetry is disabled
        (DO_NOT_TRACK=1).
permissions:
    network:
        allow:
            - registry.npmjs.org
            - '*.npmjs.org'
            - bun.sh:443
            - astral.sh:443
            - github.com:443
            - api.github.com:443
            - objects.githubusercontent.com:443
            - release-assets.githubusercontent.com:443
            - raw.githubusercontent.com:443
            - pypi.org:443
            - files.pythonhosted.org:443
            - chroma-onnx-models.s3.amazonaws.com:443
            - archive.ubuntu.com
            - security.ubuntu.com
            - ports.ubuntu.com
            - download.docker.com
ports:
    - container: 37700
      name: memory-viewer
environment:
    variables:
        CLAUDE_MEM_TELEMETRY: "0"
        CLAUDE_MEM_WORKER_HOST: 0.0.0.0
        CLAUDE_MEM_WORKER_PORT: "37700"
        DO_NOT_TRACK: "1"
setup:
    install:
        - command: npm config set proxy $HTTP_PROXY && npm config set https-proxy $HTTPS_PROXY || true
          user: "1000"
          description: Point npm at the sandbox egress proxy
        - command: npm_config_legacy_peer_deps=true npx -y claude-mem@latest install
          user: "1000"
          description: Install latest claude-mem (plugin, marketplace registration, bun deps)
    startup:
        - command:
            - sh
            - -c
            - |
              set -e
              exec > /tmp/claude-mem-reconcile.log 2>&1
              # Run unconditionally (including on early failure below) so root
              # never leaves /home/agent/.claude un-chowned.
              trap 'chown -R agent:agent /home/agent/.claude' EXIT
              S=/home/agent/.claude/settings.json
              mkdir -p /home/agent/.claude
              # Wait for the platform's own settings write to land first — at
              # create time the engine seeds this file late in the sequence and
              # overwrites whatever exists; merging before that loses our key.
              i=0
              found=0
              while [ $i -lt 60 ]; do
                if grep -q themeId "$S" 2>/dev/null; then found=1; break; fi
                sleep 1; i=$((i+1))
              done
              if [ "$found" = "1" ]; then
                echo "platform settings present after ${i}s"
              else
                echo "timed out after ${i}s waiting for platform settings; proceeding anyway"
              fi
              MODE="${SBX_CRED_ANTHROPIC_MODE:-none}" node -e '
                const fs = require("fs");
                const p = process.argv[1];
                let s = {};
                try { s = JSON.parse(fs.readFileSync(p, "utf8")); } catch {}
                const defaults = {
                  themeId: 1,
                  alwaysThinkingEnabled: true,
                  defaultMode: "bypassPermissions",
                  bypassPermissionsModeAccepted: true,
                };
                const SENTINEL = "echo proxy-managed";
                if (process.env.MODE !== "none") defaults.apiKeyHelper = SENTINEL;
                for (const k of Object.keys(defaults)) if (!(k in s)) s[k] = defaults[k];
                // Only clear our own sentinel, never a user-customized helper.
                if (process.env.MODE === "none" && s.apiKeyHelper === SENTINEL) delete s.apiKeyHelper;
                s.enabledPlugins = s.enabledPlugins || {};
                if (!("claude-mem@thedotmack" in s.enabledPlugins)) s.enabledPlugins["claude-mem@thedotmack"] = true;
                fs.writeFileSync(p, JSON.stringify(s, null, 2));
                console.log("reconciled");
              ' "$S"
          user: "0"
          description: Reconcile settings.json — ensure platform keys and claude-mem's enabledPlugins both present (ordering-immune, idempotent)