You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/AGENT-SETUP.md
+12-1Lines changed: 12 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,7 +27,7 @@ Engram works with **any MCP-compatible agent**. Pick your agent below.
27
27
28
28
### Project auto-detection (important)
29
29
30
-
**Do not pass `project` to write tools.** Engram auto-detects the project from the server's working directory (cwd) using `.engram/config.json`, git remote URL, repo root name, or directory basename. Agents that include `project` in `mem_save` or similar calls will have that argument silently discarded.
30
+
**Do not pass `project` to write tools during normal operation.** Engram auto-detects the project from the server's working directory (cwd) using `.engram/config.json`, git remote URL, repo root name, or directory basename. Agents that include `project` in `mem_save` or similar calls will have that argument ignored unless they are using the explicit ambiguous-project recovery flow below.
31
31
32
32
To lock write tools to the canonical project for a repo, add `.engram/config.json` at the repo root:
33
33
@@ -41,6 +41,17 @@ When present, `project_name` is used for writes from the repo and its subdirecto
41
41
42
42
**Recommended first call:**`mem_current_project` — confirms which project Engram detected before you start writing. Returns `project_source` (how it was detected) and `available_projects` (if cwd is ambiguous).
43
43
44
+
If a write tool returns `ambiguous_project`, the agent must not guess. Ask the user to choose one of `available_projects`, then retry only `mem_save` or `mem_save_prompt` with both fields:
This recovery path is accepted only after cwd detection is ambiguous and only when `project` exactly matches one of the reported `available_projects`. In all non-ambiguous cases, `.engram/config.json`/git/cwd detection remains authoritative and the explicit `project` is ignored. Alternatives: `cd` into the target repo before starting the MCP server, or add repo `.engram/config.json`.
54
+
44
55
**Read tools** (`mem_search`, `mem_context`, `mem_get_observation`, `mem_stats`, `mem_timeline`) accept an optional `project` override validated against the store. Omit it to auto-detect.
Copy file name to clipboardExpand all lines: internal/mcp/mcp.go
+80-6Lines changed: 80 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -328,6 +328,12 @@ Examples:
328
328
mcp.WithString("topic_key",
329
329
mcp.Description("Optional topic identifier for upserts (e.g. architecture/auth-model). Reuses and updates the latest observation in same project+scope."),
330
330
),
331
+
mcp.WithString("project",
332
+
mcp.Description("Optional recovery target only after ambiguous_project. Ignored unless project_choice_reason is user_selected_after_ambiguous_project."),
333
+
),
334
+
mcp.WithString("project_choice_reason",
335
+
mcp.Description("Must be user_selected_after_ambiguous_project, and only after the user explicitly chose one of available_projects from an ambiguous_project error."),
mcp.Description("Session ID to associate with (default: manual-save-{project})"),
435
441
),
442
+
mcp.WithString("project",
443
+
mcp.Description("Optional recovery target only after ambiguous_project. Ignored unless project_choice_reason is user_selected_after_ambiguous_project."),
444
+
),
445
+
mcp.WithString("project_choice_reason",
446
+
mcp.Description("Must be user_selected_after_ambiguous_project, and only after the user explicitly chose one of available_projects from an ambiguous_project error."),
envelope["hint"] ="Use mem_current_project to inspect detection results, or cd into one of the listed repositories."
2022
+
envelope["hint"] ="Ask the user to choose one of available_projects, then retry mem_save or mem_save_prompt with project and project_choice_reason=user_selected_after_ambiguous_project; alternatively cd into the target repo or add repo .engram/config.json."
2023
+
case"invalid_project_choice":
2024
+
envelope["hint"] ="Use exactly one of available_projects after asking the user, or cd into the target repo, or add repo .engram/config.json."
1951
2025
case"unknown_project":
1952
2026
envelope["hint"] ="Use one of the available_projects values, or omit project to auto-detect."
0 commit comments