Skip to content

[Tech Debt] Fix Memory documentation examples and clarify long-term memory isolation #794

Closed

Description

@joeyutong

Search before asking

  • I searched in the issues and found nothing similar.

Description

The Memory documentation has several documentation and code-snippet issues that can mislead users or make examples fail when copied.

  1. Long-Term Memory context isolation is described more strongly than the current implementation guarantees.

    The docs state that each keyed partition maintains isolated memories and that using the same memory set name across partitions is safe. However, the runtime currently switches the long-term-memory context with String.valueOf(key.hashCode()), for example in ActionTaskContextManager and PythonActionTask. That means the documented isolation guarantee depends on the hash value rather than the full original key, and hash collisions could share the same Mem0 context.

    Suggested fix: either change the implementation to use a stable, collision-free key serialization for the LTM context, or soften the documentation to match the actual boundary and limitations.

  2. The Java Long-Term Memory complete example does not compile as written.

    It uses:

    String userQuery = inputEvent.getInput();

    but InputEvent#getInput() returns Object. The example should use String.valueOf(inputEvent.getInput()) or an explicit cast if the input type is known.

  3. The "Complete Example" section is not actually complete.

    The Python example class does not extend Agent and does not declare the chat model, embedding model, or vector store resources referenced by the configuration. The Java tab only shows an action method, not a complete agent or full resource/config wiring.

    Suggested fix: either rename the section to "Usage snippet" or make the examples genuinely runnable.

  4. The Java usage path for Mem0 Long-Term Memory has a runtime version constraint that is not documented.

    The runtime throws when Mem0 is configured together with Java actions and the Flink/Pemja version does not support the required async behavior. The Long-Term Memory page includes Java examples, so it should mention this prerequisite or limitation.

  5. The Java MemoryRef example in the Sensory & Short-Term Memory page casts resolve(ctx) directly to the user payload type.

    The example currently suggests:

    processedData = (ProcessedData) myEvent.getValue().resolve(ctx);

    but Java MemoryRef#resolve returns a MemoryObject. The example should resolve the object and then read the value, for example:

    processedData = (ProcessedData) myEvent.getValue().resolve(ctx).getValue();

Are you willing to submit a PR?

  • I'm willing to submit a PR!

Metadata

Metadata

Assignees

Labels

fixVersion/0.3.0The feature or bug should be implemented/fixed in the 0.3.0 version.priority/blockerIndicates the PR or issue that should block the release until it gets resolved.tech debt[Issue Type] User-unaware issues, such as code refactor and infrastructure maintenance.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions