# Terminal Lag Recovery

> Recover a sluggish or stalling Codex terminal typing interface by inspecting and terminating unused zeroclaw processes. Use when the user says the CLI, terminal UI, Codex TUI, typing interface, or input responsiveness is lagging, stalling, slow, frozen, or delayed and asks for system recovery, cleanup, or killing zeroclaw workers/threads/processes.

- Skill: `careylzh/terminal-lag-recovery` (Agent Skill, multi-file: 3 files)
- Install (CLI): `npx skillmds@latest add careylzh/terminal-lag-recovery`
- Raw SKILL.md: https://api.skillmd.com/api/skills/careylzh/terminal-lag-recovery/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: careylzh (https://skillmd.com/u/careylzh)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/careylzh/terminal-lag-recovery

---


# Terminal Lag Recovery

## Recovery Workflow

Use this skill when interactive typing in the Codex terminal has become slow or stalled and the user wants local recovery.

1. Inspect for `zeroclaw` processes before killing anything:

   ```bash
   ps -axo pid,ppid,stat,etime,pcpu,pmem,command | rg -i 'zeroclaw|codex'
   ```

2. Run the bundled recovery script:

   ```bash
   python3 ~/.codex/skills/terminal-lag-recovery/scripts/recover_zeroclaw.py
   ```

3. If the sandbox cannot read the process table or send signals, rerun the same command with escalated approval. Use a concise justification such as: "Do you want to allow targeted zeroclaw process cleanup to recover the lagging terminal UI?"

4. Report what happened:
   - Say how many `zeroclaw` processes were found and terminated.
   - If none were found, say the cleanup was a no-op and mention any obvious high-CPU process only if you inspected it.
   - Do not terminate `codex cli`, Terminal, shell, or unrelated system agents as part of this skill.

## Escalation

Start with `SIGTERM`. Use `SIGKILL` only when the user explicitly asks for a stronger cleanup or when a previously matched `zeroclaw` process survives `SIGTERM` and the user has approved escalation:

```bash
python3 ~/.codex/skills/terminal-lag-recovery/scripts/recover_zeroclaw.py --kill
```

## Notes

- Treat "zeroclaw threads" as OS processes unless a managed-agent API explicitly exposes closable zeroclaw sessions.
- A `pkill -TERM -if zeroclaw` fallback is acceptable when the script is unavailable, but the script is preferred because it prints the exact matched PIDs.
- If process inspection shows no `zeroclaw` process, do not invent a cleanup. State that no matching processes were present.

