All docs

Agent memory

Do not write into memory: code paths, facts already in knowledge documents, generic product how-tos, whole conversation transcripts.

Source docs/en/site/mech-agent-memory.md

Voice: This page explains in user language what the assistant remembers across conversations, where it lives, and how it is used. memory/entries/, MEMORY.md, and similar are implementation paths; see docs/产品规格.md §3.5.

Memory layers

LayerUser languageWhat is storedTypical lifetime
User profileWho I amStable identity, how to address you, long-term backgroundManual maintain + optional auto-update
Long-term memoryThings to remember across conversationsPreferences, decisions, project milestones, where to look things upLong-lived; edit/delete on the agent “Memory” page
Daily notesRecent conversation contextToday’s task progress, temporary observationsDefault load today + yesterday; fades as it ages

Do not write into memory: code paths, facts already in knowledge documents, generic product how-tos, whole conversation transcripts.

Look up past conversations: when the user wants what was discussed recently or which words were asked, page the conversation original, not memory only. See 查看过去对话.md.

Four kinds of long-term memory

TypeUser-facing nameExample
userAbout me“I have ten years of Go backend, I’m new to front end”
feedbackPreferences and corrections“Answer in bullets later, not long paragraphs”
projectProject progress“Q2 launch deadline 2026-06-30”
referenceWhere to look“API rules are in the team wiki /api section”

feedback bodies must include Why: and How to apply: so later conversations apply them correctly.

How to write / update / delete

HowWho triggersDefault destination
Tap Remember on a messageUserLong-term memory (the form can switch to daily notes)
Say “remember / don’t forget” in conversationUser + agentAgent calls memory_write, chooses long-term or daily notes by content
Say “that’s wrong / forget / delete that one”User + agentmemory_write (update with path) or memory_delete
Auto-extract after conversationSystem (on by default)Long-term memory only; filter temporary logs
Archive before context compactionSystemDaily notes + optional extract to long-term

Tools: memory_search / memory_get / memory_write (can update) / memory_delete. Intent is judged by the conversation model, not a hard keyword route.

After a successful write, the matching message shows a Remembered badge so it is not written twice. The conversation menu can turn on Notify when auto-extract finishes (off by default; when on, each round’s extract completion is announced, and the UI waits for the extract).

Long-term vs daily notes

Write long-term memory when any of these hold:

  • The user clearly asks to keep it across conversations
  • Stable facts, preferences, confirmed decisions
  • Project milestones with a deadline
  • Reusable “where to look” pointers

Write daily notes when any of these hold:

  • Useful only today / this conversation (“today we are…”, “this round first…”)
  • Temporary task progress that may be stale in a few days
  • Conversation fragments archived before context compaction

How it is used

  1. Every round: the system injects the long-term memory index, excerpts of entries related to the question, and today/yesterday note excerpts.

- Related entries default to keyword match; when long-term memory has ≥30 entries, or ≥20 and keywords missed, an LLM may pick top-5 by name/description. - Body entries already expanded last round are not injected again this round (the index remains visible). - If the conversation recently called a tool, reference entries that describe that tool’s “how to use” are skipped; those with warning / note / Why: are kept.

  1. Agent retrieves on purpose: when details need checking, call memory_search / memory_get.
  2. Agent maintains corrections: the user points out errors/staleness, or injected material says “saved N days ago, please verify” and it is confirmed inaccurate → memory_write (update with path) or memory_delete; unique same-name entries can be updated in place.
  3. User management: Web agent detail → “Memory” to view, edit, delete entries; “User profile” is maintained separately.
  4. Idle auto-maintain (agent memory maintain): an in-process scheduled task cleans exact duplicates / older same-name entries / expired daily notes; when there are many entries, an LLM may review near-duplicates and expired project milestones; does not write the knowledge overlay, and does not go through Memory Forge adopt.

Idle maintain (alongside Memory Forge)

| | Agent memory maintain | Memory forge (MemoryForge) | |--|-------------------|---------------------------| | Serves | One agent’s personal memory | Help/workspace knowledge overlay and skills | | Writes where | memory/entries/, legacy memory/YYYY-MM-DD.md | _forged/, skills, indexes | | Trigger | agent_memory_maintain schedule (needs schedule.enabled) | Admin scan / optional auto scan | | Gate | Conservative auto-delete (caps and audit log) | Scan may be automatic; adopt defaults to human |

Config (mindlink.json / environment): agent_memory_maintain.enabled, daily_local_hour (default 2, about a 2-hour local night window once a day by RuntimeTimezone), daily_note_retain_days, use_llm, and similar.

On diskContent
{runtime_dir}/.memory_maintain_status.jsonLatest global status
{runtime_dir}/.memory_maintain_history.jsonlGlobal run history
{runtime_dir}/{agentId}/memory/.maintain/log.jsonlThat agent’s change history

Who sees what:

RoleSeesManual trigger
UserThis assistant’s “auto-maintain log”“Tidy my memory”
AdminSite-wide run history and detail“Maintain once now”

Admin: /agent-memory-maintain (GET/POST /admin/agent-memory-maintain/*). User: GET/POST /user-agents/{id}/memory/maintain/*.

Help: help/product-features/agent-memory.md, help/admin-ops/agent-memory-maintain.md.

Versus Memory Forge

  • Agent memory: belongs only to that user and that agent instance; personalized across conversations; may auto-inject every round.
  • Past conversations: original chat between the same user and this assistant; retrieve when needed, not auto-injected. See 查看过去对话.md.
  • Agent memos: records the user stores on purpose (text/files/images), retrieved by tag and date; not auto-injected; accessed only when the user clearly wants to look up or save. See 智能体备忘.md; usage: Using agent memos.
  • Memory forge (MemoryForge): platform conversation archive → admin adopt → write help/workspace knowledge overlay; serves everyone, not personal memory.
  • Agent memory maintain: idle/manual cleanup of personal memory; does not write _forged/, does not go through forge adopt.

Related implementation

  • Rule constants and tools: backend/internal/agentmemory/rules.go, agenttool/memory.go
  • Look up past conversations: backend/internal/agenttool/conversation.go, store/chat_conversation_recall.go
  • Write/update/delete: backend/internal/agentmemory/write.go
  • Idle maintain and history: backend/internal/agentmemory/maintain*.go
  • Remember from conversation: POST /api/v1/user-agents/{id}/memory/remember