agentleFS
desertcachedesertcache/agent-os/skills/session-cleanup/SKILL.md

session-cleanup

Skill0 starsChanged 9 months agoMITView on GitHub

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 phases: (1) Vault update + session note, (2) Auto memory sync, (3) Error learnings check, (4) Git commit and push.

  • Reads credentials

7 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use handoff.

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.
  • MicrosoftSkill

    handoff

    Compact the current conversation into a handoff document for another agent to pick up.

    Also in 3 projects that use this

The file

Show its rules and text

We split this skill into the rules it gives an agent

17 rules. 0 are common, 10 are distinctive, and 7 are very specific to this project.

  • 0

    Common

    Most of the 6 edited versions we read keep these.

  • 10

    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
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Run all four phases in order.

    line 12
  2. Very specific:

    All paths come from agent-os.config.json.

    line 16
  3. Very specific:

    Read ~/.claude/cache/session-context.json for detectedProject and vaultProjectPath.

    line 20
  4. Distinctive:

    If null, infer from conversation context (files touched, topics discussed).

    line 21
  5. Distinctive:

    Update with significant changes, decisions, or new context from this session.

    line 26
  6. Very specific:

    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 …

    line 28
  7. Very specific:

    Read MEMORY.md -- add new projects, tools, or environment facts discovered this session

    line 50
  8. Distinctive:

    Keep concise (max ~200 lines, loaded into every session prompt)

    line 52
  9. Distinctive:

    Don't duplicate info the project index already captures (status, summary, last session -- those come from vault READMEs automatically)

    line 53
  10. Very specific:

    If errors or new patterns occurred this session, suggest running /retro for thorough capture.

    line 57
  11. Distinctive:

    If no new errors, report "No new patterns" and move on.

    line 66
  12. Distinctive:

    If changes exist: stage relevant files, commit with descriptive message

    line 73
  13. Very specific:

    Avoid committing .env, secrets, caches, node_modules

    line 75
  14. Distinctive:

    If clean, report "Already up to date"

    line 76
  15. Very specific:

    All paths come from agent-os.config.json -- never hardcode user-specific paths

    line 91
  16. Distinctive:

    Always ask before pushing to remote (unless user explicitly pre-authorized)

    line 92
  17. Distinctive:

    Never commit .env files or secrets

    line 93

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

Session Cleanup

Run all four phases in order. Report a brief summary after each.

Phase 1: Vault Update

All paths come from agent-os.config.json.

Detect the project

Read ~/.claude/cache/session-context.json for detectedProject and vaultProjectPath. If null, infer from conversation context (files touched, topics discussed).

Update project README

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 session note

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.

Phase 2: Auto Memory

Memory directory comes from agent-os.config.json.

  1. Read MEMORY.md -- add new projects, tools, or environment facts discovered this session
  2. Correct anything that turned out wrong
  3. Keep concise (max ~200 lines, loaded into every session prompt)
  4. Don't duplicate info the project index already captures (status, summary, last session -- those come from vault READMEs automatically)

Phase 3: Error Learnings

If 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.

Phase 4: Git Sync

For each project repo worked on:

  1. git status to check for uncommitted changes
  2. If changes exist: stage relevant files, commit with descriptive message
  3. Push to remote
  4. Avoid committing .env, secrets, caches, node_modules
  5. If clean, report "Already up to date"

Output

Print 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)

Rules

  • All paths come from agent-os.config.json -- never hardcode user-specific paths
  • Always ask before pushing to remote (unless user explicitly pre-authorized)
  • Never commit .env files or secrets

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.

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.