Skip to content

PatternContentGuardOptions

Namespace AgentPrism · Assembly AgentPrism.Core.dll

Settings for the built-in pattern-based guard.

public sealed class PatternContentGuardOptions

objectPatternContentGuardOptions

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Read from the AgentPrism:ContentGuard:Pattern configuration section.

This class deliberately has no Enabled flag. The no-surprises rule’s gate is the registration itself: AddAgentPrism does not register the built-in guard, so in a default setup the inspection wrapper is never added to the pipeline and the cost is exactly zero. Adding an Enabled flag would require the guard to be registered but turned off; then the claim “if no guard is registered the cost is zero” would become unmeasurable.

If you need to keep the guard running but temporarily disable it, empty PatternContentGuardOptions.DeniedTerms and set PatternContentGuardOptions.MaskedPii to PiiPatterns.None: the guard then sees no rule and returns ContentGuardResult.Allow on the first inspection.

public PatternContentGuardOptions()

The configuration section name.

public const string SectionName = "AgentPrism:ContentGuard:Pattern"

string

Denied terms. A match produces ContentGuardAction.Block.

public IList<string> DeniedTerms { get; }

IList<string>

The comparison is case-insensitive and searches for a word fragment (IndexOf); it is not a regex, so a value the consumer writes carries no ReDoS risk.

The text written in place of a masked match. Default [redacted].

public string MaskReplacement { get; set; }

string

The built-in PII patterns to turn on. A match produces ContentGuardAction.Mask. Default PiiPatterns.None.

public PiiPatterns MaskedPii { get; set; }

PiiPatterns