termique
Blog
Guide9 min read

Debug production errors with an AI assistant over SSH

A practical workflow for debugging production errors with an AI assistant over ssh: real commands, guardrails, and where AI actually helps in 2026.

Debug production errors with an AI assistant over SSH

It’s 2am and the deploy that shipped six hours ago just started throwing 500s in production. You’re SSH’d into the box, tailing logs, and the stack trace is forty frames deep with three of your own services in the call chain. This is exactly the moment people start asking how to debug production errors with an ai assistant over ssh: not as a novelty, but because reading a trace at 2am is slower than having something read it alongside you.

The honest answer is that an AI assistant helps a lot with the first ten minutes of an incident, the part where you’re building context, and helps very little with the part where you actually understand your own system’s business logic. Where it lands in between depends on how much you let it touch the machine, and how much of what it touches gets logged.

What does debugging production errors with an ai assistant over ssh actually look like in 2026?

Strip away the marketing and it’s a small loop repeated a few times: you SSH into the affected host, pull the raw evidence (logs, process state, recent deploys), hand the relevant slice to an assistant that has context on which host you’re connected to, get back an explanation or a candidate diagnostic command, review it, and run it yourself. The loop only breaks down when a step gets skipped, usually the review step.

There are two broad shapes this takes today. The first is a general-purpose coding agent, like Claude Code or Codex CLI, running with shell access on or near the server, capable of making changes on its own. That’s a different, more autonomous workflow covered in how to run ai coding agents on remote servers via ssh. The second is an assistant scoped to a single SSH session, aware of the host you’re on and the commands you’ve run, that proposes but does not execute. For a live production incident, the second shape is the safer default, and it’s the one this article focuses on.

Where an ai assistant actually helps when debugging production errors

Where it speeds things up

The genuinely useful part of AI-assisted debugging is triage, not resolution. An assistant is good at the mechanical work of turning noise into signal fast.

  • Explaining an unfamiliar stack trace in a framework or language you don’t touch daily.
  • Turning a wall of repeated exceptions into one root cause showing up hundreds of times, instead of hundreds of separate incidents.
  • Drafting the diagnostic command you’d otherwise have to look up: the right journalctl flags, the right grep pattern for a specific error code.
  • Correlating when an error first appeared against your recent deploy timeline, so you’re not debugging code that shipped three releases ago.

Where it doesn’t help

An assistant has no access to context you don’t give it, and no understanding of your business logic beyond what’s in the code and logs in front of it. It can’t tell you a refund total is wrong because the calculation is legitimate but based on a stale exchange rate, that’s a domain problem, not a syntax problem. It can’t see data it wasn’t shown, and it can produce a plausible-sounding explanation for a genuinely novel bug that turns out to be wrong. Silent data corruption in particular needs a person who understands what the data is supposed to mean, not a pattern-matcher. For a longer, more skeptical breakdown of these limits, see what an ai assistant inside a terminal session can and can’t do.

A real production debugging session over ssh, step by step

Here’s what the loop looks like end to end, using a fictional but typical incident: a payments API starts returning 500s about two hours after a deploy.

Reproducing the error first

Before opening any AI chat, gather the raw evidence. This is the part an assistant can’t do for you, since it needs you to actually be on the box.

journalctl -u payments-api --since "-2h" --no-pager
docker logs payments-api --tail 200 --timestamps
tail -f /var/log/nginx/error.log
systemctl status payments-api
ps aux --sort=-%mem | head -n 10

Asking the assistant to explain the trace, not just paste it

Paste the stack trace along with the deploy timestamp and ask for an explanation, layer by layer, before asking for a fix. A good follow-up is asking what would confirm or rule out a specific hypothesis, for example checking whether a connection pool is exhausted, whether disk is full, or whether memory pressure caused the process to restart mid-request.

  • “Walk me through this trace one frame at a time, what’s actually failing?”
  • “What command would confirm the database connection pool is exhausted right now?”
  • “Is there a config change in the last deploy that would explain this specific error?”

Reviewing the suggested command before anything runs

The assistant might suggest restarting a service, killing a stuck process, or running a diagnostic query against production data. None of that should execute automatically. Read the command, confirm it targets the host you think it does, and run it yourself. This single review step is the difference between a debugging aid and a foot-gun sitting next to a box serving real traffic.

Confirming the fix before you close the incident

Once a hypothesis holds up, whether it’s a connection pool that needed a higher ceiling or a bad config value from the last deploy, confirm it with the same rigor you used to diagnose it. Watch the error rate after applying the change instead of assuming a restart fixed it.

watch -n 5 'journalctl -u payments-api --since "-2m" | grep -c ERROR'
curl -s -o /dev/null -w "%{http_code}\n" https://internal.example.com/health

If the error count doesn’t drop within a few minutes, the assistant’s hypothesis was wrong, not necessarily useless, but wrong, and it’s worth saying so back to it before asking for a second one. Treating a wrong first guess as a normal part of the loop, rather than a failure of the tool, keeps the incident moving instead of stalling on one bad theory.

How do you keep an ai assistant from making a production incident worse?

Propose, don’t auto-run

termique’s per-session AI assistant is built around this exact boundary: it’s aware of which host is active in your current session and can suggest commands, but it never executes anything on its own, you approve each one. The hosted mode runs on termique’s backend with Cloudflare Workers AI and needs no API key, with 15 prompts a day on the free plan; a custom mode lets you point it at your own OpenAI-compatible endpoint. Pro raises the hosted quota to 100 prompts a day and adds memory across sessions.

Per-command audit logs for anything that did run

Every command that actually runs in a session, whether you typed it yourself or approved it from a suggestion, gets a timestamped entry in a per-command audit log. During a postmortem that log is the difference between guessing what happened on the production box during the incident and knowing exactly what ran and when. It also matters for the broader question of letting an agent anywhere near a shell with real access, covered in the security risks of letting an ai coding agent run shell commands.

Scoped credentials and host-level boundaries

Don’t hand a coding agent, or an assistant, the same broad SSH key that reaches every host in your fleet. Scope credentials per host, share access to a single host without exposing the underlying credential, and keep production hosts under the same encryption model as everything else: credentials encrypted end-to-end on-device before they ever leave the machine, private keys held in the OS keychain rather than a server database. The full model is in the complete guide to ssh security.

Generic coding agents vs a per-session ai assistant built into your ssh manager

These solve different problems. A generic coding agent like Claude Code or Codex CLI running with shell access on a remote box, as described in running ai coding agents on remote servers over ssh, is genuinely useful for planned engineering work: building a feature, running a migration, refactoring a module, where autonomous execution and iteration save real time. A per-session assistant scoped to one SSH connection, that only sees what happens in that session and only proposes commands, fits a live production incident better, because the person driving the box is the one who has to own the incident timeline and explain it afterward. The audit log is what makes the difference legible after the fact: which commands were typed, which were proposed, and which were approved.

Picture the same incident handled both ways. An autonomous agent given shell access might diagnose the connection pool issue and quietly raise the limit itself, which resolves the symptom but leaves nobody sure why the pool was undersized in the first place, or whether the change is safe under next week’s traffic. A propose-and-approve assistant surfaces the same finding, but you’re the one who decides whether to raise the limit, roll back the deploy, or dig further, and that decision is what ends up in the postmortem instead of a diff nobody remembers approving.

A checklist for ai-assisted production debugging over ssh

  • Reproduce and capture raw logs before opening any AI chat.
  • Give the assistant the actual trace and deploy timeline, not a vague description of symptoms.
  • Ask it to explain the failure before asking it to fix anything.
  • Treat every suggested command as a proposal, review it before running it.
  • Confirm the command targets the host you think it does, especially under fleet-wide access.
  • Check the per-command audit log after the incident, not just during it.
  • Scope credentials per host, never one key covering the whole fleet.
  • Write down what actually fixed it, for whoever is on call next.

Debug faster without losing control of production

The point of an AI assistant during an incident isn’t to hand over the keyboard, it’s to cut the time between “something is broken” and “I understand why.” termique’s per-session AI assistant keeps that boundary explicit: it knows which host you’re connected to, proposes commands instead of running them, and every command that does run lands in a per-command audit log you can review afterward. It’s available on the free plan (15 hosted prompts a day, no API key required), with Pro ($5/month) raising that to 100 prompts a day plus memory across sessions, alongside host sharing and full audit logs for teams debugging shared infrastructure.

termique is a free ssh manager with a per-session AI assistant, per-command audit logs, and end-to-end encrypted credentials. Free tier covers 3 hosts and 15 hosted AI prompts a day, no API key needed.

Try termique free.

SSH manager with end-to-end encrypted credentials, AI assistant, and cross-device sync.

Download free

Keep reading

All articles ⟶