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 / cloud-action-packs-and-evaluation

Cloud action packs and evaluation

Cloud action packs describe what a hosted action can do and what facts Guard can derive from it. Inspection adds signals from action arguments and results. The evaluator matches these facts against a versioned policy pack, workspace rules, consent, and execution limits to produce a decision for one exact call.

System purpose

The cloud action decision system separates action meaning from action execution. A host supplies the action, its trusted facts, its policy snapshot, and the controls available for the call. The evaluator returns whether the host may dispatch it; the host remains responsible for identity, consent storage, delivery, and dispatch.

The main boundaries are:

Action fact model

Action facts

guard.action-facts.v2 describes the effect of an action rather than its name. Trusted producers provide the class, object, reversibility, scope, counts, audience, environment, money details, sensitivity, and detector findings. Each fact is known, unknown, or unsupported, so missing evidence cannot make a call look safer.

The evaluator uses the class to establish a minimum effect. For example, a read has a read effect, while a delete has a destructive effect. The binding's declared effect and the facts' implied effect combine by taking the stricter value.

Fact groupDecision use
Class and objectIdentify the kind of action and thing it affects.
Reversibility and scopeDistinguish recoverable changes from permanent or broad changes.
Record, recipient, and byte countsApply volume limits and consent bounds.
Audience and recipient domainsIdentify outbound data or value movement.
Environment, money, and sensitivityApply production, payment, and data-risk rules.
Findings and PII kindsCarry secret, injection, and personal-data signals into policy.

References: rust/…/action_facts.rs• L1-12 rust/…/action_facts.rs• L29-48 rust/…/action_facts.rs• L169-192 rust/…/cloud_action_v2.rs• L329-357

Content inspection

cloud-action inspect examines action arguments and returned results without making a decision. It reports secret findings, result-side injection signals, personal-data shapes, sensitivity hints, and redaction locations. It does not return matched secret text, and a limit or deadline refusal means the content is not known to be clean.

The inspection result feeds facts and session state. A secret in arguments can stop dispatch. A secret or injection signal in a result can restrict later outbound actions in the same host session. PII and sensitivity values are hints for policy, not a complete data-loss check.

Inspection is bounded by request size, value count, finding and redaction limits, and a time budget. This keeps inspection predictable and makes an incomplete report fail toward caution rather than appear complete.

References: rust/…/cloud_action_inspect.rs• L1-14 rust/…/cloud_action_inspect.rs• L106-201 rust/…/cloud_action_inspect.rs• L227-305 rust/…/action_facts.rs• L133-148

Unclassified actions

An action with no admitted pack entry is not treated as harmless. The name and optional input schema produce a tighten-only class proposal. The proposal starts at update and raises the class when the name suggests sending, sharing, exporting, execution, payment, deletion, or administration. An amount-and-currency schema also suggests payment.

The proposal never admits an action and never trusts provider annotations such as read-only hints. The selected policy preset applies its unclassified rule, with destructive-looking names receiving at least the preset's destructive-name decision.

References: rust/…/cloud_action_classifier.rs• L1-9 rust/…/cloud_action_classifier.rs• L281-329 rust/…/cloud_policy_pack.rs• L200-208 docs/…/cloud-policy-presets.md• L51-60

Policy pack model

Versioned policy packs

A policy pack is a versioned set of fact rules for a risk posture. It names the preset, the usage windows its rules may use, the fallback for unclassified actions, and the rules that map action facts to Guard decisions. Its digest identifies the exact policy document used for a decision.

The pack is validated before use. Rules must have unique preset-scoped identifiers, use declared windows, contain valid fact selectors, and carry only supported obligations. An unclassified fallback cannot be weaker than review. Pack fixtures can also pin expected decisions for representative safe and risky calls.

References: docs/…/cloud-policy-presets.md• L3-23 rust/…/cloud_policy_pack.rs• L63-117 rust/…/cloud_policy_pack.rs• L219-279 rust/…/cloud_policy_pack.rs• L281-331

Presets and workspace rules

