Sandbox
@toroleapinc/claude-brain

Claude Code brain sync plugin for Git

claude-brain is a Claude Code plugin that keeps your brain files in a private Git repo. It syncs CLAUDE.md, rules, skills, agents, memory, and settings across machines, then merges changes with hooks and semantic merge scripts.

86 starsβ€’19 forksβ€’Shellβ€’Updated 3mo ago
Who it's for

Builders who run Claude Code on several machines and want one shared setup.

What it delivers

You can move between machines without re-teaching Claude the same context and rules.

What it does

Auto-sync hooks

Runs on session start and end so brain state stays current without manual steps.

Semantic merge

Uses Claude-powered merge logic for memory and CLAUDE.md instead of simple overwrite.

Cross-machine sync

Keeps laptop, desktop, and other local setups converged through a Git remote.

Team sharing

Lets you share skills, agents, and rules through a shared namespace while keeping memory private.

Security filters

Strips secrets, env vars, and API keys before export and warns on unsafe repo settings.

Encryption support

Can encrypt snapshots with `age` before push and decrypt on pull.

How to get it

  1. 1Run
    # Add the marketplace and install
    /plugin marketplace add toroleapinc/claude-brain
    /plugin install claude-brain-sync
  2. 2Run
    /brain-init git@github.com:you/my-brain.git
  3. 3Run
    /brain-join git@github.com:you/my-brain.git
  4. 4Run
    /brain-init git@github.com:you/my-brain.git --encrypt

README

claude-brain

Sync your Claude Code brain across machines β€” portable, automatic, intelligent.

πŸ‡¨πŸ‡³ δΈ­ζ–‡

claude-brain is a Claude Code plugin for brain sync β€” sync Claude Code memory, skills, agents, rules, and settings across all your machines with semantic merge. Cross-machine, portable, zero daily effort.

Stars License Issues Platform Claude Code Plugin Last Commit Forks


# Machine A (work laptop) β€” first time setup
> /brain-init git@github.com:you/my-brain.git
βœ“ Brain exported: 42 memory entries, 3 skills, 5 rules
βœ“ Pushed to remote

# Machine B (home desktop) β€” join existing brain
> /brain-join git@github.com:you/my-brain.git
βœ“ Pulled brain: 42 memory entries, 3 skills, 5 rules
βœ“ Merged with local state
βœ“ Auto-sync enabled

# Later... check sync status from any machine
> /brain-status
=== Claude Brain Status ===
Machine: home-desktop (b7f2...)
Remote:  git@github.com:you/my-brain.git
Last push: 2 minutes ago
Last pull: 2 minutes ago
Status:  Clean

Two commands. Zero daily effort. Works forever.


The Problem

You use Claude Code on multiple machines. Your laptop has learned your coding patterns. Your desktop has custom skills. Your cloud VM has different rules. None of them talk to each other.

Every time you switch machines, you lose context. You re-teach Claude the same things. Your carefully crafted CLAUDE.md stays behind.

The Solution

# Machine A (work laptop)
> /brain-init git@github.com:you/my-brain.git
βœ“ Brain exported: 42 memory entries, 3 skills, 5 rules
βœ“ Pushed to remote

# Machine B (home desktop)
> /brain-join git@github.com:you/my-brain.git
βœ“ Pulled brain: 42 memory entries, 3 skills, 5 rules
βœ“ Merged with local state
βœ“ Auto-sync enabled

# That's it. Every session start/end syncs automatically.
# Your brain follows you.

Two commands. Zero daily effort. Works forever.

Why claude-brain?

ToolWhat it doesWhat claude-brain adds
claude-memEnhances memory on one machineSyncs your entire brain across all machines
chezmoi / dotfilesCopies config filesIntelligently merges knowledge β€” resolves contradictions, deduplicates
Manual CLAUDE.md copyWorks but tediousAuto-syncs silently on every session start/end

No other tool does cross-machine semantic merge of Claude Code's brain state.

Key Features

  • Auto-sync β€” hooks run on every session start/end, zero effort
  • Semantic merge β€” LLM-powered deduplication of memory and CLAUDE.md (not just overwrite)
  • N-way merge β€” laptop + desktop + cloud VM all converge intelligently
  • Encryption β€” optional age encryption for brain snapshots at rest
  • Team sharing β€” share skills, agents, and rules with teammates
  • Auto-evolve β€” promotes stable patterns from memory to durable config
  • Security-first β€” secrets stripped, env vars excluded, private repo enforced
  • Dirt cheap β€” ~$0.50-2.00/month typical usage via claude -p

Quick Start

Install

# Add the marketplace and install
/plugin marketplace add toroleapinc/claude-brain
/plugin install claude-brain-sync

Initialize (first machine)

/brain-init git@github.com:you/my-brain.git

Join (other machines)

/brain-join git@github.com:you/my-brain.git

With encryption

/brain-init git@github.com:you/my-brain.git --encrypt

Done. Auto-sync handles everything from here.

Commands

CommandDescription
/brain-init <remote>Initialize brain network with a Git remote
/brain-join <remote>Join an existing brain network
/brain-statusShow brain inventory and sync status
/brain-syncManually trigger full sync cycle
/brain-evolvePromote stable patterns from memory to config
/brain-conflictsReview and resolve merge conflicts
/brain-share <type> <name>Share a skill, agent, or rule with the team
/brain-shared-listList all shared artifacts in the network
/brain-logShow sync history

What Gets Synced

