Skip to content

Feature Request: Add config option to enable cross-project memory sharing #96

@skywalker-35

Description

@skywalker-35

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

{
  "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: userScopeMemory toggle

A 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

  1. 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" });
  2. Add defaultScope to the documented configuration options
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions