close-new-session
Skill0 starsChanged 3 months agoMITView on GitHub
Close the current session AND prepare the start of a fresh one because context is running out. Does everything /close does (distil into long-term memory) and additionally writes a handoff file under docs/handoffs/ with the exact state, chained to previous handoffs, then returns a ready-to-paste resume prompt. Use when the user says "/close-new-session", "I'm running out of context", "continue in a new session" or "prepare the handoff".
In this repositoryOne other file it gives its agents.
- closeSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 5 are distinctive, and 4 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
4
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
If docs/handoffs/ does not exist, create it.
- Very specific: line 28
Look at the most recent handoff listed.
- Very specific: line 36
Follow memory-triage.md (same skill folder).
- Distinctive: line 40
Do this before the handoff, so the handoff can point at memories by slug instead of repeating them.
- Distinctive: line 92
If something was not verified, write it as unverified.
- Very specific: line 110
Read docs/handoffs/<file>.md and continue from "Next step".
- Distinctive: line 116
Do not commit or push unless explicitly asked.
- Distinctive: line 118
Do not duplicate in the handoff what already went into memory — link it by slug.
- Distinctive: line 119
Do not write a generic handoff.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
/close-new-session — close + handoff
Two deliverables: long-term memory (what matters in months) and the handoff (what matters in five minutes, in the new session). They are different things. Do not merge them.
- Memory = durable facts, no session noise.
- Handoff = volatile state: what was half-edited, what command was running, what was tried and failed.
Step 1 — Real state
git status --short
git diff --stat
git log --oneline -8
git stash list
ls -t docs/handoffs/*.md 2>/dev/null | head -3If docs/handoffs/ does not exist, create it. If the repo has no docs/, use .claude/handoffs/.
Step 2 — Chain
Look at the most recent handoff listed. If it covers the same thread of work, this is its
continuation: inherit the slug and bump the sequence number. If it is a new topic, start at 01.
Name: docs/handoffs/YYYY-MM-DD-<slug>-<NN>.md
Example: docs/handoffs/2026-08-25-auth-rewrite-03.md
Step 3 — Memory
Follow memory-triage.md (same skill folder). Read it before writing.
Same filter as /close: only what cannot be deduced from the repo. Look for duplicates.
Update MEMORY.md.
Do this before the handoff, so the handoff can point at memories by slug instead of repeating them.
Step 4 — Write the handoff
Full template. Fill every section; if one is empty, write "—" rather than deleting it.
# Handoff — <title of the thread of work>
**Date:** YYYY-MM-DD · **Sequence:** NN · **Previous:** <previous file or "—">
**Branch:** <branch> · **Last commit:** <short sha> <subject>
## Goal
<One sentence: what this thread is trying to achieve. Not today's work — the whole thread.>
## Where we are
<10-20 bullets. Concrete state, not narrative. What works, what doesn't, what is half-built.>
## What was tried and did NOT work
<The most valuable section. Each attempt with why it failed, so nobody repeats it.>
- <approach> → failed because <reason>
## Decisions taken
- <decision> — because <reason> — <date>
## Files touched
<Relative paths + one line on what changed in each. Mark the uncommitted ones.>
## Uncommitted
<Output of git status --short, or "clean">
## Context that is not in the repo
<IDs, URLs, credentials by location (NEVER the value), which VPN is needed, what is down.>
## Memories written in this close
- [[memory_slug]] — <what it covers>
## Next step
1. <concrete action>
2. <concrete action>
3. <concrete action>
## Quick start
```bash
<exact commands to restore the environment: cd, VPN, server, tests>
```Content rules:
- Exact paths and commands. "the config file" is useless;
src/config/database.tsis not. - Never a token or secret value. Only where it lives.
- Absolute dates.
- If something was not verified, write it as unverified. A handoff that lies costs more than an empty one.
Step 5 — Return the resume prompt
End with this, in a code block so it can be copied in one go:
## Session closed — handoff ready
Memory:
+ <file>.md — new: <hook>
~ <file>.md — updated: <what changed>
Handoff: docs/handoffs/<file>.md (sequence NN)
**Paste this into the new session:**
```
Read docs/handoffs/<file>.md and continue from "Next step".
```What NOT to do
- Do not commit or push unless explicitly asked. The handoff is written to disk (that is the point), but it stays uncommitted unless the user says otherwise.
- Do not duplicate in the handoff what already went into memory — link it by slug.
- Do not write a generic handoff. If you cannot name the concrete next step, the handoff is worthless.
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
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.

