/claude-brain-sync:brain-initfrom claude-brain-sync
Initializes a Git-based sync network for Claude Code brain data, including memory, skills, settings, and MCP configs. Supports optional age encryption and validates remote URL security.
Ships in claude-brain-sync. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The user wants to initialize their Claude Brain sync network.
Parse arguments:
Arguments provided: $ARGUMENTS
First, check dependencies by running:
"${CLAUDE_PLUGIN_ROOT}/scripts/common.sh" && echo "OK"
If jq and git are missing, tell the user what to install.
Validate the remote URL for security:
source "${CLAUDE_PLUGIN_ROOT}/scripts/common.sh"
validate_remote_url "$ARGUMENTS"
If the URL is detected as pointing to a PUBLIC repository, STOP and warn the user:
Show the user their current brain inventory by running:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/status.sh"
IMPORTANT: Show the user a security notice before proceeding: Tell the user:
Ask the user to confirm they want to initialize brain sync with the provided remote.
Run the initialization sequence:
# Parse arguments for encryption flag
ENABLE_ENCRYPTION=false
REMOTE_URL=""
for arg in $ARGUMENTS; do
case "$arg" in
--encrypt) ENABLE_ENCRYPTION=true ;;
*) if [ -z "$REMOTE_URL" ]; then REMOTE_URL="$arg"; fi ;;
esac
done
# Create brain repo directory
mkdir -p ~/.claude/brain-repo
# Initialize git repo
cd ~/.claude/brain-repo
git init
git remote add origin "$REMOTE_URL" 2>/dev/null || git remote set-url origin "$REMOTE_URL"
# Create directory structure
mkdir -p machines consolidated meta
# Initialize meta files
echo '{"entries":[]}' > meta/merge-log.json
# Set up encryption if requested
if [ "$ENABLE_ENCRYPTION" = "true" ]; then
echo "Setting up age encryption..."
# Check if age is installed
if ! command -v age-keygen &>/dev/null; then
echo "ERROR: age not found. Install it from https://github.com/FiloSottile/age"
echo "On macOS: brew install age"
echo "On Ubuntu/Debian: apt install age"
exit 1
fi
# Generate age keypair
source "${CLAUDE_PLUGIN_ROOT}/scripts/common.sh"
IDENTITY_FILE="${HOME}/.claude/brain-age-key.txt"
RECIPIENTS_FILE="${HOME}/.claude/brain-repo/meta/recipients.txt"
generate_age_keypair "$IDENTITY_FILE" "$RECIPIENTS_FILE"
echo "Age encryption configured:"
echo " Private key: $IDENTITY_FILE"
echo " Public key: $RECIPIENTS_FILE"
fi
# Register this machine (with encryption settings)
if [ "$ENABLE_ENCRYPTION" = "true" ]; then
bash "${CLAUDE_PLUGIN_ROOT}/scripts/register-machine.sh" "$REMOTE_URL" --encrypt
else
bash "${CLAUDE_PLUGIN_ROOT}/scripts/register-machine.sh" "$REMOTE_URL"
fi
# Export initial brain snapshot
MACHINE_ID=$(cat ~/.claude/brain-config.json | jq -r '.machine_id')
mkdir -p "machines/${MACHINE_ID}"
bash "${CLAUDE_PLUGIN_ROOT}/scripts/export.sh" --output "machines/${MACHINE_ID}/brain-snapshot.json"
# Copy as initial consolidated brain
cp "machines/${MACHINE_ID}/brain-snapshot.json" consolidated/brain.json
# Commit and push (specific paths, not -A)
git add machines/ consolidated/ meta/
git commit -m "Initialize brain: $(hostname)"
git branch -M main
git push -u origin main
Confirm success and show the user:
If any step fails, show the error and suggest fixes (e.g., create the remote repo first on GitHub).
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub toroleapinc/claude-brain --plugin claude-brain-sync9 skills in this plugin
/brain-conflictsReview and resolve unresolved brain merge conflicts./brain-evolveAnalyze accumulated brain memory and propose promotions to CLAUDE.md, rules, or new skills. Makes your brain smarter over time./brain-joinJoin an existing brain sync network from another machine. Pulls the consolidated brain and merges with any local state./brain-logShow brain sync and evolution history./brain-shareShare a skill, agent, or rule with the team by copying it to the shared namespace/brain-shared-listList all shared skills, agents, and rules in the brain network.Other plugins' skills for the same job