Introduction¶
In DSH, switching model configurations typically involves manually adjusting the default model and sub-agent settings. dsh-profile-switch provides a mechanism to manage the default model, thinking level, and sub-agent overrides through named configurations that are bound to workspace trees. It unifies behavior across TUI and Web interfaces and fails fast in headless mode.
Plugin Overview¶
dsh-profile-switch is a DSH plugin that supports interactive switching of named model configurations through the host’s ask-user flow. It is a single implementation that works in both TUI and Web interfaces and is designed to fail fast in headless mode with helpful guidance. The plugin allows saving a default model (including thinking level) and per-sub-agent model/thinking overrides, so switching workspace contexts (such as work ↔ personal) becomes a single command instead of multiple /model adjustments.
Installation and Enabling¶
Before installation, ensure the environment meets the following requirements:
* dsh version >= 0.2.0-rc.2
* Node.js version >= 22.19.0
Use the following command to install the plugin:
dsh plugin --profile <your-profile> add @aiwayds/dsh-profile-switch
Core Features¶
- Interactive switching: Switch between named configurations using the
/profile-switchand/profile-cfgcommands. - Multi-interface support: A single logic path supports both TUI and Web interfaces.
- Settings-free design: No configuration pages are required; all data is managed through command-line wizards.
- Sub-agent overrides: Supports setting independent model and thinking levels for specific sub-agents.
- Headless-mode resilience: In headless mode, commands fail fast and provide guidance for directly editing JSON files.
Commands and Usage¶
The plugin manages configurations through two core commands:
/profile-switch¶
This command binds the current workspace tree to a named configuration. When executed, the configuration is applied in the following layers:
1. Real-time default model: In TUI, switches in real time through the dsh-tui-pi bridge; in Web, switches through the session controller. If no channel is available, it is recorded as the initial selection for the next session.
2. Tree binding: Writes a .dsh-profile file in the workspace root (the nearest valid file wins), ensuring that new sessions under this tree automatically load the configuration.
3. Sub-agent overrides: Dynamically composes runtime models and thinking levels for sub-agents at runtime, instead of writing static files.
When running this command, if the current tree is already bound, the list includes a (unbind this tree) option.
/profile-cfg¶
A configuration wizard that provides the following menu actions:
* new: Create a new configuration, enter a name, select a default model chain, and configure sub-agent overrides.
* edit: Edit an existing configuration, displaying current values and allowing changes.
* save-current: Save the current live selection to a new configuration (or override an existing one), with the option to snapshot baselines for all discovered agents.
* rename: Rename a configuration.
* delete: Delete a configuration (the last configuration cannot be deleted).
In the wizard, model selection uses a three-step narrowing chain (provider → model → thinking level), with options read live from installed LLM adapters.
Sub-agents and Storage¶
Sub-agent Overrides¶
Sub-agent functionality depends on the dsh-subagent-registry plugin. The wizard only shows agent checkboxes if this plugin is installed. At that point, you can set a model and thinking level individually for each selected agent. Recorded empty values indicate explicit inheritance (inherited from the agent file), while non-empty values override the settings in the file.
Storage Files¶
~/.dsh/model-profiles.json: The configuration storage file. It is a versioned JSON file (current version 1) containing a list of configurations and the currently active configuration name. The file is self-healing; if corrupted, it falls back to the built-inwork/personal/otherconfigurations.<workspace>/.dsh-profile: The tree binding file. It contains only one line with a configuration name and supports comments and blank lines. The plugin overwrites this file only when it can be parsed as a single line, preventing overwrites of files manually annotated by the user.
Integrations and Compatibility¶
The plugin is deeply integrated with dsh-tui-pi:
* Real-time switching: When used with dsh-tui-pi that provides the dshTuiModelSelection bridge, /profile-switch can switch the default model of the current TUI session in real time.
* Editing coexistence: The /agents manager in dsh-tui-pi can also edit the same storage file and schema.
For TUI users, it is recommended to use dsh-tui-pi >= 2.18.1 to ensure the best experience.