agentleFS
toroleapinctoroleapinc/claude-brain/skills/brain-init/SKILL.md

brain-init

Skill91 starsChanged 9 months agoMITView on GitHub

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

  • Installs packages
  • Commits and pushes

2 other projects use a version of this.

Adopted by

Most recently taken up by

  • Other versions2 projects use a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 2

    1. svy04/ballast★ 74same name
    2. jame581/LogseqBrain★ 18same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository8 other files it gives its agents.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    If arguments contain "--encrypt", enable encryption

    line 10
  2. Distinctive:

    If jq and git are missing, tell the user what to install.

    line 21
  3. Distinctive:

    If the URL is detected as pointing to a PUBLIC repository, STOP and warn the user:

    line 28
  4. Distinctive:

    Ask the user if they want to continue anyway.

    line 31
  5. Distinctive:

    Ask the user to confirm they want to initialize brain sync with the provided remote.

    line 51
  6. Distinctive:

    Run the initialization sequence:

    line 53
  7. Distinctive:

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

    line 130

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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.
  2. 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:
    • "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.
  3. Show the user their current brain inventory by running:
    bash "${CLAUDE_PLUGIN_ROOT}/scripts/status.sh"
  4. 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."
  5. Ask the user to confirm they want to initialize brain sync with the provided remote.
  6. 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
  7. 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).

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.