
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
opencode-branch-memory-manager
Advanced tools
Automatically manages branch-specific context for OpenCode with auto-save, auto-load, and git workflow integration
Automatically manages branch-specific context for OpenCode so you never lose your development context when switching branches.
The plugin supports three installation methods to fit different workflows:
Add the plugin to your opencode.json:
{
"plugin": ["opencode-branch-memory-manager"]
}
OpenCode will automatically install and load the package from npm when you run opencode.
Alternative - Manual installation:
# Install the package manually
npm install opencode-branch-memory-manager
# or
bun install opencode-branch-memory-manager
Then add it to your opencode.json as shown above.
Clone the repository directly into your project:
# Navigate to your project's .opencode directory
cd .opencode
# Clone the plugin
git clone https://github.com/Davidcreador/opencode-branch-memory-manager.git
# Install dependencies and build
cd opencode-branch-memory-manager
bun install
bun run build:local
The plugin will be automatically loaded when you run opencode from your project.
For team or organizational distribution, you can set up a marketplace:
1. Add the marketplace to your .opencode/settings.json:
{
"extraKnownMarketplaces": {
"your-org": {
"source": {
"source": "github",
"repo": "your-org/opencode-plugins"
}
}
}
}
2. Enable the plugin:
{
"enabledPlugins": {
"branch-memory-manager@your-org": true
}
}
The plugin will be installed from your organization's marketplace.
opencode
# Check status
@branch-memory_status
# Save current context with filters
@branch-memory_save --include-messages --include-todos --include-files "Working on user authentication"
# Load context for a specific branch
@branch-memory_load --branch feature/payment-api
# List all saved contexts
@branch-memory_list --verbose
Save current session context for current git branch.
Arguments:
--include-messages: Include conversation messages (default: true)--include-todos: Include todo items (default: true)--include-files: Include modified files (default: true)--description: Description of what you're savingExamples:
# Save everything
@branch-memory_save "Adding Stripe integration"
# Save only messages and todos
@branch-memory_save --include-messages --include-todos "Quick checkpoint"
# Save only files
@branch-memory_save --include-files "API work"
Load branch-specific context into current session.
Arguments:
--branch: Branch name (default: current branch)Examples:
# Load current branch context
@branch-memory_load
# Load specific branch context
@branch-memory_load --branch feature/authentication
Show branch memory status and available contexts.
Examples:
@branch-memory_status
Output:
📊 Branch Memory Status
═════════════════
Current branch: feature/user-auth
Current context:
📝 Messages: 23
✅ Todos: 7
📁 Files: 5
💾 Size: 2.3KB
⏰ Saved: 2025-01-01T14:30:00.000Z
📄 Description: Adding user authentication with OAuth
Available contexts:
→ feature/user-auth (2.3KB, 2025-01-01T14:30:00)
→ feature/payment-api (4.1KB, 2025-01-01T15:45:00)
main (1.8KB, 2025-01-01T12:00:00.000Z)
Delete saved context for a branch.
Arguments:
--branch: Branch name to delete context forExample:
@branch-memory_deleteContext --branch old-feature
List all branches with saved contexts.
Arguments:
--verbose: Show detailed information including message, todo, and file countsExamples:
@branch-memory_list
# With verbose details
@branch-memory_list --verbose
Output (verbose):
📋 Branches with saved contexts
═════════════════
feature/user-auth
💾 Size: 2.3KB
⏰ Modified: 2025-01-01T14:30:00
📝 Messages: 23
✅ Todos: 7
📁 Files: 5
feature/payment-api
💾 Size: 4.1KB
⏰ Modified: 2025-01-01T15:45:00
📝 Messages: 31
✅ Todos: 12
📁 Files: 8
main
💾 Size: 1.8KB
⏰ Modified: 2025-01-01T12:00:00
📝 Messages: 15
✅ Todos: 3
📁 Files: 2
═════════════════
Total: 3 branch(es)
Configuration is stored in .opencode/config/branch-memory.json
{
"autoSave": {
"enabled": true,
"onMessageChange": true,
"onBranchChange": true,
"onToolExecute": true
},
"contextLoading": "auto",
"context": {
"defaultInclude": ["messages", "todos", "files"],
"maxMessages": 50,
"maxTodos": 20,
"compression": false
},
"storage": {
"maxBackups": 5,
"retentionDays": 90
},
"monitoring": {
"method": "both",
"pollingInterval": 1000
}
}
enabled: Enable/disable automatic saving (default: true)onMessageChange: Auto-save when messages change (default: true)onBranchChange: Auto-save when switching branches (default: true)onToolExecute: Auto-save before running tools (default: true)"auto": Automatically load context when switching branches"ask": Prompt user before loading context"manual": Don't auto-load; use @branch-memory_load manuallydefaultInclude: Array of data types to include by defaultmaxMessages: Maximum number of messages to save (default: 50)maxTodos: Maximum number of todos to save (default: 20)compression: Enable compression (not yet implemented)maxBackups: Number of backups to keep (default: 5)retentionDays: Days to keep old contexts (default: 90)"watcher": Use file watcher only (fast, uses chokidar)"polling": Use polling only (reliable, slower)"both": Use watcher with polling fallback (default).opencode/config/branch-memory.json@branch-memory_save to save context:
@branch-memory_load to restore context:
@branch-memory_status to see:
@branch-memory_list and @branch-memory_deleteContext to manage saved contextsopencode.json:{
"tools": ["@branch-memory_save", "@branch-memory_load", "@branch-memory_status", "@branch-memory_list", "@branch-memory_deleteContext"]
}
cd .opencode
bun install
git status
cat .opencode/config/branch-memory.json
# Look for emoji indicators:
# ✅ = success
# ⚠️ = warning
# ❌ = error
git rev-parse --git-dir
Check .git/HEAD file exists and is being updated
Try both monitoring modes:
{
"monitoring": {
"method": "watcher" // or "polling"
}
}
The system automatically restores from backups. If issues persist:
ls -la .opencode/branch-memory/
@branch-memory_deleteContext --branch broken-branch
ls -la .opencode/branch-memory/
chmod -R u+w .opencode/branch-memory/
.opencode/
├── plugin/
│ └── branch-memory-plugin.ts # Event hooks for auto-save/load
├── tool/
│ └── branch-memory.ts # User-facing tools
├── branch-memory/
│ ├── index.ts # Exports
│ ├── storage.ts # Context persistence
│ ├── git.ts # Git operations
│ ├── monitor.ts # Branch monitoring
│ ├── collector.ts # Context collection
│ ├── injector.ts # Context injection
│ ├── types.ts # TypeScript types
│ └── config.ts # Configuration
├── config/
│ └── branch-memory.json # Configuration file
└── package.json # Dependencies
Edit .opencode/config/branch-memory.json to customize behavior:
{
"autoSave": {
"enabled": true,
"onMessageChange": true,
"onBranchChange": true,
"onToolExecute": true
},
"contextLoading": "ask",
"context": {
"defaultInclude": ["messages", "todos", "files"],
"maxMessages": 100,
"maxTodos": 50
}
}
git checkout -b feature/user-profile
opencode
🚀 Session created - checking for saved context...
📥 Found context for branch 'feature/user-profile'
Use @branch-memory_load to restore it
# Plugin auto-saves before tool execution and periodically
@branch-memory_save "Adding user profile feature"
git checkout main
# Plugin detects branch change
🔄 Branch changed: feature/user-profile → main
💾 Saved context for old branch 'feature/user-profile'
📥 Found context for branch 'main'
git checkout feature/user-profile
# Plugin detects branch change
🔄 Branch changed: main → feature/user-profile
📥 Found context for branch 'feature/user-profile'
Use @branch-memory_load to restore it
@branch-memory_load
# Context is restored - messages and todos are back
bun run typecheck
bun test
For development, testing, and local usage, you can install directly without npm:
# 1. Install dependencies
bun install
# 2. Build
bun run build
# 3. The .opencode/ directory is ready to use
# The build creates .opencode/dist/ with all plugin files
The .opencode/ directory structure is now ready:
.opencode/
├── dist/
│ └── branch-memory.js # Bundled plugin + tools
├── config/
│ └── branch-memory.json # Configuration
└── package.json # Dependencies
Note: For development, you can work directly in src/ and run npm run build:local to test the .opencode/ version.
package.jsonbun run buildnpm publish --access publicMake sure you're logged in to npm: npm whoami
opencode-branch-memory-manager (unscoped)@davidcreador/...) may require OTP for publishingpackage.jsonbun run buildnpm publishMake sure you're logged in to npm: npm whoami
MIT License - see LICENSE file for details.
Contributions are welcome! Please read CONTRIBUTING.md for guidelines.
Found a bug? Have a feature request? Please open an issue on GitHub.
Made with ❤️ for the OpenCode community
FAQs
Automatically manages branch-specific context for OpenCode with auto-save, auto-load, and git workflow integration
We found that opencode-branch-memory-manager demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.