当前位置: 首页 > Skill >

AI Guardian

AI Guardian

AI Guardian

Use this skill whenever the user needs to observe or govern on-endpoint local LLMs running on Ollama, llama.cpp (llama-server), LM Studio, or a local single-node vLLM — inventory installed/running models with an allow/deny verdict (shadow-AI detection), inspect VRAM residency, model license/params/capabilities and server version, view the model policy, detect model provenance/digest drift (re-pulled or tampered weights; strong for Ollama/llama.cpp, id-only and honestly weaker for LM Studio/vLLM)

0.14.1 2026.11.09 466
获取Skill文件查看使用说明
作 者:叶安 许可证: 更新时间:2026.11.09
本文目录展开

AI Guardian

Disclaimer: Community-maintained open-source project, not affiliated with, endorsed by, or sponsored by Ollama, IGEL, or any AI-security vendor. Product and trademark names belong to their owners. Source at github.com/AIops-tools/AI-Guardian under the MIT license.

Governed observability + governance for on-endpoint local LLMs (Ollama) — 20 MCP tools, every one wrapped with the bundled @governed_tool harness: a local unified audit log under ~/.ai-guardian/, token/runaway budget guard, undo-token recording, and descriptive risk tiers. It is the complement to IGEL AI Armor: AI Armor governs whether a local model may run; ai-guardian records what it did and gates what leaves in the prompt.

Ollama keeps no queryable prompt history (context is client-supplied each request), so ai-guardian observes on two fronts: passive inventory / state auditing over /api/tags, /api/ps, /api/show, /api/version; and opt-in route-through content governance — a caller sends a prompt through guarded_generate / observe_chat, which scans + policy-gates + records it and only then calls Ollama.

Standalone: the governance harness is bundled in the package (ai_guardian.governance) — no external skill-family dependency. A transparent capture proxy for other clients' traffic is v0.2 roadmap, and IGEL AI Armor interop is doc-level positioning.

What This Skill Does

Group Tools Count Read/Write
Inventory / state list_models, running_models, model_details, server_status, vram_usage 5 read
Policy / provenance policy_view, model_provenance 2 read
Content governance (read) scan_prompt, usage_events, anomaly_report 3 read
Model lifecycle pull_model (medium), remove_model (high), unload_model (medium) 3 write
Policy writes set_model_allowlist, set_model_denylist, pin_model_digest (all medium) 3 write
Route-through guard guarded_generate, observe_chat (medium) 2 write
Undo undo_list, undo_apply 2 undo

scan_prompt is pure (no Ollama call). guarded_generate / observe_chat block when the prompt's risk band >= block_threshold (default high) or the model is disallowed; blocked calls never reach Ollama and are recorded as blocked.

Quick Install

uv tool install ai-guardian-aiops
ai-guardian doctor          # works zero-config against a local Ollama
ai-guardian init            # optional: endpoint(s) + optional token + model allowlist

When to Use This Skill

  • Inventory local models and spot shadow AI (list_models / anomaly_report): unsanctioned models show allowed:false
  • Scan a prompt before sending it (scan_prompt): secrets / PII / source-code / jailbreak → a weighted risk band, no model call
  • Stop secrets or PII leaking into a local model (guarded_generate / observe_chat): scan + policy-gate + record, then run only if allowed
  • Detect a tampered / re-pulled model (model_provenance): current digest vs its pin → drift
  • Enforce which models may run (set_model_allowlist / set_model_denylist) and pin trusted digests (pin_model_digest)
  • Inspect VRAM residency (running_models / vram_usage) and audit observed usage (usage_events)

Do NOT use when the target is a GPU inference cluster (multi-node serving) — that is a different tool in the AIops-tools line. Also not for hypervisors, storage appliances, backup products, container clusters, or network devices.

Related Skills — Skill Routing

If the user wants… Use
On-endpoint local LLM (Ollama): scan prompts, shadow-AI, provenance, policy ai-guardian (this skill)
GPU inference cluster serving/ops another AIops-tools skill for cluster serving
Hypervisor / storage / backup / container / network ops the matching AIops-tools skill

Common Workflows

