Chat History Import 标志

Chat History Import

社区
dashhuang
chat-history-import

Use when the user wants to import external chat exports into OpenClaw. This skill normalizes raw chat history into conversation-archive-compatible JSONL, then guides the model to distill daily memory and `MEMORY.md` candidates before applying merges with user confirmation.

Add to TypingMind

概览

发布者dashhuang
代码仓库openclaw-chat-history-import
技能名称chat-history-import
星标数
143
复刻数
8
附带文件
10
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 10 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 dashhuang 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Chat History Import AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/dashhuang/openclaw-chat-history-import/tree/main
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/dashhuang/openclaw-chat-history-import.git \
  .claude/skills/chat-history-import
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Chat History Import,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Chat History Import。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Chat History Import 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

Chat History Import

Use this skill when a user wants to import chat history from Claude, ChatGPT, Telegram Desktop exports, Slack exports, markdown logs, JSON/JSONL transcripts, or similar archives into an OpenClaw workspace.

The most common source formats for this skill are ChatGPT exports and Claude exports. Telegram Desktop HTML exports are also supported when the user wants to backfill a Telegram direct chat or group into OpenClaw's raw archive. If the user has not exported data yet, suggest the usual official export entry points first:

  • ChatGPT: Settings -> Data Controls -> Export
  • Claude: Settings -> Privacy -> Export data

These exports usually arrive as ZIP files and are good candidates for the built-in import flow.

What This Skill Owns

  • raw archive import into logs/message-archive-raw/
  • daily memory distillation into memory/YYYY-MM-DD.md
  • MEMORY.md candidate generation
  • review and apply workflow for memory merges

Related OpenClaw Components

This skill is not a replacement for the live archive plugin or archive search skill.

  • conversation-archive plugin
    • Recommended when the workspace wants future live chats written into the same logs/message-archive-raw/ tree.
    • This skill should emit archive files that are fully compatible with that plugin's raw archive layout.
  • conversation-history skill
    • Strongly recommended when the user wants agents to search imported history after import.
    • This import skill writes archive files; it does not replace archive recall/search workflows on its own.

Preferred combined setup:

  1. use chat-history-import to backfill old history
  2. use conversation-archive to keep new history flowing in
  3. use conversation-history to search both imported and live archive data

What Scripts Do vs. What The Model Does

Scripts handle deterministic work:

  • inspect the source archive
  • normalize messages into the archive schema
  • validate archive compatibility
  • write review artifacts
  • apply approved memory merges

Validation must be reported in two layers when relevant:

  • import-batch validation: whether the files written by this import are valid
  • full-archive validation: whether the entire existing archive tree is valid

If full-archive validation fails because of pre-existing files outside this import batch, do not describe the new import itself as failed. Report the historical archive issue separately.

The model handles semantic work:

  • decide what each day is worth remembering
  • rewrite imported history into the style of existing OpenClaw daily memory
  • decide what belongs in MEMORY.md
  • compare imported MEMORY.md candidates against existing MEMORY.md

Do not try to replace this semantic step with Python heuristics.

Also do not assume the bundled Python parsers can recognize every source format. For unknown input formats, the model may need to inspect the source and write a temporary format-specific parser.

Core Rules

  1. Do not import external history into agents/<agentId>/sessions/.
  2. Treat logs/message-archive-raw/ as the canonical destination for imported raw chat history.
  3. Imported archive output must pass {baseDir}/scripts/validate_archive.py and stay compatible with the conversation-archive plugin's archive contract.
  4. Daily memory should merge into the existing memory/YYYY-MM-DD.md file for that date.
  5. Daily memory body should look like normal OpenClaw memory: concise Chinese bullets, minimal metadata, no “Claude 备份里显示” phrasing.
  6. Use a short HTML comment only to mark import provenance.
  7. MEMORY.md is the default memory file here and is always review-required before apply.

Large Export Handling

If the user says they already uploaded an archive, but the current chat channel only exposes a placeholder or incomplete file payload, treat that as a transport limitation first.

For large ChatGPT or similar exports, guide the user toward a smaller text-focused package before retrying upload:

  1. unzip the export locally
  2. keep the conversation JSON files first
  3. keep optional small metadata files only when useful
  4. remove bulky attachments such as images, audio, video, PDFs, Office files, and other binary artifacts
  5. re-zip the reduced package and retry import

For ChatGPT-style exports, the most important files are usually:

  • conversations.json
  • conversations-*.json
  • optional: group_chats.json
  • optional: export_manifest.json

If the reduced archive still cannot be uploaded through the chat channel, ask for one of these instead:

  • a direct download URL
  • a host-local file path
  • a cloud storage link that can be fetched from the host

Use a temp path or another host-local staging path for large imports rather than polluting workspace/.

Import Workflow

1. Inspect

Start by inspecting the source:

bash
python3 {baseDir}/scripts/inspect_import.py /path/to/archive-or-file

Use local file structure first. Use web research only as fallback for unclear formats.

When helpful, check whether the current workspace already has conversation-archive and conversation-history available, so the user can be told what will happen after import:

  • archive-only import
  • import plus future live archive
  • import plus searchable archive recall

2. Normalize Raw Archive

Normalize the source into the archive schema described in {baseDir}/references/schema.md:

bash
python3 {baseDir}/scripts/normalize_import.py /path/to/archive --archive-root logs/message-archive-raw --workspace workspace --agent-id main --apply
python3 {baseDir}/scripts/validate_archive.py logs/message-archive-raw

After validation, explicitly separate these outcomes:

  1. whether the newly written files from this import batch are valid
  2. whether the pre-existing archive tree is fully valid

If validation errors point to old archive files unrelated to the current import, report that clearly as a historical archive issue rather than an import-batch failure.

Unknown Format Handling

When the bundled parser does not recognize the input format, use this fallback sequence:

  1. Inspect the source files directly.
  2. Determine whether the structure is simple enough to map by hand.
  3. If not, write a temporary Python parser under a temp directory.
  4. Make that parser output the canonical archive JSONL shape from {baseDir}/references/schema.md.
  5. Run {baseDir}/scripts/validate_archive.py on the result before claiming success.

Preferred order:

  1. bundled parser
  2. model-assisted direct mapping
  3. model-authored temporary parser

Guardrails for temporary parsers:

  • only transform source data into canonical archive JSONL
  • do not write directly into MEMORY.md
  • do not bypass the archive validator
  • keep source-specific logic isolated; do not pollute the skill with one-off code unless the format is worth supporting permanently

If a bundled parser is missing for a format that seems broadly reusable, mention that it may be worth promoting the temporary parser into a maintained parser later.

3. Distill Daily Memory

This step is model-driven.

Before writing any daily memory, switch into Plan Mode (or an equivalent explicit checklist workflow) and review the import one date at a time.

When the runtime supports subAgents or delegated parallel review, prefer using them to review imported dates one by one or in very small date batches. The goal is coverage and auditability, not speed alone.

Use the helper script to build the review checklist whenever possible:

bash
python3 {baseDir}/scripts/build_review_checklist.py logs/message-archive-raw \
  --source-archive <archive-name> \
  --source-provider <provider> \
  --md-out tmp/chat-import-review-checklist.md \
  --json-out tmp/chat-import-review-checklist.json

This helper gives you a date-by-date checklist with entry counts so the Plan Mode review can be explicit and auditable.

Required review process:

  1. list every imported YYYY-MM-DD.jsonl date file first
  2. create a checklist covering all imported dates
  3. when subAgents are available, assign imported dates one by one, or in very small date batches, so every date has an explicit review owner
  4. read each date fully before deciding what to write
  5. do not infer from titles, conversation names, or sampling alone
  6. do not apply MEMORY.md standards when deciding daily memory
  7. after finishing review for one date, mark that checklist item as done immediately
  8. only claim daily-memory completion after every imported date has been marked reviewed
  9. when a date already has a local daily memory file, still check for missing imported bullets before deciding no change is needed

Checklist discipline is part of the workflow, not an optional nicety. If a date was reviewed, the checklist should show that review explicitly.

Before writing any memory, first read the local memory rules from the current OpenClaw environment.

Read in this order when available:

  1. local openclaw.json
    • focus on agents.defaults.compaction.memoryFlush.prompt
    • focus on agents.defaults.compaction.memoryFlush.systemPrompt
  2. workspace AGENTS.md
    • look for memory-writing rules, what counts as worth remembering, and what to exclude
  3. existing MEMORY.md
    • learn the default memory style already in use
  4. recent memory/YYYY-MM-DD.md
    • learn the local daily memory writing style from actual files, not assumptions

Use these local rules as the primary source of truth. If local rules conflict with anything in this skill, follow the local rules. The generic guidance in this skill is not an equal second source of truth; it is fallback-only scaffolding for cases where the local environment is missing rules or is still too vague to decide.

For ready-to-use prompt templates, read {baseDir}/references/prompts.md.

For each relevant date:

  • read the imported archive entries for that day
  • decide what is important enough to preserve in that day's log by applying the local OpenClaw memory rules first
  • only if those local rules are missing or too vague, fall back to the generic daily-memory heuristics bundled with this skill
  • write only the few items that survive that local-rule-first judgment
  • match existing OpenClaw daily memory style

Daily memory is a day log, not a default-memory summary. Do not over-filter it using long-term-memory standards.

Good output shape:

md
# 2024-04-14

<!-- imported-memory provider=claude archive=data-...zip -->
- 开始用 Claude 辅助起草中文股东信,采用“逐段整理,最后整合全文”的工作方式。

Bad output shape:

  • profile dumps
  • long autobiographical summaries
  • “Claude 备份显示……”
  • verbose provenance in the body

4. Distill MEMORY.md Candidates

Choose one of these modes explicitly:

  1. source-memory only Use a dedicated memory-like file from the import source when available, such as Claude memories.json.

  2. archive-distill only Distill MEMORY.md candidates directly from the imported archive.

  3. hybrid Use source memory as the base, then refine or supplement it from archive evidence.

Default:

  • if source memory exists, prefer source-memory only
  • only use archive-distill only or hybrid when the user explicitly wants the heavier path

Before choosing wording and granularity, read local MEMORY.md and recent daily memory files so the imported candidates match the current workspace style.

Preferred user-facing wording:

  • call MEMORY.md the default memory or 默认记忆
  • only use “长期记忆” when needed to contrast it with daily logs
  • avoid treating “long-term memory” as the canonical product term

Warn the user that archive-wide MEMORY.md distillation is slower and more dependent on model quality.

5. Stage Review Payload

After the model writes daily memory bullets and MEMORY.md bullets, save them in a JSON payload with this shape:

json
{
  "daily_memory": [
    {
      "date": "2024-04-14",
      "source_provider": "claude",
      "source_archive": "claude-export.zip",
      "bullets": [
        "开始用外部模型辅助起草正式中文文稿,采用“逐段整理,最后整合全文”的工作方式。"
      ]
    }
  ],
  "memory_md": [
    {
      "section": "关于用户",
      "source_provider": "claude",
      "source_archive": "claude-export.zip",
      "bullets": [
        "用户可在多语言环境中自然切换,个人交流常偏好中文。",
        "长期关注科技、游戏与时事。"
      ]
    }
  ]
}

Then stage or apply with:

bash
python3 {baseDir}/scripts/memory_merge.py /path/to/payload.json --review-root tmp/chat-history-import-review

Use memory_md as the preferred payload key. long_term_memory is still accepted for compatibility, but new work should use memory_md.

6. Apply

Daily memory can be applied directly:

bash
python3 {baseDir}/scripts/memory_merge.py /path/to/payload.json --memory-root memory --apply-daily

MEMORY.md candidates must be confirmed first:

bash
python3 {baseDir}/scripts/memory_merge.py /path/to/payload.json --memory-file MEMORY.md --apply-long-term

After a successful import, ask the user whether they want to delete the source archive, extracted source directory, and temp files to save disk space. Do not delete them without explicit confirmation.

Output Expectations

When reporting progress or completion, include:

  • detected source format
  • archive root written
  • import-batch validation result
  • full-archive validation result (if checked)
  • reviewed dates / total imported dates
  • which daily memory dates were updated
  • whether MEMORY.md candidates were only staged or also applied

Guardrails

  • Do not claim imported archive compatibility unless validation passes.
  • Do not describe the current import as failed when only pre-existing archive files failed full-archive validation.
  • Do not imply that imported history will automatically be searchable unless the workspace also has an archive-retrieval workflow such as conversation-history.
  • Do not imply that future live chats will keep flowing into the same archive tree unless conversation-archive or equivalent live archive plumbing is enabled.
  • Do not let imported daily memory read like a profile summary.
  • Do not silently overwrite existing MEMORY.md facts.
  • Do not add bulky metadata into daily memory bodies.
  • Do not skip daily-memory review based only on titles, thread names, or sparse sampling.
  • Do not apply MEMORY.md filtering standards to daily memory distillation.
  • Do not assume unknown source formats can be handled safely without inspection.
  • Do not promote a temporary parser into the skill unless it is stable and broadly reusable.
  • Do not invent memory-writing preferences when the local OpenClaw environment already exposes them in config or existing memory files.

Read {baseDir}/references/schema.md before changing archive output.

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Chat History Import AI 技能有什么作用?

Use when the user wants to import external chat exports into OpenClaw. This skill normalizes raw chat history into conversation-archive-compatible JSONL, then guides the model to distill daily memory and `MEMORY.md` candidates before applying merges with user confirmation.

为什么在 TypingMind 中使用 Chat History Import?

因为您只需安装一次,就能搭配任何模型使用。Chat History Import 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Chat History Import?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/dashhuang/openclaw-chat-history-import/tree/main。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Chat History Import?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Chat History Import 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Chat History Import 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Chat History Import AI 技能免费吗?

是的。dashhuang 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