Guard ships relaxed, balanced, and strict presets. The preset supplies general risk rules. Workspace rules are joined with those rules when the workspace must add local knowledge such as trusted domains or other workspace-specific limits.

Fact selectors combine dimensions such as class, object, audience, sensitivity, counts, findings, session history, and usage windows. A missing dimension is a wildcard. A fact that is unknown produces an unknown match, and the evaluator chooses the stricter result so uncertainty cannot lower protection.

The presets express different outcomes for the same fact family. Balanced is the default posture and commonly allows bounded low-risk work while requiring review for external, broad, sensitive, or destructive work. Strict raises more cases to review or block, while relaxed requires less review but still does not allow an unclassified action by default.

References: docs/…/cloud-policy-presets.md• L25-49 rust/…/action_fact_selector.rs• L1-8 rust/…/action_fact_selector.rs• L114-151 rust/…/action_fact_selector.rs• L252-344

Decision evaluation

Evaluation flow

The evaluation flow turns one hosted call into a bounded, attributable decision. Admission establishes the reviewed meaning of the action first. Policy then uses the action's effect and facts. Later checks can only tighten the result.

This diagram shows how action input and trusted context move through inspection, policy matching, consent, and the final dispatch decision.

flowchart TD
    A[Action arguments and result] --> B[Content inspection]
    B --> C[Trusted action facts and session signals]
    C --> D[Binding and connection admission]
    D --> E[Effect floor and workspace rules]
    E --> F[Versioned policy pack fact rules]
    F --> G[Activation and target capability checks]
    G --> H[Obligation checks]
    H --> I[Scoped consent]
    I --> J[Allow, warn, review, reapproval, sandbox, or block]

References: rust/…/cloud_action.rs• L1-13 rust/…/cloud_action.rs• L183-260 rust/…/cloud_action_v2.rs• L325-466 rust/…/cloud_action_serve.rs• L25-59

Decision precedence

The evaluator applies checks in a fixed order. This order prevents a later convenience, such as consent, from undoing an earlier safety boundary.

  1. Parse and validate the request and its limits.
  2. Match the binding-set digest and admit the known action.
  3. Check the provider, canonical arguments, and resource identifier.
  4. Verify a supplied workspace activation.
  5. Apply the declared effect floor and the version 1 workspace rules.
  6. Join fact rules. Definite matches apply directly. Unknown matches are considered for the stricter branch.
  7. Apply usage windows and required obligations.
  8. Apply catalog tightening, global lockdown, and target capability checks.
  9. Apply a matching consent only when the resulting action is review or reapproval eligible.

The result uses the ordered severity allow, warn, review, require-reapproval, sandbox-required, and block. Errors also return block with dispatch disabled. The host must dispatch only when the result is valid and explicitly says dispatch is permitted.

References: docs/…/cloud-action-evaluator.md• L108-130 rust/…/cloud_action_policy.rs• L129-179 rust/…/cloud_action_v2.rs• L254-323 rust/…/cloud_action.rs• L338-371

Consent answers a review for a later call. An exact scope binds consent to the full action identity. A resource scope covers one action on one connection and resource. A bounded scope covers a validated fact selector for one action and connection.

Broader consent is restricted by the facts and session. Permanent or unknown changes need exact consent. A session with an injection signal blocks broader consent. Outbound actions also need a known-safe session flow and bounded recipient, record, and byte facts. Unknown facts never satisfy a bounded selector.

The evaluator offers exact and, where safe, resource or bounded choices. It stores no consent and does not consume a one-time consent. The host must persist, apply, and consume those records.

References: docs/…/cloud-action-evaluator.md• L175-200 rust/…/cloud_action_v2_consent.rs• L1-17 rust/…/cloud_action_v2_consent.rs• L136-215 rust/…/cloud_action_v2_consent.rs• L217-326

Validation constraints

Validation protects the meaning of both the call and the policy that evaluates it. Strict JSON intake rejects duplicate keys, excessive nesting, unsafe numbers, oversized arguments, unknown fields, and malformed fact data. Canonical arguments then give the exact call a stable identity.

