Skip to main content

Crate ferrify_policy

Crate ferrify_policy 

Source
Expand description

Policy loading, resolution, and authorization.

agent-policy is the governance core for Ferrify. It loads declarative mode and approval-profile files from .agent/, merges them into an EffectivePolicy, and decides whether a capability or mode transition is allowed for the current run.

The crate deliberately separates repository configuration from application orchestration. That keeps policy versionable, reviewable, and testable without hardwiring repository-specific rules into the runtime itself.

§Examples

use agent_domain::ApprovalProfileSlug;
use agent_policy::{PolicyEngine, PolicyRepository};

let repository = PolicyRepository::load_from_root(std::path::Path::new("."))?;
let engine = PolicyEngine::new(repository);
let resolved = engine.resolve("architect", &ApprovalProfileSlug::new("default")?)?;

assert!(resolved
    .effective_policy
    .allowed_capabilities
    .contains(&agent_domain::Capability::ReadWorkspace));

Structs§

ApprovalProfile
A named approval profile loaded from .agent/approvals/*.yaml.
ModeSpec
A declarative execution mode loaded from .agent/modes/*.yaml.
PolicyEngine
Resolves declarative policy into an effective policy and enforces approvals.
PolicyRepository
In-memory policy data loaded from the repository.
ResolvedMode
A resolved mode paired with its effective policy.

Enums§

PolicyError
Errors produced while loading or enforcing policy.