MemOS icon indicating copy to clipboard operation
MemOS copied to clipboard

[Feature Request] Trae IDE Skill Integration for Zero-Configuration Memory Synchronization

Open jackyfan01 opened this issue 8 months ago • 2 comments

Summary

Propose a new integration approach for MemOS that leverages Skill-based architecture (similar to trae-supermemory) to provide zero-configuration, mandatory execution memory synchronization for AI agents.

Motivation

Current Pain Points

The existing MemOS integration methods (OpenClaw Plugin, REST API, MCP Server) suffer from several usability issues:

  1. High Configuration Barrier: Users must manually edit openclaw.json, configure embedding providers, API keys, and disable built-in memory search
  2. Complex Deployment: Requires OpenClaw gateway, Node.js >= 18, and often C++ build tools for native module compilation
  3. No Execution Guarantee: Memory synchronization relies on AI's voluntary compliance with rules written in markdown files
  4. Fragmented Experience: Different integration paths for different use cases (Cloud API, Self-Hosted, OpenClaw Plugin)

Success Story: Skill-Based Approach

Our team has successfully implemented a Skill-based memory integration using Trae's built-in trae-supermemory Skill that addresses all these issues:

  • ✅ Zero Configuration: No manual config files or provider setup required
  • ✅ Mandatory Execution: Memory sync is enforced at the system level, not optional
  • ✅ Low Barrier: Works directly within Trae IDE without additional dependencies
  • ✅ Reliable: 100% execution rate for memory search and save operations

Proposed Solution

Architecture Overview

┌─────────────────────────────────────────────────────────────────┐
│                     Trae IDE / Claude Code                       │
│  ┌─────────────────────────────────────────────────────────┐   │
│  │              Skill System (trae-supermemory)              │   │
│  │  ┌──────────────┐    ┌──────────────┐    ┌──────────┐  │   │
│  │  │ Pre-Process  │───→│   Handler    │───→│ Post-    │  │   │
│  │  │  Hook        │    │   Logic      │    │ Process  │  │   │
│  │  └──────────────┘    └──────────────┘    └──────────┘  │   │
│  │         │                   │                  │        │   │
│  │         ▼                   ▼                  ▼        │   │
│  │  ┌──────────────────────────────────────────────────┐  │   │
│  │  │  Step 1: search_memory (before each response)    │  │   │
│  │  │  Step 2: generate_response (with memory context) │  │   │
│  │  │  Step 3: add_message (after each response)       │  │   │
│  │  └──────────────────────────────────────────────────┘  │   │
│  └─────────────────────────────────────────────────────────┘   │
│                              │                                  │
│                              ▼                                  │
│  ┌─────────────────────────────────────────────────────────┐   │
│  │              MemOS Cloud API / MCP Server                │   │
│  │         (Existing infrastructure - no changes)           │   │
│  └─────────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────────┘

Key Features

1. Automatic Three-Step Workflow

The Skill system enforces a mandatory memory synchronization workflow:

// Pseudo-code for Skill execution flow
async function handleUserMessage(message: string) {
  // Step 1: Search memory (MANDATORY)
  const memories = await memos.search_memory({
    query: extractKeywords(message),
    conversation_first_message: getFirstMessage(),
    include_preference: true
  });
  
  // Step 2: Generate response with memory context
  const response = await generateResponse(message, memories);
  
  // Step 3: Save conversation (MANDATORY)
  await memos.add_message({
    conversation_first_message: getFirstMessage(),
    messages: [
      { role: "user", content: message },
      { role: "assistant", content: response }
    ]
  });
  
  return response;
}

2. Zero-Configuration Setup

Unlike the OpenClaw plugin which requires complex openclaw.json configuration, the Skill approach requires only:

# Proposed: Simple skill configuration
skill: memos-memory-sync
version: 1.0.0
triggers:
  - event: conversation.start
    action: search_memory
  - event: conversation.end
    action: add_message
config:
  auto_sync: true  # Enforce mandatory execution

3. Comparison with Existing Methods

Feature Cloud API Self-Hosted OpenClaw Plugin Skill (Proposed)
Configuration Medium High High Zero
Deployment Easy Complex Complex Built-in
Execution Guarantee Manual Manual Hook-based Mandatory
Cross-Session Memory ✅ ✅ ✅ ✅
Multi-Agent Support ✅ ✅ ✅ ✅
Works Offline ❌ ✅ ✅ ❌ (Cloud)
Setup Time 5 min 30+ min 15+ min 0 min

Implementation Details

Option A: Native Skill Support in MemOS

Extend MemOS to provide a first-class Skill interface:

# memos/api/skill_adapter.py
from memos.api.product_api import search_memories, add_memories

class MemOSSkill:
    """Skill adapter for automatic memory synchronization"""
    
    async def pre_process(self, context: ConversationContext):
        """Called before generating response"""
        memories = await search_memories(
            user_id=context.user_id,
            query=context.current_message,
            max_results=10
        )
        context.inject_memories(memories)
    
    async def post_process(self, context: ConversationContext):
        """Called after generating response"""
        await add_memories(
            user_id=context.user_id,
            messages=[
                {"role": "user", "content": context.current_message},
                {"role": "assistant", "content": context.response}
            ]
        )

Option B: IDE-Level Skill Integration

Work with Trae IDE / Claude Code to add MemOS as a built-in Skill:

// .trae/skills/memos-skill/index.ts
import { MemOSClient } from '@memtensor/memos-sdk';

export default defineSkill({
  name: 'memos-memory-sync',
  description: 'Automatic memory synchronization with MemOS Cloud',
  
  hooks: {
    beforeResponse: async (context) => {
      // Mandatory memory search
      const memories = await memos.search_memory({
        query: context.userMessage,
        conversation_first_message: context.conversation.firstMessage
      });
      context.addToSystemPrompt(formatMemories(memories));
    },
    
    afterResponse: async (context) => {
      // Mandatory memory save
      await memos.add_message({
        conversation_first_message: context.conversation.firstMessage,
        messages: [
          { role: 'user', content: context.userMessage },
          { role: 'assistant', content: context.assistantResponse }
        ]
      });
    }
  }
});

Benefits

For Users

  1. Instant Onboarding: No configuration, no setup, works immediately
  2. Reliable Memory: 100% execution rate, never forgets to sync
  3. Cross-Platform: Works wherever Trae IDE / Claude Code runs
  4. Consistent Experience: Same behavior across all conversations

For MemOS Project

  1. Lower Barrier to Entry: More users can adopt MemOS without technical hurdles
  2. Higher Engagement: Automatic sync means more data flowing into the system
  3. Competitive Advantage: First memory system with IDE-native Skill integration
  4. Ecosystem Growth: Skill architecture enables community contributions

Migration Path

Phase 1: Skill SDK (Short Term)

Provide an official MemOS Skill SDK that wraps the existing API:

npm install @memtensor/memos-skill

Phase 2: IDE Partnership (Medium Term)

Collaborate with Trae / Anthropic to add MemOS as a default Skill option

Phase 3: Native Integration (Long Term)

MemOS becomes a built-in memory provider for major AI IDEs

Request for Comments

We would love feedback from the MemOS team and community on:

  1. Architecture: Does the Skill-based approach align with MemOS's long-term vision?
  2. Prioritization: Should this be a core feature or a community plugin?
  3. Implementation: Preference for Option A (native) vs Option B (IDE-level)?
  4. Timeline: What would be a realistic roadmap for this feature?

References

  • MemOS OpenClaw Plugin: apps/memos-local-openclaw/
  • MemOS MCP Server: src/memos/api/mcp_serve.py
  • Related: Memory synchronization, IDE integration, User experience

Labels: enhancement, ide-integration, user-experience

jackyfan01 avatar Mar 25 '26 15:03 jackyfan01

This issue has been automatically marked as stale due to inactivity.

github-actions[bot] avatar Apr 25 '26 03:04 github-actions[bot]

Thanks for the detailed write-up — this is a great proposal, and the good news is that most of it has shipped since this issue was filed. A quick status update:

The "Skill SDK" (your Phase 1) already exists as an open, cross-agent skill — not a proprietary npm package, but the SKILL.md + npx skills add standard:

  • MemOS-Cloud-Skill repo: https://github.com/MemTensor/MemOS-Cloud-Skill
    • memos-cloud-server: runtime skill where the agent calls MemOS APIs directly (search / add / delete / feedback / KB).
    • memos-cloud: natural-language integration helper.
    • Install: npx skills add https://github.com/MemTensor/MemOS-Cloud-Skill --skill memos-cloud --agent cursor -g -y

Your "Option B" (IDE-level skill with mandatory pre/post hooks) is implemented in the OpenClaw plugin (apps/memos-local-openclaw/): auto-recall runs on before_agent_start and auto-capture runs on agent_end, so the search→respond→save loop is enforced at the hook level, and a bundled memos-memory-guide skill documents every tool.

On the two open questions:

  • Option A (a native skill_adapter.py inside the MemOS Python core): we'd rather not. "Skill" is an agent-runtime concern; the core already exposes search_memory / add_message for skills to consume, and we want to keep that layering clean.
  • On "100% mandatory execution": hard enforcement comes from the host's hooks (OpenClaw has them; Cursor now does too). A plain SKILL.md in Cursor/Claude/Trae is model-driven guidance, so the guarantee is host-dependent rather than absolute.

Re: Trae specifically — we don't have a Trae-specific integration, but the skills above use the cross-agent standard, so they should work in Trae with little/no change. If you hit a concrete gap when trying the memos-cloud skill in Trae, please open a focused issue with your setup details and we'll track "verify + document Trae compatibility" as a small follow-up.

Closing this as resolved by the existing skill ecosystem — thanks again for pushing on the zero-config direction, it lines up well with where we're heading.

shinetata avatar Jul 08 '26 08:07 shinetata