feat: add memory.disable_global config option to skip global scope#6
Closed
Edison-A-N wants to merge 3 commits into
Closed
feat: add memory.disable_global config option to skip global scope#6Edison-A-N wants to merge 3 commits into
Edison-A-N wants to merge 3 commits into
Conversation
Author
|
Duplicate of #7, closing. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a
memory.disable_globalconfiguration option (via~/.config/opencode/agent-memory.json) that allows users to completely disable the global memory scope, restricting all memory operations to project-scoped blocks only.Motivation
In multi-project environments, global memory blocks (
persona,human) are shared across all projects. This can cause unintended issues:For users who run OpenCode across many distinct projects, the ability to opt out of global memory is essential.
Changes
Configuration
New field in
~/.config/opencode/agent-memory.json:{ "memory": { "disable_global": true } }Behavioral changes when
disable_global: trueensureSeed()persona+human+projectprojectlistBlocks("global")[]listBlocks("all")setBlock("global", ...)replaceInBlock("global", ...)Files changed
src/journal.ts— Addedmemory.disable_globalto config schema (ConfigSchema)src/memory.ts— AddedMemoryStoreOptions.disableGlobal;createMemoryStore()accepts options and gates all global-scope operationssrc/plugin.ts— Reads config and passesdisableGlobalto memory storesrc/tools.ts— Propagates store options through tool definitionspackage.json— Published as@Edison-A-N/opencode-agent-memoryon GitHub Packages for testing.npmrc— GitHub Packages registry config (can be removed if merged upstream)Questions for maintainer
Hi @joshuadavidthomas 👋
I've been using this plugin in a multi-project setup and found that global memory blocks were causing cross-project interference. This PR is my attempt to address that — I'd love your feedback on a few things:
Is this the right approach? Adding a config flag felt minimally invasive, but I'm open to alternative designs (e.g., a per-project override, or making global scope opt-in rather than opt-out).
Config location: I added
memory.disable_globalto the existingagent-memory.jsonconfig schema alongsidejournal. Does this feel right, or would you prefer a different structure?Scope of the PR: The
.npmrcandpackage.jsonchanges are specific to my fork's publishing setup. Happy to clean those up if this is headed toward a merge.Testing: The existing tests pass. I haven't added dedicated tests for
disable_globalyet — happy to add them if the approach looks good.Thank you for building this plugin — the Letta-style memory model is a great fit for OpenCode. Looking forward to your thoughts!