Introduction
DeepSeek Harness session import function converts conversation logs saved by Claude Code, Codex, OpenCode and other coding agent tools into editable sessions usable inside Harness. The dsh-chat-import plugin README documents support for 21 different source formats. After import, migrated sessions can be refreshed, opened and continued directly in DeepSeek Harness. It is critical to clarify that this operation only transfers historical dialogue records. It will not automatically copy or modify the original project files.
This guide defines what data will and will not be migrated. The core of session import is the full context trace, which includes user messages, model replies, tool calls, tool return payloads, titles, model identifiers and timestamps. Each imported conversation becomes an independent session in DeepSeek Harness. The table below clarifies the scope of imported assets.
| Content | Included in Import | Explanation |
|---|---|---|
| Messages between users and agents | Yes | Acts as readable context to resume ongoing tasks |
| Tool calls and return results | Yes | Restores the complete task execution trace |
| Reasoning content, titles, model tags and timestamps | Yes | Marked as full-fidelity import in the README |
| Local project source code files | No | The target environment needs to re-open the repository separately |
| Skills, Hooks and global configuration settings | No | Requires dedicated migration utilities for configuration transfer |
| Unfinished repeated retry steps | Conditional | Converter removes ghost retry records to prevent repeated call ID folding failures |
Session import is different from full configuration migration. dsh-chat-import handles conversation history only. If users need to migrate Skills, Hooks, global parameters and permission rules, they need to run dsh-movein separately. Official README explicitly reminds users that these two functions have no built-in linkage. Developers should not treat imported sessions as a complete replica of the original development environment.
Step 1: Install the Plugin
DeepSeek Harness Web profile supports direct npm package installation for the plugin. Run the command below in your terminal:
dsh plugin -profile web add dsh-chat-importIf developers have checked out the plugin source code locally, use the link mode for installation:
dsh plugin -profile web add -w link:/path/to/dsh-chat-importAfter installation, restart or refresh the Harness interface. Verify that the “Import sessions” panel appears at the bottom-right corner. The plugin provides two entry points: GUI and command-line invocation. New users are recommended to start with the graphical interface. It is easier to inspect the scanned file scope and avoid path errors.
Step 2: Prepare Session Directories for Three Supported Sources
Successful import depends on passing session files or directories instead of raw repository folders. The parameter template provided in the official README is shown below.
import_chat({ format: "claude", path: "~/.claude/projects" })
import_chat({ format: "chatgpt", path: "~/Downloads/chatgpt-export/conversations.json" })
import_chat({ format: "local-jsonl", path: "D:/downloads/session.jsonl" })For Claude Code, scanning usually starts from the path ~/.claude/projects. Codex and OpenCode require locating the actual JSON or JSONL session log files under their respective storage directories before feeding paths to the importer. Default directories vary between operating systems and tool versions. Always verify file existence before starting import jobs.
A stable preparation workflow follows these four steps:
- Close source tools actively writing log data, to prevent log growth during import.
- Copy target session files to a temporary folder and retain original files as rollback backups.
- Import one single session for testing. Confirm titles, the last round of messages and tool outputs exist normally.
- After single-session validation passes, perform batch scanning for remaining sessions from the same source.
Step 3: Import Claude Code Sessions
Claude Code is one of the officially listed supported sources. The GUI workflow is to open the Import sessions panel, select the claude format and session directory, then tick the target sessions to import.
The JavaScript parameter configuration for programmatic invocation:
import_chat({
format: "claude",
path: "~/.claude/projects"
})Once import completes, refresh the session list and open the newly imported conversation. Three validation points must be checked: whether the final user message remains intact, whether tool calls and corresponding results appear in pairs, and whether the original conversation title is preserved. If plain text shows up without tool traces, double-check that the correct format is selected and the path points to raw log files instead of exported summaries.
Step 4: Import Codex Sessions
Codex is also included on the support list. Do not reuse the Claude directory parameters directly for Codex imports. Locate local Codex session logs first, and select matching import format based on file type. JSONL files can use the local-jsonl entry for validation.
Sample code for JSONL files:
import_chat({
format: "local-jsonl",
path: "/absolute/path/to/codex-session.jsonl"
})Windows file paths require double backslashes or forward slashes:
import_chat({
format: "local-jsonl",
path: "D:/work/migration/codex-session.jsonl"
})Codex sessions often contain lengthy tool outputs. Start with individual file imports to confirm Harness renders complete traces before expanding the scope. Avoid submitting the entire log directory to the converter at once. This reduces the risk of duplicate imports and simplifies locating corrupted files.
Step 5: Import OpenCode Sessions
OpenCode is another explicitly supported source. The core operation is to locate the OpenCode session storage folder and select the corresponding OpenCode format in the GUI. When calling via scripts, format strings should follow the enumeration values listed in the current Usage Reference. The README shows claude and local-jsonl examples, but it does not list all format strings on the front page.
Recommended operating sequence:
- Select OpenCode source in the Import sessions panel and let the plugin auto-discover available sessions.
- Select only one short conversation for the first trial.
- Open the result and verify messages, tool calls and timestamps.
- Batch import longer conversations after validation.
If automatic discovery fails to locate files, run scan_discover to check available sources, then pass returned absolute paths into import_chat. Do not guess OpenCode cache directories based on past experience, since different installation types use different data locations.
Three Common Import Failures and Troubleshooting
Empty Session After Import
The most frequent root cause is mismatched format and file structure, or passing directory summaries instead of raw logs. Try importing a single file first and switch formats accordingly. Avoid repeated batch retries before root cause resolution.
Lost Tool Call Records
Tool calls depend on matching result records. The plugin handles special failed ghost retry logic: when a call returns empty results and the next step repeats the identical call ID, the converter discards redundant steps. This prevents repeated call IDs from breaking trace folding. It does not mean all damaged log records can be fully recovered.
Continuous Duplicated Sessions
Check plugin history first when duplicate sessions appear. According to the README, users can view the imports.json record on the History tab and remove sessions created by the plugin. Before batch operations, record source file names and import timestamps to prevent repeated scans of the same directory.
Integrate with Treerouter API Configuration
Session migration only transfers conversation history. Model invocation configurations remain under DeepSeek Harness runtime settings. When teams need a unified model entry across multiple coding agents, they can configure Treerouter independently.It supports various model variants, including DeepSeek-V4, Kimi-K3, GLM-5.3, MiniMax-M3, and more. You can switch between models compatible with the OpenAI format using a single API key.
Sample yaml configuration:
provider: openai-compatible
base_url: https://treerouter.com/v1
api_key: ${TREEROUTER_API_KEY}
model: deepseek-v4-xxxStore secrets inside environment variables. Do not write API keys directly into JSONL session files, and never commit logs containing sensitive tokens to Git. Before importing history sessions, inspect files to remove Authorization headers, cookies and other confidential fields.
Deciding When to Import or Restart a Fresh Session
Import is suitable for scenarios where tasks are partially completed. Original agent tool traces are critical to continue work, or when consolidating research workflows from multiple tools into Harness. If the original conversation contains massive failed attempts, sensitive expired context, manual rebuilding may produce cleaner results.
Use fresh sessions when old traces contain too many invalid retry loops or obsolete assumptions. Use import when retaining step-by-step tool reasoning is required for audit and continuation. All feature limits and format compatibility follow the current Usage Reference of dsh-chat-import plugin. This article is based on the September 2025 release of the plugin documentation. Users should check official changelogs for updates before large-scale migration projects.
Conclusion
The dsh-chat-import plugin expands DeepSeek Harness interoperability across mainstream coding agent tools. Developers can migrate dialogue history and tool traces from Claude Code, Codex and OpenCode without recreating tasks manually. The workflow includes plugin installation, source file preparation, format selection, staged validation and batch migration.
It is essential to separate conversation history migration from environment configuration migration. Imported sessions carry message and tool traces only. Skills, Hooks and repository files are not transferred automatically. Teams must also handle common failure modes such as empty sessions, missing tool calls and duplicate records. Combined with an API gateway such as Treerouter, the platform can serve as a unified routing layer for multi-model coding workloads.
Before large-scale production migration, always run small-scale tests and keep original log backups. Validate trace integrity, permission scope and secret removal. This reduces risks of broken tool chains and credential leaks during session migration.
Learn more:https://treerouter.com






