📋 Pre-flight Checks
📝 Bug Description
On Windows, starting engram mcp with the process current working directory at a drive root (C:\) causes Go project auto-detection to return a backslash as the project name. That value is rejected when supplied explicitly to mem_save, creating an inconsistent MCP contract.
🔄 Steps to Reproduce
- On Windows, start
engram mcp with process cwd C:\.
- Call
mem_current_project from an OpenCode MCP client.
- Observe the returned project value, then pass it as
project to mem_save.
✅ Expected Behavior
Auto-detection must never return a project value that explicit project validation rejects. For a Windows drive root without Git/config detection, return project: "unknown" while retaining project_source: "dir_basename".
❌ Actual Behavior
mem_current_project returns:
{ "cwd":"C:\\", "project":"\\", "project_path":"C:\\", "project_source":"dir_basename" }
Passing project: "\\" to mem_save returns error_code: invalid_project, because a project must be a name rather than a path.
Operating System
Windows
Engram Version
v1.20.1-0.20260720141607-763a6ba43271 (commit 763a6ba432713725d6ce82a2416eec6cbd9ec94e)
Agent / Client
OpenCode
📋 Relevant Logs
mem_current_project -> { "cwd":"C:\\", "project":"\\", "project_path":"C:\\", "project_source":"dir_basename" }
mem_save(project: "\\") -> error_code: invalid_project
💡 Additional Context
Environment: Windows, OpenCode MCP client, PowerShell 7. The current template has no shell field; if one is added, select Other.
Root cause: internal/project/detect.go in DetectProjectFull Case 5 uses filepath.Base(dir) and maps only "" and "." to "unknown". On Windows, filepath.Base("C:\\") == "\\". internal/mcp/mcp.go (handleCurrentProject) returns the detection result verbatim. Explicit project validation correctly rejects path separators, while omitted-project write resolution can accept the auto-detected backslash.
Suggested tests:
- Windows drive root in
DetectProjectFull.
mem_current_project never emits a separator as project.
- Explicit backslash remains rejected.
Related but not duplicates: #652 and #656 address separator handling in the OpenCode TypeScript plugin, not the Go detector.
📋 Pre-flight Checks
status:approvedbefore a PR can be opened📝 Bug Description
On Windows, starting
engram mcpwith the process current working directory at a drive root (C:\) causes Go project auto-detection to return a backslash as the project name. That value is rejected when supplied explicitly tomem_save, creating an inconsistent MCP contract.🔄 Steps to Reproduce
engram mcpwith process cwdC:\.mem_current_projectfrom an OpenCode MCP client.projecttomem_save.✅ Expected Behavior
Auto-detection must never return a project value that explicit project validation rejects. For a Windows drive root without Git/config detection, return
project: "unknown"while retainingproject_source: "dir_basename".❌ Actual Behavior
mem_current_projectreturns:Passing
project: "\\"tomem_savereturnserror_code: invalid_project, because a project must be a name rather than a path.Operating System
Windows
Engram Version
v1.20.1-0.20260720141607-763a6ba43271(commit763a6ba432713725d6ce82a2416eec6cbd9ec94e)Agent / Client
OpenCode
📋 Relevant Logs
💡 Additional Context
Environment: Windows, OpenCode MCP client, PowerShell 7. The current template has no shell field; if one is added, select
Other.Root cause:
internal/project/detect.goinDetectProjectFullCase 5 usesfilepath.Base(dir)and maps only""and"."to"unknown". On Windows,filepath.Base("C:\\") == "\\".internal/mcp/mcp.go(handleCurrentProject) returns the detection result verbatim. Explicit project validation correctly rejects path separators, while omitted-project write resolution can accept the auto-detected backslash.Suggested tests:
DetectProjectFull.mem_current_projectnever emits a separator asproject.Related but not duplicates: #652 and #656 address separator handling in the OpenCode TypeScript plugin, not the Go detector.