首页 资讯 下载 教程 Skills 社群

从 ChatGPT 导入历史对话到 OpenClaw Dreaming 系统

概述

OpenClaw v2026.4.11 新增了一项重要功能:从 ChatGPT 导入对话历史,并通过 Dreaming 系统将其转化为 OpenClaw Agent 的长期记忆。

这意味着你多年的 ChatGPT 对话不再是孤岛——所有积累的偏好、知识、决策记录都可以迁移到本地 OpenClaw 中,由 Agent 持续利用。

适用场景

  • 从 ChatGPT 切换到 OpenClaw 时不丢失历史
  • 让 OpenClaw Agent 立即拥有"了解你"的能力
  • 整合多个 AI 工具的对话历史
  • 团队 ChatGPT 历史的统一管理

第一步:从 ChatGPT 导出数据

个人账户

  1. 访问 chatgpt.com
  2. 设置 → 数据控制 → 导出数据
  3. 点击"Export"按钮
  4. 等待邮件通知(通常 24 小时内)
  5. 从邮件链接下载 ZIP 文件

ZIP 文件包含:

  • conversations.json:所有对话历史
  • chat.html:HTML 格式的对话浏览
  • message_feedback.json:消息反馈
  • model_comparisons.json:模型对比数据
  • user.json:账户信息

企业账户(ChatGPT Team / Enterprise)

需要管理员通过 Admin Console 导出团队数据,导出格式相同。

第二步:导入到 OpenClaw

基础导入

# 导入 ChatGPT 历史
openclaw memory import chatgpt --file ./chatgpt-export.zip

OpenClaw 会:

  1. 解压 ZIP 文件
  2. 解析 conversations.json
  3. 将每个对话转化为 OpenClaw 内部格式
  4. 存入待处理队列

高级选项

# 只导入特定时间范围
openclaw memory import chatgpt \
  --file ./chatgpt-export.zip \
  --from "2024-01-01" \
  --to "2026-04-01"

# 只导入特定模型的对话
openclaw memory import chatgpt \
  --file ./chatgpt-export.zip \
  --model gpt-4o

# 导入并指定 Agent
openclaw memory import chatgpt \
  --file ./chatgpt-export.zip \
  --agent personal

第三步:触发 Dreaming 处理

导入后的对话需要通过 Dreaming 系统消化:

# 触发 REM 阶段处理(推荐)
openclaw memory dream rem

# 或完整三阶段
openclaw memory dream light
openclaw memory dream deep
openclaw memory dream rem

Dreaming 系统会:

  • Light 阶段:清理冗余、整合相似话题
  • Deep 阶段:深度分析、建立知识链接
  • REM 阶段:提取持久化事实、更新长期记忆

第四步:验证导入结果

查看 Dreaming 摘要

openclaw memory diary --recent

可以看到处理的对话数、提取的事实数等。

测试记忆效果

打开新会话,问 Agent 一些只在 ChatGPT 历史里讨论过的话题:

用户:我之前在 ChatGPT 里学的 Rust 学到第几章了?
Agent:根据导入的历史,你上次学到第 8 章关于错误处理。
       要继续吗?

查看 Memory-Wiki 新条目

如果配合 Memory-Wiki 系统:

ls memory/wiki/imported/

会发现 Dreaming 系统将重要话题整理成 Wiki 文档。

数据隐私考虑

本地处理

OpenClaw 的 Dreaming 在本地处理导入的数据:

  • 不会上传到第三方
  • 全程在用户设备/服务器上完成
  • ZIP 文件解压后的临时数据可以手动清理

敏感信息过滤

导入时可以指定过滤规则:

# config.yaml
memory:
  import:
    filters:
      excludeKeywords: ["password", "ssn", "credit card"]
      excludeConversations: ["private-*"]

匹配的对话或消息会被跳过。

删除已导入数据

如果想删除某次导入:

# 列出导入历史
openclaw memory import list

# 删除特定批次
openclaw memory import delete <import-id>

# 删除并清理 Dreaming 处理结果
openclaw memory import delete <import-id> --purge

性能考虑

大量历史的处理

对于多年的 ChatGPT 历史(可能有数千条对话):

  • 磁盘空间:原始 JSON 可能数百 MB,建议预留 2-3 倍空间
  • Token 消耗:Dreaming 处理消耗大量 Token,建议使用便宜模型
  • 处理时间:完整 Dreaming 可能需要数小时

分批处理建议

# 按月分批
for month in 2024-{01..12}; do
  openclaw memory import chatgpt \
    --file ./chatgpt-export.zip \
    --from "${month}-01" \
    --to "${month}-31"
  openclaw memory dream rem
  sleep 60  # 避免 API 限流
done

推荐 Dreaming 模型

memory:
  dreaming:
    provider: "qwen"
    model: "qwen-plus"  # 性价比好的中等模型

避免用 GPT-5 或 Claude Opus 处理大量历史,成本会很高。

与其他平台的对比

OpenClaw 类似的导入支持:

平台 状态 命令
ChatGPT 支持(v2026.4.11) --source chatgpt
Claude 支持 --source claude
Gemini 实验 --source gemini
通义千问 计划中 -

故障排查

"Invalid format" 错误

确认 ZIP 文件未损坏:

unzip -t chatgpt-export.zip

导入卡住

openclaw memory import status
openclaw logs --filter "memory.import" --tail 100

Dreaming 处理失败

# 重置卡住的任务
openclaw memory dream reset --stuck

# 重试
openclaw memory dream rem --retry

注意事项

  • 需要 OpenClaw v2026.4.11 或更高版本
  • 大批量导入消耗的 API Token 较多,建议预估成本
  • ChatGPT 导出包含图片、文件附件,目前仅文本部分被处理
  • 导入是一次性操作,不会自动同步新的 ChatGPT 对话
  • 建议导入完成后清理原始 ZIP 文件减少敏感数据暴露