Skip to content
Merged
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
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,24 @@ export SUPERMEMORY_CC_API_KEY="sm_..."
- **supermemory-search** — Ask about past work or previous sessions, Claude searches your memories
- **supermemory-save** — Ask to save something important, Claude saves it for the team

### Shared Agents memory

Claude Code and `codex-supermemory` use one container for a repository:

- `repo_<project-name>__<remote-hash>` stores automatic capture and every explicit save.
- `sm_scope` metadata keeps personal and project memories filterable inside that container.

The hash is derived from the normalized Git remote, so clones share memory while
same-named repositories do not collide. Repositories without a remote fall back to
a local path identity. Both plugins also read the previous `user_project_*`,
`repo_<project-name>`, `claudecode_project_*`, `codex_user_*`, and
`codex_project_*` containers, so existing memories remain searchable without a
migration. Set `SUPERMEMORY_ISOLATE_WORKTREES=true` to use the worktree path
instead of the remote identity.

Explicit `repoContainerTag`/`projectContainerTag` overrides remain the canonical
write destination. Older personal/user overrides remain in the legacy read set.

## Commands

| Command | Description |
Expand Down Expand Up @@ -102,8 +120,8 @@ Per-repo overrides. Run `/supermemory:project-config` or create manually:
| ---------------------- | --------------------------- |
| `apiKey` | Project-specific API key |
| `baseUrl` | Supermemory API URL |
| `personalContainerTag` | Override personal container |
| `repoContainerTag` | Override team container tag |
| `personalContainerTag` | Legacy personal container retained for reads |
| `repoContainerTag` | Override unified project container tag |

## License

