dsh-doc

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

DeepSeek Harness documentation

DeepSeek Harness 文档

Summary

摘要

The DeepSeek Harness documentation standard: make every page searchable, newcomer-readable, and exact enough for agents and maintainers, and keep the documentation website a tested projection of repository Markdown. Apply repository
AGENTS.md
files and executed gates first, then this workflow for kind-mapped metadata, progressive detail, line-aligned bilingual pages, corpus audits, and website publication. Preserve one owner per fact: source, tests, generated catalogs, package READMEs, guides, Agent Notes, and scratch each keep their own kind of truth. The
session-persistence-jsonl
README pair is the reference example of the format.
DeepSeek Harness文档标准:确保每个页面可搜索、对新手友好,同时精确到能满足Agent和维护者的需求,且文档网站是仓库Markdown文件的经过测试的映射版本。优先应用仓库中的
AGENTS.md
文件和已执行的验证规则,再遵循本工作流来实现kind映射元数据、渐进式细节展示、行对齐的双语页面、文档集审核以及网站发布。为每个事实保留唯一所有者:源代码、测试用例、生成的目录、包README、指南、Agent Notes以及草稿内容各自维护其专属的事实依据。
session-persistence-jsonl
的README双语对是该格式的参考示例。

Table of Contents

目录

Workflow

工作流

Follow this sequence for each requested scope. Keep the common reader path brief, but do not delete failures, ownership, limitations, or other required contracts merely to reduce words.
  1. Read root and more-specific
    AGENTS.md
    , the documentation standard, the target page, its source/tests, navigation owner, and bilingual record.
  2. Classify the page by one primary job and reader: product quick start, user task guide, contributor tutorial, architecture overview, package/subsystem reference, generated reference, agent instruction, decision record, or scratch.
  3. Place the page at its nearest owner. Keep package contracts beside package code; use
    docs/
    for cross-package learning, user, developer, architecture, discussion, and expiring scratch material.
  4. Define the reader's starting state, observable outcome, likely failure, recovery path, and next useful depth before writing details.
  5. Add or revise YAML metadata — assign the
    kind
    that maps to the template for this document's job — then write
    Summary
    ,
    Table of Contents
    , user-facing content, developer-facing content, optional
    Further Exploration
    , and final
    Dev Note
    in that order where the document type permits.
  6. Update the bilingual counterpart in the same pass. Keep headings, lists, tables, code, links, frontmatter layout, and physical line count aligned.
  7. Verify every claim against code, tests, generators, package metadata, or a current decision owner — and run the operations the page instructs, per the fact-check procedure below. Update the owner before any derivative artifact.
  8. Run focused checks, then
    pnpm run test:docs
    ,
    pnpm run doc-sync
    ,
    pnpm run lint
    , and
    git diff --check
    ; re-read the complete diff for correctness and then for brevity and repository fit.
针对每个请求的范围遵循以下步骤。保持通用读者路径简洁,但不得仅为减少字数而删除失败案例、所有权信息、限制条件或其他必要约定。
  1. 阅读根目录及更具体的
    AGENTS.md
    文档标准、目标页面、其源代码/测试用例、导航所有者以及双语记录。
  2. 根据核心用途和读者群体对页面进行分类:产品快速入门、用户任务指南、贡献者教程、架构概述、包/子系统参考、生成式参考、Agent指令、决策记录或草稿。
  3. 将页面放置在最接近其所有者的位置。将包契约与包代码放在一起;使用
    docs/
    目录存放跨包学习内容、用户文档、开发者文档、架构文档、讨论内容以及临时草稿材料。
  4. 在编写细节之前,定义读者的初始状态、可观察的结果、可能的失败情况、恢复路径以及下一步有用的深入方向。
  5. 添加或修订YAML元数据——为文档的用途分配对应的
    kind
    类型(映射至相应模板)——然后按照
    摘要
    目录
    、面向用户的内容、面向开发者的内容、可选的
    进一步探索
    以及最终的
    开发笔记
    的顺序编写内容(文档类型允许的情况下)。
  6. 在同一流程中更新双语对应文档。保持标题、列表、表格、代码、链接、前置内容布局以及实际行数对齐。
  7. 根据代码、测试用例、生成器、包元数据或当前决策所有者验证每一项声明——并按照下文的事实核查流程执行页面中指示的操作。在生成任何衍生工件之前更新所有者信息。
  8. 运行针对性检查,然后执行
    pnpm run test:docs
    pnpm run doc-sync
    pnpm run lint
    git diff --check
    ;重新阅读完整的差异内容以确保正确性,再检查简洁性和与仓库的适配性。

Fact-check procedure: test, do not assume

事实核查流程:测试,而非假设

Documentation states how the product behaves today, and the only admissible evidence for an operation claim is having run it. This procedure is mandatory for every new document and every new paragraph that claims an operation, command, default, error, or platform difference.
  1. Classify the subject before writing install guidance. Read the facts, never the folder name:
    package.json
    for a
    dsh.bundle.patch
    declaration, and the entry file for the plugin shape (
    apply
    export or a default service export is a plugin; a plain module API is a library). A bundle installs with
    dsh plugin --profile <name> add <package>
    and is the only package shape for which that command activates a profile layer; a plugin mounts as a
    cordis.yml
    row; a library is a dependency with no install path of its own. Packages with special status (libraries, bundles) get their own README template — never a plugin README with install guidance that does not apply.
  2. Run every claimed operation against the current checkout. Execute each CLI command, config snippet, and profile or patch example exactly as the document will show it; write down only what you observed, including the exact output, warnings, and failure modes. If a claim depends on a key or a network you do not have, say so and name the verification owner instead of asserting the behavior.
  3. Delete what you could not reproduce. Never carry a command, field, default value, or behavior from memory, analogy, or a neighboring package's README. When a claim fails to reproduce, fix the claim — not the test.
  4. Check old docs against latest master. Before revising pre-existing pages,
    git fetch origin
    and compare the section against
    origin/master
    ; the pairing sidecar recovers the last-confirmed text of either side. A stale statement on master is still wrong: correct it against the code, not against the old prose.
  5. Re-record the pair after every edit. Each paired edit re-runs
    pnpm run verify-translation-pairing --write <pair>
    so the sidecar tracks the confirmed pair.
文档描述的是产品当前的行为,操作声明唯一可接受的证据是实际执行过该操作。对于每一份新文档以及每一段涉及操作、命令、默认值、错误或平台差异的新段落,都必须遵循此流程。
  1. 编写安装指南前先对主题进行分类。 依据事实而非文件夹名称进行判断:查看
    package.json
    中的
    dsh.bundle.patch
    声明,以及入口文件的插件形态(导出
    apply
    或默认服务导出为插件;普通模块API为库)。bundle包使用
    dsh plugin --profile <name> add <package>
    命令安装,且这是唯一能通过该命令激活配置文件层的包形态;插件作为
    cordis.yml
    中的一行进行挂载;库是无独立安装路径的依赖项。具有特殊状态的包(库、bundle)使用专属的README模板——绝不要使用包含不适用安装指南的插件README模板。
  2. 针对当前检出版本运行所有声称的操作。 完全按照文档将展示的方式执行每个CLI命令、配置片段、配置文件或补丁示例;仅记录观察到的内容,包括精确的输出、警告和失败模式。如果声明依赖于你没有的密钥或网络,请注明并指定验证所有者,而非断言其行为。
  3. 删除无法重现的内容。 绝不要凭记忆、类比或相邻包的README来保留命令、字段、默认值或行为。当声明无法重现时,修正声明——而非测试用例。
  4. 对照最新master分支检查旧文档。 在修订现有页面之前,执行
    git fetch origin
    并将该部分与
    origin/master
    进行对比;配对副文件可恢复任意一侧的最后确认文本。master分支上的过时陈述仍然是错误的:依据代码修正,而非旧文本。
  5. 每次编辑后重新记录配对文档。 每次配对编辑后重新运行
    pnpm run verify-translation-pairing --write <pair>
    ,以便副文件跟踪已确认的配对关系。

Kind system and templates

kind系统与模板

