Skip to content

feat(pi-memory-mem0): add agentId support for memory isolation#71

Open
sirusdas wants to merge 2 commits into
TGYD-helige:masterfrom
sirusdas:feature/add-agentid-support
Open

feat(pi-memory-mem0): add agentId support for memory isolation#71
sirusdas wants to merge 2 commits into
TGYD-helige:masterfrom
sirusdas:feature/add-agentid-support

Conversation

@sirusdas

Copy link
Copy Markdown

Summary

This PR adds configuration support to the pi-memory-mem0 extension, allowing memory isolation between different agents or profiles.

Changes

  • Add to type
  • Update interface to accept in opts
  • Update to pass in filters
  • Update to pass in filters
  • Update class to accept
  • Update to accept
  • Update to load and pass from config
  • Update to document configuration

Configuration

Add the following to your :

Usage

Once configured, pi will:

  1. Store memories with in the mem0 server
  2. Search memories filtered by
  3. List memories filtered by

This allows pi to have its own isolated memory space while sharing the same mem0 server as other agents.

Testing

The changes have been tested and verified to:

  • Add memories with agent_id=pi ✓
  • Search memories filtered by agent_id=pi ✓
  • List memories filtered by agent_id=pi ✓
  • Keep other agent memories separate (agent_id=hermes) ✓

sirusdas added 2 commits June 29, 2026 08:57
Add agentId configuration option to pi-memory-mem0 extension to allow
memory isolation between different agents or profiles.

Changes:
- Add agentId to Mem0ExtensionConfig type
- Update Mem0Provider interface to accept agentId in opts
- Update PlatformProvider to pass agentId in filters
- Update OSSProvider to pass agentId in filters
- Update Prefetch class to accept agentId
- Update createMem0Tools to accept agentId
- Update index.ts to load and pass agentId from config
- Update README.md to document agentId configuration

This allows multiple agents to share the same mem0 server while
maintaining separate memory spaces based on agent_id.
Add support for dynamic agent_id selection based on the current working
directory. This allows pi to automatically use the correct agent_id
when working on different projects.

Changes:
- Add resolveAgentId function with project mapping support
- Load project mapping from ~/.pi/agent/mem0-project-mapping.json
- Match current directory against patterns to determine agent_id
- Update README.md to document dynamic agent_id selection

Configuration:
Create ~/.pi/agent/mem0-project-mapping.json with project patterns:

{
  "mappings": [
    {
      "pattern": "*farmneed*|*hrms*",
      "agentId": "hermes-fhrms",
      "description": "Farmneed HRMS project"
    },
    {
      "pattern": "*",
      "agentId": "pi",
      "description": "Default pi agent"
    }
  ]
}
@sirusdas sirusdas force-pushed the feature/add-agentid-support branch from d1853ac to 79b4720 Compare June 29, 2026 06:29
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.

1 participant