dshplugin.devDeepSeek Harness Plugins
DSH Plugin Codex Import plugin logo
DeepSeek Harness Plugin

DSH Plugin Codex Import

0
Published by Gordonynh

DeepSeek Harness plugin: import OpenAI Codex conversation history into DSH sessions via /codex-import | 用 /codex-import 把 Codex 历史对话导入 DSH

Sessionscodexdeepseekdeepseek-harnessdsh

Get this plugin

Review the source, then continue to the publisher.

Get this plugin
Share on X ↗

About this plugin

Source snapshot 8/14/2026

dsh-plugin-codex-import

English | 中文

A DeepSeek Harness plugin that imports your OpenAI Codex conversation history into DSH sessions — grouped into project workspaces, resumable, searchable, forkable — from a single slash command.

/codex-import
Imported 679 session(s) from /Users/you/.codex.
Scanned 681, already present 0, failed 0.
Content: 10694 turns, 81513 steps, 13580 user messages, 81513 assistant messages, 101215 tool calls.
Grouped 529 session(s) into 116 workspace(s).
Reload the interface to see the imported sessions.

Install

dsh plugin --profile web add github:Gordonynh/dsh-plugin-codex-import

Then add it to your profile's ~/.dsh/profiles/web/cordis.patch.yml:

- insert:
    - id: codex-import
      name: 'dsh-plugin-codex-import'

Restart the harness. Verify it composed with dsh --profile web --dump-config | grep codex-import.

Usage

CommandEffect
/codex-importimport every not-yet-imported Codex session
/codex-import --dry-runreport what would be imported, write nothing
/codex-import --limit 20stop after 20 sessions
/codex-import --since 30only sessions from the last 30 days
/codex-import --project ~/workonly sessions whose cwd is under a path
/codex-import --archivedalso scan ~/.codex/archived_sessions

Re-running is safe: already-imported session ids are skipped, and Codex originals are never modified.

Configuration

- insert:
    - id: codex-import
      name: 'dsh-plugin-codex-import'
      config:
        codexHome: '~/.codex'        # default: $CODEX_HOME, else ~/.codex
        provider: 'codex'            # recorded on imported assistant messages
        groupIntoWorkspaces: true    # attach imported sessions to workspaces

How the mapping works

Codex (rollout-*.jsonl)DeepSeek Harness session events
session_metasession header (id, createdAt, cwd)
user message (human)user/message, source:{kind:"user"}
injected context / developer roleuser/message, source:{kind:"plugin",plugin:"codex-import"}
reasoningreasoning block on assistant/message
assistant message / agent_messagetext block on assistant/message
function_call / custom_tool_calltool-call block + tool/call event
*_output itemstool/result, call-id matched within the step
web_search_call / tool_search_call / image_generation_callbalanced tool/call + tool/result pair
turn_context.modelAssistantMessage.source.model
first human promptsession/title event (no auxiliary model call)
event_msg telemetry, ghost_snapshot, token countsdropped (UI duplicates)

Codex records a flat item stream; the harness wants it bracketed into turn/start → (user/message | step/start … step/end)* → turn/end. The plugin rebuilds that structure using Codex turn_id stamps where present, and human message boundaries otherwise.

Storage is the harness's own. Sessions are written through ctx.sessionPersistence.create() / .append() and grouped through ctx.workspaceRegistry.create() / workspace.attachSession(). The plugin never touches the session directory, the zstd container, or the workspace registry file — physical encoding, path layout, durability, and workspace accounting all stay where they belong, so a harness format change cannot silently desync this plugin.

Repairs applied during conversion: dangling tool calls get a synthetic error result (TOOL_NOT_STARTED) so no assistant message carries an unanswered call; orphan tool outputs are dropped; non-JSON custom-tool input is wrapped as {"input": …} so tool/call.arguments stays parseable; images become a text placeholder (harness image blocks need attachment-service references a plugin cannot mint); Codex-compacted sessions import their full pre-compaction history.

Sessions whose project directory no longer exists are imported but stay ungrouped — a workspace must point at a real directory, which is the harness's own rule.

Verification

node test/verify.mjs        # grammar, argument parsing, mapping edges,
                            # + folds every real rollout through the harness
node test/integration.mjs   # boots real dsh-session, persistence and workspace
                            # plugins in a scratch root and imports through them

verify.mjs runs the harness's own foldSurface / deriveEventMessage — the exact reconstruction path a resumed session uses. integration.mjs proves the harness's real persistence accepts the headers and event batches this plugin produces, and that the workspace registry accepts the resulting sessions.

On the author's machine: 679 real sessions, 196k+ reconstructed messages, zero failures.

Caveats

  • DSH is in developer preview and pins its session format at version 0 with no compatibility promise. If a future harness refuses v0 logs, re-run the import — Codex originals are untouched.
  • Resuming an imported session sends its history to whatever model DSH has configured; provider-specific replay state is not carried over.
  • Requires Node ≥ 22 (the harness's own floor).

License

Source-available under a custom license — not an OSI-approved open-source license. Summary (the license texts control):

WhoRights
Everyonefree noncommercial use, modification, redistribution (same license, keep notices)
Individuals, worldwideadditionally: commercial use
DeepSeek & its partner enterprisesadditionally: commercial use, closed-source/proprietary derivatives, sublicensing — see the supplement
Other organizationsnoncommercial only; commercial use requires a separate license from the author

LICENSE.md · LICENSE-SUPPLEMENT-DEEPSEEK.md · NOTICE.md