end-session
Skill9 starsChanged 7 months agoMITView on GitHub
End and close a work session — round up everything: state the session goal + assess it, save a resumable checkpoint (working files, git state, decisions, task progress), LAND the work (CI-gated auto-merge), and confirm the session is closeable. Use when finishing, wrapping up, or closing a session (also covers a mid-work "save my progress" checkpoint).
12 other projects use a version of this.
Adopted by
Most recently taken up by
- Imtylerrrrrr/second-braintheir own version, first seen Nov 16, 2026
- jocarrd/crux-agentstheir own version, first seen Nov 8, 2026
- DavoDC/claude-playbooktheir own version, first seen Oct 13, 2026
- lunaman81/claude-skillstheir own version, first seen Oct 6, 2026
- edwardyen724-g/claude-session-skillstheir own version, first seen Aug 30, 2026
- jctots/thinkpad-fedora-agenttheir own version, first seen Aug 15, 2026
Other versions12 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 12
- YehudaFrankel/clankbrain★ 16same name
- ozgurkarahan/ai-agent-memory★ 8same name
- alxyrgin/agent-forge★ 4same name
- jocarrd/crux-agents★ 4same name
- DavoDC/claude-playbook★ 1same name
- heffrey/claude-skills★ 1same name
- Imtylerrrrrr/second-brain★ 1same name
- edwardyen724-g/claude-session-skills★ 0same name
- jctots/thinkpad-fedora-agent★ 0same name
- lunaman81/claude-skills★ 0same name
2 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository44 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- anthropic-multi-agent-research-system-skillSkill
- apply-selectionsSkill
- bootstrap-dogfood-projectSkill
- brainstormSkill
- branch-choiceSkill
- cc-adoption-scoutSkill
- claude-guardianSkill
- continueSkill
- executing-plansSkill
- five-advisorsSkill
- get-work-doneSkill
- git-branch-lifecycleSkill
- githubSkill
- grill-meSkill
- hook-transcript-fixture-testSkill
- instagramSkill
- linkedinSkill
- modern-data-pipeline-diagramSkill
- pattern-qualitySkill
- platform-event-live-probeSkill
- plugin-lifecycleSkill
- promote-to-coreSkill
- prompt-auto-enhanceSkill
- provision-reportSkill
- redditSkill
- review-new-claude-featuresSkill
- save-sessionSkill
- scan-discovery-reportSkill
- scan-repoSkill
- scan-urlSkill
- self-improveSkill
- skill-evaluatorSkill
- skill-masterSkill
- ssot-workflow-auditSkill
- start-sessionSkill
- synthesize-hubSkill
- synthesize-projectSkill
- twitter-xSkill
- verify-effect-at-destinationSkill
- workflow-doc-reviewerSkill
- writing-plansSkill
- writing-skillsSkill
- youtube-transcriptSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
22 rules. 0 are common, 13 are distinctive, and 9 are very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
13
Distinctive
This author's own choices. Worth a look.
9
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 35
If the user provided a session name argument, use it.
- Very specific: line 43
Collision check: If .claude/sessions/{name}.md already exists:
- Very specific: line 44
Ask the user: overwrite, append a numeric suffix (-2, -3), or choose a different name
- Distinctive: line 45
MUST NOT silently overwrite
- Very specific: line 49
Remove characters not in [a-z0-9-]
- Distinctive: line 109
Only include docs that are directly relevant to the work in this session.
- Very specific: line 115
Read the template from the skill's references directory.
- Distinctive: line 119
Create the sessions directory if it doesn't exist:
- Distinctive: line 124
Write the populated session file:
- Distinctive: line 151
MUST NOT prompt the user or log individual deletions.
- Distinctive: line 179
MUST NOT force-merge past failing CI, and MUST NOT report the session as closed while the branch is still open — STEP 5 either …
- Distinctive: line 195
Before closing, every decision made this session that alters a SHARED artifact (conversation map, template inventory, queue config, …
- Very specific: line 207
Gitignore suggestion: If .claude/sessions/ is not in .gitignore, suggest adding it:
- Very specific: line 221
MUST NOT hardcode project-specific paths — use generic discovery (ls, find) for docs
- Very specific: line 222
MUST NOT include self-improvement or learnings sections — /learn-n-improve handles that
- Distinctive: line 223
MUST NOT overwrite an existing session file without explicit user confirmation
- Very specific: line 224
MUST create .claude/sessions/ directory if it does not exist
- Distinctive: line 225
MUST sanitize session names to filesystem-safe kebab-case
- Distinctive: line 226
MUST NOT delegate context gathering to subagents — gather inline in this skill
- Very specific: line 227
MUST read the session template from references/session-template.md when available
- Distinctive: line 228
MUST automatically purge session files older than 5 days — no user confirmation required
- Distinctive: line 229
MUST NOT log or display individual file deletions during purge — silent cleanup only
“Common” is measured: kept by at least 6 in 10 of the 9 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.
Files
End Session — Round Up & Close
Close out a work session cleanly: round up everything into a resumable checkpoint, land the
work (so "session ended" = "merged when green"), and confirm the session can be closed.
Renamed from /save-session (clearer pairing with /start-session); /save-session still works
as a deprecated alias. Restore later with /start-session.
Key distinction: /end-session captures file-level working state for exact resumption. /handover produces a narrative handoff document for broader context transfer. /continue is a lightweight git-state briefing. These serve different needs — use all three as appropriate.
STEP 1: Determine Session Name
If the user provided a session name argument, use it. Otherwise, auto-generate one:
- Get the current date:
date +%Y-%m-%d - Get the current branch name:
git branch --show-current - Get recent commit messages:
git log --oneline -3 - Derive a 2-4 word task summary from the branch name or recent commits
- Format:
{YYYY-MM-DD}-{task-summary}(e.g.,2026-03-19-add-session-skills)
Collision check: If .claude/sessions/{name}.md already exists:
- Ask the user: overwrite, append a numeric suffix (
-2,-3), or choose a different name - MUST NOT silently overwrite
Sanitization: Convert the name to filesystem-safe kebab-case:
- Lowercase, replace spaces and underscores with hyphens
- Remove characters not in
[a-z0-9-] - Collapse consecutive hyphens
STEP 2: Gather Context
Collect all context inline (no subagent delegation).
2.1: Working Files
git status --short
git diff --name-status HEADClassify each file:
- modified — existing file with changes (staged or unstaged)
- created — new untracked or newly added file
- deleted — removed file
- read — files that were read during the session but not changed (scan conversation history for Read tool calls on files not in the diff)
For modified/created files, note a brief context of what changed (1 line).
2.2: Git State
git branch --show-current
git log --oneline -5
git diff --stat
git stash listRecord: current branch, last 5 commits, uncommitted change summary, stash entries.
2.3: Key Decisions
Scan the conversation for architectural choices, design decisions, or trade-offs discussed. Look for:
- Choices between approaches ("went with X because...")
- Rejected alternatives
- Constraints discovered during implementation
Format as bullet points with rationale.
2.4: Task Progress
Categorize work items from the conversation into:
- Completed — finished and verified
- In Progress — started but not finished
- Blocked — waiting on something (specify the blocker)
2.5: Relevant Docs
Scan the project for documentation files that are relevant to the current work:
# Check for common doc locations (skip if they don't exist)
ls README.md docs/ ARCHITECTURE.md CONTRIBUTING.md 2>/dev/nullOnly include docs that are directly relevant to the work in this session.
STEP 3: Generate Session File
- Read the template from the skill's references directory. If running from a project that copied this skill, the template is at
.claude/skills/end-session/references/session-template.md. If the template is not found, use the structure from memory (the template format is documented in this skill). - Populate the template with gathered context from Step 2.
- Create the sessions directory if it doesn't exist:
mkdir -p .claude/sessions - Write the populated session file:
.claude/sessions/{session-name}.md
STEP 4: Purge Expired Sessions
Automatically delete session files older than 5 days. This runs silently with no user interaction.
find .claude/sessions -name "*.md" -mtime +5 -delete 2>/dev/nullOn Windows (Git Bash / MSYS2 may not support -mtime), use this fallback:
python3 -c "
import os, time, glob
cutoff = time.time() - 5 * 86400
for f in glob.glob('.claude/sessions/*.md'):
if os.path.getmtime(f) < cutoff:
os.remove(f)
" 2>/dev/null || trueMUST NOT prompt the user or log individual deletions. If no expired sessions exist, this step is a silent no-op.
STEP 5: Land the Session's Work — WAIT for CI, then merge (CLOSE the branch)
"Session ended" must mean "the work is merged and the branch is CLOSED" — not "a PR was armed
and left open." So this step waits for the required CI checks to conclude, then merges
synchronously. This runs on the CURRENT branch (the one thing /start-session STEP 0 skips).
Why the wait is the whole point (the root cause it fixes): a freshly-pushed PR's CI has not run
yet, so its mergeStateStatus is never CLEAN at push time. A naive "if CLEAN merge, else arm"
check therefore ALWAYS arms-and-returns — leaving the branch open while the merge happens
asynchronously, after /end-session already declared the session closed. Waiting for CI to finish
is what makes the close real and synchronous.
Skip silently if gh is unavailable, the repo has no GitHub remote, on main/master/detached
HEAD, or AUTO_MERGE=0.
# Single source of truth for the landing logic: .claude/hooks/session-git-landing.sh
# (shared with /start-session's reconcile and the auto-pr hooks — fix landing in ONE place).
# `land --wait` arms GitHub's native auto-merge (gated on the REQUIRED checks only) and then BLOCKS
# until the PR is MERGED, so the branch is genuinely CLOSED before this step returns. It prints one
# of: "merged ... CLOSED" / "NOT CLOSED ..." / "skipped ...". Report that verbatim in STEP 6.
bash "$(git rev-parse --show-toplevel 2>/dev/null)/.claude/hooks/session-git-landing.sh" land --waitMUST NOT force-merge past failing CI, and MUST NOT report the session as closed while the branch is still open — STEP 5 either merges+closes the branch (after CI passes) or surfaces the CI failure. Report which happened in STEP 6.
STEP 5b: Enroll Standing Goals
For each deliverable this session FINISHED whose continued working matters beyond the session (a
wired hook, a scheduled workflow, a deployed artifact, an installable plugin), write or update
goals/<slug>.md (see goals/README.md for the format) with 1-2 cheap read-only predicates that
would catch its silent death, then run PYTHONPATH=. python scripts/check_standing_goals.py and
confirm the new goal passes. A goal verified once is an assumption with a timestamp — enrollment is
what keeps it verified. Skip only when the session shipped nothing with a standing runtime/wiring
surface (pure docs/analysis).
Before closing, every decision made this session that alters a SHARED artifact (conversation map, template inventory, queue config, cross-project policy) must be persisted to the owning repo's docs in THIS session — leaving it as "sync pending"/"outlined" in a handoff buffer is a defect.
STEP 6: Post-Save Summary
After saving, present:
- Confirmation: "Session saved to
.claude/sessions/{name}.md" 1b. Landing: what STEP 5 did — "merged '<branch>' → main and CLOSED the branch (CI passed)", "NOT closed — CI failed (armed as fallback); investigate<check>", or "skipped (why — e.g. on main / no remote)". - Gitignore suggestion: If
.claude/sessions/is not in.gitignore, suggest adding it:
Note: Teams that want to share session state can skip this.# Session files (local working state) .claude/sessions/ - Resume command: "To restore this session later, run:
/start-session {name}" - Quick stats: Number of working files captured, completed/in-progress/blocked counts
- Session closeable: state the session goal + whether it was met (distinguish PARKED external blockers from PENDING work). Confirm "the session is complete and can be closed" ONLY if STEP 5 actually merged + closed the branch (or cleanly skipped). If STEP 5 reported "NOT closed" (CI failed), the session is NOT cleanly closeable — say so and name the failing check; do not declare it closed with an open branch.
CRITICAL RULES
- MUST NOT hardcode project-specific paths — use generic discovery (
ls,find) for docs - MUST NOT include self-improvement or learnings sections —
/learn-n-improvehandles that - MUST NOT overwrite an existing session file without explicit user confirmation
- MUST create
.claude/sessions/directory if it does not exist - MUST sanitize session names to filesystem-safe kebab-case
- MUST NOT delegate context gathering to subagents — gather inline in this skill
- MUST read the session template from
references/session-template.mdwhen available - MUST automatically purge session files older than 5 days — no user confirmation required
- MUST NOT log or display individual file deletions during purge — silent cleanup only
- MUST, in STEP 5, arm GitHub native auto-merge (gated on the REQUIRED checks only) and WAIT for the PR to reach
MERGED— so the branch is genuinely CLOSED when the skill returns, not armed-and-left-open. A fresh PR is neverCLEANat push time, so checking merge-state (or returning) without waiting leaves the branch open (the root cause). MUST NOT gate on ALL checks (e.g.--watch --fail-fast) — a noisy non-required workflow would false-fail while the requiredvalidatepasses. - MUST NOT force-merge past failing CI, and MUST NOT declare the session "closed/closeable" while its branch is still open. If CI fails, arm as a fallback, report "NOT closed" + the failing check, and do NOT claim the session is cleanly closeable. Skip on
main/detached HEAD/no-gh/no-remote/AUTO_MERGE=0.
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.

