Skip to main content ホーム クリエイター adu2021 skillxiv multi-agent-memory-framework
multi-agent-memory-framework Design multi-agent systems with brain-inspired memory mechanisms that enable efficient information sharing and coordination. Implement hierarchical memory structures (working memory, episodic memory, semantic memory) similar to neuroscience models to improve multi-agent reasoning, planning, and task completion.
インストールへ移動 Skills Marketplace コミュニティが作成したAIスキルを発見・探索
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
直接コマンドでは確認用 Prompt が省略されます。実行前にソースを確認してください。
npx skills add https://github.com/ADu2021/skillXiv --skill multi-agent-memory-frameworkコマンドは1行のまま表示されます。コピー前に横へスクロールして全体を確認してください。
ローカルで確認しますか?SkillsMP が現在取得できるファイルをダウンロードできます。
Zipをダウンロード ダウンロード中... name multi-agent-memory-framework title BMAM: Brain-inspired Multi-Agent Memory Framework version 0.0.2 engine skillxiv-v0.0.2-claude-opus-4.6 license MIT url https://arxiv.org/abs/2601.20465 keywords ["multi-agent","memory-management","neural-architecture","agent-coordination","shared-state"] description Design multi-agent systems with brain-inspired memory mechanisms that enable efficient information sharing and coordination. Implement hierarchical memory structures (working memory, episodic memory, semantic memory) similar to neuroscience models to improve multi-agent reasoning, planning, and task completion.
Problem
Multi-agent systems struggle with inefficient information sharing and coordination. Agents often duplicate computational effort or fail to leverage collective knowledge. Traditional approaches don't effectively balance shared memory (enabling coordination) with individual agent autonomy (enabling parallelism).
Solution
Implement BMAM: a brain-inspired memory framework that structures multi-agent memory hierarchically:
Working Memory : Short-term, high-capacity state shared between agents for immediate coordination
Episodic Memory : Persistent records of agent interactions, decisions, and outcomes
Semantic Memory : Abstracted knowledge and learned patterns shared across the team
Memory Consolidation : Mechanism for moving information between memory types based on relevance and frequency
This approach mirrors neuroscience models while enabling efficient multi-agent coordination.
When to Use
Multi-agent systems performing collaborative tasks (research, planning, problem-solving)
Scenarios requiring shared knowledge while maintaining agent specialization
Long-running agent systems needing persistent learning
Complex tasks requiring both coordination and parallel execution
Systems where agents build on each other's discoveries
When NOT to Use
Single-agent systems (overhead not justified)
Scenarios with strict memory/latency constraints
Competitive or adversarial multi-agent settings
Tasks requiring immediate responses without consolidation
Implementation
Step 1: Design the Memory Architecture
Create hierarchical memory structures inspired by cognitive science.
class BrainInspiredMemory :
"""
Hierarchical memory system for multi-agent coordination
Inspired by working, episodic, and semantic memory in neuroscience
"""
def __init__ (self, num_agents ):
self .working_memory = {
"current_observations" : {},
"recent_actions" : deque(maxlen= ),
: [],
: {}
}
.episodic_memory = {
: [],
: [],
: {}
}
.semantic_memory = {
: {},
: {},
: {},
: {}
}
.num_agents = num_agents
.consolidation_counter =
( ):
.working_memory[ ][agent_id] = {
: observation,
: time.time()
}
( ):
action_record = {
: agent_id,
: action,
: result,
: time.time()
}
.working_memory[ ].append(action_record)
( ):
interaction = {
: (agent_a, agent_b),
: action,
: outcome,
: time.time()
}
.episodic_memory[ ].append(interaction)
( ):
context = {
: .working_memory[ ].get(agent_id),
: ( .working_memory[ ])[- :],
: .working_memory[ ],
: .working_memory[ ].get(agent_id, [])
}
context
100
"shared_goals"
"active_subtasks"
self
"interaction_history"
"decision_outcomes"
"problem_solutions"
self
"agent_capabilities"
"task_strategies"
"learned_relationships"
"domain_knowledge"
self
self
0
def
record_observation
self, agent_id, observation
"""Add agent observation to working memory"""
self
"current_observations"
"data"
"timestamp"
def
record_action
self, agent_id, action, result
"""Log action execution"""
"agent"
"action"
"result"
"timestamp"
self
"recent_actions"
def
record_interaction
self, agent_a, agent_b, action, outcome
"""Log multi-agent interaction"""
"agents"
"action"
"outcome"
"timestamp"
self
"interaction_history"
def
get_agent_working_context
self, agent_id
"""Retrieve relevant working memory for an agent"""
"own_observation"
self
"current_observations"
"recent_actions"
list
self
"recent_actions"
10
"shared_goals"
self
"shared_goals"
"relevant_subtasks"
self
"active_subtasks"
return
Step 2: Implement Memory Consolidation Move information from working to episodic to semantic memory based on relevance.
class MemoryConsolidation :
"""Manage information movement through memory hierarchy"""
def consolidate_memory (self, memory_system ):
"""
Periodically consolidate working memory to episodic/semantic
Similar to sleep-based memory consolidation in brains
"""
recent_actions = list (memory_system.working_memory["recent_actions" ])
decision_patterns = self .extract_decision_patterns(recent_actions)
successful_sequences = self .identify_frequent_patterns(
memory_system.episodic_memory["decision_outcomes" ],
min_success_rate=0.7 ,
min_frequency=3
)
for sequence, success_rate in successful_sequences:
task_type = self .infer_task_type(sequence)
if task_type not in memory_system.semantic_memory["task_strategies" ]:
memory_system.semantic_memory["task_strategies" ][task_type] = []
memory_system.semantic_memory["task_strategies" ][task_type].append({
"strategy" : sequence,
"success_rate" : success_rate,
"learned_at" : time.time()
})
for agent_id in range (memory_system.num_agents):
capabilities = self .extract_agent_capabilities(
memory_system.episodic_memory["decision_outcomes" ],
agent_id
)
memory_system.semantic_memory["agent_capabilities" ][agent_id] = capabilities
memory_system.working_memory["recent_actions" ] = deque(
list (memory_system.working_memory["recent_actions" ])[-50 :],
maxlen=100
)
def extract_decision_patterns (self, actions ):
"""Find repeated decision patterns"""
patterns = {}
for action in actions:
action_type = action["action" ]["type" ]
if action_type not in patterns:
patterns[action_type] = 0
patterns[action_type] += 1
return sorted (patterns.items(), key=lambda x: x[1 ], reverse=True )
def identify_frequent_patterns (self, decision_outcomes, min_success_rate=0.7 , min_frequency=3 ):
"""Extract successful action sequences that should become learned strategies"""
sequence_success = {}
for outcome in decision_outcomes:
decision = outcome["decision" ]
success = outcome["success" ]
seq_key = tuple (decision) if isinstance (decision, list ) else (decision,)
if seq_key not in sequence_success:
sequence_success[seq_key] = {"success" : 0 , "total" : 0 }
sequence_success[seq_key]["total" ] += 1
if success:
sequence_success[seq_key]["success" ] += 1
frequent_patterns = [
(seq, data["success" ] / data["total" ])
for seq, data in sequence_success.items()
if data["total" ] >= min_frequency and (data["success" ] / data["total" ]) >= min_success_rate
]
return frequent_patterns
def extract_agent_capabilities (self, decision_outcomes, agent_id ):
"""Build capability profile for an agent"""
agent_outcomes = [
o for o in decision_outcomes
if o["agent" ] == agent_id
]
capabilities = {}
for outcome in agent_outcomes:
task_type = self .infer_task_type(outcome["decision" ])
if task_type not in capabilities:
capabilities[task_type] = {"success" : 0 , "total" : 0 }
capabilities[task_type]["total" ] += 1
if outcome["success" ]:
capabilities[task_type]["success" ] += 1
return {
task: data["success" ] / data["total" ]
for task, data in capabilities.items()
if data["total" ] >= 2
}
Step 3: Implement Semantic Memory for Learned Knowledge Store and retrieve learned patterns and relationships.
class SemanticMemoryManager :
"""Manage semantic/abstract knowledge across agents"""
def __init__ (self, semantic_memory ):
self .semantic_memory = semantic_memory
def get_best_strategy_for_task (self, task_type, agent_capabilities=None ):
"""
Retrieve learned strategy for a task, optionally filtered by agent capability
"""
if task_type not in self .semantic_memory["task_strategies" ]:
return None
strategies = self .semantic_memory["task_strategies" ][task_type]
strategies.sort(key=lambda s: s["success_rate" ], reverse=True )
if agent_capabilities:
best_fit = None
for strategy in strategies:
if agent_capabilities.get(task_type, 0 ) > 0.5 :
best_fit = strategy
break
return best_fit or strategies[0 ]
return strategies[0 ]
def find_capable_agent (self, task_type, min_capability=0.6 ):
"""Find which agent is best suited for a task"""
capabilities = self .semantic_memory["agent_capabilities" ]
best_agent = None
best_score = min_capability
for agent_id, agent_caps in capabilities.items():
score = agent_caps.get(task_type, 0 )
if score > best_score:
best_score = score
best_agent = agent_id
return best_agent
def get_related_knowledge (self, concept ):
"""Find related domain knowledge"""
if concept in self .semantic_memory["learned_relationships" ]:
return self .semantic_memory["learned_relationships" ][concept]
return []
Step 4: Coordinate Multi-Agent Actions Using Memory Use memory to guide agent coordination.
class MultiAgentCoordinator :
"""Use brain-inspired memory for agent coordination"""
def __init__ (self, memory_system ):
self .memory = memory_system
self .semantic_manager = SemanticMemoryManager(memory_system.semantic_memory)
def assign_task_to_capable_agent (self, task_type ):
"""
Find best agent for task using semantic memory
"""
capable_agent = self .semantic_manager.find_capable_agent(task_type, min_capability=0.5 )
if not capable_agent:
capable_agent = 0
return capable_agent
def get_learned_strategy_for_agent (self, agent_id, task_type ):
"""
Provide agent with learned strategy for task
"""
agent_capabilities = self .memory.semantic_memory["agent_capabilities" ].get(agent_id, {})
strategy = self .semantic_manager.get_best_strategy_for_task(
task_type,
agent_capabilities
)
return strategy
def record_team_decision (self, agents_involved, decision, outcome ):
"""
Log multi-agent collaborative decision
"""
for agent_id in agents_involved:
self .memory.record_action(agent_id, decision, outcome)
if len (agents_involved) > 1 :
for i in range (len (agents_involved) - 1 ):
self .memory.record_interaction(
agents_involved[i],
agents_involved[i+1 ],
decision,
outcome
)
def coordinate_multi_step_task (self, agents, task_sequence ):
"""
Execute complex task requiring multiple agents
Use memory for coordination
"""
results = []
for step_idx, task in enumerate (task_sequence):
assigned_agent = self .assign_task_to_capable_agent(task["type" ])
strategy = self .get_learned_strategy_for_agent(assigned_agent, task["type" ])
outcome = agents[assigned_agent].execute(task, strategy)
results.append(outcome)
self .record_team_decision([assigned_agent], task, outcome)
if step_idx % 10 == 0 :
consolidator = MemoryConsolidation()
consolidator.consolidate_memory(self .memory)
return results
Key Neuroscience Insights
Working Memory : Enables immediate coordination, limited capacity (~100 items)
Episodic Memory : Records what happened, when, with whom - enables learning from history
Semantic Memory : Abstracted facts and strategies - efficient knowledge representation
Consolidation : Regularly move frequently-used episodic knowledge to semantic storage
Benefits
Agents can coordinate without direct communication (via shared memory)
Learned strategies improve over time through consolidation
Efficient knowledge reuse across multiple agents
Scalable: adding agents doesn't require retraining
References
arXiv:2601.20465: BMAM brain-inspired multi-agent memory framework
Based on neuroscience models of human working, episodic, and semantic memory