Skip to content

[Feature]: Multi-bundle search across user-level and project-level knowledge/ #11

Description

@kurodaritsu

Is your feature request related to a problem or limitation?

I'm running Claude Code with a user-level ~/.claude/ and a per-project .claude/ setup. I'd like okf-agent-memory to implement that same idea, meaning there's a user-level ~/knowledge/ bundle for things true across every repo (e.g. web/programming research files) and a project-level ./knowledge/ for things that are true only in one repo.

The MCP server currently can only use a single bundle per call via bundle arg. Though, there is OKF_MCP_ROOT that I can use as a hack, it's only a single root, so one server instance can't reach both ~/knowledge and <project>/knowledge at the same time unless I set the it to something like $HOME, which looks ugly to me given create_concept and update_concept write through the same path check.

Though, this idea looks far fetched to me because this means dealing with ID collisions, handling graph builds and validations between user and project level, multi-root config shenanigans, etc.

Proposed Solution / Enhancement

Ideal: okf search to have an optional scope arg (user / project / default: both).

One server instance load an ordered list of bundles, each with a scope label, and search their union. Probably something like this in the config:

OKF_MCP_BUNDLES="user=/home/me/knowledge:project=./knowledge"

Not sure if this is the best approach but I'm open to alternatives.

Alternatives Considered

Current workaround is registering two MCP server instances, one for user scope and another at project scope, so the tools are named like mcp__okf-user__search and mcp__okf-project__search.

Although, this workaround have some limitations:

  1. Separate ranked list - Two bundles that are indexed separately produce separate scores, and merging the list result by score here probably doesn't work. idf is derived from the per-bundle concept count:
    N := float64(len(b.Concepts))

    idf := math.Log(1.0 + (N-docFreq+0.5)/(docFreq+0.5))
  2. The agent has to remember to call both servers - Even if I tell the agent to query from both servers (in CLAUDE.md), it'll eventually forgets one server or the other and I have to keep reminding it via hook.

Additional Context

Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions