GuardEngine is a deterministic rule, contract, and evidence evaluation library for Partme Guard. It does not parse Java/Rust source, call an LLM, authorize a Git merge, or claim that an architecture is optimal.
GuardEngine is the implementation repository for the logical GuardCore role. The existing alpha CLI keeps its behavior. The following separate library candidates are under development; their APIs do not establish production trust or execute authorized delivery actions.
| Package | Responsibility | Detail |
|---|---|---|
| guard-protocol | Closed versioned documents, strict raw JSON, JCS and lossless paths | Protocol |
| guard-contract | Draft2020-12 validation, approved rule composition and verifier readiness | Contracts |
| guard-subject | Actual worktree/index/commit/merge inputs and Git object integrity | Subjects |
| guard-store | Private SQLite/artifact storage, idempotency and interruption recovery | Storage |
| guard-plan | Approved task baselines, complete frozen obligations and explicit CAS migration | Plans |
| guard-runner | Bounded native argv, aggregate output limits and managed process-tree cleanup | Processes |
| guard-run-ledger | Durable local run sequences, single-flight and late-result rejection | Run ledger |
| guard-runtime | Registered-plan dispatch and private raw-output persistence | Runtime |
The cross-repository delivery inventory preserves native requirements, scenarios and task ownership. Inventory consistency and local library tests do not close the full architecture roadmap. CLI/MCP, trusted authority, isolated execution and controlled delivery still require their own implementation and evidence.
- Contract Engine: load/validate strict versioned YAML contracts.
- Rule Engine: evaluate exact relationship assertions over analyzer-produced facts.
- Evidence Engine: produce deterministic JSON reports with input digests and a reproducible evaluation ID.
- Analyzer interface:
GuardAnalyzertrait, implemented by specialized Guards. - Fail closed: partial analyzer facts yield
INDETERMINATEandBLOCK. - Unsigned by design: local reports have
signed: false; verification means recomputation, not trusted provenance.
Place the sibling ArchGuard checkout beside GuardEngine:
workspace-full-stack-plugins/
├── guardengine/
└── archguard/
From archguard (PowerShell or Bash):
cargo run -- check --project fixtures/forbidden --contract examples/agent-job-contract.yaml --facts facts.json --report evidence.json
# Expected exit code: 2 (BLOCK); both files are produced before the exit.
cd ../guardengine
cargo run -- verify --contract ../archguard/examples/agent-job-contract.yaml --facts ../archguard/facts.json --report ../archguard/evidence.json
# Expected exit code: 2: evidence is consistent but the rule BLOCKS.Alternatively generate facts from any GuardAnalyzer and call:
guardengine evaluate --contract contract.yaml --facts facts.json --report report.json
guardengine verify --contract contract.yaml --facts facts.json --report report.jsonExit codes: 0=ALLOW, 2=BLOCK, 3=REQUIRE_APPROVAL, 4=invalid input/verification failure.
| Component | v1alpha1 format |
|---|---|
| Contract | YAML apiVersion: guard.partme.ai/v1alpha1, kind: GuardContract |
| Facts | JSON kind: GuardFacts, sourced by a specialized Guard |
| Report | JSON kind: GuardReport, deterministic evaluations |
| Rule | Exact forbid_relation(subject, predicate, object) |
| Enforcement | enforce, review, advise |
| Rule status | PASS, FAIL, REVIEW_REQUIRED, INDETERMINATE, reserved NOT_APPLICABLE |
| Decision | ALLOW, BLOCK, REQUIRE_APPROVAL |
Unknown protocol fields, versions, and rule variants are rejected, never ignored. advise emits matched facts with a nonblocking advisory detail: PASS means the rule did not block, not that there was no observation.
See architecture, technical design, protocol contract, trust boundaries, and OpenSpec plan.
- Only one rule operator is available; there is no arbitrary Rego/JS/Python expression execution.
- Fact completeness is claimed by the analyzer. A malicious local agent can fabricate inputs. Trusted CI must independently regenerate facts using protected contract versions.
- ArchGuard's current snapshot digest covers examined Cargo manifests, not the entire Git tree.
- Reports are unsigned and not attestations. Signing, approvals, policy exception registries, Git branch control, and semantic code graphs are future integrations.
- This source uses a local sibling path dependency until both repositories are published and the dependency is replaced by a pinned, independently released GuardEngine artifact.
Run cargo fmt --check, cargo clippy --all-targets -- -D warnings, and cargo test --all-targets.
License: Apache-2.0.
crates/guard-install is a separate shared installation library for the six Guard CLIs, independent of the evaluation kernel. See design and usage and the single OpenSpec change.