session-close
Skill0 starsChanged 6 days agoMITView on GitHub
Use when the user signals end-of-session. Trigger phrases (English + Hinglish, substring-matched) — "bye", "session khatam", "aaj ka kaam ho gaya", "done for today", "end session", "close session", "wrapping up", "session done", "kal milte hain", "chalo bye", "session band karo", "that's it for today", "ho gaya kaam", "session ending", "ending this session", "I'm done". Runs the daemon's session-close protocol — session log + digest block + handoff + GEPA queue — without needing any API key.
22 other projects use a version of this.
Adopted by
Most recently taken up by
- kimkon1011/orgiast-claude-rulestheir own version, first seen Nov 8, 2026
- paureis/pau-skillstheir own version, first seen Nov 8, 2026
- NathanForster/claude-commandstheir own version, first seen Nov 1, 2026
- ngmeyer/skillstheir own version, first seen Nov 1, 2026
- albertomarturelo/siitheir own version, first seen Nov 1, 2026
- tornikebolokadze1-cyber/agent-foundation-kittheir own version, first seen Nov 1, 2026
Used with
Projects with it also use session-open.
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.
vishnujchandranSkillsession-open
Restart-safe session starter that restores context, validates readiness, and creates a focused execution plan for the current development session.
Also in 4 projects that use this
Other versions22 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 22
- albertomarturelo/sii★ 18same name
- tornikebolokadze1-cyber/agent-foundation-kit★ 6same name
- ngmeyer/skills★ 4same name
- paureis/pau-skills★ 2same name
- PUNCKe/manuscript-context-integrity★ 2same name
- toper2525ua-eng/claude-longrun★ 2same name
- vardan6/trackline★ 2same name
- AN0099/toothpaste-kit★ 1same name
- CorvusWing/CorvusWing★ 1same name
- farky-tech/containers★ 1same name
12 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 repository174 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- ad-ci-readinessSkill
- ad-pre-pushSkill
- accessibilitySkill
- agent-evalSkill
- agent-harness-constructionSkill
- agentic-engineeringSkill
- agent-introspection-debuggingSkill
- agent-sortSkill
- ai-first-engineeringSkill
- ai-regression-testingSkill
- api-connector-builderSkill
- architecture-decision-recordsSkill
- article-writingSkill
- automation-audit-opsSkill
- autonomous-agent-harnessSkill
- autonomous-loopsSkill
- backend-patternsSkill
- benchmarkSkill
- blueprintSkill
- brand-voiceSkill
- browser-qaSkill
- bun-runtimeSkill
- canary-watchSkill
- cavemanSkill
- ckSkill
- claude-devfleetSkill
- click-path-auditSkill
- codebase-onboardingSkill
- code-tourSkill
- coding-standardsSkill
- content-engineSkill
- content-hash-cache-patternSkill
- context-budgetSkill
- continuous-agent-loopSkill
- continuous-learningSkill
- continuous-learning-v2Skill
- cost-aware-llm-pipelineSkill
- councilSkill
- crosspostSkill
- ad-harnessSkill
- ad-state-migrateSkill
- ad-tui-devSkill
- agent-daemon-memorySkill
- big-feature-flowSkill
- bootstrap-daemonSkill
- bug-flowSkill
- engine-upgradeSkill
- feature-flowSkill
- gepa-evolve-inlineSkill
- harness-troubleshootSkill
- orchestrate-teamSkill
- release-flowSkill
- skill-authorSkill
- skill-installerSkill
- dashboard-builderSkill
- database-migrationsSkill
- deep-researchSkill
- deployment-patternsSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
18 rules. 0 are common, 11 are distinctive, and 7 are very specific to this project.
0
Common
Most of the 18 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 15
When the user signals end of session, you must close the loop.
- Distinctive: line 17
Do all five steps below in the same response — don't ask for confirmation, don't ask the user to choose, just do it.
- Very specific: line 27
If the block is missing, the project wasn't ad init-ed.
- Very specific: line 31
Before doing file writes, check .agent-daemon/last-session-close.flag:
- Distinctive: line 37
If the flag exists AND was modified less than 5 minutes ago → this is a re-trigger (user said "bye" twice in quick succession).
- Distinctive: line 39
After phase 5 completes, update the flag:
- Very specific: line 53
If no file exists, create today's: session-logs/$(date +%Y-%m-%d)_session-01.md.
- Very specific: line 74
If a previous ## End of session heading exists in the same file, rename the new one to ## End of session (continued) to satisfy MD024.
- Very specific: line 106
If nothing meaningful: emit empty "learnings": [] — still produces signal
- Very specific: line 126
Write the same content to BOTH locations.
- Distinctive: line 130
Check for skills that have been failing repeatedly.
- Distinctive: line 154
If the DB doesn't exist or query fails — skip silently.
- Distinctive: line 174
Don't ask the user "is there anything else?" — they said bye.
- Distinctive: line 186
After Phase 7, in a verification step:
- Distinctive: line 204
Read CLAUDE.md (verify protocol section present)
- Distinctive: line 205
Check flag — not present
- Distinctive: line 207
Write handoff (per-project + global, same content)
- Distinctive: line 220
Check flag — present, mtime 90s ago → re-trigger mode
“Common” is measured: kept by at least 6 in 10 of the 18 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 — the no-API daemon protocol
When the user signals end of session, you must close the loop. The agent-daemon depends on you emitting the right artifacts now so the next session starts smarter.
Do all five steps below in the same response — don't ask for confirmation, don't ask the user to choose, just do it. Short prep-only sessions still emit all five — they produce signal too.
Phase 1 — Read the protocol from CLAUDE.md
The project's CLAUDE.md has an <!-- agent-daemon:start --> ... <!-- agent-daemon:end --> managed block with the session-close protocol details (digest block schema, file paths, etc.). Read it once to ground yourself:
grep -A 80 "agent-daemon:start" CLAUDE.md 2>/dev/null | head -100If the block is missing, the project wasn't ad init-ed. Tell the user briefly and fall back to default behavior (steps 2–5 below).
Phase 2 — Idempotency check
Before doing file writes, check .agent-daemon/last-session-close.flag:
test -f .agent-daemon/last-session-close.flag && find .agent-daemon/last-session-close.flag -mmin -5 -printIf the flag exists AND was modified less than 5 minutes ago → this is a re-trigger (user said "bye" twice in quick succession). Skip steps 3 (session log) and 5 (handoff), but still re-emit the digest block (step 4) — Claude Code may have missed the first one.
After phase 5 completes, update the flag:
mkdir -p .agent-daemon && touch .agent-daemon/last-session-close.flagPhase 3 — Update session-logs
Find the current session-log file (latest by mtime in session-logs/):
ls -t session-logs/*.md 2>/dev/null | head -1If no file exists, create today's: session-logs/$(date +%Y-%m-%d)_session-01.md.
Append (or fill) the End of session block:
## End of session
- **Closed:** <ISO timestamp UTC>
- **Outcome:** <one-line — feature shipped / bug fixed / planning done / etc.>
- **Net deliverables:**
- <bullet — commit hashes, branches, files of meaningful work>
- **What works now:**
- <bullet — observable wins>
- **What's pending:**
- <bullet — open threads, blocked items>
- **Next session must start with:**
- <bullet — the very first thing to look at>
- **Files touched:**
- `<path>` — <brief reason>If a previous ## End of session heading exists in the same file, rename the new one to ## End of session (continued) to satisfy MD024.
Phase 4 — Emit the digest block
Append this at the END of your final assistant response (after the normal user-facing text):
<agent-daemon-digest>
{
"learnings": [
{
"type": "correction" | "confirmation" | "pattern" | "tool",
"text": "1-3 sentences written for a FUTURE session that doesn't have this transcript",
"evidence_quote": "exact quote from the user supporting this lesson (≤200 chars)",
"evidence_speaker": "user" | "agent",
"scope": "project" | "global",
"confidence": 0.0,
"tags": ["filepath/component/keyword", ...]
}
],
"session_summary": "≤2 sentences: what the session accomplished + the most important lesson"
}
</agent-daemon-digest>Schema details:
- Tags
<agent-daemon-digest>are HTML-style → invisible in markdown to user - Valid JSON only (no trailing commas, double-quoted keys/strings, ASCII safe)
- Cap at 8 learnings. Quality > quantity. Daemon dedupes across sessions
confidence: ≥0.9 if user explicitly stated; 0.6-0.8 strong inference; <0.3 → dropscope: "project" when in doubt (lower bar than "global")- Skip restating the user's request, project-trivial paths, self-praise
- If nothing meaningful: emit empty
"learnings": []— still produces signal
Refer to constitution/ending-protocol.md for the canonical schema.
Phase 5 — Write handoff (invoke handoff skill)
The handoff skill (in skills/handoff/) writes a dual-location handoff doc:
- Per-project:
<cwd>/.agent-daemon/handoffs/handoff-<ISO-timestamp>.md(commitable) - Global:
~/.agent-daemon/handoffs/<project-slug>/handoff-<ISO-timestamp>.md(your trail)
Filename format: handoff-2026-05-21T14-32-08Z.md (colons → hyphens, Windows-safe).
Content sections in order:
- Context — 2-3 sentences. What was this session about?
- State — done/in-progress/blocked. Reference paths + commits, don't restate.
- Next action — single most important first step. Be specific.
- Open questions — items that needed user input.
- Suggested skills — 1-3 skill names matching the next-action.
- Files touched — bullet list of paths, no diffs.
Write the same content to BOTH locations. The handoff skill's body has full template.
Phase 6 — GEPA candidates → queue (zero-API)
Check for skills that have been failing repeatedly. Query the episodic DB:
sqlite3 ~/.agent-daemon/episodic.db "SELECT skill_name, COUNT(*) as failures FROM skill_executions WHERE outcome = 'failure' AND created_at > datetime('now', '-30 days') GROUP BY skill_name HAVING failures >= 3 ORDER BY failures DESC LIMIT 5;" 2>/dev/nullFor each result, write a queue stub:
mkdir -p .agent-daemon/gepa-queue
for skill in <candidates>; do
cat > ".agent-daemon/gepa-queue/${skill}.md" <<EOF
# GEPA evolve queue: ${skill}
Queued: $(date -u +%Y-%m-%dT%H:%M:%SZ)
Failures (last 30d): N
To process in a Claude Code session, say: "evolve skill ${skill}"
The \`gepa-evolve-inline\` skill will read traces inline and propose changes.
No API key needed.
EOF
doneIf the DB doesn't exist or query fails — skip silently. GEPA queueing is best-effort.
Phase 7 — Touch the idempotency flag
Final step:
mkdir -p .agent-daemon && touch .agent-daemon/last-session-close.flagThis protects against rapid double-trigger.
Communication style
Just close out. Don't be ceremonial. After completing phases 2–7, your assistant response should:
- Confirm in 1-2 short sentences what was done ("Session-log updated, handoff written, digest emitted")
- Mention any GEPA candidates ("3 skills queued for evolution — run
ad reviewor say 'evolve skill X' next session").ad reviewshows each skill change as a diff and applies it only on the user's typed accept (ad skill undo <name>reverts). - End with the digest block
Don't ask the user "is there anything else?" — they said bye. Honor it.
Anti-patterns
- Skipping the digest block — continuous local correction capture still runs, but the richer session summary and handoff are lost.
--fallback-to-llmis opt-in only; never assume it will repair a missed digest. - Asking for confirmation before each step — the trigger phrases imply the user already decided. Just execute.
- Duplicating handoff content into the session-log — they have different purposes. Session-log is the journal (what happened, when); handoff is the next-session brief (do this first). Keep separate.
- Forgetting the idempotency flag — without it, a casual second "bye" 30 seconds later re-writes the same files (timestamps shift, content stays same).
- Inventing learnings to hit a quota — empty
"learnings": []is fine. 8 garbage ones poisons the memory.
Verification
After Phase 7, in a verification step:
ls -la .agent-daemon/last-session-close.flag # exists, mtime = now
ls -t session-logs/*.md | head -1 | xargs grep -l "End of session" # latest session-log has end block
ls -t .agent-daemon/handoffs/*.md | head -1 # latest handoff written
ls .agent-daemon/gepa-queue/ 2>/dev/null # any queued GEPA candidatesThe digest block itself is in your assistant response — verify by looking at your own output.
Examples
Example 1: Standard "bye" close
User: "bye, aaj ka kaam ho gaya"
You:
- Read CLAUDE.md (verify protocol section present)
- Check flag — not present
- Append
## End of sessionblock to today's session-log - Write handoff (per-project + global, same content)
- Query GEPA candidates — none found
- Touch idempotency flag
- Emit
<agent-daemon-digest>with 3 learnings from this session
Final response: "Session closed. Log + handoff written. No GEPA candidates this session. See you tomorrow. [digest block]"
Example 2: Re-trigger within 5 minutes
User says "bye" → you close cleanly. Then 90 seconds later user says "chalo bye".
You:
- Read CLAUDE.md
- Check flag — present, mtime 90s ago → re-trigger mode
- Skip session-log update (already done)
- Re-emit digest block (Claude Code may have missed first one)
- Skip handoff (already written)
- Skip GEPA query (already queued)
Final response: "Already closed 90s ago. Re-emitting digest just in case. [digest block]"
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.

