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)
| Layer | Who maintains it | Can Memory Forge change it? |
|---|---|---|
| Knowledge original | Human-written (system help/, workspace/agent knowledge/ bodies) | No — read-only citation |
| Answer supplement | Created after forge adopt | Yes — write overlay directories such as _forged/ (retrieval merge pending in older plans; now shipped, see below) |
| Workspace skills | Forge or conversation deposit | Yes — write DB, do not patch bodies |
| Retrieval index | Human or AI rebuild | Partial — 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):
| Value | User language | Typical scene |
|---|---|---|
supplement | Create an answer supplement | Frequent FAQ, weak answers, missing wording |
skill | Create a workspace skill | Weak answers + operational/process questions (workspace path only) |
index | Improve the retrieval index | Answers are OK but still frequent; likely the original was not retrieved |
verified_answer | Archive a verified answer | A 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
jsonlfiles. - Default directory:
tmp/memoryforge/chat-archive - Config:
CHAT_ARCHIVE_DIR - Scan and proposals (MVP): Admin
POST /admin/memoryforge/scanscans the last N days of archive, clusters by repeated questions, writes proposals withaction_typetotmp/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_noteare 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:
/memoryforgecan scan, view historical proposals and evidence conversations (including “user not satisfied” marks). - Adopt write (answer supplement):
POST /admin/memoryforge/proposals/{id}/adoptwritessupplementclusters into_forged/under the matching knowledge root (new Markdown + index), without changing originals; proposal JSON writes backadopted_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,daterequest_id,session_iduser_id,workspace_id,user_agent_idhelp_mode,partialintent_meta(structured intent:intent,slots,confidence,need_clarification)user_message,assistant_message,assistant_message_idrating,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,evidencedissatisfied_count,rating_reasons(when the user was not satisfied)
Later plan (suggested)
Phased delivery: see ../../记忆锻造与定时任务实施计划.md (MF track).
- ~~Time-window scan~~: MVP shipped (admin scans last N days).
- ~~Signal extraction and action classification~~: MVP already has frequency clustering, weak-answer priority, and four
action_types. - ~~Adopt write (answer supplement)~~:
supplement/verified_answercan write_forged/;skillwrites the workspace Skills center;indeximprovesindex.jsonaliases. - ~~Retrieval merge~~: help and workspace/agent knowledge retrieval already merge
_forged/. - ~~Light outcome look-back~~: admin last-30-day adopt stats by
action_type. - Optional auto scan:
MEMORYFORGE_AUTO_SCAN_ENABLEDenvironment 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 | |
|---|---|---|
| Serves | Help documents, workspace knowledge overlay and skills | One user agent’s preferences and facts across conversations |
| Data source | Platform-wide conversation archive (chat-archive) | Runtime Workspace (memory/entries/, daily notes, and so on) |
| How it writes | Offline scan, create supplement/skill/index after human adopt | Extract after conversation, flush before compaction, user/assistant edit/delete, idle maintain |
| Typical outputs | Answer-supplement articles, workspace skills, index aliases | memory/entries/*.md, USER.md |
| Idle cleanup | Does not delete personal memory | agent_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/, workspaceknowledge/_forged/