Import the conversation history of other AI coding assistants into DeepSeek Harness (DSH) as resumable sessions — named after what was actually asked, and filed into one workspace per source.
Supported sources: Claude Code, Codex CLI, WorkBuddy, Cursor, and optionally Trae (prompt-only). Two packages live in this repository:
| Package | Path | What it is |
|---|---|---|
dsh-ai-import |
root | the converter: scanning, naming, session writing, grouping, the /import-ai command and two agent tools |
dsh-ai-import-ui |
packages/ui |
the Web panel: a floating “AI 导入” button, a right-hand drawer, and a three-column pick-and-file wizard |
The panel drives the same scanAll() / runImport() code and the same ledger as the command, so the
two can be used interchangeably.
From this repository (works today — the packages are not on npm yet):
dsh plugin add github:LoneLeave/aiplug # the converter: command-line + agent tools
dsh plugin add "github:LoneLeave/aiplug&path:/packages/ui" # adds the Web panel on top of itOnce published to npm the same two lines become dsh plugin add dsh-ai-import and
dsh plugin add dsh-ai-import-ui.
Install both if you want the panel: dsh-ai-import-ui imports dsh-ai-import/lib/* directly and
does nothing useful without it. After installing, reload the DSH Web UI page.
Nothing in this plugin runs at install time — there is no build step, no postinstall, and no
dependency to compile. The packages ship plain ESM.
/import-ai scan and report how many conversations are importable
/import-ai full list every entry (source, project, title, turns)
/import-ai run 5 --dry-run convert 5 entries without writing anything
/import-ai run import everything
/import-ai run cursor import one source only
/import-ai run --force re-import what the ledger already knows (new sessions, nothing overwritten)
/import-ai status where the ledger lives, how much has been imported
The same capability is exposed as two tools:
ai_import_scan({ detail: "summary" | "full" })ai_import_run({ sources?, dryRun?, force?, limit? })
Click AI 导入 in the bottom-right corner (it sits above the “🐳 Claude 迁移” button), or open Settings → AI 对话导入. The drawer has two modes.
Simple mode — five source cards, each showing its resolved path (手动指定 / 自动探测 /
未找到) and a one-line tally 新增 N · 已导入 M · 过滤 K. Tick the sources you want, optionally
tick dry run / force, press 开始导入, and watch a per-source progress bar and a result table.
Pick mode (wizard) — “上排三栏 + 下排整条预览”:
| Where | What | What you can do |
|---|---|---|
| top left | every source with new or changed conversations (Codex(3)) |
click one; the middle column lists its candidates |
| top middle | that source's candidates with checkboxes; for a folder, archived sessions (grey, not checkable) followed by each source's unimported candidates | tick what to import; click a row to preview it below |
| top right | every folder under <DSH_HOME>/ai-import/groups plus an input + 建立 / 归档到 / 取消归档指定 |
create a folder, or point the current selection at an existing one |
| bottom, full width | the message stream of the selected conversation (question / answer / thinking / tool call) | decide whether this one is worth importing |
So “import three of these into an existing folder” is: click the folder, tick the conversations in the middle column, press 归档到, then 导入勾选的 N 条.
Titles come from, in order:
- a title the source itself recorded — Claude's
custom-title/ai-title, Codex'sstate_5.sqlitethreads.name/threads.title(falling back tosession_index.jsonlthread_name), a Cursor composername; - the first line of the first human question, with injected noise stripped (
<system-reminder>,<user_info>,# AGENTS.md instructions,@skill:"…", Codex review templates), cut at the first sentence-final punctuation, at most 56 characters; <source> <date time>;<source> conversation N.
Three traps that are handled explicitly: Codex's thread_name contains repeated automation titles
(Guardian review, Weekly review, hi) — only names that appear exactly once in the whole index
are trusted; Codex also keeps internal threads (42 guardian_review, 60 subagent, 8 automation
in a typical install) whose titles are all the same string, so they are skipped and counted as
“filtered” unless you set codexIncludeInternal: true; and an unnamed Cursor composer stores a UUID
in name, which is treated as no name.
Newer Codex CLI builds write ~/.codex/sessions/**/rollout-*.jsonl.zst instead of plain .jsonl.
The reader decompresses with zlib.zstdDecompressSync (Node 22.15+ / 24.9+) and feeds the result to
the same converter, so nothing else changes. Two details worth knowing:
- The ledger key drops the
.zstsuffix, so sessions imported before the format change are still recognised as “already imported” instead of reappearing as new. - A single rollout can be large (the biggest one seen here was 218 MB compressed / 301 MB of text, about 1.7 GB of peak memory while converting), so imports run one file at a time.
DSH 0.2.1-rc.5 tightened one rule: a system/message is only allowed as the first node of the
session surface. Anything else throws system/message requires a protected first surface head.
That matters because of how a session with no system message behaves: when you resume it and ask
something, SystemPromptProjection finds head === undefined and appends a system message in the
middle of the surface — and the file becomes unreadable. Imported sessions used to have no system
message at all, so this happened to any imported conversation you continued.
The importer now writes an empty system/message (content: [], source.kind: 'system-prompt')
right after the first step/start and before the first user/message. It claims the protected head,
so later system-prompt updates go through surfaceOp: replace instead of a mid-surface append. Older
imports can be fixed in place with tools/repair-system-head.mjs, and tools/verify-all.mjs
revalidates every imported session with DSH's own validator.
One workspace per source, not per project:
| Source | Directory | Workspace title |
|---|---|---|
| Claude Code | <DSH_HOME>/ai-import/groups/claude |
Claude 对话 |
| Codex | <DSH_HOME>/ai-import/groups/codex |
Codex 对话 |
| WorkBuddy | <DSH_HOME>/ai-import/groups/workbuddy |
WorkBuddy 对话 |
| Cursor | <DSH_HOME>/ai-import/groups/cursor |
Cursor 对话 |
| Trae | <DSH_HOME>/ai-import/groups/trae |
Trae 对话 |
A session's own cwd still points at the real project directory, so opening it in DSH carries the
right project context; the group directory is used only when the original project is gone. The
wizard can also file individual conversations into any subdirectory of groups/, and the folder
name becomes the workspace title.
Every source resolves its root in this order: plugin config → the path remembered in the panel
(<DSH_HOME>/ai-import/roots.json) → environment variable → platform default. Windows, macOS and
Linux defaults are all covered, and the panel's 换目录 browser writes the remembered path, so a
machine with a non-standard install location works without editing any configuration file.
Trae is off by default (prompt-only data): enable it with includePromptOnlySources: true, or by
importing it from the pick-mode wizard where it appears when it has entries.
- Sessions go through DSH's own
sessionPersistenceservice, in the same on-disk format DSH uses for its own sessions, after passingvalidateSessionEvents, so they can be resumed normally. - Every session also gets a projection-cache record (
titleandsessionListMetadata), because DSH's session list reads cold sessions from that cache — without the record an imported session shows up as “未命名” (untitled) until it is opened once. - The ledger is
<DSH_HOME>/ai-import/imports.json: source key → session id, fingerprint, turns. Re-running only picks up new or changed files; a source file that grew appends to its session instead of creating a second one. - Imported session ids look like
import-claude-<uuid>, namespaced by source so they cannot collide with sessions imported by other tools.
Source files are only ever read. Nothing in the original assistant's directories is moved, renamed or deleted.
- DSH
0.2.x(theengines.dshrange inpackage.json); last verified against0.2.1-rc.5. - Node.js
^22.19.0 || >=24.9.0(zstd support is required for compressed Codex rollouts). - Official
@deepseek-ai/*packages are declared aspeerDependencies, not bundled.
Apache-2.0. See LICENSE. 中文说明见 README.zh.md.

