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
{{ message }}
Repository navigation
memory_lesson_save MCP tool can't set sourceIds — lessons saved via MCP always have empty sources #1656
The memory_lesson_save MCP tool has no way to set sourceIds, so every lesson saved through MCP is stored with "sourceIds": []. The REST endpoint POST /agentmemory/lessons and mem::lesson-save both support sourceIds; only the MCP path drops it.
In the viewer, these lessons show "No sources recorded. This lesson was saved by hand without sourceIds" and suggest re-saving via curl with sourceIds. An agent calling the MCP tool can't follow that advice, because the tool doesn't accept the field.
Handler: src/mcp/server.ts#L1133-L1149. It builds the mem::lesson-save payload with source: "manual" and never passes sourceIds, even if a client sends it.
src/functions/lessons.ts stores them on create and merges them (mergeSourceIds) when a duplicate save strengthens an existing lesson.
Repro
Call memory_lesson_save over MCP with { "content": "…", "context": "…", "project": "…" }. The tool offers no sourceIds field to pass.
Open the lesson in the viewer, or read the raw record.
Result: "source": "manual", "sourceIds": [], plus the "No sources recorded" notice.
Seen on v0.9.31 through the Claude Code plugin.
Expected
An agent saving a lesson mid-session should be able to link it to the session (or memory, observation or crystal) it came from, the same way the REST endpoint allows.
Suggested fix
Add sourceIds to the memory_lesson_save input schema, e.g. { type: "array", items: { type: "string" }, description: "Ids of the session, memory, observation or crystal this lesson came from" }. A comma-separated string would also match the existing tags convention.
In the handler, run it through normalizeLessonSourceIds, return a 400 with the REST endpoint's message when it's invalid, and pass sourceIds to mem::lesson-save.
Activity
rohitg00 commentedon Nov 4, 2026
Fixed on main by #1661: memory_lesson_save now accepts sourceIds, validated the same way as the REST endpoint. Ships in 0.9.32.