Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More
TypeScript aiai-agentsai-memoryanthropicartificial-intelligencechromadbclaudeclaude-agent-sdkclaude-agentsclaude-codeclaude-code-pluginclaude-skillsembeddingslong-term-memorymem0memory-engineopenmemoryragsqlitesupermemory
#!/usr/bin/env node
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const rootDir = path.resolve(__dirname, '..');
const packageJsonPath = path.join(rootDir, 'package.json');
const codexPluginPath = path.join(rootDir, '.codex-plugin', 'plugin.json');
const bundledCodexPluginPath = path.join(rootDir, 'plugin', '.codex-plugin', 'plugin.json');
const qoderPluginPath = path.join(rootDir, '.qoder-plugin', 'plugin.json');
const bundledQoderPluginPath = path.join(rootDir, 'plugin', '.qoder-plugin', 'plugin.json');
const bundledDevinPluginPath = path.join(rootDir, 'plugin', '.devin-plugin', 'plugin.json');
const claudePluginPath = path.join(rootDir, '.claude-plugin', 'plugin.json');
const bundledClaudePluginPath = path.join(rootDir, 'plugin', '.claude-plugin', 'plugin.json');
const claudeMarketplacePath = path.join(rootDir, '.claude-plugin', 'marketplace.json');
const grokPluginPath = path.join(rootDir, '.grok-plugin', 'plugin.json');
const dshPackagePath = path.join(rootDir, 'dsh', 'package.json');
const openClawPluginPath = path.join(rootDir, 'openclaw', 'openclaw.plugin.json');
const cursorPluginPaths = [
path.join(rootDir, 'claude-mem-cursor', '.cursor-plugin', 'plugin.json'),
path.join(rootDir, 'claude-mem-grok-bot', '.cursor-plugin', 'plugin.json'),
];
function readJson(filePath) {
return JSON.parse(fs.readFileSync(filePath, 'utf8'));
}
function writeJson(filePath, value) {
fs.writeFileSync(filePath, JSON.stringify(value, null, 2) + '\n');
}
function syncCodexPlugin(plugin, pkg) {
const author =
typeof plugin.author === 'object' && plugin.author ? plugin.author : {};
return {
...plugin,
name: pkg.name,
version: pkg.version,
description: pkg.description,
homepage: pkg.homepage,
repository: normalizeRepositoryUrl(pkg.repository),
license: pkg.license,
keywords: pkg.keywords,
author: {
...author,
name: normalizeAuthorName(pkg.author),
},
interface: {
...plugin.interface,
developerName: normalizeAuthorName(pkg.author),
websiteURL: normalizeRepositoryUrl(pkg.repository),
},
};
}
function syncClaudePlugin(plugin, pkg) {
return {
...plugin,
name: pkg.name,
version: pkg.version,
description: pkg.description,
homepage: pkg.homepage,
repository: normalizeRepositoryUrl(pkg.repository),
license: pkg.license,
keywords: pkg.keywords,
author: {
...(typeof plugin.author === 'object' && plugin.author ? plugin.author : {}),
name: normalizeAuthorName(pkg.author),
},
};
}
function syncVersionOnly(manifest, pkg) {
return {
...manifest,
version: pkg.version,
};
}
function syncClaudeMarketplace(marketplace, pkg) {
return {
...marketplace,
plugins: marketplace.plugins.map((plugin) =>
plugin.name === pkg.name ? { ...plugin, version: pkg.version } : plugin,
),
};
}
function normalizeAuthorName(author) {
if (typeof author === 'string') return author;
if (author && typeof author === 'object' && typeof author.name === 'string') return author.name;
return '';
}
function syncCursorPlugin(plugin, pkg) {
return {
...plugin,
version: pkg.version,
description: plugin.description ?? pkg.description,
homepage: plugin.homepage ?? pkg.homepage,
repository: normalizeRepositoryUrl(pkg.repository),
license: pkg.license,
author: {
...(typeof plugin.author === 'object' && plugin.author ? plugin.author : {}),
name: normalizeAuthorName(pkg.author),
},
};
}
function normalizeRepositoryUrl(repository) {
if (typeof repository === 'string') return repository.replace(/\.git$/, '');
if (repository && typeof repository === 'object' && typeof repository.url === 'string')
return repository.url.replace(/\.git$/, '');
return '';
}
function main() {
for (const filePath of [
packageJsonPath,
codexPluginPath,
bundledCodexPluginPath,
qoderPluginPath,
bundledQoderPluginPath,
bundledDevinPluginPath,
claudePluginPath,
bundledClaudePluginPath,
claudeMarketplacePath,
grokPluginPath,
dshPackagePath,
openClawPluginPath,
...cursorPluginPaths,
]) {
if (!fs.existsSync(filePath)) {
console.error(`Missing required file: ${filePath}`);
process.exit(1);
}
}
const pkg = readJson(packageJsonPath);
const codexPlugin = readJson(codexPluginPath);
const bundledCodexPlugin = readJson(bundledCodexPluginPath);
const qoderPlugin = readJson(qoderPluginPath);
const bundledQoderPlugin = readJson(bundledQoderPluginPath);
const bundledDevinPlugin = readJson(bundledDevinPluginPath);
const claudePlugin = readJson(claudePluginPath);
const bundledClaudePlugin = readJson(bundledClaudePluginPath);
const claudeMarketplace = readJson(claudeMarketplacePath);
const grokPlugin = readJson(grokPluginPath);
const dshPackage = readJson(dshPackagePath);
const openClawPlugin = readJson(openClawPluginPath);
const cursorPlugins = cursorPluginPaths.map(readJson);
writeJson(codexPluginPath, syncCodexPlugin(codexPlugin, pkg));
writeJson(bundledCodexPluginPath, syncCodexPlugin(bundledCodexPlugin, pkg));
writeJson(qoderPluginPath, syncCursorPlugin(qoderPlugin, pkg));
writeJson(bundledQoderPluginPath, syncCursorPlugin(bundledQoderPlugin, pkg));
writeJson(bundledDevinPluginPath, syncVersionOnly(bundledDevinPlugin, pkg));
writeJson(claudePluginPath, syncClaudePlugin(claudePlugin, pkg));
writeJson(bundledClaudePluginPath, syncClaudePlugin(bundledClaudePlugin, pkg));
writeJson(claudeMarketplacePath, syncClaudeMarketplace(claudeMarketplace, pkg));
writeJson(grokPluginPath, syncVersionOnly(grokPlugin, pkg));
writeJson(dshPackagePath, syncVersionOnly(dshPackage, pkg));
writeJson(openClawPluginPath, syncVersionOnly(openClawPlugin, pkg));
cursorPluginPaths.forEach((filePath, index) => writeJson(filePath, syncCursorPlugin(cursorPlugins[index], pkg)));
console.log('✓ Synced plugin manifests from package.json');
}
main();