/cub-scout:pilot-patch-and-driftfrom cub-scout
Classifies drift between intended and live state, then decides revert/quarantine/accept-as-canonical/ASK-human using cub-scout attribution evidence (cause, managerHint, gitSource, bindingSource).
Ships in cub-scout. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The drift-classification scenario from Pilot's side. A field has diverged from its intended value; Pilot needs to decide what to do — revert, quarantine, accept-as-canonical, or ASK a human. The decision depends on who changed the field and what kind of change it was, which is exactly what cub-scout's attribution layer (#435) produces.
cub-scout's attribution surface is deterministic: every compareFieldMismatch carries cause (controller-drift / manual-edit / unknown) + managerHint (the verified manager-string from managedFields) + gitSource (where the intended value came from) + bindingSource (which ConfigHub Link supplied it, when connected). Pilot reads that triple and picks an action.
Explicit phrasings:
Implicit intents:
pilot-cd-gatepilot-watch-alert-responsepilot-fleet-conformancepilot-incident-evidenceinvestigate-driftscout-attribute (the underlying capability) or scout-comparecub / Argo / Flux / kubectl. alert: drift detected on deploy/payments-api spec.replicas
│
▼
Pilot (acceptance judge)
│ "classify this drift, decide an action"
│
├──► cub-scout compare three-way deploy/payments-api -n prod
│ --format json
│ │
│ │ per-field fieldMismatches[] with:
│ │ cause (controller-drift / manual-edit / unknown)
│ │ managerHint (verified manager string)
│ │ gitSource (repoUrl / revision / path / file / line)
│ │ bindingSource (upstream unit + binding path + link, connected)
│ │ compareThreeWay (DRY/WET/LIVE values per field)
│ ▼
│
├──► (optional) cub-scout history deploy/payments-api -n prod
│ # ConfigHub ChangeSet timeline for the past 24h
│
├──► (optional) cub-scout explain deploy/payments-api -n prod --presentation ai
│ # narrative ownership + lineage (AI-shaped output)
│
└──► (optional, for audit) cub-scout receipt verify deploy/payments-api -n prod
--predicate no-manual-edits-since --since <timestamp> --save
│
▼
Pilot's drift verdict, by field:
│
│ cause: controller-drift → ACCEPT (controller is reconciling; transient)
│ cause: manual-edit + Argo-owned → INVESTIGATE → likely REVERT or QUARANTINE
│ cause: manual-edit + Flux-owned → same
│ cause: manual-edit + unmanaged → ACCEPT-AS-CANONICAL or QUARANTINE
│ cause: unknown → ASK (managedFields incomplete)
│
▼
downstream consumer reads the action
│ ACCEPT → no-op
│ REVERT → route to Pilot's REVERT path (controller sync or
│ intent re-apply; mutation lives outside cub-scout)
│ QUARANTINE → tag the resource, alert the owner
│ ACCEPT-AS-CANONICAL → route to Pilot's intent-update path (Git PR / ConfigHub
│ unit update; mutation lives outside cub-scout)
│ ASK → page a human
└────────────────────────────────────────────────────
cause values + owner contextcub-scout's attribution layer produces one of three cause values per field (per pkg/agent/field_ownership.go:10-30): controller-drift, manual-edit, unknown. Pilot's policy decision is shaped by the (cause, owner, managerHint) triple — so the same cause can map to different actions depending on whether the resource has a controller owner and whether the writer's manager string is in the verified enumeration:
cause | Owner / manager context | Typical Pilot action |
|---|---|---|
controller-drift | Detected owner's controller wrote the field; managerHint is in the verified enumeration. The drift is the controller doing its job (HPA scaled replicas, etc.). | ACCEPT — no action; the controller is reconciling. |
manual-edit | Argo / Flux / ConfigHub / Sveltos / Modelplane / kro / Crossplane owner; kubectl-* writer touched the field. The controller will fight the manual edit on next sync. | INVESTIGATE — read the gitSource / bindingSource; usually REVERT (let the controller win) or QUARANTINE if the manual edit was an emergency fix. |
manual-edit | No controller owner (unmanaged resource); kubectl-* writer. There's no controller to fight back. | ACCEPT-AS-CANONICAL (update intent to match) or QUARANTINE if the resource shouldn't be unmanaged. |
controller-drift | A controller wrote it, but the managerHint is not in the verified enumeration, OR it's from a different controller than the detected owner (e.g., Argo wrote on a Flux-owned resource). | ASK — possible controller-on-controller conflict; cub-scout doesn't guess which is canonical. |
unknown | managedFields is missing (older K8s, stripped) or the field-path resolution failed. | ASK — Pilot doesn't have enough evidence. |
The five rows above are Pilot policy cases, not five distinct cause values from cub-scout. cub-scout's cause is the three-valued enum; the owner / manager / verified-or-not context disambiguates within the manual-edit and controller-drift cases. See verified-manager-strings for the canonical enumeration.
The verified manager-string enumeration (verified-manager-strings) covers Argo CD, Flux (kustomize/helm/source controllers), Helm direct, Crossplane (composite/composed/claim/MRD/refs), kro (applyset/parent/labeller), Sveltos (application/apply-patch), Modelplane via Crossplane composition managers, and kubectl-*. Strings not in the enumeration return unknown rather than misclassifying — same parse, don't guess rule used by ownership detection.
$ cub-scout compare three-way deploy/payments-api -n prod --format json
The output's fieldMismatches[] is per-field. Each entry has:
{
"path": "spec.template.spec.containers[0].image",
"compareThreeWay": {
"dry": "ghcr.io/org/payments-api:v1.4.2",
"wet": "ghcr.io/org/payments-api:v1.4.2",
"live": "ghcr.io/org/payments-api:v1.4.3-hotfix"
},
"cause": "manual-edit",
"managerHint": "kubectl-edit",
"gitSource": {
"repoUrl": "https://github.com/org/payments",
"revision": "abc123",
"path": "apps/prod/payments-api/deployment.yaml",
"file": "apps/prod/payments-api/deployment.yaml",
"line": 42
},
"bindingSource": null
}
This is the canonical evidence shape Pilot reads. The triple (cause, managerHint, gitSource) carries the deterministic classification; the four values (dry, wet, live, plus the resolved gitSource) carry the divergence shape.
When connected, the same output includes a bindingSource per field that the field came from an upstream ConfigHub Link:
{
"bindingSource": {
"unit": "payments-base",
"path": ".spec.image",
"link": "lnk-2024-prod-image-bump"
}
}
Reading: the live image field was supposed to come from upstream unit payments-base via Link lnk-2024-prod-image-bump. Pilot can:
cub unit get payments-base to see the canonical valuecub link list payments-api to see all incoming bindingsWhen standalone or the resource isn't ConfigHub-linked, bindingSource: null and Pilot drops back to the cause + managerHint evidence.
$ cub-scout history deploy/payments-api -n prod --since 24h --format json
The history surface produces the ConfigHub ChangeSet timeline (connected only). Useful when:
Pilot's verdict per field is the action from the table above. For the worked-example field (manual-edit on an Argo-owned image field):
{
"resource": "Deployment/payments-api in prod",
"field": "spec.template.spec.containers[0].image",
"cause": "manual-edit",
"managerHint": "kubectl-edit",
"owner": "argo",
"action": "INVESTIGATE",
"recommendation": "Likely emergency hotfix — verify with on-call before reverting. If intentional, update intent (Git PR to apps/prod/payments-api/deployment.yaml line 42); if not, let Argo sync revert it.",
"evidence_path": null
}
If the verdict needs an audit trail (e.g., for compliance review later):
# Predicate "no-manual-edits-since": BLOCK if any kubectl-* writer touched the resource
# after the cutoff. The cutoff is typically the last known intentional change.
$ cub-scout receipt verify deploy/payments-api -n prod \
--predicate no-manual-edits-since \
--since 2026-05-22T00:00:00Z \
--save \
--out drift.receipt.json
The receipt records what cub-scout observed at this moment + the verdict (BLOCK if a kubectl-* writer touched it after the cutoff). Pilot attaches drift.receipt.json to the drift ticket.
Pilot's mutation choices, by action (mutation implementation lives outside cub-scout — concrete CLI surfaces are intentionally abstracted here):
| Action | Pilot's mutation path |
|---|---|
| ACCEPT | none (no-op) |
| REVERT | Pilot's REVERT path — controller sync or intent re-apply, depending on which controller owns the resource. Implementation lives in Pilot / cub / Argo / Flux; this skill does not name a specific CLI. |
| QUARANTINE | Label/annotate the resource (out-of-scope for cub-scout); page the owner. |
| ACCEPT-AS-CANONICAL | Pilot's intent-update path — typically a Git PR amending intent, or a ConfigHub unit update. Implementation lives outside cub-scout. |
| ASK | Escalate to the on-call human. |
cub-scout participates only in evidence. The mutation paths above are all out-of-scope for this skill, and their concrete CLI surfaces (controller sync verbs, ConfigHub unit update verbs) are deliberately not enumerated here to keep cub-scout's read-only boundary loud.
A drift alert fires on deploy/payments-api in prod — spec.template.spec.containers[0].image has diverged.
$ cub-scout compare three-way deploy/payments-api -n prod --format json \
| jq '.fieldMismatches[] | select(.path | contains("image"))'
{
"path": "spec.template.spec.containers[0].image",
"compareThreeWay": {
"dry": "ghcr.io/org/payments-api:v1.4.2",
"wet": "ghcr.io/org/payments-api:v1.4.2",
"live": "ghcr.io/org/payments-api:v1.4.3-hotfix"
},
"cause": "manual-edit",
"managerHint": "kubectl-edit",
"gitSource": {
"repoUrl": "https://github.com/org/payments",
"revision": "abc123",
"path": "apps/prod/payments-api/deployment.yaml",
"file": "apps/prod/payments-api/deployment.yaml",
"line": 42
},
"bindingSource": null
}
Pilot's reading:
v1.4.2) but LIVE=v1.4.3-hotfix — manual-editcause: manual-edit + managerHint: kubectl-edit confirms a human ran kubectl edit or kubectl set imagecub-scout explain): Argo CD application payments-apigitSource.file:line points at the canonical declarationPilot's verdict:
-hotfix is a strong hint). Verify with on-call:
apps/prod/payments-api/deployment.yaml:42 to v1.4.3-hotfix and merge; Argo will sync.Pilot's downstream system records the verdict + the cub-scout evidence ID + a link to the on-call ticket.
kubectl apply --client-side write the same manager string — the classifier reads pkg/agent/ownership.go first; Argo-owned resources resolve as controller-drift, non-Argo as manual-edit. (See verified-manager-strings for the full enumeration.)apiextensions.crossplane.io/composed-<hash> varies per XR. The classifier matches by prefix, not exact string.FieldsV1 is missing (older K8s, stripped), classification is resource-level. When present, per-field. List-key fields (e.g., spec.template.spec.containers[name="api"].image) currently fall back to resource-level pending list-key selector support — pilot-patch-and-drift should treat resource-level cause as authoritative for those fields.gitSource.file:line is opt-in via --source-path <local-checkout> — the resource-level gitSource (repoUrl/revision/path) is automatic; raw-YAML back-resolution to file:line requires the CI pipeline (or Pilot's runtime) to have a local checkout available. Helm/Kustomize templating explicitly deferred.explain, trace, history; receipt verify / show / validate / list. All read-only.kubectl get/describe, kubectl get --show-managed-fields (Pilot may want to inspect the raw managedFields to verify cub-scout's classification). NOT kubectl apply / edit / patch / delete.cub <entity> get / list for the entities named in allowed-tools. NOT cub * create / update / delete.argocd app get, flux get. NOT argocd app sync, flux reconcile (those are Pilot's REVERT path, not cub-scout's).cub / Argo / Flux.scout-attribute — the underlying attribution capability (cub-scout side)scout-compare — the Compare verbs that surface attributionscout-verify — receipt persistenceinvestigate-drift — operator-driven counterpart (same evidence, different framing)pilot-cd-gate — pre-deploy companionpilot-watch-alert-response — real-time companionpilot-incident-evidence — postmortem companionverified-manager-strings — the canonical manager-string listkubernetes-managedfields — managedFields mechanics#435 (parent), #437 (A1+A1.5+A2 classifier + manager strings + git anchor), #438 (C1 incoming binding), #439 (C2 per-field binding source), #440 (B raw-YAML file:line)cause classification requires managedFields present on the resource (K8s ≥ 1.18 default; some controllers strip it). When missing, classification degrades to resource-level.pkg/agent/manager_strings.go (a cub-scout core change, not a Pilot-side patch).bindingSource requires connected mode AND the resource being ConfigHub-linked via cub link create. Without that, bindingSource: null and Pilot drops to cause + managerHint alone.gitSource.file:line requires --source-path <local-checkout> to be passed AND the source to be raw YAML (not Helm/Kustomize templated). Templated sources only get the resource-level repoUrl/revision/path anchor.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
Generated from the plugin's indexed repository (confighub/cub-scout) — no native marketplace selected
npx claudepluginhub p/confighub-cub-scout35 skills in this plugin
/ai-agent-readonly-contextUse when the user is WIRING CUB-SCOUT INTO AN AI AGENT (Claude / Codex / a custom LLM workflow) and needs the patterns for read-only context, MCP gateway tools, deterministic context snapshots, and the prompt-shape that makes cub-scout's output reliable for LLMs. Natural phrasing: "set up cub-scout as a Claude tool", "expose cub-scout to my agent over MCP", "give the LLM a deterministic snapshot of this cluster", "what cub-scout patterns work well for AI agents?", "MCP config for cub-scout in Claude Code", "best practices for wiring cub-scout into Codex / Cursor / Continue", "AI-ready cluster context", "prompt template for cub-scout output". Composes `mcp serve` + `context-pack` + `--presentation ai` + the structured JSON contracts. Do NOT load for: a specific verb invocation (load the corresponding scout-* skill), authoring an MCP server in general (this is about wiring CUB-SCOUT specifically), or any mutating workflow (cub-scout never mutates; the read-only triad is the whole point of this skill)./audit-fleet-conformanceUse when the user wants to verify CONFORMANCE ACROSS A FLEET — multiple namespaces, multiple clusters, or a defined View scope. Natural phrasing: "which clusters are conformant?", "audit fleet conformance against this View", "show me all outliers in prod fleet", "compare every service against its source-truth strategy", "scope-wide three-way check for drift", "fleet-level compliance audit", "which deployments drift across the cluster?". Composes `compare three-way --view` + `compare source-truth` + `fleet outliers` for multi-resource / multi-cluster checks. Requires connected mode for the View + ConfigHub surfaces. Do NOT load for: a single resource (use investigate-drift), a triage (use triage-unhealthy-workload), incident evidence for one event (use operator-incident-evidence), or anything mutating./confighub-source-truthUse when the user wants a STRATEGY-TYPED, PILOT-ACCEPTANCE-SHAPED VERDICT about whether ConfigHub / controller / runtime agree under a declared delivery strategy — the `compare source-truth` workflow with the explicit `--strategy <name>` requirement. Natural phrasing: "give me a source-truth verdict for deploy/api", "verify under git-argo strategy that ConfigHub matches the cluster", "run the source-truth contract for upstream Pilot acceptance", "compare source-truth confighub-oci-flux strategy across the namespace", "produce strategy-relative correctness evidence", "show me where the strategy declaration is being violated". Composes `compare source-truth --strategy <s>` + the source-truth evidence contract + (optionally) `receipt verify --strategy <s>` for a fingerprinted version. Requires CONNECTED MODE. Do NOT load for: a single-resource live drift question without a declared strategy (use investigate-drift), a triage (use triage-unhealthy-workload), or a fleet-wide audit that doesn't need strategy framing (use audit-fleet-conformance). cub-scout NEVER infers a strategy — this skill enforces that boundary./cub-scoutUse when working in the cub-scout repo or when answering capability-assistant questions ("can cub-scout do X?", "should I use cub-scout or kubectl here?", "how does cub-scout differ from cub?"). This is the umbrella router — it points you at the verb-grouped scenario skills under `skills/scout-*/` and the workflow / observer / reference skills planned for batches 2–5. For a specific verb-group task (observe / diagnose / compare / attribute / adopt existing config / govern / integrate / verify) load the corresponding `scout-*` skill directly./investigate-driftUse when the user wants to compare live and desired state and inspect available manager and source evidence. Natural phrasing: "why is this Deployment different from the git manifest?", "which recognized manager is recorded for this path?", "controller-drift or interactive-manager evidence?", "compare three-way + attribution for deploy/api". Composes `compare three-way` + `compare drift` + the attribution layer (`cause` / `managerHint` / `gitSource` / `bindingSource`). Do NOT promise who changed the value or which manager wrote last: path-level manager evidence is not time-ordered, and resource-level `explain` evidence is not field-specific. Do NOT load for: a triage where the workload won't start (use triage-unhealthy-workload), pure inventory (use scout-observe), generating a fingerprinted evidence artifact (use scout-verify and the no-manual-edits-since predicate), or any mutating fix (cub-scout never mutates)./migrate-from-kubectlUse when the user is MIGRATING from ad-hoc `kubectl apply` toward GitOps (Argo / Flux / ConfigHub) — and needs to find the manual edits, decide what to do with each (revert / port to git / accept as canonical), and plan the transition. Natural phrasing: "find all the manual edits in this cluster", "we have years of kubectl-apply, help us move to GitOps", "which resources have been hand-edited?", "audit drift caused by humans not controllers", "port my cluster state to git", "show me everything kubectl-* has touched". Composes attribution layer (`cause: manual-edit`) + `map orphans` (resources without a controller owner) + `scan` (risk classification) + `snapshot` / `import --git-path` preview once a repo skeleton exists. Read-only throughout — the migration itself is user-driven. Do NOT load for: real-time triage (use triage-unhealthy-workload), single-resource drift question (use investigate-drift), a fleet conformance audit (use audit-fleet-conformance), or any mutating action.Other plugins' skills for the same job