記事一覧へ
OpenClawの最大の問題(記憶)を修正した
OpenClawのデフォルト記憶システムはAIエージェントがセッション間でコンテキストを失う原因になります。システム全体を配線し直して実際に機能するようにした方法を紹介します。
■ 根本的な問題
エージェントは「健忘症」を経験します。なぜなら短期記憶はツール出力と長いメッセージですぐに埋まるからです。圧縮が発生すると、最初に長期記憶ファイルに保存されていなければ重要なコンテキストが消えます。
■ 主な解決策
ファイル整理:構造化された記憶フォルダを作成します:memory/projects/、memory/decisions/、memory/lessons/。全てを1つのファイルに詰め込む代わりに、恒久的な事実、アクティブなプロジェクト、決定事項、学んだ教訓を分離します。
圧縮設定:keepRecentTokensを20000に、recentTurnsPreserveを4に設定して最後の4つのユーザー/アシスタントのやり取りをサマリーなしで保持します。
記憶フラッシュのカスタマイズ:「決定事項、修正された点、制約や好み」を保存するよう具体的にエージェントに伝えます。
コンテキスト刈り込み:この機能を有効にすると、コンテキストウィンドウを消費する前に肥大化したツール出力を自動的にトリミングします。
QMDインストール:会話トランスクリプト全体のセマンティック検索を可能にするツールです。
■ 行動習慣
・重要な決定を保存するよう明示的にエージェントに指示する
・セッション終了時に保持すべき重要ポイントをリストアップする
・毎週関連性のない記憶ファイルを確認・削除する
結果:エージェントはセッション間で名前を忘れることから、数週間前の会話を覚えるまでに進化しました。

claude-setupclaude-workflowai-thinking
OpenClawの記憶問題を解決する方法
♥ 238↻ 28🔖 701👁 66,313
原文を表示 / Show original
I Fixed OpenClaw's Biggest Problem (Memory)
OpenClaw's default memory system causes AI agents to lose context between sessions. Here's how I rewired the entire system so it actually works.
Core Problem
Agents experience "amnesia" because short-term memory fills quickly with tool outputs and long messages. When compaction occurs, important context disappears if it wasn't saved to long-term memory files first.
Key Solutions
File Organization: Create structured memory folders: memory/projects/, memory/decisions/, and memory/lessons/. This separates permanent facts, active projects, decisions, and lessons learned rather than dumping everything into one file.
Compaction Settings: Specific configuration changes preserve recent context, including setting keepRecentTokens to 20000 and recentTurnsPreserve to 4 to keep the last four user/assistant exchanges intact without summarization.
Memory Flush Customization: A custom prompt tells the agent exactly what to save — "decisions made, corrections given, constraints or preferences" — rather than using generic defaults.
Context Pruning: Enabling this feature automatically trims bloated tool outputs before they consume the context window.
QMD Installation: This tool enables semantic search across conversation transcripts, serving as a safety net for unsaved context.
Behavioral Habits:
- Explicitly instruct agents to save important decisions
- End sessions by listing key points to preserve
- Review and delete irrelevant memory files weekly
The result: agents progressed from forgetting names between sessions to remembering conversations from weeks prior.