1. Find and shut down shadow (unsanctioned) local models

  1. ai-guardian doctor → confirm the Ollama endpoint is reachable before you conclude a fleet has "no models" when it really has no connectivity
  2. ai-guardian overview → endpoint status, model count, and what is loaded right now
  3. ai-guardian model list (MCP: list_models) → every installed model with its allow/deny verdict; anything allowed:false is shadow AI
  4. ai-guardian guard anomalies (MCP: anomaly_report) → a one-shot rollup of shadow models + digest drift + high-risk / blocked prompts, so you can tell a single stray pull from a pattern
  5. ai-guardian model running / vram_usage → is the shadow model merely installed, or actually loaded and consuming VRAM right now?
  6. Tighten policy so it cannot recur: set_model_allowlist(["llama3.*", "qwen*"]) → future unsanctioned models are refused at pull_model. Reversible: the prior list is captured as the undo descriptor
  7. Remove the offender: ai-guardian model remove <model> --dry-run, then re-run without --dry-run → high risk, double confirmation, needs AI_GUARDIAN_AUDIT_APPROVED_BY; the undo descriptor records a re-pull
  8. Failure branch: if the new allowlist turns out to be too tight and blocks a sanctioned model, ai-guardian undo list → undo apply <id> restores the prior list exactly. If a removal was wrong, replaying the undo re-pulls the model — but the weights come from the registry, so confirm the digest afterwards with workflow 3 rather than assuming it is bit-identical.

2. Stop secrets and PII leaking into a local model

  1. ai-guardian guard scan "…text…" (MCP: scan_prompt) → a pure call, no model involved: deterministic findings (secrets / PII / code / jailbreak) plus a weighted risk band. Use it to pre-check content offline before it ever reaches a model
  2. ai-guardian guard policy (MCP: policy_view) → confirm which models are permitted and what the current thresholds are
  3. Route real calls through the guard: guarded_generate(model, prompt, block_threshold="high") → the guard scans, records to the usage log, and blocks before Ollama if the risk band is >= high or the model is disallowed
  4. ai-guardian guard usage (MCP: usage_events(allowed=False)) → review what was caught. The raw prompt is never stored — only its length and redacted findings, so reviewing the log cannot itself leak the secret
  5. ai-guardian guard anomalies → confirm the rate of blocked prompts is falling after you educate the user or fix the calling integration
  6. Failure branch: route-through is opt-in — anything that calls Ollama directly bypasses the guard entirely. If usage_events is suspiciously empty while running_models shows activity, you are looking at un-routed traffic, not a clean fleet. A transparent capture proxy is a v0.2 roadmap item; until then, treat guard coverage as coverage of what was routed, and say so.

3. Detect tampered or silently re-pulled model weights

  1. ai-guardian model list / model_details <model> → read the current digest for the models you sanction
  2. pin_model_digest(model, digest) → pin the trusted digest once, while you still trust it. Pinning after a suspected compromise pins the compromise
  3. Later (or on a schedule): ai-guardian guard provenance (MCP: model_provenance) → any model whose current digest differs from its pin reports status: DRIFT — re-pulled or tampered weights
  4. usage_events around the drift timestamp → was the drifted model used, and for what, before you noticed?
  5. Failure branch: DRIFT is a statement about the digest, not about intent — a legitimate upgrade drifts identically to tampering. Investigate before removing: check whether a pull_model appears in the audit trail at ~/.ai-guardian/audit.db. If it does not, treat it as untrusted and remove under workflow 1. Re-pin only once you have re-established what the digest should be.

4. Fleet hygiene review before a rollout

  1. ai-guardian overview → the endpoint's current state at a glance
  2. ai-guardian model list → the full inventory with allow/deny verdicts
  3. ai-guardian guard provenance → every pinned model still matching its digest
  4. vram_usage + running_models → what is resident and whether the endpoint has headroom for the model you are about to roll out
  5. unload_model <model> → free VRAM from an idle model without removing it (reversible in practice — it reloads on next use)
  6. ai-guardian model pull <model> → the pull is checked against the allowlist, so an unsanctioned rollout is refused rather than merely logged
  7. ai-guardian guard anomalies → a clean rollup is the exit criterion for the review
  8. Failure branch: if pull_model is refused, the model is not on the allowlist — widen the policy deliberately with set_model_allowlist (audited, reversible) rather than working around the guard. If the pull fails on VRAM, unload_model an idle model first; the audit trail records the failed attempt with status=error and no undo token.

Governance & Safety

The skill delivers reads and writes and records them; it does not decide whether a write is permitted. That is your agent's judgement, or the permission of the host and account you run it under (point it at a runtime the account cannot administer, or hand the agent only the scan/observe tools). There is no read-only switch, deny-rules file, or approval gate — content governance (the model allow/deny policy and the guarded_generate block threshold) is a separate, product-level control that stays.

  • Audit is the guarantee, and it is not bypassable. Every operation — MCP and CLI alike — is logged to ~/.ai-guardian/audit.db (relocatable via AI_GUARDIAN_AIOPS_HOME): params, result, status, duration, and the risk tier. Observed local-LLM usage lives in a separate ~/.ai-guardian/usage.db.
  • AI_GUARDIAN_AUDIT_APPROVED_BY / AI_GUARDIAN_AUDIT_RATIONALE are optional annotations recorded on the audit row (who/why); they are never required and never block.
  • Runaway guard — a safety backstop, not authorization: the same call looped in a tight window trips a circuit breaker. Disable with AI_GUARDIAN_RUNAWAY_MAX=0.
  • remove_model supports --dry-run + double confirmation at the CLI and records an undo (re-pull); allowlist/denylist writes record an undo → the prior list.
  • The scanner is deterministic and offline; findings are redacted so a secret is never re-emitted.

References

  • references/capabilities.md — full 20-tool + endpoint reference
  • references/cli-reference.md — CLI command reference
  • references/setup-guide.md — onboarding, optional token, and connectivity

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,017
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,005
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,003
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,002
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,002
Linux内核提权风险待核实,先查版本与补丁

CVE-2026-78901在摘要中被称为Linux内核ext4本地提权漏洞,CVSS评分7.8,但上游正文暂未核实。本文提供通用只读排查命令,帮运维和开发者核对当前运行内核、发行版补丁及升级生效状态。

2026.12.02 1,001
Skill 文件
  • SKILL.md
    • AI Guardian
    • What This Skill Does
    • Quick Install
    • When to Use This Skill
    • Related Skills — Skill Routing
    • Common Workflows
      • 1. Find and shut down shadow (unsanctioned) local models
      • 2. Stop secrets and PII leaking into a local model
      • 3. Detect tampered or silently re-pulled model weights
      • 4. Fleet hygiene review before a rollout
    • Governance & Safety
    • References
  • 项目或源文件

相关 Skill

更多
Offload Tasks to LM Studio Models Offload Tasks to LM Studio Models 通过将工作负载卸载到本地 LM Studio 模型,减少对付费提供商的 token 使用。使用场景:(1)降低成本——当质量足够时,使用本地模型进行摘要、抽取、分类、改写、首次审查、头脑风暴;(2)避免高批量或重复性任务的付费 API 调用;(3)无需额外模型配置——JIT 加载和 REST API 与现有 LM Studio 设置兼容;(4)仅限本地或隐私敏感的工作。需 LM Studio 0.4+ 并启动服务器(默认 :1234),无需 CLI。
多AI讨论 多AI讨论 多个 AI 角色组成「谋士团」,主参谋(WorkBuddy)常驻对话,其余 AI 角色按需 @召唤发言。适合小说创作、剧本讨论、创意头脑风暴。 核心特点: - 主参谋先回应,谋士平时沉默、@召唤才开口 - 支持单角色召唤、全体讨论、上下文自动共享 - 默认角色:逻辑猫、共鸣猫、现实猫、博学家 - 自带可视化角色管理页,可增删角色、改 prompt - 支持 DeepSeek / OpenAI / 本地 LM Studio 三种后端 安装后填入自己的 API Key 即可使用。
Adaptive Routing Adaptive Routing 优先将LLM请求路由至本地模型(如Ollama、LM Studio、llamafile),验证响应质量,仅在本地结果不佳时升级至云端。
Local-First LLM Local-First LLM 将LLM请求优先路由至本地模型(Ollama、LM Studio、llamafile),失败后回退至云端API,并持续追踪Token节省与成本规避情况。
Lmstudio Model Switch Lmstudio Model Switch 在OpenClaw中通过简单命令实时切换本地LM Studio与云端Kimi API模型,自动重启网关。