xiaobright/dsh-anchored-standard

dsh-anchored-standard

Two-phase DeepSeek Harness preset: Minimal-aligned bootstrap, then full Standard tools (Project2 98/99)

未分類deepseekdeepseek-harnessllm-agent

dsh-anchored-standard

中文说明

Experimental DeepSeek Harness agent presets — a base mode, two live-anchor variants, and one seeded prefab mode — that anchor a session's model trajectory on the Minimal condition (real Minimal tool schema, no auto-injected context), then promote to a small resident catalog once the session is durable, unlocking heavier Standard tools on demand.

This is a community project. It is not an official DeepSeek preset and is not affiliated with or endorsed by DeepSeek.

The project is frozen — new issues and pull requests are no longer accepted (see Project status). For ideas for new plugins or useful findings, please submit them under the repository.

Project status (frozen 2026-09-10)

This project is frozen. On 2026-09-10 DeepSeek released V4.1 Flash and announced that V4 Pro — the model these presets were measured on and tuned for — is retired on 2026-09-14 12:00, with its traffic routed to V4.1 Flash. The presets exist to re-anchor a trajectory that the successor does not appear to need patched: the flash family anchored under every condition in our first-round dose-response probes (32/32), which is why the project never tuned for it. V4.1 Flash's own first-round trajectory has NOT been measured (no API budget in maintenance mode), so treat that as an inference from the earlier flash data, not a result. The model the work was built around is going away, so the maintenance period ends here. New issues and pull requests are no longer accepted or handled. The repository stays online with its history, data and acknowledgement record intact.

This is the ending FAREWELL.md asked for: "let the next model eat more diverse harness environments during training, so that patch engineering like this is no longer necessary." That file now ends with a closing note written by the successor model itself, V4.1 Flash. What stays valid is the model-agnostic part — the context-gate unified injection control, the prefab pipeline, the discovery-tool dose-response data, and the general observation that the API-visible surface conditions the trajectory. Research material remains open in DeepseekCotexplorations.

Earlier status (2026-08-17, kept for the record): following the price increases on both the DeepSeek official API and the opencode go subscription, active development had already stopped — the evaluation loops these presets depend on (Project2-class runs and multi-trial roll/probe experiments) were no longer affordable, leaving the repository in maintenance only mode (bug fixes and harness-compatibility updates when feasible). A personal note from the maintainer: FAREWELL.md (Chinese). Contributors and collaborators are listed in ACKNOWLEDGEMENTS.md.

Community projects that users report perform better in some scenarios, plus ecosystem tooling built around these presets:

  • dsh-routing-suite — a runtime injector plus task-aware thinking-mode routing presets (the router-standard family).
  • J-Space Cognition Suite — a model-agnostic inference-time cognitive control layer packaged as a Skill.
  • both-anchored (auto-b7n) — an independently developed two-phase anchored preset: no first-request output cap, no promotion gate, promotion on the first durable tool/call or assistant/message, with the full PTC SDK kept intact via post-promotion wire trimming (the #85 feedback and experiment data live in the research repository, with sample sizes and boundary caveats stated in the original contribution).
  • dsh-recovery — a zero-dependency self-healing CLI plus watchdog plugin: broken-preset quarantine/rollback, safe-mode whitelists, and boot probes.

Modes at a glance

ModeDirectoryFirst model requestAnchor mechanismPromotion signalCost
Anchored Standardpreset/2 tools (the Minimal pair)Minimal tool schemafirst durable tool/call or assistant/message (promoteOn: either)none
Zero-Anchored Standardzero-anchored-standard/0 toolsone fixed anchor turnthe anchor reply (assistant/message)+1 model call
Whoami Standardwhoami-standard/0 toolsone "你是谁" self-introduction turnthe self-introduction reply (assistant/message)+1 model call
Prefab Anchored Standardprefab/seeded rolled historybundled successful trajectoryalready promoted in the seedno model call to instantiate
Eternal Minimaleternal-minimal/2 tools, foreverthe visible catalog never grows; heavier tools run via the dshx bash gatewaynone (no phases)none
Wire Think-Execute Standardwire-think-standard/tools present, tool_choice: none on the wiresibling provider route per think stepper-turn: the steer itself+1 model call/turn, prefix-cache churn
Combo Anchoredcombo-anchored/0 tools, on every user turnthink/execute split + depth gate + deliberation drip as three independent rowsper-mechanism+1 model call/turn

Every mode directory is self-contained and installs alone under whatever id you copy it to (see Install). The prefab hydrates the blank session in place when its preset is selected; no per-workspace import is required.

Terminology

  • trajectory — the style of the model's first reasoning chain. The Minimal condition produces "We need…" first lines; the Standard condition produces "Let me…" ("standard-like") first lines.
  • anchor — the first-request conditions that select the trajectory. Issue #11 isolated three levers: the tool schema, the output budget, and the injected reminders.
  • bootstrap phase — request #1 of a session: the bootstrap tool pair, no auto-injected context, optional output cap.
  • promotion — the durable session event that ends the bootstrap phase. Base mode: first tool/call or assistant/message, whichever comes first. Variants: the anchor reply.
  • durable — recorded in the session event log. Phase state is derived from durable events, so resume and reload preserve it.
  • resident catalog — the promoted tool set: the bootstrap pair plus the discovery tools plus every tool the model explicitly unlocked.
  • discovery tools — dev_tool_search, skill_search, skill_load: the on-demand unlock surface for heavier Standard tools.
  • materialized copy — the committed copy of a shared/ plugin inside a mode directory, generated by npm run sync.

How it works

The base mode in one request lifecycle (the variants change only the first turn — see their sections):

user's first message
        │
        ▼
┌ request #1 ─ bootstrap phase ──────────────────────────────┐
│ tools    : bash + str_replace_editor (Minimal's real pair) │
│ context  : no AGENTS.md digest, no skill-catalog reminder  │
│ budget   : adapter default (`bootstrapMaxTokens` optional) │
└─────────────────────────────────────────────────────────────┘
        │ first durable tool/call OR assistant/message
        ▼ PROMOTION — derived from durable events, resume-safe
┌ request #2+ ─ resident phase ──────────────────────────────┐
│ tools    : bootstrap pair + discovery tools + unlocked     │
│ context  : standard injections restored                    │
│ budget   : adapter default (a cap is stripped on promote)  │
└─────────────────────────────────────────────────────────────┘

Three first-request levers decide the trajectory (issue #11):

  1. Tool schema — the decisive variable at the adapter-default maxTokens (256000). The real Minimal pair anchored 5/5; every standard-family schema fell standard-like 11/11.
  2. Output budget — a 1024 first-request cap also anchored the trajectory (26/32), independent of the tool descriptions. That measurement kept the first round inside the cap; when the first reply exceeds it, the truncation-continuation loop amplifies drift instead (we-fingerprint 0.17 capped vs 0.98 uncapped, #85). The base mode leaves this lever unset (bootstrapMaxTokens is opt-in).
  3. Injected reminders — the AGENTS.md/CLAUDE.md digest and the available-skills reminder. With the skill catalog present, the anchor did not reproduce at all (0/9). The base mode now suppresses EVERY automatic injection during bootstrap at the harness's two unified injection paths (the context-gate plugin), not just the two measured ones.

Why

DeepSeek V4 Pro conditions strongly on the API-visible tool catalog. In the Project2 evaluation, Standard and PTC produced scores of 91 and 92, while the official Minimal preset produced 99 and 96. Permanently staying on Minimal, however, gives up the Standard preset's broader tool set.

Anchored Standard separates initial trajectory selection from later tool use:

  1. Keep the complete Minimal system prompt.
  2. Expose the Minimal preset's REAL tool schemas — persistent bash + str_replace_editor, byte-identical to the official Minimal composition — on the first model request (lever 1 above).
  3. Suppress EVERY auto-injected context on that first request — at the harness's unified injection paths, not per source name (the context-gate row, mounted FIRST; lever 3). While the session is unpromoted the assembly's dynamic runtime-context contributions are blanked (the whole SystemPrompt.context() family: sandbox/approval policy snapshots and any third-party context provider), and the pre-step waterfall keeps only the CLAIMED message batch plus a small kind allowlist (a user-initiated skill gesture survives; skill catalog, AGENTS.md digest, time/tmux context, hooks, and unknown third-party injections are stripped by default). After promotion the gate opens and the loop's own snapshot projection diffs exactly ONE fresh runtime-context message into the next request — minimal first round, injections on the second round. A compaction/end boundary re-closes the gate the same way.
  4. After the session records its first durable promotion signal — a tool/call or the first assistant/message, whichever comes first — promote to the RESIDENT catalog: the bootstrap pair plus the discovery tools plus whatever the model has explicitly unlocked via dev_tool_search. Dumping the full Standard catalog at promotion pulled the trajectory back to standard-like behavior (the post-promotion regression), so heavier tools — web_search, subagent, workflow, … — stay one dev_tool_search call away. Request #1 always sees the bootstrap catalog; request #2 always sees the resident catalog, so a text-only first reply can no longer trap the session in bootstrap. (promoteOn in the tool-bootstrap row selects the trigger: either default, tool-call, or assistant-message.)
  5. Derive the phase from durable session events so resume and reload preserve it.

The bootstrap catalog is the same on every platform: the Minimal pair (bash/str_replace_editor). The preset's shell is the persistent PTY bash (the sandboxed Standard bash row is disabled — both register the bash name into the same layer, and the tools registry rejects duplicates; Windows never had the sandboxed bash anyway). pwsh remains available in the promoted catalog on Windows.

Results

The anchored family was validated on Project2 with three V4 Pro scores of 98, 99, and 99. Provenance note (issue #60): those three runs predate the current composition — they used the Minimal system prompt with a first-request pwsh + read surface and promoted to the full 25-tool Standard catalog; the exact Minimal pair (persistent bash + str_replace_editor) with the small resident catalog was introduced afterward. The bundled generic prefab removes Project2-specific warm-up facts and was not re-benchmarked before the API price change, so those scores must not be attributed to the generic template.

Independent replications: the trajectory anchoring reproduces strongly, but the ability gap is unresolved at small n — see #65 (anchoring 9/9 separated by preset; anchored−standard +3.3, 95% CI [−2.6, +9.3]) and #51 (multi-env, Ability 85–90, 98/99 not reproduced). Treat the scores above as our original observations, not a settled effect size.

Research write-ups live in the companion exploration repository DeepseekCotexplorations (data and methodology; this repository keeps the code):

Development-process records (what was done, why, and the pitfall lists) are kept in this repository as HANDOFF.md and HANDOFF-2.md.

Configuration reference

All knobs are rows in each mode's agent.cordis.yml. Unknown keys fail at preset mount.

context-gate (mounted FIRST in preset/, zero-anchored-standard/, and whoami-standard/ — waterfall registration order makes the gate the outermost transform; the plugin lives in shared/context-gate.mjs and is reusable by any other composition that wants unified injection control alone):

KeyDefaultMeaning
promoteOneitherPromotion trigger: either, tool-call, or assistant-message (the variants use assistant-message).
includeSubagentsfalseGate subagents too (true in the base mode and whoami; keep in sync with the bootstrap row).
enabledtruefalse disables both interception paths (A/B testing without touching the row set).
allowKinds[skill-invocation]source.kind values allowed beyond the claimed batch; [] keeps ONLY the claimed batch.

Injection control division of labor: session-phase suppression (everything keyed on a promotion boundary) belongs to context-gate. Two documented exceptions keep their own enumerated suppressedContextSources strip because the gate's phase machine does not map onto their scope: the think-step strip in think-phase/wire-think (per-step, not per-session-phase) and the permanent every-request strip in eternal-minimal (no promotion boundary; frozen to the configuration its recorded measurements were taken under).

tool-bootstrap (in preset/agent.cordis.yml; mount right after context-gate):

KeyDefaultMeaning
bootstrapTools[bash, str_replace_editor]Tools visible on request #1.
promoteOneitherPromotion trigger: either, tool-call, or assistant-message.
bootstrapMaxTokensunsetOptional output cap for request #1; stripped after promotion. A cap below the first round's actual output truncates it and amplifies drift (#85) — the default stays unset for this reason.
includeSubagentsfalseSubagents take the bootstrap phase too (true in the base mode).
compactionTools[]Extra tools available between a compaction boundary and re-promotion.

zero-tool-bootstrap (in zero-anchored-standard/ and whoami-standard/): compactionTools has the same semantics (promotion is always the first assistant/message), plus includeSubagents, whether subagents also take the anchor phase (set true in whoami-standard, false in zero-anchored-standard). Context suppression is NOT here — both variants mount the context-gate row (above) with promoteOn: assistant-message; the bootstrap's former suppressedContextSources key now fails at mount.

anchor-turn (in both variants): text — the synthetic first user message (default "This round is a test. Tools are not open yet; all tools will open next round." in zero-anchored, "你是谁" in whoami); includeSubagents — whether subagents also take the anchor turn.

eternal-minimal (in eternal-minimal/; the row must stay FIRST):

KeyDefaultMeaning
guidetrueAppend the short dshx capability guide to the system prompt; false keeps the persona byte-pure.
gatewaytrueIntercept dshx shell commands and execute the real tools; false leaves the bare Minimal pair.
gatewayCommanddshxThe interception word.
maxGatewayChars12000Cap on one gateway result payload.
suppressedContextSources[agent-instructions, skill-catalog]Stripped on every request (no promotion boundary; the enum intentionally stays — see the division-of-labor note above).

cot-drip (in combo-anchored/):

KeyDefaultMeaning
every4Attach one deliberation beat after every Nth tool result; 0 disables the drip.
maxPerTurn1Beats per turn.
textbuilt-in beatThe reminder text (one "We …" sentence restating the remaining goal).
includeSubagentsfalseWhether subagent calls are dripped too.

toolchoice-adapter (in wire-think-standard/; the row must stay the first LOCAL row):

KeyDefaultMeaning
providerdeepseek-wire-thinkThe sibling route id the adapter owns; registering an id twice throws DUPLICATE_ADAPTER (caught, degraded).
toolChoicenoneThe wire tool_choice sent whenever tool definitions are present.
baseURL / apiKeyEnvsettings/envRow config first, then the llm-deepseek settings section, then DEEPSEEK_BASE_URL / DEEPSEEK_API_KEY.
logprobsfalseOpt-in research hook: request token logprobs and log a per-request mean summary (no StreamChunk surface exists).

wire-think (in wire-think-standard/): same mode / suppressedContextSources / includeSubagents / steerText semantics as think-phase, plus provider (must match the toolchoice-adapter row's id) and defaultProvider (the route execute steps restore onto, default deepseek-official).

instruction-hint (all modes): promoteOn matching the mode's promotion semantics (either in the base mode, assistant-message in the variants) — the one-shot "instruction files exist, read them before acting" hint waits for promotion.

Repository layout

preset/                  Anchored Standard — the base mode
zero-anchored-standard/  variant: fixed zero-tool anchor turn
whoami-standard/         variant: "你是谁" anchor turn, subagents inherit
eternal-minimal/         variant: Minimal pair forever + dshx bash gateway
wire-think-standard/     variant: wire-level condition (tools + tool_choice=none)
combo-anchored/          combination package: think split + gate + drip rows
shared/                  single source of truth for plugins used by 2+ modes
scripts/sync-modes.mjs   materializes shared/ plugins into every mode dir
test/                    zero-dependency test suite (npm test)
verify/                  one-shot headless verification runner
prefab/                  Prefab Anchored Standard + bundled session template

prefab/ ships a generic template by default and a Project2-specific template as an explicit opt-in. Both contain real model reasoning; read the mode's installation notes before use.

Invariants, enforced by npm run check:

  • Every mode directory is self-contained: installable by copying it alone; agent.cordis.yml rows may reference only ./local.mjs files, never ../.
  • Plugins shared by several modes live once in shared/; the copies in mode directories are generated. Edit shared/, run npm run sync, commit both — never edit a materialized copy.
  • The context-gate row stays the FIRST row of preset/agent.cordis.yml (the gate must register before every injecting plugin), with tool-bootstrap right after it. The same first-row rule holds for the context-gate row in zero-anchored-standard/ and whoami-standard/.

This repository deliberately ships no AGENTS.md/CLAUDE.md: the presets' whole mechanism is a clean request #1, stripping exactly those instruction-file digests from it (issue #6: 0/9 anchored with the injection present). Shipping one would only feed later rounds and contradict the mechanism being documented. Everything an assistant needs is in this README.

Compatibility

Developed and tested against:

  • DeepSeek Harness 0.1.0-rc.5
  • repository commit 47f9438
  • Node.js 24 on Windows

DeepSeek Harness 0.1.3-alpha.1 removed the public session.events array in favor of session.snapshotEvents() (a frozen copy whose cache is invalidated on every append). Since PR #88 every history scan prefers snapshotEvents() and falls back to session.events, so the presets load on both old and new harness builds. Verified against the 0.1.3-alpha.1 source (the session API surface the plugins touch, plus the plugin hook names) and by the mock suite; not by live runs on that build.

DeepSeek Harness 0.1.3-alpha.2 replaced the dsh-persona row's text key with a required prefix (plus an optional suffix), so every mode's preset failed to mount with invalid config: $.prefix missing required value. Since PR #90 the persona rows use prefix: — the persona TEXT is unchanged (it still matches the official 0.1.3 minimal persona row byte-for-byte), so the byte-pure Minimal anchor condition is unaffected. This part is a one-way migration: a preset row cannot carry both keys (unknown keys fail at mount), so on dsh 0.1.3-alpha.1 and older the persona row must use text: again — change that one line per mode directory, or use the commit before #90.

The persistent shell resolves shellPath adaptively: it keeps the terminal-bash plugin default /bin/bash on hosts where that absolute path exists, and falls back to bash (PATH lookup) otherwise — e.g. NixOS, where bash lives under the Nix store. Hosts that ship /bin/bash keep the previous behavior exactly; the fallback only activates where the default would make every bash call fail with "PTY shell exited during startup".

On the 0.1.0-rc.5 source checkout, bootstrapMaxTokens reaches the actual first request (the first request/header records the cap, adapterDefaults stays empty), because llm.prepareCall only materializes a default maxTokens when the proposed config has none. One prebuilt profile package observed in issue #11 (CLI launcher reporting 0.1.0-rc.6) overwrote the proposed cap with adapterDefaults.maxTokens; there the cap is a no-op. The default composition therefore relies on the Minimal tool schema alone (which anchors at the adapter default with no cap) and leaves bootstrapMaxTokens as an opt-in for standard-schema bootstraps.

DeepSeek Harness is currently a developer preview and explicitly permits breaking changes. This preset is a full snapshot of the Standard composition, so review upstre