HoMe: Toward Practical Harness Optimization of Memory Systems for AI Assistants
Organizations: Shanghai Jiao Tong University · Alibaba Group · Peking University
Abstract
The behavior of memory systems for long-running AI assistants is governed by a harness, which consists of the code, prompts, and configurations for memory construction, maintenance, retrieval, and answer generation. However, optimizing the harness of a memory system remains largely manual, and unrestricted editing alone does not ensure structural improvements. In this paper, we introduce HoMe, an evaluation-driven framework that iteratively evaluates candidate harnesses and derives each new candidate from any previously evaluated harness by editing any part of it. HoMe combines session-level memory versioning with execution traces to identify shared failure mechanisms across cases and localize them to the responsible sessions and harness components. It encourages early structural exploration through candidate gating and reduces evaluation cost through smoke tests, adaptive sampling, and the reuse of constructed memory. We validate HoMe with the open-source memory system ReMe on two large-scale long-horizon memory benchmarks, LongMemEval-S and BEAM. With six formal candidate evaluations per benchmark, after a full initial evaluation, HoMe discovers harnesses that improve end-task performance over the originally strong harness while consuming far fewer query-time tokens. The code is available at https://github.com/agentscope-ai/ReMe.
Figures & tables
| Dataset | LME | BEAM | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Method | Score | Token | Input | Out | Calls | Score | Token | Input | Out | Calls |
| A-MEM | 0.740 | 19.8K | 19.8K | K | 2.0 | 0.642 | 30.3K | 28.4K | 1.9K | 2.0 |
| SimpleMem | 0.728 | 37.7K | 28.7K | 9.0K | 8.1 | 0.440 | 34.8K | 25.2K | 9.6K | 6.8 |
| ReMe | 0.888 | 43.9K | 43.2K | 0.8K | 4.7 | 0.650 | 101.8K | 100.0K | 1.8K | 4.5 |
| MemPro | 0.812 | 96.9K | 95.8K | 1.0K | 5.5 | 0.693 | 65.4K | 63.3K | 2.1K | 6.7 |
| HoMe | 0.916 | 17.9K | 17.2K | 0.6K | 3.0 | 0.704 | 60.4K | 57.8K | 2.6K | 6.7 |
| Training set | None | LME | BEAM-100K | |||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Method | HoMe | MemPro | HoMe | MemPro | ||||||
| Test set | Score | Token | Score | Token | Score | Token | Score | Token | Score | Token |
| LME | 0.888 | 43.9K | 0.916 | 17.9K | 0.812 | 96.9K | 0.908 | 26.6K | 0.800 | 42.2K |
| BEAM-1M | 0.650 | 101.8K | 0.639 | 39.0K | 0.617 | 113.1K | 0.704 | 60.4K | 0.693 | 65.4K |
| Setting | LME | BEAM | ||||
|---|---|---|---|---|---|---|
| Cases (Queries) | Time | Cases (Queries) | Time | |||
| Full, serial | 250 (250) | 153.5 h | – | 20 (400) | 14.4 h | – |
| Parallel | 250 (250) | 5.5 h | 96% | 20 (400) | 87 min | 90% |
| Sampling | 28 (28) | 37 min | 89% | 10 (100) | 38 min | 56% |
| Reuse | 28 (28) | 2 min | 94% | 10 (100) | 8 min | 78% |
Appendix figures & tables11 assets
Supplementary material from the paper’s appendix.
Appendix
| Method | Metric | KU | MS | SSA | SSP | SSU | TR |
|---|---|---|---|---|---|---|---|
| A-MEM | Score | 0.790 | 0.657 | 0.963 | 0.600 | 0.914 | 0.647 |
| Total Tok. | 21.5K | 21.5K | 15.6K | 18.6K | 19.3K | 19.4K | |
| In Tok. | 21.5K | 21.5K | 15.5K | 18.6K | 19.2K | 19.4K | |
| Out Tok. | K | K | K | K | K | K | |
| LLM Calls | 2.0 | 2.0 | 2.0 | 2.0 | 2.0 | 2.0 | |
| SimpleMem | Score | 0.711 | 0.761 | 0.926 | 0.533 | 0.800 | 0.632 |
| Method | Metric | Abs. | CR | EO | IE | IF | KU | MSR | PF | Sum. | TR |
|---|---|---|---|---|---|---|---|---|---|---|---|
| A-MEM | Score | 0.629 | 0.505 | 0.486 | 0.774 | 0.689 | 0.779 | 0.661 | 0.840 | 0.540 | 0.518 |
| Total Tok. | 30.9K | 28.4K | 27.4K | 27.6K | 26.7K | 29.7K | 33.2K | 31.3K | 35.2K | 32.7K | |
| In Tok. | 29.7K | 27.2K | 24.1K | 26.3K | 24.7K | 28.8K | 31.1K | 29.2K | 31.4K | 31.6K | |
| Out Tok. | 1.2K | 1.2K | 3.3K | 1.3K | 2.0K | 0.8K | 2.1K | 2.1K | 3.8K | 1.1K | |
| LLM Calls | 2.0 | 2.0 | 2.0 | 2.0 | 2.0 | 2.0 | 2.0 | 2.0 | 2.0 | 2.0 | |
| SimpleMem | Score | 0.564 | 0.241 | 0.393 | 0.544 | 0.349 | 0.546 | 0.356 | 0.624 | 0.459 | 0.324 |
| Cand. | Elapsed | Lines (+/–) | Changed | Score | Main change |
|---|---|---|---|---|---|
| L1 | 6:15 | 0.607 | Rebalanced retrieval by relevance and source; revised memory construction and answering rules. | ||
| L2 | 9:27 | 0.630 | Added a compact index of memory-note descriptions. | ||
| L3 | 10:41 | 0.593 | Extended the index to individual facts. | ||
| L4 | 12:03 | 0.593 | Gated index delivery and adjusted evidence interpretation rules. | ||
| L5 | 12:35 | 0.630 | Reverted broader prompt changes while retaining targeted fixes. | ||
| L6 ⋆ | 13:05 | 0.741 | Restored the always-available index with query-dependent width. |
| Cand. | Elapsed | Lines (+/–) | Changed | Score | Main change |
|---|---|---|---|---|---|
| B1 | 5:00 | 0.694 | Rebalanced notes and transcripts; revised construction and answering rules. | ||
| B2 | 6:17 | 0.698 | Selected evidence lines using the query. | ||
| B3 | 6:54 | 0.710 | Added a cross-session topic index. | ||
| B4 ⋆ | 8:10 | 0.670 | Narrowed index routing and consolidated duplicate notes. | ||
| B5 | 9:16 | 0.715 | Replaced the topic overview with a chronological source-path map. | ||
| B6 | 10:10 | 0.677 | Added conversation-flow line ranges to the map. |
| Problem | Run 1 solution | Run 2 solution | Comparison |
|---|---|---|---|
| Transcripts crowd notes out of retrieval | Reranks candidates to reserve room for notes and transcripts. | Uses separate note and transcript quotas, with unused slots filled from the other tier. | Same |
| Long search output hides evidence or wastes tokens | Applies a character budget with source pointers and selects query-relevant evidence lines. | Compresses long transcripts to retain facts before applying the character budget. | Similar |
| Top- retrieval misses cross-session evidence | Builds a date-ordered index from all notes for coverage questions, retaining source paths. | Builds a deduplicated timeline from dated note entries, with source locations and a separate retrieval quota. | Similar |
| Mention or event order is lost | Preserves mention order and provides chronological source paths with conversation-flow line ranges. | Adds complete monthly timelines for on-demand reading. | Different |
| Compression loses attribution and update relations | Preserves speakers, user decisions versus assistant suggestions, and both sides of updates with supersession relations. | Preserves the same distinctions and explicitly records both sides of unresolved conflicts. | Same |
| Persistent user constraints are not followed | Retains enduring instructions verbatim during construction. | Checks recorded constraints during answering and annotates how recommendations satisfy them. | Different |
| Version | Score | Tokens/query | Memory execution |
|---|---|---|---|
| Initial harness | 0.6120 | 58,756 | Constructed |
| Audit ( d003d84 ) | 0.4762 | 55,995 | Reused |
| Repair ( b08d48a ) | 0.6760 | 51,908 | Reconstructed |
| Version | Parent | Changed | Lines (+/–) | Score |
| BM0 | — | — | — | — |
| BM1 | BM0 | 0.585 | ||
| BM2 | BM1 | 0.659 | ||
| BM3 | BM2 | 0.605 | ||
| BM4 | BM2 | 0.666 | ||
| BM5 | BM4 | 0.669 |
| Version | Parent | Changed | Lines (+/–) | Score |
| LM0 | — | — | — | — |
| LM1 | LM0 | 0.800 | ||
| LM2 | LM1 | 0.840 | ||
| LM3 | LM0 | 0.800 | ||
| LM4 | LM3 | 0.840 | ||
| LM5 | LM4 | 0.820 |
| Method | Stage | Input | Output | Total |
|---|---|---|---|---|
| MemPro | Construction | 145.0M | 17.6M | 162.6M |
| Query | 132.2M | 11.7M | 144.0M | |
| Developer agents | 24.6M | 58.4K | 24.7M | |
| Total | 301.8M | 29.4M | 331.2M | |
| HoMe | Construction | 79.5M | 9.3M | 88.8M |
| Query | 55.0M | 4.1M | 59.1M |
| Model | MemPro | HoMe | ||
|---|---|---|---|---|
| Token | Share | Token | Share | |
| qwen3.6-flash | 162.6M | 49.1% | 88.8M | 47.9% |
| qwen3.7-max | 168.7M | 50.9% | 96.4M | 52.1% |
| Total | 331.2M | 100% | 185.2M | 100% |
Agent Harness Optimization
Agent harness optimization improves the prompts, tools, memory, workflows, and control code that shape how AI agents act.
See all 220 papers