[{"data":1,"prerenderedAt":632},["ShallowReactive",2],{"/open_source/modules/mem_scheduler":3,"surround-/open_source/modules/mem_scheduler":617},{"id":4,"title":5,"avatar":6,"banner":6,"body":7,"category":6,"desc":610,"description":597,"extension":611,"links":6,"meta":612,"navigation":6,"path":613,"seo":614,"stem":615,"__hash__":616},"docs/en/open_source/modules/mem_scheduler.md","MemScheduler: The Scheduler for Memory Organization",null,{"type":8,"value":9,"toc":596},"minimark",[10,15,64,68,77,116,120,123,128,181,185,188,191,314,317,320,559,563,572,576,579,593],[11,12,14],"h2",{"id":13},"key-features","Key Features",[16,17,18,27,34,41,48,55,62],"ul",{},[19,20,21,22,26],"li",{},"🚀 ",[23,24,25],"strong",{},"Concurrent operation"," with MemOS system",[19,28,29,30,33],{},"🧠 ",[23,31,32],{},"Multi-memory coordination"," (Working/Long-Term/User memory)",[19,35,36,37,40],{},"⚡ ",[23,38,39],{},"Event-driven scheduling"," for memory operations",[19,42,43,44,47],{},"🔍 ",[23,45,46],{},"Efficient retrieval"," of relevant memory items",[19,49,50,51,54],{},"📊 ",[23,52,53],{},"Comprehensive monitoring"," of memory usage",[19,56,57,58,61],{},"📝 ",[23,59,60],{},"Detailed logging"," for debugging and analysis",[19,63],{},[11,65,67],{"id":66},"memory-scheduler-architecture","Memory Scheduler Architecture",[69,70,71,72,76],"p",{},"The ",[73,74,75],"code",{},"MemScheduler"," system is structured around several key components:",[78,79,80,86,92,98,104,110],"ol",{},[19,81,82,85],{},[23,83,84],{},"Message Handling",": Processes incoming messages through a dispatcher with labeled handlers",[19,87,88,91],{},[23,89,90],{},"Memory Management",": Manages different memory types (Working, Long-Term, User)",[19,93,94,97],{},[23,95,96],{},"Retrieval System",": Efficiently retrieves relevant memory items based on context",[19,99,100,103],{},[23,101,102],{},"Monitoring",": Tracks memory usage, frequencies, and triggers updates",[19,105,106,109],{},[23,107,108],{},"Dispatcher (Router)",": Trigger different memory reorganization strategies by checking messages from MemOS systems.",[19,111,112,115],{},[23,113,114],{},"Logging",": Maintains logs of memory operations for debugging and analysis",[11,117,119],{"id":118},"message-processing","Message Processing",[69,121,122],{},"The scheduler processes messages through a dispatcher with dedicated handlers:",[124,125,127],"h3",{"id":126},"message-types","Message Types",[129,130,131,147],"table",{},[132,133,134],"thead",{},[135,136,137,141,144],"tr",{},[138,139,140],"th",{},"Message Type",[138,142,143],{},"Handler Method",[138,145,146],{},"Description",[148,149,150,166],"tbody",{},[135,151,152,158,163],{},[153,154,155],"td",{},[73,156,157],{},"QUERY_LABEL",[153,159,160],{},[73,161,162],{},"_query_message_consume",[153,164,165],{},"Handles user queries and triggers retrieval",[135,167,168,173,178],{},[153,169,170],{},[73,171,172],{},"ANSWER_LABEL",[153,174,175],{},[73,176,177],{},"_answer_message_consume",[153,179,180],{},"Processes answers and updates memory usage",[124,182,184],{"id":183},"schedule-message-structure","Schedule Message Structure",[69,186,187],{},"The scheduler processes messages from its queue using the following format:",[69,189,190],{},"ScheduleMessageItem:",[129,192,193,205],{},[132,194,195],{},[135,196,197,200,203],{},[138,198,199],{},"Field",[138,201,202],{},"Type",[138,204,146],{},[148,206,207,222,236,250,270,285,299],{},[135,208,209,214,219],{},[153,210,211],{},[73,212,213],{},"item_id",[153,215,216],{},[73,217,218],{},"str",[153,220,221],{},"UUID (auto-generated) for unique identification",[135,223,224,229,233],{},[153,225,226],{},[73,227,228],{},"user_id",[153,230,231],{},[73,232,218],{},[153,234,235],{},"Identifier for the associated user",[135,237,238,243,247],{},[153,239,240],{},[73,241,242],{},"mem_cube_id",[153,244,245],{},[73,246,218],{},[153,248,249],{},"Identifier for the memory cube",[135,251,252,257,261],{},[153,253,254],{},[73,255,256],{},"label",[153,258,259],{},[73,260,218],{},[153,262,263,264,266,267,269],{},"Message label (e.g., ",[73,265,157],{},", ",[73,268,172],{},")",[135,271,272,277,282],{},[153,273,274],{},[73,275,276],{},"mem_cube",[153,278,279],{},[73,280,281],{},"GeneralMemCube｜str",[153,283,284],{},"Memory cube object or reference",[135,286,287,292,296],{},[153,288,289],{},[73,290,291],{},"content",[153,293,294],{},[73,295,218],{},[153,297,298],{},"Message content",[135,300,301,306,311],{},[153,302,303],{},[73,304,305],{},"timestamp",[153,307,308],{},[73,309,310],{},"datetime",[153,312,313],{},"Time when the message was submitted",[69,315,316],{},"Meanwhile the scheduler will send the scheduling messages by following structures.",[69,318,319],{},"ScheduleLogForWebItem:",[129,321,322,335],{},[132,323,324],{},[135,325,326,328,330,332],{},[138,327,199],{},[138,329,202],{},[138,331,146],{},[138,333,334],{},"Default Value",[148,336,337,356,372,387,402,438,454,470,506,540],{},[135,338,339,343,347,350],{},[153,340,341],{},[73,342,213],{},[153,344,345],{},[73,346,218],{},[153,348,349],{},"Unique log entry identifier (UUIDv4)",[153,351,352,353,269],{},"Auto-generated (",[73,354,355],{},"uuid4()",[135,357,358,362,366,369],{},[153,359,360],{},[73,361,228],{},[153,363,364],{},[73,365,218],{},[153,367,368],{},"Associated user identifier",[153,370,371],{},"(Required)",[135,373,374,378,382,385],{},[153,375,376],{},[73,377,242],{},[153,379,380],{},[73,381,218],{},[153,383,384],{},"Linked memory cube ID",[153,386,371],{},[135,388,389,393,397,400],{},[153,390,391],{},[73,392,256],{},[153,394,395],{},[73,396,218],{},[153,398,399],{},"Log category identifier",[153,401,371],{},[135,403,404,409,413,436],{},[153,405,406],{},[73,407,408],{},"from_memory_type",[153,410,411],{},[73,412,218],{},[153,414,415,416,419,420,422,423,426,422,428,431,422,433],{},"Source memory partition",[417,418],"br",{},"Possible values:",[417,421],{},"- ",[73,424,425],{},"\"LongTermMemory\"",[417,427],{},[73,429,430],{},"\"UserMemory\"",[417,432],{},[73,434,435],{},"\"WorkingMemory\"",[153,437,371],{},[135,439,440,445,449,452],{},[153,441,442],{},[73,443,444],{},"to_memory_type",[153,446,447],{},[73,448,218],{},[153,450,451],{},"Destination memory partition",[153,453,371],{},[135,455,456,461,465,468],{},[153,457,458],{},[73,459,460],{},"log_content",[153,462,463],{},[73,464,218],{},[153,466,467],{},"Detailed log message",[153,469,371],{},[135,471,472,477,482,485],{},[153,473,474],{},[73,475,476],{},"current_memory_sizes",[153,478,479],{},[73,480,481],{},"MemorySizes",[153,483,484],{},"Current memory utilization",[153,486,487],{},[488,489,490,491,493,494,496,497,499,500,502,503,505],"pre",{},"DEFAULT_MEMORY_SIZES = {",[417,492],{},"  \"long_term_memory_size\": -1,",[417,495],{},"  \"user_memory_size\": -1,",[417,498],{},"  \"working_memory_size\": -1,",[417,501],{},"  \"transformed_act_memory_size\": -1",[417,504],{},"}",[135,507,508,513,518,521],{},[153,509,510],{},[73,511,512],{},"memory_capacities",[153,514,515],{},[73,516,517],{},"MemoryCapacities",[153,519,520],{},"Memory partition limits",[153,522,523],{},[488,524,525,526,528,529,531,532,534,535,537,538,505],{},"DEFAULT_MEMORY_CAPACITIES = {",[417,527],{},"  \"long_term_memory_capacity\": 10000,",[417,530],{},"  \"user_memory_capacity\": 10000,",[417,533],{},"  \"working_memory_capacity\": 20,",[417,536],{},"  \"transformed_act_memory_capacity\": -1",[417,539],{},[135,541,542,546,550,553],{},[153,543,544],{},[73,545,305],{},[153,547,548],{},[73,549,310],{},[153,551,552],{},"Log creation time",[153,554,555,556,269],{},"Auto-set (",[73,557,558],{},"datetime.now",[11,560,562],{"id":561},"execution-example","Execution Example",[69,564,565,568,569,571],{},[73,566,567],{},"examples/mem_scheduler/schedule_w_memos.py"," is a demonstration script showcasing how to utilize the ",[73,570,75],{}," module. It illustrates memory management and retrieval within conversational contexts.",[124,573,575],{"id":574},"code-functionality-overview","Code Functionality Overview",[69,577,578],{},"This script demonstrates two methods for initializing and using the memory scheduler:",[78,580,581,587],{},[19,582,583,586],{},[23,584,585],{},"Automatic Initialization",": Configures the scheduler via configuration files",[19,588,589,592],{},[23,590,591],{},"Manual Initialization",": Explicitly creates and configures scheduler components",[69,594,595],{},"The script simulates a pet-related conversation between a user and an assistant, demonstrating how memory scheduler manages conversation history and retrieves relevant information.",{"title":597,"searchDepth":598,"depth":598,"links":599},"",2,[600,601,602,607],{"id":13,"depth":598,"text":14},{"id":66,"depth":598,"text":67},{"id":118,"depth":598,"text":119,"children":603},[604,606],{"id":126,"depth":605,"text":127},3,{"id":183,"depth":605,"text":184},{"id":561,"depth":598,"text":562,"children":608},[609],{"id":574,"depth":605,"text":575},"`MemScheduler` is a concurrent memory management system parallel running with the MemOS system, which coordinates memory operations between working memory, long-term memory, and activation memory in AI systems. It handles memory retrieval, updates, and compaction through event-driven scheduling. \u003Cbr/> This system is particularly suited for conversational agents and reasoning systems requiring dynamic memory management.","md",{},"/en/open_source/modules/mem_scheduler",{"title":5,"description":597},"en/open_source/modules/mem_scheduler","zOE4IznpUVXAc-F20EkqwqUVHMoF3X1YgEI5Hl0AwRY",[618,626],{"title":619,"path":620,"stem":621,"icon":622,"framework":6,"module":6,"class":623,"target":-1,"active":624,"defaultOpen":624,"children":-1,"description":625},"MemReader","/open_source/modules/mem_reader","open_source/modules/mem_reader","i-ri-book-open-line",[],false,"MemReader is MemOS's “memory translator”. It translates messy user inputs (chat, documents, images) into structured memory fragments the system can understand.",{"title":627,"path":628,"stem":629,"icon":630,"framework":6,"module":6,"class":631,"target":-1,"active":624,"defaultOpen":624,"children":-1,"description":-1},"MemChat","/open_source/modules/mem_chat","open_source/modules/mem_chat","i-ri-calendar-line",[],1770372088086]