lets-wrap
End-of-session orchestrator that closes the learning loop. Extracts learnings and encodes them back into CLAUDE.md, mission-context, and skills. Use when "lets wrap", "wrapping up", "end of session", "syncing".
Installation
Follow the repository instructions for this skill and your agent. Review the files and dependencies before adding it to your workflow.
View source ↗GuidesSkill instructions
Lets Wrap
End-of-session orchestrator that closes the learning loop. Each session should leave the system smarter than it started.
Philosophy
The Loop:
Session work → Learnings extracted → Encoded into system → Next session benefits
Stage 3 "Learning Loops" from mission-context: insights automatically become implementations.
The Pipeline
Run these steps in order. Use two-step preview pattern: show what you'll change, then ask approval.
Step 1: Session Detection
Detect what was worked on:
# Files changed (uncommitted)
git status --porcelain
# Today's commits
git log --since="midnight" --oneline
# Skills modified
git diff --name-only HEAD 2>/dev/null | grep "^skills/" | cut -d'/' -f2 | sort -u
Output: Brief summary of session activity.
Step 2: Documentation Checklist
Only show this step if session involved agents, skills, or tools.
Scan for what might need updating:
| Check | Target | Question to Ask |
|---|---|---|
| New features built | Powerhouse Lab Index | "Add to master skills/agents list?" |
| Universal workflow rule | CLAUDE.md | "Add to workflow section?" |
| Topic-specific gotcha | .claude/rules/<topic>.md |
"Add to rules file?" |
| New terminology | mission-context resources | "Add this term?" |
| Skill changes | skill/docs/ROADMAP.md | "Log what shipped?" |
| User-facing changes | docs/HOW-IT-WORKS.md | "Update the explanation?" |
| Technical changes | docs/README.md | "Update technical docs?" |
Topic classification for gotchas:
| Topic | Rules File |
|---|---|
| Obsidian, Templater, daily notes | .claude/rules/obsidian.md |
| External APIs (Basecamp, Substack, Gemini) | .claude/rules/api-integrations.md |
| Skill/agent building, settings, registration | .claude/rules/skill-development.md |
| Image generation, carousels | .claude/rules/image-generation.md |
| Git operations, file safety | .claude/rules/git-safety.md |
| Agent/skill instruction patterns | .claude/rules/agent-patterns.md |
The test: "Does this apply to EVERY session, regardless of task?" Yes → CLAUDE.md. No → rules/ or skill docs.
For each applicable item: Show the proposed edit, ask approval, then apply.
Step 3: Learning Capture (Feed the Loop)
Scan the conversation for learnings. Look for:
- Explicit corrections ("Never do X", "Always Y", "That's wrong because...")
- Patterns that worked well
- Failed attempts that were fixed
- Discoveries worth encoding
Classify by confidence:
- HIGH: Explicit user corrections → propose immediate update
- MEDIUM: Patterns that worked → note for consideration
- LOW: Observations → mention but don't propose edits
Where learnings go:
| Finding Type | Target File |
|---|---|
| Universal workflow rule | CLAUDE.md (workflow section) |
| Topic-specific gotcha | .claude/rules/<topic>.md |
| Skill-specific pattern | skills/<skill>/docs/ or SKILL.md |
| New terminology | mission-context/resources/terminology.md |
| Credentials/config | mission-context/resources/credentials.md |
Use the topic classification table from Step 2 to route gotchas to the correct rules file.
For HIGH confidence findings:
- Show the proposed edit (old → new)
- Ask: "Apply this learning? [Yes / Skip]"
- If approved, use Edit tool to apply
The Goal: Next session starts smarter because THIS session updated the docs.
Step 3.5: Daily Note Update
Update today's daily note with session outputs. IRON RULE: Never use Write on daily notes - Edit only.
Step 3.5a: Detect session outputs
Scan the conversation for items to capture:
| Type | What to Look For | Format |
|---|---|---|
| Done Today | Files edited, features shipped, tasks completed | - [x] [action] - [context] |
| Captures | Documents saved to Zettelkasten, research outputs | - [[Doc Name]] - Brief description |
Step 3.5b: Find today's daily note
Always Glob first (CLAUDE.md Iron Rule):
TODAY=$(date +%Y-%m-%d)
ls /Users/eddale/Documents/COPYobsidian/MAGI/Zettelkasten/${TODAY}.md
If not found, skip this step and report "Daily note doesn't exist yet."
Step 3.5c: Read current state
Read the daily note. Extract current Done Today and Captures content to avoid duplicates.
Step 3.5d: Preview updates
Show proposed updates:
## Daily Note Updates
**Done Today (add N items):**
- [x] newsletter-coach v1.2 - Added Hook Stack and Slop Detector integrations
- [x] win-the-day v3.1 - BB call prep integration
**Captures (add M items):**
- [[Research Swarm - Topic - 2026-01-16]] - Description
Current Done Today has X items. Current Captures has Y items.
Apply these updates? [Yes / Modify / Skip]
Step 3.5e: Apply with Edit
Use Edit tool to append to sections. Pattern:
old_string: "## Done Today\n- [x] existing item"
new_string: "## Done Today\n- [x] existing item\n- [x] [new item]"
If section is empty: Edit from the header.
Step 3.5f: Automation mode
When "wrap up automatically":
- Auto-detect items
- Apply without preview
- Report what was added in final summary
Step 4: Git Commit (Session-Scoped)
Critical: Only commit files touched in THIS session. Leave other work alone.
Step 4a: Identify session files
Scan the conversation for files you actually modified:
- Look for Edit tool calls → extract
file_path - Look for Write tool calls → extract
file_path - These are "session files"
Step 4b: Check git status
git status --porcelain
Step 4c: Separate session work from other work
Compare uncommitted files against session files:
- Session files: Files you touched in this conversation
- Other files: Everything else uncommitted (from parallel work/other sessions)
Step 4d: Present clearly
## This Session's Changes
- M skills/bb-call-prep/SKILL.md (edited in this session)
- M CLAUDE.md (edited in this session)
## Other Uncommitted (leaving alone)
- ?? .claude/skills/instagram-poster/ (from another session)
- M some-other-file.md (not touched this session)
Commit this session's work?
Step 4e: Commit only session files
If approved, stage ONLY session files:
git add <session-file-1> <session-file-2>
git commit -m "<message>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>"
git push
Never use git add . - that grabs everything and creates the confusion Ed mentioned.
If no session files were modified: Skip git entirely, report "No repo changes this session."
Step 4b: Clean Merged Branches
Check for and clean up any branches that have been merged to main:
# Find merged branches (excluding main)
git branch --merged main | grep -v "^\*" | grep -v "main"
If merged branches exist:
Show: "Found X merged branches that can be cleaned up: [list]"
Ask: "Delete these merged branches? [Yes / Skip]"
If approved:
# Delete local merged branches
git branch --merged main | grep -v "^\*" | grep -v "main" | xargs -n 1 git branch -d
# Delete remote merged branches
git branch -r --merged main | grep -v "main" | grep -v "HEAD" | sed 's/origin\///' | xargs -n 1 git push origin --delete
Report: "Cleaned up X merged branches."
Skip this step if no merged branches exist.
Step 5: Skill Packaging (Session-Scoped)
Only package skills modified in THIS session.
From the session files identified in Step 4a, extract skill names:
-
skills/bb-call-prep/SKILL.md→bb-call-prep -
.claude/skills/lets-wrap/SKILL.md→lets-wrap
For each session-modified skill:
Ask: "Package <skill-name> for Claude.ai? [Yes / Skip]"
If yes:
./scripts/package-skill.sh <skill-name>
After all packaging:
List ZIPs that need uploading: "Remember to upload these to Claude.ai: dist/<name>.zip"
Skip this step if no skills were modified this session.
Step 5.5: Index Sync Check
Verify session-modified skills and agents are catalogued in the Powerhouse Lab Index.
Index file: ~/Documents/COPYobsidian/MAGI/Zettelkasten/Powerhouse Lab Index - 2026-01-08.md
Check process:
- From session detection (Step 1), get list of modified skills and agents
- Read the index file
- For each modified skill: check if name appears in Skills table
- For each modified agent: check if name appears in Agents table
- Compile list of missing entries
If all catalogued: Skip silently (or in verbose mode: "Index verified - all session changes catalogued.")
If entries missing:
Index out of sync. Missing entries:
Skills:
- [skill-name] - [description from SKILL.md frontmatter]
Agents:
- [agent-name] - [description from agent frontmatter]
Update index? [Yes / Skip]
On "Yes":
- Read each missing skill/agent's description from its file
- Add to appropriate table in alphabetical order
- Add trigger phrases for skills (from SKILL.md description field)
- Update the count in section headers (e.g., "## Skills (45)" → "## Skills (46)")
Automation mode: Auto-update without asking.
Skip this step if no skills or agents were modified this session.
Step 6: Session Summary
Output a brief summary:
## Session Complete
**Worked on:** [brief description]
**Learnings encoded:** [count] updates to system docs
**Daily note updated:** [N] Done Today items, [M] Captures added
**Git status:** [committed/uncommitted]
**Skills packaged:** [list or "none"]
**Index:** [synced / updated N entries]
Next session will benefit from: [what was encoded]
Automation Mode
When Ed says "wrap up automatically" or "quick wrap":
- Skip previews, apply sensible defaults
- Only stop for actual errors
- Commit with auto-generated message
- Package all modified skills
- Apply only HIGH confidence learnings automatically
Guidelines
- Two-step preview: Always show what you'll change before changing it
- Batch approvals: Group related changes, don't ask one at a time
- Be concise: Session wrap shouldn't take longer than the session
- Focus on encoding: The value is what gets written back into the system
- Skip empty steps: If no learnings found, say so and move on
Examples
Read the usage examples in the source repository.
View source ↗Source history
- Indexed on
- 2026-01-20
- Index updated
- 2026-01-26
- Branch
- main
Index and sync dates describe this directory. View the source repository for code history.
GitHub ↗chat Comments (0)
Sign in to join the discussion and leave a comment.
No comments yet. Be the first to share your thoughts!