Skip to content

Add tool namespacing to avoid collisions with other plugins #133

@augustoolucas

Description

@augustoolucas

Short description

ctx_search name collision causes magic-context's unified search to be silently overwritten when context-mode is also installed

What problem does this solve?

When both magic-context and context-mode are installed as OpenCode plugins, they both register a tool named ctx_search. OpenCode's tool registry silently overwrites duplicates — the last registrant wins.

Result: magic-context's ctx_search (memories + session history + git commits) can override or be overwritten by context-mode's ctx_search (FTS5 indexed content). The model could lose access to the unified search that is central to magic-context's value proposition.

Evidence

Tool registry log with both plugins installed:

duration=57 ctx_search ← magic-context (registered first, overwritten)
duration=89 ctx_search ← context-mode (registered second, wins)

Both execute functions fire at runtime, but only context-mode's result is returned to the model.

Impact

Only ctx_search has a name collision. All other tools (ctx_reduce, ctx_expand, ctx_note, ctx_memory) are unique to magic-context and work correctly. The collision affects the most important tool — the unified search across memories, session history, and git commits.

Request

Add a namespace prefix to magic-context's tools when registering as a native OpenCode plugin — e.g., mc_ctx_search, mc_ctx_reduce, mc_ctx_expand, mc_ctx_note, mc_ctx_memory.

This avoids collisions with other plugins that may register tools with similar names, without depending on those plugins or on OpenCode's tool registry to handle duplicates.

Proposed solution

Prefix magic-context's tools with a namespace when registering as a native OpenCode plugin. The tools would be renamed:

Current name Proposed name
ctx_search mc_ctx_search
ctx_reduce mc_ctx_reduce
ctx_expand mc_ctx_expand
ctx_note mc_ctx_note
ctx_memory mc_ctx_memory

Implementation: In the native plugin registration path (where tools are exported as tool: { ... }), prefix each key with mc_. The MCP server registration (for non-OpenCode hosts) can keep the bare names since those hosts typically namespace MCP tools automatically.

Behavior: No change to tool functionality. Only the tool name visible to the model changes. Existing cross-session memories, session history, and indexed content are unaffected — they are stored by session ID, not by tool name.

Alternatives considered

No response

Area

OpenCode plugin

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature requestNew feature or capability request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions