Skip to content

memory_lesson_save MCP tool can't set sourceIds — lessons saved via MCP always have empty sources #1656

Closed

Description

@onelaview

Summary

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.

Where

At c6c476d (current main):

Repro

  1. Call memory_lesson_save over MCP with { "content": "…", "context": "…", "project": "…" }. The tool offers no sourceIds field to pass.
  2. Open the lesson in the viewer, or read the raw record.
  3. 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

  1. 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.
  2. 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.
  3. Optionally, document it alongside docs: memory_lesson_save MCP tool exists but is completely undocumented (confidence, decay, reinforcement lifecycle) #552, which covers the tool's undocumented confidence and decay lifecycle.

Related

Activity

  1. rohitg00 commented on Nov 4, 2026

    @rohitg00
    Owner

    Fixed on main by #1661: memory_lesson_save now accepts sourceIds, validated the same way as the REST endpoint. Ships in 0.9.32.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions