شعار Agent Runtime Guard

Agent Runtime Guard

مؤسسة
Navinspire-ia
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".

نظرة عامة

الناشرNavinspire-ia
المستودعnavin
اسم المهارةagent-runtime-guard
النجوم
37
التفريعات
5
الملفات المرفقة
11
الترخيصAGPL-3.0
الروابط
  • تعليمات بصيغة Markdown

    ملف SKILL.md يُحمّله النموذج عند الحاجة، فلا يستهلك توكنات إلا عندما يَرِد طلب ذو صلة فعلًا.

  • تعمل مع أي نموذج لغوي كبير

    مهارات الذكاء الاصطناعي مكتوبة بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا تعمل مع GPT أو Claude أو Gemini أو Grok أو نموذج محلي.

  • الملفات المرفقة: 11

    نصوص برمجية وقوالب ومراجع يمكن للنموذج قراءتها أثناء عمله. الملفات للقراءة فقط ولا تُنفّذ أبدًا.

  • مفتوحة المصدر

    نشرها Navinspire-ia على GitHub. اطّلع على المصدر قبل تثبيتها.

التثبيت

ثبّت مهارة الذكاء الاصطناعي Agent Runtime Guard في TypingMind لاستخدامها مع أي نموذج لغوي كبير، أو أضفها إلى وكيل ذكاء اصطناعي آخر يقرأ SKILL.md.

1

التثبيت في TypingMind

يُثبّت TypingMind المهارة مباشرةً من مجلدها على GitHub — فيقرأ SKILL.md، ويجمع ملفات الموارد في حزمة، ويحفظ النتيجة محليًا.

  1. افتح التطبيق وانتقل إلى «الإضافات» ثم «المهارات».
  2. اختر «تثبيت من GitHub».
  3. الصق رابط مجلد المهارة الموضّح أدناه وأكّد التثبيت.
    https://github.com/Navinspire-ia/navin/tree/main/navin/skills/agent-runtime-guard
  4. فعّل المهارة في كل محادثة تريد إتاحتها فيها.
الإضافات ← المهارات ← إضافة مهارة ← من رابط GitHub، ثم الصق رابط المجلد واضغط على «متابعة».
2

التثبيت في وكيل ذكاء اصطناعي آخر

يمكن لأي وكيل ذكاء اصطناعي يقرأ تنسيق Agent Skills استخدام هذه المهارة — انسخ المجلد إلى مجلد المهارات الخاص بذلك الوكيل.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Navinspire-ia/navin.git /tmp/navin
mkdir -p .claude/skills
cp -r /tmp/navin/navin/skills/agent-runtime-guard .claude/skills/agent-runtime-guard
أعد تشغيل Claude Code بعد النسخ ليتعرّف على المهارة الجديدة.

استخدمها في TypingMind

فعّل Agent Runtime Guard في أي محادثة على TypingMind وسيتولى النموذج الباقي. تتضمن مطالبة النظام اسمها ووصفها، وبمجرد ورود طلب ذي صلة، يُحمّل النموذج التعليمات الكاملة تلقائيًا — فلا تحتاج إلى استدعائها يدويًا، ولا تستهلك أي توكنات حتى تُستخدم فعليًا.

يُحمّل النموذج مهارة Agent Runtime Guard تلقائيًا بمجرد ورود طلب ذي صلة بها.

تعمل مع أي نموذج ذكاء اصطناعي

مهارات الذكاء الاصطناعي هي تعليمات بصيغة Markdown وليست شيفرة خاصة بمزوّد معيّن، لذا لا ترتبط Agent Runtime Guard بالنموذج الذي كُتبت له. ثبّتها مرة واحدة في TypingMind واستخدمها مع GPT-5 أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو نموذج محلي تشغّله بنفسك — كل ذلك باستخدام مفاتيح API الخاصة بك.

  • تُحمَّل عند الحاجة فقط

    تتضمن مطالبة النظام الاسم والوصف فقط. وتُجلب التعليمات عند أول طلب ذي صلة، لذا لا تستهلك تعليمات المهارة أي توكنات ما دامت المهارة غير مستخدمة.

  • بدّل النماذج أثناء المحادثة

    لأن المهارة تعليمات وليست شيفرة، فإن تغيير النموذج لا يعطّلها — فالنموذج التالي يقرأ ملف SKILL.md نفسه.

تعليمات المهارة

هذا هو محتوى SKILL.md الذي يُحمّله النموذج. اقرأه قبل التثبيت — فالمهارة عبارة عن تعليمات سيتبعها نموذجك.

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 or infra on 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

LayerMechanismWhere it lives
Policy decisionscripts/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 scopeenabledTools 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 operationsthe infra tool with its observe / prepare / execute levels, which asks before critical operations and snapshots before a changecloud, Kubernetes, Terraform commands
Evidence--log tool-calls.jsonl written by the hook; scripts/audit_tool_log.py reads it<workspace>/.navin/guard/
Content checksprompt-injection-defender on tool results, permission-guard for the least-privilege reasoning, audit-logger for the human-readable recordcompanion 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

  1. 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.

  2. 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 with enabledTools and toolTimeout in the declaration so the unneeded tools do not exist at all.

  3. Write the policy. Copy assets/policy.example.json to <workspace>/.navin/guard/policy.json and adjust it with references/policy-schema.md. Start from the sample deny rules; leave network.allow_hosts at null, commands.allow_binaries and mcp.allow_servers empty for the first session. Check every regex loads:

    bash
    python3 scripts/guard_pretooluse.py --policy assets/policy.example.json --event examples/event-mcp-call.json --json
  4. Dry-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 .env with a key inside. The expected decisions are deny (commands.deny_remote_scripts), allow, deny (paths.deny):

    bash
    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.json

    Add one event file per rule the user cares about and keep them next to the policy; they are the regression tests of the policy.

  5. Install the hook. Copy the two scripts and the policy to <workspace>/.navin/guard/, then add the PreToolUse and Stop entries from examples/hooks.json to <workspace>/.navin/hooks.json. The matcher lists the tools worth checking (exec, the write tools, infra, mcp_.*); read-only tools are left out so the hook costs nothing there. A project hooks.json runs only once the user trusted it: say so and let the user accept the trust prompt. Validate the file with the hook schema checker of the hook-development skill when the format is in doubt.

  6. Run one normal session and read the log. After the first real task:

    bash
    python3 scripts/audit_tool_log.py examples/tool-calls.sample.jsonl

    on the real tool-calls.jsonl. The report lists calls per tool, decisions, denied calls with their rule, MCP servers used, repeated identical calls, bursts, hosts contacted and paths written. Exit 1 means there is at least one denied call, loop or burst to look at.

  7. Tighten from evidence. Turn the hosts table into network.allow_hosts, the binaries seen into commands.allow_binaries, the servers seen into mcp.allow_servers. Allow lists written from a real session are precise; allow lists written from imagination block the agent on its second task. Promote a warn that is always wrong into a deny; narrow a warn that fires on every call.

  8. Scope subagents too. Hooks apply to the main agent and its subagents in the shared tree, but an isolated subagent has its own checkout: pass allowed_paths, allowed_commands and isolate=true at spawn so the same limits hold there.

  9. Deliver the evidence. Give the policy, the event tests and the audit report (section below). For an incident, the JSONL log is the timeline: each line has the timestamp, session, tool, trimmed arguments and the decision.

Rules

  • Deny through the JSON decision, never through exit 2 from the guard script. A policy file with a bad regex must produce a visible error on stderr, not a silent block of every tool; the script exits 2 only when the policy or the event cannot be read, and Navin logs that as a hook error.
  • A permissionDecision of allow does not bypass Navin's own permission checks; the guard only adds restrictions on top of them.
  • Hooks cannot rewrite tool_input. When the agent needs an alternative, the deny reason names it ("use an environment variable or the vault").
  • Match paths after expansion: ~/.ssh in the policy must also catch /home/me/.ssh/id_rsa and ../.ssh; the script does this against the event cwd.
  • The host check sees arguments only. A URL built inside a Python one-liner is invisible to it; bound the binaries (allow_binaries) and rely on sandbox or egress rules for the rest, and say so in the report.
  • Secrets never reach the log: the same detector that denies a credential in arguments redacts it before the line is written. Keep secrets.deny_in_arguments on; a key that must be stored goes through request_credentials or the connectors UI, not through a tool argument.
  • Keep mcp.deny_tools for destructive shapes (delete, drop, execute_sql, run_shell) even when enabledTools already hides them: the declaration can change, the hook stays.
  • git has its own safety (the git tool asks before a force push); the policy still denies git push --force and git reset --hard through exec, which is where a shortcut would go.
  • Three identical calls in a row is the default loop threshold; raise it to 5 to 8 on long builds where pytest legitimately runs several times. The report shows the exact repeated arguments, so the call is made on evidence.
  • Do not log the full content of file writes: strings are cut at 400 characters. The path and the decision are the evidence; the content is in git.
  • A session audit that found nothing is still a result: report the counts, the servers used and the hosts contacted, so the reviewer sees what was covered.

Deliverable

  1. Policy pack in <workspace>/.navin/guard/: policy.json, the two scripts, the event tests, and the hooks.json entries. State which allow lists are active and which are still open (allow_hosts: null).

  2. Dry-run table, one row per event test:

    EventToolExpectedGotRule
  3. Session audit (the Markdown printed by audit_tool_log.py): calls per tool, decisions, denied calls (When, Tool, Rule, Reason), MCP servers used, loops, bursts, hosts, paths written. Add one line of judgment per denied call and per loop: expected behaviour, policy too strict, or a real attempt to leave the scope.

  4. Gaps: what the guard cannot see in this setup (runtime-built hosts, isolated subagents without spawn limits, tool results) and the control that covers each gap, from references/detections.md.

Produce the HTML version with studio-html-report when the user wants a report to share.

Resources

  • scripts/guard_pretooluse.py - the PreToolUse hook: evaluates one call against the policy, prints the Navin decision, appends a redacted line to the log. Also the dry-run tool (--event, --json).
  • scripts/audit_tool_log.py - the session audit over the JSONL log: per-tool counts, denied and warned calls, MCP servers, loops, bursts, hosts, written paths; exit 1 when there is something to look at.
  • assets/policy.example.json - the starting policy: deny lists for commands, paths, MCP tools and credentials, three warn rules, allow lists left open.
  • examples/hooks.json - the PreToolUse and Stop entries to add to .navin/hooks.json.
  • examples/event-remote-script.json, examples/event-mcp-call.json, examples/event-write-env.json - event tests for the dry run (expected: deny, allow, deny).
  • examples/tool-calls.sample.jsonl - a sample log with two denials, one warning and a loop, to see the audit output before a real session.
  • references/policy-schema.md - every policy key, its type, matching rules and evaluation order; the decision output and the log line format.
  • references/mcp-controls.md - vetting checklist for an MCP server, the Navin declaration limits, runtime risks (tool poisoning, rug pull, confused deputy) and their controls.
  • references/detections.md - the catalogue of runtime signals RG-01 to RG-18 with the rule that catches each, tuning advice, and what the hook cannot see.

الملفات المرفقة

يقرأ النموذج هذه الملفات عند الحاجة ما دامت المهارة محمّلة. وهي متاحة للقراءة ولا تُنفّذ أبدًا.

الأسئلة الشائعة

ماذا تفعل مهارة الذكاء الاصطناعي 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 actio...

لماذا تستخدم Agent Runtime Guard على TypingMind؟

لأنك تثبّتها مرة واحدة وتستخدمها مع أي نموذج. مهارة Agent Runtime Guard عبارة عن نص Markdown وليست شيفرة خاصة بمزود بعينه، لذا تعمل المهارة نفسها مع GPT-5 أو Claude أو Gemini أو Grok أو نموذج محلي، ويمكنك تبديل النموذج أثناء المحادثة دون تعطّل المهارة. يعمل TypingMind بمفاتيح API الخاصة بك، فتدفع للمزودين مباشرةً بدلًا من اشتراك لكل مقعد، وتبقى مهاراتك ومحادثاتك في مساحة التخزين الخاصة بك.

كيف أثبّت Agent Runtime Guard في TypingMind؟

في TypingMind، افتح «الإضافات»، ثم «المهارات»، ثم اختر «التثبيت من GitHub» والصق https://github.com/Navinspire-ia/navin/tree/main/navin/skills/agent-runtime-guard. يقرأ TypingMind ملف SKILL.md الخاص بالمهارة، ويجمع ملفاتها ويثبّتها كمهارة يمكنك تفعيلها لكل محادثة على حدة.

ما نماذج الذكاء الاصطناعي التي يمكنها استخدام Agent Runtime Guard؟

أي نموذج تربطه في TypingMind. مهارات الذكاء الاصطناعي عبارة عن تعليمات Markdown وليست شيفرة خاصة بمزود بعينه، لذا يمكن لكل من GPT وClaude وGemini وGrok والنماذج المحلية تحميل هذه المهارة عندما يتوافق الطلب معها.

كم نموذج ذكاء اصطناعي يمكنني استخدامه مع Agent Runtime Guard؟

أي عدد تريده. ما دام النموذج يدعم المهارات، يمكنك استخدام Agent Runtime Guard معه، سواء كان GPT أو Claude أو Gemini أو Grok أو DeepSeek أو Mistral أو Llama أو غيرها، وكل ذلك على TypingMind باستخدام مفاتيح API الخاصة بك.

هل مهارة الذكاء الاصطناعي Agent Runtime Guard مجانية؟

نعم. نشرها Navinspire-ia على GitHub بموجب ترخيص AGPL-3.0. لا تدفع إلا لمزود الذكاء الاصطناعي الخاص بك مقابل التوكنات التي تستخدمها.

ما هي مهارات الذكاء الاصطناعي؟

مهارة الذكاء الاصطناعي حزمة تعليمات قابلة لإعادة الاستخدام تعلّم نموذج الذكاء الاصطناعي كيفية تنفيذ مهمة محددة. وتتبع تنسيق Agent Skills المفتوح: ملف SKILL.md يتضمن اسمًا ووصفًا، إلى جانب أي نصوص برمجية أو قوالب أو ملفات مرجعية قد يحتاج إليها النموذج. لا يقرأ النموذج التعليمات إلا عندما يتوافق طلبك مع المهارة، لذا لا تترتب على المهارة المثبتة أي تكلفة حتى تُستخدم.

كيف تختلف مهارات الذكاء الاصطناعي عن الإضافات أو موصلات MCP؟

تمنح الإضافة أو موصل MCP النموذج أدوات جديدة يمكنه استدعاؤها، وهي شيفرة تُنفَّذ في مكان ما وتُرجع نتيجة. أما مهارة الذكاء الاصطناعي فتزوّد النموذج بالمعرفة ومنهجية العمل: كيفية التعامل مع مهمة، والخطوات التي ينبغي اتباعها، وما ينبغي أن تكون عليه المخرجات الجيدة. المهارات عبارة عن نصوص Markdown، لذا لا تحتاج إلى خادم أو مفتاح API أو بيئة تشغيل، وتعمل مع أي نموذج.

عرض الكل

أنشئ مساحة عملك للذكاء الاصطناعي الآن

اشترك في نشرتنا الإخبارية لتصلك أخبار الميزات الجديدة والهدايا القادمة 👇