Preface¶
When running agents in DeepSeek Harness (DSH), the same set of global tools and skills often treats all conversations equally: if you want to perform a “read-only review” or “disable internet access,” you can only rely on system prompts to persuade the model to self-regulate, while the execution layer may still call unauthorized tools. If you want to switch permission boundaries between different tasks without interrupting the current step or creating unnecessary conversation noise, you need a session-level identity abstraction. Below is an introduction to the community plugin dsh-role-gate (maintainer lgqtime), which implements a session-switchable identity layer on DSH: tool and skill allowlists, multi-parent inheritance, dynamic switching, and identity pre-selection before a new session.
What is this¶
RoleGate (package name dsh-role-gate, category admin-security) is a session-based identity layer plugin for DSH. Each identity carries a set of tool authorizations, skill authorizations, and behavioral instructions; it supports multi-parent union inheritance. Switching only updates the selection and changes tool visibility, skill gating, and system prompts starting from the next step, without interrupting the current step. Original tagline: Per-session identity layer for DeepSeek Harness: tool/skill allowlists, multi-parent inheritance, dynamic switching, and a new-session picker.
Core Features¶
Multi-parent Inheritance and Capability Semantics¶
inheritsforms a DAG; tools and skills are combined via union, instructions are concatenated with ancestor priority, and each identity appears only once in the concatenated result.tools: ["*"]indicates all tools currently known to the agent;tools: []indicates no tools other than the three RoleGate meta-tools.skills: ["*"]allows all skills to be loaded;skills: []rejects any skill loading; whenskillsis not empty, theskilltool is automatically retained.- When
allowWebFallbackis true, configured web tools (defaultweb_search,web_fetch) are automatically added. - The resident meta-tools
role_gate,role_gate_find_local, androle_gate_authorare always visible, ensuring any identity can switch back tonone.
Execution Layer Constraints and Next-Step Effectiveness¶
Switching can be done via the identity capsule below the input box, the /identity command, or the role_gate tool; it only updates the selection and replaces tool restrictions at agent/pre-step. Tools are hidden via agent.ctx.tools.restrict({ allow }), and calls to hidden tools return UNKNOWN_TOOL. The skill directory still displays all skills, but loading skills not listed in the current identity is rejected without generating additional conversation messages.
Creation, Editing, and Local Retrieval¶
- AI Assistance:
role_gate_authorprovides catalog, draft scaffolding, create/modify/delete; writing to disk requiresconfirmed=true. - Conversational Supplement:
updatesupportsaddTools/removeTools/addSkills/removeSkills. - UI: The identity panel supports new/edit (title, description, inheritance, tool/skill checkboxes, instructions, web fallback, draft); “Let AI complete” writes the current design to the input box to hand over to the model.
- Local Capability Retrieval:
role_gate_find_localsearches tools and skills, marking visible/hidden, authorized/blocked. draft: trueonly displays a “to be perfected” hint and does not affect switching or application.
New Sessions and Sub-agents¶
The New Session row in a new conversation displays an identity selector; the selected identity is written to pending, automatically applied when the session is created, and then cleared. Sub-sessions/forks inherit the parent session identity. The current identity is persisted in $DSH_HOME/role-gate/state.json and retained after restart or recovery.
Installation and Activation¶
Search for dsh-role-gate in the DSH plugin marketplace for one-click installation. Currently, it is a GitHub-only release and is not yet available on npm.
Refresh the web page after installation; the client bundle does not automatically hot-reload without a dev build watcher. If duplicate role-gate rows appear in the composition tree, you can change the insert in cordis.patch.yml to an empty array [], keeping only the unique row in the profile.
For local development, the bundle can be installed via (source text):
plugin_manager action=install_bundle target=<local repository path>
The plugin requires DSH engine ^0.2.1-rc.2 (see package.json). License MIT.
Typical Usage¶
Create Identity¶
Explain the requirements in the conversation, for example:
Use RoleGate to create a code review identity that only reads code, can run tests, and has no internet access.
The model will call role_gate_author action=catalog, then action=propose, and finally action=create confirmed=true to save after confirmation. You can also check and save in a form via Identity ▾ → New Identity below the input box.
Identity definition example (stored in the identity library):
{
"version": 1,
"identities": {
"code-review": {
"name": "code-review",
"title": "Code Review",
"description": "Read-only review and minimal fixes",
"inherits": ["reader"],
"tools": ["read", "grep", "glob", "edit"],
"skills": ["tdd"],
"instructions": "Work as a reviewer, read before modifying, run tests after modification.",
"allowWebFallback": false,
"draft": false
}
}
}
Switch Identity¶
- UI: The
Identity: … ▾capsule below the input box. - Command:
/identity code-review,/identity list,/identity none. - Tool:
role_gate action=switch name=code-review, oraction=clear.
After switching, the UI may display “Effective next step”; tool calls already issued in the current step will not be revoked midway.
New Session Pre-selection¶
After clicking “New Session”, there is an Identity · New Session ▾ on the right side of the New Session row. The selection is written to pending in state.json, automatically applied when the first message creates the session, and then cleared; selecting “Not enabled” clears the pending.
Configuration¶
Data directory: $DSH_HOME/role-gate/ (~/.dsh if DSH_HOME is not set). Main files: identities.json (identity library), state.json (session current identity and pending).
The role-gate line in cordis.patch.yml or the profile’s cordis.yml can be configured (excerpt):
| Field | Default | Description |
|---|---|---|
defaultIdentity |
null |
Default identity for new sessions |
webTools |
["web_search","web_fetch"] |
Web fallback tool names |
allowWebFallbackByDefault |
true |
Default when identity is not explicitly set |
enforceSkills |
true |
Whether to enable skill gating |
maxInstructionsChars |
16000 |
Instruction limit per identity |
Instruction priority in the identity system prompt (plugin convention): Prioritize current identity tools/skills; use role_gate_find_local when insufficient; only use the internet when local capabilities are insufficient and web tools are visible; identity instructions do not override direct requests from the user’s current turn.
Use Cases and Notes¶
Who it is for: Developers and teams who need to switch tool/skill boundaries by task within the same DSH environment, perform multi-role workflows, or preset permissions for new sessions.
Operation and Trust: The plugin runs with the permissions of the current dsh process. The identity library is global data at the $DSH_HOME level and is not isolated by profile. Please read the source code and license before installation.
Known Boundaries (Excerpt from README):
ctx.tools.restrictcannot mask tools registered by the agent’s own layer; the registry view of Plugin/Tool inspectors may still see these tools.- Explicit user
/skillnameinjection does not go through theskilltool and is not affected by skill gating. - Presets using
persona.complete: truewill discard other system-prompt sections, including the RoleGate identity section. - Switches made by the model via
role_gatewill leave tool call cards;/identitywill leave command nodes.
Conclusion¶
dsh-role-gate turns “identity” into a session layer that is inheritable, switchable, and persistent. In the DSH ecosystem where “everything is a plugin,” it belongs to an enhancement of admin-security capabilities. Community directory page: lgqtime/dsh-role-gate; Source code and full instructions: GitHub — lgqtime/dsh-role-gate.