The
kind
frontmatter field selects exactly one README template. Every kind in the metadata reference maps to one template file in
templates/
, and every template backs exactly one kind; the documentation check derives the expected kind from the same mechanical facts.
  • package-group
    templates/package-group.md: group maps (
    packages/README.md
    ,
    packages/<group>/README.md
    ) — orient the family, map its direct packages, link package-owned details.
  • package-reference
    templates/package-reference.md: a Cordis plugin or service package — mount configuration, the config table, folded implementation, Model Experience and Known Limitations in the gate-owned forms.
  • package-library
    templates/package-library.md: a package with no plugin surface — consumer entry points, no profile-install path, no mount configuration.
  • package-bundle
    templates/package-bundle.md: a package declaring
    dsh.bundle.patch
    — the verified
    dsh plugin
    install path, layer semantics, patch document.
Open the template before writing and follow its skeleton and rules; it states what the kind is, how the page is structured, and the fact checks each section owes. Add a new kind only together with a distinct template file, a documented repository position or declared owner, and a focused check that maps documents to it.
前置内容中的
kind
字段精确对应一个README模板。元数据参考中的每一种
kind
都映射到
templates/
目录中的一个模板文件,且每个模板仅对应一种
kind
;文档检查会从相同的机械事实中推导出预期的
kind
类型。
  • package-group
    templates/package-group.md:组映射文件(
    packages/README.md
    packages/<group>/README.md
    )——介绍包族、映射其直接包含的包、链接包专属的详细内容。
  • package-reference
    templates/package-reference.md:Cordis插件或服务包——挂载配置、配置表、折叠的实现细节、由验证规则维护的模型体验和已知限制部分。
  • package-library
    templates/package-library.md:无插件界面的包——消费者入口点、无配置文件安装路径、无挂载配置。
  • package-bundle
    templates/package-bundle.md:声明了
    dsh.bundle.patch
    的包——经过验证的
    dsh plugin
    安装路径、层语义、补丁文档。
编写前打开对应模板并遵循其框架和规则;模板会说明该
kind
的用途、页面结构以及各部分需要进行的事实核查。仅当同时添加了独特的模板文件、文档化的仓库位置或声明的所有者,以及将文档映射到该
kind
的针对性检查时,才可添加新的
kind
类型。

Voice rules

表述规则

These rules decide what a section may say. They apply to every authored human-facing page, and to package READMEs with particular force.
  • Summary says what the subject does. The opening
    Summary
    and the user-facing sections describe what a user or agent can DO with the subject — outcomes, benefits, when to choose it, main cost — never its role, type, or internal identity. "The seam registers
    ctx.x
    and appends
    x/event
    records" is identity narration; "you can save a note per message and it survives restarts" is what it does.
  • Developer sections explain, never enumerate. Folded implementation content covers the overall design concept, architecture, and hand-waving dataflow — enough to understand how the package works — and links code for exact detail. No full API catalogs, exhaustive column lists, event-payload enumerations, or JSDoc restatement inside the folds.
  • Dev Note is the only slop zone. Partial ideas, scratches, undecided directions, measured artifacts, and working hypotheses live only in the final Dev Note, marked explicitly non-authoritative. Every other section is polished, current-state prose.
  • Current state only. No compatibility shims, migration talk, or history ("previously", "now", "no longer", renamed) outside the Dev Note; the codebase as it is today is the only subject.
  • Use controlled technical English. Give each sentence an explicit actor and one main action when ambiguity can change behavior. Reuse one term per concept, prefer direct verbs, split stacked instructions and conditions, and preserve modality and exceptions. Apply the non-certified, ASD-STE100-inspired discipline in the page-style reference. Do not force a shorter sentence when precision would fall.
这些规则决定了某一部分可以包含的内容。适用于所有面向人类的创作页面,尤其适用于包README。
  • 摘要说明主题的功能。 开头的
    摘要
    和面向用户的部分描述用户或Agent可以用该主题做什么——成果、益处、何时选择它、主要成本——绝不要描述其角色、类型或内部标识。“该接缝注册
    ctx.x
    并追加
    x/event
    记录”是标识叙述;“你可以为每条消息保存笔记,且笔记在重启后仍能保留”是功能描述。
  • 开发者部分重在解释,而非枚举。 折叠的实现内容涵盖整体设计理念、架构和大致数据流——足以理解包的工作原理——并链接至代码以获取精确细节。折叠部分内不得包含完整的API目录、详尽的列列表、事件负载枚举或JSDoc重述。
  • 开发笔记是唯一的非正式区域。 部分想法、草稿、未确定的方向、测量工件和工作假设仅能放在最后的开发笔记中,并明确标记为非权威内容。其他所有部分均为经过打磨的当前状态文本。
  • 仅描述当前状态。 开发笔记之外不得包含兼容性垫片、迁移说明或历史内容(“以前”、“现在”、“不再”、重命名);当前的代码库是唯一的描述对象。
  • 使用规范的技术英语。 当歧义可能改变行为时,给每个句子一个明确的主语和一个主要动作。每个概念复用一个术语,优先使用直接动词,拆分堆叠的指令和条件,并保留语气和例外情况。应用页面风格参考中基于ASD-STE100的非认证规范。当精度会下降时,不要强行缩短句子。

