Skip to content

kandotrun/opencode-supermemory-max

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

66 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

opencode-supermemory-max

๐Ÿง  Enhanced fork of opencode-supermemory โ€” maximizing memory quality and coverage for OpenCode coding agents.

License: MIT

Why "max"?

The official opencode-supermemory plugin is maintained by the Supermemory team, but tends to be conservative with API calls and slow to merge fixes. opencode-supermemory-max takes the opposite approach:

  • Aggressive memory utilization โ€” save more, recall more, lose nothing
  • Bug fixes shipped fast โ€” no 2-week PR review waits
  • Feature parity with claude-supermemory โ€” all the good stuff from the Claude Code plugin, ported to OpenCode
  • Japanese language support โ€” keyword detection and signal extraction work in both English and Japanese
  • Upstream tracking โ€” good changes from upstream get merged in

What's different from upstream?

This plugin combines the best features from all three official Supermemory plugins:

Feature upstream claude openclaw max
Part ID fix (OpenCode v1.2.25+) โŒ โ€” โ€” โœ…
Japanese keywords (่ฆšใˆใฆ, ใƒกใƒขใ—ใฆ) โŒ โŒ โŒ โœ…
Incremental capture (crash-safe) โŒ โŒ โœ… โœ…
Every-message recall โŒ โŒ โœ… โœ…
Metadata stripping for queries โŒ โŒ โœ… โœ…
Pre-compaction full save โŒ โŒ โœ… โœ…
Post-compaction memory re-injection โŒ โŒ โŒ โœ…
Entity Context (extraction guidance) โŒ โœ… โŒ โœ…
Dedup (no duplicate memories) โŒ โœ… โŒ โœ…
Relative time display โŒ โœ… โŒ โœ…
Repo container tag (team sharing) โŒ โœ… โŒ โœ…
Signal extraction (smart filtering) โŒ โœ… โŒ โœ…
Context re-injection (periodic) โŒ โŒ โŒ โœ…
Recall keywords (ๆ€ใ„ๅ‡บใ—ใฆ, recall) โŒ โŒ โŒ โœ…
Session-end auto-save โŒ โœ… โœ… โœ…

Installation

Quick Start

# Clone and build
git clone https://github.com/kandotrun/opencode-supermemory-max.git
cd opencode-supermemory-max
bun install && bun run build

Add to your OpenCode config (~/.config/opencode/opencode.json):

{
  "plugin": ["~/opencode-supermemory-max"]
}

Set your API key:

export SUPERMEMORY_API_KEY="sm_..."

Or create ~/.config/opencode/supermemory.jsonc:

{
  "apiKey": "sm_..."
}

Get your API key from app.supermemory.ai.

Features

๐Ÿ”„ Context Injection

On first message (and periodically), the agent receives memory context:

[SUPERMEMORY]

User Profile:
- Prefers concise responses
- Expert in TypeScript

Repo Knowledge (Shared):
- [2hrs ago] Uses monorepo with turborepo [85%]

Project Knowledge:
- [just now] Build: bun run build [100%]

Relevant Memories:
- [3d ago] Build fails if .env.local missing [82%]

๐Ÿ‡ฏ๐Ÿ‡ต Japanese + English Keywords

Memory triggers work in both languages:

English Japanese
remember, save this ่ฆšใˆใฆ, ใƒกใƒขใ—ใฆ, ไฟๅญ˜ใ—ใฆ
recall, check memory ๆ€ใ„ๅ‡บใ—ใฆ, ใƒกใƒขใƒช็ขบ่ช

๐Ÿ“ฆ 3-Tier Memory Scopes

Scope Purpose Tag Format
User Cross-project preferences opencode_user_{hash}
Project Directory-specific knowledge opencode_project_{hash}
Repo Team-shared via git remote repo_{reponame}

๐ŸŽฏ Signal Extraction

When enabled, only saves session turns containing important keywords โ€” no noise:

{
  "signalExtraction": true,
  "signalTurnsBefore": 3  // context turns before each signal
}

Built-in signal keywords: implementation, architecture, decision, bug, fix, ๅฎŸ่ฃ…, ่จญ่จˆ, ้‡่ฆ, ใƒใ‚ฐ, ไฟฎๆญฃ ...

๐Ÿงน Dedup & Entity Context

  • Dedup: Duplicate memories are automatically filtered out from search results and profile
  • Entity Context: Guides Supermemory on what to extract โ€” user actions & decisions for personal scope, architecture & patterns for repo scope

โฐ Context Re-injection

{
  "reinjectEveryN": 10  // re-inject context every 10 messages
}

Or say "recall" / "ๆ€ใ„ๅ‡บใ—ใฆ" to trigger immediate context refresh.

Configuration

~/.config/opencode/supermemory.jsonc:

{
  // Memory retrieval
  "similarityThreshold": 0.6,
  "maxMemories": 5,
  "maxProjectMemories": 10,
  "maxRepoMemories": 5,
  "maxProfileItems": 5,

  // Container tags (auto-generated if not set)
  "containerTagPrefix": "opencode",
  "userContainerTag": "my-custom-user-tag",
  "projectContainerTag": "my-project-tag",
  "repoContainerTag": "my-repo-tag",

  // Context re-injection
  "reinjectEveryN": 10,

  // Signal extraction (disabled by default)
  "signalExtraction": false,
  "signalTurnsBefore": 3,

  // Compaction
  "compactionThreshold": 0.8,

  // Extra keyword patterns (regex)
  "keywordPatterns": ["log\\s+this"],
  "recallKeywordPatterns": ["my custom recall"],
  "signalKeywords": ["custom signal"]
}

Tool Usage

The supermemory tool is available to the agent:

Mode Args Description
add content, type?, scope? Store memory
search query, scope? Search memories
profile query? View user profile
list scope?, limit? List memories
forget memoryId, scope? Delete memory

Scopes: user, project (default), repo

Privacy

Content in <private> tags is never stored:

API key is <private>sk-abc123</private>

Development

bun install
bun run build
bun run typecheck

Upstream Sync

This fork tracks supermemoryai/opencode-supermemory:

git fetch upstream
git merge upstream/main

License

MIT

About

๐Ÿง  Enhanced OpenCode memory plugin โ€” Japanese support, signal extraction, 3-tier scopes, dedup, entity context. Fork of opencode-supermemory with aggressive memory maximization.

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • TypeScript 81.3%
  • JavaScript 17.4%
  • Shell 1.3%