mindcraft icon indicating copy to clipboard operation
mindcraft copied to clipboard

Enhanced memory capability

Open Ninot1Quyi opened this issue 9 months ago • 2 comments

Last Edited:2025-4-14 22:16

1. Modify Memory Storage Format

  • [x] Change memory in memory.json from a single string to a list format with timestamps
  • [x] Implement generating a summary every summary_chunk_size messages and storing it in the list
  • [x] Ensure list elements follow the format: ["example summary 1", "example summary 2"]
  • [x] Update memory storage to structured format with fields like example:
    "memories": [
      {
        "id": "base36_6bit",
        "created_at": "YYYY-MM-DD HH:MM:SS",
        "memory": "example memory description",
        "trigger_type": "auto/user_flagged",
        "message_timeframe": {
          "earliest": "YYYY-MM-DD HH:MM:SS",
          "latest": "YYYY-MM-DD HH:MM:SS"
        }
      }
    ]
    
    And history turns example:
    "turns": [
      {
        "role": "user/assistant",
        "content": "xxxx",
        "created_at": "2025-03-26 20:47:06"
      }
    ]
    
  • [x] Test if the compressed history is neat and practical

2. Add New Command !reflectionToMem [num]

  • [x] Add the !reflectionToMem [num] command to COMMAND
  • [x] Implement default behavior to summarize the last 5 conversations and add to memory when no parameter is provided
  • [x] Support custom conversation ranges when a parameter is given (e.g., !reflectionToMem 10 summarizes the last 10)
  • [x] Add automatic extraction to summaries every summary_chunk_size messages
  • [x] Test the command’s flexibility and correctness

3. Optimize Memory Saving and Summary Details

  • [x] Adjust the saving_memory prompt in profiles/defaults/_default.json to be more reasonable
  • [x] Adjust the ratio of summary to details to enable LLM to grasp information at different levels

4. Complete the CRUD of Memory

  • [x] [Read] Memory retrieval: Integrate embedding vectors for memory relevance retrieval
    • Implemented semantic search with cosine similarity for context-aware memory retrieval
    • Created table format display with memory ID, type, timestamp and content columns
    • Modified display to hide timestamps for knowledge-type memories
  • [x] [Create] Memory addition: Implemented structured memory creation with timestamps and type classification
    • Added LLM-driven memory operations via JSON commands (newMem)
  • [x] [Update&Delete] Memory merging:
    • Added LLM-driven memory operations via JSON commands (mergeMem/noMerge)
    • Implemented memory type support (event/knowledge) with appropriate display formatting
    • Added robust error handling for partial merges when some memory IDs aren't found
    • Created detailed operation logging system for tracking all memory manipulations
  • [x] Add a configuration option in settings.json to adjust retrieval count (default 10, -1 for all)

5. Code Validation

  • [ ] Test whether the memory module is working properly
  • [ ] Compare the new memory management method with the original method to check whether the performance is improved
  • [ ] Count the change in the number of memories, and the change in the number of different kinds of memories

6. Code Optimization

  • [ ] Optimize memory management prompt
  • [ ] Check if the modified code is concise and meets project requirements
  • [ ] Run full tests to ensure new features don’t affect existing functionality
  • [ ] Discuss with Max or the team to confirm if the implementation meets expectations

Notes

  • Mark tasks as completed with a check (- [x]) to track progress.
  • Add any additional requirements or adjustments to this list as needed.

Ninot1Quyi avatar Mar 26 '25 13:03 Ninot1Quyi

Last Edited:2025-4-20 14:59

I'm adding MCP support to supercharge the MindCraft community and unlock a ton of new possibilities for Andy! 🎉

Down the road, I’ll implement Memory as a pluggable MCP Server component, making it easy to swap in and out as needed.

Ninot1Quyi avatar Apr 20 '25 06:04 Ninot1Quyi

Added the Memory tool from the official Model Context Protocol (MCP) example using MCP, enabling the storage of memories in a knowledge graph.

Please refer to the methods in this PR: https://github.com/kolbytn/mindcraft/pull/508#issue-3007100329

Ninot1Quyi avatar Apr 20 '25 17:04 Ninot1Quyi

I would love to see this in Mindcraft-CE

Sweaterdog avatar Jun 30 '25 10:06 Sweaterdog