DSH / Atlas
2026-11-04proposedarchitecture

Harness home path categories

harness home 路径类别

Each package builds its own path under `$DSH_HOME` (default `~/.dsh`), so the home root mixes user configuration, durable records, logs, indexes, and downloads. A new service or plugin has no rule for where its files belong, and some owners resolve the home by hand: [liveshare](../../../../packages/experimental/liveshare/src/host/share-host.ts) reads `process.env.DSH_HOME` directly, and [migrate-sessions-to-v4](../..

English

Problem

Each package builds its own path under $DSH_HOME (default ~/.dsh), so the home root mixes user configuration, durable records, logs, indexes, and downloads. A new service or plugin has no rule for where its files belong, and some owners resolve the home by hand: liveshare reads process.env.DSH_HOME directly, and migrate-sessions-to-v4 defaults to ~/.dsh/sessions without reading DSH_HOME.

Proposal

Group paths under $DSH_HOME by the kinds the XDG Base Directory Specification uses. Every category stays inside $DSH_HOME; the harness does not read XDG_* variables.

CategoryHoldsLosing it
configFiles a person writes or edits to configure the harnessLoses the user's configuration
dataDurable records: user work, sign-ins, installed softwareLoses user work, sign-ins, or installed software
stateRecords that persist across runs but are not user work: logs, indexes, ids, retained outputsResets history; the harness keeps working
cacheContent the harness can rebuild or download againCosts time or bandwidth only
backupBackup archives the harness writes, such as compressed copies of the home or a profileNothing; the archives are not read during normal operation

There is no runtime category, the XDG kind for sockets and pid files, because no owner needs one under the home: locks sit beside the file they protect, and live sockets stay in the operating-system temporary directory because Unix socket paths have a length limit. backup is not an XDG kind: it gives backup archives one directory that users and cleanup tools can empty at any time without affecting a running harness or the records the archives copy.

Path helper

dshPath(category, ...segments) in @deepseek-ai/dsh-home-paths returns <home>/<category>/<segments> without creating directories; dshPath({ category, dshHome }, ...segments) resolves an explicit configured home. Loader !!js config expressions receive the same function beside dshHomePath. A new path under the home uses dshPath and passes its owner's directory name, normally the package name without the @deepseek-ai/dsh- prefix, as the first segment. dshHomePath remains for the existing top-level entries, and dshCachePath is dshPath('cache', ...).

Conventional top-level entries

Users open, edit, and script against these entries directly, and documentation across the repository names them, so they keep their current top-level locations and are not candidates for moving:

Path under $DSH_HOMEOwnerKind
.envapp-boot environment layerconfig
cordis.patch.ymlapp-boot home patch layerconfig
AGENTS.mdagent-instructionsconfig
skills/skill-filesystemconfig
.credentials.yamlcredentials-localdata
profiles/<name>/app-boot, plugin-manager, Desktop (desktop profile and its lock)data
sessions/session-persistence-jsonl root in the base and sdk-minimal bundlesdata
cache/already the cache categorycache

Files inside a profile directory, such as node_modules/, pnpm-lock.yaml, compatibility.json, .plugin-manager/, .plugin-market/repositories/, created-plugins/, and cua-*.lock, stay with their profile because pnpm and the profile tools address them relative to it. The legacy settings.yaml importer keeps reading the home root because that file is the import source.

Other existing entries

These entries have no user-facing convention. Each row names the category it belongs to; moving it is a separate change that needs a data migration plan:

Current path under $DSH_HOMECategoryOwnerWhy
storages/datastorage-json root in the base bundleWorkspace, schedule, and other domain records; its session_projcache unit is a rebuildable cache, but storage-json has one root
attachments/v1/dataattachment-localUser attachments; Session history records their absolute paths
dsh-runtimes/dataDesktop offline runtimes (workspace-dependencies)Installed software that may hold user additions
liveshare/dataliveshare owner state and credentialHolds management tokens
.anonymous-user-idstateanonymous-user-idLosing it only issues a new id
logs/stateCLI startup failure reportsLogs
llm-deepseek/files-v3.jsonstatellm-deepseek upload indexDerived index
office-kit/outputs/stateoffice-kitRetained conversion outputs removed after their retention period
speech-to-text/sensevoice/cachevoice-input-bundleDownloadable models
cache/attachments/cacheattachment-local request imagesAlready in cache

Outside the home

These locations are out of scope: ~/.agents (DSH_AGENTS_HOME), shared with other agent tools; Electron userData and logs, managed by Electron; the Python SDK resource cache ~/.cache/deepseek-harness/resources (DSH_RESOURCE_CACHE), shared across homes; spill and subprocess output directories under the operating-system temporary directory; and developer or release script state such as ~/.dsh-desktop-signing.

Alternatives considered

Move every entry now. A first draft moved all entries, including the conventional ones, into category directories with no fallback. It made every existing home look empty after an upgrade, broke absolute attachment paths recorded in Sessions, and renamed files users edit by hand. The conventional entries above now stay, and the remaining moves wait for a migration plan.

Read XDG_* variables. Splitting the home across XDG_CONFIG_HOME, XDG_DATA_HOME, and similar roots would scatter one installation across several directories and break the single DSH_HOME override that tests, the SDK, and Desktop rely on; the single harness home resolver already rejected separate roots. The proposal borrows only the classification, inside that one root.

Add a runtime category. No current owner needs one; adding it would publish an unused value.

Acceptance criteria

  • New paths under $DSH_HOME are built with dshPath and land in one category directory.
  • Each move of an entry from "Other existing entries" ships with a migration that preserves existing user data, plus an upgrade guide.
  • The conventional top-level entries keep their locations.

Risks

Until migrations land, the home holds both category directories and legacy top-level entries. Moving attachments/ invalidates absolute paths in Session history unless the migration keeps the old location readable. Owners that resolve the home by hand do not pick up the helper until they are changed.

中文

问题

各个包在 $DSH_HOME(默认 ~/.dsh)下自行构造路径,因此 home 根目录混杂着用户配置、持久记录、日志、索引和下载内容。新的服务或插件没有规则可以确定其文件应放在哪里,部分负责方还会手动解析 home:liveshare 直接读取 process.env.DSH_HOME,migrate-sessions-to-v4 默认使用 ~/.dsh/sessions,不读取 DSH_HOME。

方案

按照 XDG Base Directory Specification 使用的类型,对 $DSH_HOME 下的路径分组。每个类别都位于 $DSH_HOME 内;harness 不读取 XDG_* 变量。

类别存放内容丢失后果
config用户为配置 harness 而编写或编辑的文件丢失用户配置
data持久记录:用户工作成果、登录信息、已安装的软件丢失用户工作成果、登录信息或已安装的软件
state跨运行保留但不属于用户工作成果的记录:日志、索引、id、保留的输出历史被重置;harness 仍可正常工作
cacheharness 可以重新构建或重新下载的内容仅耗费时间或带宽
backupharness 写入的备份压缩包,例如 home 或 profile 的压缩副本无影响;正常运行时不会读取这些压缩包

不设 runtime 类别(XDG 中用于 socket 和 pid 文件的类型),因为没有负责方需要在 home 下使用它:锁文件放在其保护的文件旁边,而活动的 socket 留在操作系统临时目录中,因为 Unix socket 路径有长度限制。backup 不是 XDG 的类型:它为备份压缩包提供一个目录,用户和清理工具可以随时清空,不影响运行中的 harness,也不影响被备份的记录。

路径辅助函数

@deepseek-ai/dsh-home-paths 中的 dshPath(category, ...segments) 返回 <home>/<category>/<segments>,不创建目录;dshPath({ category, dshHome }, ...segments) 基于显式配置的 home 解析路径。Loader !!js 配置表达式在 dshHomePath 之外也可以使用同一个函数。home 下的新路径使用 dshPath,并把负责方的目录名作为第一个路径段传入,该目录名通常是去掉 @deepseek-ai/dsh- 前缀的包名。dshHomePath 继续用于现有的顶层条目,dshCachePath 等同于 dshPath('cache', ...)。

约定的顶层条目

用户会直接打开、编辑这些条目并在脚本中引用它们,仓库中的文档也提到它们,因此它们保留当前的顶层位置,不在迁移候选之列:

$DSH_HOME 下的路径负责方类型
.envapp-boot 环境层config
cordis.patch.ymlapp-boot home patch 层config
AGENTS.mdagent-instructionsconfig
skills/skill-filesystemconfig
.credentials.yamlcredentials-localdata
profiles/<name>/app-boot、plugin-manager、Desktop(desktop profile 及其 lock)data
sessions/base 和 sdk-minimal bundle 中的 session-persistence-jsonl 根目录data
cache/已经是 cache 类别cache

profile 目录内的文件,例如 node_modules/、pnpm-lock.yaml、compatibility.json、.plugin-manager/、.plugin-market/repositories/、created-plugins/ 和 cua-*.lock,随所属 profile 保留,因为 pnpm 和 profile 工具按相对于 profile 的路径访问它们。旧版 settings.yaml 导入器继续读取 home 根目录,因为该文件是导入来源。

其他现有条目

这些条目没有面向用户的约定。每一行给出该条目所属的类别;迁移它属于单独的变更,需要数据迁移方案:

$DSH_HOME 下的当前路径类别负责方原因
storages/database bundle 中的 storage-json 根目录Workspace、schedule 及其他领域记录;其中 session_projcache 单元是可重建的缓存,但 storage-json 只有一个根目录
attachments/v1/dataattachment-local用户附件;Session 历史记录了它们的绝对路径
dsh-runtimes/dataDesktop 离线运行时(workspace-dependencies)已安装的软件,可能包含用户添加的内容
liveshare/dataliveshare 的所有者状态和凭据存放管理令牌
.anonymous-user-idstateanonymous-user-id丢失后只会生成新的 id
logs/stateCLI 启动失败报告日志
llm-deepseek/files-v3.jsonstatellm-deepseek 上传索引派生索引
office-kit/outputs/stateoffice-kit保留的转换输出,超过保留期后删除
speech-to-text/sensevoice/cachevoice-input-bundle可下载的模型
cache/attachments/cacheattachment-local 请求图片已位于 cache 中

home 之外

以下位置不在本提案范围内:~/.agents(DSH_AGENTS_HOME),与其他 agent 工具共享;Electron 的 userData 和 logs,由 Electron 管理;Python SDK 资源缓存 ~/.cache/deepseek-harness/resources(DSH_RESOURCE_CACHE),在多个 home 之间共享;操作系统临时目录下的 spill 和子进程输出目录;以及开发者或发布脚本的状态,例如 ~/.dsh-desktop-signing。

备选方案

立即迁移所有条目。 最初的草案把所有条目(包括约定的条目)都移入类别目录,且不提供回退。这样做会使每个现有 home 在升级后看起来为空,使 Session 中记录的附件绝对路径失效,并重命名用户手动编辑的文件。上述约定条目现在保持不动,其余迁移等待迁移方案。

读取 XDG_* 变量。 把 home 拆分到 XDG_CONFIG_HOME、XDG_DATA_HOME 等多个根目录,会让一次安装分散到多个目录,并破坏测试、SDK 和 Desktop 所依赖的单一 DSH_HOME 覆盖;单一 harness home 解析器已经否决了拆分根目录。本提案只借用分类方式,并且仍在这一个根目录之内。

增加 runtime 类别。 当前没有负责方需要它;增加它会发布一个未使用的值。

验收标准

  • $DSH_HOME 下的新路径使用 dshPath 构造,并落在某一个类别目录中。
  • 每次迁移“其他现有条目”中的条目时,都附带一个保留现有用户数据的迁移,以及一份升级指南。
  • 约定的顶层条目保留其位置。

风险

在迁移落地之前,home 中同时存在类别目录和旧的顶层条目。迁移 attachments/ 会使 Session 历史中的绝对路径失效,除非迁移保持旧位置可读。手动解析 home 的负责方在被修改之前不会使用该辅助函数。