Introduction¶
In DSH’s plugin-based architecture, sessions are typically organized around workspaces. dsh-project-context is a client plugin maintained by buhuikongpan, licensed under MIT. It solves a specific problem: how to automatically obtain a concise “project workspace convention” after a model enters an existing workspace directory.
This plugin treats DSH workspace sessions with a real current working directory (cwd) as projects: new sessions are automatically injected with a simplified project context, and a per-session toggle is provided next to the input box.
Core Mechanism¶
- Injects an independent user message block via the
agent/pre-stephook, labeled with the source tagproject-context. - Automatically injects the project workspace convention when a new session is opened within a workspace; no manual prompt appending is required.
- Does not register
systemPrompt.contextand does not participate in system prompt assembly. - Only effective for sessions with a real
cwd; sessions withoutcwd(system/background) are not injected. - The client Web UI supports automatic switching between Chinese and English interface languages.
Per-Session Toggle¶
A “Project” toggle is provided on the right side of the input box; it is enabled by default.
When disabled, existing context blocks are not deleted but are rendered as a status hint indicating “downgraded to normal workspace”. This prevents the sudden disappearance of project conventions within the same session, allowing the model to see the updated state in the next round of steps.
If you need to adjust the injected text or the downgrade hint text, you can modify projectContextText() / projectDisabledText() in lib/index.js.
Installation and Activation¶
Use the installation command:
dsh plugin --profile web add dsh-project-context
Restart the dsh service after installation.
You can also install from source:
dsh plugin --profile web add https://github.com/buhuikongpan/dsh-project-context
Note: Do not manually write the same insert: id: project-context outside the activation line in cordis.patch.yml included with this package; otherwise, it may trigger a duplicate loader entry id error and cause a startup failure.
Typical Usage¶
-
Install and restart the dsh service.
-
Open a new session in a workspace folder.
-
Check for an independent
<project_context>message block appearing in the conversation; seeing a user message block with theproject-contextsource tag indicates successful injection. -
Click the “Project” button on the right side of the input box to toggle between enabled and disabled states.
-
Perform syntax checking and unit tests on the source code:
npm run check
npm test
Suitable Scenarios and Notes¶
Suitable for adding a stable project convention entry for sessions with a clear workspace directory in the DSH Web client. It is also suitable for temporarily disabling the project context within a session while retaining a downgrade hint, preventing the model from mistakenly believing the project convention remains valid.
The plugin runs with the current dsh process permissions; source code and the license should be reviewed before installation.
The documentation also mentions two version-related issues: the plain-object state file from the old version 0.1.x will be migrated and backed up as .migrated upon startup; version 0.3.x writing custom session events may cause the session to be unreadable after a restart (SessionFormatUnsupportedError). Additionally, the English and Chinese documentation describe inconsistent methods for storing switch state; this article does not treat the specific storage location as a definitive behavior.
Links¶
- Independent Plugin Directory Page: https://www.skillhub.cn/plugins/buhuikongpan/dsh-project-context
- GitHub: https://github.com/buhuikongpan/dsh-project-context