用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/TheArchitectit/agent-guardrails-template --skill pi-guardrails-core命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Insert honeypot tokens into sensitive files to detect if an agent leaks their contents in output
Topic-based content filtering to block harmful or unauthorized content in agent output
Access and read guardrails skill documentation, configuration examples, and usage guides at runtime.
基于 SOC 职业分类
正在显示 SKILL.md
| id | guardrails-core |
| name | Pi Guardrails Core |
| description | Available guardrail tools and automatic enforcement behavior for pi agents |
| version | 1.3.0 |
| tags | ["safety","core","pi"] |
| tools | ["guardrail_init","guardrail_record_read","guardrail_verify_read","guardrail_set_scope","guardrail_check_scope","guardrail_record_attempt","guardrail_check_strikes","guardrail_reset_strikes","guardrail_check_halt","guardrail_log_violation","guardrail_status","guardrail_mcp","guardrail_pre_work_check","guardrail_detect_creep","guardrail_check_pattern","guardrail_validate_git","guardrail_detect_language","guardrail_get_language_profile","guardrail_check_regression","guardrail_verify_fixes","guardrail_register_failure","guardrail_validate_replacement","guardrail_acknowledge_halt","guardrail_read_skill","guardrail_list_skills","guardrail_list_languages"] |
The Four Laws of Agent Safety are enforced automatically via event handlers. You do NOT need to call guardrail tools before every edit — the extension handles enforcement automatically.
The following rules are enforced without any explicit tool calls:
| Handler | Event | Law | What It Does |
|---|---|---|---|
| Read tracking | tool_result | Law 1 | Tracks every file read; blocks edits to unread files |
| Scope enforcement | tool_call | Law 2 | Blocks edits to files outside authorized scope |
| Bash safety | tool_call | Law 4 | Blocks dangerous commands (rm -rf, sudo, force-push) |
| Injection defense | tool_call | Law 4 | Blocks/warns on prompt injection in tool input (bash/write/edit) |
| Output validation | tool_result | Law 3 | Detects secrets/PII in tool output, warns via status bar and logs violation |
| Content filtering | tool_result | Law 3 | Detects denied topic content in output, warns and logs violation |
| Canary tokens | tool_result | Law 3 | Detects canary tokens in output (data exfiltration), alerts via status bar |
| Permissions | tool_call | All | Gates tool access by auto/ask/blocked levels |
When a handler blocks an operation, it also records a halt in the session state. Use guardrail_acknowledge_halt to resume after reviewing the halt reason.
These tools are available for proactive checking before operations:
guardrail_verify_read — Check if a file has been read before editing itguardrail_check_scope — Check if a path is within the authorized scopeguardrail_check_halt — Evaluate whether an operation should be halted (includes uncertainty score)guardrail_init — Initialize a guardrails session at the start of each conversationguardrail_status — Get the full session state summary (scope, strikes, violations, MCP status, halt state)The Three Strikes rule enforces Law 4 (Halt When Uncertain):
guardrail_record_attempt — Record each task attempt (success or failure)guardrail_check_strikes — Check the strike count for a taskguardrail_reset_strikes — Reset strikes after a successful resolution or user escalationAfter 3 consecutive failures on the same task, the system recommends halting and escalating to the user.
guardrail_set_scope — Define which file paths the agent is authorized to operate onguardrail_check_scope — Verify a path is in scope before operating on itguardrail_log_violation — Log a guardrail violation with law, severity, and contextWhen a handler blocks an operation, a halt is recorded in the session state:
guardrail_acknowledge_halt — Acknowledge a halt condition so work can resumeactive → halted → acknowledgedCross-session failure registry for preventing regressions:
guardrail_check_regression — Check if modifying files risks regressing past failuresguardrail_verify_fixes — Verify that past fixes in a file are still intactguardrail_register_failure — Register a past failure with a regression patternguardrail_validate_replacement — Validate that old content in an edit matches the actual file (catches stale edits)guardrail_detect_language — Scan a project directory and return detected languagesguardrail_get_language_profile — Get detected languages + available rules with descriptionsguardrail_validate_git — Validate git commands against branch protection and destructive operation policiesguardrail_read_skill — Read a guardrails skill's SKILL.md documentationguardrail_list_skills — List all available guardrails skillsguardrail_list_languages — List available language-specific prevention rulesguardrail_check_halt returns an uncertaintyScore (0-1):
When the Go MCP server is available, guardrail_mcp proxies calls to it for enhanced enforcement including sandbox execution, canary tokens, extended validation, and policy retrieval.
| Module | Skill | Automatic? | Explicit Tool? |
|---|---|---|---|
| Read tracking | [[guardrails-core]] | Yes (tool_result) | guardrail_verify_read |
| Scope enforcement | [[guardrails-core]] | Yes (tool_call) | guardrail_check_scope |
| Bash safety | [[guardrails-core]] | Yes (tool_call) | guardrail_check_halt |
| Strike tracking | [[guardrails-core]] | No | guardrail_record_attempt/check_strikes |
| Injection defense | [[injection-defense]] | Yes (tool_call) | guardrail_mcp detect_injection |
| Output validation | [[output-security]] | Yes (tool_result) | guardrail_mcp scan_output |
| Content filtering | [[content-safety]] | Warn (tool_result) | guardrail_mcp filter_content |
| Tool permissions | [[tool-permissions]] | Yes (tool_call) | guardrail_mcp set_permission |
| Policy layers | [[policy-config]] | Yes (config load) | guardrail_mcp get_policy |
| Sandbox | [[sandbox-isolation]] | No | guardrail_mcp sandbox_run |
| Canary tokens | [[canary-tokens]] | Warn (tool_result) | guardrail_mcp canary_insert/check |
| Pre-work check | [[guardrails-core]] | No | guardrail_pre_work_check |
| Feature creep | [[guardrails-core]] | No | guardrail_detect_creep |
| Pattern rules | [[guardrails-core]] | No | guardrail_check_pattern |
| Language detection | [[language-detection]] | Auto (on load) | guardrail_detect_language |
| Language profile | [[language-detection]] | No | guardrail_get_language_profile |
| Git validation | [[guardrails-core]] | No | guardrail_validate_git |
| Regression guard | [[guardrails-core]] | No | guardrail_check_regression |
| Fix verification |
| [[guardrails-core]] |
| No |
| guardrail_verify_fixes |
| Failure registry | [[guardrails-core]] | No | guardrail_register_failure |
| Replacement validation | [[guardrails-core]] | No | guardrail_validate_replacement |
| Halt lifecycle | [[guardrails-core]] | Auto (on block) | guardrail_acknowledge_halt |
| Docs access | [[docs-access]] | No | guardrail_read_skill/list_skills |
| Language listing | [[docs-access]] | No | guardrail_list_languages |