Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
148 commits
Select commit Hold shift + click to select a range
2fbef25
docs: start milestone v1.6 Audit-Mode Onboarding & cpg-Dedicated Agen…
SoulKyu Jul 22, 2026
d5087b5
docs: synthesize v1.6 milestone research
SoulKyu Jul 22, 2026
1ab02f5
docs: define milestone v1.6 requirements
SoulKyu Jul 22, 2026
6894007
docs: create milestone v1.6 roadmap (5 phases)
SoulKyu Jul 22, 2026
ecc4328
docs(20): research --include-audit verdict ingestion phase
SoulKyu Jul 22, 2026
ba9687e
docs(phase-20): add validation strategy
SoulKyu Jul 22, 2026
9481ba6
docs(20): create phase plan
SoulKyu Jul 22, 2026
a2a7710
test(20-01): add failing test for AUDIT diagnostic counter
SoulKyu Jul 22, 2026
43adde7
feat(20-01): add includeAudit gate field and AUDIT diagnostic counter
SoulKyu Jul 22, 2026
9209182
test(20-01): add failing test for classification gate AUDIT widening
SoulKyu Jul 22, 2026
5b586ae
feat(20-01): widen classification gate to include AUDIT verdicts
SoulKyu Jul 22, 2026
60a0074
docs(20-01): complete aggregator includeAudit gate + counter plan
SoulKyu Jul 22, 2026
93aa101
docs(20-01): append self-check results to SUMMARY.md
SoulKyu Jul 22, 2026
08b592a
merge: bring 20-01 aggregator includeAudit gate into master
SoulKyu Jul 22, 2026
a1be053
docs(phase-20): update tracking after wave 1
SoulKyu Jul 22, 2026
dceb3ad
feat(20-02): widen FlowSource interface + filter sites 1-4, thread In…
SoulKyu Jul 22, 2026
4586f97
test(20-02): update 15 test-double locations for widened FlowSource i…
SoulKyu Jul 22, 2026
98d1fd3
test(20-02): pin buildFilters widened output with 4 _WithAudit tests
SoulKyu Jul 22, 2026
dfd2dab
docs(20-02): complete FlowSource interface widening + filter sites 1-…
SoulKyu Jul 22, 2026
bdf5f01
docs(20-02): append self-check results to SUMMARY.md
SoulKyu Jul 22, 2026
e1c6e8e
merge: bring 20-02 FlowSource interface widening into master
SoulKyu Jul 22, 2026
8c6a50b
docs(phase-20): update tracking after wave 2
SoulKyu Jul 22, 2026
42abd7a
test(20-03): add with_audit.jsonl fixture (1 DROPPED + 1 AUDIT)
SoulKyu Jul 22, 2026
c262257
test(20-03): add pipeline_audit_test.go — 5 E2E tests for --include-a…
SoulKyu Jul 22, 2026
4e397d1
feat(20-04): register --include-audit CLI flag on generate/replay
SoulKyu Jul 22, 2026
e49e93d
feat(20-04): thread include_audit MCP arg through StartArgs to Pipeli…
SoulKyu Jul 22, 2026
68defa7
docs(20-03): complete include-audit E2E regression proof plan
SoulKyu Jul 22, 2026
ce4c470
docs(20-03): append self-check results to SUMMARY.md
SoulKyu Jul 22, 2026
b609472
merge: bring 20-03 include-audit E2E regression proof into master
SoulKyu Jul 22, 2026
a849b27
docs(20-04): document --include-audit (Flags table) and include_audit…
SoulKyu Jul 22, 2026
a380c71
docs(20-04): add plan summary
SoulKyu Jul 22, 2026
6d72aa4
docs(20-04): append self-check results to SUMMARY.md
SoulKyu Jul 22, 2026
6471182
merge: bring 20-04 include-audit CLI/MCP surface into master
SoulKyu Jul 22, 2026
6c3a57f
docs(phase-20): update tracking after wave 3
SoulKyu Jul 22, 2026
6f82e84
docs(20): add code review report
SoulKyu Jul 22, 2026
ada7b30
fix(20): surface AuditVerdictCount through SessionStats and StopResul…
SoulKyu Jul 22, 2026
6820cd0
docs(20): mark WR-01 resolved in code review report
SoulKyu Jul 22, 2026
a2f21a8
docs(20): add code review fix report
SoulKyu Jul 22, 2026
83cd236
docs(phase-20): complete phase execution
SoulKyu Jul 22, 2026
c85f2d8
docs(phase-20): evolve PROJECT.md after phase completion
SoulKyu Jul 22, 2026
5a6870b
docs(phase-20): add security threat verification
SoulKyu Jul 22, 2026
089dbbd
docs(21): research Cilium compatibility matrix + runtime detection
SoulKyu Jul 22, 2026
89d9c0d
docs(phase-21): add validation strategy
SoulKyu Jul 22, 2026
12d06b0
docs(21): create phase plan (4 plans, 2 waves) for Cilium compat matr…
SoulKyu Jul 22, 2026
c054713
docs(21): finalize phase plan
SoulKyu Jul 22, 2026
35d33f7
docs(21-02): add Supported Cilium versions section, fix proxy-visibil…
SoulKyu Jul 22, 2026
1e90a54
test(21-02): add readme_compat_test.go golden consistency test
SoulKyu Jul 22, 2026
2f7eecb
test(21-02): pin merged-PR citations in readme_compat_test.go
SoulKyu Jul 22, 2026
cfa36ea
feat(21-01): add pkg/k8s/version.go Cilium version detection
SoulKyu Jul 22, 2026
77983ea
docs(21-02): add plan 02 SUMMARY
SoulKyu Jul 22, 2026
c970966
docs(21-02): append self-check results to SUMMARY
SoulKyu Jul 22, 2026
ae0ef0d
merge: bring 21-02 supported-versions README + golden test into master
SoulKyu Jul 22, 2026
d7691c5
test(21-01): add pkg/k8s/version_test.go fake-clientset coverage
SoulKyu Jul 22, 2026
3e7e490
test(21-01): add TestParseAgentVersionString direct coverage
SoulKyu Jul 22, 2026
83c9494
docs(21-01): complete Cilium version detection library plan
SoulKyu Jul 22, 2026
408fae2
merge: bring 21-01 cilium version detection library into master
SoulKyu Jul 22, 2026
11b27b3
docs(phase-21): update tracking after wave 1
SoulKyu Jul 22, 2026
6362e89
feat(21-03): add maybeRunVersionPreflight always-on preflight in gene…
SoulKyu Jul 22, 2026
3ca6465
feat(21-04): add compat fields + detectVersionFn seam + resolveSetup …
SoulKyu Jul 22, 2026
9d090dd
test(21-03): guard replay.go against version detection
SoulKyu Jul 22, 2026
103db47
docs(21-03): add plan 03 SUMMARY
SoulKyu Jul 22, 2026
d3471b9
merge: bring 21-03 CLI version preflight into master
SoulKyu Jul 22, 2026
46b885a
test(21-04): stub detectVersionFn seam, assert compat fields, prove w…
SoulKyu Jul 22, 2026
0c9834f
docs(21-04): add plan summary
SoulKyu Jul 22, 2026
2ce71f2
merge: bring 21-04 MCP compat surfacing into master
SoulKyu Jul 22, 2026
03be224
docs(phase-21): update tracking after wave 2
SoulKyu Jul 22, 2026
ddcce14
docs(21): add code review report
SoulKyu Jul 22, 2026
c4db965
fix(21): WR-01 bound CLI version preflight and suppress Ctrl+C warn
SoulKyu Jul 22, 2026
0144ae0
fix(21): WR-02 bound GetNodes RPC with versionDetectTimeout budget
SoulKyu Jul 22, 2026
b8a389d
docs(21): WR-03 clarify featureFloors covers floors only, ceiling is …
SoulKyu Jul 22, 2026
e615b65
docs(21): add code review fix report
SoulKyu Jul 22, 2026
1df3721
docs(22): smart discuss context
SoulKyu Jul 22, 2026
247d13e
docs(22): research + patterns + context correction (empty-rule stanza…
SoulKyu Jul 22, 2026
99d9d9d
docs(22): add phase plans, validation strategy, checker fixes + state…
SoulKyu Jul 22, 2026
2a1b0fc
feat(22-01): add BuildBootstrapPolicy default-deny CNP constructor
SoulKyu Jul 22, 2026
a5af49d
test(22-01): add named cilium#35558 default-deny acceptance test
SoulKyu Jul 22, 2026
ab70c42
docs(22-03): add bootstrap + audit-onboarding runbook with golden test
SoulKyu Jul 22, 2026
74745c1
docs(22-03): cross-reference enableDefaultDeny compat row to cpg boot…
SoulKyu Jul 22, 2026
768f259
docs(22-01): complete bootstrap CNP builder plan
SoulKyu Jul 22, 2026
383996b
docs(22-03): add plan summary
SoulKyu Jul 22, 2026
6e6f19b
merge: bring 22-01 bootstrap builder into master
SoulKyu Jul 22, 2026
952fc8f
merge: bring 22-03 runbook + README compat docs into master
SoulKyu Jul 22, 2026
52861d7
feat(22-02): add cpg bootstrap CLI command + version gate
SoulKyu Jul 22, 2026
87630fd
feat(22-02): add readonly get_bootstrap_policy MCP tool
SoulKyu Jul 22, 2026
a111188
fix(22-02): update pinned MCP tool-count tests for get_bootstrap_policy
SoulKyu Jul 22, 2026
918a18c
docs(22-02): add plan summary
SoulKyu Jul 22, 2026
4bdda1b
merge: bring 22-02 bootstrap CLI + MCP tool into master
SoulKyu Jul 22, 2026
61c58c0
fix(22-02): make cpg bootstrap stdout-only, restoring zero new SEC-01…
SoulKyu Jul 22, 2026
ce33488
docs(22): add code review report
SoulKyu Jul 22, 2026
4ebdfe4
fix(22): review fixes — runbook -o drift + DNS-1123 namespace validat…
SoulKyu Jul 22, 2026
de30692
docs(22): add code review fix report
SoulKyu Jul 22, 2026
bae7bb5
docs(22): verification passed — mark phase 22 complete, sync traceabi…
SoulKyu Jul 22, 2026
14730aa
docs(23): record AUD-03 CLI-only surface decision (user gate approval)
SoulKyu Jul 22, 2026
9ed4f4a
docs(23): smart discuss context (CLI-only surface per user gate decis…
SoulKyu Jul 22, 2026
7ff5c57
docs(23): research + patterns
SoulKyu Jul 22, 2026
6030ed2
docs(23): validation strategy
SoulKyu Jul 22, 2026
4a9149a
docs(23): add phase plans + checker fixes, update state
SoulKyu Jul 22, 2026
c36e03e
feat(23-01): add SPDY exec primitive + node-to-agent-pod mapping
SoulKyu Jul 22, 2026
f0ab85f
feat(23-01): add read-before-flip, canonical flip, binary gate, daemo…
SoulKyu Jul 22, 2026
ba00722
docs(23-01): add plan summary
SoulKyu Jul 22, 2026
c379d76
merge: bring 23-01 exec plumbing into master
SoulKyu Jul 22, 2026
f2de4da
feat(23-02): add auditwindow.Manager scaffold + Open precondition/fli…
SoulKyu Jul 22, 2026
4c9c66e
feat(23-02): add bounded revert fan-out for Close/Shutdown with per-e…
SoulKyu Jul 22, 2026
42b3b8f
feat(23-02): add new-endpoint watcher with bounded-backoff reconnect
SoulKyu Jul 22, 2026
8244069
docs(23-02): complete pkg/auditwindow Manager plan
SoulKyu Jul 22, 2026
23d6d78
merge: bring 23-02 auditwindow Manager into master
SoulKyu Jul 22, 2026
c8bf7b8
docs(23): README readonly-by-default + audit-window RBAC
SoulKyu Jul 22, 2026
6b7157a
feat(23): add cpg audit-window command
SoulKyu Jul 22, 2026
bd32e1a
docs(23): runbook wires cpg audit-window + honest race
SoulKyu Jul 22, 2026
ad7565e
docs(23-04): add plan summary
SoulKyu Jul 22, 2026
1c1077d
test(23): SEC-01 tripwire proving exec path unreachable from MCP
SoulKyu Jul 22, 2026
3709a59
docs(23-03): add plan summary
SoulKyu Jul 22, 2026
43a763f
docs(23-03): append self-check results to plan summary
SoulKyu Jul 22, 2026
81b75ee
merge: bring 23-03 audit-window CLI + SEC-01 tripwire into master
SoulKyu Jul 22, 2026
761ba9c
merge: bring 23-04 README/runbook honesty docs into master
SoulKyu Jul 22, 2026
213ae54
docs(23): add code review report
SoulKyu Jul 22, 2026
4d62126
fix(23): CR-01/CR-02/WR-01 route audit-window revert through bounded …
SoulKyu Jul 22, 2026
dc7f21c
fix(23): WR-02/WR-03 harden SEC-01 exec tripwire negative half
SoulKyu Jul 22, 2026
acee4a9
fix(23): report possibly-stuck endpoints when revert deadline expires
SoulKyu Jul 22, 2026
bbe18f4
docs(23): add code review fix report (2 iterations)
SoulKyu Jul 22, 2026
4d195b0
docs(23): verification passed — mark phase 23 complete, sync tracking
SoulKyu Jul 22, 2026
92aadf2
docs(24): smart discuss context
SoulKyu Jul 22, 2026
6bf65ca
docs(24): research + validation strategy
SoulKyu Jul 22, 2026
4dfc1c3
docs(24): add phase plans
SoulKyu Jul 22, 2026
817db1f
feat(24): add cpg-operator agent + cpg-triage skill
SoulKyu Jul 22, 2026
de97afa
feat(24): add cpg-audit-onboard + cpg-policy-review skills
SoulKyu Jul 22, 2026
26d06a5
feat(24): add cpg-health-report + cpg-mcp-smoke skills + README agent…
SoulKyu Jul 22, 2026
3fbe82a
docs(24-01): add plan summary
SoulKyu Jul 22, 2026
964e6af
merge: bring 24-01 skills + agent + README section into master
SoulKyu Jul 22, 2026
8d52f4a
test(24): add skills/agent consistency tripwire
SoulKyu Jul 22, 2026
a5c3718
docs(24-02): add plan summary
SoulKyu Jul 22, 2026
912e130
merge: bring 24-02 consistency tripwire into master
SoulKyu Jul 22, 2026
d011d16
fix(24): correct nonexistent 'cpg explain --output json' flag to --js…
SoulKyu Jul 22, 2026
a5d9e46
docs(24): add code review fix report
SoulKyu Jul 22, 2026
755cf0c
fix(24): correct remaining --output json reference in README MCP table
SoulKyu Jul 22, 2026
ce7432c
docs(24): verification passed — mark phase 24 and all v1.6 phases com…
SoulKyu Jul 22, 2026
36e7fc2
docs: close v1.6 audit doc-drift — README MCP table 9th tool row + RE…
SoulKyu Jul 22, 2026
5639684
docs(v1.6): milestone audit — passed
SoulKyu Jul 22, 2026
2f49556
chore: archive v1.6 milestone
SoulKyu Jul 22, 2026
884b83a
chore: archive v1.6 phase directories to milestones/v1.6-phases/
SoulKyu Jul 22, 2026
d880bc4
docs(quick): plan websocket-exec-fallback (AUD-FUT-01)
SoulKyu Jul 23, 2026
2465740
feat(quick): use WebSocket exec with SPDY fallback in audit-window ex…
SoulKyu Jul 23, 2026
4707c44
test(quick): extend SEC-01 exec tripwire to WebSocket + fallback cons…
SoulKyu Jul 23, 2026
9afd645
docs(quick): note WebSocket-first exec transport in README
SoulKyu Jul 23, 2026
c0b435e
docs(quick): websocket-exec-fallback summary
SoulKyu Jul 23, 2026
34097bc
docs(quick): track websocket-exec-fallback completion (AUD-FUT-01 shi…
SoulKyu Jul 23, 2026
86fecf0
fix: resolve new lint findings (errcheck Fprintln, QF1008 embedded Ob…
SoulKyu Jul 23, 2026
457421d
docs: recommend audit-window-first order for live-traffic onboarding …
SoulKyu Jul 23, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .claude/agents/cpg-operator.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
name: cpg-operator
description: Drives a live cpg MCP session (`start_session`/`get_status`/`stop_session`
plus the query tools and `get_bootstrap_policy`) on behalf of `cpg-triage` and
`cpg-audit-onboard`. Never invoked directly by the operator — spawned by those
two skills whenever a live session needs to be driven end-to-end.
tools: Bash, Read
---

# cpg-operator

## Operating contract

- You are spawned by `cpg-triage` or `cpg-audit-onboard`, never invoked standalone.
If you are somehow asked to run outside that context, say so and stop — you have
no independent workflow of your own.
- Before calling ANY tool, call `tools/list` and read the live schema. Never assume
an argument name, a result field, or a tool's exact behavior from this document
or from the calling skill's prose — those are workflow routers, not a copy of the
tool contract. The MCP server (`cpg mcp`) is the single source of truth.
- Drive the session lifecycle the calling skill asks for (typically some ordering
of `start_session`, `get_status`, `stop_session`, and the read-only query tools:
`list_dropped_flows`, `list_policies`, `get_policy`, `get_evidence`,
`get_cluster_health`, `get_bootstrap_policy`). Report findings back to the
calling skill in plain terms — you are the driver, not the presenter.
- `Bash` is for spawning `cpg mcp` and driving JSON-RPC over stdio (or a thin MCP
client wrapping that subprocess). `Read` is for inspecting policy YAML and
evidence files a session writes to its own tmpdir. You have no `Write`/`Edit` —
you drive and report, you never author files in this repository.
- Stop the session cleanly (`stop_session`) once the calling skill's workflow is
done or once a hard error stops progress — never leave a session dangling.
- If a tool response looks like an error, check whether it is actually a documented
non-error state (e.g. a mid-capture "not ready yet" marker) before surfacing it as
a failure to the calling skill.
129 changes: 129 additions & 0 deletions .claude/skills/cpg-audit-onboard/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
---
name: cpg-audit-onboard
description: >
Guide an operator through onboarding a brand-new namespace into enforced
default-deny network policy: bootstrap, per-endpoint audit mode, capture,
and the human-applied enforce checklist. Use when a namespace has no
default-deny CiliumNetworkPolicy yet and needs to be brought onto one
safely. Do NOT use for triaging an already-running capture on a namespace
that is already onboarded (see cpg-triage) or for offline review of
existing policies (see cpg-policy-review).
---

# cpg-audit-onboard

Router for the full onboarding workflow documented in
[docs/bootstrap-runbook.md](../../../docs/bootstrap-runbook.md). This skill
GUIDES the human through the CLI steps that are human-run, DRIVES the capture
step via the `cpg-operator` agent, and ENDS with the human applying policy —
it never runs `cpg bootstrap`/`cpg audit-window` itself and never invokes an
apply tool, because none exists and none should be invented.

## Step 0: Check prerequisites

Point the operator at the runbook's
[Prerequisites](../../../docs/bootstrap-runbook.md#prerequisites) section:
`cpg` on `PATH`, a working `kubeconfig` with `create`/`apply` RBAC for the
target namespace, and Cilium >= 1.16 on the cluster. Confirm these before
proceeding — a stale Cilium version silently degrades `cpg bootstrap`'s
output rather than failing loudly.

## Step 0.5: Pick the order (live traffic vs fresh namespace)

Ask the operator one question before anything else: **does the namespace
carry live traffic?**

- **Live traffic → audit window FIRST, bootstrap second** (swap Steps 1
and 2 below). Flipping `PolicyAuditMode` is a no-op until a policy
matches, so opening the window first is harmless — and the bootstrap
apply then produces `AUDIT` verdicts instead of real drops. Zero real
drops, end to end.
- **Fresh or scaled-down namespace → bootstrap first** (the order as
written). Nothing is running to drop, and the namespace is enforced from
the very first pod.

See the runbook's
[Choose Your Order](../../../docs/bootstrap-runbook.md#choose-your-order-live-traffic-vs-fresh-namespace)
section. Either way, remind the operator the namespace is NOT enforced
while the window is open — keep the `--ttl` as short as the capture needs.

## Step 1: Guide bootstrap (human-run)

Instruct the operator to run, in their own terminal:

```bash
cpg bootstrap -n <namespace> | kubectl apply -f -
```

This is a human-run CLI step — this skill does not execute it. If the
operator wants to review before applying, tell them they can redirect to a
file first and `kubectl apply -f` it themselves; see the runbook's
[Bootstrap the Namespace](../../../docs/bootstrap-runbook.md#bootstrap-the-namespace)
section for both paths, plus the note on
[Deploy / Scale Considerations](../../../docs/bootstrap-runbook.md#deploy--scale-considerations)
if the namespace carries live traffic (in which case Step 2's window should
already be open per Step 0.5).

## Step 2: Guide per-endpoint audit mode (human-run)

Instruct the operator to run `cpg audit-window` in its own supervised
terminal for the duration of the onboarding capture:

```bash
cpg audit-window -n <namespace> --ttl <duration>
```

This skill does not run this command either — it is foreground and
supervised by design, and it self-reverts on every exit path (Ctrl+C,
SIGTERM, or `--ttl` expiry). Point the operator at the runbook's
[Enable Per-Endpoint Audit Mode](../../../docs/bootstrap-runbook.md#enable-per-endpoint-audit-mode)
section for the RBAC it needs and the documented new-endpoint race window.
Use the per-endpoint form only — never suggest the daemon-wide audit-mode
setting; that ConfigMap knob disables enforcement cluster-wide and the
runbook's own leading warning confines it to a single paragraph for exactly
that reason.

## Step 3: Drive the capture

Once the operator confirms audit mode is active, delegate to the
`cpg-operator` agent to call `start_session` with audit-inclusion enabled —
discover the exact argument name for that via `tools/list` at call time; do
not assume it from this document (Router Principle). Let the capture run
long enough to observe the traffic the operator cares about, then have
`cpg-operator` call `stop_session`.

For a wider verdict view alongside the MCP-driven capture, the operator may
also want the runbook's
[Observe Policy Verdicts](../../../docs/bootstrap-runbook.md#observe-policy-verdicts)
Hubble command — that stays a human/CLI step, not something this skill runs.

## Step 4: Enforce checklist (ends with the human applying)

1. Review the generated policy YAML the capture produced.
2. Cross-check against the runbook's
[Create and Apply Generated Policies](../../../docs/bootstrap-runbook.md#create-and-apply-generated-policies)
section.
3. The HUMAN applies the reviewed policy:

```bash
kubectl apply -f ./policies/<namespace>/
```

There is no apply tool in this workflow and none should be invoked or
suggested — this step is intentionally the operator's own action, taken
outside this skill, after they have reviewed the YAML.

## Step 5: Verify and clean up (human-run)

Point the operator at the runbook's
[Verify Enforcement](../../../docs/bootstrap-runbook.md#verify-enforcement) and
[Clean-up](../../../docs/bootstrap-runbook.md#clean-up) sections to confirm the
endpoint left audit mode and, if this was a one-off exercise, to tear down
what was applied. Per-endpoint audit mode has no separate disable step —
stopping `cpg audit-window` in Step 2 already reverted it.

## After onboarding

Once a namespace is onboarded and enforcing, route follow-up live-capture
work to `cpg-triage` and offline policy audits to `cpg-policy-review` — this
skill's job ends at a verified, enforcing namespace.
60 changes: 60 additions & 0 deletions .claude/skills/cpg-health-report/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
name: cpg-health-report
description: >
Turn a captured cluster-health.json into a shareable, self-contained HTML
report of infra/transient drops broken down by node and workload, with
Cilium remediation links. Use when an operator wants a readable report of
the infra side of a session (drops that were not turned into policy). Do
NOT use for generating or reviewing CiliumNetworkPolicies (see cpg-triage
or cpg-policy-review).
---

# cpg-health-report

Router for turning `cluster-health.json` into a shareable HTML report. This
skill routes to where the data lives and what to render — it does not
restate the JSON schema field-by-field beyond naming the fields needed to
route the rendering.

## Step 1: Obtain cluster-health.json

Two sources exist — pick the one that matches the invocation context and
STATE which one was used in the report itself:

- **A saved/archived session directory:** read the file directly from disk
at `<session_tmpdir>/cluster-health.json` (available post-`stop_session`).
This copy is uncapped.
- **An already-running or already-driven session:** call the
`get_cluster_health` MCP tool (via `cpg-operator` if a session is already
being driven for another purpose). This path is server-capped at 100
node/workload entries per drop.

## Step 2: Render a self-contained HTML file

Build one static HTML file, inline `<style>` only — no external JS/CSS,
no CDN dependency, nothing that requires network access to render correctly
when the operator opens it locally. Structure:

1. **Header:** session summary line built from `flows_seen` and
`infra_drops_total`.
2. **One table row per drop entry:** reason, class, count.
3. **Expandable breakdown per row:** the by-node and by-workload counts for
that drop reason.
4. **Remediation link:** wherever a drop entry's remediation field is
non-empty, render it as a clickable link to the Cilium docs page it
points at; omit the link entirely when the field is empty rather than
rendering a dead link.

## Step 3: Escape before embedding

HTML-escape every string field pulled from `cluster-health.json` before
embedding it in the generated file — reason strings, remediation URLs, node
names, workload names. This is a self-XSS guardrail: the report is a local
file the operator opens in a browser, and nothing in this pipeline should
assume those strings are already safe to embed raw.

## Step 4: Hand off

Tell the operator where the HTML file was written and which source (disk
file vs `get_cluster_health` tool, per Step 1) it was built from, so they
know whether they're looking at a capped or uncapped view.
62 changes: 62 additions & 0 deletions .claude/skills/cpg-mcp-smoke/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: cpg-mcp-smoke
description: >
Smoke-test a tagged cpg binary's MCP server against the fake-relay e2e
harness: full 9-tool handshake plus a graceful session lifecycle. Use
after a release build, before shipping a new cpg binary, to confirm the
MCP surface still works end-to-end. Do NOT use this for a live-cluster
workflow — it targets the fake relay, not a real cluster (see cpg-triage
or cpg-audit-onboard for live work).
---

# cpg-mcp-smoke

Router for post-release MCP smoke testing. This skill routes to the
EXISTING e2e harness in `cmd/cpg/mcp_e2e_test.go` — it does not rebuild any
test infrastructure.

## Step 1: Run the graceful lifecycle test WITHOUT -short

```bash
rtk proxy go test ./cmd/cpg/... -run TestMCPE2EGracefulLifecycle -v
```

This must run WITHOUT `-short` — the test explicitly skips itself under
short mode. A "pass" that completes in under a second means the test was
skipped, not that the smoke actually ran; the real run does a one-time
`-race` build of the binary plus a real subprocess round-trip, so expect it
to take several seconds minimum.

## Step 2: What the test covers

`TestMCPE2EGracefulLifecycle` exercises the full handshake and session
lifecycle against an in-process fake Hubble relay: initialize, `tools/list`
(schema + annotation checks), `start_session`, `get_status`, all five query
tools mid-capture, `stop_session`, `get_cluster_health` post-stop, and a
graceful stdin-close exit. This is the smoke skill's primary target.

## Step 3: Assert the tool count

The handshake must report exactly 9 tools. This skill validates the current
full real tool surface, not the stale "8-tool" figure some older docs still
carry — `get_bootstrap_policy` shipped after that figure was written.

## Step 4: Coverage floor — the 9 tools

Every registered MCP tool must be exercised or at minimum named as part of
this smoke's scope: `start_session`, `get_status`, `stop_session`,
`list_dropped_flows`, `list_policies`, `get_policy`, `get_evidence`,
`get_cluster_health`, `get_bootstrap_policy`.

## Step 5: Companion scenario — abrupt disconnect

`TestMCPE2EUngracefulDisconnect` is the companion scenario for a killed
transport (an abrupt disconnect instead of a graceful stdin close). Run it
alongside the graceful lifecycle test for a fuller smoke pass:

```bash
rtk proxy go test ./cmd/cpg/... -run TestMCPE2EUngracefulDisconnect -v
```

The graceful lifecycle test in Step 1 remains the primary smoke target;
this companion is worth running but is not a substitute for it.
73 changes: 73 additions & 0 deletions .claude/skills/cpg-policy-review/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
name: cpg-policy-review
description: >
Audit already-generated CiliumNetworkPolicies offline: over-broad rules,
missing/incorrect L7 anchoring, missing DNS-53 companion rules, and
dedup sanity, routed through cpg explain and per-rule flow evidence. Use
when reviewing policy YAML that already exists on disk or in git, without
a live cluster session. Do NOT use for driving a live capture (see
cpg-triage) or for the initial namespace onboarding workflow (see
cpg-audit-onboard).
---

# cpg-policy-review

Router for an offline policy audit. This skill routes to `cpg explain` and
the `get_evidence` tool for evidence, and points at the README rather than
restating flag lists or field shapes.

## Step 1: Locate the target

Identify the namespace/workload pair or the policy YAML path to review
(`<NAMESPACE/WORKLOAD>` or a path under the output directory, e.g.
`./policies/<namespace>/<workload>.yaml`).

## Step 2: Explain the policy

Run `cpg explain <NAMESPACE/WORKLOAD | path/to/policy.yaml>` for the target.
Use its filter flags (`--ingress`/`--egress`/`--port`/`--peer`/`--peer-cidr`/
`--http-method`/`--http-path`/`--dns-pattern`/`--since`/`--samples-limit`) to
narrow the review to the rules under question, and `--json`/`--format` to
get a structured view when comparing against evidence programmatically.
Do not restate the flag semantics beyond naming them — run `cpg explain
--help` for the exact current flag surface if anything is unclear.

If reviewing against a live-ish source (an active or recently-stopped MCP
session) rather than files on disk, use the `get_evidence` tool instead —
it returns evidence in the same shape `cpg explain --json` does.

## Step 3: Checklist — walk each rule

For each rule `cpg explain` surfaces, check:

- **Over-broad rules:** does the peer selector or CIDR match more than the
evidence actually shows traffic from? A rule matching a whole namespace
when evidence shows only one workload talking is a candidate to tighten.
- **L7 anchoring:** for HTTP/DNS rules, is the L7 detail (method, path,
matchName) actually present and correctly anchored? See the README's
[L7 Prerequisites](../../../README.md#l7-prerequisites) section for the
capture-time requirements a rule needs before L7 attribution is even
possible — do not re-derive those requirements here, route to it.
- **Missing DNS-53 companions:** an egress rule permitting a `toFQDNs` peer
needs a paired DNS/port-53 rule for the FQDN to resolve at all; flag any
FQDN-based rule missing its DNS companion.
- **Dedup sanity:** do near-duplicate rules exist (same peer/port pair
expressed twice with slightly different selectors)? Evidence should
justify each distinct rule; if two rules are backed by the same evidence
set, they are a dedup candidate.

## Step 4: Cross-reference the evidence

For every rule flagged in Step 3, pull its evidence via `get_evidence` (or
the JSON output of `cpg explain` from Step 2) and confirm the flagged
concern is real — a rule that looks over-broad in isolation may be backed by
genuinely varied evidence samples justifying the breadth.

## Step 5: Report

Summarize findings per rule: keep as-is, tighten (with the specific narrower
selector/port/L7 filter suggested), or flag as a dedup candidate. Point the
operator at [Explain policies](../../../README.md#explain-policies) in the
README for the full worked examples of `cpg explain` usage if they want to
reproduce a finding themselves. This skill reports; the operator decides
whether and how to edit the policy YAML.
Loading
Loading