Introducing a new way to review your PRs.

Read the announcement

hashgraph-online / hol-guard

Open-source antivirus and firewall for AI agents: block risky tools, secret access, prompt injection, malicious packages, MCP servers, plugins, and skills at runtime.

View on GitHub

44 documents · Updated Nov 23, 2026

docs / plugin-kit-validation-installation-and-telemetry

Plugin-kit validation, installation, and telemetry

The Rust plugin kit turns plugin and MCP source into checked packages for agent runtimes. It also plans safe installs from HOL listings, records what it installed, and supports local update checks plus opt-in aggregate install telemetry.

System flow

The lifecycle starts with source discovery and ends with runtime use, reporting, or an update prompt. The kit keeps these paths separate: package creation reads a source repository, installation consumes a trusted shape of listing data, and telemetry reads installed manifests without exposing private plugin identity.

This diagram shows how source and public listing data move through the system.

flowchart LR
    S[Plugin source] --> D[Plugin and MCP discovery]
    D --> V[Validation]
    V --> P[Runtime packages]
    P --> R[Agent runtime installation]
    L[HOL install spec] --> I[Install plan]
    I --> R
    R --> M[Installed manifests]
    M --> U[Local update check]
    M --> T[Opt-in telemetry match]
    T --> H[Weekly aggregate report]

Source discovery and validation

Plugin and MCP discovery

The kit builds one runtime-neutral view of a source repository. It recognizes plugin manifests, marketplace entries, Gemini extensions, MCP Registry server.json, MCP configuration, Agent Plugins files, and SKILL.md skills. The shallowest plugin root supplies the main identity, while other supported sources add missing data.

MCP discovery records the server command or remote URL, transport, referenced environment variables, headers, and files that a local server needs. It keeps variable names and reference shape, not secret values. A repository can supply its identity through a manifest, nearby package.json, or the Git origin when the source does not declare one.

The source walk is bounded and does not follow symlinks. It skips common dependency and build folders, so discovery stays limited to the named repository and does not execute source code.

References: rust/…/detect.rs• L1-7 rust/…/detect.rs• L35-199 rust/…/model.rs• L8-23 rust/…/walk.rs• L1-5

Validation and runtime fit

Validation tells a publisher whether the discovered plugin is complete and which runtimes can carry its features. It reports errors for invalid plugin or skill data and warnings for issues such as missing versions, licenses, repositories, or portable MCP settings. Strict mode treats warnings as a failed check.

The result also shows runtime support and dropped components. This makes portability visible before packaging: Claude Code can carry its full plugin surface, while other runtimes may carry only skills, MCP servers, or a context file. Literal environment values and headers are not carried into packages, and a server that depends on a plugin-root path is omitted from runtimes that cannot express that path.

Agent Plugins 1.0 conformance is a separate check. It explains the affected specification section and whether a client rejects the whole plugin or only one component.

References: rust/…/lib.rs• L228-240 rust/…/check.rs• L31-45 rust/…/check.rs• L68-215 rust/…/check.rs• L244-255 rust/…/emit.rs• L91-187

Package and installation lifecycle

Package emission

Packaging runs validation first and writes only when the check passes. It emits a separate runtime folder for each supported target, with the manifest and configuration shape that target understands. It copies only the source files needed by the selected features and records the source and output digests in hol.provenance.json.

The output is deterministic for the same source, kit version, and runtime selection. A normal package requires an empty destination. Force replacement removes only files recorded by the prior provenance record, which protects unrelated files in the destination. Output paths cannot escape the selected destination or pass through symlinks. A failed write removes files and folders created by that write.

References: rust/…/lib.rs• L243-286 rust/…/lib.rs• L335-378 rust/…/emit.rs• L190-308 rust/…/emit.rs• L317-422 rust/…/output.rs• L17-23 rust/…/output.rs• L25-90 rust/…/output.rs• L114-158 rust/…/output.rs• L228-345

Install plan and runtime execution

Installation consumes a HOL install spec rather than arbitrary command text. The kit validates the listing identity, version, repository, marketplace names, target runtimes, manual steps, and security data. It then builds fixed argument lists for the supported runtime CLIs. A spec can point to another listing origin only when that origin passes the endpoint rules; plain HTTP is limited to local hosts.

