# Class PolicyEngine

In-memory policy engine with priority-ordered rule evaluation.

Rules are evaluated in descending priority order. First blocking rule short-circuits evaluation.

#### Implements

- IPolicyEngine

- Defined in packages/nexus-agents/src/pipeline/policy-engine.ts:61

##### Index

### Constructors

constructor

### Methods

registerRule
evaluate
listRules

## Constructors

### constructor

- new PolicyEngine(): PolicyEngine

  #### Returns PolicyEngine

## Methods

### registerRule

- registerRule(rule: PolicyRule): void

  #### Parameters

  - rule: PolicyRule

  #### Returns void

  Implementation of IPolicyEngine.registerRule

  - Defined in packages/nexus-agents/src/pipeline/policy-engine.ts:64

### evaluate

- evaluate(
  gate: {
  id: string;
  afterStage: string;
  beforeStage: string;
  rules: string[];
  onFail: "warn" | "block" | "escalate";
  },
  context: PolicyContext,
  ): PolicyDecision

  #### Parameters

  - gate: {
    id: string;
    afterStage: string;
    beforeStage: string;
    rules: string[];
    onFail: "warn" | "block" | "escalate";
    }
  - context: PolicyContext

  #### Returns PolicyDecision

  Implementation of IPolicyEngine.evaluate

  - Defined in packages/nexus-agents/src/pipeline/policy-engine.ts:71

### listRules

- listRules(): readonly PolicyRule[]

  #### Returns readonly PolicyRule[]

  Implementation of IPolicyEngine.listRules

  - Defined in packages/nexus-agents/src/pipeline/policy-engine.ts:89