Introduction¶
When running Agents in DSH, the long-term instructions for Agents are written in ~/.dsh/AGENTS.md. Currently, there is no UI entry point to modify this file: you either have to exit the session to look at the file, or use an external editor to save it. If you make a mistake, you won’t see it until the next round of conversation, and there are no prompts for name conflicts.
dsh-agents-md-editor is a sidebar entry added for this purpose. Below is an introduction to its positioning, installation method, and the permission boundaries that need attention.
What is it¶
A DSH bundle maintained by AikawaNaya that registers a panel in the Web UI sidebar. Once opened, it allows viewing, modifying, and saving ~/.dsh/AGENTS.md. It is a client-side plugin that does not change the Agent’s behavior, only provides an editing entry point.
Core Features¶
-
Sidebar Entry. The bundle is registered in
sidebar.panellist, corresponding to the openedmainkeyed panel. -
Real-time Reading. The page polls the file’s sha1 version every 2 seconds. If the file is changed elsewhere (by the Agent itself or another editor), it syncs automatically when the buffer is clean; if the text is unsaved, a prompt pops up instead of overwriting.
-
Safe Saving. Saving uses
POST /agents-md-editor/api/save, carrying the version number read when the page loaded in the request. If the file changes mid-way,conflict(409) is returned, and the write is rejected. To write to disk, it first writes to a temporary sibling file and then renames it, so a process crash will not leave a truncated instruction file behind. -
No Draft Loss on Panel Switch. Switch to a session and switch back, and unsaved text is restored.
-
Follow Theme Font Size. All sizes read theme variables (
--dsh-content-font-size,--dsh-content-font-size-secondary), with no hardcoded px. Changing font size in Settings → General causes this page to update accordingly.
Installation and Enablement¶
Installation from registry:
dsh plugin --profile desktop add dsh-agents-md-editor
Development scenario with local checkout:
dsh plugin --profile desktop add ./dsh-agents-md-editor
Both methods will place the bundle in the profile, adding an entry to the sidebar (“Agent Instructions Editor”).
The component requires Node.js >=22 (see engines in the package).
Configuration¶
filePath is the unique file read and written by the plugin, defaulting to ~/.dsh/AGENTS.md. The ~ and ~/ in the path will be expanded, and relative paths are resolved based on the Host process’s working directory.
- id: agents-md-editor
name: 'dsh-agents-md-editor'
config:
filePath: '~/.dsh/AGENTS.md'
Provided Interfaces¶
Both routes are gated by ctx.connection.requestRejection, using the same browser trust fence as built-in plugins, and neither accepts path parameters. Therefore, the reachable scope is limited to the single file configured above.
| Route | Method | Request or Return |
|---|---|---|
/agents-md-editor/api/state |
GET | { exists, path, content, version, mtimeMs, size } |
/agents-md-editor/api/save |
POST | Request { content, baseVersion }, Return { path, version, mtimeMs, size, savedAt } |
version is the file’s UTF-8 bytes sha1.
The Host side uses node:fs to write directly, bypassing the file sandbox. The reason is that the target file is deliberately located outside the session workspace, and there is no approval channel for UI actions. Furthermore, since the route table does not accept user-provided paths, the only file that can actually be written is the one configured.
Verification and Testing¶
node test/host.test.mjs # or: npm test
The test performs 22 checks on a one-time file in the OS temporary directory: file does not exist, first creation, normal save, baseVersion expired returning 409 without changing the file, 405/404/400, trust fence returning 403, and ~ expansion. The test does not open the real ~/.dsh/AGENTS.md.
Applicable Scenarios and Notes¶
Suitable for Agent developers who frequently adjust AGENTS.md and want changes to take effect immediately upon completion, as well as scenarios where multiple people share the same instruction file and need version conflict alerts.
Three points to note:
- The plugin runs with the permissions of the current dsh process; the only path it can read and write is the one you specified in the configuration. Read the source code before installing, then check the license (MIT in the package).
- If the file has been changed elsewhere when saving, the request will be rejected and return 409; at this point, you need to re-read the file and submit again.
- The page polls the file version every 2 seconds; keeping the edit window open for a long time will result in continuous requests.
Conclusion¶
The value of this plugin lies not in its extensive functionality, but in bringing AGENTS.md into the sidebar from outside the session: save immediately after modification, report conflicts immediately, and leave no truncated files after a crash.
- Directory page: https://www.skillhub.cn/plugins/AikawaNaya/dsh-agents-md-editor
- GitHub: https://github.com/AikawaNaya/dsh-agents-md-editor
The directory site is an independent site with no official affiliation with DeepSeek or Hypersphere.