360 Secure SkillHub
360 安全技能中心

chat-history-importer

解析 OpenAI ChatGPT 与 Anthropic Claude 的对话导出文件,自动识别格式,按日期生成 memory/episodic/YYYY-MM-DD.md 情景记忆摘要,并按对话 ID 去重;支持 dry-run、日期筛选和从工作区读取说话人名称。

分类:知识
djc00p
djc00p
热度 45.65
最近更新 2026-11-05 03:01:22

安装

发给 Agent
帮我安装这个技能:npx secure-skills-cli add djc00p/chat-history-importer
兼容性
OpenClaw 专属
联网要求
不联网
数据出网
数据不出本机
Metadata
name
chat-history-importer
description
Import AI conversation exports (OpenAI ChatGPT and Anthropic Claude) into your agent's episodic memory. Parses export files, writes daily memory summaries, and deduplicates on re-runs. Trigger phrases: import chat history, ingest conversation export, import chatgpt export, import claude export, load AI conversation history.
metadata
{"clawdbot":{"emoji":"📥","requires":{"bins":["python3"],"env":[]},"env":[],"os":["linux","darwin","win32"],"homepage":"https://clawhub.com/djc00p/chat-history-importer","envVars":[{"name":"OPENCLAW_WORKSPACE","required":false,"description":"Agent workspace path to write memory into. Defaults to ~/.openclaw/workspace. Set this explicitly so imports land where you expect."}],"version":"1.1.3"}}

Chat History Importer

Import years of AI conversations into searchable episodic memory. Parse ChatGPT and Claude exports and create dated daily memory files your agent can search and reference. Perfect for onboarding new agents with rich historical context or preserving important conversations for future recall. Pairs well with the chat-learnings-extractor skill for a complete conversation analysis workflow.

Before You Import

This skill writes your private chat history into your agent's persistent memory. Review these before the first run.

  • Dry run first. python3 scripts/batch.py --dir <exports> --dry-run shows what would be written without touching memory.
  • Scope the input. Point --dir at a single export folder and use --since to bound the date range. You do not need your entire history.
  • Redact sensitive content first. Chat exports routinely contain API keys, credentials, client details, and proprietary work. Remove or redact them before importing.
  • Set the target explicitly. Export OPENCLAW_WORKSPACE so the import lands in the workspace you intend rather than a default.
  • Inspect after importing. Read the generated memory/episodic/YYYY-MM-DD.md files. Memory poisoning is possible if unreviewed export content reaches it.

Quick Start

  1. Export from OpenAI: Settings → Data Controls → Export data → conversations.json
  2. Export from Anthropic: Settings → Privacy → Export data → conversations.json in zip
  3. Dry run first: python3 scripts/batch.py --dir ~/Downloads/chat_exports --dry-run
  4. Import: python3 scripts/batch.py --dir ~/Downloads/chat_exports

Key Concepts

  • Auto-detection: Identifies OpenAI vs Anthropic format automatically — no flags needed
  • Episodic memory: Writes daily summaries to memory/episodic/YYYY-MM-DD.md
  • Deduplication: Chat IDs tracked — re-running the same export never creates duplicates
  • OPENCLAW_WORKSPACE: Set this env var to point imports to the right agent workspace
  • Human speaker names: Memories are written as Kael: / Deonte: instead of assistant: / user: — auto-read from IDENTITY.md and USER.md in the workspace, making imported history feel like recalled conversations rather than raw log files

Common Usage

# Dry run — preview what would be imported without writing anything
python3 scripts/batch.py --dir ~/Downloads/chat_exports --dry-run

# Import all conversations
python3 scripts/batch.py --dir ~/Downloads/chat_exports

# Import only conversations since a date
python3 scripts/batch.py --dir ~/Downloads/chat_exports --since 2025-01-01

# Force a specific format (auto-detects by default)
python3 scripts/batch.py --dir ~/Downloads/chat_exports --format anthropic

# Override speaker names if IDENTITY.md / USER.md aren’t set up yet
python3 scripts/batch.py --dir ~/Downloads/chat_exports --agent-name "Ayo" --user-name "Deonte"

# Verbose — show message count + first user message per chat
python3 scripts/batch.py --dir ~/Downloads/chat_exports --dry-run --verbose

Tip: Use --dry-run --verbose first to see message counts and previews — great for identifying meaty conversations worth deeper analysis.

References

  • references/export-formats.md — Detailed OpenAI and Anthropic export formats, normalization rules

Original implementation by @djc00p