Logo: Respawn

Respawn

Communautéit
vicnaum
respawn

Restart the current Claude Code or Codex CLI in its own terminal (iTerm2 window or tmux pane), or the current Claude Code background session (claude --bg / ←, no terminal), and resume a session — the external relaunch step an agent cannot perform on itself. Use when: (1) the session's context is nearly full and was just stripped with session-stripper, so the stripped pending copy must be swapped in (--swap) and the CLI restarted to load the smaller transcript, (2) resuming a forked stripped session under a new session id, (3) the user or the agent says respawn, restart yourself, restart the CLI, reload the session, or resume after strip. Backends: iTerm2 (macOS), tmux (works headless, e.g. Linux servers) and Claude Code background sessions.

Iwwersiicht

Editeurvicnaum
Repositoryvics-agent-skills
Skill-Nummrespawn
Stären
53
Forks
5
Matgeliwwert Dateien
2
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 2 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    vicnaum huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Respawn an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/vicnaum/vics-agent-skills/tree/main/skills/respawn
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/vicnaum/vics-agent-skills.git /tmp/vics-agent-skills
mkdir -p .claude/skills
cp -r /tmp/vics-agent-skills/skills/respawn .claude/skills/respawn
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Respawn an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Respawn automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Respawn net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Respawn

Restarts the calling Claude Code or Codex CLI in its verified iTerm2 session or tmux pane, or the calling Claude Code background session through its daemon, and resumes a session. Requires the companion agent-chat skill/CLI, which provides the shared identity and terminal ownership checks. Companion to session-stripper: a CLI restart loads the stripped transcript as smaller context.

Workflow (context nearly full)

Run inside the session that needs restarting:

  1. Strip first — use the session-stripper skill. Its mutating commands are copy-first: they write <session>.jsonl.pending and never touch the live file, so stripping your own running session is safe. Verify the pending copy. (If stripping forked to a NEW session id instead, note that id for step 2 — forks need no swap.)
  2. Schedule the respawn — this must be the LAST tool call of the turn:
bash
<skill-dir>/scripts/respawn.sh --swap <session.jsonl>.pending   # stripped in place: swap + resume this session's id
<skill-dir>/scripts/respawn.sh <new-session-id>                 # forked strip: resume the fork (no swap)
<skill-dir>/scripts/respawn.sh                                  # plain restart, nothing to swap
  1. End the turn immediately — reply with one short line (e.g. "Respawning now, back shortly") and stop. Do not keep working after scheduling a real respawn. The watcher will recheck ownership, then stop the captured CLI. A dry run does not schedule anything and need not be the last tool call.

--swap applies the session surgery at the only race-free moment: after the watcher has confirmed the CLI process is dead, before relaunch. It runs session-stripper's apply (atomic rename; refuses on lineage/liveness/verify failures). If apply refuses, the watcher relaunches the UNSTRIPPED session and rewrites the kickoff prompt to say so — fail-open, nothing is lost. Whatever the CLI appended after the snapshot (the stripping turn itself) is discarded by design.

How it works

respawn.sh asks agent-chat whereami for the calling CLI, session and pane. It uses the sibling checkout's CLI when available, so an older PATH install cannot bypass the guard. Conflicting inherited session variables are resolved through the nearest CLI ancestor; ambiguous identity refuses. The scheduler verifies the foreground session and captures its pid/birth time, tty, and parent shell pid/birth time before detaching the watcher. The resume id may differ after a fork; the identity stopped is always the original calling session.

For Claude Code, the launch command is rebuilt from its exact argv (sysctl on macOS, /proc on Linux; ps joins arguments and loses quoting). Flags are preserved except session/worktree selectors: -c/--continue, -r/--resume [id], --from-pr [ref], --session-id <id>, --fork-session, -w/--worktree [name]/--tmux, --bg. Any prompt the CLI was launched with is dropped too; agents started by agent-chat carry their kickoff there. Then --resume <sid> is appended. --cmd "claude ..." overrides reconstruction.

