Introduction¶
When building Agents with tools in DeepSeek Harness (DSH), a common practice is to maintain a separate policy file that clearly defines whether network access is allowed, which tools are permitted, and which operations require human confirmation. As code iterates, declarations and implementations can easily become decoupled—policy.yml might state “no network access,” yet the repository still contains fetch calls to the external network; comments might claim “requires human confirmation,” yet high-risk actions are executed directly in the same file.
Manually reviewing files is insufficient for systematic verification. dsh-agent-policy performs static comparison: it places policy declarations side-by-side with project code to list facts where “declarations say A, but code does B.” It does not intercept runtime behavior, nor does it provide compliance certification on your behalf. The following introduces what it is, what it checks, and how to install and use it.
What is This¶
Maintained by feely0208, the npm package is named @deepwhale-cn/dsh-agent-policy (GitHub: feely0208/dsh-agent-policy), categorized under admin-security in the DSH plugin directory. In one sentence: It checks if forbidden actions were taken, and if taken actions were declared.
It is a static analysis tool, not a runtime interceptor, nor is it a scanner that solely looks at “whether permissions are overly broad” (the latter is closer to the sibling project dsh-agent-scope). The distinction can be summarized as:
agent-scope = Looks at whether the [permissions themselves] are too broad (wildcards, root directory, unrestricted egress)
agent-policy = Looks at whether [declarations] and [implementation] are consistent
For the same allow: "*", both sides might mention it; agent-scope cares about “permissions being too broad,” while agent-policy cares about inconsistencies like “you think you declared a whitelist, but the declaration allows everything.”
Core Features: Five Rules¶
The plugin verifies the project root directory. When a match is found, it provides the file path, line number, the content of that line, and the corresponding rule number. The rules listed in the README are as follows:
| Rule | What it checks | Severity |
|---|---|---|
POLICY-EGRESS-PROMISE |
Policy states “no network,” yet network calls exist in the same project | High |
POLICY-CONFIRM-MISSING |
Code implies “requires human confirmation,” yet high-risk actions are executed directly in the same file | High |
POLICY-WILDCARD-ALLOW |
Policy defines permissions as wildcards (e.g., allow: "*", tools: ["*"], permissions: all) |
High |
POLICY-DECL-EMPTY |
The tool list in the policy declaration is empty (tools: [] / tools: null) |
Medium |
POLICY-NO-DECLARATION |
Agent-related code exists, but no policy declaration file can be found | Medium |
Policy declarations typically come from policy.yml, agent.yml, or permission configurations within the project; specific parsing logic depends on the plugin source code and the output of dsh-agent-policy --list-rules.
POLICY-NO-DECLARATION only applies when Agent characteristics (such as openai, anthropic, @deepseek-ai, tool_call, tool_use, AgentExecutor, etc.) appear in the project; simple utilities will not be falsely flagged. If this rule returns notApplicable, it indicates that no Agent code was detected in the current repository.
The criteria reference OWASP Top 10 for LLM Applications 2025 (LLM06 Excessive Agency), CIS Controls v8 Control 6, NIST AI RMF 1.0, and NIST SP 800-53 Rev.5 AC-6 in the README for comparative reading. The plugin itself does not draw “secure / insecure” conclusions.
Installation and Activation¶
In an environment where DSH is installed, follow the official README:
dsh plugin --profile web add @deepwhale-cn/dsh-agent-policy
package.json requires Node.js >=18 and DSH engine >=0.1.0-rc.6 <0.3.0. The license is MIT. The plugin reads the project directory you specify with the current DSH process permissions. It is recommended to review the GitHub repository source code and license before installation.
Typical Usage¶
After installation, use the command line dsh-agent-policy (provided by the plugin’s bin).
First, perform a verification on a local Agent project. Replace /path/to/your-agent with the actual root directory:
dsh-agent-policy --root /path/to/your-agent
If you are unfamiliar with the output format, you can run the built-in demo (an example project where “the policy says no egress, but the code is sending requests out”):
dsh-agent-policy --demo
View built-in rules and rationale:
dsh-agent-policy --list-rules
For saving reports to disk or integrating with CI:
dsh-agent-policy --root . --html
dsh-agent-policy --root . --json
When there are High severity hits, the process exit code is 1, facilitating its use as a gate in CI.
The comparison example in the README: policy.yml has outbound.allow: false and notes no network access, yet src/sync.js calls fetch for a Slack Webhook. The report would look like:
POLICY-EGRESS-PROMISE src/sync.js:9
Policy explicitly states no network access, but network calls exist in the same project
The goal here is not to determine “network access is definitely a crime,” but to align declarations and implementations—either by choosing one or aligning both—to avoid mismatches between policy files and actual behavior when incidents occur.
The repository also provides bash tests/run.sh for bidirectional verification, including fixtures for “should fail,” “should pass,” and “has Agent code but no policy file,” to help understand the boundaries of the rules.
Applicable Scenarios and Notes¶
Suitable for: Agent projects that already have or plan to maintain policy files like policy.yml / agent.yml; teams that want to automatically discover “declaration-code conflicts” before merging or in CI.
Not suitable as: A runtime permission gateway, a standalone least-privilege audit (please combine with sibling plugins like dsh-agent-scope), or a compliance audit conclusion.
The DSH community plugin directory (e.g., feely0208/dsh-agent-policy on SkillHub) is maintained by the community and has no official affiliation with DeepSeek / High-Flyer. The ecosystem philosophy is “everything is a plugin,” and you can select from the directory page as needed.
In the same author’s “Deep Whale Network Security Guardian” series, dsh-agent-policy is categorized under “AI and Agent Governance” and can be used in conjunction with plugins for Agent permissions and MCP security. Each plugin does only one thing; policy verification solves the link regarding the consistency between declarations and implementations.
Conclusion¶
dsh-agent-policy statically compares policy files against code, uses five rules to list inconsistencies, supports terminal, HTML, and JSON output, and allows CI integration via exit codes. For installation commands, rule lists, and examples, refer to the GitHub README; to browse metadata in the directory site, open the SkillHub plugin page.