Quality criteria

质量标准

Use these definitions in review. Each section opens with a short orienting paragraph before subsections or exhaustive detail.
  • Brief: the common path contains only facts needed for its outcome; exhaustive truth remains one direct link or detail layer away.
  • Intuitive: prerequisites precede dependent concepts, one next action is obvious, and headings use terms readers search for.
  • Friendly: readers can recognize success, understand risk before acting, recover from likely failure, and choose whether to continue deeper.
  • Accurate: each durable claim has one owner and a verification path proportionate to its risk.
  • Agent-readable: metadata, stable headings, anchors, terminology, ownership, and current/proposed status support targeted retrieval without loading the corpus.
  • Newcomer-complete: a professional engineer with no repository context can reconstruct the relevant architecture or feature through three to five linked pages.
Do not apply a universal word limit to exhaustive references. Measure entry-path length, unrelated material scanned for one lookup, largest section, heading count, and page size; split by an existing domain owner when retrieval cost is high.
在审阅时使用以下定义。每个部分在子部分或详尽细节之前都以简短的引导段落开头。
  • 简洁: 通用路径仅包含实现其成果所需的事实;详尽内容只需一次直接链接或一层细节即可获取。
  • 直观: 前置条件先于依赖概念,下一步操作明确,标题使用读者搜索的术语。
  • 友好: 读者可以识别成功状态、在操作前了解风险、从可能的失败中恢复,并选择是否继续深入。
  • 准确: 每个持久声明都有一个所有者和与其风险相称的验证路径。
  • Agent可读: 元数据、稳定的标题、锚点、术语、所有权以及当前/提议状态支持目标检索,无需加载整个文档集。
  • 新手完整: 不了解仓库背景的专业工程师可以通过三到五个链接页面重建相关架构或功能。
不要对详尽参考内容应用通用字数限制。衡量入口路径长度、为单次查找而扫描的无关材料、最大部分的篇幅、标题数量和页面大小;当检索成本过高时,按现有领域所有者拆分内容。

Audit the corpus

文档集审核

Read, do not re-summarize, the owning contracts: docs/AGENTS.md for hierarchy, tutorial/reference forms, taxonomy, budgets, and the slop checklist; .agents/notes/README.md for Agent Note lifecycle; docs/i18n/README.md for the bilingual pairing rules; and root AGENTS.md for standing orders. Exclude
.agents/notes/archived/
from audits and edits — archived notes are frozen history.
Apply the standard's authoring order to every human-facing document in scope (not to Agent Notes): locate the document and state its own subject; set the permitted detail level and move deeper explanations to owning descendants with links; classify tutorial or reference from intended use, not path; for a tutorial, order concepts by prerequisite and difficulty; split substantial mixed forms. Then check placement constraints: paired docs cost a counterpart update and a
--write
re-record on every edit; generated catalogs are never hand-edited; a move is atomic with every inbound link repaired in the same change.
After the structural pass, hunt the slop checklist with the cheapest probes first. Use dsh-trim-cot-leakage for reasoning-transcript leakage, grep distinctive phrases to find duplicated rules, replace hand-written catalogs and status inventories with their authoritative owners, and remove migration plans and future-tense spec language from implemented Agent Notes. Measure outliers with
pnpm run verify-doc-budgets --list
and a word-count scan; if removing prose changes a promised behavior rather than its explanation, propose the behavior change first (follow dsh-find-simplifications). Keep every load-bearing rule, preferably as one to three lines plus a link to its rationale; do not create a new explanation merely to relocate disposable reasoning.
阅读而非重述所有权契约:docs/AGENTS.md涉及层级结构、教程/参考形式、分类法、字数预算和非正式内容清单;.agents/notes/README.md涉及Agent Note的生命周期;docs/i18n/README.md涉及双语配对规则;根目录AGENTS.md涉及常规指令。审核和编辑时排除
.agents/notes/archived/
目录——归档的笔记是冻结的历史记录。
对范围内所有面向人类的文档(不包括Agent Note)应用标准的创作顺序:定位文档并说明其主题;设置允许的细节级别并将深入解释移至所属的子文档并添加链接;根据预期用途而非路径将文档分类为教程或参考;对于教程,按前置条件和难度排序概念;拆分内容混杂的大型文档。然后检查放置约束:配对文档每次编辑都需要更新对应文档并运行
--write
重新记录;生成的目录绝不能手动编辑;移动文档时必须在同一变更中修复所有入站链接。
完成结构检查后,先用最简便的方法查找非正式内容清单中的问题。使用dsh-trim-cot-leakage检测推理记录泄露,使用grep查找重复规则的独特短语,用权威所有者替换手写目录和状态清单,并从已实现的Agent Note中移除迁移计划和未来时态的规范语言。使用
pnpm run verify-doc-budgets --list
和字数扫描衡量异常内容;如果删除文本会改变承诺的行为而非其解释,请先提议行为变更(遵循dsh-find-simplifications)。保留每个承载核心规则的内容,最好是一到三行加上其原理的链接;不要仅仅为了转移一次性推理而创建新的解释。

