Skip to content

Support global container tag override for API-key-scoped tenancy #29

@ramarivera

Description

@ramarivera

Problem

When using an API key scoped to a specific container (e.g., "ramiro"), the plugin's getContainerTag() function auto-derives a hash-based tag (claudecode_project_<sha256>) that doesn't match the API key's scope, causing 400 Invalid container tag errors on every operation.

The only workaround is creating .claude/.supermemory-claude/config.json with personalContainerTag in every single project. This is tedious and easy to forget — the first memory save in any new project always fails until you remember to create the config.

Current resolution order

project config (.claude/.supermemory-claude/config.json) → git-path hash fallback

Proposed resolution order

project config → environment variable → global settings file → git-path hash fallback

Specifically:

  1. Project config.claude/.supermemory-claude/config.jsonpersonalContainerTag (existing, unchanged)
  2. Environment variable — e.g., SUPERMEMORY_CONTAINER_TAG or SUPERMEMORY_PERSONAL_CONTAINER_TAG (new)
  3. Global settings file~/.supermemory-claude/settings.jsonpersonalContainerTag (new)
  4. Git-path hashclaudecode_project_${sha256(basePath)} (existing fallback)

The code change in container-tag.js would be minimal:

function getContainerTag(cwd) {
  const projectConfig = loadProjectConfig(cwd);
  if (projectConfig?.personalContainerTag) return projectConfig.personalContainerTag;
  
  // NEW: check env var
  if (process.env.SUPERMEMORY_CONTAINER_TAG) return process.env.SUPERMEMORY_CONTAINER_TAG;
  
  // NEW: check global settings
  const globalSettings = loadGlobalSettings();
  if (globalSettings?.personalContainerTag) return globalSettings.personalContainerTag;
  
  // Existing fallback
  const basePath = getGitRoot(cwd) || cwd;
  return `claudecode_project_${sha256(basePath)}`;
}

Cross-integration concern: unified container tag support

This isn't just a Claude Code plugin issue — Supermemory has integrations across multiple platforms:

  • claude-supermemory (Claude Code plugin)
  • supermemory-mcp (MCP server — used by Claude Desktop, Cursor, etc.)
  • opencode-supermemory (OpenCode plugin)
  • openclaw-supermemory (OpenClaw / Clawdbot)
  • Notion integration
  • Any future integrations

All of these would benefit from a consistent, cross-integration container tag configuration mechanism. When an API key is scoped to a container (e.g., for multi-tenancy or personal branding), every integration should respect the same tag without requiring per-integration, per-project configuration.

Recommendation

Consider standardizing across all integrations:

  1. SUPERMEMORY_CONTAINER_TAG environment variable — works everywhere, set once in shell profile, respected by all integrations
  2. Global config file (e.g., ~/.config/supermemory/config.json or ~/.supermemory/config.json) — a single file that all integrations read for shared settings like container tag, API URL, debug mode
  3. Per-integration overrides remain available for cases where you genuinely want different containers per tool

This enables multi-tenancy use cases like:

  • Personal vs. work memory separation via scoped API keys
  • Team-shared memory pools where all team members' tools use the same container
  • Custom container naming instead of opaque hashes

Environment

  • claude-supermemory plugin v0.0.2
  • API key scoped to container "ramiro"
  • macOS, multiple projects

🤖 This content was generated with AI assistance using Claude Opus 4.6.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions