Commit & Self-Maintain CLAUDE.md + Memory
Step 1: Commit
- Run
git status (never use -uall), git diff --cached, and git log --oneline -5 in parallel.
- Analyze all staged changes. Draft a concise commit message:
- Use conventional commits:
feat:, fix:, refactor:, docs:, chore:, etc.
- Focus on why, not what.
- NEVER include
Co-Authored-By lines or mention Claude.
- Stage relevant untracked files if needed (prefer specific files over
git add .).
- Commit using a HEREDOC for the message. Do NOT use
--no-verify.
- Run
git status to confirm success.
Step 2: Update ROADMAP.md
After committing, update ROADMAP.md at the project root.
- Gitignore rule:
ROADMAP.md should normally be tracked by git and committed alongside the changes it describes. Only leave it gitignored if that specific repo already does so.
- Read the current
ROADMAP.md (create it if it doesn't exist).
- Prepend a new entry at the top (most recent first) with this format:
## [commit hash short] - [commit message] ([date YYYY-MM-DD])
**Problem:** [What was wrong or missing - 1-2 sentences]
**Solution:** [What was done to fix/implement it - 1-2 sentences]
**Files changed:** [list of key files touched, not exhaustive]
---
- Keep entries concise and useful. Focus on the why and the how, not line-by-line diffs.
- If the commit is trivial (typo fix, formatting), still add an entry but keep it minimal.
Step 3: Evaluate CLAUDE.md Relevance
After committing, read the project's CLAUDE.md (if one exists) and review the committed diff against it.
Update CLAUDE.md ONLY if the commit changed something the file already documents or should document:
- A new backend function/endpoint/service → add to whatever list tracks those
- A new data model/entity/schema → add to whatever list tracks those
- A changed core flow (auth, payments, data pipeline, etc.) → update the relevant section
- A new critical constraint or gotcha discovered → add to constraints/warnings section
- An architecture shift (new library, new pattern, new convention) → update architecture docs
- A removed or renamed component that CLAUDE.md references → fix the stale reference
Do NOT update CLAUDE.md for:
- Bug fixes that don't change architecture
- UI tweaks, styling, or cosmetic changes
- Routine feature work that follows existing patterns
- Anything speculative - only document confirmed facts
Step 4: If Updating CLAUDE.md
- Read the current CLAUDE.md.
- Make minimal, surgical edits - add a bullet, update a list, fix a stale reference.
- Respect the file's existing structure and style. Don't reorganize it.
- If the file is growing long, consider condensing older info rather than appending.
- Before committing CLAUDE.md, check if it's in
.gitignore. If it is, skip the commit - just edit it locally. If it's NOT in .gitignore, create a separate commit: docs: update CLAUDE.md - [brief reason].
Step 5: Evaluate Memory Relevance
After committing, check if any of these should be saved to memory:
- User feedback received during this session (corrections, preferences, "don't do X") → save as
feedback memory
- Project context learned (who's doing what, why, deadlines, business decisions) → save as
project memory
- Investigation/debugging findings discovered during this session (error patterns, log analysis results, root cause analysis, affected users, ongoing unresolved issues) → save as
project memory with current status and key data points. When updating an existing project memory, preserve history: mark what was fixed vs what remains open.
- User profile details learned (role, expertise, preferences) → save as
user memory
- External references discovered (where to find info, dashboards, tools) → save as
reference memory
Do NOT save to memory:
- Code patterns or architecture (that's what CLAUDE.md is for)
- Anything already in CLAUDE.md or derivable from code/git
- Ephemeral task details only relevant to current conversation
If saving, write to the memory directory and update MEMORY.md index.
Step 6: Report
Tell the user:
- What was committed (short summary)
- Whether ROADMAP.md was updated
- Whether CLAUDE.md was updated and why (or "no update needed - [reason]")
- Whether memory was updated and why (or "no memory update needed")
1---2name: commit3description: Commit staged changes, update CLAUDE.md and memory if relevant4---56# Commit & Self-Maintain CLAUDE.md + Memory78## Step 1: Commit9101. Run `git status` (never use `-uall`), `git diff --cached`, and `git log --oneline -5` in parallel.112. Analyze all staged changes. Draft a concise commit message:12 - Use conventional commits: `feat:`, `fix:`, `refactor:`, `docs:`, `chore:`, etc.13 - Focus on **why**, not what.14 - NEVER include `Co-Authored-By` lines or mention Claude.153. Stage relevant untracked files if needed (prefer specific files over `git add .`).164. Commit using a HEREDOC for the message. Do NOT use `--no-verify`.175. Run `git status` to confirm success.1819## Step 2: Update ROADMAP.md2021After committing, update `ROADMAP.md` at the project root.22231. **Gitignore rule:** `ROADMAP.md` should normally be tracked by git and committed alongside the changes it describes. Only leave it gitignored if that specific repo already does so.242. Read the current `ROADMAP.md` (create it if it doesn't exist).253. **Prepend** a new entry at the top (most recent first) with this format:2627```28## [commit hash short] - [commit message] ([date YYYY-MM-DD])2930**Problem:** [What was wrong or missing - 1-2 sentences]3132**Solution:** [What was done to fix/implement it - 1-2 sentences]3334**Files changed:** [list of key files touched, not exhaustive]3536---37```38394. Keep entries concise and useful. Focus on the **why** and the **how**, not line-by-line diffs.405. If the commit is trivial (typo fix, formatting), still add an entry but keep it minimal.4142## Step 3: Evaluate CLAUDE.md Relevance4344After committing, read the project's CLAUDE.md (if one exists) and review the committed diff against it.4546**Update CLAUDE.md ONLY if the commit changed something the file already documents or should document:**4748- A new backend function/endpoint/service → add to whatever list tracks those49- A new data model/entity/schema → add to whatever list tracks those50- A changed core flow (auth, payments, data pipeline, etc.) → update the relevant section51- A new critical constraint or gotcha discovered → add to constraints/warnings section52- An architecture shift (new library, new pattern, new convention) → update architecture docs53- A removed or renamed component that CLAUDE.md references → fix the stale reference5455**Do NOT update CLAUDE.md for:**56- Bug fixes that don't change architecture57- UI tweaks, styling, or cosmetic changes58- Routine feature work that follows existing patterns59- Anything speculative - only document confirmed facts6061## Step 4: If Updating CLAUDE.md62631. Read the current CLAUDE.md.642. Make minimal, surgical edits - add a bullet, update a list, fix a stale reference.653. Respect the file's existing structure and style. Don't reorganize it.664. If the file is growing long, consider condensing older info rather than appending.675. **Before committing CLAUDE.md**, check if it's in `.gitignore`. If it is, skip the commit - just edit it locally. If it's NOT in `.gitignore`, create a separate commit: `docs: update CLAUDE.md - [brief reason]`.6869## Step 5: Evaluate Memory Relevance7071After committing, check if any of these should be saved to memory:7273- **User feedback** received during this session (corrections, preferences, "don't do X") → save as `feedback` memory74- **Project context** learned (who's doing what, why, deadlines, business decisions) → save as `project` memory75- **Investigation/debugging findings** discovered during this session (error patterns, log analysis results, root cause analysis, affected users, ongoing unresolved issues) → save as `project` memory with current status and key data points. When updating an existing project memory, preserve history: mark what was fixed vs what remains open.76- **User profile** details learned (role, expertise, preferences) → save as `user` memory77- **External references** discovered (where to find info, dashboards, tools) → save as `reference` memory7879**Do NOT save to memory:**80- Code patterns or architecture (that's what CLAUDE.md is for)81- Anything already in CLAUDE.md or derivable from code/git82- Ephemeral task details only relevant to current conversation8384If saving, write to the memory directory and update MEMORY.md index.8586## Step 6: Report8788Tell the user:89- What was committed (short summary)90- Whether ROADMAP.md was updated91- Whether CLAUDE.md was updated and why (or "no update needed - [reason]")92- Whether memory was updated and why (or "no memory update needed")