buhuikongpan/dsh-project-context

将每个DSH工作区文件夹转换为项目:在每个新会话中自动注入紧凑的项目-工作区约定,并在composer中为每个会话提供项目切换开关。dsh-plugin

Project Overview项目介绍

This is a native plugin built exclusively for DeepSeek Harness (DSH) that adds workspace purpose classification to DSH's core functionality. It splits all workspaces into two types: project workspaces for persistent code projects, and a single shared temporary workspace for ad-hoc queries and one-off tasks. To install the plugin, you run the DSH CLI command dsh plugin --profile web add "github:buhuikongpan/dsh-project-context", then restart your DSH web instance to activate it. After installation, you can confirm it is loaded correctly by running dsh --profile web --dump-config | grep -i project-context, which should return exactly one match.

After activation, the plugin adds a dedicated "Temporary Session" button below the official "New Session" button in DSH's sidebar. When you click this button, a new session opens in the pre-created temporary workspace at $DSH_HOME/workspace/default, which is automatically created on first run. The plugin also adds a non-interactive "Temporary Session" badge to the session header so you can instantly tell what type of session you are in. This workflow is ideal for DSH users who regularly handle both persistent project work and quick, unrelated temporary tasks that do not need to be tied to an existing code repository.

The plugin is released under the open source MIT license, and does not require any external dependencies or paid services to function. It stores its own state in a JSON file at $DSH_HOME/storages/workspace-purpose.json, and handles corrupted or missing state files gracefully without blocking DSH startup. If creation of the temporary workspace fails for any reason (such as file permissions or a conflicting existing path), the plugin will log an error, disable the button, and retry on the next DSH startup or button click. Old versions of this plugin used a different state file format, so users upgrading from older versions should manually delete the old project-context.json state file after updating.

这是一个专为DeepSeek Harness(DSH)开发的原生插件,用于给DSH的工作区区分用途属性,将工作区划分为项目工作区和固定的临时会话工作区。DSH原生仅支持通用工作区概念,不区分会话的使用用途,该插件补充了这一能力,新增侧边栏「临时会话」按钮、会话头状态标识,仅给项目工作区注入项目上下文提示,临时会话不注入额外内容。

当用户需要发起不关联任何现有项目仓库的临时查询或一次性测试时,可以点击侧边栏的「临时会话」按钮,在固定的临时沙箱目录中开启新会话。插件会自动在会话头显示临时会话标识,方便用户快速区分当前会话环境,满足用户快速发起临时任务、不污染现有项目目录的需求。该插件适合经常使用DSH处理不同类型任务、需要明确区分项目任务和临时任务的用户。

用户可以通过DSH的CLI命令行工具执行dsh plugin --profile web add "github:buhuikongpan/dsh-project-context"完成安装,安装后需要重启DSH Web端才能生效。插件采用MIT许可证开源,不依赖额外第三方服务,首次运行会自动创建临时工作区目录,创建失败不阻塞插件加载,仅会禁用按钮并提示用户。旧版本遗留的状态文件需要手动删除,不会影响现有会话历史。

Pre-install check安装前体检Compatibility · Security兼容性 · 安全性 1 warning1 项注意
  • Only 2 stars - very few users, little community feedback星标只有 2,几乎没人在用,遇到问题缺少社区反馈
DSH walks through these 9 checksDSH 会逐条核对这 9 项

Compatibility兼容性

  • DSH, Node, OS and profile requirementsDSH 版本 / Node 版本 / 操作系统 / profile 是否满足要求
  • External dependencies and runtimes (Electron / Python / Docker, ...)外部依赖与运行时(Electron / Python / Docker 等)是否齐备
  • Conflicts with installed plugins: command names, skill / tool names, ports, duplicate MCP registration与已装插件是否冲突:命令名、skill / tool 重名、端口占用、重复 MCP 注册

Security安全性

  • Repo matches the facts registered here; archived or abandoned?仓库是否与页面登记一致,是否归档或长期停更
  • Safety of preinstall / install / postinstall and install.sh / setup.ps1preinstall / install / postinstall 与 install.sh、setup.ps1 是否安全
  • curl|bash, download-then-execute, obfuscation, unrelated domains → stop immediatelycurl|bash、下载即执行、混淆代码、无关域名 → 立刻停止
  • Typosquatting or unmaintained packages among the new dependencies新增依赖里有没有 typosquatting 或无人维护的包
  • Requested permissions vs. what the feature actually needs申请了哪些权限、是否超出功能所需(filesystem / network / shell / clipboard)
  • Any sudo / admin requirement, plus uninstall and rollback是否要求 sudo / 管理员权限,以及卸载与回滚方式

Anything uncertain must be marked unknown with a note on how to confirm it. This site's signal screen is a static snapshot, not a security audit.拿不准的必须标「未知」并说明要我怎么确认。本站的信号筛查是静态快照,不能替代安全审计。

Or use CLI install (for developers)或使用命令行安装(适合开发者)

CLI Install命令行安装

dsh plugin --profile web add "github:buhuikongpan/dsh-project-context"

把 buhuikongpan/dsh-project-context 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-project-context · 给 DSH 工作区一个「用途」

包名和仓库名是历史标识(它最早只做「项目上下文」)。如今它实现的是工作区用途分层: 项目工作区自带项目约定,临时会话不继承任何项目级上下文。

DSH 原生只有工作区(workspace),没有用途:每个目录都被当成项目。 可真实使用里并不都是项目——有时只想临时问点东西、试一段一次性代码、让 agent 干点跟任何仓库 都无关的事。这些东西现在有了落脚点:

  • 侧边栏「新会话」下面多一颗「临时会话」按钮:点它在固定的临时工作区里开一个新会话;
  • 那一个固定目录就是唯一的临时会话沙箱:$DSH_HOME/workspace/default,首次运行自动创建(空目录);
  • 会话头出现「临时会话」徽标:一眼看出当前会话在哪个环境里;
  • 只有项目工作区会拿到提示词:临时会话什么都不注入——它落在自己的工作区目录里,这件事由目录本身表达。

它做了什么

1. 用途只有一个判据

用途是工作区的属性,而且只有两种:conversation(就是那个固定临时目录)与 project(其余一切)。

没有「把任意工作区标成临时」的入口,也没有会话级开关——用途不是会话偶然的属性, 一个会话在项目目录里却被标成临时,是无法自洽的状态。因此状态文件里只留一个指针:

{ "version": 1, "conversationWorkspaceId": "<uuid|null>" }

位置:$DSH_HOME/storages/workspace-purpose.json(原子写:tmp + rename;损坏/缺失一律当缺省态,不阻塞启动)。

2. 首次运行创建临时工作区(幂等)

启动时(ctx.inject(['workspaceRegistry']) 之后):

  1. mkdir -p $DSH_HOME/workspace/default —— 只建目录,不预放任何文件(连 .gitkeep 都不放);
  2. workspaceRegistry.resolveByPath(dir) 命中即复用,未命中才 create(dir, '临时会话');
  3. 把 id 记进状态文件。

失败(权限/只读/路径被占)不阻塞插件加载:写一条 host 日志,按钮进入禁用态并在 tooltip 说明原因, 下次启动或下次点击会自动重试。临时工作区被手工删除/归档后,只重建目录与登记,不恢复历史会话。

3. 只给项目工作区注入消息块(agent/pre-step)

与技能目录(dsh-tool-skill)同款机制:一条带 source.kind = 'workspace-purpose' 的独立 user 消息, 不参与系统提示词拼接。

<project_context>
Working directory "<cwd>" is a project workspace: files for this work belong here.
Build a mental model before changing: inspect structure and entry points, follow the call chain.
Code is ground truth; docs are reference.
An empty directory is a new project — files still live here.
Report your understanding and plan before making changes.
</project_context>

临时会话什么都不注入:它落在自己的工作区目录里,这件事由目录本身表达,不需要再写一段文字去 "告诉"模型(何况那段文字是 user 消息,会被 compaction 折掉)。

  • 幂等:扫会话历史里 surface 可见的那条同来源消息,内容不变不重发;变化时原位替换(不是追加)。
  • 无 cwd 的会话(系统/后台)不注入、不判定。
  • 不写任何自定义会话事件——harness 的已知事件类型白名单不含仓库外插件事件,写日志会让重启后的 会话恢复抛 SessionFormatUnsupportedError(v0.3.x 的教训,这一版沿用文件存储)。

4. 两处 UI

位置 插槽(kind) 内容
侧边栏「新会话」下面 sidebar.panellist(list / root) 「临时会话」按钮:点它 = uiWorkspace.startSession(临时工作区);当前已是空白会话时不重复新建。entry 里用 stopPropagation 把点击从外壳的 selectPanel 劫持过来(见「已知边界」)
会话头 conversation.session.header.actions(list / session) 不可点的「临时会话」Pill,仅在当前会话属于临时工作区时渲染

Showing the opening section of the README — the full document lives in the repository以上为 README 开头摘要,完整文档在仓库内 · View the full README on GitHub →在 GitHub 查看完整 README →

← 上一个 Prev dsh-cost 下一个 Next dsh-skill-importer →