fleet-audit-reports
暂无简介
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 126
- Forks
- 44
02 资源文件 2
- 脚本scripts/report_query.py36.0 KB
- 脚本scripts/test_report_query.py56.7 KB
03 SKILL.md 正文
fleet-audit-reports — Reading What the Audits Found
Every audit run keeps what it published, on the volume, beside the agent. This skill answers
questions off those files. It never runs an audit and never publishes one — the fleet-audit skill
owns both ends of that lifecycle.
The store
/opt/data/fleet-audit/reports/<audit-id>/<owner>/<name>/, one directory per stream and GitOps
repository. A run publishes to the role: gitops repository, or to the repository a person gave
with --repo, so a stream can have more than one directory. A run with no repository to publish
to uses no_forge/local:
latest.json— the newest run's envelope.runs/<YYYYMMDDThhmmss.ffffffZ>.json— one envelope per run, newest 14 kept. The only run-over-run history that exists anywhere: the ledger issue rewrites itself in place.
An envelope carries audit_id, repo, started_at, finished_at, status, issue_number, issue_url,
partial, coverage_gaps, declared, unaccounted, unpublished_candidates,
wholly_unpublished_checks, uncorroborated_findings, prs_opened, prs_still_open, prs_closed, silent_ok,
ledger_held_open, scheduled, scheduled_coverage_gaps, scheduled_published_ids, scheduled_reported_under_gap, delta_known, new_ids, resolved_ids, current_ids, id_scheme, ledger_body,
document, and sometimes ledger_document, reported_under_gap, silent_floor, inspect_s, publish_s and collect_s.
The scheduled_* keys record the last scheduled run, not this run: an on-demand run copies them
forward.
documentis this run's whole validated findings document — un-clipped, so it holds findings the issue body had no room to print.statusisOPENED,UPDATED,CLEAN,HELD,NO_FORGE, orSTORE_LEDGER.NO_FORGEmeans the run had no repository to publish to: it wrote no ledger issue,issue_numberandissue_urlare null, and the envelope is the only record of what it found. ANO_FORGEenvelope in a repository's directory carriesunreachable_repo(repo,reason): the run could not reach that repository. One underno_forge/localcan carryno_repository_chosen(reason): several repositories are managed and none is the onerole: gitopsrepository. For both, the new and resolved counts are unknown; say so. An envelope with neither key is from an install with no forge.STORE_LEDGERmeans the repository is on a forge with no issue tracker, or no labels: the envelope is the ledger (issue_numberandissue_urlare null,ledgerisstore), and the remediation pull requests opened on the forge are inprs_opened,prs_still_openandprs_closed. Give those links where you would give the ledger link.ledger_held_opentrue means aCLEANorHELDrun left the issue open (partial, or over findings it did not account for) without rewriting it: the issue still lists the previous run's findings,currentcounts those, and this run'sfindings: 0andcritical: 0do not mean the ledger is clear.streams,showandfindingsall carry it. Held open over a lost memory, the envelope'sissue_numberis null andcurrentis 0: the store does not know what the issue lists, so read the issue.ledger_documentis that previous document, kept forfleet-audit; do not answer from it.delta_knownfalse meansfleet-auditlost its memory of the previous run and withheld the delta:new_idsandresolved_idsare empty, andnew/resolved0, because nothing was claimed, not because nothing changed. Say the delta is unknown for that run. Envelopes written before the key existed lack it; read their counts as they are.streamsandshowcarry it.silent_floortrue means an earlierfinishin the same run reported news or opened a pull request, so this run'ssilent_okwas keptfalseand its counts may be measured against thatfinish.current_idsis exactly what the body's hidden block published: the findings the body named, in full or on one line, the ids the collector held, and the ids under Not re-checked this run (previous findings on a target the run did not check). Derive this run's full set fromdocument.started_atis when the run that published this envelope started, or null whenfinishcould not read it. Envelopes written before the key existed lack it.showgives it;streamsdoes not carry it. It is notrunning_since, whichstreamstakes from the lease of a run that started and did not finish.inspect_s,publish_sandcollect_sare seconds: fromstarttofinish, forfinishto publish, and for the collector to run. An envelope has only the onesfinishcould measure.showgives them, with null for the others;streamsdoes not carry them.ledger_bodyis the issue body the run left on GitHub —fleet-audit's memory of the previous run, not something to answer from. No subcommand returns it.
Whether a run is in flight comes from the lease fleet-audit's start takes, not from a file in
this directory. streams and runs report it as liveness: never (no run stored), completed,
running, died (started over two hours ago and never finished), or error. A stream-level
problem (a sibling repository's unreadable store, a bad lease note) comes back under error with
exit 2 even when the listing is complete; report it, do not drop it.
Query it; do not read it
Never open a store file — not latest.json, not a ring entry, not with a file tool and not
with cat, head, grep or jq in the shell. Each embeds document and ledger_body, which pass
60,000 characters each on a finding-heavy stream — times every stream, times fourteen runs.
Answering "how many criticals are open?" that way spends tens of thousands of tokens on an integer.
When report_query.py says a stream has no record, that is the answer: do not search the directory
for a file it did not find.
python3 /opt/data/profiles/platform/skills/fleet-audit-reports/scripts/report_query.py <subcommand> prints one small JSON
object per call.
| Subcommand | Answers |
|---|---|
streams |
one row per stream and repository: last run, status, counts, liveness |
show <stream> |
one run's envelope without document |
findings <stream> |
finding id, severity, title, cluster, check — filterable |
finding <stream> <id> |
one finding in full; the only call that returns prose |
checks <stream> |
the command behind each check that ran, plus exclusions |
diff <stream> [--from S] [--to S] |
ids and titles added and resolved between two runs |
runs <stream> |
the stamps the ring holds, so a diff can name real ones |
- Exit 0 answered the question. Exit 2 could not, and stdout still holds one JSON object whose
errorsays why — absent or unlistable store, absent stream, absent stamp, a file that would not parse. Arguments that do not parse are the exception: argparse prints usage to stderr and stdout is empty. Every answer carries anerrorkey, null on success.streamsexits 2 when any one stream is unreadable; its other rows still stand — report them and name the unreadable ones. - Every subcommand but
streamstakes--repo, the repository as the managed list or thereposlist names it:owner/name(orgithub.com/owner/name) on github.com,<host>/owner/nameon a GitHub Enterprise Server, and<host>/<path>for a repository on another forge. Leave it off when the stream has published to one repository; when it has published to several, the answer is exit 2 with thereposto choose from — ask which, or run once per repository, never pick one silently. --runtakes a stamp fromruns, with or without the.json. Default is the newest run:latest.json, or the newest ring entry when a later run deleted it and failed.streams,show,findings,findingandchecksthen carrylatest_missing: true— say the answer is from that run and the issue may be newer.--severity,--clusterand--checkonfindings, and--clusterand--checkonchecks, are exact matches, case-insensitive.findings,checksanddiffcap at 100 rows, raisable with--limit.findingsandchecksreportmatched,returnedandtruncated, andcheckscaps its exclusions separately undernot_applicable_matched,not_applicable_returnedandnot_applicable_truncated;diffcapsaddedandresolvedindependently and reportsadded_total,resolved_total,unchangedandtruncated— quoteadded_total, not the length ofadded. Findings sort severity-first, so a cap drops only the least severe;checkskeeps the document's order, one row per cluster and check, while the issue's table groups clusters that ran the same command into one row.--rootoverrides the store root. In the pod, leave it alone.
The four questions this gets asked
"What did last night's compliance audit find?"
python3 /opt/data/profiles/platform/skills/fleet-audit-reports/scripts/report_query.py show compliance-audit
python3 /opt/data/profiles/platform/skills/fleet-audit-reports/scripts/report_query.py findings compliance-audit --severity critical
show gives, under envelope, status, findings, critical, partial, ledger_held_open, the
delta counts and issue_url; name the criticals from findings. When ledger_held_open is true,
this run found nothing but the issue still carries the previous run's findings — say both, and point
at the issue. Always hand back the issue URL — the store is where you read, the ledger is where a
human acts — except on a NO_FORGE run, which has no issue: the store is the only record. A
STORE_LEDGER run has no issue either: hand back its pull request links instead.
"What changed since the last run?"
python3 /opt/data/profiles/platform/skills/fleet-audit-reports/scripts/report_query.py diff compliance-audit
Defaults to the newest two runs and returns ids and titles under added and resolved. When
from_partial or to_partial is true, that run could not see the whole fleet: a finding under
resolved may be one it did not look at, so say "not seen", never "fixed". When to_held_open is
true, the audit itself refused to resolve them; they are still on the issue. When from_held_open
is true, the earlier run found nothing while the issue still listed older findings, so added may
be findings the ledger already carried — say "found again", not "new". For a wider span, list the
ring first and name two stamps, older as --from — a reversed pair is refused:
python3 /opt/data/profiles/platform/skills/fleet-audit-reports/scripts/report_query.py runs compliance-audit
python3 /opt/data/profiles/platform/skills/fleet-audit-reports/scripts/report_query.py diff compliance-audit --from <stamp> --to <stamp>
"Tell me about that finding."
python3 /opt/data/profiles/platform/skills/fleet-audit-reports/scripts/report_query.py finding compliance-audit <finding-id>
The evidence command and excerpt, the impact, and all three recommendation fields. This is the
expensive call: make it for the finding that was asked about, not for the list.
"The issue says findings or commands were omitted — what were they?"
python3 /opt/data/profiles/platform/skills/fleet-audit-reports/scripts/report_query.py findings obtainability-audit
python3 /opt/data/profiles/platform/skills/fleet-audit-reports/scripts/report_query.py checks obtainability-audit --cluster prod-us-east
The ledger names findings it has no room to show in full on one line each, as far as the room left
after the criticals' full blocks allows, then drops the least-severe ones and its evidence table whole, to stay inside GitHub's
body limit, and says so in a notice that points here. findings lists every finding the run
carried. checks is one row per check the run says it performed, with the command that performed
it, plus each checks_not_applicable exclusion and its reason; filter by cluster or check — a
16-cluster stream carries upwards of 150.
Fleet-wide, streams is the whole answer: one row per stream with its liveness, so "when did each
last run" and "is anything stuck" come back in one call. Coverage questions read show's
coverage_gaps; streams carries only the count.
Two things the store is not
- Not the live issue. It is the last published state. A finding a human closed by hand since
that run, or a
/remediateposted since, is not in it until the next run rewrites the store. When the question is about the issue, read the issue. - Not written for every invocation. Only a
finishthat exits 0 writes — never--dry-run, never a run that exited 2, neverremediate. The write is best-effort.finishdeleteslatest.jsonbefore it rewrites the ledger, and after the clean close lands (a close that fails leaves it, since the ledger is still the one it describes), so a run that fails partway leaves no superseded envelope reading as current; the ring stays, and answers come from it flaggedlatest_missing. When the close landed but the run failed before storing itself, the newest ring entry is anOPENEDorUPDATEDrun whose issue is now closed, and a human can close one by hand: either way it is not the open ledger. Check the issue's state, or say the findings are as of that run. No stored run means unknown, not clean — say the store has no record, and read the ledger issue if the install has a forge.
Red lines
- Never report an absent, unreadable,
neverordiedstream as a clean fleet. "I could not look" and "nothing is wrong" are different answers; passerror,livenessand anystream_errorthrough to the user. - Never read
documentorledger_bodywhole to answer a question a subcommand answers. - Never run, publish, or remediate from here. Dispatching a stream, rewriting a ledger and
opening remediation pull requests belong to
fleet-audit(Running a stream on demand). - Never act on a
runningordiedstream's lease. It isfleet-audit's; report the state. - Never quote a count the store did not give you. The counts are keys; re-deriving one by hand from prose is how a stale number reaches a user with the authority of a file read.
04 同仓库更多 Skills
gke-workload-troubleshooting
Diagnoses GKE workload failures (CrashLoopBackOff, OOMKilled, ImagePullBackOff, Pending, etc.) via logs and events. Use when pods fail to start or crash repeatedly. Don't use for GKE cluster infrastructure provisioning, node pool creation, or non-Kubernetes Google Cloud services.
gke-workload-security
Audits, configures, and hardens workload-level security controls for Google Kubernetes Engine (GKE) applications and namespaces. Covers running security audits (`audit_cluster.sh`), enforcing Network Policies (default-deny and Dataplane V2 logging), isolating high-risk pods inside GKE Sandbox (`gVisor`), enforcing Pod Security Standards (`restricted` labeling) and pod securityContext, and mounting Secret Manager secrets via CSI (`SecretProviderClass`). Use when auditing workload security posture, isolating namespaces, applying pod security standards, or configuring network policies and secret volume mounts. Don't use for Workload Identity (use gke-workload-identity), cluster-wide control plane security, RBAC hardening, Binary Authorization, Shielded Nodes, or enabling platform-level GKE add-ons (use gke-platform-security instead).
gke-workload-scaling
Manages scaling for GKE workloads using HPA and VPA. Use when configuring Horizontal Pod Autoscaler (HPA), configuring Vertical Pod Autoscaler (VPA), or applying best practices for GKE workload autoscaling. Do not use for cluster-level autoscaling (Cluster Autoscaler), static cluster sizing, or configuring node-level machine styles directly.
gke-workload-identity
Configures and diagnoses Workload Identity Federation for GKE authentication failures for Pods (403 "iam.serviceAccounts.getAccessToken" / permission denied, "could not find default credentials", or GKE metadata server unreachable) by verifying cluster and node-pool Workload Identity configuration, the Kubernetes ServiceAccount (KSA) to IAM binding (direct principal binding and legacy Google ServiceAccount impersonation), target-resource IAM roles, and gke-metadata-server health. Use when setting up KSA/GSA bindings (`roles/iam.workloadIdentityUser`, `iam.gke.io/gcp-service-account`) or when a Pod cannot authenticate to Google Cloud APIs. Don't use for in-cluster Kubernetes RBAC errors (API-server authorization), general workload crashes (use gke-workload-troubleshooting), or Pod Security Standards and NetworkPolicies (use gke-workload-security).
gke-upgrades
Plans, executes, and validates Google Kubernetes Engine (GKE) cluster upgrades and maintenance operations for both Standard and Autopilot clusters. Produces upgrade plans, pre/post-upgrade checklists, maintenance runbooks with gcloud commands, release channel strategy, and troubleshooting guides. Handles node pool upgrade strategies (surge, blue-green), version compatibility, PDB management, and workload-specific concerns (stateful, GPU, operators). Use this skill whenever the user mentions GKE upgrades, Kubernetes version bumps, node pool maintenance, GKE patching, cluster version management, release channel selection, maintenance windows, surge upgrades, stuck upgrades, or any GKE lifecycle management task — even casual mentions like "we need to upgrade our clusters" or "plan our next GKE maintenance" or "our upgrade is stuck." Don't use for GKE cluster creation, application onboarding, general networking/routing setup, or security policy configurations (use gke-basics or relevant GKE skills instead).
gke-tpu-metrics-monitoring
Monitors and troubleshoots GKE TPU workloads, nodes, and node pools using GKE system metrics and PromQL. Use when monitoring TensorCore duty cycle, TPU memory, node readiness, multi-host TPU node pool availability, host maintenance or preemption interruptions, and calculating MTTR or MTBI metrics for GKE TPUs. Don't use for general non-TPU GKE workload monitoring or non-metric TPU debugging.