Security data gives each install a gate: pass, confirm, or block. Guard blocks listings marked unavailable or tied to a different scanned commit. It asks before installs with no scan, an old scan, a low trust score, high findings, or a commit that a runtime cannot pin. Codex receives the scanned commit during marketplace setup. Claude Code is checked after install and is rolled back if its installed commit differs.

The command shows a dry-run plan by default. Apply mode asks before each automatic runtime and runs one approved runtime at a time. Agent Skills remains a manual step because its CLI can install for multiple detected agents. Guard records a runtime only after its command succeeds.

References: rust/…/install.rs• L1-9 rust/…/install.rs• L16-29 rust/…/install.rs• L478-560 rust/…/install.rs• L575-685 rust/…/install.rs• L692-821 tests/test_guard_plugin_install_cli.py• L90-149

Uninstall record

The install ledger is the source for uninstall planning. It stores the listing metadata and the runtime targets that Guard installed, so uninstall can work even if the listing later leaves HOL. It removes only recorded runtime installs. A marketplace is removed only when Guard added it and no other plugin needs it.

Ledger writes use an exclusive lock and an atomic file replacement. An invalid record is an error and is not replaced, because guessing could remove a plugin that Guard did not install. A corrupt regular record can be moved aside through recovery, while an unreadable file or a record from a newer schema remains untouched.

References: rust/…/ledger.rs• L1-13 rust/…/ledger.rs• L23-110 rust/…/ledger.rs• L123-247 rust/…/ledger.rs• L259-308 rust/…/lib.rs• L176-198

Installed-plugin reporting

Installed manifest discovery

The Guard runtime locates the install homes of Claude Code, Codex, Gemini, and Cursor. It uses configured homes where the runtime supports them and ignores homes that do not exist. The telemetry kit then extracts only each installed plugin's runtime, name, version, and repository from the runtime's manifest layout. Missing, malformed, oversized, or unreachable manifests are skipped.

Repository identity is the join key for public reporting. A homepage or plugin name alone cannot match a listing, and a monorepo needs the manifest name to select one listing. This prevents a private or unlisted plugin from entering a public report by name collision.

References: rust/…/plugin_telemetry_host.rs• L167-187 rust/…/installed.rs• L1-6 rust/…/installed.rs• L20-93 rust/…/report.rs• L33-97 rust/…/plugin_telemetry_host_tests.rs• L60-71

Weekly telemetry report

Plugin install counts are opt-in. Guard downloads the public HOL index through the managed network policy, then uses the installed repositories to filter it on the device. It reports one entry per matched listing and runtime, with the highest cached version for that pair. Entries installed by Guard's plugin installer are marked with via: hol-guard when the install record can be read.

The report contains a weekly HMAC-based counting key instead of a device identifier or private plugin name. The key changes with the device secret, week, listing, and runtime. The device secret stays in the Guard home. A report is sent at most once per ISO week after telemetry is enabled. Guard holds a send lock for the full send and records the week only after HOL accepts the report, so an interrupted or failed send remains due.

References: rust/…/plugin_telemetry_host.rs• L74-165 rust/…/plugin_telemetry_host.rs• L190-246 rust/…/plugin_telemetry_weekly.rs• L277-320 rust/…/plugin_telemetry_weekly.rs• L394-430 rust/…/lib.rs• L1-23 rust/…/lib.rs• L117-151 rust/…/report.rs• L60-70 rust/…/report.rs• L100-165 rust/…/plugin_telemetry_weekly_tests.rs• L188-232 rust/…/plugin_telemetry_weekly_tests.rs• L279-356

Local update checks

Update checks use the same repository-based listing match but stay local after Guard downloads the public release index. They compare the newest installed version for each listing and runtime with checked releases. A prompt marks a newer security fix or an installed high-severity release as urgent.

Users can dismiss a prompt for one latest version. A newer release makes the prompt eligible again, and the dismissal file can be reset. Plugins without a valid version, a public listing match, or a checked release do not produce prompts.

References: rust/…/plugin_telemetry_host.rs• L272-296 rust/…/plugin_telemetry_host.rs• L324-394 rust/…/updates.rs• L1-6 rust/…/updates.rs• L48-84 rust/…/updates.rs• L265-364 rust/…/lib.rs• L152-177

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep the source manifest rules, runtime emitters, output safety checks, and runtime support report aligned. A new carried or dropped component must appear in all relevant paths.
  • Keep install-spec security gates, runtime pin checks, and the install ledger compatible. The ledger rebuilds uninstall plans from recorded targets and validates them again.
  • Keep repository normalization identical between installed-manifest discovery, public index matching, and update checks. Name-only matching would expose private plugins.
  • Keep managed index downloads, runtime-home selection, and native telemetry requests within their size, shape, and network limits. A changed public index contract can stop both reports and update checks.
  • Keep the install ledger's runtime targets aligned with weekly report via marking. A changed slug or runtime name can mislabel which installs came from Guard.
  • Keep the telemetry report fields free of local paths, private names, and device identifiers. Only matched public listings may reach the report.
  • Keep release version rules aligned between package metadata, report version selection, and update comparison. Unknown versions must not create false update prompts.
  • Keep consent, device-key, send-lock, and last-week state changes atomic across opt-in, opt-out, and report submission. A key reset during a send must not submit a report keyed to the old consent state.

Important failure modes

TriggerConsequenceGuard
Validation finds an error or strict mode finds a warningPackaging stops before it writes a packageRun check and fix the reported source or portability issue
A requested runtime cannot load the discovered pluginThe package request fails instead of producing a partial named targetUse the runtime support result or omit unsupported targets
An output path is unsafe, overlaps source, or passes through a symlinkPackage output is refusedUse a separate destination with plain relative paths
A package write fails after it startsFiles and folders created by that write are removedFix the destination access problem and retry
An install spec contains command text, invalid identifiers, or a mismatched originNo runtime command runsUse a valid HOL spec and fixed runtime targets
HOL blocks the listing or its scanned commit differs from the pinned commitInstallation is refusedRescan or publish a spec with matching security data
An install command failsThat runtime is not recorded as installedCheck the per-runtime result before retrying or uninstalling
The install ledger is missing or invalidUninstall stops without removing anythingRepair or recover the ledger; do not replace it with guessed data
A HOL index is unavailable, too large, invalid, or outside the expected shapeReports or update checks fail without using untrusted index dataRetry through the managed network path or update Guard when the index exceeds its request limit
An installed manifest has no valid public repository matchIt is excluded from telemetry and update promptsPublish a repository-backed listing and keep the manifest repository accurate
Telemetry is off, another sender is active, or the weekly send already completedNo report is sentEnable telemetry, let the active send finish, or wait for the next due week
Consent is withdrawn or the device key changes while a report is being builtThe report is rejected before sending and the week remains dueKeep the current consent and key in place until the send completes

Key files

FileWhy to read it
rust/…/lib.rsNative request boundary and the end-to-end check, package, install, ledger, and report operations
rust/…/detect.rsSource and MCP discovery model
rust/…/check.rsValidation outcomes and runtime support decisions
rust/…/emit.rsRuntime package outputs and provenance inputs
rust/…/output.rsSafe package destination and rollback behavior
rust/…/install.rsInstall spec validation, security gates, and runtime plan contract
rust/…/ledger.rsRecorded install state and safe uninstall source
rust/…/plugin_telemetry_host.rsManaged HOL index access, runtime-home selection, installed-listing matching, and update request routing
rust/…/plugin_telemetry_weekly.rsConsent state, device-key lifecycle, weekly send coordination, and Guard-install report tags
rust/…/installed.rsInstalled plugin manifest discovery
rust/…/report.rsPublic listing matching and weekly report entries
rust/…/updates.rsLocal release comparison, urgency, and dismissals
tests/test_guard_plugin_install_cli.pyUser-facing install safety and ledger behavior
tests/test_guard_plugin_telemetry_cli.pyOpt-in telemetry and privacy guarantees
tests/test_guard_plugin_updates_cli.pyUpdate prompts and dismissal behavior