agentleFS
vasilievyakovvasilievyakov/miracle-infrastructure/skills/session-save/SKILL.md

session-save

Skill17 starsChanged 9 months agoMITView on GitHub

Saves session context to project memory. Run at end of work or when switching projects. Use when: (1) Ending a work session, (2) Switching projects, (3) Before a long break. Triggers: "/session-save", "save session", "remember context".

4 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

12 rules. 0 are common, 12 are distinctive, and 0 are very specific to this project.

  • 0

    Common

    Most of the 4 edited versions we read keep these.

  • 12

    Distinctive

    This author's own choices. Worth a look.

  • 0

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Check the current working directory

    line 19
  2. Distinctive:

    Check which files were read/modified during the session

    line 20
  3. Distinctive:

    If the project is unclear, ask the user

    line 21
  4. Distinctive:

    If git is unavailable, rely on conversation history: which files were created, modified, which tasks were solved.

    line 44
  5. Distinctive:

    If the file does not exist, create a new dossier using the template from Step 4.

    line 72
  6. Distinctive:

    If it exists, update it. Do not overwrite completely.

    line 74
  7. Distinctive:

    Unresolved Problems: remove solved ones, add new ones

    line 116
  8. Distinctive:

    Decisions Made: only append, never delete

    line 117
  9. Distinctive:

    Session History: add new entry at the top, keep the last 10

    line 119
  10. Distinctive:

    If the file does not exist, create it from template:

    line 137
  11. Distinctive:

    After updating the dossier and observations, update MEMORY.md:

    line 152
  12. Distinctive:

    Warnings: If there were discoveries signaling risks, add them

    line 163

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

Saves key information from the current session into long-term memory so the next session does not start from zero.


Step 1: Identify the project

Determine which project the work was about:

  1. Check the current working directory
  2. Check which files were read/modified during the session
  3. If the project is unclear, ask the user

Load keyword mappings from config:

Read ~/.claude/memory/memory-config.json

Match the session context against project keywords. Use fallback_project from config if no match.


Step 2: Gather session context

Analyze what happened during the session:

2a. What was done

# If there is a git repository:
git log --oneline -5  # recent commits
git diff --stat       # uncommitted changes

If git is unavailable, rely on conversation history: which files were created, modified, which tasks were solved.

2b. Decisions made

Extract from the conversation:

  • Architectural decisions ("chose X over Y")
  • Configuration decisions ("configured Z this way")
  • Business decisions ("client wants A, dropped B")

2c. Unresolved problems

  • Bugs not yet fixed
  • Tasks postponed
  • Questions without answers

2d. What to do next

  • Explicitly stated next steps
  • Tasks that follow from completed work

Step 3: Read existing dossier

Read ~/.claude/memory/projects/{project-name}.md

If the file does not exist, create a new dossier using the template from Step 4.

If it exists, update it. Do not overwrite completely. Preserve history.


Step 4: Write updated dossier

Project dossier format:

# {Project Name}

## Status
{One sentence: active/paused/completed}

## Description
{2-3 sentences: what it is, what it does, who uses it}

## Architecture
{Key components, stack, deployment}

## Current State
- Last session: {date}
- Done: {list}
- Uncommitted: {yes/no, what}

## Unresolved Problems
- {problem 1}
- {problem 2}

## Decisions Made
- [{date}] {decision and rationale}

## Next Steps
1. {task}
2. {task}

## Session History
- [{date}] {brief description of work}

Update rules:

  • Current State: overwrite completely (this is a snapshot)
  • Unresolved Problems: remove solved ones, add new ones
  • Decisions Made: only append, never delete
  • Next Steps: overwrite (this is the current plan)
  • Session History: add new entry at the top, keep the last 10

Step 5: Update Observations

In addition to the dossier, add typed observations to the observations file:

Read ~/.claude/memory/projects/{project-name}.observations.md

For each significant session event, add an entry:

  • To the Index table (~40 tokens per row)
  • To the Details section (Before/After/Files/Why, ~150 tokens)

Types: decision, bugfix, feature, discovery, problem.

If the file does not exist, create it from template:

# Observations - {project-name}

## Index
| # | Date | Type | Summary | Files |
|---|------|------|---------|-------|

## Details

Step 6: Sync MEMORY.md

After updating the dossier and observations, update MEMORY.md:

Read ~/.claude/memory/MEMORY.md

Update:

  1. Observation counts in the project table. Recount Index table rows
  2. Open problems. Rebuild from all observations:
    • Find all entries of type problem without the [R] marker in Summary
    • Format: - {project} #{number}: {summary}
  3. Warnings. If there were discoveries signaling risks, add them

Step 7: Save files

Edit ~/.claude/memory/projects/{project-name}.md
Edit ~/.claude/memory/projects/{project-name}.observations.md
Edit ~/.claude/memory/MEMORY.md

Step 8: Confirmation

Show the user a brief summary:

Session saved to {project-name} memory.

Recorded:
- Done: {N items}
- Decisions: {N decisions}
- Problems: {N unresolved}
- Observations: {N new observations}
- Next steps: {N tasks}

Next session will load the dossier and continue from here.

Important

  • Do NOT record sensitive data (passwords, tokens, API keys)
  • Do NOT duplicate code. Reference files and line numbers
  • Be concise. The dossier should fit in 200 lines
  • Update, do not overwrite. Decision history is critical

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.