feat(memory): Cross Agent Memory Experimentation#65
Merged
Conversation
Feature/aios memory
Feature/system wide personalization
aiosfoundation
approved these changes
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR: System-Wide Personalization via Kernel-Managed Shared Memory
Summary
Adds a kernel-managed shared memory architecture to the Cerebrum SDK that enables system-wide personalization across agents. Three new example agents (ProfileAgent, TaskAgent, AssistantAgent) demonstrate the pattern: specialized agents write user context as shared memories with standardized metadata, and the AIOS kernel automatically injects that context into other agents' LLM calls. A two-phase benchmark harness validates that shared memory improves personalization quality over a private-only baseline.
What Changed
New Example Agents (
cerebrum/example/agents/)memory_type="profile"and configurablesharing_policy.memory_type="task_context".llm_chatcalls. No retrieval logic — the kernel'sauto_injecthandles shared context injection, andauto_extracthandles conversation memory storage.build_memory_metadata()helper with input validation for constructing standardized metadata dicts.filter_shared_memories()retained for optional debug/ablation use.Memory API Extension (
cerebrum/memory/apis.py)search_memories()now accepts optionaluser_idandsharing_policykeyword parameters for cross-agent memory queries, with input validation and kernel contract documentation.CLI Extension (
cerebrum/commands/run_agent.py)--share-memoryflag torun-agentCLI command, propagated to agent instances.Benchmark Harness (
benchmarks/shared_memory/)synth.py): Generates unique user profiles, task contexts, vague follow-up queries, and plausible actions per trial.judge.py): Combines deterministic keyword matching with LLM-based scoring. Keyword matching provides a reliable signal for whether the response references injected profile/task attributes. LLM scoring assesses quality and integration. Content-based rubric with no generic_penalty.pipeline.py): Runs ProfileAgent → TaskAgent → AssistantAgent per trial. Captures written memory metadata.RetrievalLogwithinjection_statusfield ("confirmed"/"audit_inferred"/"unknown") for observability.run_evaluation.py): Manages per-phaseshare_memoryflag, collects metrics, computes comparative analysis, writes JSON/CSV output.models.py): Pydantic models for synthetic data, judge scores, trial results, injection diagnostics, and experiment output.Documentation (
docs/)system_wide_personalization.md— Architecture overview and design rationaleshared-memory-experiment-report.md— Full experiment report with results, ablation study, methodology, and reproduction instructionsCI (
.github/workflows/test.yml)config.yamlif missing, preventing CI failures when the kernel repo doesn't ship one.Experimental Results (30 trials, qwen2.5:7b, HybridJudge)
Kernel-managed shared memory produces measurably stronger personalized behavior across all three evaluation dimensions.
Test Coverage
test_shared_memory_utils.pytest_shared_memory_utils_props.pytest_assistant_agent.pytest_benchmark_orchestrator.pytest_benchmark_metrics.pytest_results_props.pytest_benchmark_harness_preservation.pytest_search_memories_cross_agent.pytest_share_memory_flag.pyHow to Run
Companion Kernel Changes (AIOS repo)
This PR requires corresponding changes in the AIOS kernel for full functionality:
user_idfrom memory metadata, enforcesharing_policyfilteruser_idfrom injection context