agent-killswitch
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
integrity-killswitch (agent-killswitch CLI)
An OS process-tree emergency killswitch, Cloud PANIC sync gate, and OS firewall/ACL/freeze cutoff for autonomous AI coding agents (Claude Code, Codex CLI, Cursor, Gemini CLI, Antigravity, Aider, Copilot, Windsurf, Grok).
PyPI Package Name Warning: The official PyPI distribution name for this project is
integrity-killswitch(CLI binary:agent-killswitch, Python import:agent_killswitch). Do NOT install the unrelated third-partyagent-killswitchpackage on PyPI — that namespace belongs to an unrelated author.
Zero runtime dependencies — pure Python 3.10+ standard library.
Tighten-only for agents, owner-only restore: any agent or script can hit
panic,net-cut,freeze, or disable a vendor/scope, butresume,on,scope-on,net-restore,thaw, anduninstall-hookswalk the OS process tree and refuse (exit3) whenever an LLM ancestor or orphaned shell is detected.--vendorcan never override an OS-detected LLM vendor.1-Command Hook Auto-Installer (Fail-Closed Exit
2+ Vendor JSON):agent-killswitch install-hooks --allsafely patches Claude Code, Codex CLI, Cursor, Gemini CLI, and Antigravity using each client's exact native schema, UTF-8 BOM-safe JSON parsing, dynamic executable resolution (agent-killswitchor"<python>" -m agent_killswitch), explicit hardened--stateembedding, and--hook-format <vendor>(exit 2+ vendor-specific blocking JSON on stdout).Cloud Control Plane PANIC Sync (
cloud-sync): pollsGET <cloud_url>/api/v1/killswitch/state(stdliburllib.request, 3s timeout, TTL-cached every 15s duringcheck) and immediately latches localstate.jsonMaster Panic when the Cloud Dashboard's Big Red PANIC button is pressed.Absolute OS Killswitch:
agent-killswitch panic --network --freezecombinesstate.jsonMaster Panic, kernel-level outbound TCP + UDP 80/443 (HTTP/HTTPS/QUIC) LLM API firewall cutoff (nftables/iptables/netsh+PowerShell/pf) with anti-lockout rules, and POSIXSIGSTOPprocess-tree freeze — plusagent-killswitch hardendefaulting to system-owned paths (/etc/agent-killswitch/state.json/C:\ProgramData\agent-killswitch\state.json) with locale-independent Windows SIDs.Fail-closed: corrupt or unreadable state defaults to Master Panic active.
60-Second Install (PEP 668 & Windows pwsh 7 Safe)
Modern Debian/Ubuntu 24.04+ enforces PEP 668 (externally-managed-environment). Never pass --break-system-packages. Use zero-install or an isolated .venv:
Option A: Zero-Install Direct Run (Linux / macOS / Windows)
git clone https://github.com/BlackBadHope/agent-killswitch
cd agent-killswitch
python3 killswitch.py statusOption B: Isolated .venv Install (Linux / macOS — PEP 668 Safe)
git clone https://github.com/BlackBadHope/agent-killswitch
cd agent-killswitch
python3 -m venv .venv
.venv/bin/python -m pip install --no-deps .
.venv/bin/agent-killswitch statusOption C: Windows PowerShell 7 (pwsh 7)
Use PowerShell 7 (
pwsh 7), not legacy Windows PowerShell 5.1, when installing hooks or running elevated firewall/ACL commands to avoid UTF-8 BOM and argument-quoting drift.
git clone https://github.com/BlackBadHope/agent-killswitch
cd agent-killswitch
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install --no-deps .
.\.venv\Scripts\agent-killswitch.exe status(When installing from PyPI once published, install integrity-killswitch — never agent-killswitch.)
Related MCP server: interactive-process-mcp
Honest Threat Model: User-Level vs Elevated-Privilege Enforcement
Security tools lose trust when they claim magic. Here is what each layer enforces — and where its boundary is:
Layer | Privilege Required | What It Stops | Boundary / Bypass |
1. Hooks & Process Ancestry ( | None (normal user) | Accidental tool calls, prompt-injected deploys/pushes, | A rogue same-user process that ignores client hooks can overwrite a user-writable |
2. System-Owned State ACL Hardening ( | Root / Administrator (once) | Same-user rogue agent editing, truncating, deleting, or | Does not stop an agent from ignoring hook wrappers if it executes tools outside hooked paths |
3. Absolute OS Cutoff ( | Root / Administrator for firewall; same user for POSIX | Even if a same-user rogue agent ignores hooks completely, outbound TCP & UDP 80/443 (including QUIC / HTTP/3) to LLM API providers is rejected at the OS firewall and POSIX agent process trees (parents + children) are frozen ( | Requires elevation to apply/remove firewall rules. On Windows, live |
4. Cloud Control Plane Sync ( | License / agent key | Remote fleet Master Panic, per-vendor off, and per-scope off pushed from the dashboard latch locally on next | Offline hosts fall back to local + last cached remote state unless |
5. Root / Admin Compromised Host | External control plane | Nothing local can contain an attacker who already owns | Pair with the external Integrity Cloud Control Plane (integrity.subnet.zp.ua) for server-side key revocation and SHA-256 Cloud Witness notarization |
Process-Ancestry Caller Detection Details
Windows: walks Win32
CreateToolhelp32Snapshot, bridges Git/MSYSfork/execchains viaps.exe, and detects browser clients on127.0.0.1viaGetExtendedTcpTable. Orphaned shells (Start-Process pwshwhose parent exited) fail closed asunknown_llm.Linux: walks
/proc/<pid>/stat,exe,comm, andcmdlineup to PID1, checks start times against PID reuse, and re-validates the full chain on a second pass. Detachedtmux/screenshells and non-interactive SSH commands fail closed asunknown_llm; interactive human SSH logins (sshd/sshd-session+SSH_TTY+ live TTY) are recognized asowner.macOS: walks
/bin/ps -axo pid=,ppid=,comm=up tolaunchd(PID1) and resolves loopback dashboard peers via/usr/sbin/lsof(nosudorequired).Anti-spoofing (
--vendor):checkALWAYS runs OS ancestry detection first;--vendorcan never downgrade an OS-detected LLM vendor (e.g., aclaudeprocess passing--vendor codexor--vendor owneris still evaluated asclaude).
Core Commands
# Inspect state and see how your current shell is classified (zero-write)
agent-killswitch status
agent-killswitch status --json
# MASTER RED BUTTON: immediately block all AI agents
agent-killswitch panic --reason "unexpected prod diff"
# Disable one vendor or one action scope
agent-killswitch off claude --reason "investigating loop"
agent-killswitch scope-off deploy
# Gate any script or deploy wrapper (default: exit 0 allowed, exit 3 refused)
agent-killswitch check --action deploy --target prod-api
# Gate AI client hooks (exit 2 + vendor-specific blocking JSON on stdout)
agent-killswitch check --hook-format claude --action deploy
agent-killswitch check --hook-format cursor
agent-killswitch check --hook-format antigravity
# Restore access (MUST be run by the human owner in an interactive shell or browser)
agent-killswitch resume
agent-killswitch on claude
# Launch the localhost-only Web UI dashboard (Same-Origin + peer-PID verified)
agent-killswitch serve --port 8787--hook-format Refusal Matrix
| Refusal Exit Code | Stdout Blocking JSON |
|
| (none; refusal reason on stderr — 100% backwards compatible) |
|
|
|
|
|
|
|
|
|
MCP Server (stdio)
Run a zero-dependency Python stdlib JSON-RPC 2.0 MCP server over stdio so AI coding clients can inspect killswitch state or trip an emergency cutoff directly:
# Installed CLI, zero-install shim, or Python module entry point
agent-killswitch mcp-serve
python killswitch.py mcp-serve
python -m agent_killswitch.mcp_serverTighten-Only Security Invariant: MCP exposes ONLY read and tighten tools (killswitch_status, killswitch_check, killswitch_panic, killswitch_vendor_off, killswitch_scope_off). Restore operations (resume, on, scope-on, net-restore, thaw, uninstall-hooks) are never exposed over MCP and require the human owner in an interactive shell or the localhost Web UI.
Claude Code / Cursor / Antigravity MCP Config
Add to ~/.claude.json (or .mcp.json), ~/.cursor/mcp.json, or ~/.gemini/antigravity/mcp_config.json (pointing to your local clone or .venv Python):
{
"mcpServers": {
"agent-killswitch": {
"command": "python",
"args": ["-m", "agent_killswitch.mcp_server"],
"env": {
"PYTHONPATH": "/path/to/agent-killswitch"
}
}
}
}(If installed into a .venv via pip install --no-deps ., set "command" to your .venv Python executable and omit "PYTHONPATH". Pass ["-m", "agent_killswitch.mcp_server", "--state", "/etc/agent-killswitch/state.json"] to bind to a hardened state file.)
Cloud Control Plane PANIC Sync (cloud-sync)
Connect local agent-killswitch to the Integrity Cloud Control Plane (https://integrity.subnet.zp.ua) so pressing the Dashboard's Big Red PANIC button halts local agents automatically:
# One-shot sync (fetches GET <cloud_url>/api/v1/killswitch/state, 3s timeout)
export INTEGRITY_CLOUD_URL="https://integrity.subnet.zp.ua"
export INTEGRITY_LICENSE_KEY="IHA-your-scoped-agent-key"
agent-killswitch cloud-sync --json
# Or pass flags directly (license key is never written to logs or cache files)
agent-killswitch cloud-sync \
--cloud-url https://integrity.subnet.zp.ua \
--license-key "$INTEGRITY_LICENSE_KEY"
# Automatic TTL-cached sync inside `check` (refreshes every INTEGRITY_CLOUD_TTL seconds, default 15s)
agent-killswitch check --hook-format claude
# Optional strict mode: refuse actions if Cloud Control Plane is unreachable
agent-killswitch check --hook-format claude --cloud-fail-closedWhen remote
master_panic == true,cloud-sync(andcheck) immediately latches localstate.json(master_panic: true) and cachesdisabled_vendorsanddisabled_scopeslocally.When offline,
checkfails safe by enforcing localstate.json+ the last cached remote state (or refuses immediately with--cloud-fail-closed).
1-Command Hook Auto-Installer (install-hooks / uninstall-hooks)
Wire all 5 supported AI coding agents in one command without hand-editing JSON:
# Preview changes safely (zero writes, zero backups created)
agent-killswitch install-hooks --all --dry-run
# Install fail-closed exit-2 hooks across Claude Code, Codex CLI, Cursor, Gemini CLI, and Antigravity
agent-killswitch install-hooks --all
# Or target specific clients with an explicit hardened state path (blocks AGENT_KILLSWITCH_STATE bypass)
agent-killswitch install-hooks --claude --cursor --gemini --state /etc/agent-killswitch/state.json
# Cleanly remove ONLY agent-killswitch entries (owner-only, preserves all other hooks)
agent-killswitch uninstall-hooks --allTarget Flag | Client | Config Path | Native Schema Managed |
| Claude Code |
|
|
| Codex CLI |
|
|
| Cursor |
|
|
| Gemini CLI |
|
|
| Antigravity |
| Top-level |
Safety guarantees:
Reads JSON with
utf-8-sig(handles Windows UTF-8 BOM files without crashing).Resolves the executable dynamically: emits
agent-killswitchonly when onPATH, otherwise"<sys.executable>" -m agent_killswitch.Automatically embeds
--state "<hardened_path>"when--stateis passed or when the OS hardened state file exists (/etc/agent-killswitch/state.jsonorC:\ProgramData\agent-killswitch\state.json).Creates a timestamped
.bakcopy next to any existing file before patching, preserves unrelated hooks/settings, and stays idempotent on re-run.uninstall-hooksis owner-only (exit 3if invoked by an LLM agent).
Absolute Killswitch (OS Network Cutoff + ACL + Freeze)
When cooperative hooks are not enough, escalate to OS-level enforcement:
# 1-command ABSOLUTE KILLSWITCH: Master Panic + OS LLM API firewall cutoff + POSIX SIGSTOP freeze
sudo agent-killswitch panic --network --freeze --reason "runaway agent loop"
# Inspect whether OS network cutoff rules are active (strictly zero-write)
agent-killswitch net-status --json
# Preview any OS cutoff, ACL hardening, or freeze plan safely before applying
agent-killswitch net-cut --dry-run
agent-killswitch freeze --dry-run
agent-killswitch harden --dry-run
# Owner-only full restore (refuses with exit 3 if called by any LLM agent!)
sudo agent-killswitch resume --network --thawOS Network Cutoff (net-cut / net-restore / net-status)
Blocks outbound TCP and UDP 80/443 (closing HTTP/HTTPS and QUIC / HTTP/3) to known LLM API providers (api.anthropic.com, api.openai.com, generativelanguage.googleapis.com, cloudcode-pa.googleapis.com, api2.cursor.sh, api.githubcopilot.com, openrouter.ai, api.x.ai, api.mistral.ai, api.deepseek.com) plus any extra hosts in --endpoints-file PATH:
Linux: applies an isolated
nftablestableinet agent_killswitch_net(meta l4proto { tcp, udp } th dport { 80, 443 } reject), with dedicatediptables/ip6tableschainAGENT_KILLSWITCH_OUTTCP+UDP fallback.Windows (Locale-Independent — works on EN/RU/UK/DE/FR Windows): adds Windows Firewall outbound TCP + UDP block rules prefixed
AgentKillswitch_Block_vianetsh advfirewall(plus optional--block-binaries PATH), and inspects/removes them via PowerShellGet-NetFirewallRule/Remove-NetFirewallRule(zero English text parsing).macOS: loads a dedicated
pfanchorcom.agent-killswitch/cutoff(block return out quick proto { tcp, udp } to <ak_block> port { 80, 443 }) and flushes active states (pfctl -k).Anti-Lockout Guarantee: loopback (
127.0.0.0/8,::1), SSH (TCP 22), DNS (UDP/TCP 53),integrity.subnet.zp.ua, and any--allow-host HOSTare ALWAYS explicitly allowed and stripped from block sets.net-restoreis OWNER-ONLY: fails closed (exit 3) if invoked by any LLM agent.
Process Freeze & Thaw (freeze / thaw)
# Freeze running AI agent process trees (parents + child processes on POSIX)
agent-killswitch freeze --vendor claude
# Resume frozen agent processes (OWNER-ONLY — exit 3 for LLM callers)
agent-killswitch thaw --vendor claudeMatches only executable basenames and interpreter script paths (never substring-matches arbitrary CLI arguments like
vim claude.md), includes descendant child processes on POSIX, and excludes self, parent shells, owner terminals, browsers, andsshd.Sends POSIX
SIGSTOP/SIGCONTon Linux and macOS. On Windows,--dry-runreturnsok: true, supported: falsewith apssuspendplan; livefreeze/thawhonestly returnsok: false, supported: false(exit1) rather than claiming processes were frozen.
OS-Level State ACL Hardening (harden)
Defaults to a system-owned root directory (eliminating mv ~/.agent-killswitch swap bypasses and keeping user ~/.agent-killswitch/audit.jsonl writable):
# Linux / macOS: defaults to /etc/agent-killswitch/state.json (root:root or root:wheel 0755/0644)
sudo agent-killswitch harden
# Windows (elevated pwsh 7): defaults to C:\ProgramData\agent-killswitch\state.json
# Uses universal locale-independent SIDs (*S-1-5-32-544, *S-1-5-18, *S-1-5-32-545)
agent-killswitch hardenOpenSSH Match exec & Python API Examples
Match host prod-* exec "agent-killswitch check --action ssh --target %h --match-blocked"
ProxyCommand /bin/falsefrom agent_killswitch import check_or_refuse
check_or_refuse(action="secrets", target="prod-db-password")Clean Uninstall / Reset-to-Zero
integrity-killswitch installs no background daemons, services, or kernel drivers:
# Linux / macOS
agent-killswitch uninstall-hooks --all
python3 -m pip uninstall -y integrity-killswitch 2>/dev/null || true
rm -rf ~/.agent-killswitch# Windows (PowerShell 7)
agent-killswitch uninstall-hooks --all
python -m pip uninstall -y integrity-killswitch
Remove-Item -Recurse -Force "$HOME\.agent-killswitch" -ErrorAction SilentlyContinueDevelopment & Tests
ruff check agent_killswitch killswitch.py tests agensi-skill/scripts
python -m pytest -qFull Production Suite & Cloud Control Plane
integrity-killswitch is the free open-source foundation of the Integrity Harness ecosystem:
Cloud Control Plane (Hybrid SaaS): integrity.subnet.zp.ua — tamper-evident SHA-256 Cloud Witness notarization, central multi-host Killswitch PANIC API, and team license management.
1-Click MCP Skills & Paid Packs (Agensi Storefront): agensi.io/r/BLACKHOPE
Free Companion OSS Tool: BlackBadHope/agent-token-forensics — read-only JSONL token, prompt-cache, and retry-loop forensics across Claude Code, Codex CLI, Cursor, and Gemini.
License
MIT — see LICENSE.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Dead-man switch for AI agents & cron jobs: heartbeat with state capsule, alerts + resume links
macOS process-tree reaper, simulator runaway guard, and $10/mo token cap for AI coding agents.
Dead-man switch monitors for cron & AI agents with dependency-cascade alerts. No account needed.
Related MCP Servers
- AlicenseAqualityBmaintenanceTerminal multiplexer MCP server for orchestrating parallel AI agents. Manages workspaces, panes, surfaces with send_input/read_screen/spawn_agent/stop_agent tools. Supports Claude Code, Codex, Gemini, Cursor CLI agents with lifecycle management, browser automation, and agent status push via Claude --channels.1031Apache 2.0
- AlicenseAqualityDmaintenanceMCP server for managing interactive processes, enabling AI agents to start, interact with, and terminate long-running programs like SSH sessions, REPLs, and installers via read/write operations.88MIT
- AlicenseBqualityDmaintenanceLocal MCP server for safe inspection and dry-run cleanup of leftover subprocesses from AI coding agents, providing ownership-based classification and reproducible evidence.243Apache 2.0
- AlicenseNot gradedqualityCmaintenanceHarness-agnostic MCP server for orchestrating deterministic, resumable multi-agent workflows. It lets you start, watch, resume, and cancel agent runs from any MCP client, using agents from Codex, Claude, Cursor, or Kimi.5MIT