📋 Pre-flight Checks
🔍 Problem Description
When working on a project, it's common to need context from a related project — a decision made last week in a different repo, a pattern established in another service, or a known gotcha from a dependency project.
Currently, mem_search always restricts results to the current/default project. There's no way to reach across projects from within the MCP tool.
The CLI already supports this via engram search "query" (without --project), which searches globally. The MCP tool has no equivalent.
Real scenario: while working on project-A, I need to recall an architectural decision logged under project-B. Today this requires either multiple mem_search calls with explicit project values, or falling back to the CLI outside the agent context.
💡 Proposed Solution
Add an optional boolean parameter all_projects to mem_search.
Example usage:
mem_search(query: "auth middleware decision", all_projects: true)
When all_projects: true, the tool skips the default project assignment and passes an empty project to Store.Search(), which already handles global search correctly (no WHERE project = ? clause is added).
When all_projects is false or omitted, behavior is unchanged.
📦 Affected Area
MCP Server (tools, transport)
🔄 Alternatives Considered
Passing project: "" explicitly — doesn't work because the handler replaces empty project with cfg.DefaultProject before calling Store.Search().
📎 Additional Context
Root cause is in internal/mcp/mcp.go, handleSearch() (~line 634):
if project == "" {
project = cfg.DefaultProject // always overwrites empty project
}
The CLI (cmd/engram/main.go, cmdSearch) doesn't apply this default, so opts.Project stays "" and Store.Search() performs a global query.
The store layer already supports global search — Store.Search() only adds WHERE o.project = ? when opts.Project != "" (internal/store/store.go, ~line 1536).
The fix is minimal:
if project == "" && !allProjects {
project = cfg.DefaultProject
}
📋 Pre-flight Checks
status:approvedbefore a PR can be opened🔍 Problem Description
When working on a project, it's common to need context from a related project — a decision made last week in a different repo, a pattern established in another service, or a known gotcha from a dependency project.
Currently,
mem_searchalways restricts results to the current/default project. There's no way to reach across projects from within the MCP tool.The CLI already supports this via
engram search "query"(without--project), which searches globally. The MCP tool has no equivalent.Real scenario: while working on project-A, I need to recall an architectural decision logged under project-B. Today this requires either multiple
mem_searchcalls with explicit project values, or falling back to the CLI outside the agent context.💡 Proposed Solution
Add an optional boolean parameter
all_projectstomem_search.Example usage:
When
all_projects: true, the tool skips the default project assignment and passes an empty project toStore.Search(), which already handles global search correctly (noWHERE project = ?clause is added).When
all_projectsisfalseor omitted, behavior is unchanged.📦 Affected Area
MCP Server (tools, transport)
🔄 Alternatives Considered
Passing
project: ""explicitly — doesn't work because the handler replaces empty project withcfg.DefaultProjectbefore callingStore.Search().📎 Additional Context
Root cause is in
internal/mcp/mcp.go,handleSearch()(~line 634):The CLI (
cmd/engram/main.go,cmdSearch) doesn't apply this default, soopts.Projectstays""andStore.Search()performs a global query.The store layer already supports global search —
Store.Search()only addsWHERE o.project = ?whenopts.Project != ""(internal/store/store.go, ~line 1536).The fix is minimal: