DeepSeek Harness is an all-plugin Cordis agent harness. Read docs/architecture.md before changing packages/; follow docs/AGENTS.md for documentation.
Public APIs are pre-stable; update every consumer. Released Session JSONL follows adjacent migration: body reads may add a version-named successor but never move, overwrite, or delete committed generations; predecessors imply neither fallback nor downgrade support. SQLite domains use monotonic SCHEMA_VERSION.
Application launch. Only dsh profiles launch supported Node apps; package bins, demos, and public SDK argv escapes are forbidden (rule).
vendor/ Vendored Cordis source — manifest + sync procedure in vendor/README.md
packages/ @deepseek-ai/dsh-<pkg> workspaces at packages/<group>/<pkg>/
core/ product API spine: session, system-prompt, tools, agent, agent-loop
api/ Remote BFF assembly and Typert RPC gateway
typert/ type graph generator, loader, and runtime registry
llm/ LLM capability: Service Definition/Consumer + DeepSeek providers
e2b/ E2B POC: sandbox + FS/subprocess adapters
shell/ bash capability: Service Definition + local/pwsh providers + shell Consumers
subprocess/ subprocess capability + local process-tree provider + shared Win32 library
terminal/ persistent sessions
fs/ filesystem capability + policy
lsp/ language-server capability
skill/ skill provider registry + local impl + catalog/loader tool
web/ web capability: Service Definition + search/fetch providers + tool Consumer
compaction/ compaction capability + basic provider
context/ request-context plugins
subagent/ subagent capability: Service Definition + providers + delegation Consumers
bundle/ installable dsh --profile patch-layer bundles
workflow/ workflow capability + worker-thread provider + tool Consumer
webhook/ webhook ingress
todo/ todo_write tool
plan/ plan mode as logged state
preset/ per-session agent composition from preset cordis.yml files
guard/ loop-hygiene + tool-timeout plugins
self-modification/ the agent inspects/mounts its own plugins
hooks/ Claude Code/Codex hook bridges + wire-protocol library
session/ durable session data: persistence, projection, titles, telemetry
identity/ anonymous identity
settings/ user-settings capability + file provider
credentials/ credential/authorization capabilities + env/.env provider
acp/ automation-only Agent Client Protocol server
interaction/ approval/interaction capabilities, permission, commands, ask-user
boot/ shared profile/application boot glue
sdk/ JSON-RPC protocol + TypeScript client/server
experimental/ private prototypes excluded from official releases
support/ dev/test infrastructure
util/ zero-dependency utilities
python/ Python SDK and bundled runtime (see python/README.md)
native/ @deepseek-ai/node-addon-landlock-run source of record (see native/README.md)
.agents/ Agent workflows and Agent Notes (`notes/`)
docs/ architecture, generated catalogs, postmortems, cookbook (see docs/AGENTS.md)
scripts/ repo gates and generators
website/ VitePress projection of selected bilingual docs/ sources
Package groups: packages/README.md.
pnpm install # pnpm workspaces, node ^22.19 || >=24
pnpm run clean # remove build outputs and safe residue from deleted packages
pnpm run test # unit tests
pnpm run test:coverage # CI coverage gate: per-file 100% on packages/*/*/src
pnpm run test:e2e # real-API tests; self-skip without DEEPSEEK_API_KEY
pnpm run test:expected # owner-local process expectations
pnpm run test:snapshot # keyless recorded-session replay through shipped profiles; filter: -t <name>
pnpm run test:snapshot:record # re-record expected outputs (needs key)
pnpm run typecheck
pnpm run lint
pnpm run duplication # cross-file TypeScript clone detection
pnpm run build # tsc emits lib/types, tsdown bundles runtime
pnpm run hygiene # publint + workspace/package/dependency checks + NodeNext consumer check
pnpm run check:windows-wine # ONLY when diagnosing a known Windows failure (needs wine); CI owns this signal
pnpm run doc-sync # all documentation gates; leaf list in scripts/run-gates.ts
pnpm run test:docs # quick documentation checks (no build; doc-quick aggregate)
pnpm run website:build # VitePress build (doubles as dead-link check)
pnpm dsh --profile headless "task" # run one task from source (needs DEEPSEEK_API_KEY)
pnpm run demo:ptc -- "task" # headless PTC mode run (needs key)
If a required gh, pnpm, build, test, or generator command fails because the sandbox blocks credentials, network, IPC, watching, or nested sandbox-exec, retry unchanged with the narrowest host escalation. Require sandbox evidence; never bypass test failures or the product sandbox.
Run checks before pushes via dsh-pre-push-checks; report only commands run. After gh stack sync, validate immediately; do not merge before checks pass.
doc-sync for docs, built smokes for published paths, and real-API e2e for providers.test:coverage, not test, is the CI coverage gate (why).Real-API tests and demos read DEEPSEEK_API_KEY, optional DEEPSEEK_BASE_URL, and root .env. cordis.yml allows !!js (never !js) under plugin config and entry disabled; other metadata stays literal, so conditional composition also uses overlays (primer). Never commit credentials. CI e2e skips without a key; testing.md owns key policy.
@deepseek-ai/dsh-<name>; vendored packages are rescoped (mapping) and private: true. @deepseek-ai/cordis is a peerDependency (+ dev) of every harness package."type": "module"). Use package names across packages and .ts in local relative imports. Config subprocesses run built lib/ under plain Node; source regressions use their declared launcher (testing policy). The dsh CLI source launch runs through tsx's ESM-only hook (node --import tsx/esm); modules it reaches must stay ESM (no CJS-only exports) — Node's native TypeScript modes are unavailable across the engines range (source-launch contract). Raw/Web cordis.yml bare plugins must appear in their resolver manifest's dependencies; verify-cordis-config enforces it.ctx.effect() / ctx.on(); a registry's register() returns the disposer../invariant only when independent observations can diverge. Otherwise omit its source and wiring and record why in its README; empty installers and checks of service presence, plugin metadata, effects, or fixed examples are invalid (package invariant rules).@mode and payload @param; scoped keys absent from payloads need @dshScopeScan unsupported. Public service methods document parameters and non-void returns. SessionEventMap members are required-on-read by default — builds that do not know a type refuse the log unless the event carries the envelope's ignorable: true; only structural format changes bump SESSION_FORMAT_VERSION (mechanism).assertNever; merge-extensible unions fall through a documented default.next() to delegate; returning without it short-circuits the chain (semantics).agent-loop requires updating docs/architecture.md.resolve(request): Spec step in the owning implementation, never a hidden ?? default inside run() (the dsh-shell request/spec split is the template).Config fields changeable from cordis.yml; a DEFAULT_* constant or test hook is not configurability. Protocol constants, external specs, and security invariants stay fixed.Branded<B> from dsh-brand), never bare string.paths to src and pass on a clean tree; gates consuming built lib/ declare that dependency (layout).catch names what it swallows and why nothing else can reach it; keep the try to one statement.t or localized primitive props; verify-client-ui-i18n rejects hardcoded copy (decision).SessionEventMap changes update the TypeScript and Python SDK expected outputs in the same PR; pnpm run test covers neither (surfaces).--force-with-lease, abort on remote movement, never raw --force; preserve an in-progress merge-forward checkpoint before taking a newer base (rationale).kind/*, all material area/*, and native Issue Type (taxonomy).FIXME/TODO/XXX by urgency (semantics).git diff --cached --check (pre-commit) gates it.Read docs/defensive-patterns.md before lifecycle, concurrency, subprocess, or teardown work.
Everything compiles under strict: true with noImplicitAny; every remaining any explains why narrowing is infeasible. Every module and export has concise JSDoc for its non-obvious contract; function-like exports include @param/@returns, as enforced by verify-export-jsdoc. Heritage-declared members, plugin-protocol slots, and constructors keep their docs at the declaring Service Definition, protocol, or class.
Comments and docs state complete contracts and context, not reasoning transcripts. Use direct, concrete terms. Do not use metaphors. Before writing contract, boundary, or shape, ask whether a more exact term names the subject: write response fields, JSON validation, or ESM exports instead of response shape, validation boundary, or module shape. Keep contract for preconditions, postconditions, invariants, compatibility promises, and other obligations that callers, callees, implementers, providers, producers, or consumers rely on. Keep a literal process, wire, security, transaction, or lifecycle boundary. Do not narrate control flow or tests, preserve review history, or restate code. Keep behavior, failure, timing, ownership, and safe-use facts; link the rationale. Use dsh-prose-standard for decisions. Wire mechanically checkable invariants into an executed top-level gate and prove each changed acceptance path rejects an invalid case. Use narrow, justified exceptions instead of disabling a rule globally.
Docs accompany every code change: update affected README and JSDoc contracts together. Routine bilingual work follows docs/AGENTS.md; only explicit user invocation may run dsh-translate-docs. Current-state prose, one physical line per paragraph, one home per fact, and word budgets live there.
CLAUDE.md symlinks AGENTS.md at root and packages/; edit the real file. Keep each rule self-contained while linking high-level docs. Condense when clarity survives; raise a verify-doc-budgets ceiling when the required content genuinely needs more space.
vendor/ packages are pinned source copies (manifest with upstream SHAs in vendor/README.md). Update via the sync procedure there; re-apply or retire the logged local modifications; rerun pnpm run test && pnpm run build.