Introduction¶
When building agents in DeepSeek Harness (DSH), skill files tend to accumulate quickly. The model has no “permission awareness”—it will proactively attempt to read every skill, sometimes using the read tool, the skill tool, or even cat in the terminal to pull out the full content. For skills that require strict access control (such as those containing internal standards, sensitive paths, or private configurations), this “read-all-by-default” pattern is inappropriate.
DSH does not have built-in skill access control and can only be extended through plugins. dsh-skill-gate was built to solve exactly this problem: it turns skill access into “session-level” authorization management and provides a panel that shows which skills were actually loaded, what content was loaded, and how much context they consume. Once installed, a new “Skills” tab appears at the top of the session.
What Is This¶
dsh-skill-gate is a DSH plugin maintained by naili0712, categorized under admin-security. It provides two layers of capability: first, a “gate” on skill access (you can only see skill names; the body requires authorization), and second, an “audit trail” for skill loading (recording which skills the model actually read and by what method). Additionally, it supports pinning certain skills as the current session’s “working set” and provides a fallback and recovery mechanism when context is compacted.
Core Features¶
Two Authorization Modes¶
The plugin offers two modes. The default is auto-authorization:
- Auto-authorization (default): The model reads freely; the plugin only records, it does not block.
- Manual authorization: Skills that have not been explicitly granted are invisible to the model. When the model requests one, the panel highlights it as “Pending Authorization,” and it only becomes readable after you click “Grant.”
Manual mode is suited for scenarios requiring strict access control, such as allowing the model to access only a specific subset of skills.
Content Authorization & Load Audit¶
In manual mode, the plugin intercepts the following actions:
- Calls to the
skilltool - Direct reads via the
readcommand - Read operations such as
catwithinpwsh/bash
At the same time, the plugin records the model’s actual read behavior: which skills were read, how many times, and by what method. These records persist in the panel so you can verify whether the model is “following the rules.”
Pinned Skills & Compaction Fallback¶
Pinning a skill keeps it available throughout the session:
- Check a skill → click “Load Selected” → the plugin injects the full text once
- In subsequent turns, the model can work with the context of this pinned skill
Context is finite, and injecting full text frequently can easily exceed the limit. The plugin includes a compaction fallback mechanism:
- After the first compaction, it automatically injects a key-points summary (tens to hundreds of tokens)
- After a second compaction, it injects the summary again
- Once exhausted, the panel shows “Content Compacted · Awaiting Re-injection” in red and stops auto-recovery
- You must manually click “Re-inject” to inject the full text again; the counter resets to zero
This prevents the infinite loop of “full text → compacted → over limit again → full text → compacted again.”
History Recovery¶
The plugin tags every injected message with source.kind = 'skill-gate' along with the skill name and content hash, and these are persisted with the session. After a restart or session reopen, the plugin restores the previous state from snapshotEvents():
- The top of the panel displays “Restored N pinned skills from session history”
- On restore, it compares hashes: if they match, the skill shows as “Pinned”; if they differ, it prompts “Skill Updated · Re-injection Recommended”
- If the injected message itself was reduced to a compaction summary, it falls back to “Unpinned”—this is a normal graceful degradation
Size Estimation¶
The panel displays the character count and token estimate for each skill:
- Each row shows
N tok; hovering reveals the character count - The top bar shows the total for all pinned skills and the percentage of the current context window they occupy
- The algorithm is a rough estimate: CJK characters count as 1 token each; other text counts as 1 token per 3.5 characters
- The context window is taken from the session’s
requestContext().contextWindow; if unavailable, the percentage displays as 0
Skill Groups & Custom Grouping¶
The plugin ships with a built-in “Office Document Suite” group, collapsing 7 office-related skills together. It displays the member count, total tokens, and pinned count, and supports one-click “Grant Group / Pin Group / Unpin Group.” The group definition lives in the plugin’s BUILTIN_GROUPS code, with the matching rule: name === 'office' || name.startsWith('office-').
Users can also create custom groups:
- Check any number of skills → click “New Group” → enter a name → create
- The group row carries a “Custom” badge, is expandable, and supports Grant Group / Pin Group / Unpin Group / Delete Group
- Definitions are stored in
~/.dsh/skill-gate/groups.jsonand shared across sessions - A skill belongs to only one custom group; creating a new group automatically removes it from the old one
- Deleting a group only removes the definition; it does not affect already-pinned skills
Custom groups take priority over built-in groups.
Status Bar & Change Detection¶
The third row of the panel is a loading status bar. Example:
● Directory scanned at 15:44:02 · 2 skill files changed recently: plugin-install-check, watch-video
· Skill file changes take effect in the next turn (no restart needed); plugin updates require a DSH restart [Refresh Now]
- Directory scanning is disk-first: if you modify SKILL.md externally, the description, token count, and size will update on the next refresh
- Changed skill files are detected via mtime+size comparison, and the status bar flags them
- If a pinned skill’s file has been modified, that row immediately shows “Skill Updated · Re-injection Recommended”
- Click “Refresh Now” to force a rescan without waiting for the 5-second cache
Effect rules: skill file changes do not require a restart (DSH re-reads files on every load); plugin code updates do require restarting DSH.
Expansion State Persistence¶
Whether a group is expanded or collapsed is saved in the browser’s localStorage (key: dsh-skill-gate:expanded). Closing the panel, switching sessions, and reopening all preserve the state. In private browsing mode, state cannot be persisted, but usage is unaffected.
Localization¶
The plugin includes built-in Chinese names and summaries for common skills. To modify or add entries, write to ~/.dsh/skill-gate/labels.json:
{ "watch-video": { "label": "看视频", "summary": "场景检测切段 + 联系表" } }
Installation & Activation¶
The plugin is installed by modifying the profile’s package.json:
- Add the following to
dependenciesin the profile’spackage.json:
"dependencies": {
"dsh-skill-gate": "link:<path-to-this-repo>"
}
- Add the following to
bundlesinpackage.json:
"bundles": [
"dsh-skill-gate"
]
-
Create a junction (or symbolic link) in the profile’s
node_modulesdirectory pointing to the plugin. -
After making changes, you must fully exit DSH and restart it.
To roll back, back up the profile’s package.json first, then restore it when needed.
Typical Usage¶
Using manual authorization as an example:
- Open a DSH session; a “Skills” tab appears at the top.
- In default mode, the model can read all skills freely; the panel only records activity.
- After switching to manual mode, any attempt by the model to read an unauthorized skill is blocked, and the corresponding skill in the panel highlights as “Pending Authorization.”
- You click “Grant” in the panel, and the model can then read that skill.
- Check several skills, click “Load Selected,” and the plugin injects the full text.
- In subsequent turns, the model works with the context of these pinned skills.
- When context is compacted, the plugin automatically injects a summary; once the budget is exhausted, the panel prompts you to manually “Re-inject.”
- After restarting the session, the plugin restores the pinned state from history, and the top of the panel shows the recovery count.
Use Cases & Caveats¶
Suitable for the following scenarios:
- Many skills exist, and you need to distinguish between “readable” and “unreadable” ones.
- You need an audit trail of which skills the model actually read and by what method.
- You need to pin a set of skills as the current session’s working set.
- You need to monitor how much context window pinned skills consume.
Caveats:
- The plugin runs with the current DSH process’s privileges. Review the source code and license before installing.
- Injected messages appear in the conversation as “user messages” and visually look like you sent them (DSH currently only offers this injection point).
- Compaction detection is coarse-grained: any
compaction/*event will mark pinned skills as “Compacted · Awaiting Re-injection,” which may produce false positives. - In the unpinned state, pinning requires the session working directory to be ready; for a freshly opened empty session, send a message first before clicking “Load Selected.”
- Pinning too many skills consumes context; it is recommended to keep it to ≤2–3 simultaneously.
- The gate prevents the model from “not knowing the rules,” not from malicious bypass.
Conclusion¶
dsh-skill-gate provides a complete solution from “see skill names only” to “controlled loading and auditing,” making it ideal for DSH users who need fine-grained control over skill access. For more details, visit the directory page or the GitHub repository.
- Directory page: https://www.skillhub.cn/plugins/naili0712/dsh-skill-gate
- GitHub: https://github.com/naili0712/dsh-skill-gate