Skip to content

Consolidate config files into a single directory (~/.deepseek/) #1224

@douglarek

Description

@douglarek

Problem

DeepSeek TUI currently splits its persistent configuration across two separate directory trees:

File Path Purpose
config.toml ~/.deepseek/config.toml API keys, providers, network policy, hooks, LSP, skills installer, snapshots, etc.
settings.toml ~/.config/deepseek/settings.toml UI/behavior preferences (auto_compact, locale, composer density, sidebar width, etc.)
tui.toml ~/.deepseek/tui.toml TUI appearance (theme, font_size, keybinds) — reserved, not yet wired (#657)

EN: This dual-directory split is confusing for users and has no technical justification. A user who edits ~/.deepseek/config.toml following deepseek doctor's instructions later discovers that /config --save writes to a completely different directory they didn't know existed. The slash-command write targets are also internally inconsistent: /config --save writes to settings.toml (under ~/.config/deepseek/), but /statusline writes to config.toml (under ~/.deepseek/), and /config mcp_config_path --save also writes to config.toml — three different targets for what the user sees as "the config command."

CN: 双目录配置拆分让用户非常困惑,而且没有任何技术必要性。用户按照 deepseek doctor 的提示编辑了 ~/.deepseek/config.toml,之后却发现 /config --save 写入了一个完全不同的、他们根本不知道其存在的目录。slash 命令的写入目标也内部不一致:/config --save 写入 settings.toml(在 ~/.config/deepseek/ 下),但 /statusline 写入 config.toml(在 ~/.deepseek/ 下),/config mcp_config_path --save 也写入 config.toml——用户眼中的"配置命令"实际上有三个不同的写入目标。

Additionally, there is content overlap: model/default_model appears in both config.toml and settings.toml. The TuiPrefs struct (tui.toml) overlaps with Settings (settings.toml) — both store TUI-related knobs. And ~/.deepseek/ is a misnomer: it's not a config directory but an application data directory that mixes user-editable config files with auto-generated runtime artifacts (sessions, audit logs, caches, stashes, embeddings), making it impossible for users to tell what's safe to edit.

此外,还有内容重叠问题:model/default_model 同时存在于 config.tomlsettings.toml 中。TuiPrefstui.toml)和 Settingssettings.toml)都存储 TUI 相关设置,功能重叠。而且 ~/.deepseek/ 名称有误导性——它不是一个单纯的配置目录,而是一个应用程序数据目录,混杂了用户可编辑的配置文件(config.tomltui.tomlmcp.jsonexecpolicy.tomlnotes.txtmemory.md)和运行时自动生成的产物(sessions/audit.logcache/secrets/tool_outputs/embeddings/ 等),用户完全无法区分哪些可以手动修改、哪些不能碰。

An outdated comment in crates/tui/src/tui/model_picker.rs:12 still references ~/.deepseek/settings.toml, which is no longer the production path — this has been stale since the settings path moved to dirs::config_dir().

crates/tui/src/tui/model_picker.rs:12 的注释仍然引用 ~/.deepseek/settings.toml,而这个路径已经不是生产环境中的实际路径——自 settings 路径迁移到 dirs::config_dir() 后该注释就已经过时。

Proposed solution

EN: Consolidate all user-editable config files under ~/.deepseek/:

  • Move settings.toml from ~/.config/deepseek/settings.toml to ~/.deepseek/settings.toml (with a migration step that copies from the old location on first launch).
  • Unify /config --save and /statusline to write to the same files in the same directory.
  • Clearly separate user-editable config files from auto-generated runtime artifacts, either through a config/ subdirectory or explicit documentation.

CN: 将所有用户可编辑的配置文件统合到 ~/.deepseek/ 下:

  • settings.toml~/.config/deepseek/settings.toml 迁移到 ~/.deepseek/settings.toml(首次启动时自动从旧路径复制)。
  • 统合 /config --save/statusline 的写入目标,使它们写入同一目录下的同一个文件集。
  • 清晰地区分用户可编辑的配置文件与自动生成的运行时数据,可以通过 config/ 子目录或明确文档来实现。

Classification of files in ~/.deepseek/

EN — User-editable config files (documented, safe to edit):

