AI Code Guard Policy Guide

Status: Planned Audience: policy authors, security reviewers, and CI owners Related: Scanner AI Code Guard operations

This guide defines the Policy signals and matrix logic used to evaluate AI Code Guard evidence — the analysis Stella Ops produces for AI-generated code changes (new secrets, unsafe APIs, suspicious similarity, and license risk). The goal is deterministic, explainable pass / review / block outcomes with auditable overrides.

1) Policy goals

2) Signals (proposed)

SignalTypeNotes
guard.ai.statusstringpass, review, block from Scanner.
guard.ai.hunk.countintCount of changed hunks evaluated.
guard.ai.secrets.new.countintNew secrets in this change.
guard.ai.secrets.pre_existing.countintPreviously known secrets.
guard.ai.unsafe.countintUnsafe API findings.
guard.ai.similarity.maxnumberHighest similarity score (0.0-1.0).
guard.ai.similarity.denylist_hitboolTrue when denylist threshold is exceeded.
guard.ai.license.block.countintLicenses in block list.
guard.ai.license.review.countintLicenses requiring review.
guard.ai.override.activeboolOverride is present and unexpired.
guard.ai.override.expires_atstringUTC ISO-8601 timestamp.

3) Policy matrix

Default matrix (policy pack example):

4) Example DSL snippet

The rule below blocks a change when it introduces new secrets or trips the similarity denylist. For the full Stella Policy Language reference, see the Policy DSL guide.

rule ai_code_guard_block priority 50 {
  when guard.ai.secrets.new.count > 0 or guard.ai.similarity.denylist_hit == true
  then status := "block"
  because "AI code guard block criteria met";
}

5) Overrides

6) Evidence and replay