Wrap session
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.From its SKILL.md
npx -y skills add VaibhavAher100/wrap-sessionAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
- runs commandsInstructs the agent to run 3 commands, including `mkdir -p .claude/commands` and 2 more.
SKILL.md
3.6 KB, 899 tokens by cl100k_base, as published. Nobody here has run it
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/wrapcommand yet
What /wrap Does
- Pre-flight check - warn before wrapping if 20+ uncommitted file deletions
- Determine session ID - scan
sessions/for today's files, increment to nextYYYY-MM-DD-NNN - Write session log - create
sessions/YYYY-MM-DD-NNN.mdwith a self-assessedconfidencerating (high/medium/low, consumed by/unwrap), then append tosessions/_index.jsonl - Overwrite living state doc - update
_state.mdatomically (tmp file, verify, rename) - Consume the change-ledger - summarize hook-captured file changes while their content is still in context, then clear the ledger
- Append to decision log - only if new cross-session structural decisions were made this session
- Update CLAUDE.md breadcrumb - sanitized sentinel block pointing at the new session
- Report - output
Session logged as \<id>`. Safe to /clear.`
Three-Document System
| File | Purpose | Update pattern |
|---|---|---|
_state.md | Current project health, open items, user preferences | Overwritten each session |
_decisions.md | Locked-in cross-session decisions | Append-only - never delete |
sessions/YYYY-MM-DD-NNN.md | Full session detail | Created 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
| Mistake | Fix |
|---|---|
/wrap not found | File must be at .claude/commands/wrap.md, not .claude/wrap.md |
| Session ID collision | Always scan existing files before picking ID - never hardcode |
_state.md not updated | Step 3 must overwrite, not append |
| Decision log bloated | Only append when a genuine cross-session structural decision was made |
Wrap run after /clear | Too late - context is gone. Always /wrap before /clear |
Two sessions /wrap at once | IDs are scan-then-write - parallel wraps can collide on the same NNN. Run one at a time |
| Wrong paths in wrap.md | Adapt the three path comments at the top of wrap.md to match your project |
What ships with it: 17 files
44.8 KB alongside SKILL.md, 6 of them executable
commands/
- unwrap.md3.0 KB
- wrap-find.md1.5 KB
- wrap-list.md1.5 KB
- wrap.md8.2 KB
- wrap-repair.md1.3 KB
scripts/
- change-ledger.shruns1.4 KB
- context-monitor.shruns2.4 KB
- context-prompt-check.shruns2.4 KB
- context-thresholds.shruns310 B
- statusline.shruns1.4 KB
- AI_INSTALL.md3.1 KB
- CONTRIBUTORS.md1.2 KB
- .gitignore16 B
- install.shruns5.7 KB
- LICENSE1.0 KB
- MANUAL.md2.8 KB
- README.md7.4 KB