agentleFS
binay-pybinay-py/claude-skills/skills/session-handoff/SKILL.md

session-handoff

Skill1 starsChanged 6 days agoMITView on GitHub

Keep long Claude Code sessions from eating usage limits. `write` builds a HANDOFF.md from the session log (files edited, commands run, recent requests, last todo list, git status and recent commits, secrets redacted) with sections Claude fills in (goal, done, decisions, open problems, next steps), so the user can /clear and continue in a cheap fresh session. `meter` is a Stop hook that warns the user when the context passes ~150k tokens. Use when a session is long or drifting, when the user says "write a handoff", "summarize where we are", "I need to restart", or when context warnings appear.

143 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use ascii-diagram, research-fleet and 10 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • SethGammonSkill

    ascii-diagram

    Generate perfectly aligned ASCII diagrams — architecture, flow, sequence, box-and-arrow. Uses a programmatic character-grid approach so alignment is guaranteed by math, not token prediction. Includes post-render verification.

    Also in 4 projects that use this

  • SethGammonSkill

    research-fleet

    Parallel research using Fleet wave mechanics. Spawns multiple scout agents, each investigating a different angle of the same question. Findings are compressed between waves. Produces a unified research brief from multiple independent perspectives.

    Also in 3 projects that use this

  • vicoa-aiSkill

    live-preview

    Start a local app in the current user project, expose it through a tunnel, and return preview details in structured Markdown. Use when the user asks for a preview URL, public URL, shareable localhost, mobile/web preview, or tunnel setup.

    Also in 4 projects that use this

  • botlearn-aiSkill

    doc-gen

    Also in 4 projects that use this

  • flyingobsidianSkill

    terminology

    Read a codebase, find terminology, create/update definitions into a markdown document.

    Also in 3 projects that use this

  • Dizzy-TenSkill

    bug-diagnosis

    Diagnose bugs and product issues without modifying code. Use when the user explicitly invokes $bug-diagnosis or asks for diagnosis, root-cause analysis, issue classification, or fix strategy for code bugs, failing tests, configuration/dependency problems, deployment issues, performance regressions, data anomalies, or frontend/user-experience problems described through screenshots, annotations, logs, errors, or natural-language reports. Prioritize analysis and recommendations only; do not edit files.

    Also in 3 projects that use this

  • +1 more from SethGammon

The file

We split this skill into the rules it gives an agent

1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.

  • 0

    Common

    Most of the 121 edited versions we read keep these.

  • 0

    Distinctive

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    After each reply it reads the tail of the transcript.

    line 23

“Common” is measured: kept by at least 6 in 10 of the 121 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

session-handoff

scripts/handoff.mjs is zero-dependency Node 22+ and reads the local logs in ~/.claude/projects/.

Every message in a session re-sends the whole context. At 300k+ tokens even "thanks" costs as much as reading a book, and the claude-token-audit skill usually shows a few long sessions eating most of the usage. A good handoff plus /clear resets that to a few thousand tokens.

Writing a handoff (when the user asks, or the meter fires)

  1. node handoff.mjs write (in the project folder). It picks this session automatically, even with several Claude Code windows open. --session <id-prefix> or --transcript <file> choose explicitly; --out changes the file name.
  2. Open HANDOFF.md and replace every <!-- CLAUDE: … --> placeholder from your knowledge of the session. Be short and concrete: real file names, exact error messages, commands that worked, what the user explicitly decided or rejected. Don't pad. The "Facts from the session log" section is already filled.
  3. Tell the user: run /clear, then say "Read HANDOFF.md and continue". Remind them HANDOFF.md is a working note (the script warns if it isn't gitignored).

Secrets in commands and prompts (API keys, tokens, PASSWORD=…, credentialed URLs) are replaced with [redacted] in the facts section. Still read it before sharing.

Context meter (optional hook, ask before installing)

{ "hooks": { "Stop": [ { "hooks": [ { "type": "command", "command": "node \"/ABSOLUTE/PATH/session-handoff/scripts/handoff.mjs\" meter" } ] } ] } }

After each reply it reads the tail of the transcript. Once context passes 150k tokens it shows the user one line suggesting a handoff or /compact, then again every +50k (HANDOFF_WARN_TOKENS, HANDOFF_STEP_TOKENS). Silent otherwise, and it fails open.

node handoff.mjs status prints the current context size.

Limits

  • The facts come from the log. The why comes from Claude filling the sections, so the handoff is only as good as that summary. Write it before the context is so long that early details are fuzzy.
  • /compact is the built-in alternative when you want to stay in the same session. A handoff file survives across sessions, machines and teammates.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.