← Back to library

Have a local agent diagnose a crashing server process

Flavio Copes watched Claude Code get killed seconds after launch on his small newsletter server. From his Mac he launched Codex CLI, explained how to reach the box over SSH and described the symptom without offering a theory. Codex stated a hypothesis, read kernel logs, found the out-of-memory killer at work with no swap configured, and suggested fixes.

  • OutcomeFind out why something keeps dying on a server by letting an agent on your laptop investigate over SSH, before anything is changed.
  • SetupMinutes
  • LevelIntermediate
  • CreditFlavio Copes
View original
Works with
Custom agent

Published Oct 23, 2026Updated Oct 23, 2026AI dry run on sample input: passed Oct 23, 2026Source verified Oct 23, 2026

When should you use it?

  • A process on a server dies without a clear error
  • You can reach the box over SSH from your laptop
  • You want an explanation before any fix

Not for: Production systems where even read commands need change approval; Handing out root keys you cannot revoke

What do you need, and what do you get?

You need

  • Login details for reaching the machine
  • A plain description of the symptom

You get

  • A stated hypothesis and the evidence checked
  • A diagnosis with ranked fixes
  • No changes made until you approve

How does it work, step by step?

  1. Run the agent locallyKeep it on your own machine and let it connect out to the server.
  2. Describe, do not diagnoseGive the symptom only, so you get an unbiased investigation.
  3. Approve each remote commandRead every command before it runs, especially as root.
  4. Ask for evidenceExpect it to check memory, processes, limits and kernel logs and quote what it found.
  5. Choose the fix yourselfPick from its options, such as adding swap or resizing, and apply it deliberately.

The prompt

Our own prompt, inspired by Flavio Copes and written to work in Custom agent. Values in lime are placeholders.

Prompt0 variables
Connect to my server with: [ssh command]. Problem: [symptom, e.g. a process is killed a few seconds after starting]. Do not change anything. First state your hypothesis and which logs or commands will confirm it. Then check memory, swap, running processes, limits and kernel logs, quoting the relevant lines. End with the likely cause plus a short ranked list of remedies, noting effort and cost. Wait for me to choose before making any change.

Inspired by Flavio Copes: Debugging a process killed on my server with Codex. The prompt above is written by playbooks.bot in our own words; nothing from the original is quoted.

What can go wrong?

  • Giving an agent root SSH is powerful; prefer a limited user if diagnosis allows it.
  • Fixes like resizing cost money; the agent should propose, not decide.

Our take

Flavio Copes points to the behavior worth demanding from any troubleshooting agent: a hypothesis first, then evidence, then options, with nothing changed along the way. That is how a careful engineer approaches a production box, and you can write it into the prompt explicitly, along with an instruction to stop before making any change. Describing the symptom without your own theory is a subtle but valuable choice, because it avoids steering the agent toward a wrong guess that it will then try to confirm. Running the agent on your laptop and connecting over SSH keeps the struggling server from having to host yet another memory-hungry process, which mattered here since memory was the problem. Approve each remote command rather than granting blanket permission, and prefer read-only commands such as log inspection during diagnosis. When it proposes fixes, like adding swap or limiting memory for a service, choose and apply them yourself, and note what you changed. Set up a simple memory alert afterward so the next out-of-memory kill is noticed before users notice.

Where the time goes back: Log-reading you might not know how to do is handled in minutes, and you still decide the fix.

FAQ

What was the cause?
The kernel's out-of-memory killer: the tool needed far more memory than was free on a small box with no swap.
Did the agent change anything?
No. It reported its findings and options and explicitly made no changes.

Source and credit

Inspired by Flavio Copes. We describe the idea in our own words, link to the original, and wrote the prompt ourselves; nothing is quoted.

Inspired by
Debugging a process killed on my server with Codex
Creator
Flavio Copes
Published on
flaviocopes.com
Original date
Sep 15, 2026
License
Not openly licensed (the poster keeps all rights), so we quote nothing and link to the original
Originally for
Custom agent
AI dry run
Oct 23, 2026: passed. Dry-run tested by our AI test agent on sample input. PASS: Gates held on desk check; no live sends or purchases.
AI dry run on sample data; not run with live connected accounts. The playbooks.bot test agent filled the prompt with synthetic inputs, produced the output and checked it against the page's stated outputs and guardrails.
Verified
Oct 23, 2026: source link resolves to the original, the credited creator published it, our excerpt or prompt matches it, and the license allows our use.

Are you the creator? Claim or correct this page.

More in IT & Security

All 82 IT & Security playbooks →

Related playbooks

IT & SecurityPrompt✓ AI dry run

Audit which of your bots could spend from a saved card

Have your assistant map which bots and scheduled jobs could reach a checkout, renewal or subscription using a stored card, compare that with your current approval settings, and return a table of risks and the five most important fixes, without buying anything, revealing card details or changing settings.

Credit: Michael Fenech (@Michael_Fenech_)

Minutes
IT & SecurityPrompt✓ AI dry run

Plan a least-privilege move of your agent's Google access

Get a written, reviewable plan for moving an agent's Gmail, Calendar and Drive access onto Google's agent interfaces, with the current setup kept as a fallback, read-only grants first, proof that writes fail, and no cutover until a side-by-side run is clean.

Credit: u/rlnerd on r/hermesagent

An afternoon+
IT & SecurityPrompt✓ AI dry run

Audit where your agents trust tool results blindly

Have an overseeing agent review your other agents and list every place a tool's answer is acted on without a check, with fixes ranked.

Credit: Michael Fenech (@Michael_Fenech_)

Under an hour
IT & SecurityRoutine✓ AI dry run

Get a memory check that asks before closing apps

Have an always-on assistant watch your computer's memory, text you what is using it, and close only what you approve.

Credit: Adam (@Adamdesgns)

Minutes
IT & SecurityPrompt✓ AI dry run

Make a security audit your new agent's first job

Close obvious holes on the server running your always-on agent before you give it access to anything else.

Credit: Jonathan Shriftman

Under an hour