Skip to content

Conversation

vinci-grape
Copy link
Collaborator

Change Summary

  • Add complete Mem0AI memory implementation with Mem0Memory class and SharedMemoryManager
  • Remove legacy mem0.py stub and implement full memory functionality
  • Integrate shared memory manager into LLMAgent for session and procedural memory
  • Add memory persistence capabilities for conversation and procedural memory
  • Refine architecture, coding, and refinement workflows with memory-aware processing

Related issue number

Checklist

  • The pull request title is a good summary of the changes - it will be used in the changelog
  • Unit tests for the changes exist
  • Run pre-commit install and pre-commit run --all-files before git commit, and passed lint check.
  • Documentation reflects the changes where applicable

Copy link

Summary of Changes

Hello @vinci-grape, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly upgrades the project's memory management by integrating Mem0AI. It introduces a robust system for shared and persistent memory within the LLMAgent, enabling more sophisticated conversational and procedural context retention. The changes span core agent logic, memory utilities, and project configurations, ensuring that the new memory capabilities are seamlessly incorporated into the existing workflows.

Highlights

  • Mem0 Integration: Introduced a complete Mem0AI memory implementation, including a Mem0Memory class and a SharedMemoryManager for efficient memory handling across agents.
  • LLMAgent Memory Management: Integrated the shared memory manager into the LLMAgent to support session and procedural memory, replacing a legacy mem0.py stub.
  • Memory Persistence: Added capabilities for persisting both conversation and procedural memories, allowing agents to retain context across interactions.
  • Workflow Refinements: Updated architecture, coding, and refinement workflows to leverage the new memory-aware processing, including changes to prompts and callback logic.
  • Dependency Updates: Added chromadb and mem0ai to the project requirements to support the new memory features.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request successfully integrates Mem0 for memory management, introducing a SharedMemoryManager and the Mem0Memory implementation. The changes enable the agent to handle both conversational and procedural memory, which is a great enhancement. My review focuses on improving code quality and robustness. I've identified a few issues, including an unused import, leftover commented code, a brittle string manipulation that could lead to bugs, and a typo in a configuration file's prompt. Addressing these points will make the new memory feature more reliable and the codebase cleaner.


if system_message and hasattr(system_message, 'content'):
# Append memories to existing system message
system_message.content = system_message.content.split("\n\nUser Memories:\n")[0]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using split("\n\nUser Memories:\n") to remove previous memories before injecting new ones is brittle. If the original system message contains this string for any other reason, it will be unintentionally truncated, which could lead to incorrect agent behavior. A more robust approach should be considered, such as storing the base system prompt separately and reconstructing it with the latest memories in each turn.

f'which supports: {list(memory_mapping.keys())}')
self.memory_tools.append(memory_mapping[_memory.name](
self.config))
if _memory.name == 'mem0':
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move the memory module to parent dir as an independent module.

Refer to this PR: #721

json5
markdown
mcp
mem0ai
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be optional dependency ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

"""Load and initialize memory components from the config."""
if hasattr(self.config, 'memory'):
for _memory in (self.config.memory or []):
assert _memory.name in memory_mapping, (
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint:

pip install pre-commit 
pre-commit run --all-files   (if needed)

def check_runtime():
try:
os.system('pkill -f node')
# os.system('pkill -f node')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete code, not comment code if they are not needed

@wangxingjun778 wangxingjun778 merged commit b8a582f into main Sep 22, 2025
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants