π Pre-flight Checks
π Bug Description
mem_session_summary intentionally omits the project field from its input schema ("auto-detect only β REQ-308 write-tool contract", internal/mcp/mcp.go), so an explicit project: argument is silently dropped. When the server cwd is a parent directory containing multiple git repos, the tool then fails with error_code=ambiguous_project with no recovery path: passing project does nothing, and passing project_choice_reason=user_selected_after_ambiguous_project doesn't help either because the handler never reads any of the recovery fields. The handler also passes activity=nil to writeProjectErrorResult, so unlike mem_save, the ambiguous error envelope never mints a recovery_token.
This contradicts the project's own agent instructions in two places:
plugin/claude-code/scripts/post-compaction.sh explicitly tells the model: "Call mem_session_summary β¦ Use project: '%s'" β an argument the Go server does not accept.
- The Pi wrapper already accepts an explicit
project fallback for mem_session_summary (unreleased changelog entry), so the TypeScript lane and the Go MCP lane now disagree on the tool contract.
Meanwhile mem_save honors a validated explicit selection via resolveSaveWriteProjectWithProcessOverride (REQ-308) and returns project_source=explicit_override. The net effect: an agent that ends a session from a multi-repo workspace root can save observations with mem_save project=X all session long, then cannot save the session summary for the same project at all.
π Steps to Reproduce
- Create a parent dir with two git repos:
mkdir -p ws/repo-a ws/repo-b && git -C ws/repo-a init && git -C ws/repo-b init
- Seed any known project (e.g.
mem_save from a repo named my-project so it exists in the store)
- From
cd ws, call mem_session_summary with {"content": "## Goal\nβ¦", "project": "my-project"}
- Observe
ambiguous_project even though a known project was named explicitly (and mem_save with the identical project argument from the same cwd succeeds)
β
Expected Behavior
mem_session_summary accepts the same validated explicit-project selection as mem_save: a project backed by known store context (existing project, matching session, repo config, or ambiguous-recovery choice) is honored with project_source=explicit_override; unbacked names still fail loudly (no arbitrary buckets); omitted project keeps today's auto-detect + ENGRAM_PROJECT/--project behavior.
β Actual Behavior
{"available_projects":["repo-a","repo-b"],"error_code":"ambiguous_project",
"message":"Cannot determine project: ambiguous project: multiple git repos found in cwd", ...}
returned regardless of any project / project_choice_reason / recovery_token argument, and (unlike mem_save) with no recovery_token minted for this tool's own error path prior to the fix.
π₯οΈ Environment
- Operating System: macOS
- Engram Version: 1.16.3 (reproduced; code path unchanged on
main @ be4b613 and v1.19.0)
- Agent / Client: Claude Code
π‘ Additional Context
Fix is implemented and ready on uhhexe/engram branch fix/session-summary-explicit-project-main: exposes project/project_choice_reason/recovery_token on the mem_session_summary schema, routes explicit selections through resolveSaveWriteProjectWithProcessOverride (identical REQ-308 validation as mem_save), leaves omitted-project behavior byte-for-byte unchanged, and passes activity so ambiguous errors mint recovery tokens. Includes tests (explicit backed project bypasses ambiguous cwd; unbacked project fails loudly with no write; omitted project still errors; schema contract). go test ./... green. Happy to open the PR once this is approved.
π Pre-flight Checks
status:approvedbefore a PR can be openedπ Bug Description
mem_session_summaryintentionally omits theprojectfield from its input schema ("auto-detect only β REQ-308 write-tool contract",internal/mcp/mcp.go), so an explicitproject:argument is silently dropped. When the server cwd is a parent directory containing multiple git repos, the tool then fails witherror_code=ambiguous_projectwith no recovery path: passingprojectdoes nothing, and passingproject_choice_reason=user_selected_after_ambiguous_projectdoesn't help either because the handler never reads any of the recovery fields. The handler also passesactivity=niltowriteProjectErrorResult, so unlikemem_save, the ambiguous error envelope never mints arecovery_token.This contradicts the project's own agent instructions in two places:
plugin/claude-code/scripts/post-compaction.shexplicitly tells the model: "Call mem_session_summary β¦ Use project: '%s'" β an argument the Go server does not accept.projectfallback formem_session_summary(unreleased changelog entry), so the TypeScript lane and the Go MCP lane now disagree on the tool contract.Meanwhile
mem_savehonors a validated explicit selection viaresolveSaveWriteProjectWithProcessOverride(REQ-308) and returnsproject_source=explicit_override. The net effect: an agent that ends a session from a multi-repo workspace root can save observations withmem_save project=Xall session long, then cannot save the session summary for the same project at all.π Steps to Reproduce
mkdir -p ws/repo-a ws/repo-b && git -C ws/repo-a init && git -C ws/repo-b initmem_savefrom a repo namedmy-projectso it exists in the store)cd ws, callmem_session_summarywith{"content": "## Goal\nβ¦", "project": "my-project"}ambiguous_projecteven though a known project was named explicitly (andmem_savewith the identicalprojectargument from the same cwd succeeds)β Expected Behavior
mem_session_summaryaccepts the same validated explicit-project selection asmem_save: aprojectbacked by known store context (existing project, matching session, repo config, or ambiguous-recovery choice) is honored withproject_source=explicit_override; unbacked names still fail loudly (no arbitrary buckets); omittedprojectkeeps today's auto-detect +ENGRAM_PROJECT/--projectbehavior.β Actual Behavior
returned regardless of any
project/project_choice_reason/recovery_tokenargument, and (unlike mem_save) with norecovery_tokenminted for this tool's own error path prior to the fix.π₯οΈ Environment
main@ be4b613 and v1.19.0)π‘ Additional Context
Fix is implemented and ready on
uhhexe/engrambranchfix/session-summary-explicit-project-main: exposesproject/project_choice_reason/recovery_tokenon themem_session_summaryschema, routes explicit selections throughresolveSaveWriteProjectWithProcessOverride(identical REQ-308 validation asmem_save), leaves omitted-project behavior byte-for-byte unchanged, and passesactivityso ambiguous errors mint recovery tokens. Includes tests (explicit backed project bypasses ambiguous cwd; unbacked project fails loudly with no write; omitted project still errors; schema contract).go test ./...green. Happy to open the PR once this is approved.