Policy enforcement layer for bounded agent actions.
GuardMesh is a lightweight specification, validation, and decision layer for bounded agent actions.
It is built for modular agent systems that need a portable answer to a narrow set of runtime questions:
- should this action be allowed?
- should it be denied?
- should it be escalated for approval?
- should a kill switch be triggered?
GuardMesh is intentionally not a full enterprise policy platform, a runtime sidecar, or a dashboard-heavy control plane. The first alpha stays focused on clear artifacts, strong decisions, and a clean developer workflow.
This repository currently focuses on:
- parsing
policy.yamlandrequest.jsonfrom an example pack - validating minimum structure and policy boundaries
- evaluating requests into
allow,deny,escalate, orkill - producing readable explanations and machine-readable decision output
- shipping example policy packs that demonstrate the core decision semantics
npm install
npm run build
node dist/cli.js validate ./examples/web-access-allow
node dist/cli.js evaluate ./examples/web-access-allow
node dist/cli.js explain ./examples/public-post-escalateDuring development you can run the CLI directly with tsx:
npm run dev -- evaluate ./examples/emergency-kill-switchFor a full local release-style verification pass:
npm run check
npm run release:dry-runexamples/web-access-allowshows a straightforward allow decision for low-risk public web access.examples/public-post-escalateshows approval-driven escalation for posting into a public channel.examples/admin-change-denyshows an explicit deny rule for risky control-plane changes.examples/emergency-kill-switchshows a kill decision for actions that should terminate execution immediately.
guardmesh validate <example-dir>
guardmesh validate <example-dir> --json
guardmesh lint <example-dir> --json
guardmesh schema-check <example-dir> --json
guardmesh inspect-policy <example-dir>
guardmesh inspect-request <example-dir>
guardmesh evaluate <example-dir>
guardmesh test-pack <example-dir> --json
guardmesh explain <example-dir>evaluate returns machine-readable JSON. explain returns a human-readable rationale intended for operators, reviewers, or logs.
Additional authoring commands:
guardmesh lint <example-dir>
guardmesh test-pack <example-dir>lint highlights policy-pack quality issues such as duplicate rule ids, overly broad rules, or shadowed rules. test-pack compares the evaluated output to decision.expected.json, which makes example packs executable documentation.
schema-check runs optional runtime validation against the shipped JSON schemas for policy, request, and decision artifacts.
Exit codes:
0means success.1means validation, lint, schema, or usage failure.2means the evaluated action did not produce anallowresult or an expectation test failed.
docs/ product and design documentation
examples/ example policy packs
schemas/ JSON schemas for policy, request, and decision artifacts
src/ parsers, validation, evaluation, explanation, and CLI
GuardMesh alpha uses three artifacts:
policy.yamldefines allowed subject, action, and resource domains plus decision rules.request.jsondescribes the bounded action request being evaluated.- decision output JSON captures the chosen decision, matched rules, approval status, and validation issues.
The canonical request field is request_id. For developer convenience, the parser also accepts the legacy alias requestId.
GuardMesh can also be embedded directly:
import { evaluateDirectory, lintDirectory, testPolicyPack } from "guardmesh";
const evaluation = evaluateDirectory("./examples/web-access-allow");
console.log(evaluation.decision.decision);
const lint = lintDirectory("./examples/web-access-allow");
const packTest = testPolicyPack("./examples/web-access-allow");The initial runtime API stays deliberately small and file-based so integrations can start simple.
For longer-lived integrations, you can also instantiate PolicyEngine directly once you already have a policy and request object.
If you want runtime schema checks in addition to code-driven validation, use schemaCheckDirectory or the individual schema validation helpers.
GuardMesh supports a minimal extends field in policy.yaml for file-based composition.
extendsis resolved relative to the child policy file.- child scalar fields override parent fields
- declared type arrays are merged and deduplicated
- constraints are shallow-merged
- parent rules are loaded before child rules
This keeps composition understandable while avoiding a larger bundle system in the alpha.
GuardMesh is one building block in a broader family of OSS components for reliable and governable agent systems.
SkillPulsefocuses on skill reliability signals.Agent Contractsfocuses on delegated task structure.CapTokenfocuses on bounded authorization.TraceForgefocuses on execution trace artifacts.AgentEvalOpsfocuses on evaluation and failure-mode analysis.GuardMeshfocuses on portable policy decisions at action boundaries.
GuardMesh should complement those modules, not absorb their responsibilities.
- Keep the surface area narrow and easy to understand.
- Prefer explicit decisions over implicit behavior.
- Make the CLI the first real integration surface.
- Leave room for future policy packs, adapters, and richer semantics without overengineering the alpha.
- Vision
- Architecture
- Policy Spec
- Roadmap
- Release Checklist
- Contributing
- Alpha Stability Policy
- Security Policy
- Code Of Conduct
MIT