End-of-session cleanup that syncs all persistent state. Use when the user says "cleanup", "wrap up", "end session", "save state", "sync everything", or "/cleanup". Performs four actions: (1) Update vault project notes and session handoff, (2) Update auto memory (MEMORY.md), (3) Record any new error learnings to error-patterns.md, (4) Commit and push changes to GitHub for any active project repos.
Run all four phases in order. Report a brief summary after each.
All paths come from agent-os.config.json.
Read ~/.claude/cache/session-context.json for detectedProject and vaultProjectPath.
If null, infer from conversation context (files touched, topics discussed).
Read <vaultPath>/<vaultProjectPath>/README.md.
Update with significant changes, decisions, or new context from this session.
If the project's status changed (e.g., went from active to complete, or a major milestone was hit), update the status: field in the README frontmatter. The session-start index reads this field, so keeping it current matters.
Create <vaultPath>/Sessions/YYYY-MM-DD-<topic>.md with:
---
date: YYYY-MM-DD
tags: [session, {project-tag}]
project: {vault-folder-name}
---
The project: field MUST match the vault folder name exactly (e.g., Agent-OS, Job-Search). This feeds the session-start project index. Use "general" if no specific project applies.
Include: what was done (bullets), current state, next steps. Keep it concise -- under 30 lines of content. Only add Decisions or Blockers sections if they have content.
Memory directory comes from agent-os.config.json.
MEMORY.md -- add new projects, tools, or environment facts discovered this sessionIf errors or new patterns occurred this session, suggest running /retro for thorough capture.
For quick cleanup without a full retro: only add to error-patterns.md if there was a genuinely new, likely-to-recur error pattern. Follow the existing format:
### [Short descriptive title]
**What happened:** [Specific error]
**Rule:** [What to do instead]
If no new errors, report "No new patterns" and move on.
For each project repo worked on:
git status to check for uncommitted changes.env, secrets, caches, node_modulesPrint one-line summary per phase:
Cleanup complete:
Vault: Updated <project>/README.md + created session note
Memory: Added N entries to MEMORY.md (or: No changes)
Errors: No new patterns (or: Added N patterns / Suggest /retro)
GitHub: Pushed to repo-name (or: Already up to date)
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer