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 / ai-bom-and-agent-inventory

AI BOM and agent inventory

Guard's AI bill of materials (AIBOM) is a redacted view of the AI agents, tools, instructions, skills, plugins, policies, and related security evidence found on a device. It turns provider-specific discovery into stable local records that Guard can inspect, compare, export, and send to Guard Cloud without exposing private paths or secret values. This page complements the security scanner and plugin analysis page by focusing on inventory data flow rather than scanner design.

Inventory purpose

The inventory gives local and cloud security workflows one common description of what an AI agent can use. A harness is an AI agent host such as Codex or Cursor. Guard keeps the harness identity with each inventory snapshot so that similar artifacts from different hosts do not become one record.

Inventory scope

Guard collects evidence from both the agent's own configuration and the workspace that the agent uses. The inventory includes primary objects and the security-relevant relationships around them.

Inventory areaSecurity question
Agents and harnessesWhich AI host is present on the device?
Skills, plugins, and prompt or instruction overlaysWhat can shape an agent's behavior?
MCP servers and toolsWhich external tools can the agent call, and what do their schemas describe?
Policies, hooks, channels, and model providersWhich controls, message paths, and model services affect execution?
Workspace packages and live host metadataWhich software components and installed host apps are visible to local security workflows?
Sources, findings, trust layers, and driftWhat evidence supports the record, and what changed?

Guard normalizes harness identities to the inventory contract's supported agent types. The set includes native and third-party hosts such as Codex, Claude Code, Cursor, Gemini, OpenClaw, OpenCode, Copilot, Cline, Devin, and Paseo. An unknown identity falls back to the Codex type so downstream records still use a known contract value.

References: src/…/inventory_agent_types.py• L7-54 src/…/aibom_detection.py• L33-52 src/…/inventory_contract_models.py• L10-29

Host metadata

Guard can read display metadata from an existing Codex host through a private, same-user control channel. This view reports installed apps and public tool summaries for local inventory use. It does not start a host or MCP process, and it does not treat summaries as schemas, account proof, or granted permissions.

The host view remains temporary and is discarded when the host identity, socket, or freshness window is no longer valid. An incomplete reply stays marked as incomplete instead of becoming a stronger security claim.

References: src/…/codex_host_inventory.py• L1-5 src/…/codex_host_inventory.py• L55-133 src/…/codex_host_inventory.py• L352-417

Collection boundaries

Guard first runs the normal provider detection path. It then uses the native resident as the authority for shared workspace artifacts, Codex skill inventory, enablement rules, and workspace merge plans. The resident returns typed artifacts and found paths. If it cannot provide a bound discovery answer, Guard fails closed instead of inventing local discovery results.

On hosts where the resident cannot walk skills, Guard uses a bounded portable walk for eligible skill roots. This path keeps the workspace and home scopes separate and records incomplete skill discovery as an artifact. MCP metadata has a different safe fallback: an unavailable resident produces unbound digests that cannot act as approval context.

Guard can inspect symlink sources when requested. It limits inspection to the home and workspace roots by default. An unsafe target is recorded as blocked evidence instead of being followed. This boundary keeps inventory collection useful for shared files while preventing a workspace record from becoming a path traversal tool.

Workspace collection can also include package evidence from manifests, lockfiles, and SBOM files. The native workspace inventory is authoritative and returns validated pages with one digest, package scan targets, package-specific targets, manifest change data, and lockfile warnings. A missing or malformed resident reply raises an error rather than using a Python fallback. This evidence supports package-aware local security checks without changing which AI hosts are present.

References: src/…/aibom_detection.py• L1-10 src/…/aibom_detection.py• L144-229 src/…/aibom_detection.py• L232-343 src/…/aibom_detection.py• L404-465 src/…/native_workspace_inventory.py• L1-8 src/…/native_workspace_inventory.py• L166-253

Normalized inventory model

The normalized model separates an agent snapshot from the items and evidence inside it. This lets Guard report a whole provider state while still attributing a finding or capability to one skill, server, tool, or instruction source.

Snapshot assembly

An inventory snapshot is a time-stamped view for one harness. Each item has a stable identity, display name, kind, content or semantic hash, capability categories, risk level, and redacted metadata. The snapshot also carries scanner findings and source availability so a missing scanner is not confused with a clean scan.

The collection path combines native detection, workspace additions, optional Cisco skill or MCP scans, local trust evidence, and source inspection before it computes the snapshot identity.

This diagram shows how provider and workspace evidence becomes a local snapshot and then a cloud-facing event.

flowchart LR
    A[Provider detection] --> B[Workspace and home artifacts]
    B --> C[Normalized inventory items]
    C --> D[Trust and scanner evidence]
    D --> E[Redaction and stable hashes]
    E --> F[Local snapshot]
    F --> G[Status and export]
    F --> H[Cloud inventory event]

References: src/…/aibom_collection.py• L22-78 src/…/inventory_contract.py• L244-334 src/…/inventory_contract_models.py• L67-170

Identity and drift

Guard uses stable fingerprints to distinguish a real change from a new observation time. Snapshot identity is based on the agent type, item content and metadata, findings, and source state. Volatile times and attestation fields do not change that identity. Local inventory state keeps first-seen, last-seen, changed, approved, present, and removed information for each artifact.

This makes drift useful to both local policy checks and cloud views. A new or changed hash can trigger review. A missing artifact remains visible as removed rather than silently disappearing from history.

References: src/…/inventory_contract_fingerprints.py• L25-77 src/…/store_inventory.py• L189-298 src/…/service.py• L1359-1411 src/…/service.py• L1665-1696

Security evidence

Trust evidence describes how Guard reached a local assessment. The local baseline covers supported instruction, skill, plugin, MCP, hook, policy, and related items. Optional Cisco skill and MCP scans add separate layers and findings when they run. These layers retain scanner status and finding counts, and they are marked as local device claims rather than cloud-verified score input.

MCP servers can produce separate MCP tool items. Guard derives their capabilities from tool names, descriptions, schemas, and annotations so a tool can be reviewed separately from the server that advertises it. If the native metadata service is unavailable, Guard attaches unbound environment and header digests rather than treating them as proof of an approved context.

References: src/…/aibom_trust_metadata.py• L43-148 src/…/aibom_trust_metadata.py• L695-742 src/…/inventory_contract_scans.py• L19-117 src/…/inventory_contract_items.py• L205-369 src/…/aibom_detection.py• L367-465

Redaction and source safety

Redaction is part of the inventory contract, not a display-only step. Guard sanitizes artifact metadata before it builds an item and runs a final safety check before it serializes a snapshot for output or cloud transport.

Redaction boundary

Guard preserves enough identity to support review without exporting private values. Home paths become {home}/..., workspace paths become {workspace}/... where the boundary is known, and paths outside those boundaries are reduced to safe names. URL credentials and sensitive query values are removed. Header and environment values are represented by presence markers. Commands lose path and credential values.

The serialized payload records the redaction result. It reports which field classes were redacted and whether raw secrets were included. The final serializer rejects a payload that still matches unsafe path or secret patterns.

References: src/…/inventory_contract_redaction.py• L22-78 src/…/inventory_contract_redaction.py• L101-130 src/…/inventory_contract_redaction.py• L155-230 src/…/inventory_contract.py• L171-204

When an artifact is a symlink, Guard reports the relationship without publishing the raw target path. It records a source fingerprint, link kind, path class, target content hash when safe, and a validation state such as valid, broken, loop, missing, or escape blocked. Invalid link states become inventory findings so local security workflows can act on them.

The same source evidence can appear as sourceOfTruth metadata or as redacted source links. This lets an operator see that two records share a source or that a source moved without revealing the operator's filesystem layout.

References: src/…/aibom_symlink.py• L13-30 src/…/aibom_symlink.py• L145-178 src/…/inventory_contract_scans.py• L174-207 src/…/aibom_reporting.py• L221-245

Local reports and state

Guard exposes the same normalized evidence through local status, inventory, and AIBOM export views. These views differ in purpose but share the collection and redaction rules.

Local views

The guard aibom status view summarizes layer counts, trust coverage, drift, redaction, connection state, and the last sync. The inventory JSON view combines current stored artifact rows with fresh snapshot metadata. The AIBOM export provides redacted JSON or Markdown with snapshots, artifact rows, layer summaries, trust summaries, drift summaries, and the last synchronization time.

The status view answers whether the local evidence is connected and current. The export view is the portable report. Neither view treats absent trust evidence as a positive trust judgment.

References: src/…/aibom_commands.py• L16-60 src/…/aibom_commands.py• L63-134 src/…/aibom_reporting.py• L17-124 src/…/commands_parser_local.py• L419-437

Local inventory records

Guard stores the current artifact row separately from the richer snapshot evidence. The row supports policy and approval workflows with artifact identity, source scope, launch data, hashes, presence, and approval times. Snapshot and diff records preserve the evidence needed to explain a change. The resident store owns this persistence and returns large result sets in ordered pages, so callers do not mistake a partial reply for a complete inventory.

References: src/…/store_inventory.py• L51-103 src/…/store_inventory.py• L105-179 src/…/aibom_reporting.py• L144-177

Cloud synchronization

Cloud synchronization sends compatible snapshots as inventory events tied to a Guard Cloud workspace and local device. Guard keeps local collection and reporting useful even when the cloud connection is absent or a provider is not supported by the cloud contract.

Snapshot event flow

The sync path checks workspace identity, collects snapshots with cloud defaults, filters local-only composites, sends bounded event batches, and records the result locally. Content bodies are handled only after the cloud accepts the related snapshot.

This sequence shows the order that protects cloud inventory from unaccepted snapshots and unverified bodies.

sequenceDiagram
    participant G as Guard
    participant C as Guard Cloud
    G->>G: Collect and redact snapshots
    G->>G: Remove local-only composite snapshots
    G->>C: POST agent.inventory_snapshot events
    C-->>G: Accepted or rejected statuses
    G->>C: Upload verified primary bodies for accepted snapshots
    C-->>G: Stored, hash-only, or failed counts
    G->>G: Save sync summary and retry state

Paseo composite snapshots remain local until the cloud consumer supports that type. Guard sends native provider snapshots instead of relabeling them as another agent.

References: src/…/aibom_cloud_contract.py• L11-42 src/…/aibom_cli.py• L139-233 src/…/aibom_cli.py• L242-379

Primary content upload

The cloud inventory normally carries hashes and metadata. For eligible primary skill and workspace instruction files, Guard can also send the exact body after snapshot acceptance. A primary body means SKILL.md or an allowed workspace Markdown instruction file. Supplementary skill files are not part of this upload.

Before upload, Guard checks the path boundary, reads a bounded body, recomputes the SHA-256 hash, and compares it with the snapshot claim. It reports stored bodies, hash-only acceptance, skipped items, and failures. A body that cannot be verified is not uploaded.

References: src/…/aibom_content_upload.py• L25-36 src/…/aibom_content_upload.py• L84-180 src/…/aibom_content_upload.py• L189-217 src/…/aibom_content_upload.py• L252-368

Sync freshness and outcomes

Automatic sync is normally limited to one attempt every 15 minutes. An empty successful sync uses a shorter retry window so a newly installed agent is not hidden for long. A recent missing events endpoint uses a separate backoff. Sync also checks that the workspace did not change while the operation was being prepared.

The stored summary distinguishes full success from partial sync. It records accepted and rejected snapshots, endpoint or network errors, oversized snapshots, and incomplete content upload. This prevents the local status view from claiming that the cloud has a complete inventory when only the event or only the hash was accepted.

References: src/…/aibom_models.py• L22-44 src/…/aibom_cli.py• L85-126 src/…/aibom_commands.py• L137-202 src/…/aibom_sync.py• L25-91

Change checklist

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

  • Keep the canonical agent types aligned with provider detection and the cloud event consumer. A new local type must not be silently mapped to an existing cloud type.
  • Keep native discovery kinds, artifact wire fields, portable skill roots, and workspace merge plans aligned with the resident contract.
  • Keep item-kind mapping aligned with artifact discovery, MCP tool expansion, trust enrichment, and the serialized inventory contract.
  • Preserve the distinction between a skill's full directory identity and its uploadable primary SKILL.md body.
  • Update redaction and final serialization together when a new metadata field can contain a path, URL, header, environment value, command, or finding text.
  • Preserve snapshot replacement and idempotency behavior when changing event batching or acknowledgment parsing.
  • Keep cloud acceptance ahead of primary content upload so a body cannot be stored without an accepted snapshot.
  • Keep local-only composite inventories out of cloud events until the cloud contract supports them.
  • Keep host display metadata separate from schemas, account evidence, and permissions when changing Codex host collection.
  • Keep MCP outage backoff and unbound digest behavior from turning missing native metadata into approval evidence.
  • Keep workspace package pagination, inventory digests, package targets, and lockfile warnings aligned with the native workspace inventory contract.
  • Keep resident inventory cursors advancing so a paged result cannot silently omit or repeat local records.

Important failure modes

TriggerConsequenceGuard
An artifact path resolves outside the allowed home or workspace rootsGuard records blocked source evidence and can emit a high-severity symlink findingBounded source inspection and unsafe-symlink blocking
A serialized item still contains a private path or secret patternExport or cloud serialization fails instead of sending unsafe dataFinal payload safety assertion
The native discovery resident cannot provide a bound answerProvider or workspace discovery fails closed instead of producing an untrusted inventoryNative authority errors and strict reply validation
Native MCP metadata is unavailableThe server receives unbound digests and cannot use them as approval contextOutage backoff and unbound sentinel metadata
A skill body changes after collection or is outside an approved skill rootThe body is skipped and the sync reports an incomplete uploadRe-read, size check, and SHA-256 comparison
A snapshot exceeds the cloud request limitThat snapshot is rejected while smaller snapshots may still syncWhole-snapshot batching and explicit oversized status
The inventory events endpoint is unavailableSync records a partial or skipped result and applies temporary backoffSeparate endpoint backoff state
The cloud workspace changes during sync preparationThe operation stops rather than associating data with the wrong workspaceExpected workspace identity check
A provider returns an unknown scanner severity or statusThe result is not promoted to a stronger security claimConservative severity and source-status normalization
The Codex socket or host identity changes during a metadata readGuard drops the temporary host view instead of attributing data to another processSame-user socket checks and host identity pinning
Native workspace inventory pages disagree on their digest or stop advancingGuard rejects the result instead of using an incomplete or mixed package viewStable digest validation and bounded page checks
The resident inventory cursor stallsGuard raises an error instead of returning a partial local inventoryAdvancing-cursor validation

Key files

FileWhy to read it
src/…/aibom_collection.pyShows how provider detections become collected snapshots and how scanner time is shared.
src/…/aibom_detection.pyDefines the native discovery boundary, workspace merge flow, portable skill path, and safe MCP metadata fallback.
src/…/inventory_agent_types.pyDefines the canonical agent identities accepted by local and cloud inventory contracts.
src/…/inventory_contract.pyShows snapshot assembly, contract serialization, and the final redaction check.
src/…/inventory_contract_models.pyDefines the snapshot, item, finding, drift, and source concepts used across local and cloud views.
src/…/inventory_contract_items.pyShows how one detected artifact becomes a normalized item and how MCP tools become separate items.
src/…/inventory_contract_redaction.pyDefines the boundary that removes private paths, credentials, and unsafe strings.
src/…/aibom_trust_metadata.pyExplains local trust evidence and optional Cisco scanner evidence attached to items.
src/…/aibom_reporting.pyBuilds local summaries and redacted human-readable export rows.
src/…/aibom_cloud_contract.pyDefines which snapshots can become cloud inventory events.
src/…/aibom_cli.pyCoordinates collection, cloud event sync, acknowledgment handling, and content upload.
src/…/aibom_content_upload.pyDefines the verified primary-content upload boundary and its result counts.
src/…/store_inventory.pyShows how local artifact rows, snapshots, diffs, and sync identity are retained.
src/…/native_workspace_inventory.pyShows the authoritative resident workspace inventory contract, page checks, package targets, and digest validation.
src/…/codex_host_inventory.pyShows the trust boundary for reading existing Codex host display metadata.