Expand Down
2 changes: 1 addition & 1 deletion latest.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "0.0.10",
"version": "0.0.11",
"updateCommand": "/plugin marketplace update supermemory-plugins\n/plugin install supermemory@supermemory-plugins\n\nOnly if you still have the old \"claude-supermemory\" plugin, also remove it:\n/plugin uninstall claude-supermemory@supermemory-plugins"
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "claude-supermemory-dev",
"version": "0.0.10",
"version": "0.0.11",
"description": "Claude code plugin by Supermemory AI",
"private": true,
"type": "commonjs",
"scripts": {
"build": "node scripts/build.js",
"clean": "rm -rf plugin/scripts/*.cjs",
"test": "node --test test/unit.mjs",
"lint": "biome check .",
"lint:fix": "biome check --write .",
"format": "biome format --write ."
Expand Down
2 changes: 1 addition & 1 deletion plugin/.claude-plugin/plugin.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "supermemory",
"displayName": "Supermemory",
"version": "0.0.10",
"version": "0.0.11",
"description": "Persistent memory across Claude Code sessions using Supermemory",
"author": {
"name": "Supermemory",
Expand Down
6 changes: 3 additions & 3 deletions plugin/commands/project-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Update project-level config stored in `.claude/.supermemory-claude/config.json`.
2. Ask the user what they want to update using AskUserQuestion:
- **API Key** (`apiKey`): Project-level API key that overrides global
- **Base URL** (`baseUrl`): Supermemory API base URL, defaults to `https://api.supermemory.ai`
- **Personal Container Tag** (`personalContainerTag`): Used for saving and searching personal memories across sessions
- **Repo Container Tag** (`repoContainerTag`): Used for repo-level memories shared across team
- **Project Container Tag** (`repoContainerTag`): Overrides the unified container used by Claude Code and Codex
- **Legacy Personal Container Tag** (`personalContainerTag`): Optional read-only fallback for memories created by older plugin versions

3. Ask the user for the new value. Confirm the value they provide.

Expand All @@ -44,6 +44,6 @@ Update project-level config stored in `.claude/.supermemory-claude/config.json`.
"
```

Replace `KEY_NAME` with `apiKey`, `baseUrl`, `personalContainerTag`, or `repoContainerTag` and `NEW_VALUE` with the user's provided value.
Replace `KEY_NAME` with `apiKey`, `baseUrl`, `repoContainerTag`, or the legacy-read-only `personalContainerTag`, and `NEW_VALUE` with the user's provided value.

5. Confirm to the user the project configuration has been updated.
2 changes: 1 addition & 1 deletion plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "claude-supermemory",
"version": "0.0.10",
"version": "0.0.11",
"description": "Persistent memory for Claude Code using Supermemory",
"private": true,
"engines": {
Expand Down
48 changes: 13 additions & 35 deletions plugin/scripts/add-memory.cjs

Large diffs are not rendered by default.

98 changes: 38 additions & 60 deletions plugin/scripts/context-hook.cjs

Large diffs are not rendered by default.

48 changes: 13 additions & 35 deletions plugin/scripts/save-project-memory.cjs

Large diffs are not rendered by default.

78 changes: 28 additions & 50 deletions plugin/scripts/search-memory.cjs

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions plugin/scripts/status.cjs

Large diffs are not rendered by default.

62 changes: 20 additions & 42 deletions plugin/scripts/summary-hook.cjs

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion src/add-memory.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ const {
SupermemoryClient,
PERSONAL_ENTITY_CONTEXT,
} = require('./lib/supermemory-client');
const { getContainerTag, getProjectName } = require('./lib/container-tag');
const {
getContainerTag,
getProjectIdentity,
getProjectName,
} = require('./lib/container-tag');
const { loadProjectConfig } = require('./lib/project-config');
const { loadSettings, getApiKey, getBaseUrl } = require('./lib/settings');
const { getUserFriendlyError } = require('./lib/error-helpers');
Expand Down Expand Up @@ -42,6 +46,9 @@ async function main() {
{
type: 'manual',
project: projectName,
sm_project_id: getProjectIdentity(cwd),
sm_scope: 'personal',
sm_capture_mode: 'explicit',
timestamp: new Date().toISOString(),
},
{ entityContext: PERSONAL_ENTITY_CONTEXT },
Expand Down
42 changes: 13 additions & 29 deletions src/context-hook.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
const { SupermemoryClient } = require('./lib/supermemory-client');
const {
getContainerTag,
getRepoContainerTag,
getProjectName,
} = require('./lib/container-tag');
const { getProjectName, getAllReadTags } = require('./lib/container-tag');
const { loadProjectConfig } = require('./lib/project-config');
const {
loadSettings,
Expand Down Expand Up @@ -68,10 +64,9 @@ Or set SUPERMEMORY_CC_API_KEY environment variable manually.

const baseUrl = getBaseUrl(cwd, projectConfig);
const client = new SupermemoryClient(apiKey, undefined, { baseUrl });
const personalTag = getContainerTag(cwd);
const repoTag = getRepoContainerTag(cwd);
const readTags = getAllReadTags(cwd);

debugLog(settings, 'Fetching contexts', { personalTag, repoTag });
debugLog(settings, 'Fetching project context', { readTags });

const apiErrors = [];

Expand All @@ -92,34 +87,24 @@ Or set SUPERMEMORY_CC_API_KEY environment variable manually.
return null;
};

const [personalResult, repoResult] = await Promise.all([
client
.getProfile(personalTag, projectName)
.catch(handleProfileError('personal')),
client.getProfile(repoTag, projectName).catch(handleProfileError('repo')),
]);

const personalContext = formatContext(
personalResult,
true,
false,
settings.maxProfileItems,
false,
);
const projectResult = await client
.getProfileMany(readTags, projectName, {
limit: settings.maxProfileItems,
})
.catch(handleProfileError('project'));

const repoContext = formatContext(
repoResult,
const projectContext = formatContext(
projectResult,
true,
false,
settings.maxProfileItems,
false,
);

const additionalContext = combineContexts([
{ label: '### Personal Memories', content: personalContext },
{
label: '### Project Knowledge (Shared across team)',
content: repoContext,
label: '### Project Memories (Shared across agents)',
content: projectContext,
},
]);

Expand Down Expand Up @@ -149,8 +134,7 @@ Memories will be saved as you work.

debugLog(settings, 'Context generated', {
length: additionalContext.length,
hasPersonal: !!personalContext,
hasRepo: !!repoContext,
hasProject: !!projectContext,
});

const updateNotice = await updateCheck;
Expand Down
Loading
Loading