跳转到内容

DeepSeek harness dsh system prompt

Related vault note (prompt-collector landscape, different product): 2026-09-28 Grok Bot system prompts collectors


ProductDeepSeek Harness — open-source agent runner (“everything is a plugin”), Cordis-based
Repodeepseek-ai/deepseek-harness (MIT; topics dsh, dsh-plugin, ai-agents, cordis)
CLI / npmnpx @deepseek-ai/dsh web · package @deepseek-ai/dsh
DocsOfficial reference · product home deepseek.com/harness · plugin index dsh.pub
StatusDeveloper preview; breaking changes expected (README, SAFETY.md)
Snapshotmaster tip 4878cdab (2026-09-28 19:48 CST / 11:48Z) — release note 0.2.0-rc.1; @deepseek-ai/dsh-system-prompt 0.2.0-rc.1

Not a DeepSeek Chat website system prompt, and not a model-weights RLHF template. It is the harness’s runtime prompt pipeline for coding/agent sessions (tools, sandbox, plan mode, workspace AGENTS.md, presets).

Alternatives briefly: community explainers such as dsh-in-depth.com/core/system-prompt mirror the architecture but lag the API (still mention older persona / order -100 in places). Prefer the repo files below. Unrelated “dsh” hits (other products/acronyms) are out of scope.


Primary implementation:

Ownership principle (Agent Note): prompt variables & tool-guidance ownership — each fact has one owner (identity vs persona vs per-tool section vs schema description).

Fixed harness opener (only hard-coded identity line)

Section titled “Fixed harness opener (only hard-coded identity line)”

Registered as section harness:identity at named order HARNESS_IDENTITY (−1000), when includeHarnessIdentity: true (default):

You are an AI agent powered by DeepSeek Harness.

Source: constructor in index.ts. Disable only for compatibility deployments that own a complete: true prompt.

Config on @deepseek-ai/dsh-system-prompt (current master):

FieldSection nameOrderDefault in dsh-base
personaPrefixdeployment:persona-prefix0'' (packages/bundle/base/cordis.patch.yml)
personaSuffixdeployment:persona-suffix10200''
includeRuntimeContext——true
toolOrder——omitted ⇒ lexicographic tool names; if set must include rest marker <unlisted-tools>

Per-agent override: mount @deepseek-ai/dsh-persona inside an agent preset to shadow the same section names (prefix / optional suffix / complete / includeRuntimeContext). Global mount collides with the registry’s own persona registration.

Templates support strict {{variable}} interpolation at render time ([a-z][a-z0-9_]*). Unknown / undefined / malformed refs throw (fail assembly rather than ship a bad prompt). Loop-supplied variables include model and cwd (plus others plugins register).


Four contribution kinds on ctx.systemPrompt:

  1. section() — system-role prose (ordered, join with blank lines after interpolate)
  2. context() — dynamic facts → user-role runtime-context snapshots (separate from system text)
  3. tools(provider) — ToolSchema[] for the model-visible tool catalog (also part of PromptAssembly)
  4. variable(name, provider) — values for {{…}}

Pipeline (assemble → optional system-prompt/assemble waterfall → restore complete section if any → renderPrompt):

  1. Merge global + agent-scope layers (scoped same-name sections/variables shadow globals)
  2. Collect tool schemas; detach/clone parameters; apply toolOrder
  3. Sort sections by ascending order, then code-unit name
  4. Run scope-filtered waterfall (listeners may rewrite assembly)
  5. If one section has complete: true, it becomes the sole system section after waterfall (tools/contexts/variables still from waterfall); multiple completes ⇒ hard fail
  6. renderPrompt: interpolate, drop empty sections, join with \n\n

Delivery to the model (critical difference vs chat): agent-loop commits rendered text as a system/message surface node in the session log / derived history (node 0, or in-history append when systemPromptUpdate: 'in-history'). The HTTP request does not carry a separate system field — the prompt is reconstructable from the session log’s request/header + surface nodes.

Runtime-context snapshot opener (when contexts present):

Current runtime context. This snapshot supersedes earlier runtime-context snapshots.

Contexts are suppressed by includeRuntimeContext: false or suppressRuntimeContext() without disabling the services that own sandbox/approval state.


Named allocation in SECTION_ORDERS (index.ts) — contributors must use getSectionOrder() / getContextOrder():

Order name≈Typical content
HARNESS_IDENTITY−1000Fixed “powered by DeepSeek Harness”
DEPLOYMENT_PERSONA_PREFIX0Deployment / preset persona
PLAN_POLICY500Plan-mode soft guidance (plan:policy)
TEAM_POLICY600Agent-team policy (experimental)
PTC_ONLY800Programmatic tool-calling guidance
FILE_REFERENCE900File-reference UX
TOOL_BASH … TOOL_COMPUTER_USE1000–3000Per-tool cross-call habits
MCP_SERVERS3100MCP server context
TOOLS_SDK5000Generated tools SDK prose
DELIVERABLE_FILE_REFERENCES9000Deliverables
STRUCTURED_OUTPUT9900Structured output
HARNESS_SOURCE10000Local harness source path hints
WEB_SURFACE10100Web GUI surface contract
DEPLOYMENT_PERSONA_SUFFIX10200Late persona suffix

Runtime context orders: SANDBOX_POLICY 110, APPROVAL_POLICY 115, SUBAGENT_DELEGATION 120.


Key behaviors the assembled prompt encodes

Section titled “Key behaviors the assembled prompt encodes”
  • Minimal first-party identity (one sentence). Behavioral “personality” is deployment/preset persona, not the harness opener.
  • Shipped dsh-base leaves personaPrefix empty — a live Web/CLI session’s chatty persona comes from presets / overlays, not from a baked novel in dsh-system-prompt.
  • Each tool plugin registers (a) a schema via the tools registry / ToolRuntime auto-provider and (b) often a short cross-call system section.
  • Example — bash (packages/shell/tool-bash):
Check the [exit code: N] marker on every bash result; investigate failures before moving on.
  • Example — fs tools (packages/fs/tool-fs README Model Experience): prefer read over cat; read-before-write/edit under observation policy.
  • Tool guidance sections often gate on visibility (ctx.tools.get(name, scope)) so restricted agents drop prose that doesn’t match their schema set.
  • Schema description owns one-call semantics; prompt sections own habits a single description can’t carry.

Plan mode (richest shipped deployment prose in base)

Section titled “Plan mode (richest shipped deployment prose in base)”

dsh-plan-mode contributes plan:policy at order 500 only while active. Base bundle ships a long soft-guidance section (explore/design, no mutating implementation, use exit_plan_mode as sole final tool call, etc.) in cordis.patch.yml. Explicitly not enforcement — sandbox + approval stay independent.

Workspace instructions (user-role, not system sections)

Section titled “Workspace instructions (user-role, not system sections)”

@deepseek-ai/dsh-agent-instructions injects $DSH_HOME/AGENTS.md + project AGENTS.md/CLAUDE.md (+ local overlays) as durable <system-reminder> user messages (budget maxBytes: 65536 in base). Lower authority than system/developer/direct user instructions.

Web app registers app:web-surface (~order 10100): model is told it is interacting via the DeepSeek Harness Web GUI at a local URL, with no implicit DOM/route/screenshot context (packages/bundle/web-app/src/index.ts).

  • SAFETY.md is a human/operator warning (experimental code execution, sandbox limits, no warranty) — not a long model refuse/allowlist block in harness:identity.
  • Model-visible policy arrives mainly as runtime-context snapshots (sandbox mode, approval policy) plus tool result markers ([sandbox: file access denied under mode], escalation via sandbox_permissions + justification).
  • Default permission posture in base: workspace-write + approval ask (env-overridable).

How this differs from plain DeepSeek chat prompts

Section titled “How this differs from plain DeepSeek chat prompts”
DeepSeek Chat / API chatdsh harness
ShapeOne optional system string (or product-owned chat template)Composable registry of ordered sections + tools + variables
ToolsOptional function-calling fields on the requestFirst-class PromptAssembly.tools; loop executes via ctx.tools
HistoryClient-managed messagesAppend-only session log; system prompt is a surface message
IdentityProduct chat personaFixed one-line harness identity + empty/default persona + plugins
WorkspaceUsually noneAGENTS.md chain as sourced user reminders
ExtensibilityPrompt string editMount Cordis plugins / presets / system-prompt/assemble waterfall
ReconstructabilityOpaque unless loggedExact past prompt reconstructable from session request/header + nodes

Using DeepSeek models inside dsh still goes through adapters (dsh-llm-deepseek-*); the harness prompt is orthogonal to whatever system string chat.deepseek.com uses.


From architecture turn flow: claim inbox → assemble prompt + tool schemas → agent/pre-step → prepare call → reconcile system/message → append users → derive history → stream LLM → tool pipeline → next step. Retries inside a step do not re-run assembly. Profiles (web, headless, sdk, sdk-minimal, acp) compose bundles; dsh --profile web --dump-config dumps the live Cordis tree.


  • No single canonical “full prompt dump” in-repo — by design the rendered text is composition-dependent (profile, presets, plan on/off, tool restrictions, persona overlays). Capturing one live assembly requires running dsh and reading session log / request/header.
  • Default Web/CLI agent persona prefix for the stock “standard” preset was not fully enumerated here (base ships empty; presets live under agent-preset composition and may change rapidly in preview).
  • GitHub code-search / third-party mirrors still surface older APIs (persona vs personaPrefix/personaSuffix, identity order -100 vs −1000, deployment:persona vs deployment:persona-prefix). Prefer raw master files; note dated Agent Notes may lag.
  • Chat.deepseek.com / API product system prompts are out of scope and not published in this harness repo.
  • Secondary sites (dsh-in-depth, mirrored “docs” domains) should not be treated as version-pinned primary sources.