From a7712a73ef18294fae197c21f29b9aea65f55b6a Mon Sep 17 00:00:00 2001 From: byrn-baker Date: Thu, 12 Nov 2026 16:38:12 +0000 Subject: [PATCH] feat(skills): guardrails for n2n_kill, lab mode and emergency changes (spec 192) - n2n-federation: when to propose n2n_kill, and n2n_forget_endpoint for a dead endpoint. - protocol-participation: only the operator sets NETCLAW_LAB_MODE. - pyats-config-mgmt: three conditions before an emergency bypasses CR approval; record them in GAIT. - Regenerate skill catalog digests. Release 1.22.1. Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 6 +++ VERSION | 2 +- config/components/catalog.json | 6 +-- docs/releases/1.22.1.md | 31 +++++++++++++ scripts/lib/catalog.sh | 2 +- specs/192-skill-guardrails/plan.md | 9 ++++ specs/192-skill-guardrails/research.md | 20 +++++++++ specs/192-skill-guardrails/spec.md | 44 +++++++++++++++++++ specs/192-skill-guardrails/tasks.md | 7 +++ specs/192-skill-guardrails/verification.md | 35 +++++++++++++++ workspace/skills/n2n-federation/SKILL.md | 16 +++++++ .../skills/protocol-participation/SKILL.md | 1 + workspace/skills/pyats-config-mgmt/SKILL.md | 13 +++++- 13 files changed, 185 insertions(+), 7 deletions(-) create mode 100644 docs/releases/1.22.1.md create mode 100644 specs/192-skill-guardrails/plan.md create mode 100644 specs/192-skill-guardrails/research.md create mode 100644 specs/192-skill-guardrails/spec.md create mode 100644 specs/192-skill-guardrails/tasks.md create mode 100644 specs/192-skill-guardrails/verification.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 9d8498fa..8af69588 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ NetClaw source releases use `1.x.y`. Feature specs increment the minor version and reset the patch; fixes, documentation and maintenance increment the patch. Every release records its numbered specs. Component and mobile distribution versions are independent. +## [1.22.1] - 2026-11-12 + +Spec [192-skill-guardrails](specs/192-skill-guardrails/spec.md). See [release notes](docs/releases/1.22.1.md). + +- Skill guardrails: when to propose `n2n_kill` (`n2n-federation`), only the operator sets `NETCLAW_LAB_MODE` (`protocol-participation`), and a three-condition test before an emergency change bypasses CR approval (`pyats-config-mgmt`). + ## [1.22.0] - 2026-11-11 Spec [186-member-spec-providers](specs/186-member-spec-providers/spec.md). See [release notes](docs/releases/1.22.0.md). diff --git a/VERSION b/VERSION index 57807d6d..6245beec 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.22.0 +1.22.1 diff --git a/config/components/catalog.json b/config/components/catalog.json index 83772be1..138cbabf 100644 --- a/config/components/catalog.json +++ b/config/components/catalog.json @@ -26620,7 +26620,7 @@ "title": "n2n-federation", "description": "Federate your NetClaw with other NetClaw operators over the BGP mesh — exchange capability inventories and ask your claw what a peer can do. (US1; remote invocation and chat land in later phases.)", "path": "workspace/skills/n2n-federation/SKILL.md", - "sha256": "111752601d3c596e72e017747d396aaac15f4a6fcc3b9890961f1e00cf286315", + "sha256": "e16472d60c8a66822cf572b29e4533d6c6cc9afb6f6428558feb33c7ab880bbf", "components": [ "n2n" ], @@ -27316,7 +27316,7 @@ "title": "protocol-participation", "description": "Live BGP and OSPF control-plane participation — NetClaw itself acts as a protocol speaker: peer with real routers, inject/withdraw routes, query its own RIB/LSDB, adjust metrics, GRE tunnel status. Use when injecting or withdrawing BGP routes, checking the state of NetClaw's own BGP peering, querying its own OSPF LSDB, or testing route advertisement in a lab. This does not query an existing device's routing table — for that, use `pyats-routing` (Cisco) or `pyats-junos-routing` (Juniper) instead.", "path": "workspace/skills/protocol-participation/SKILL.md", - "sha256": "29c1d37f2803878b6928a5d6f42e992f88dc86a5ea3135b949d63815f033a9fa", + "sha256": "f2fee76c19372f3928c42d01033b740f318d0756e9a468ab39454402d527df92", "components": [ "protocol" ], @@ -27372,7 +27372,7 @@ "title": "pyats-config-mgmt", "description": "Direct, pyATS-based network change management - pre-change baselines, configuration deployment, post-change verification, rollback procedures, and compliance validation. Use when pushing config to a device, planning a network change, rolling back a configuration, or running compliance checks outside of a governed workflow platform. When the change should go through Itential's golden-config/compliance engine instead, use `itential-automation`.", "path": "workspace/skills/pyats-config-mgmt/SKILL.md", - "sha256": "07c33be5e29e704703ecabd655358da875719a92b94eba6823910e2debf2cb0d", + "sha256": "5053f0c1ff7c39f7bc05407ebc009beb5c2151d634747d73043c6da4d0d96f84", "components": [ "pyats" ], diff --git a/docs/releases/1.22.1.md b/docs/releases/1.22.1.md new file mode 100644 index 00000000..d5a24001 --- /dev/null +++ b/docs/releases/1.22.1.md @@ -0,0 +1,31 @@ +# NetClaw 1.22.1 + +Spec: [192-skill-guardrails](../../specs/192-skill-guardrails/spec.md) + +## Changes + +- **When to propose the federation kill switch.** `n2n-federation` now says the agent + proposes `n2n_kill` only for malicious or corrupted data it can see, an operator request, + or a revoked peer that keeps connecting. A dead endpoint gets `n2n_forget_endpoint`, which + keeps the federation; a slow peer or a general question gets neither. A proposal names + the peer and the evidence and says restoring needs a new `n2n_consent`. +- **Only the operator sets lab mode.** `protocol-participation` Safety Rule 7: the agent + never sets or exports `NETCLAW_LAB_MODE`, treats route mutations as production unless it is + already `true`, and does not suggest enabling it unless asked. +- **Emergency changes are qualified.** `pyats-config-mgmt` bypasses the CR approval gate + only when the outage, incident or exploited vulnerability is affecting production now, the + operator has confirmed the urgency in the conversation, and the fix is a single change that + can be rolled back. Otherwise the standard CR workflow applies. A qualifying emergency + records the conditions and evidence in GAIT. + +## Upgrade and compatibility + +No migration. Skill descriptions are unchanged, so routing and skill-limit budgets are the +same. Workspace copies installed before 1.22.1 keep the old text until the skills are +redeployed (`scripts/deploy-skills.py`). + +## Validation and known limitations + +See [verification](../../specs/192-skill-guardrails/verification.md): catalog parity, skill +limits and the skill-related test suites. These are instructions to the agent; the MCP +servers' own CR and lab-mode gates are unchanged, and no code enforces the new rules. diff --git a/scripts/lib/catalog.sh b/scripts/lib/catalog.sh index ac419d24..0543b3b3 100644 --- a/scripts/lib/catalog.sh +++ b/scripts/lib/catalog.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Generated by scripts/build-catalog.py; edit config/components/catalog.json. -# Catalog SHA-256: 9da871f7ec88b9e874f34fef4b8969725e2fb7e9580594da9ce504d7595b44a7 +# Catalog SHA-256: 86986ccd387b6fce770a4565876da5a625d0426488b16318d96f5fcc18ca54b2 CATALOG=( "hermes-hud|Runtime|Hermes HUD bridge|Private HUD conversation bridge; isolated pinned Hermes companion (8 private tools)" diff --git a/specs/192-skill-guardrails/plan.md b/specs/192-skill-guardrails/plan.md new file mode 100644 index 00000000..2d24af0a --- /dev/null +++ b/specs/192-skill-guardrails/plan.md @@ -0,0 +1,9 @@ +# Plan + +- `workspace/skills/n2n-federation/SKILL.md`: a "propose only when / do not propose" + list under "4. Sever (kill switch)". +- `workspace/skills/protocol-participation/SKILL.md`: Safety Rule 7, who sets lab mode. +- `workspace/skills/pyats-config-mgmt/SKILL.md`: the three-condition test at the top of + "Emergency Changes" and a GAIT step for the justification. +- Regenerate the catalog (skill digests and `scripts/lib/catalog.sh` header). +- Release 1.22.1 (patch: documentation and behaviour guidance, no code). diff --git a/specs/192-skill-guardrails/research.md b/specs/192-skill-guardrails/research.md new file mode 100644 index 00000000..e2b93ee5 --- /dev/null +++ b/specs/192-skill-guardrails/research.md @@ -0,0 +1,20 @@ +# Research + +- `n2n_kill` (`mcp-servers/n2n-mcp/server.py`) is documented as destructive: it revokes + consent, drops the NCFED channel and purges the cached inventory; BGP is untouched. + `n2n_forget_endpoint` only clears a stale dial address; the peer stays federated and + reconnects when it registers a new endpoint. The skill described the kill switch but + not when to propose it. +- `NETCLAW_LAB_MODE` is read from the environment at start by `protocol-mcp` + (`LAB_MODE`), `gnmi-mcp` and `claroty-mcp` (`itsm_gate.py`). The server gate is real, + but the value comes from `.env`, which an agent with shell or file tools could edit. + The skill said "never set this in production" without saying the agent never sets it. +- `servicenow-change-workflow` lists when an emergency applies (active outage, security + incident, actively exploited vulnerability) and requires notifying the human. + `pyats-config-mgmt` repeats the four-step emergency path with no qualification, so an + agent working from that skill alone could treat any urgent-sounding change as an + emergency. The new conditions are stricter for direct pyATS changes (one change that + can be rolled back, confirmed by the operator) and keep the same categories. +- The skill catalog (`config/components/catalog.json`) records each SKILL.md's sha256; + `node scripts/build-catalog.mjs` then `python3 scripts/build-catalog.py` regenerate it + and `--check` runs in CI. diff --git a/specs/192-skill-guardrails/spec.md b/specs/192-skill-guardrails/spec.md new file mode 100644 index 00000000..6db749d0 --- /dev/null +++ b/specs/192-skill-guardrails/spec.md @@ -0,0 +1,44 @@ +# Spec 192: Guardrails for three high-impact skill actions + +Created 2026-11-12; branch `192-skill-guardrails`, on 1.22.0; status: implementation +and verification. The three rules have run in an operator Border's workspace copies of +these skills since October 2026. + +## Problem + +Three skills name an action with a large effect but leave the agent to decide when it +applies: + +- `n2n-federation` says to confirm `n2n_kill` with the operator, but not when to + propose it. It severs federation with a peer (revokes consent, drops the channel, + purges the cached inventory). Proposing it for a dead endpoint or a slow peer + offers a destructive fix where `n2n_forget_endpoint` is the right one. +- `protocol-participation` says lab mode (`NETCLAW_LAB_MODE=true`) relaxes the CR + requirement and must not be set in production, but not who sets it. An agent that + sets or suggests it to get past the CR gate removes the gate it is meant to respect. +- `pyats-config-mgmt` lets an emergency change bypass the CR approval gate but gives + no test for what counts as an emergency. + +## Requirements + +- FR-001: `n2n-federation` lists when to propose `n2n_kill` (malicious or corrupted + data the agent can see, an operator request, a revoked peer that keeps connecting) + and when not to (connectivity or a dead endpoint, pointing to `n2n_forget_endpoint`; + a slow peer; a general question). A proposal names the peer and the evidence and + says restoring needs a new `n2n_consent`. +- FR-002: `protocol-participation` says only the operator sets lab mode, in `.env`; + the agent never sets or exports it, treats route mutations as production unless it + is already `true`, and does not suggest enabling it unless asked about lab mode. +- FR-003: `pyats-config-mgmt` qualifies an emergency only when all three hold: the + outage, incident or exploited vulnerability is affecting production now; the operator + has confirmed the urgency in the conversation; the fix is a single change that can be + rolled back. Otherwise the standard CR workflow applies. A qualifying emergency + records in GAIT which conditions held and the evidence. +- FR-004: Skill descriptions are unchanged, so routing and skill-limit budgets do not + move; the catalog's skill digests are regenerated. + +## Out of scope + +Enforcing these rules in code (the MCP servers already gate on CRs and lab mode at +their own level); the `servicenow-change-workflow` emergency process, which stays as is; +other skills. diff --git a/specs/192-skill-guardrails/tasks.md b/specs/192-skill-guardrails/tasks.md new file mode 100644 index 00000000..97b0a5a2 --- /dev/null +++ b/specs/192-skill-guardrails/tasks.md @@ -0,0 +1,7 @@ +# Tasks + +- [x] T001 `n2n-federation`: when to propose `n2n_kill`, and the `n2n_forget_endpoint` alternative (FR-001). +- [x] T002 `protocol-participation`: only the operator sets lab mode (FR-002). +- [x] T003 `pyats-config-mgmt`: emergency qualification and GAIT record (FR-003). +- [x] T004 Regenerate the skill catalog; descriptions unchanged (FR-004). +- [x] T005 Release metadata (1.22.1). diff --git a/specs/192-skill-guardrails/verification.md b/specs/192-skill-guardrails/verification.md new file mode 100644 index 00000000..0db2b66a --- /dev/null +++ b/specs/192-skill-guardrails/verification.md @@ -0,0 +1,35 @@ +# Verification + +No credentials are recorded here. Run on the development host (Ubuntu 24.04, Python 3.12, +Node 24) against `main` at 150fd24d. + +## Checks + +- `node scripts/build-catalog.mjs --check` and `python3 scripts/build-catalog.py --check`: + PASS (242 skills) after regeneration. Only the three skills' `sha256` and the + `scripts/lib/catalog.sh` catalog digest changed. +- `python3 scripts/check-catalog-metadata.py`: PASS (114 components, 242 skills). +- `python3 scripts/verify-catalog-coverage.py`: PASS. +- `python3 -m unittest discover -s tests -p test_setup_catalog.py`: OK. +- `python3 scripts/check-skill-limits.py`: ok, 242 shipped skills within the limits + (descriptions unchanged, FR-004). +- `python3 scripts/verify-spec-artifacts.py`: PASS. +- `python3 scripts/prepare-release.py --check`: PASS (1.22.1); `python3 scripts/test-prepare-release.py`: OK. +- `python3 scripts/reconcile-mcp.py` with the release surfaces (catalog, dependencies, docs, + meraki-ids, packages, portability): exit 0. +- `pytest tests/n2n/test_convergence_member_164.py tests/unit/test_jev_border.py + tests/skill-limits tests/netconverter/test_installation.py`: 39 passed, 1 failed. The + failure (`test_installed_interpreter_passes_real_owned_dependency_observation`, + `setup_state.Conflict: unsafe_parent`) also fails on unchanged `main` on this host. +- `python3 scripts/reconcile-mcp.py`: exit 1 on this branch and on unchanged `main`, with + the same failing surface (`startup`, servers not installed on this host). + +## Live + +The three rules, in slightly different wording, have been in an operator Border's +workspace copies of these skills since October 2026. That shows they load and coexist +with the rest of each skill, not that they change a decision; no incident is claimed. + +## Not verified + +An evaluation of agent decisions with and without the rules; macOS. diff --git a/workspace/skills/n2n-federation/SKILL.md b/workspace/skills/n2n-federation/SKILL.md index 9f48cb1a..a562d431 100644 --- a/workspace/skills/n2n-federation/SKILL.md +++ b/workspace/skills/n2n-federation/SKILL.md @@ -66,6 +66,22 @@ Both operators must consent before ANY capability information flows. Stops all federation with that peer and purges their cached inventory immediately. The BGP session is untouched — routes keep flowing. +Propose `n2n_kill` only when: + +1. a peer is sending malicious or corrupted data that you can see in logs or results; +2. the operator asks to sever the peer; or +3. a peer whose credential was revoked keeps trying to connect. + +Do not propose it for: + +- a connectivity problem or a dead endpoint: `n2n_forget_endpoint` retires a stale + dial address and keeps the federation; +- a peer that is slow to respond; +- a general question such as "what can we do about peer X". + +When you propose it, name the peer and the evidence, and say that restoring federation +needs a new `n2n_consent` on this side. + ## Guardrails - Federation requires **mutual consent** per peer; a peer merely present on the diff --git a/workspace/skills/protocol-participation/SKILL.md b/workspace/skills/protocol-participation/SKILL.md index ec0b4d8f..3639e771 100644 --- a/workspace/skills/protocol-participation/SKILL.md +++ b/workspace/skills/protocol-participation/SKILL.md @@ -269,6 +269,7 @@ NETCLAW_LAB_MODE=true 4. **ALWAYS** record protocol changes in GAIT (`gait-session-tracking`) 5. **GRE tunnels require sudo** — the install wizard handles initial setup; runtime queries via `gre_tunnel_status` do not require elevated privileges 6. **Lab mode** (`NETCLAW_LAB_MODE=true`) relaxes the CR requirement for the FRR testbed — never set this in production +7. **Only the operator sets lab mode**, in `.env`. Never set or export `NETCLAW_LAB_MODE` yourself. When it is not already `true` in the environment, treat every route mutation as production and require a CR. Do not suggest enabling it unless the operator asks about lab-mode operation ## Guardrails diff --git a/workspace/skills/pyats-config-mgmt/SKILL.md b/workspace/skills/pyats-config-mgmt/SKILL.md index f744fcc5..7fbbf8c8 100644 --- a/workspace/skills/pyats-config-mgmt/SKILL.md +++ b/workspace/skills/pyats-config-mgmt/SKILL.md @@ -312,11 +312,20 @@ python3 $MCP_CALL "python3 -u $SERVICENOW_MCP_SCRIPT" update_change_request '{"c ### Emergency Changes -For emergency changes (network outage, security incident): +An emergency change (network outage, security incident) bypasses the CR approval gate, +so a change qualifies only when **all three** are true: + +1. An outage, security incident or actively exploited vulnerability is affecting production now, not one that is predicted. +2. The operator knows about it and has confirmed the urgency in this conversation. +3. The fix is a single configuration change that can be rolled back, not a multi-step procedure. + +If any one is false, follow the standard CR workflow. Otherwise: + 1. Notify human immediately 2. Create CR with category "Emergency" 3. Proceed with change (approval gate bypassed) -4. CR must be retroactively approved within 24 hours +4. Record in GAIT which conditions held and the evidence for each +5. CR must be retroactively approved within 24 hours ## GAIT Audit Trail