Wordcount budgets

字数预算

pnpm run verify-doc-budgets
compares standing documents against ceilings in scripts/doc-budgets.manifest.json; a red gate follows the ordered relocate-condense-raise policy in docs/AGENTS.md. Ceilings are guardrails, not reduction targets: at or below target, retain at least 5% headroom; raise a ceiling only when the words need the space, and justify the manifest diff in the PR.
pnpm run verify-doc-budgets
会将现有文档与scripts/doc-budgets.manifest.json中的上限进行对比;如果超出上限,将遵循docs/AGENTS.md中规定的“迁移-精简-提升预算”有序策略。上限是防护线,而非精简目标:达到或低于目标时,至少保留5%的余量;仅当内容需要更多空间时才提升上限,并在PR中说明清单差异的理由。

Website publication

网站发布

The website is a tested projection, never a second copy: website/docs.ts is the explicit public allowlist mapping canonical
docs/
sources into route trees, scripts/project-doc-site.ts rewrites them into the disposable
website/.generated/
tree, and VitePress builds that tree. Repository Markdown stays the only editable content source; translations stay sibling pairs (
foo.md
,
foo.zh.md
,
foo.i18n.yaml
), never locale directories. Edit an already published page in its canonical source only; add one manifest entry for a new page; update source, manifest entry, and inbound links atomically for a move or removal; never edit
website/.generated/
,
website/.cache/
, or
website/.dist/
. Set every
DocsPage
field deliberately and honor the projector's link rules; see references/website-sync.md for the fields, sidebar collections, and preview commands. Synchronizing content into the build does not publish it: deployment stays a separate, explicitly requested step.
网站是经过测试的映射版本,绝不是第二份副本:website/docs.ts是明确的公共允许列表,将规范的
docs/
源文件映射到路由树;scripts/project-doc-site.ts将它们重写到临时的
website/.generated/
目录中;VitePress构建该目录。仓库中的Markdown文件始终是唯一可编辑的内容源;翻译内容保持为同级配对文件(
foo.md
foo.zh.md
foo.i18n.yaml
),绝不要使用语言环境目录。仅在规范源文件中编辑已发布页面;为新页面添加一条清单条目;移动或移除页面时需原子性地更新源文件、清单条目和入站链接;绝不要编辑
website/.generated/
website/.cache/
website/.dist/
目录。有意设置每个
DocsPage
字段并遵守映射工具的链接规则;有关字段、侧边栏集合和预览命令,请参阅references/website-sync.md。将内容同步到构建过程并不等同于发布:部署是单独的、需明确请求的步骤。

Detailed references

详细参考

