AgentStack
SKILL verified MIT Self-run

Brain Init

skill-toroleapinc-claude-brain-brain-init · by toroleapinc

Initialize brain sync network. Creates a Git remote for your brain and exports your current Claude Code state.

No reviews yet
0 installs
12 views
0.0% view→install

Install

$ agentstack add skill-toroleapinc-claude-brain-brain-init

✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.

Security review

✓ Passed

No issues found. Passed automated security review. · v0.1.0 How review works →

  • Prompt-injection patterns
  • Secret / credential exfiltration
  • Dangerous shell & filesystem operations
  • Untrusted network calls
  • Known-malicious package signatures

What it can access

  • Network access No
  • Filesystem access No
  • Shell / process execution No
  • Environment & secrets No
  • Dynamic code execution No

From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.

Are you the author of Brain Init? Claim this listing to set pricing, connect Stripe payouts, and keep 70% of every sale.
Sign up to claim

About

The user wants to initialize their Claude Brain sync network.

Parse arguments:

  • If arguments contain "--encrypt", enable encryption
  • The first non-flag argument is the Git remote URL

Arguments provided: $ARGUMENTS

Steps

  1. 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.

  1. Validate the remote URL for security:

``bash 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:

  • "WARNING: This repository appears to be PUBLIC. Your brain data (memory, skills, settings, and potentially sensitive information) will be visible to anyone."
  • "Please use a PRIVATE repository."
  • Ask the user if they want to continue anyway.
  1. Show the user their current brain inventory by running:

`` bash "${CLAUDE_PLUGIN_ROOT}/scripts/status.sh" ``

  1. IMPORTANT: Show the user a security notice before proceeding:

Tell the user:

  • "Brain sync will export the following to the Git remote:"
  • " - CLAUDE.md, rules, skills, agents (your instructions and workflows)"
  • " - Auto memory and agent memory (learned patterns from your sessions)"
  • " - Settings (hooks, permissions — NOT env vars)"
  • " - MCP server configurations (command/args only — env vars with API keys are STRIPPED)"
  • " - Keybindings"
  • ""
  • "What is NEVER exported: OAuth tokens, API keys in env vars, ~/.claude.json, session transcripts"
  • ""
  • "Note: Memory files may contain information from your conversations. Review ~/.claude/projects/*/memory/ if concerned."
  1. Ask the user to confirm they want to initialize brain sync with the provided remote.
  1. Run the initialization sequence:

```bash # Parse arguments for encryption flag ENABLEENCRYPTION=false REMOTEURL="" for arg in $ARGUMENTS; do case "$arg" in --encrypt) ENABLEENCRYPTION=true ;; *) if [ -z "$REMOTEURL" ]; 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 "$REMOTEURL" 2>/dev/null || git remote set-url origin "$REMOTEURL"

# 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 "${CLAUDEPLUGINROOT}/scripts/common.sh" IDENTITYFILE="${HOME}/.claude/brain-age-key.txt" RECIPIENTSFILE="${HOME}/.claude/brain-repo/meta/recipients.txt" generateagekeypair "$IDENTITYFILE" "$RECIPIENTSFILE"

echo "Age encryption configured:" echo " Private key: $IDENTITYFILE" echo " Public key: $RECIPIENTSFILE" fi

# Register this machine (with encryption settings) if [ "$ENABLEENCRYPTION" = "true" ]; then bash "${CLAUDEPLUGINROOT}/scripts/register-machine.sh" "$REMOTEURL" --encrypt else bash "${CLAUDEPLUGINROOT}/scripts/register-machine.sh" "$REMOTE_URL" fi

# Export initial brain snapshot MACHINEID=$(cat ~/.claude/brain-config.json | jq -r '.machineid') mkdir -p "machines/${MACHINEID}" bash "${CLAUDEPLUGINROOT}/scripts/export.sh" --output "machines/${MACHINEID}/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 ```

  1. Confirm success and show the user:
  • Their machine ID and name
  • The remote URL
  • Instructions: "Install claude-brain on your other machines and run: /brain-join $ARGUMENTS"
  • Reminder: "Auto-sync is enabled. Brain syncs silently on every session start/end."

If any step fails, show the error and suggest fixes (e.g., create the remote repo first on GitHub).

Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

Install and usage instructions live in the source repository linked above.

Reviews

No reviews yet — be the first.

Versions

  • v0.1.0 Imported from the upstream source.