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
+61-2Lines changed: 61 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,29 @@ 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:
44
+
If a write tool returns `ambiguous_project`, the agent must not guess. This happens when the MCP server is started from a parent directory that contains multiple repositories, for example:
45
+
46
+
```text
47
+
/Users/you/work
48
+
├── alan-thegentleman/
49
+
├── angular-18-jest-playwright/
50
+
└── engram/
51
+
```
52
+
53
+
The first write fails with an error like:
54
+
55
+
```json
56
+
{
57
+
"error_code": "ambiguous_project",
58
+
"available_projects": [
59
+
"alan-thegentleman",
60
+
"angular-18-jest-playwright",
61
+
"engram"
62
+
]
63
+
}
64
+
```
65
+
66
+
Ask the user to choose exactly one value from `available_projects`, then retry only `mem_save` or `mem_save_prompt` with both recovery fields:
45
67
46
68
```json
47
69
{
@@ -50,7 +72,44 @@ If a write tool returns `ambiguous_project`, the agent must not guess. Ask the u
50
72
}
51
73
```
52
74
53
-
This recovery path is accepted only after cwd detection is ambiguous and only when `project`, after trimming surrounding whitespace, exactly matches one of the reported `available_projects`. Do not send normalized variants or guesses: if `available_projects` contains `foo--bar`, the retry must use `foo--bar`, not `foo-bar`; empty/whitespace choices are rejected. 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`.
75
+
On success, Engram writes to the selected project and reports the recovery source:
This is a narrow rescue path, not a free-form project override:
88
+
89
+
- Recovery is accepted only after cwd detection failed with `ambiguous_project`.
90
+
-`project_choice_reason` must be exactly `user_selected_after_ambiguous_project`.
91
+
-`project`, after trimming surrounding whitespace, must exactly match one of the reported `available_projects`.
92
+
- Normalized variants and guesses are rejected: if `available_projects` contains `foo--bar`, retry with `foo--bar`, not `foo-bar`.
93
+
- Empty or whitespace-only choices are rejected.
94
+
- In all non-ambiguous cases, `.engram/config.json`/git/cwd detection remains authoritative and the explicit `project` field is ignored.
95
+
96
+
Mental model:
97
+
98
+
```text
99
+
mem_save fails with ambiguous_project
100
+
↓
101
+
Engram returns available_projects
102
+
↓
103
+
agent asks the user to choose one exact value
104
+
↓
105
+
agent retries with project + project_choice_reason
106
+
↓
107
+
Engram validates the choice came from ambiguity
108
+
↓
109
+
Engram saves to the selected project
110
+
```
111
+
112
+
Alternatives: `cd` into the target repo before starting the MCP server, or add repo `.engram/config.json`.
54
113
55
114
**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.
0 commit comments