supermemoryai/opencode-supermemory

Supermemory plugin for OpenCode

opencode‑supermemory

What it is – A plugin for the OpenCode AI coding assistant that gives the assistant persistent, searchable memory across sessions and projects. It talks to the Supermemory service (https://supermemory.ai) to store and retrieve “memories” such as user preferences, project architecture, error‑solution patterns, and conversation snippets.

Key capabilities

  • Automatic capture – Every few turns (configurable) the conversation is saved to Supermemory; any leftover turns are flushed when the session ends.
  • Context injection – On the first message of a session the agent receives a concise profile, a list of project memories, and (optionally) a semantic search over personal memories, all without the user having to prompt for it.
  • Reasoned recall – Before answering, the agent decides whether a memory search would help; if so it runs the supermemory tool and the results are auto‑approved and injected into the model request (up to a configurable number of matches).
  • Keyword nudges – Saying “remember”, “save this”, etc., (or custom regexes) forces an immediate save.
  • Codebase indexing – The /supermemory-index (or /supermemory-init) command makes the agent explore the repository and store structural and pattern information.
  • Compaction memory – When OpenCode’s context window reaches a threshold, the plugin enriches the summarisation step with relevant memories and stores the summary as a new memory.
  • Privacy – Anything wrapped in <private>…</private> is stripped before storage.
  • Status notices – Small non‑intrusive toasts (or TUI messages) inform the user when memories are saved, recalled, or when a newer plugin version is available.

Installation & setup

bunx opencode-supermemory@latest install   # registers the plugin for both OpenCode V1 and V2
bunx opencode-supermemory@latest login      # or set SUPERMEMORY_API_KEY in the config file
bunx opencode-supermemory@latest status     # verify connectivity

The installer writes the appropriate entries to ~/.config/opencode/opencode.jsonc for both generations and creates the /supermemory-index command. In‑chat commands (/supermemory‑init, /supermemory‑login, etc.) are also provided.

How to use

  • The agent automatically gets memory context; you can also invoke the tool directly:
    {"mode": "search", "query": "how to build with bun"}
    
  • Run /supermemory-index to let the agent scan the repository and populate memories.
  • Use keyword phrases or add custom regexes (keywordPatterns in the config) to trigger manual saves.

Configuration (all optional, stored in ~/.config/opencode/supermemory.jsonc or via env vars)

Setting Meaning
SUPERMEMORY_API_KEY API key for the Supermemory service
captureEveryNTurns How many turns between automatic saves (default 3)
recallMode direct (auto‑search on each prompt), advisory (agent decides), or off
maxMemories Max number of retrieved memories injected per request
keywordPatterns Extra regexes that cause a save when matched
compactionThreshold / compactionEnabled When to trigger summarisation and whether to enrich OpenCode 2’s native compaction
SUPERMEMORY_DEBUG=1 Shows internal recall‑decision lines for debugging

Supported scopes & types

  • Scopes: user (personal) or project (default). Tags are derived from the Git remote or filesystem path, ensuring the same container is used across Claude Code, Codex, Cursor, etc.
  • Types include project-config, architecture, error-solution, preference, learned-pattern, conversation.

License – MIT.


All details are taken directly from the repository’s README.

Related

  • Project
  • Project
  • Project
  • Project
  • Project