AGENT SKILL

Kubernetes 诊断与修复建议

scout-diagnose

当用户希望 cub-scout 解读(INTERPRET)其观察到的内容并建议下一步操作时使用该技能 —— Diagnose(诊断)动词组。自然表述:"解释一下这个 Deployment"、"为什么这个出问题了?"、"我该怎么办?"、"这是漂移还是同步慢?"、"这个错误是什么意思?"、"这有没有已知的模式?"、"我的 GitOps 流水线健康吗?"、"这个 Pod 上触发了哪些事件?"、"针对这个发现给我一个建议的修复方案"。当意图是针对 Kubernetes 集群或扫描发现进行解释 / 原因 / 含义 / 该怎么办 / 解读 / 诊断 / 推荐 / 建议修复时加载。不要用于:纯集群清单(使用 scout-observe)、逐字段比较预期状态与运行态(使用 scout-compare)、逐字段溯源(使用 scout-attribute),或实际应用修复(cub-scout 从不修改状态 —— 应转由用户驱动 cub 或 kubectl 执行)。

适用职业SRE 工程师
License 许可
MIT
最近更新
2026-11-14
Stars
★ 14
Forks
1

01 前言 Front Matter

name
scout-diagnose
phase
verify
description
Use when the user wants cub-scout to INTERPRET what it sees and suggest a next step — the Diagnose verb group. Natural phrasing: "explain this Deployment", "why is this broken?", "what should I do about this?", "is this drift or just slow sync?", "what does this error mean?", "is there a known pattern for this?", "is my GitOps pipeline healthy?", "what events are firing on this Pod?", "give me a suggested remedy for this finding". Load whenever intent is explain / why / what-does-it-mean / what-should-I-do / interpret / diagnose / recommend / suggest-fix over a Kubernetes cluster or a scan finding. Do NOT load for: pure cluster inventory (use scout-observe), comparing intended vs running state at the field level (use scout-compare), field-level provenance (use scout-attribute), or actually applying a fix (cub-scout never mutates — route to cub or kubectl with the user driving).
allowed-tools
Bash(./cub-scout explain *) Bash(cub-scout explain *) Bash(cub scout explain *) Bash(./cub-scout debug *) Bash(cub-scout debug *) Bash(cub scout debug *) Bash(./cub-scout suggest-remedy *) Bash(cub-scout suggest-remedy *) Bash(cub scout suggest-remedy *) Bash(./cub-scout patterns *) Bash(cub-scout patterns *) Bash(cub scout patterns *) Bash(./cub-scout gitops status *) Bash(cub-scout gitops status *) Bash(cub scout gitops status *) Bash(kubectl get *) Bash(kubectl describe *) Bash(kubectl logs *) Bash(kubectl get events *) Bash(argocd app get *) Bash(flux get *)

02 资源文件 2

03 SKILL.md 正文

scout-diagnose

The Diagnose verb group of cub-scout. Five commands that interpret what's in the cluster and produce next-step guidance — without applying any fix.

When to use

Explicit phrasings:

  • "Explain this Deployment" / "what does this resource mean?"
  • "Why is my Pod CrashLooping?" / "what's wrong with this StatefulSet?"
  • "What should I do about this?" / "give me a remediation"
  • "Is this drift, or just controller still syncing?"
  • "Is there a known pattern that matches this?"
  • "Is my GitOps pipeline healthy?" / "what's the state of Flux / Argo?"
  • "Show me the recent events on this resource"
  • "Suggest a remedy for this scan finding"

Implicit intents:

  • The user has already seen something (via scout-observe) and wants to know why it looks that way
  • The user wants a concrete next command to run, not just facts
  • The user wants pattern-matching against known failure modes, not just raw cluster output

Do not load for

  • Pure inventory ("show me what's running") — load scout-observe
  • Comparing intended vs running state at the field level — load scout-compare
  • Per-field provenance (which controller / which git file set this value) — load scout-attribute
  • "Apply this fix" / "edit / patch / sync" — cub-scout never mutates. suggest-remedy describes a fix; it does not execute it. Route to cub, kubectl (user driven), or another tool

Standalone vs connected

  • Standalone (cluster only): explain, debug, suggest-remedy, patterns, gitops status all work against your current kubectl context.
  • Connected (cluster + cub auth login): explain --with-confighub, trace --with-confighub, and single-resource receipt verify --with-confighub add optional object-correlated delivery evidence; doctor --with-confighub adds a scope-level delivery rollup; map activity --with-confighub adds bounded release, unit-event, live-status, and event-consumer timeline rows; three-way disagreement gets a dedicated section.
  • Offline (file / bundle only): patterns detect --file <yaml> runs the pattern engine against a manifest; suggest-remedy works against scan findings without a live cluster.

Tool boundary

  • Allowed (read-only): all five Diagnose verbs, plus kubectl get/describe/logs/get events, argocd app get, flux get. These are the read-only diagnostic surfaces the skill may invoke for context.
  • Not allowed: kubectl apply/edit/patch/delete/exec, argocd app sync/refresh (as mutation), flux reconcile (mutating), cub * create/update/delete, any --dry-run=false carve-out.
  • suggest-remedy is read-only: the original command was renamed from remedy in #428; the mutating executor was deleted. The command describes a fix that would resolve the finding — it does not run it. cub-scout no longer has a non-dry-run path.

The verb menu

Question Verb Notes
"Explain this one resource" cub-scout explain <kind>/<name> -n <ns> Plain-English ownership + lineage + health + drift + next steps. Supports --presentation human|ai|paired and --hint-mode default|beginner|operator.
"Walk me through a GitOps debug" cub-scout debug Guided wizard for the common failure modes
"Suggest a fix for this scan finding" cub-scout suggest-remedy <finding-id> Read-only — describes the patch, does not apply. Legacy remedy accepted as an alias.
"Match the cluster against known patterns" cub-scout patterns detect / patterns explain / patterns list The pattern engine. Works on cluster, file, or bundle.
"Is GitOps healthy?" cub-scout gitops status Pipeline health for Flux + Argo: stuck reconciles, source errors, applyset drift
"Did delivery feedback report back, and what happened recently?" cub-scout map activity --with-confighub --confighub-space <space> Timeline view across controller activity, Kubernetes events, ConfigHub releases, unit events, live-status freshness, event-consumer health, and omissions
"Can I preserve this delivery/status evidence?" cub-scout receipt verify <kind>/<name> -n <ns> --with-confighub --confighub-space <space> Single-resource receipt with fingerprint-covered predicate.evidence.deliveryEvidence

All five verbs emit --format json for agents.

The loop

  1. Identify intent. The user is starting from a symptom (broken resource, scan finding, slow sync) and wants an interpretation + a recommended next step.
  2. Gather context. If the user names a specific resource, lead with cub-scout explain <kind>/<name> -n <ns>. If they have a scan finding ID, lead with cub-scout suggest-remedy <id>. If they're at "something feels off across the cluster", lead with cub-scout doctor (from scout-observe) and then drill in.
  3. Read the structured hints. explain and doctor both emit nextSteps[] — each hint has an actionType (read-only / waiting / human-decision; mutating is rejected on emit) and a nextCommand. Use those hints to drive the next invocation.
  4. Pattern-match if needed. If the symptom is well-known (CrashLoop, image pull error, kustomization unhealthy), cub-scout patterns detect produces a structured match against the 46 built-in patterns.
  5. Hand off. When the diagnosis points at a change the user wants to make, refuse to act and route them: ConfigHub-authored fixes go to cub skills in confighub/confighub-skills; direct manifest fixes go to kubectl edit with the user driving; if the divergence might be drift vs reconciliation, route to scout-compare for the connected three-way view.

Worked example

User: "deploy/api in prod is CrashLooping. What's going on?"

Standalone mode (cluster only)

$ cub-scout explain deploy/api -n prod --hint-mode operator
Deployment/api in prod:
  Owner:        Argo CD (Application: payments-api, source: https://github.com/org/repo @ apps/prod/api)
  Source:       Git
  Deployed via: argocd-controller
  Health:       Degraded (1/3 replicas Ready)
  Risks:        CrashLoopBackOff on container "api" (3 restarts in last 5m)
  Drift:        Not checked (standalone mode)
  Notes:
    - Recent events: Warning BackOff (3x, 5m) kubectl: Back-off restarting failed container

Try next (read-only):
  → cub-scout patterns detect --resource Deployment/api -n prod
  → kubectl logs -n prod deploy/api --previous --tail=100

The user can follow the structured hints — both read-only — without ever needing to apply, edit, or sync.

Connected mode adds three-way disagreement detail

When cub auth login is set up, the same explain command also includes a THREE-WAY STATUS block:

THREE-WAY STATUS (connected)
  ConfigHub revision 42 → controller revision 42 → cluster revision 42 (agreed)
  Conclusion: not a drift problem. Investigate the workload itself.

This disambiguates "is this CrashLoop a workload bug, or is the controller still rolling out an old revision?" — connected mode tells you the revisions agree, so the failure is in the workload, not the GitOps loop.

For agents:

$ cub-scout explain deploy/api -n prod --format json | jq '.nextSteps[]'
{
  "actionType": "read-only",
  "reason": "CrashLoop suggests application-level failure, not drift; inspect logs",
  "nextCommand": "kubectl logs -n prod deploy/api --previous --tail=100",
  "nextSurface": "kubectl"
}

Output evidence

  • Primary artifact: structured explanation JSON or human-readable ASCII
  • nextSteps[] with actionType ∈ {read-only, waiting, human-decision}. Mutating actionType is rejected at every cub-scout emit point.
  • Three-way disagreement section (connected mode only) when ConfigHub / controller / cluster disagree

References

  • Capability map: README.md § Diagnose
  • Command details: docs/reference/commands.md
  • Phase-aware hint design: #367 (Argo phase hints), #370 (structured nextSteps)
  • Triad lock (read-only suggest-remedy): #410 / #428

Constraints

  • suggest-remedy describes; it does not apply. If a user asks to run the suggested fix, refuse and route them to the appropriate skill (cub for ConfigHub-authored changes; kubectl with the user driving for direct edits). The original remedy executor was deleted in #428.
  • Hint actionType: mutating is structurally impossible — the emitter rejects it. Any "next step" from this skill is safe to read and follow without risk of accidental mutation.
  • If the diagnosis is evidence-missing (no managedFields, no controller spec, no ConfigHub link), explain returns the evidence gap honestly rather than guessing. Don't synthesize a recommendation from absence.

04 同仓库更多 Skills

confighub
confighub/cub-scout

异常工作负载故障分诊

triage-unhealthy-workload

当用户需要在时间压力下应对出现故障的 Kubernetes 工作负载时使用——例如寻呼告警响起、CI 飘红、“生产环境挂了”的场景。自然表述包括:“deploy/api 出现 CrashLoopBackOff,该怎么办?”“发布卡住了,帮帮我”“这个 pod 起不来”“支付服务触发了寻呼告警”“argocd 里全红了”“我应该先检查什么?”“给我一份针对这个工作负载的分诊方案”。它将 doctor → explain → trace 组合成一个紧凑的约 30 秒循环,运维人员可在已确认寻呼告警的上下文中执行。不要用于:没有紧迫性的计划性排查(直接使用 scout-diagnose)、漂移相关问题(使用 investigate-drift),或任何变更操作(cub-scout 从不做变更——应由用户主导,转由 kubectl 处理)。

SRE 工程师生产事故响应与应急处置
★ 14
confighub
confighub/cub-scout

资源证据收据生成与校验

scout-verify

当用户需要针对某个 Kubernetes 资源生成带类型、带指纹、不可篡改(TYPED、FINGERPRINTED、IMMUTABLE)的证据工件时使用——即 cub-scout 的 Verify 动词组(在 #446 中发布的收据能力)。自然表述包括:“出具一份证明此资源合规的收据”“给我一份证明集群与 Git 一致的证明”“我需要一份可用于审计跟踪的可验证记录”“生成一份收据,证明自部署以来没有人工改动”“对照事实源(source-truth)校验 deploy/api 并保存工件”“验证此收据未被篡改”“展示我们有哪些收据”“此收据是否被篡改过?”“把证据附加到我的 CI 关卡”。当意图涉及 receipt / attestation / evidence-artifact / tamper-evident-record / verified-record / audit-trail / postmortem-evidence / acceptance-judge-input 时均应加载。不要用于:不落盘工件的实时比对(使用 scout-compare)、解读单个字段的来源出处(使用 scout-attribute),或真正实施修复(cub-scout 从不做变更——应由用户主导,转由 cub / argocd / kubectl 处理)。

SRE 工程师审计准备与证据管理
★ 14
confighub
confighub/cub-scout

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).

★ 14
confighub
confighub/cub-scout

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).

★ 14
confighub
confighub/cub-scout

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.

★ 14
confighub
confighub/cub-scout

ConfigHub 治理信号查询

scout-govern

当用户希望从 cub-scout 获取已连接的(CONNECTED)ConfigHub 治理信号时使用该技能 —— Govern(治理)动词组。自然表述:"给我看这个单元的 ChangeSet 历史"、"如果我修改这个单元,影响范围(blast radius)有多大?"、"我的机群中哪些集群是异常值?"、"给我看昨天的连接摘要"、"在整个机群中呈现这个视图"、"审计谁修改了这个"、"上一次应用来自哪里?"、"列出我拥有的 ConfigHub bundle"、"给我看过往快照的目录"。当意图为历史 / 影响 / 影响范围 / 机群异常 / 摘要 / 视图 / 审计 / bundle / 目录 / 连接上下文时加载。不要用于:实时集群比较(使用 scout-compare)、回执(使用 scout-verify)、正在运行的 Pod 清单(使用 scout-observe),或通过 cub 进行的任何修改。该技能的大部分功能需要 `cub auth login` —— 请提前说明。

SRE 工程师工程变更管理
★ 14