/dmg – a Claude Code skill for persistent memory and session sync

responsiblparty1 pts0 comments

GitHub - responsiblparty/claude-dmg-skill: Claude Code /dmg skill — persistent memory + session sync (git, docs, memory in one command) · GitHub

/" data-turbo-transient="true" />

Skip to content

Search or jump to...

Search code, repositories, users, issues, pull requests...

-->

Search

Clear

Search syntax tips

Provide feedback

--><br>We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Cancel

Submit feedback

Saved searches

Use saved searches to filter your results more quickly

-->

Name

Query

To see all available qualifiers, see our documentation.

Cancel

Create saved search

Sign in

/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up

Appearance settings

Resetting focus

You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.

Dismiss alert

{{ message }}

responsiblparty

claude-dmg-skill

Public

Notifications<br>You must be signed in to change notification settings

Fork

Star

main

BranchesTags

Go to file

CodeOpen more actions menu

Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit

History<br>1 Commit<br>1 Commit

memory

memory

skills/dmg

skills/dmg

CLAUDE.md

CLAUDE.md

README.md

README.md

View all files

Repository files navigation

/dmg — Claude Code skill for persistent memory + auto-sync

A Claude Code slash command that ends every session by committing dirty repos, refreshing documentation, and updating a persistent memory system — so the next session starts with full context.

/dmg = d ocumentation, m emories, g it.

The problem

When you build things with Claude Code, context resets every session. You re-explain your project layout. You re-describe decisions you already made. Claude doesn't know what changed yesterday.

The other problem: after a productive session you have uncommitted work, stale docs, and no record of what you learned.

/dmg solves both. One command cleans up the session and primes the next one.

What it does

1. Git — finds every repo touched during the session (including nested repos), commits anything dirty with a message explaining why the change was made, and appends the Claude Code co-author line.

2. Docs — updates whatever operational documentation went stale: README files, service tables, architecture docs. New projects and services get added to the right tables automatically.

3. Memory — updates a set of structured markdown files that persist across sessions. The next time you open Claude Code, it reads the index and knows your projects, your lessons learned, your preferences, and your infrastructure — without you re-explaining anything.

At the end it shows a clean git status across all repos as proof.

Setup

1. Install Claude Code

npm install -g @anthropic-ai/claude-code

2. Install the skill

mkdir -p ~/.claude/skills/dmg<br>cp skills/dmg/SKILL.md ~/.claude/skills/dmg/SKILL.md

Claude Code loads any skill files found in ~/.claude/skills/ and makes them available as slash commands. After copying the file, type /dmg in any Claude Code session.

3. Set up the memory folder

# Pick a project name — usually matches your working directory<br>mkdir -p ~/.claude/projects/my-project/memory<br>cp memory/MEMORY.md ~/.claude/projects/my-project/memory/MEMORY.md

Start writing memory files as you go. Use the examples in memory/examples/ as a starting point.

4. Wire up CLAUDE.md

Copy CLAUDE.md to your project root (or add its contents to an existing one). This tells Claude to read the memory index at session start.

cp CLAUDE.md ~/my-project/CLAUDE.md

5. Adapt the skill to your setup

Open ~/.claude/skills/dmg/SKILL.md and edit the instructions to match your actual repo layout and doc conventions. The more specific you make it, the more reliably it runs.

At minimum, tell it:

Which directories are their own git repos vs. tracked by a parent

Which documentation files to keep current

Where your memory folder lives

6. (Optional) Autocommit hook

Add a hook in Claude Code settings to commit the memory folder every few minutes. This prevents losing memory updates if a session crashes.

In your Claude Code settings (~/.claude/settings.json):

"hooks": {<br>"PostToolUse": [<br>"matcher": "",<br>"hooks": [<br>"type": "command",<br>"command": "bash ~/.claude/skills/dmg/autocommit.sh"

autocommit.sh (create at ~/.claude/skills/dmg/autocommit.sh):

#!/bin/bash<br>MEMORY_DIR="$HOME/.claude/projects/my-project/memory"<br>cd "$MEMORY_DIR" || exit 0<br>git diff --quiet && exit 0<br>git add -A && git commit -m "auto: $(date '+%Y-%m-%d %H:%M:%S')" --quiet

Memory file format

Each memory file is a markdown file with YAML frontmatter:

name: short-kebab-case-slug<br>description: "one line — used to decide relevance when scanning the index"<br>metadata:<br>type: project # project | feedback | user | reference

Content here. For feedback/lessons,...

claude memory code session skill skills

Related Articles