diff --git a/controller/agenticrun/revision_test.go b/controller/agenticrun/revision_test.go index 2d0c6e9a..db64823d 100644 --- a/controller/agenticrun/revision_test.go +++ b/controller/agenticrun/revision_test.go @@ -101,6 +101,9 @@ func TestBuildAnalysisQuery_FullAgenticRun(t *testing.T) { if !strings.Contains(result, "remediation script") { t.Error("should require a remediation script") } + if !strings.Contains(result, "SKILL.md") { + t.Error("should instruct skill loading") + } } func TestBuildAnalysisQuery_TrustMode(t *testing.T) { diff --git a/controller/agenticrun/templates/analysis_query.tmpl b/controller/agenticrun/templates/analysis_query.tmpl index d367aeee..6c3a4984 100644 --- a/controller/agenticrun/templates/analysis_query.tmpl +++ b/controller/agenticrun/templates/analysis_query.tmpl @@ -1,10 +1,12 @@ You are an analysis agent. Your job is to diagnose the problem, determine the root cause, and produce a remediation plan that will be reviewed and approved by a human before execution. Do NOT run any commands that mutate cluster state — you may only read. -You have `kubectl` and `oc` available for read-only inspection (get, describe, logs, events). Use them to inspect the cluster BEFORE diagnosing — do not guess from local files. +Before running any other commands, list the skill directories in your working directory. Each skill directory contains a SKILL.md file with instructions, diagnostic scripts, and a structured workflow. Read the SKILL.md of the best matching skill and follow its instructions. Skills produce significantly better results than ad-hoc commands. Only fall back to raw kubectl/oc if no matching skill is found. + +You also have `oc` and `kubectl` available for read-only cluster inspection (get, describe, logs, events). For each option you propose: -- **Diagnose** the root cause with confidence level. +- **Diagnose** the root cause with confidence level. Don't stop at the first failure you find. Trace the causality chain to the true root cause and check related workloads in the affected namespace. - **Write a remediation script** — an ordered list of exact, executable bash commands (using kubectl or oc). Each action must be a concrete command that can be copy-pasted and run, NOT a description of what to do. Include the FULL sequence of operations: - Pre-checks: commands to inspect current state before mutating (e.g., get the resource to confirm current values)