agentleFS
VaibhavAher100VaibhavAher100/wrap-session/SKILL.md

wrap-session

Skill1 starsChanged 4 months agoMITView on GitHub

Use when a Claude Code session is ending and the user wants to preserve context before /clear, or wants to add session logging to a new project.

3 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions3 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 3

    1. nmamano/isomux★ 43same name
    2. DanielOnPurpose/danielonpurpose-skills★ 0same name
    3. labsiqbal/wrap-session★ 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

4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • 0

    Common

    Most of the 3 edited versions we read keep these.

  • 1

    Distinctive

    This author's own choices. Worth a look.

  • 3

    Very specific

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

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

    Write session log: - create sessions/YYYY-MM-DD-NNN.md with a self-assessed confidence rating (high/medium/low, consumed by /unwrap), then …

    line 20
  2. Very specific:

    Overwrite living state doc: - update _state.md atomically (tmp file, verify, rename)

    line 21
  3. Distinctive:

    Append to decision log: - only if new cross-session structural decisions were made this session

    line 23
  4. Very specific:

    All other instructions in wrap.md are path-agnostic.

    line 64

“Common” is measured: kept by at least 6 in 10 of the 3 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

wrap-session

Prevents session history loss when users type /clear. Sets up a project-local /wrap slash command, or executes the wrap directly if the project already has the logging structure.

When to Use

  • User says "wrap up", "log this session", "save before clear", or types /wrap
  • User wants to set up session logging in a new project
  • Project has a _state.md / sessions/ structure but no /wrap command yet

What /wrap Does

  1. Pre-flight check - warn before wrapping if 20+ uncommitted file deletions
  2. Determine session ID - scan sessions/ for today's files, increment to next YYYY-MM-DD-NNN
  3. Write session log - create sessions/YYYY-MM-DD-NNN.md with a self-assessed confidence rating (high/medium/low, consumed by /unwrap), then append to sessions/_index.jsonl
  4. Overwrite living state doc - update _state.md atomically (tmp file, verify, rename)
  5. Consume the change-ledger - summarize hook-captured file changes while their content is still in context, then clear the ledger
  6. Append to decision log - only if new cross-session structural decisions were made this session
  7. Update CLAUDE.md breadcrumb - sanitized sentinel block pointing at the new session
  8. Report - output Session logged as \<id>`. Safe to /clear.`

Three-Document System

FilePurposeUpdate pattern
_state.mdCurrent project health, open items, user preferencesOverwritten each session
_decisions.mdLocked-in cross-session decisionsAppend-only - never delete
sessions/YYYY-MM-DD-NNN.mdFull session detailCreated once, immutable after

Setting Up in a New Project

Step 1 - Create the logging structure

<logs-dir>/
  _state.md          # Living doc - overwritten each session
  _decisions.md      # Append-only decision log
  sessions/
    (empty - Claude fills this)

Seed _state.md with current project state. Seed _decisions.md with the header only.

Step 2 - Create the /wrap command

mkdir -p .claude/commands

Copy wrap.md from this skill into .claude/commands/wrap.md.

Adapt the three path comments at the top of the copied file:

<!-- SESSIONS_DIR: logs/sessions          -->
<!-- STATE_DOC:    logs/_state.md         -->
<!-- DECISIONS_LOG: logs/_decisions.md    -->

All other instructions in wrap.md are path-agnostic.

Step 3 - Invoke

/wrap

or

/project:wrap

Session Log Frontmatter

---
schema_version: 2
session_date: YYYY-MM-DD
session_id: YYYY-MM-DD-NNN
summary: one-line description
confidence: high   # high|medium|low - self-assessed context completeness, see the rubric in wrap.md
status: complete
tags: [session]
files_changed: 0
open_items: 0
---

Common Mistakes

MistakeFix
/wrap not foundFile must be at .claude/commands/wrap.md, not .claude/wrap.md
Session ID collisionAlways scan existing files before picking ID - never hardcode
_state.md not updatedStep 3 must overwrite, not append
Decision log bloatedOnly append when a genuine cross-session structural decision was made
Wrap run after /clearToo late - context is gone. Always /wrap before /clear
Two sessions /wrap at onceIDs are scan-then-write - parallel wraps can collide on the same NNN. Run one at a time
Wrong paths in wrap.mdAdapt the three path comments at the top of wrap.md to match your project

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.

Reviews can't be read right now.

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.