investigate-drift
Use 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).
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 14
- Forks
- 1
01 前言 Front Matter
- name
- investigate-drift
- phase
- cross-cutting
- description
- Use 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).
- allowed-tools
- Bash(./cub-scout compare three-way *) Bash(cub-scout compare three-way *) Bash(cub scout compare three-way *) Bash(./cub-scout compare drift *) Bash(cub-scout compare drift *) Bash(cub scout compare drift *) Bash(./cub-scout compare source-truth *) Bash(cub-scout compare source-truth *) Bash(cub scout compare source-truth *) Bash(./cub-scout explain *) Bash(cub-scout explain *) Bash(cub scout explain *) Bash(./cub-scout trace *) Bash(cub-scout trace *) Bash(cub scout trace *) Bash(kubectl get *) Bash(kubectl describe *) Bash(kubectl get --show-managed-fields *) Bash(cub space list *) Bash(cub unit get *) Bash(cub unit list *) Bash(cub link get *) Bash(cub link list *) Bash(cub view get *) Bash(cub view list *) Bash(cub unit-event list *) Bash(cub resource list *) Bash(cub release list *) Bash(cub changeset list *) Bash(argocd app get *) Bash(flux get *)
03 SKILL.md 正文
investigate-drift
The drift-investigation loop. Live state does not match desired state, so compare the values and inspect available provenance. Composes compare three-way (DRY/WET/LIVE) + compare drift (file/bundle vs cluster) + attribution (cause / managerHint / gitSource / bindingSource). Manager evidence classifies recognized managers; it does not establish write order or human identity.
When to use
Explicit phrasings:
- "Why is deploy/api different from the git manifest?"
- "Is a recognized interactive manager recorded for this path?"
- "Which recognized controller or interactive manager is recorded?"
- "controller-drift or manual-edit?"
- "Find the field that diverged and show its available manager evidence"
- "Compare three-way + attribution for deploy/api in prod"
- "The cluster says replicas=1, ConfigHub says 3 — what happened?"
Implicit intents:
- The user knows there's a divergence; they need the per-field detail
- The user wants the cause classified, not just the diff
- The user is planning a response (revert to controller / port edit to git / accept manual change)
- The user may need to attach the result to a release-gate decision
Do not load for
- A pager-pressed triage where the workload is broken —
triage-unhealthy-workload - Pure inventory ("what's running") —
scout-observe - Generating a fingerprinted evidence receipt —
scout-verify, specifically theno-manual-edits-sincepredicate - Audit-fleet-wide conformance ("which clusters are outliers?") —
audit-fleet-conformance - Any mutating fix — cub-scout never applies. Route to
kubectl rollout undo,cubfor ConfigHub updates, or a git commit.
The loop
- Detect the diff with
compare three-way(connected) orcompare drift --file <yaml>(standalone). - Inspect manager evidence on each
compareFieldMismatch. Path-specific classifications require decodableFieldsV1and a mapped canonical path; otherwise the result can be a resource-level fallback, which must not be attributed to that field:cause:controller-drift/manual-edit/unknownmanagerHint: a representative recognized K8smanagedFieldsmanager string for the path classification or fallbackgitSource: where the desired value comes from (repo / revision / path / file:line if stage B back-resolution is wired)bindingSource(connected): which ConfigHub Link supplied this field
- Interpret the manager string conservatively using
references/verified-manager-strings.md:argocd-controller/kustomize-controller/helm-controller→ recognized controller-manager evidence; this does not show reconciliation is happening nowkubectl-edit/kubectl-patch/kubectl-apply→ recognized interactive-manager evidence; it does not identify the person or prove write orderkubectl-client-side-apply+ Argo owner → Argo CSA migration co-signal; manager strings alone do not identify a human
- Decide the response based on cause + the operator's policy. cub-scout doesn't pick; the user does.
Step-by-step
Step 1 — detect the diff
Connected mode (preferred): DRY (ConfigHub intent) vs WET (rendered) vs LIVE (cluster).
$ cub-scout compare three-way deploy/api -n prod --format json
{
"agreement": "diverged",
"summary": { "agreed": 5, "diverged": 2 },
"fieldMismatches": [
{
"path": ".spec.replicas",
"dry": 3, "wet": 3, "live": 1,
"attribution": {
"cause": "manual-edit",
"managerHint": "kubectl-edit",
"gitSource": { "repoUrl": "https://github.com/org/platform-config", "revision": "abc123", "path": "apps/prod/api" }
}
}
]
}
Standalone mode: compare drift --file desired.yaml -n prod for a file-vs-live diff. Or compare three-way --source-path <local-git-checkout> for stage B back-resolution (file:line per field).
Step 2 — read the attribution
Each compareFieldMismatch.attribution block carries the per-field provenance. The fields:
| Field | Meaning |
|---|---|
cause |
One of controller-drift / manual-edit / unknown (verified manager-string enumeration in pkg/agent/manager_strings.go) |
managerHint |
A representative recognized manager string; not proof of the latest writer or a person |
gitSource.{repoUrl, revision, path} |
Resource-level git anchor from the Argo / Flux tracer (A2) |
gitSource.{file, line} |
Stage B back-resolution (--source-path <local-checkout>) — the exact YAML file:line where the field was set |
bindingSource (connected) |
{unit, path, link} — which ConfigHub Link supplies this field's value (C2) |
The cause classifies recognized manager evidence. managerHint is a manager string, not a person or timestamped writer identity. The git/binding sources point to desired-state provenance.
Step 3 — interpret manager evidence
Read the manager-string enumeration in references/verified-manager-strings.md. These are manager classifications, not proof of a current reconciliation or human action:
| Writer | Owner context | Meaning |
|---|---|---|
argocd-controller |
Argo-owned | Recognized Argo controller-manager evidence. controller-drift; recency is not established. |
kubectl-client-side-apply |
Argo-owned | Argo CSA migration co-signal. controller-drift; does not establish recency. |
kubectl-client-side-apply |
Native (no Argo signal) | Classified as interactive-manager evidence. manual-edit; the human identity is unknown. |
kustomize-controller / helm-controller |
Flux-owned | Recognized Flux controller-manager evidence. controller-drift; recency is not established. |
kubectl-edit / kubectl-patch |
Any | Recognized interactive-manager evidence. manual-edit; person and write order are unknown. |
apiextensions.crossplane.io/composed-<hash> |
Crossplane-owned | Recognized Crossplane composed-resource manager evidence. controller-drift; recency is not established. |
helm (bare) |
Helm-direct | Helm manager evidence. controller-drift for OwnerHelm; it does not establish a person or write order. |
| Unrecognized | Any | cause=unknown. cub-scout parses; it does not guess. |
The owner co-signal is essential for the kubectl-client-side-apply disambiguation. See observe-argocd for the full rule.
Step 4 — decide the response
cub-scout produces the evidence; the operator picks the action.
| Cause | Common operator response (mutations are user-driven) |
|---|---|
controller-drift + independently observed recent sync |
Compare live values again and inspect controller health; manager evidence alone does not show it is reconciling or that the diff is transient. |
controller-drift + persistent |
Investigate controller status (Argo OutOfSync, Flux False, kstatus failure); do not infer a broken reconciler from manager evidence alone. |
manual-edit + change should be kept |
Verify the live value and desired source, then port an approved change back to git. |
manual-edit + change should be reverted |
Verify policy and live value, then have the operator restore desired state; do not assume which value is newest. |
manual-edit + change should be accepted as canonical |
Verify and review the live value, then update the source of truth through the operator's normal process. |
unknown |
Cannot classify. Missing, incomplete, unmapped, or unrecognized evidence can all yield unknown; investigate the available metadata without guessing. |
Worked example
Production deploy/api has 1 replica; ConfigHub says 3. Argo CD is in Synced state. The operator's question: "did Argo do this, or did someone?"
$ cub-scout compare three-way deploy/api -n prod
Three-way compare for Deployment/api in prod
Agreement: DIVERGED — 2 of 7 fields disagree
Field mismatches:
.spec.replicas
DRY (ConfigHub unit payments-api rev=42): 3
WET (rendered): 3
LIVE (cluster): 1
Cause: manual-edit (manager: kubectl-edit)
Git source: https://github.com/org/platform-config @abc123 path=apps/prod/api
.spec.template.spec.containers[0].resources.requests.cpu
DRY: 500m
WET: 500m
LIVE: 250m
Cause: manual-edit (manager: kubectl-patch)
Git source: (same)
Reading: If these are path-specific classifications, each path has recognized interactive-manager evidence; controller-manager evidence may also be present. The strings do not prove separate commands, identify a person, or establish that Argo's last sync predates these values. Check the actual live and desired values and the controller status independently.
Response options:
- If the live values should return to desired state, have the operator restore them through the approved workflow and verify reconciliation.
- If the live values should become canonical, have the operator review and update the source of truth through the normal workflow.
- Manager evidence alone does not establish that somebody bypassed GitOps. For time-bounded history, use a suitable audit source or the receipt predicate with its documented timestamp evidence.
cub-scout produced the evidence in one command. The decision is the operator's.
Connected-mode enrichment
With cub auth login, compare three-way adds:
- DRY column — the ConfigHub Unit's intent (the canonical "what we asked for")
bindingSourceper field — which ConfigHub Link supplies this value (e.g.,link:env-shared.replicas). Per-field provenance into the unit graph.confighubUrl— deep-link to the unit's revision in the ConfigHub GUIincomingBindings[]on the unit — which upstream units feed this unit
Standalone mode loses the DRY column and bindingSource; what remains is the WET (file) vs LIVE (cluster) diff. A path-specific manager classification is available only when decodable FieldsV1 maps the mismatch; otherwise output may be resource-level or unknown. It still does not establish write order or a person.
Tool boundary
- Allowed: the four Compare verbs;
explain,trace;kubectl get/describe/get --show-managed-fields;cub <entity> get / listfor the entities named in allowed-tools (connected);argocd app get,flux get(controller-side reads) - Not allowed:
kubectl rollout undo,kubectl edit,kubectl patch,argocd app sync,flux reconcile,cub * update/create/delete. The investigation produces evidence; the response is the operator's. cub-scout'scompare three-way --fail-onand--suggestflags work for CI gating but do not write.
References
scout-compare— the verb group this skill composesscout-attribute— the attribution-layer evidence surfacereferences/kubernetes-managedfields.md— the data substratereferences/verified-manager-strings.md— the writer enumerationobserve-argocd,observe-flux— owner co-signals for disambiguationscout-verify— theno-manual-edits-sincepredicate captures the same evidence as a fingerprinted receipt- Attribution layer issues:
#435(parent),#437(A1+A1.5+A2),#438(C1),#439(C2),#440(stage B) - Example:
examples/drift/mutation-cause-attribution/
Constraints
- This skill is investigation, not remediation. cub-scout categorically never applies a fix. Every revert / port / accept is the operator running another tool.
cause=unknownis honest when manager evidence is missing, incomplete, unmapped, or unrecognized. Don't pressure-classify it.controller-driftandmanual-editdescribe recognized manager presence in the resource or mapped path. The classifier does not use manager timestamps to order writers or prove a person acted; inspect audit logs for identity/history.- Stage B file:line back-resolution requires
--source-path <local-git-checkout>and only covers raw YAML (no Helm / Kustomize templating yet — see #435 follow-ons).
04 同仓库更多 Skills
triage-unhealthy-workload
Use when the user is responding to a broken Kubernetes workload UNDER TIME PRESSURE — pager-going-off, CI-red, "prod is down" framing. Natural phrasing: "deploy/api is CrashLoopBackOff, what now?", "the rollout is stuck, help", "this pod won't start", "pager fired on payments", "everything is red in argocd", "what should I check first?", "give me a triage plan for this workload". Composes doctor → explain → trace into a tight ~30-second loop the operator can run in a pager-acknowledged context. Do NOT load for: a planned investigation without urgency (use scout-diagnose directly), a drift question (use investigate-drift), or anything mutating (cub-scout never mutates — route to kubectl with the user driving).
scout-verify
Use when the user wants a TYPED, FINGERPRINTED, IMMUTABLE evidence artifact about a Kubernetes resource — the Verify verb group of cub-scout (the receipt capability shipped in #446). Natural phrasing: "produce a receipt that this is in compliance", "give me an attestation that the cluster matches Git", "I need a verifiable record for the audit trail", "build a receipt verifying no manual edits since deploy", "verify deploy/api against source-truth and save the artifact", "validate this receipt has not been tampered with", "show me what receipts we have", "is this receipt tampered with?", "attach evidence to my CI gate". Load whenever intent is receipt / attestation / evidence-artifact / tamper-evident-record / verified-record / audit-trail / postmortem-evidence / acceptance-judge-input. Do NOT load for: a live comparison without a persisted artifact (use scout-compare), interpreting a single field's provenance (use scout-attribute), or actually applying a fix (cub-scout never mutates — route to cub / argocd / kubectl with the user driving).
scout-observe
Use when the user wants to SEE what is running in a Kubernetes cluster, who owns it, and how it is structured — the read-only Observe verb group of cub-scout. Natural phrasing: "what is running in my cluster?", "give me a map of resources", "who owns this Deployment?", "trace this back to its source", "show me the ownership tree", "scan this cluster for risk", "dump the cluster as JSON", "stream cluster events", "run cub-scout as a bot", "what is the connection status?", "is this cluster healthy?". Load when intent is observe / inventory / map / show / list / trace / scan / dump / stream / bot / health-check over a Kubernetes cluster. Do NOT load for: explaining WHY something is broken (use scout-diagnose), comparing cluster state to intended state (use scout-compare), provenance of individual field values (use scout-attribute), or any action that mutates the cluster (cub-scout never mutates — route to cub or kubectl with the user driving).
scout-mcp
Use when the user wants to expose cub-scout to an AI agent over MCP, wants a deterministic AI-ready snapshot of cluster context, or wants cub-scout running as a read-only event bot — the Integrate verb group. Natural phrasing: "start the MCP server", "expose cub-scout to Claude / Codex / my agent", "give me an AI-ready context pack of this cluster", "set up the MCP gateway", "what MCP tools does cub-scout expose?", "run cub-scout as a bot", "produce JSON context for an LLM to reason about this cluster". Load whenever intent is mcp / mcp-gateway / mcp-serve / context-pack / bot / agent-context / ai-snapshot / llm-context / model-context-protocol. Do NOT load for: actually running a non-integrate verb (those are scout-observe / scout-diagnose / scout-compare / scout-attribute / scout-ingest / scout-govern / scout-verify), or `cub` MCP integration (that's a separate tool surface).
scout-ingest
Use when the user wants to ADOPT existing Kubernetes / GitOps workload structure into ConfigHub after observing the live cluster — the adoption/import verb group of cub-scout. Natural phrasing: "discover workloads in this cluster and propose ConfigHub units", "show me the import proposal before I apply", "import this Argo Application set", "bring my Flux Kustomizations into ConfigHub", "preview what would land in ConfigHub if I imported this repo", "parse my git repo as a ConfigHub import bundle", "import a cluster aggregator", "what would --git-path produce for this repo?". Load whenever intent is adopt / import / ingest / preview / propose / parse-repo / discovery / aggregator / bring-into-confighub / what-would-confighub-see. Do NOT load for: questions about who changed a resource, whether it was edited by hand or drifted (use scout-attribute or investigate-drift); reading an exported `kubectl get -o yaml` dump to answer a question about the cluster (that is not an import); basic live-cluster inventory (use scout-observe), troubleshooting (use scout-diagnose), comparing live state to ConfigHub (use scout-compare), or the actual write to ConfigHub via `cub variant upload` (that is `cub`, not cub-scout — route to cub skills). Important: `cub-scout import apply` IS the mutating write into ConfigHub — this skill teaches the read-only preview path and explicitly refuses to invoke `import apply` itself.
scout-govern
Use when the user wants to consume CONNECTED ConfigHub governance signals from cub-scout — the Govern verb group. Natural phrasing: "show me the ChangeSet history for this unit", "what is the blast radius if I change this unit?", "which clusters in my fleet are outliers?", "show me yesterday's connected summary", "render this view across the fleet", "audit who changed this", "where did the last apply come from?", "list ConfigHub bundles I have", "show me the catalog of past snapshots". Load whenever intent is history / impact / blast-radius / fleet-outliers / summary / view / audit / bundle / catalog / connected-context. Do NOT load for: live cluster comparison (use scout-compare), receipts (use scout-verify), inventory of running pods (use scout-observe), or any mutation via cub. Most of this skill requires `cub auth login` — say so upfront.