auto-handoff

Reviewed at commit 8d762ce

Caution: Starts a background web server that keeps running after Claude Code exits and serves your session briefs, without a login, to your Tailscale network.

Hands a Claude Code session off to a fresh one before the context fills: a Haiku-written brief, /clear, and a seed that points the new session at the brief.

Made by
Alex Hillman
What we checked

When the context nears a token threshold (160k by default), it has Haiku on your own account write a brief of the session, runs /clear and tells the fresh session to read the brief. Briefs are saved under ~/.claude/state/auto-handoff and served as web pages by a local server. It refuses tool calls once a handoff is due.

Review details

Static review of the source at the pinned commit; not run. Hooks: turn.complete, turn.step, tool.call, session.compact, prompt.submit, classic.SessionStart and ui.render (AbovePrompt panel, seed row). It reads the session messages and usage ($.session.messages/usage), asks Haiku via $.model.complete for a brief, then writes it with $.fs.write to ~/.claude/state/auto-handoff/<session>.md, writes HTML pages to .../pages and a log file, and copies its two template files into ~/.claude/auto-handoff/ if missing. It runs /clear and submits a seed prompt via $.command.run and $.prompt.submit. tool.call denies calls past the threshold; turn.step ends the turn with a text notice; session.compact skips auto-compact in favour of a handoff. A loop guard stops after 2 handoffs without a user prompt. Programs run: sh (log append, mkdir, launching the server), tailscale ip -4, and a detached node -e static file server (setsid/nohup) serving only <name>.html files from the pages folder on the Tailscale IP port 3846 (127.0.0.1 without Tailscale), unauthenticated, kept alive across sessions and restarted when found dead. The pages load fonts from Google Fonts and marked and DOMPurify from cdnjs in the viewer's browser, without integrity hashes; the mod itself makes no outbound requests. Briefs can contain code, file paths and anything discussed in the session. Env vars read: HOME, USERPROFILE, AUTO_HANDOFF_DISABLE, DISABLE_AUTO_COMPACT, AUTO_HANDOFF_TOKENS. Blank viewer setting disables the server. Failures are logged and the session carries on. The shipped templates/ markdown (brief.md, instructions.md) are prompt text and were only skimmed: they tell Haiku which sections to write and tell the fresh session to read the brief and continue.

What it uses
  • Reads your prompts: yes
  • Sees tool calls: yes
  • Blocks or changes tool calls: yes
  • Reads or writes files: yes
  • Runs programs on your machine: yes
  • Calls the model (uses tokens): yes
  • Sends data over the network: no
  • Stores data: yes
  • Shows something on screen: yes
Made this mod? Add a badge to your README

modsforClaude badge for auto-handoff

Paste this into your README. The badge says reviewed once the current version has been reviewed, and links readers to this page.

[![Listed on modsforClaude](https://modsforclaude.com/badge/auto-handoff.svg)](https://modsforclaude.com/mods/auto-handoff/)

← All mods