- Home
- Skills
- Agents & Orchestration
- Stop AI Agents Hanging or Orphaning Windows Processes
More screenshots
Works with the AI Agents you already use
Stop AI Agents Hanging or Orphaning Windows Processes
Windows only. This skill gives coding agents short safety rules plus a standard-library Job Object wrapper that stops the whole process tree when a command ends or exceeds its budget.
$7.99
Stop AI Agents Hanging or Orphaning Windows Processes
Example session with this skill installed
Example request
On my Windows laptop, run the unit tests for the Python project in
C:\work\shop-apiand also start its dev server so I can check the health page. Do not leave anything running afterwards. The tests sometimes spawn helper processes.
(The project is fictional. The wrapper command below was run for real on a stand-in command that starts a detached helper, Python 3.12, Windows 11.)
- Read your context and instructions
- Compiled the stop ai agents
Example output
Guardrail report
Working folder: C:\work\shop-api (temp files in C:\work\shop-api\_tmp_agent, which I created)
Disk free before/after: checked with Get-PSDrive C before starting; stop below 20 GB.
Heavy jobs run, one at a time: (1) unit tests, then (2) the dev server check. The server was not started until the tests had finished.
| Step | Command | Why this way |
|---|---|---|
| 1 | where python, then use the installed interpreter by full path | A WindowsApps result would be the Store stub |
| 2 | python scripts/ticket_run.py --log _tmp_agent/runs.jsonl unit-tests 10 -- <full path to python.exe> -m pytest -q | Job Object: helpers started by the tests die with the run; a 10 minute budget stops it at 15 minutes |
| 3 | Dev server: python serve.py --port 0 through subprocess with CREATE_NO_WINDOW; PID recorded as 18420, port read back from the server's first output line | Free port, hidden window, PID known |
| 4 | curl http://127.0.0.1:<port>/health, then taskkill /PID 18420 /T /F | Stopped by PID, never by name |
| 5 | Get-CimInstance Win32_Process | Where-Object CommandLine -like '*shop-api*' | Leftover check |
What the wrapper prints for a command that starts a detached helper (real run of ticket_run.py on a stand-in script, helper still sleeping for 60 s when the parent exits):
ticket_run: demo-build exit=0 killed_by_budget=False processes=3 survivors_killed=1
and the log line in runs.jsonl records "exit": 0, "processes_started": 3, "survivors_killed": 1. The one survivor was the detached helper; the job killed it when the command ended. scripts/test_ticket_run.py confirms the same on any machine:
RED unwrapped grandchild survives: True (expected True)
GREEN wrapped grandchild is dead: True (expected True)
BUDGET stopped after 4.7 s, exit 1 (expected about 4.5 s, exit 1): True
LOG 2 lines written (expected 2): True
ALL PASS
The PIDs and the port in steps 3 to 5 are illustrative values for the fictional project; the two blocks of program output above are real.
Leftover check: no process mentions the project folder. Destructive actions: none. Git: nothing committed (not asked).
Connects securely to your tools. The creator never sees your data.
About this skill
Windows only. This skill gives coding agents short safety rules plus a standard-library Job Object wrapper that stops the whole process tree when a command ends or exceeds its budget.
The proof
These are real lines saved in example-output.md.
From a wrapped command that left a helper sleeping:
ticket_run: demo-build exit=0 killed_by_budget=False processes=3 survivors_killed=1
From scripts/test_ticket_run.py:
RED unwrapped grandchild survives: True (expected True)
GREEN wrapped grandchild is dead: True (expected True)
BUDGET stopped after 4.7 s, exit 1 (expected about 4.5 s, exit 1): True
LOG 2 lines written (expected 2): True
ALL PASS
What you get
SKILL.md: Windows command, process, file and git guardrails for Claude Code and OpenAI Codex.scripts/ticket_run.py: the standard-library Job Object wrapper.scripts/test_ticket_run.py: the real Windows platform check.example-task.mdandexample-output.md: a worked guardrail report with saved output.TESTING.mdandCHANGELOG.md: tested platform, scope and release notes.
How to use
- Install the skill before an agent starts a Windows ticket.
- Run
scripts/test_ticket_run.pyonce on the machine. - Put long or risky commands behind
scripts/ticket_run.pywith a task name and budget. - Record every PID you start and stop only that PID.
- Run the leftover-process check before reporting done.
Known limitations
- The scripts are Windows only.
- Rules guide an agent; they cannot undo a command that was already allowed to run.
- The wrapper writes a JSON log and kills processes in its own Job Object. It does not judge whether a command is safe.
- A budget is enforced at one and a half times the supplied minutes, not at an exact wall-clock deadline.
FAQ
Does it kill every Python or Node process? No. It kills only the process tree assigned to its Job Object.
Does it need extra packages? No. The wrapper and platform test use the Python standard library.
Which agents does it work with? It is a SKILL.md skill for Claude Code and OpenAI Codex.
Does it write files? Yes. The wrapper appends a JSON line to the log path you choose.
Can I use the wrapper on macOS or Linux? No. It uses Windows Job Objects.
Requires Windows and Python 3.8+. Not compatible with macOS or Linux. Wrapped commands cannot leave persistent processes running after completion.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before any payment.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 4 days ago
Requires