File Edited by
config.toml Manual editing, deepseek auth set, deepseek skill install, /statusline (via persist_status_items), /config mcp_config_path --save
tui.toml Manual editing (reserved, not yet wired — #657)
mcp.json Manual editing, deepseek mcp add-self
execpolicy.toml Manual editing
notes.txt Manual editing (or # quick-add in composer)
memory.md Manual editing (or # quick-add in composer, when [memory] enabled = true)

Auto-generated runtime files (do not edit):

File Written by
settings.toml /config --save (Settings)
audit.log Network auditor, credential events, tool approvals
events.jsonl Hook event sink
sessions/ Session manager (saves + checkpoints + cycle archives)
tasks/runtime/events/ Runtime thread event streams
cache/skills/ Skill installer cache
embeddings/ Archive embedding cache
secrets/secrets.json OS keyring fallback store
composer_stash.jsonl Composer draft stash
composer_history.txt Composer input history
tool_outputs/ Spilled large tool outputs
file-frecency.jsonl File frecency tracker
skills_state.toml Skill state tracker
mcp_server.toml MCP server self-config
managed_config.toml Managed config
requirements.toml Requirements
workspace-trust.json /trust add persistence
.onboarded Onboarding marker

CN — 用户可编辑的配置文件(有文档,可以安全编辑):

文件 修改方式
config.toml 手动编辑、deepseek auth setdeepseek skill install/statusline(通过 persist_status_items)、/config mcp_config_path --save
tui.toml 手动编辑(预留,尚未接线 — #657
mcp.json 手动编辑、deepseek mcp add-self
execpolicy.toml 手动编辑
notes.txt 手动编辑(或在输入框中用 # 快速追加)
memory.md 手动编辑(或在输入框中用 # 快速追加,需要 [memory] enabled = true

自动生成的运行时文件(不要编辑):

文件 写入来源
settings.toml /config --save(Settings)
audit.log 网络审计器、凭证事件、工具审批
events.jsonl Hook 事件 sink
sessions/ 会话管理器(保存 + 检查点 + 循环归档)
tasks/runtime/events/ 运行时线程事件流
cache/skills/ 技能安装器缓存
embeddings/ 归档嵌入缓存
secrets/secrets.json OS keyring 降级存储
composer_stash.jsonl 输入框草稿暂存
composer_history.txt 输入框历史
tool_outputs/ 溢出的大型工具输出
file-frecency.jsonl 文件使用频率追踪
skills_state.toml 技能状态追踪
mcp_server.toml MCP 服务器自配置
managed_config.toml 托管配置
requirements.toml 需求文件
workspace-trust.json /trust add 持久化
.onboarded 新手引导标记

Alternatives considered

EN:

  1. Move everything to ~/.config/deepseek/ (XDG-compliant). Rejected because ~/.deepseek/ already contains >20 auto-generated runtime artifacts (sessions, caches, audit logs, stashes) that are not "config" per XDG. Moving the entire state tree to ~/.config/ would violate XDG spirit worse than the current split. And ~/.deepseek/config.toml is already well-known to existing users.
  2. Keep the split but add symlinks. Adds fragility and platform-specific edge cases (Windows symlink permissions, snap/Flatpak sandbox restrictions).
  3. Merge config.toml and settings.toml into one file. Reduces confusion about "which file has what" but doesn't address the directory split itself; also risks bloating a single file with heterogeneous concerns and makes safe round-trip writes harder (programmatic updates to one section could clobber unrelated manual edits).

CN:

  1. 全部迁移到 ~/.config/deepseek/(XDG 兼容)。否决,因为 ~/.deepseek/ 已经包含超过 20 个自动生成的运行时产物(sessions、caches、audit logs、stashes),这些按 XDG 规范不属于 "config"。将整个状态树迁移到 ~/.config/ 会比当前分裂更违背 XDG 精神。且 ~/.deepseek/config.toml 已经是现有用户熟知的路径。
  2. 保持分裂但添加软链接。 增加脆弱性和平台特化边界情况(Windows 软链接权限、snap/Flatpak 沙箱限制)。
  3. 合并 config.toml 和 settings.toml 为一个文件。 减少"哪个文件有什么"的困惑,但不解决目录分裂本身的问题;还会让单个文件膨胀、混合异质关注点,并使安全的 round-trip 写入更困难(对某一节的程序化更新可能破坏不相关的手动编辑)。

Additional context

  • /config approval_mode and /config model (without --save) modify App state in-memory only and are intentionally session-scoped. This is reasonable behavior but should be documented alongside the persistence distinction.
  • DEEPSEEK_CONFIG_PATH currently redirects the parent directory for both config.toml and settings.toml — after consolidation this would simply point at the ~/.deepseek/ alternative root.
  • The TuiPrefs struct at ~/.deepseek/tui.toml (#657) should be either fully wired or removed before consolidation, so the final file layout is stable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Projects

    Status

    Backlog

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions