Home / trpc-group / trpc-agent-python · examples/tool_safety/DESIGN.md · GitHub

DESIGN.md@examples/tool_safety designC

DESIGN.md@examples/tool_safety is agent-read markdown (design) from trpc-group/trpc-agent-python.

Indexed from public GitHub and served as immutable, content-addressed versions. Install it pinned to an exact SHA-256 with the mdr CLI, and every file is verified against the hash recorded here before it reaches your agent. The deterministic audit below grades the latest version, and the same file always earns the same grade.

What the file says

# Tool Script Safety Guard 设计文档

本文档说明 Tool Script Safety Guard 的请求处理流程,以及遇到不同风险程度命令时的决策和执行结果。

## 设计目标

Tool、Skill、MCP Tool 和 CodeExecutor 都可能执行脚本、shell 命令、外部进程或网络请求。Safety Guard 的目标是在真实执行前完成静态扫描和策略判断,把明显危险的请求拦截在执行边界外,并为不确定请求提供人工复核、审计和 telemetry 信息。

实现保持向后兼容:`BashTool` 和 `UnsafeLocalCodeExecutor` 默认不改变历史行为,只有显式设置 `enable_safety_guard=True` 后才启用扫描。`deny` 默认阻断执行;`needs_human_review` 默认记录但不阻断,设置 `block_on_review=True` 后也会阻断。

## 请求处理流程

```text
Tool / Skill / MCP Tool / CodeExecutor request
        |
        v
提取待执行内容
script / code / command / cmd / code_blocks
language / command_args / cwd / env / tool_metadata
        |
        v
ToolScriptScanRequest
        |
        v
ToolScriptSafetyScanner.scan()
        |
        +--> 语言归一化: python / bash / unknown
        +--> 脱敏检测: script 和 env 中的 key/token/password/private_key
        +--> Python AST 规则: open、Path、subprocess、os.system、requests、socket、eval、while True
        +--> Bash 规则: rm、curl、wget、token 环境变量输出、敏感路径、管道、重定向、命令替换、依赖安装、sudo、sleep、fork bomb
        +--> 执行上下文规则: cwd、timeout、max_output_bytes、command_args
        +--> 用户注册规则: ToolScriptSafetyScanner.custom_rules / register_rule()
        |
        v
命中 RiskFinding 列表
…

Read the whole file at its exact version.

How to install

Latest version
mdr add trpc-group/trpc-agent-python/examples/tool_safety/DESIGN.md@git:20260731.fa1428f
Exact content
mdr add trpc-group/trpc-agent-python/examples/tool_safety/DESIGN.md@sha256:87cada287f0d8ca0

Pin to a label to follow the author's releases, or to a sha256 to freeze the exact bytes forever. Either way the resolved hash is written to mdr.lock, and mdr install reproduces it on any machine.

Badge

mdr badge

[![mdr](https://markdownregistry.com/badge/art_mq3zufs7fxomtqmn.svg)](https://markdownregistry.com/a/art_mq3zufs7fxomtqmn)

1 badge views in 30 days

Versions

versioncommittedcommitsizeaudit
git:20260731.fa1428f latest2026-07-31 fa1428f 16,776 BC view · diff
git:20260731.93d7c1c2026-07-31 93d7c1c 16,707 BC view · diff
git:20260731.2478d9c2026-07-31 2478d9c 16,646 BC view · diff
git:20260731.1153e7f2026-07-31 1153e7f 16,713 BC view · diff
git:20260731.273cf2d2026-07-31 273cf2d 12,306 BC view

Audit of the latest version

C  12 of 14 checks passed. Deterministic, no model, same answer every run.
  • fail: No curl or wget piped into a shell (matched: curl ... \| sh)
  • fail: No instruction to read or print local credentials (matched: cat .env)
  • pass: Size between 200 bytes and 200 KB (16776 bytes)
  • pass: No zero-width or bidi control characters
  • pass: No instruction hidden inside an HTML comment
  • pass: No link to an exfiltration or paste host
  • pass: No credential-shaped string
  • pass: No instruction to send local credentials anywhere
  • pass: No text hidden with inline styles
  • pass: No prompt-injection phrasing
  • pass: No recursive delete of root, home or parent
  • pass: No base64 blob over 200 characters
  • pass: No link to a raw IP address
  • pass: No script tag

Source

GitHub

trpc-group/trpc-agent-python · 143 stars · license NOASSERTION · pushed 2026-09-23 · branch main

API

GET https://markdownregistry.com/api/v1/artifacts/art_mq3zufs7fxomtqmn
GET https://markdownregistry.com/api/v1/resolve?ref=trpc-group/trpc-agent-python/examples/tool_safety/DESIGN.md
GET https://markdownregistry.com/api/v1/blob/87cada287f0d8ca03addd22cc62c553aaef111f1dc5c42378dd76d1cc4093e0f

Your agent does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.

More from trpc-group/trpc-agent-python

Travel Planning Assistant skill
trpc-group/trpc-agent-python · examples/claude_agent_with_skills/.claude/skills/traver_helper/SKILL.md · Automatically generate a comprehensive travel plan based on user's travel needs (destination, date, budget, etc.)…
git:20260401.f485ee4 · audit A · 143 stars
city-info skill
trpc-group/trpc-agent-python · examples/optimization/blackbox_cli/workspace/.claude/skills/city-info/SKILL.md · 城市信息
git:20260520.dde5f18 · audit B · 143 stars
CLAUDE.md@examples/optimization/blackbox_cli/workspace claude
trpc-group/trpc-agent-python · examples/optimization/blackbox_cli/workspace/CLAUDE.md
git:20260520.dde5f18 · audit B · 143 stars
DESIGN.md@examples/optimization/eval_optimize_loop design
trpc-group/trpc-agent-python · examples/optimization/eval_optimize_loop/DESIGN.md
git:20260805.9e82694 · audit A · 143 stars
data-analysis skill
trpc-group/trpc-agent-python · examples/skills/skills/data_analysis/SKILL.md · Python-based data analysis tools using pandas and numpy for data processing and visualization.
git:20260401.f485ee4 · audit A · 143 stars
file-tools skill
trpc-group/trpc-agent-python · examples/skills/skills/file_tools/SKILL.md · Simple shell utilities for files and archives.
git:20260401.f485ee4 · audit A · 143 stars
python-math skill
trpc-group/trpc-agent-python · examples/skills/skills/python-math/SKILL.md · Small Python utilities for math and text files.
git:20260509.8d2cacd · audit A · 143 stars
user-file-ops skill
trpc-group/trpc-agent-python · examples/skills/skills/user_file_ops/SKILL.md · Simple operations on user-provided text files including summarization.
git:20260401.f485ee4 · audit A · 143 stars
code-review skill
trpc-group/trpc-agent-python · examples/skills_code_review_agent/skills/code-review/SKILL.md · Review unified diffs, file lists, or Git worktree changes inside an isolated workspace and return evidence-based…
git:20260802.b4ea8cc · audit A · 143 stars
python-math skill
trpc-group/trpc-agent-python · examples/skills_with_container/skills/python-math/SKILL.md · Small Python utilities for math and text files.
git:20260509.8d2cacd · audit A · 143 stars
python-math skill
trpc-group/trpc-agent-python · examples/skills_with_cube/skills/python-math/SKILL.md · Small Python utilities for math and text files.
git:20260603.614b07d · audit A · 143 stars
weather-tools skill
trpc-group/trpc-agent-python · examples/skills_with_dynamic_tools/skills/weather-tools/SKILL.md · Weather information query tools including current weather, forecast, and location search.
git:20260401.f485ee4 · audit A · 143 stars

Every file in trpc-group/trpc-agent-python

Browse by kind, by grade C, or by owner.