Expand description
harn-guard — the downloadable on-device prompt-injection classifier for
Harn (security Layer 2).
This crate is the management layer: a catalog of upstream, already-hosted
models (catalog), an on-disk store that installs and verifies them
(store), and selector resolution (resolve_dir). It hosts nothing,
bundles no weights, and makes no network calls itself — the CLI downloads
from the catalog’s upstream URLs on the user’s machine and hands the bytes to
GuardStore::install for SHA-256 verification + atomic install.
The heavy inference runtime (ONNX) lives behind the off-by-default neural
feature, so the default binary never links a model runtime. When built
without it, load_classifier is a no-op returning None and the runtime
keeps using the always-available built-in heuristic classifier. When built
with it, a host installs load_classifier into the runtime’s lazy loader
seam (harn_vm::security::set_injection_classifier_loader), which fires the
first time a local-ml policy scores untrusted content.
Re-exports§
pub use catalog::CatalogFile;pub use catalog::CatalogModel;pub use catalog::ModelFormat;pub use catalog::DEFAULT_MODEL;pub use resolve::resolve_dir;pub use store::sha256_hex;pub use store::GuardStore;pub use store::Manifest;pub use store::ManifestFile;
Modules§
- catalog
- The built-in catalog of downloadable injection-detection models.
- resolve
- Resolve a model selector to a concrete directory on disk.
- store
- The on-disk model store under
<state>/guard/.
Enums§
- Guard
Error - Failures from installing, resolving, or removing a guard model package.
Functions§
- load_
classifier - Stub for builds without the
neuralfeature: the runtime keeps the heuristic.
Type Aliases§
- Result
- Result alias for guard operations.