agent-runtime-guard
Control what an AI agent and its MCP servers may do while they run - a PreToolUse policy (denied commands, protected paths, approved hosts, approved MCP…
от Navinspire-ia★ 37 звёзд на GitHub
Установить agent-runtime-guard в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Agent Runtime Guard
Overview
An agent acts through tools: a shell, file writes, git, cloud CLIs, MCP
servers. Each call runs with the user's rights, so the question at runtime is
not "is the model well behaved" but "is this call inside what the task
allows". This skill installs that check: a policy evaluated before every tool
call through a Navin PreToolUse hook, a log of each decision with secrets
redacted, and an audit of the session that shows what was denied, which MCP
servers were used, and where the agent looped. The posture is deny what is
clearly wrong, warn on what needs a human look, allow the rest, and keep
evidence. The guard never edits a tool call; it blocks with a precise reason
so the model takes another route.
When it applies
- Navin runs with
exec, write tools orinfraon a machine where a wrong command costs something (production credentials, shared repositories, customer data). - One or more MCP servers are declared, especially remote ones or servers with destructive tools.
- Subagents run in parallel and their actions must stay inside a scope.
- A compliance owner asks what the agent did during a session (DORA art. 9 logging, ISO 27001:2022 A.8.15, NIS2 art. 21 access control) or an incident review needs the sequence of tool calls.
- The user asks to restrict the agent to a folder, a toolchain or a list of APIs before letting it work unattended.
Engines and sources
| Layer | Mechanism | Where it lives |
|---|---|---|
| Policy decision | scripts/guard_pretooluse.py, a PreToolUse hook reading the event JSON on stdin and answering with Navin hook JSON |
<workspace>/.navin/hooks.json (project), ~/.navin/hooks.json (personal), or a plugin hooks/hooks.json |
| Static scope | enabledTools and toolTimeout on each MCP server; allowed-tools in a command or subagent frontmatter; allowed_paths, allowed_commands, isolate=true at spawn |
~/.navin/config.json tools.mcpServers, <plugin>/mcp.json, agent files |
| Infra operations | the infra tool with its observe / prepare / execute levels, which asks before critical operations and snapshots before a change |
cloud, Kubernetes, Terraform commands |
| Evidence | --log tool-calls.jsonl written by the hook; scripts/audit_tool_log.py reads it |
<workspace>/.navin/guard/ |
| Content checks | prompt-injection-defender on tool results, permission-guard for the least-privilege reasoning, audit-logger for the human-readable record |
companion skills |
The hook event for PreToolUse carries hook_event_name, session_id,
cwd, tool_name and tool_input (the real tool arguments: command for
exec, path and content for write_file, edits[] for edit_file). Exit 0
with {"hookSpecificOutput": {"permissionDecision": "deny", "permissionDecisionReason": "..."}} blocks the call and returns the reason to
the model as the tool result; {"systemMessage": "..."} shows a line to the
user without blocking. The hook-development skill has the complete event
and output reference.
Workflow
Inventory the surface. List the tools the task needs (read, grep, edit, exec with which binaries, git, infra, which MCP servers and which of their tools) and the targets it must never touch (production profiles, credential files, folders outside the project, hosts outside the approved APIs). Write both lists down; they become the policy.
Vet each MCP server before it is enabled, with
references/mcp-controls.md: origin, transport and identity, the full tool list with its descriptions (tool poisoning hides there), the scope of the token behind it. Restrict withenabledToolsandtoolTimeoutin the declaration so the unneeded tools do not exist at all.Write the policy. Copy
assets/policy.example.jsonto<workspace>/.navin/guard/policy.jsonand adjust it withreferences/policy-schema.md. Start from the sample deny rules; leavenetwork.allow_hostsatnull,commands.allow_binariesandmcp.allow_serversempty for the first session. Check every regex loads:python3 scripts/guard_pretooluse.py --policy assets/policy.example.json --event examples/event-mcp-call.json --jsonDry-run the policy on real events. The examples folder holds three events: a download piped to
sudo bash, a harmless MCP search, a write of.envwith a key inside. The expected decisions are deny (commands.deny_remote_scripts), allow, deny (paths.deny):python3 scripts/guard_pretooluse.py --policy assets/policy.example.json --event examples/event-remote-script.json python3 scripts/guard_pretooluse.py --policy assets/policy.example.json --event examples/event-write-env.jsonAdd one event file per rule the user cares about and keep them next to the policy; they are the regression tests of the policy.
Install the hook. Copy the two scripts and the policy to `/.navin
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
- assets/policy.example.json
- examples/event-mcp-call.json
- examples/event-remote-script.json
- examples/event-write-env.json
- examples/hooks.json
- examples/tool-calls.sample.jsonl
- references/detections.md
- references/mcp-controls.md
- references/policy-schema.md
- scripts/audit_tool_log.py
- scripts/guard_pretooluse.py
FAQ
Что делает скилл agent-runtime-guard?
Control what an AI agent and its MCP servers may do while they run - a PreToolUse policy (denied commands, protected paths, approved hosts, approved MCP servers and tools, no credentials in arguments), a redacted log of every tool call, and a session audit that finds denied calls, loops and bursts. Use when the user asks to "lock down what the agent can do", "block dangerous commands", "control MCP tool calls", "audit what the agent did", "stop the agent from touching production", or deploys Navin, a subagent or an MCP server where a wrong call has a real cost. In French "encadrer les actions de l'agent", "bloquer les commandes dangereuses", "auditer les appels d'outils", "controler les serveurs MCP".
Как установить скилл agent-runtime-guard?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл agent-runtime-guard запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…