Class MemorySaveTool

java.lang.Object
io.agentscope.harness.agent.tool.MemorySaveTool

public class MemorySaveTool extends Object
Dedicated tool for persisting user memories to both MEMORY.md and today's daily ledger (memory/YYYY-MM-DD.md).

This is the only sanctioned entry point for the agent to write long-term memories. The system prompt directs the LLM to use this tool instead of write_file/edit_file on memory paths, eliminating the non-determinism of the LLM choosing arbitrary file names or skipping the daily ledger.

Writes are append-only; deduplication and size-trimming are handled by the periodic MemoryConsolidator.

  • Constructor Details

  • Method Details

    • memorySave

      @Tool(name="memory_save", description="Persist one or more facts to long-term memory. Use whenever the user asks you to remember something, or when you observe important preferences, decisions, or context worth keeping across conversations. Do NOT use write_file or edit_file on MEMORY.md \u2014 always use this tool instead.") public String memorySave(io.agentscope.core.agent.RuntimeContext runtimeContext, @ToolParam(name="content",description="Markdown bullet list of facts to remember. Each bullet should be a concise, self-contained fact. Example:\\n- User prefers dark mode\\n- Project deadline is 2026-07-01") String content)