Use cases & examples
Real-world scenarios showing how to use Sudoji on a production Linux server.
First install on a new server
The recommended workflow when you set up Sudoji on a new server for the first time. Takes about two minutes.
npm install -g @sudoji/cliSUDOJI_NO_KEYCHAIN=1 sudoji login --paste sudoji_sk_your_key_heresudoji doctorsudoji context "Ubuntu 22.04 LTS. Nginx 1.24 reverse proxy. Node 20 + PM2 for api.example.com. PostgreSQL 15 on port 5432. Production — handle with care."sudo npm install -g pm2
pm2 start $(which sudoji) --name sudoji-daemon --interpreter none -- daemon
pm2 save
pm2 startup # run the command it prints to survive rebootssudoji ask "give me a quick health summary of this server"Profile a device or migrate a server
Two built-in tools, runnable with sudoji tool <name> or from the portal's + run tool ▾ chat menu — no need to phrase a natural-language request.
sudoji tool knowmesudoji tool exportconfigscp old-server:~/.sudoji/exports/server-export-*.md .npm install -g @sudoji/cli
sudoji login
sudoji doctorDiagnose a service failure
nginx is returning 502, a pm2 process crashed, or something is clearly wrong. Sudoji narrows down the root cause in one command.
sudoji ask "nginx is returning 502 after my last deploy — what is wrong?"Once you understand the cause, switch to fix mode:
sudoji do "nginx is returning 502, find the cause and fix it"sudoji ask "my pm2 app called api keeps crashing with exit code 1 — what is causing it?"sudoji logs --source pm2 --unit api --tail 200sudoji do "fix the pm2 api crash"Disk space management
When a server is running low on disk space, Sudoji can identify the culprits and clean them up safely.
sudoji ask "the disk is at 90%, what is taking up all the space?"sudoji do "check disk space and safely free up space — don't delete anything important"Safe system package updates
Keeping packages up to date is important but can be risky on production. Sudoji checks what will change before applying.
sudoji ask "what packages need updating on this server and are any of them security-critical?"Once you know what will change:
sudoji do "update all system packages safely"Log analysis
sudoji logs is the fastest way to get the agent to look at service logs — it handles the redaction and context bundling automatically.
sudoji logs --source systemd --unit nginxsudoji logs --source systemd --unit postgres --since "30 minutes ago"sudoji logs --source pm2 --unit api --tail 200sudoji logs --source file --file /var/log/myapp/error.log --tail 50Performance investigation
High CPU, memory exhaustion, or slow response times — the agent can read /proc data, check running processes, and identify the bottleneck.
sudoji ask "the server CPU is at 100%, what is causing it?"sudoji do "the CPU is at 100% — identify the cause and fix it"sudoji ask "a process is consuming all RAM and the server is swapping heavily — what should I do?"sudoji do "identify the memory-hungry process and restart it safely"Recurring checks with persistent context
Once you set context with sudoji context, every subsequent command automatically knows what server it is running on. This makes day-to-day queries much faster.
sudoji context "Ubuntu 22.04. Production API server. nginx + Node 20 + PM2 + PostgreSQL 15. 4 vCPUs, 16GB RAM. No Docker."sudoji ask "quick health summary — any warnings I should know about?"sudoji ask "is postgres running normally and are there any slow queries?"
sudoji ask "how is nginx performing, any error rate spikes?"
sudoji ask "any cron jobs that have not run in the last 24 hours?"sudoji do "restart any services that are in a failed state"Planning with Sudoji before making changes
Use sudoji chat (or the portal Chat tab with the daemon running) in diagnose mode to talk through a planned change before executing anything. The agent reads your server state, identifies risks, and proposes an ordered set of steps.
sudoji chat
sudoji › I want to migrate my api process from pm2 to systemd — plan it for me
[agent reads pm2 process list, checks for existing units…]
› Here's the migration plan:
1. Generate a systemd unit from your pm2 config
2. Test the unit starts correctly
3. Disable pm2 start for this process
4. Enable the systemd unit
sudoji › show me what the unit file would look like
› [Unit]
Description=API Service
After=network.target
…
sudoji › what are the risks?
› Main risk: if the unit fails to start, the api will be down until you re-enable pm2.
Safeguard: keep pm2 running until you verify the systemd unit is stable.
sudoji › exitOnce you are happy with the plan:
sudoji chat --mode fix
sudoji › create the systemd unit for the api process and enable it
allow? run systemctl daemon-reload [y/N] y
allow? run systemctl enable --now api.service [y/N] y
✓ Done.Monitoring from the portal
Every sudoji ask, sudoji chat, and sudoji do session is recorded in the Sudoji portal under Sessions. Two tabs organise the view:
+ run tool ▾ menu triggers KnowMe or ExportServerConfig directly. When a command needs approval you'll see Approve / Approve all / Deny buttons, and a ■ stop button appears in the header while a turn is running — see the daemon & portal chat guide.