{"id":30459567,"url":"https://github.com/davidcreador/claude-code-branch-memory-manager","last_synced_at":"2026-04-28T12:32:42.280Z","repository":{"id":310755420,"uuid":"1041086368","full_name":"Davidcreador/claude-code-branch-memory-manager","owner":"Davidcreador","description":"Automatically manages branch-specific CLAUDE.md files so Claude always has the right context for your current work. Switch branches seamlessly without losing your development context, notes, or current progress.","archived":false,"fork":false,"pushed_at":"2025-08-20T02:49:25.000Z","size":115,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-10-26T10:27:17.870Z","etag":null,"topics":["ai","ai-tools","bash","branching","claude","claude-ai","claude-code","context-management","developer-tools","git","git-hooks","productivity","productivity-tools"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Davidcreador.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":["Davidcreador"],"custom":["https://github.com/Davidcreador/claude-code-branch-memory-manager","https://buymeacoffee.com/davidcreadk"]}},"created_at":"2025-08-20T00:54:15.000Z","updated_at":"2025-10-10T02:29:11.000Z","dependencies_parsed_at":"2025-08-22T00:31:13.992Z","dependency_job_id":null,"html_url":"https://github.com/Davidcreador/claude-code-branch-memory-manager","commit_stats":null,"previous_names":["davidcreador/claude-code-branch-memory-manager"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Davidcreador/claude-code-branch-memory-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Davidcreador%2Fclaude-code-branch-memory-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Davidcreador%2Fclaude-code-branch-memory-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Davidcreador%2Fclaude-code-branch-memory-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Davidcreador%2Fclaude-code-branch-memory-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Davidcreador","download_url":"https://codeload.github.com/Davidcreador/claude-code-branch-memory-manager/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Davidcreador%2Fclaude-code-branch-memory-manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32381400,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T11:25:28.583Z","status":"ssl_error","status_checked_at":"2026-04-28T11:25:05.435Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ai-tools","bash","branching","claude","claude-ai","claude-code","context-management","developer-tools","git","git-hooks","productivity","productivity-tools"],"created_at":"2025-08-23T18:34:54.679Z","updated_at":"2026-04-28T12:32:42.275Z","avatar_url":"https://github.com/Davidcreador.png","language":"Shell","funding_links":["https://github.com/sponsors/Davidcreador","https://github.com/Davidcreador/claude-code-branch-memory-manager","https://buymeacoffee.com/davidcreadk"],"categories":[],"sub_categories":[],"readme":"# Claude Code Branch Memory Manager\n\nAutomatic branch-specific `CLAUDE.md` memory management for [Claude Code](https://docs.anthropic.com/en/docs/claude-code). When you switch git branches, your Claude Code context switches with you.\n\n## The Problem\n\nWhen working across multiple git branches, your `CLAUDE.md` file contains context specific to one branch. Switching branches means Claude Code loses that context, or worse, has the wrong context for your current work.\n\n## The Solution\n\nBranch Memory Manager saves and loads branch-specific `CLAUDE.md` files automatically. Each branch gets its own memory, stored in `.claude/memories/`.\n\n**As a Claude Code plugin** — memories switch automatically when you run `git checkout` or `git switch` inside Claude Code. No manual intervention needed.\n\n**As a CLI** — manually save, load, and manage branch memories from your terminal.\n\n## Quick Start\n\n### Install as a Claude Code Plugin (Recommended)\n\n```bash\n# Install the npm package in your project\nnpm install --save-dev claude-code-branch-memory-manager\n\n# Or install globally\nnpm install -g claude-code-branch-memory-manager\n```\n\nThen load as a plugin:\n```bash\nclaude --plugin-dir ./node_modules/claude-code-branch-memory-manager\n```\n\nOnce installed, branch memory switching happens automatically:\n1. You run `git checkout feature/auth` inside Claude Code\n2. The plugin saves your current `CLAUDE.md` to `.claude/memories/main.md`\n3. It loads `.claude/memories/feature_auth.md` into `CLAUDE.md`\n4. Claude Code now has the right context for your `feature/auth` work\n\n### Use as a Standalone CLI\n\n```bash\n# Initialize in your repo\nbranch-memory init\n\n# Save current context\nbranch-memory save \"Implemented user auth\"\n\n# Switch branches (saves + loads automatically)\nbranch-memory switch feature/api\n\n# List all saved memories\nbranch-memory list\n\n# Check status\nbranch-memory status\n```\n\n## Commands\n\n| Command | Description |\n|---------|-------------|\n| `branch-memory save [description]` | Save current `CLAUDE.md` to branch memory |\n| `branch-memory load \u003cbranch\u003e` | Load memory from a specific branch |\n| `branch-memory list` | List all stored branch memories |\n| `branch-memory status` | Show current branch and memory status |\n| `branch-memory switch \u003cbranch\u003e` | Git switch + memory swap in one command |\n| `branch-memory copy \u003csrc\u003e \u003cdst\u003e` | Copy memory between branches |\n| `branch-memory clean` | Remove memories for deleted branches |\n| `branch-memory restore [branch]` | Restore from backup |\n| `branch-memory init` | Set up branch memory in current repo |\n| `branch-memory version` | Show version |\n\n## How It Works\n\n### Storage\n\nBranch memories are stored in `.claude/memories/` within your repository:\n\n```\nyour-repo/\n├── CLAUDE.md                          # Active memory (read by Claude Code)\n├── .claude/\n│   └── memories/\n│       ├── main.md                    # Memory for main branch\n│       ├── feature_auth.md            # Memory for feature/auth\n│       ├── feature_api.md             # Memory for feature/api\n│       └── .backups/                  # Automatic backups\n│           └── main.2025-03-18T...md\n```\n\n### Plugin Integration\n\nWhen installed as a Claude Code plugin, two hooks handle automatic switching:\n\n- **`SessionStart`** — Loads the correct branch memory when Claude Code starts\n- **`PostToolUse` (Bash)** — Detects `git checkout` / `git switch` commands and swaps memories\n\n### Fallback Behavior\n\nWhen switching to a branch with no saved memory, the tool looks for a fallback in this order: `main` → `master` → `develop`. This is configurable.\n\n## Configuration\n\nCreate a `.branch-memory.json` in your repo root:\n\n```json\n{\n  \"memoryDir\": \".claude/memories\",\n  \"memoryFileName\": \"CLAUDE.md\",\n  \"autoSaveOnSwitch\": true,\n  \"fallbackToDefault\": true,\n  \"fallbackBranches\": [\"main\", \"master\", \"develop\"]\n}\n```\n\n### Environment Variables\n\n| Variable | Description |\n|----------|-------------|\n| `BRANCH_MEMORY_DIR` | Memory storage directory |\n| `BRANCH_MEMORY_FILE` | Memory file name |\n| `BRANCH_MEMORY_AUTO_SAVE` | Enable/disable auto-save (`true`/`false`) |\n| `BRANCH_MEMORY_FALLBACK` | Enable/disable fallback (`true`/`false`) |\n| `BRANCH_MEMORY_FALLBACK_BRANCHES` | Comma-separated fallback branches |\n\n## Plugin Skills\n\nWhen installed as a Claude Code plugin, these skills are available:\n\n- `/branch-memory:save` — Save current context\n- `/branch-memory:load` — Load a branch's context\n- `/branch-memory:status` — Show memory status\n- `/branch-memory:list` — List all memories\n\n## Tips\n\n- **Add `.claude/memories/` to `.gitignore`** if you don't want to share memories across the team\n- **Commit `.claude/memories/`** if you want shared branch context\n- **Run `branch-memory clean`** periodically to remove memories for deleted branches\n- Branch names are sanitized for filenames: `feature/auth` becomes `feature_auth.md`\n\n## Requirements\n\n- Node.js 18+\n- Git 2.0+\n\n## License\n\nMIT\n\n## Author\n\n[David Pastor](https://github.com/Davidcreador)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidcreador%2Fclaude-code-branch-memory-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidcreador%2Fclaude-code-branch-memory-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidcreador%2Fclaude-code-branch-memory-manager/lists"}