ComponentSynced?Merge Strategy
CLAUDE.mdYesSemantic merge
RulesYesUnion by filename
SkillsYesUnion by name
AgentsYesUnion by name
Auto memoryYesSemantic merge
Agent memoryYesSemantic merge
Settings (hooks, permissions)YesDeep merge
KeybindingsYesUnion
MCP serversYesUnion (env vars stripped)
Shared team artifactsYesUnion via shared namespace
OAuth tokensNeverSecurity
Env varsNeverMachine-specific
API keysNeverStripped automatically

Architecture

Machine A              Machine B              Machine C
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”          β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ claude-   β”‚          β”‚ claude-   β”‚          β”‚ claude-   β”‚
β”‚ brain     β”‚          β”‚ brain     β”‚          β”‚ brain     β”‚
β”‚ plugin    β”‚          β”‚ plugin    β”‚          β”‚ plugin    β”‚
β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜          β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜          β””β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”˜
      β”‚                      β”‚                      β”‚
      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                 β”‚     Git Remote       β”‚
                 β”‚  (your private       β”‚
                 β”‚       repo)          β”‚
                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

No central server. Git handles transport. Each machine merges on pull.

Merge strategy:

  • Structured data (settings, keybindings, MCP) β†’ deterministic JSON deep-merge (free)
  • Unstructured data (memory, CLAUDE.md) β†’ LLM-powered semantic merge via claude -p (~$0.01-0.05)

Security

claude-brain is designed with security as a first-class concern:

  • Secrets are never exported β€” OAuth tokens, API keys, env vars, .claude.json are all excluded
  • Pattern-based secret scanning β€” warns if potential secrets are detected in memory
  • MCP env vars stripped β€” server configs sync without credentials
  • Private repo enforced β€” warns if public repo detected
  • Automatic backups β€” every import creates a backup in ~/.claude/brain-backups/
  • Machine trust model β€” only add machines you fully control
  • Optional encryption β€” age encryption for snapshots at rest

See the full Security Notice below.

API Costs

OperationCostWhen
Structured mergeFreeEvery sync
Semantic merge~$0.01–0.05Only when content differs
Auto-evolve~$0.02–0.10At most once per 7 days
Export / importFreeEvery sync

Typical monthly cost: $0.50–2.00 for active multi-machine use. Budget cap: $0.50/call (configurable).

Platform Support

PlatformStatus
LinuxFully supported
macOSFully supported (Apple Silicon + Intel)
WSLFully supported (WSL2 recommended)
Windows nativeNot supported (use WSL)
Claude Code CloudNot supported

claude-brain runs as a local plugin that hooks SessionStart/SessionEnd to shell out to git and read/write ~/.claude/. Cloud sessions are ephemeral, sandboxed, and don't have a persistent ~/.claude to sync to, so the current architecture doesn't apply. See #32 for the discussion of what a future read-only Cloud variant could look like.

Dependencies

  • git β€” sync transport
  • jq β€” JSON processing (apt install jq / brew install jq)
  • claude CLI β€” semantic merge (already installed with Claude Code)
  • age β€” optional, for encryption

Team Sharing

Share skills, agents, and rules with teammates:

/brain-share skill my-useful-tool.md
/brain-share agent debugger.md
/brain-share rule security.md

Shared artifacts live in shared/ in the brain repo. Memory is never shared β€” personal only. Team members receive shared artifacts on their next sync.

Auto-Evolve

The brain runs evolution analysis every 7 days (configurable). It:

  • Analyzes memory for stable, repeated patterns
  • High-confidence promotions (>0.9) are applied automatically
  • Lower-confidence suggestions are queued for manual review via /brain-conflicts

Trigger manually anytime with /brain-evolve.

Encryption

/brain-init git@github.com:you/my-brain.git --encrypt
  • Generates an age keypair per machine
  • Snapshots encrypted before push, decrypted on pull
  • Recipients file controls access: meta/recipients.txt
  • Backward compatible with unencrypted snapshots

Security Notice

Read this before using claude-brain. This plugin syncs your Claude Code configuration via a Git remote. Understand what data leaves your machine:

What IS exported

  • CLAUDE.md, rules, skills, agents
  • Auto memory and agent memory
  • Settings (hooks, permissions β€” NOT env vars)
  • MCP server configurations (env vars stripped)
  • Keybindings
  • Machine hostname and project directory names

What is NEVER exported

  • OAuth tokens and API keys
  • ~/.claude.json (credentials)
  • Environment variables from settings
  • MCP server env fields
  • .local config files
  • Session transcripts

Important considerations

  1. Use a PRIVATE Git repository. Plugin warns if public repo detected.
  2. Memory may contain sensitive context. Review before initializing.
  3. Git history is permanent. Use git-filter-repo to purge if needed.
  4. Auto-sync runs silently. Backups created before each import.
  5. Semantic merge uses Claude API. Memory content is sent to claude -p.
  6. Trust all machines in your network. Imported skills execute with Claude's permissions.

Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.

License

MIT

Files in the repo

Repository payloadβ€’15 top-level entries
  • .claude-plugin
  • .github
  • agents
  • config
  • docs
  • hooks
  • scripts
  • skills
  • templates
  • tests
  • .gitignore
  • CHANGELOG.md
  • CONTRIBUTING.md
  • LICENSE
  • README.md

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More plugins

Makes your AI agent think like the laziest senior dev in the room. The best code is the code you never wrote.

138k
1 add

Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.

82k
code-yeongyu/
oh-my-openagent

OmO: Just type "mass ulw" keyword with your prompt. Now you are the master of graph engineering.

69k

Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More

94k

Opinionated Oxlint rules for rejecting low-evidence TypeScript and JavaScript patterns

4.3k