Load only the reference needed for the task. Each reference links directly from this file so the skill has no deep reference chain.
  • Metadata, links, and bilingual pairs: README frontmatter, the kind system and its derivation, description semantics, repository paths, line alignment, and the sidecar record.
  • Page structure and hierarchy: mandatory section order, section summaries, user-to-developer progression, docs tree placement, small rule files, Further Exploration, and Dev Note ownership.
  • Page style: short Summary,
    -----
    section separators, foldable content sections, and emphasis discipline.
  • Review criteria: newcomer test, evidence checks, package README review, the reference example, and verification commands.
  • Website publication: manifest fields, projector link rules, preview and validation, and deployment separation.
The four README templates in
templates/
are the working skeletons for the four
kind
labels; open the one your document's kind names before writing.
Use dsh-prose-standard for sentence-level contract coverage and editorial judgment. The
session-persistence-jsonl
README pair (English, Chinese) is the reference example: searchable YAML, Summary and Table of Contents, user-to-developer progression with a folded developer section, Further Exploration, canonical Model Experience and Known Limitations sections, and a final Dev Note.
仅加载任务所需的参考内容。每个参考都直接从此文件链接,因此无需深层参考链。
  • 元数据、链接与双语配对:README前置内容、kind系统及其推导、描述语义、仓库路径、行对齐和副文件记录。
  • 页面结构与层级:必填部分顺序、部分摘要、从用户到开发者的渐进式展示、文档树放置、小型规则文件、进一步探索以及开发笔记的所有权。
  • 页面风格:简短摘要、
    -----
    部分分隔符、可折叠内容部分以及强调规范。
  • 审阅标准:新手测试、证据检查、包README审阅、参考示例和验证命令。
  • 网站发布:清单字段、映射工具链接规则、预览与验证以及部署分离。
templates/
目录中的四个README模板是四种
kind
标签的工作框架;编写前打开文档
kind
对应的模板。
使用dsh-prose-standard进行句子级契约覆盖和编辑判断。
session-persistence-jsonl
的README双语对(英文中文)是参考示例:包含可搜索的YAML、摘要和目录、从用户到开发者的渐进式内容(含折叠的开发者部分)、进一步探索、规范的模型体验和已知限制部分,以及最终的开发笔记。

Validation

验证

Validate the affected format, not merely Markdown syntax. A strong promise needs a focused valid fixture and an invalid fixture that proves the top-level gate can fail.
  • README metadata: parse YAML, map
    kind
    to its template and document standard, reject
    name
    ,
    audience
    , ungoverned
    tags
    , and README-local
    i18n
    metadata, and reject missing or advertisement-style descriptions.
  • Bilingual pages: verify structure, exact line count, terminology, link parity, and the sidecar record.
  • Tutorials: exercise the documented entry path or name an explicit manual verification owner.
  • Generated references: run the deterministic freshness check and report retrieval-size measures.
  • Package READMEs: run model-experience and limitation checks, then package-focused tests when behavior claims changed; re-run every command the README instructs before merging a claim about it.
  • Skills: run the repository's skill-invocation metadata check.
Run
pnpm run test:docs
for the quick comprehensive documentation checks (pairing, wrap, links, README gates, budgets, skill metadata, Agent Note gates) before the full
pnpm run doc-sync
.
验证受影响的格式,而非仅验证Markdown语法。可靠的承诺需要针对性的有效测试用例和无效测试用例,以证明顶层验证规则可以检测到错误。
  • README元数据:解析YAML,将
    kind
    映射到其模板和文档标准,拒绝
    name
    audience
    、未受管控的
    tags
    以及README本地的
    i18n
    元数据,拒绝缺失或广告式的描述。
  • 双语页面:验证结构、精确行数、术语、链接一致性和副文件记录。
  • 教程:执行文档记录的入口路径或指定明确的手动验证所有者。
  • 生成式参考:运行确定性新鲜度检查并报告检索大小指标。
  • 包README:运行模型体验和限制检查,当行为声明变更时运行包针对性测试;在合并关于命令的声明之前,重新运行README中指示的每个命令。
  • Skills:运行仓库的Skill调用元数据检查。
在完整执行
pnpm run doc-sync
之前,先运行
pnpm run test:docs
进行快速全面的文档检查(配对、换行、链接、README验证规则、字数预算、Skill元数据、Agent Note验证规则)。

Dev Note

开发笔记

None.
无。