The detached watcher then:

  1. Waits --grace N seconds (default 15), then verifies the original foreground session and process identity again. A changed thread, replaced process or pane causes refusal before input/signals. A CLI that already exited is accepted only in its verified original shell.
  2. Stops the captured CLI: Codex receives SIGTERM by verified pid, with no terminal quit keys. Claude receives /exit plus a separately guarded Enter; it can queue until turn end. When background shells or agents are running, Claude Code then asks "Background work is running": 1. Exit and stop tasks / 2. Move to background and exit / 3. Stay. The watcher confirms the default with Enter, and only while the selection is on "Exit and stop tasks". Those shells die with the CLI, and the default kickoff tells the agent to re-arm the ones it needs, such as an agent-chat watch. The watcher waits up to 15 minutes, or 20s with --force, and rechecks ownership before signal escalation. It never retargets a different pid that appeared on the tty.
  3. With --swap, applies the pending Claude transcript only after the original CLI is gone. On apply refusal it retains the original and rewrites the kickoff to explain that the session is unstripped.
  4. Verifies the original foreground shell before typing the launch line and again before Enter. The kickoff is a quoted command-line argument, including after a failed swap; nothing is typed into a booting TUI.
  5. Waits up to 60s for the resumed session to be proved in the same pane under the original shell. Startup failure or a dialog produces a logged failure and no additional input.

Log: ~/.claude/respawn/respawn.log.

Claude Code background sessions

A session started with claude --bg, or moved there with ← or /background, has no pane: its worker runs on a pty the daemon owns. Typing /exit in a terminal attached to it only detaches, and claude --resume <id> refuses while it runs. agent-chat whereami reports it as bg <job>, and the proof is Claude Code's own live record (pid, start time, job). The watcher:

  1. After the grace period, re-proves the worker and waits until the session reports idle, so its last reply is never cut off (up to 15 minutes, or 20s with --force).
  2. Records every terminal running claude attach <job> directly under a shell, then runs claude stop <job> and waits for the worker to exit. It then waits for the daemon's bg settled <job> line: a wake sent before that starts a copy under a new id instead of resuming.
  3. Applies --swap while nothing runs, as in the terminal flow.
  4. Runs claude --bg --resume <sid> '<kickoff>'. The daemon wakes the same job with its saved options. A forked strip resumes the new id with the job's saved options passed explicitly. If the daemon reports that it started a copy, the watcher stops and logs it.
  5. Verifies the new worker holds the session, then types claude attach <job> back into each recorded terminal, but only once its old client has exited and its original shell is at the prompt.

Claude Code's built-in claude respawn <job> restarts a background worker (e.g. onto a new version) in one step. That leaves no moment to swap a transcript, so this skill does not use it.

OpenAI Codex sessions

Codex resumes with codex resume <thread-id> '<kickoff>'. Settings come from Codex configuration; use --cmd "codex --profile x" when an explicit profile/flags are needed. Only self-respawn when about to end the turn: stopping the frontend interrupts interactive use.

Codex tool shells run in a shared daemon, so terminal environment variables and tty ancestry cannot select this session's pane. A unique current thread-id title is required. Run agent-chat setup-codex --title-id, restart the affected TUI, then register. Original launch arguments, registration text and cached bindings are insufficient after a thread switch. The watcher checks the same current-thread evidence again after its delay. There is no ownership override.

Verification / caveats

  • --dry-run synchronously verifies the pane, session, process and parent shell and prints the proposed restart. It starts no watcher and sends no input/signals or swaps.
  • Avoid scheduling while a human is editing that terminal. Ownership checks do not preserve a draft already sitting at its prompt.
  • After a forked strip (new session id), anything keyed to the old id (e.g. an agent-chat registration) is stale — redo it in the resumed session.

The shared regression suite is python3 -m unittest discover -s skills/agent-chat/tests -v from the repository root. Unit tests mock terminal and signal operations; an optional private-tmux test uses a dummy TUI. They exercise successful restarts and changed-session, PID-reuse, failed-startup, failed-write and swap-refusal paths without contacting real agents.

Matgeliwwert Dateien

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Respawn?

Restart the current Claude Code or Codex CLI in its own terminal (iTerm2 window or tmux pane), or the current Claude Code background session (claude --bg / ←, no terminal), and resume a session — the external relaunch step an agent cannot perform on itself. Use when: (1) the session's context is nearly full and was just stripped with session-stripper, so the stripped pending copy must be swapped in (--swap) and the CLI restarted to load the smaller transcript, (2) resuming a forked stripped session under a new session id, (3) the user or the agent says respawn, restart yourself, restart the...

Firwat Respawn op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Respawn besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Respawn an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/vicnaum/vics-agent-skills/tree/main/skills/respawn an. TypingMind liest d'Datei SKILL.md, bëndelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Respawn benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Respawn benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Respawn domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Respawn gratis?

vicnaum huet de Skill op GitHub publizéiert. Kuckt am Repository no de Lizenzbedéngungen. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