From 561435d86c5c2ada638ed4cdda282e00bc2cd082 Mon Sep 17 00:00:00 2001 From: ShivamB25 <104637569+ShivamB25@users.noreply.github.com> Date: Wed, 31 Dec 2025 12:56:47 +0530 Subject: [PATCH 1/3] Update installation command to use latest version bunx opencode-supermemory@latest setup Note: 'setup' is deprecated. Use 'install' instead. happens. bun uses cache instead always if u don't make it @latest. same can be said for the plugin. version locking is bad here incase frequent update. suggestion to update the plugin to always have @latest in config.json too. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6c45b55..31b7390 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Your agent remembers what you tell it - across sessions, across projects. ### For Humans ```bash -bunx opencode-supermemory install +bunx opencode-supermemory@latest install ``` Then get your API key from [console.supermemory.ai](https://console.supermemory.ai) and set it: @@ -33,7 +33,7 @@ If you're an LLM agent helping set up opencode-supermemory, follow these steps: #### Step 1: Run the installer ```bash -bunx opencode-supermemory install --no-tui +bunx opencode-supermemory@latest install --no-tui ``` This will: From 794eaeb9a0690bf980ffbb79f6ec5c8e71c71bcb Mon Sep 17 00:00:00 2001 From: shivam bansal Date: Wed, 31 Dec 2025 13:00:49 +0530 Subject: [PATCH 2/3] fix: use @latest tag in plugin config to bypass bun cache This ensures the plugin always fetches the latest version instead of using cached versions, which is important for frequently updated packages. Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> --- src/cli.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cli.ts b/src/cli.ts index dc4d729..cc20529 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -6,7 +6,7 @@ import * as readline from "node:readline"; const OPENCODE_CONFIG_DIR = join(homedir(), ".config", "opencode"); const OPENCODE_COMMAND_DIR = join(OPENCODE_CONFIG_DIR, "command"); -const PLUGIN_NAME = "opencode-supermemory"; +const PLUGIN_NAME = "opencode-supermemory@latest"; const SUPERMEMORY_INIT_COMMAND = `--- description: Initialize Supermemory with comprehensive codebase knowledge From 7500343e8f40d2696e7494bbceb4ad93edb36c30 Mon Sep 17 00:00:00 2001 From: shivam bansal Date: Wed, 31 Dec 2025 13:07:09 +0530 Subject: [PATCH 3/3] feat: add Oh My OpenCode integration with --disable-auto-compact flag - Detect Oh My OpenCode plugin in user's config - Add option to disable anthropic-auto-compact hook for Supermemory compatibility - In TUI mode: prompt user for confirmation - In --no-tui mode: require explicit --disable-auto-compact flag - Update help text and examples to use @latest tag Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com> --- src/cli.ts | 93 ++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 86 insertions(+), 7 deletions(-) diff --git a/src/cli.ts b/src/cli.ts index cc20529..7059582 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -6,6 +6,7 @@ import * as readline from "node:readline"; const OPENCODE_CONFIG_DIR = join(homedir(), ".config", "opencode"); const OPENCODE_COMMAND_DIR = join(OPENCODE_CONFIG_DIR, "command"); +const OH_MY_OPENCODE_CONFIG = join(OPENCODE_CONFIG_DIR, "oh-my-opencode.json"); const PLUGIN_NAME = "opencode-supermemory@latest"; const SUPERMEMORY_INIT_COMMAND = `--- @@ -269,8 +270,58 @@ function createCommand(): boolean { return true; } +function isOhMyOpencodeInstalled(): boolean { + const configPath = findOpencodeConfig(); + if (!configPath) return false; + + try { + const content = readFileSync(configPath, "utf-8"); + return content.includes("oh-my-opencode"); + } catch { + return false; + } +} + +function isAutoCompactAlreadyDisabled(): boolean { + if (!existsSync(OH_MY_OPENCODE_CONFIG)) return false; + + try { + const content = readFileSync(OH_MY_OPENCODE_CONFIG, "utf-8"); + const config = JSON.parse(content); + const disabledHooks = config.disabled_hooks as string[] | undefined; + return disabledHooks?.includes("anthropic-auto-compact") ?? false; + } catch { + return false; + } +} + +function disableAutoCompactHook(): boolean { + try { + let config: Record = {}; + + if (existsSync(OH_MY_OPENCODE_CONFIG)) { + const content = readFileSync(OH_MY_OPENCODE_CONFIG, "utf-8"); + config = JSON.parse(content); + } + + const disabledHooks = (config.disabled_hooks as string[]) || []; + if (!disabledHooks.includes("anthropic-auto-compact")) { + disabledHooks.push("anthropic-auto-compact"); + } + config.disabled_hooks = disabledHooks; + + writeFileSync(OH_MY_OPENCODE_CONFIG, JSON.stringify(config, null, 2)); + console.log(`āœ“ Disabled anthropic-auto-compact hook in oh-my-opencode.json`); + return true; + } catch (err) { + console.error("āœ— Failed to update oh-my-opencode.json:", err); + return false; + } +} + interface InstallOptions { tui: boolean; + disableAutoCompact: boolean; } async function install(options: InstallOptions): Promise { @@ -319,7 +370,31 @@ async function install(options: InstallOptions): Promise { createCommand(); } - // Step 3: API key instructions + // Step 3: Configure Oh My OpenCode (if installed) + if (isOhMyOpencodeInstalled()) { + console.log("\nStep 3: Configure Oh My OpenCode"); + console.log("Detected Oh My OpenCode plugin."); + console.log("Supermemory handles context compaction, so the built-in auto-compact hook should be disabled."); + + if (isAutoCompactAlreadyDisabled()) { + console.log("āœ“ anthropic-auto-compact hook already disabled"); + } else { + if (options.tui) { + const shouldDisable = await confirm(rl!, "Disable anthropic-auto-compact hook to let Supermemory handle context?"); + if (!shouldDisable) { + console.log("Skipped."); + } else { + disableAutoCompactHook(); + } + } else if (options.disableAutoCompact) { + disableAutoCompactHook(); + } else { + console.log("Skipped. Use --disable-auto-compact to disable the hook in non-interactive mode."); + } + } + } + + // Step 4: API key instructions console.log("\n" + "─".repeat(50)); console.log("\nšŸ”‘ Final step: Set your API key\n"); console.log("Get your API key from: https://console.supermemory.ai"); @@ -339,12 +414,14 @@ function printHelp(): void { opencode-supermemory - Persistent memory for OpenCode agents Commands: - install Install and configure the plugin - --no-tui Run in non-interactive mode (for LLM agents) + install Install and configure the plugin + --no-tui Run in non-interactive mode (for LLM agents) + --disable-auto-compact Disable Oh My OpenCode's auto-compact hook (use with --no-tui) Examples: - bunx opencode-supermemory install - bunx opencode-supermemory install --no-tui + bunx opencode-supermemory@latest install + bunx opencode-supermemory@latest install --no-tui + bunx opencode-supermemory@latest install --no-tui --disable-auto-compact `); } @@ -357,12 +434,14 @@ if (args.length === 0 || args[0] === "help" || args[0] === "--help" || args[0] = if (args[0] === "install") { const noTui = args.includes("--no-tui"); - install({ tui: !noTui }).then((code) => process.exit(code)); + const disableAutoCompact = args.includes("--disable-auto-compact"); + install({ tui: !noTui, disableAutoCompact }).then((code) => process.exit(code)); } else if (args[0] === "setup") { // Backwards compatibility console.log("Note: 'setup' is deprecated. Use 'install' instead.\n"); const noTui = args.includes("--no-tui"); - install({ tui: !noTui }).then((code) => process.exit(code)); + const disableAutoCompact = args.includes("--disable-auto-compact"); + install({ tui: !noTui, disableAutoCompact }).then((code) => process.exit(code)); } else { console.error(`Unknown command: ${args[0]}`); printHelp();