All docs

Memory forge

- English name: memoryforge

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

  • English name: memoryforge
  • Chinese name: 记忆锻造

MemoryForge is Cadau’s “conversation insight and knowledge feed” mechanism: by archiving real conversations and extracting frequent and critical questions offline, it keeps improving answer quality without changing human-written knowledge originals.

Method layer: ../索引式文档与反馈闭环.md. This page focuses on how MemoryForge is implemented and how it runs.

Goals

  • Let help and team knowledge evolve with real questions, originals read-only, improvements on overlay layers.
  • Cut repeat Q&A cost and raise first-answer hit rate.
  • Provide stable data input for later “adopt → write overlay / skill / index”.

Originals vs overlay (core principle)

LayerWho maintains itCan Memory Forge change it?
Knowledge originalHuman-written (system help/, workspace/agent knowledge/ bodies)No — read-only citation
Answer supplementCreated after forge adoptYes — write overlay directories such as _forged/ (retrieval merge pending in older plans; now shipped, see below)
Workspace skillsForge or conversation depositYes — write DB, do not patch bodies
Retrieval indexHuman or AI rebuildPartial — only index.json aliases/tags/summaries

When the agent answers: originals win; overlays fill gaps; on conflict the original wins and the injected block marks the source.

Adopt action types (action_type)

After scan clustering, each proposal carries one of the following (rules + optional LLM polish of suggested copy):

ValueUser languageTypical scene
supplementCreate an answer supplementFrequent FAQ, weak answers, missing wording
skillCreate a workspace skillWeak answers + operational/process questions (workspace path only)
indexImprove the retrieval indexAnswers are OK but still frequent; likely the original was not retrieved
verified_answerArchive a verified answerA longer reliable answer already exists; freeze it as standard wording

Forbidden: a proposal or one-click apply that rewrites or merges into an existing .md original.

Shipped now

  • After chat finishes, the backend writes “user question + assistant reply” to the archive.
  • Archive format: daily jsonl files.
  • Default directory: tmp/memoryforge/chat-archive
  • Config: CHAT_ARCHIVE_DIR
  • Scan and proposals (MVP): Admin POST /admin/memoryforge/scan scans the last N days of archive, clusters by repeated questions, writes proposals with action_type to tmp/memoryforge/proposals/; optional LLM polish of top suggestions.
  • User rating signal: conversation archive writes assistant_message_id; after the user rates an assistant reply, rating / rating_reasons / rating_note are written back. On scan: help conversations rated “not satisfied” can enter a proposal on a single occurrence, priority high, with suggested copy and evidence.
  • Admin page: /memoryforge can scan, view historical proposals and evidence conversations (including “user not satisfied” marks).
  • Adopt write (answer supplement): POST /admin/memoryforge/proposals/{id}/adopt writes supplement clusters into _forged/ under the matching knowledge root (new Markdown + index), without changing originals; proposal JSON writes back adopted_path.
  • Retrieval merge: help assistant and workspace/agent knowledge retrieval merge _forged/ hit passages and mark “if this conflicts with the original, the original wins”.

Archive records include (example fields):

  • timestamp, date
  • request_id, session_id
  • user_id, workspace_id, user_agent_id
  • help_mode, partial
  • intent_meta (structured intent: intent, slots, confidence, need_clarification)
  • user_message, assistant_message, assistant_message_id
  • rating, rating_reasons, rating_note, rated_at (written back after rating)
  • topic, review (conversation topic and confirmed review, if any; helps cluster by topic)

Proposal cluster fields (example):

  • title, frequency, target_layer (help | workspace)
  • action_type (see the table above)
  • priority, suggestion, evidence
  • dissatisfied_count, rating_reasons (when the user was not satisfied)

Later plan (suggested)

Phased delivery: see ../../记忆锻造与定时任务实施计划.md (MF track).

  1. ~~Time-window scan~~: MVP shipped (admin scans last N days).
  2. ~~Signal extraction and action classification~~: MVP already has frequency clustering, weak-answer priority, and four action_types.
  3. ~~Adopt write (answer supplement)~~: supplement / verified_answer can write _forged/; skill writes the workspace Skills center; index improves index.json aliases.
  4. ~~Retrieval merge~~: help and workspace/agent knowledge retrieval already merge _forged/.
  5. ~~Light outcome look-back~~: admin last-30-day adopt stats by action_type.
  6. Optional auto scan: MEMORYFORGE_AUTO_SCAN_ENABLED environment variable (adopt still human).

Relation to the index loop

  • The index loop defines “how to organize documents and how to form an improvement cycle”.
  • MemoryForge provides “collect data, analyze offline, propose improvements”.
  • Together, the document system can keep evolving:

- the index system owns “retrieval and execution quality”; - MemoryForge owns “find problems and drive overlay updates”, and does not replace humans maintaining originals.

Versus long-term agent memory

Memory forge (MemoryForge)Agent long-term memory
ServesHelp documents, workspace knowledge overlay and skillsOne user agent’s preferences and facts across conversations
Data sourcePlatform-wide conversation archive (chat-archive)Runtime Workspace (memory/entries/, daily notes, and so on)
How it writesOffline scan, create supplement/skill/index after human adoptExtract after conversation, flush before compaction, user/assistant edit/delete, idle maintain
Typical outputsAnswer-supplement articles, workspace skills, index aliasesmemory/entries/*.md, USER.md
Idle cleanupDoes not delete personal memoryagent_memory_maintain (alongside forge)

OpenClaw Dreaming / memory promotion in the spec maps to the right-hand “agent long-term memory” path in Cadau (shipped: conversation extract, flush before compaction, idle maintain agent_memory_maintain), not MemoryForge. MemoryForge does not promote conversation logs straight into structured memory entries, and does not delete personal memory/entries/. Idle dedupe/expiry: ../智能体记忆.md “Idle maintain”.

Naming

  • Mechanism name: MemoryForge
  • Proposal directory: tmp/memoryforge/proposals
  • Overlay directories (planned): system help/_forged/, workspace knowledge/_forged/

Related mechanisms