Historical experience can guide scientific coding at multiple levels, but task-level retrieval may miss implementation lessons that become relevant during execution. We introduce MUSE, a memory management framework combining multi-level memory with selective runtime injection for scientific coding agents. MUSE builds global, approach-level, and implementation-level memory from historical trajectories. At initialization, the agent receives global memory and problem-matched approach-level memory. During execution, current interactions are used to retrieve implementation-level memory. An LLM gate selects relevant experience and generates specific review advice, or skips injection. Across four benchmarks spanning numerical problem solving, kernel optimization, and scientific software repair, MUSE outperforms retrieval and memory baselines on all evaluation metrics. Ablations support the multi-level design and gated injection, while transfer experiments show that memory remains useful across kernel benchmarks. These results show that multi-level memory and selective runtime injection enable effective reuse of experience in scientific coding. Code is available at https://github.com/hr-jin/MUSE.
Compile, Then Page: Executable SOP Programs and a Capability-Gated Runtime for Procedural LLM Agents
The Hong Kong Polytechnic University(香港理工大学);The University of Hong Kong(香港大学);Zhejiang Normal University(浙江师范大学);Research Institute for Generative AI, The Hong Kong Polytechnic University(香港理工大学生成式人工智能研究所)
MemSecBench: Tracking Agent Memory Poisoning from Persistence to Consequence and Repair
Institute of Cyberspace Security, Zhejiang University of Technology(浙江工业大学网络空间安全研究院);Binjiang Institute of Artificial Intelligence, ZJUT(浙江工业大学滨江人工智能研究院);College of Information Engineering, Zhejiang University of Technology(浙江工业大学信息工程学院)