01 · Walk the repository
Every YAML file, but only the ones that changed.
Every six hours the scanner lists the YAML files in each configured
repository. It skips a file whose content hash has not changed since the last
pass, so a quiet repository costs almost nothing.
By default the scanner excludes system namespaces (kube-system, flux-system,
cert-manager) and kinds such as CRDs (custom resource definitions).
It skips very large files instead of half-reading them.
02 · Rules before models
Rule-based linters go first.
The scanner runs each manifest through three tools. The first is kube-score.
The second is an in-house
structural rule pack (Flux API versions, HelmRelease
remediation settings, HPA target bands). The third is the Trivy
misconfiguration checks.
When a rule can decide a finding, the assistant never leaves it to an AI model to rediscover.
It also recognises findings that it already proposed and that are still open, and does not
raise them again.
03 · Patch what a rule can patch
Known fixes are applied by code, not by prompt.
A fixed set of rules has a patcher. These are image pull
policy, read-only root filesystem, running as a non-root user,
ephemeral-storage requests, rollout strategy, replicas, and new
PodDisruptionBudgets or NetworkPolicies. The patcher makes the patch in memory.
The patch becomes its own proposal.
A patcher can also refuse. Suppose a container writes to an unbounded
local cache. If the patcher picks an ephemeral-storage cap, Kubernetes could evict the pod.
So the scanner asks you for the size instead of guessing.
04 · Judgement where it is needed
The AI model sees the patched manifest, and real usage.
Only then does an AI model read the manifest. It sees the file
after the rule-based patches, so it cannot re-propose
them. It also sees the linter findings that it should skip. For workloads, it sees
recent CPU and memory usage from your metrics backend.
Each suggestion must carry a category, a confidence and evidence.
The assistant drops low-confidence suggestions.
05 · A minimal patch
The AI model says what to change. Code makes the change.
The AI model does not rewrite the file. It returns a short list of
structured edits. Each edit has an operation, a YAML path and a value. A round-trip YAML editor
applies them and touches only that path.
Comments, key order, block scalars and every other document in a
multi-document file stay byte-for-byte as they were. The assistant rejects an edit that
names a file outside the scan. There is no cosmetic churn.
06 · Safety checks on the diff
Suspicious diffs are held, not shipped.
The assistant checks every diff before it can become an MR. It escalates a diff that removes
more than half of a file to high risk. It holds that diff as
NEEDS_REVIEW. It also flags a diff that looks like a truncated file.
Sometimes a Helm chart (a packaged application) renders the live object behind the file.
Editing the rendered output would fight the chart forever, so the assistant
escalates the proposal. It points to the HelmRelease values as the
right place for the fix.
07 · Bundle what belongs together
One MR per concern, not one per line.
The assistant merges two additive findings on the same file into one diff.
The same additive change across many files (standard labels, say)
becomes one MR that lists every file, instead of twenty.
The assistant never bundles functional changes, such as upgrades or API-version migrations,
across environments. So you can still merge dev, staging and production
one at a time. Rule-based patches and AI model
suggestions stay in separate MRs.
08 · The proposal
A small, additive diff with the evidence attached.
For orders-api that means one draft MR. It sets resource
requests sized from observed usage. It also adds a hardened security context.
Both changes go into one file's diff. The full MR is below.