Introduction

DSH Web provides a workflow environment for building agents. During development, maintaining a clear set of context rules (such as role definitions and tool usage instructions) is crucial. This plugin provides a Dock control above the chat input box, allowing users to maintain checkable context rules globally or per workspace, and to inject them in real time into the session system prompt.

Core Features

A “Dynamic AGENTS.md” dropdown button is persistently docked above the input box, always visible and displaying a badge with the number of selected rules. The panel is divided into “Global” and “Current Workspace” groups, and supports selection, select all/deselect all, adding, deleting (with secondary confirmation), and viewing full content.

The rule library is managed in two levels:
- Global Rule Library: Located at ~/.dsh/dynamic-agents.json, it shares rule definitions across all workspaces and does not store selection states.
- Workspace Rule Library: Located at <workspace>/.dsh/dynamic-agents.json, it stores the workspace’s rules, selection states, and session unlock states.

The selection state of global rules is controlled by the workspace file (global rule IDs are prefixed with g-), so different workspaces can each select different global rules. New rules require a name and content; after saving, they are immediately injected into the session system prompt without restarting. Selected content is merged and injected in the order “global first, workspace after”, in the format ## Rule Name + rule content.

After a session already has chat history, the control enters a locked state. Selection, adding, and deleting are not allowed. Unlocking requires secondary confirmation to maintain the session system prompt cache hit rate.

Installation and Activation

Prerequisites: dsh and pnpm must be installed locally.

Install the plugin:

dsh plugin --profile web add "git+https://github.com/hw-cola/dsh-dynamic-agents.git"

After installation, restart dsh web (to activate the plugin’s cordis patch layer) and refresh the browser page.

Usage Examples

  1. Manage Context: In the “Dynamic AGENTS.md” dropdown button in the Dock above the input box, select or deselect context rules. The panel displays the current number of selected rules.
  2. Add a Rule: Click the add button, enter the rule name and content, and save. The rule takes effect immediately.
  3. Quick Management: Use the select all/deselect all functions in the panel to manage rules quickly.
  4. View Details: Click view full content to see all available rules.
  5. Locking and Unlocking: Before the first turn of a session, it waits for configuration loading to complete. After the session starts, the control is locked; unlock it before modifying the configuration.

Notes and Compatibility

  • Data Cleanup: Uninstallation does not automatically delete data files (the global rule library and workspace rule library must be cleaned up manually).
  • Version Compatibility: The plugin was developed and tested on DSH 0.1.7-rc.1. Check version compatibility after major version upgrades.
  • Loading Timing: Before the first turn of a session, it waits for configuration loading to complete, avoiding missed injection in the first turn.
  • Runtime Environment: The plugin is also available on mobile devices, and the panel supports adaptive positioning.

Conclusion

This plugin solves the cumbersome problem of context rule management in DSH Web through a visual interface, achieving rule isolation and flexible injection across global and workspace scopes. For more details, see the GitHub repository.