close-session
Skill0 starsChanged 3 months agoMITView on GitHub
Run the session-close protocol (Conditional Update with No-Drift Guard) for any long-running Claude Code project. Use whenever the user says "close session", "end session", "close it out", "wrap up the session", or otherwise signals the session is ending. This is a SHARED, project-agnostic protocol; it reads each project's own values from `_handoff/close_config.md`. Covers Bucket A/B classification, the drift ledger, size gates, and the commit/backup step (which some projects do locally only).
10 other projects use a version of this.
Adopted by
Most recently taken up by
- vinaySankar2004/vuhritheir own version, first seen Nov 3, 2026
- eranw2000/multi-phase-skills-frameworktheir own version, first seen Oct 25, 2026
- Dmkdok/product-factorytheir own version, first seen Oct 25, 2026
- dave8172/skillstheir own version, first seen Oct 25, 2026
- ai-erp-collab/deterministic-context-routing-plugintheir own version, first seen Oct 15, 2026
- sheldor26/Blastdoortheir own version, first seen Oct 8, 2026
Other versions10 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 10
- eranw2000/multi-phase-skills-framework★ 10same name
- philippe-desplats/second-brain★ 6same name
- dave8172/skills★ 1same name
- Dmkdok/product-factory★ 1same name
- ai-erp-collab/deterministic-context-routing-plugin★ 0same name
- herreraspaintingba-hub/second-brain-starter-kit★ 0same name
- rokokol/close-session-skill★ 0same name
- sheldor26/Blastdoor★ 0same name
- sheldor26/whatloads★ 0same name
- vinaySankar2004/vuhri★ 0same name
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.
The file
We split this skill into the rules it gives an agent
6 rules. 0 are common, 2 are distinctive, and 4 are very specific to this project.
0
Common
Most of the 9 edited versions we read keep these.
2
Distinctive
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 20
Read _handoff/close_config.md.
- Very specific: line 62
mtime: if an UNCHANGED file's mtime is newer than its ledger date + 1 day, re-read it once, then --ack.
- Very specific: line 67
Do NOT "re-read once and leave the stamp" — that re-fires the alert every startup forever and trains you to ignore it.
- Distinctive: line 85
Never defer a size check to "protect the close under budget" — that's how a context file reaches 5× its cap over a few deferrals.
- Very specific: line 88
COMMIT, and PUSH only if
push_policy: push: If local-only, STOP after the commit — do NOT push. - Distinctive: line 89
NOT push. Then VERIFY: git status --short must be clean, or every remaining entry is deliberately gitignored.
“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
Session Close Protocol — shared
One protocol, every project. This skill holds the drift-prevention discipline that is
identical across projects. The values that differ per project — which files are Bucket A, the
size caps, which drift script exists, whether the repo may be pushed — live in that project's
_handoff/close_config.md. This skill reads that config and runs the generic steps.
Project-specific safeguards belong in the per-project config, never forked into a second copy of these steps. Divergent copies drift — the exact failure this protocol exists to prevent.
STEP 0 — Load this project's config FIRST
Read _handoff/close_config.md. It declares:
push_policy:pushorlocal-only(commit but NEVER push — e.g. a repo holding private documents; there may be no remote at all).bucket_a: the files rewritten at EVERY close (the session record).drift_check: the command that enforces the staleness ledger (ornone— then Bucket B is tracked by hand in explicit lists in the handoff).ledger: path to the Bucket-B ledger (ornone).review_refresh,size_bill: optional per-project commands (ornone).size_caps: the per-artifact caps for this project.
If _handoff/close_config.md is absent, STOP and tell the user the project needs a close
config (offer to draft one from the template at the end of this skill). Do not guess a size cap
or a push policy — a wrong value is a real hazard.
Why this exists
Prevent DRIFT — the gap between what is true about the project now and what a future session believes is true at startup. It accumulates when (a) the user edits a file outside a session, (b) a session silently skips updating a tracked file, or (c) the context file describes a world later work has changed but the close didn't rewrite. Enough drift and a future session operates on false beliefs. Secondary goal: keep the always-loaded context small by skipping UNCHANGED Bucket B files at startup.
Bucket A vs Bucket B
- Bucket A — ALWAYS rewrite at close: the context file (CLAUDE.md) + the handoff files. Every
field reflects today's reality even if the answer is "no change." Exact list =
bucket_a. - Bucket B — CONDITIONAL (touch only if the file's own state changed). Tracked in the
project's
ledger; without one, track it via explicitUPDATED:/UNCHANGED:lists.
The ledger date means "KNOWN-REVIEWED THROUGH"
The date is the date someone last confirmed the file's contents. It moves forward for exactly two
reasons: the file changed, or it was genuinely reviewed. Carry it forward on UNCHANGED — never
reset to today for a file you did not look at. Advancing a date without a change is allowed only
by acknowledging a valve trip AFTER really reviewing the file (drift_check --ack <path> --note
"<what you verified>"). Acking without looking is a FALSE PASS — the one failure mode this gate
may never have.
The two staleness valves (when the project has a drift_check)
- mtime: if an UNCHANGED file's mtime is newer than its ledger date + 1 day, re-read it once,
then
--ack. - calendar: any UNCHANGED file older than its interval gets re-read once, then
--acked — the re-read IS the review that earns the new date.
Do NOT "re-read once and leave the stamp" — that re-fires the alert every startup forever and
trains you to ignore it. Both valves are enforced by the drift_check script, fail-closed.
THE CLOSE STEPS
- Name in one sentence what changed (engine / product / docs / cleanup / ops).
- Identify what files changed — use BOTH
git statusAND a scan of the session, not memory. - For each Bucket B file: decide AFFECTED or UNCHANGED.
- Update EVERY Bucket A file IN FULL — partial updates are an anti-pattern.
- Update ONLY the AFFECTED Bucket B files.
- List both buckets explicitly in the session record (
UPDATED:/UNCHANGED:). A silent skip is indistinguishable from a forgotten file. - Update the ledger (if any): AFFECTED → today's date (add a
:scopefor very large files); UNCHANGED → carry the prior date forward. Rundrift_checkand confirm it does not hard-error. - SIZE GATE — check each capped artifact; over cap, prune (move procedures to skills, rules to rules files, history to an archive; trim the handoff to only what the next session must ACT on). Never defer a size check to "protect the close under budget" — that's how a context file reaches 5× its cap over a few deferrals.
- Refresh the review folder (if
review_refresh!= none) — never hand-copy files there. - COMMIT, and PUSH only if
push_policy: push. Iflocal-only, STOP after the commit — do NOT push. Then VERIFY:git status --shortmust be clean, or every remaining entry is deliberately gitignored. A commit that ran is not the same as a clean tree.
Anti-patterns
- Bumping a date stamp for a file whose content didn't change.
- Skipping a Bucket B file without naming it in the UNCHANGED list.
- Updating Bucket A only partially.
- Resetting date stamps to today for files you did NOT review (the most subtle, damaging error).
- Leaving a valve trip un-acked once it IS reviewed (a permanently-red gate trains you to ignore red).
- Hooking SessionStart to mandate any Bucket B file by name (defeats the conditional mechanism).
- Letting the context file grow back past its cap.
- Pushing a
local-onlyrepo.
APPENDIX — _handoff/close_config.md template
# Close config — <PROJECT NAME>
push_policy: push # or: local-only
bucket_a: CLAUDE.md, _handoff/Next_Session_Handoff.txt, _handoff/Session_Block_Latest.txt
drift_check: python "$HOME/.claude/ops/startup_read_check.py" # or: none
ledger: _handoff/bucket_b_ledger.txt # or: none
review_refresh: none
size_bill: none
size_caps:
- CLAUDE.md: 30000 chars
- _handoff/Next_Session_Handoff.txt: 8000 chars
- gitStatus: tree clean
notes: <anything project-specific>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.

