Problem
Currently, opencode-mem isolates memories by project directory (each project gets its own shard DB like project_{hash}_shard_0.db). This is a sensible default for project-specific context (architecture decisions, code patterns, etc.), but it makes it difficult to share global user knowledge across projects.
For example, I want to store things like:
- My GitHub username (
skywalker-35) so the AI can use it for issue/PR operations in any project
- Personal preferences (language, coding style) that apply universally
- Cross-project workflows (e.g., "always run tests before committing")
Currently, switching to a different project directory means the AI has no access to memories stored in other projects. The AGENTS.md workaround exists but requires manual file editing and doesn't leverage the vector search capabilities.
Proposed Solution
Add a configuration option to control memory scope behavior:
Option A: defaultScope config
This already exists in the source code but is not documented in the README config section.
Option B: userScopeMemory toggle
A dedicated config to allow storing memories in user scope by default:
Option C (Best): Hybrid approach
- Document the existing
scope parameter for memory() calls:
memory({ mode: "add", content: "GitHub: skywalker-35", scope: "user" });
memory({ mode: "search", query: "GitHub account", scope: "all-projects" });
- Add
defaultScope to the documented configuration options
- Improve the
chatMessage injection to optionally include user-scope memories in every project session
Environment
- OS: Windows 11
- opencode-mem version: latest (installed via plugin system)
- Storage:
~/.opencode-mem/data with 9 project shards
Problem
Currently, opencode-mem isolates memories by project directory (each project gets its own shard DB like
project_{hash}_shard_0.db). This is a sensible default for project-specific context (architecture decisions, code patterns, etc.), but it makes it difficult to share global user knowledge across projects.For example, I want to store things like:
skywalker-35) so the AI can use it for issue/PR operations in any projectCurrently, switching to a different project directory means the AI has no access to memories stored in other projects. The
AGENTS.mdworkaround exists but requires manual file editing and doesn't leverage the vector search capabilities.Proposed Solution
Add a configuration option to control memory scope behavior:
Option A:
defaultScopeconfig{ "memory": { "defaultScope": "all-projects" // or "project" (default) } }This already exists in the source code but is not documented in the README config section.
Option B:
userScopeMemorytoggleA dedicated config to allow storing memories in user scope by default:
{ "userScopeMemory": true // new memories default to user scope instead of project scope }Option C (Best): Hybrid approach
scopeparameter formemory()calls:defaultScopeto the documented configuration optionschatMessageinjection to optionally include user-scope memories in every project sessionEnvironment
~/.opencode-mem/datawith 9 project shards