Bindings require a known action meaning and minimum target controls such as pinned egress and bounded output. Fact rules and selectors have bounded sizes. Missing target capabilities or unsupported obligations tighten the decision instead of being ignored.

References: docs/…/cloud-action-evaluator.md• L8-20 rust/…/cloud_action_canonical.rs• L18-27 rust/…/cloud_action_binding.rs• L141-207 rust/…/cloud_action_v2.rs• L199-227

Decision evidence

Decision provenance

The result records the reason codes and matched rule identifiers that explain the outcome. It also reports the action identity, execution identity, facts digest, policy pack digest, and evaluation provenance digest. These values let the host tie a decision to the exact action, binding, facts, policy inputs, and evaluator context.

The evaluator is stateless between requests. The hosting service supplies current session flow, usage counters, policy rules, saved consent, and activation on each request. A change to any identity-bearing input creates a different exact action identity or provenance record.

References: docs/…/cloud-action-evaluator.md• L81-106 rust/…/cloud_action_canonical.rs• L189-210 rust/…/cloud_action_v2.rs• L417-465

Change checklist

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

  • Change an action pack fact extractor only with its policy selectors, fixture decisions, facts digest, and any consent bounds that depend on the fact.
  • Change a binding effect, resource field, adapter identity, or required capability with the binding-set digest, execution identity, and exact-consent behavior.
  • Change a policy pack rule or usage window with the pack digest, workspace-rule join, provenance data, and preset fixture expectations.
  • Add or change an obligation with the host capability contract. A policy can otherwise turn a permitted-looking call into a block.
  • Change inspection detectors or redaction paths with the action facts, session ledger, and result-delivery handling.
  • Change activation or catalog controls with both the catalog digest and the fail-closed activation checks.

Important failure modes

TriggerConsequenceGuard
Binding-set digest does not match the evaluatorThe action is unavailable and cannot dispatch.Load one admitted binding set and require its digest in every request.
Facts or inspection are unknown or incompleteRisk rules take the stricter branch. Broad consent may not apply.Treat unknown as unknown. Do not convert an inspection refusal into a clean result.
A required target capability is absentThe result becomes sandbox-required unless it is already stricter.Report only capabilities the host really enforces.
A matched rule requires an unsupported obligationThe result becomes block.Keep the host's supported-obligation list aligned with policy rules.
Activation signature, workspace, catalog, or time window is invalidEvaluation returns an error-shaped block.Verify activation before policy can use external catalog controls.
A saved consent is broader than the call's known safety factsThe consent does not answer the review.Use exact consent for permanent, unknown, tainted, or unsafe outbound calls.
An admin effect or destructive unclassified action is presentedAdmin is blocked. Unclassified actions receive at least review and may require stricter handling.Keep action meanings in admitted bindings and use the preset fallback for unknown tools.

Key files

FileWhy to read it
docs/…/cloud-action-packs.mdExplains the declarative action-pack model, extracted facts, fixtures, and pack digests.
docs/…/cloud-action-evaluator.mdDefines the evaluator contract, precedence, result states, and host obligations.
docs/…/cloud-policy-presets.mdSummarizes the three shipped policy postures and their risk families.
contracts/…/cloud-action-pack.v1.schema.jsonDefines the data contract for providers, actions, fact extractors, safety limits, and fixtures.
rust/…/cloud_action_inspect.rsShows the bounded inspection boundary for secrets, injection signals, PII, and redactions.
rust/…/action_facts.rsDefines the trusted action-fact vocabulary and fact validity rules.
rust/…/action_fact_selector.rsDefines selector matching, unknown facts, session flags, and usage windows.
rust/…/cloud_policy_pack.rsConnects versioned preset data to evaluator fact rules and pack digests.
rust/…/cloud_action_v2.rsShows how facts, rules, obligations, consent, and provenance become a result.
rust/…/cloud_action_v2_consent.rsDefines exact, resource, and bounded consent behavior.
rust/…/cloud_action_binding.rsDefines the admitted meaning and required runtime controls for each action.