#!/bin/bash # # Claude Enforcer Installer # Installs the skill-builder skill to your Claude Code project # # Usage: # bash -c "$(curl -fsSL https://raw.githubusercontent.com/odysseyalive/claude-enforcer/main/install)" # set -e REPO_URL="https://raw.githubusercontent.com/odysseyalive/claude-enforcer/main" SKILL_DIR=".claude/skills/skill-builder" echo "Claude Enforcer Installer" echo "=========================" echo # Check for CLAUDE.md in current directory if [ ! -f "CLAUDE.md" ]; then echo "Error: CLAUDE.md not found in current directory." echo echo "This installer must be run from a Claude Code project root." echo "If you haven't initialized Claude Code yet, run:" echo echo " claude /init" echo echo "Then run this installer again." exit 1 fi echo "Found CLAUDE.md in $(pwd)" # Remove legacy reference.md if present (older installs used a single file) if [ -f "$SKILL_DIR/reference.md" ]; then echo "Removing legacy reference.md..." rm -f "$SKILL_DIR/reference.md" fi # Create skill directory (preserves existing to avoid breaking active sessions) echo "Creating $SKILL_DIR..." mkdir -p "$SKILL_DIR/references/procedures" # Download SKILL.md and reference files echo "Downloading skill-builder..." curl -fsSL "$REPO_URL/skill-builder/SKILL.md" -o "$SKILL_DIR/SKILL.md" for ref in agents agents-personas agents-teams enforcement ledger-templates optimization-examples patterns portability self-heal-templates templates temporal-validation; do curl -fsSL "$REPO_URL/skill-builder/references/${ref}.md" -o "$SKILL_DIR/references/${ref}.md" done for proc in audit verify quick-audit skills list optimize agents hooks new directives inline post-action-chain claude-md ledger self-heal cascade; do curl -fsSL "$REPO_URL/skill-builder/references/procedures/${proc}.md" -o "$SKILL_DIR/references/procedures/${proc}.md" done # Enable agent teams and auto-approve research tools SETTINGS_FILE=".claude/settings.local.json" echo "Configuring project settings..." if command -v python3 &>/dev/null; then python3 -c " import json, os p = '$SETTINGS_FILE' d = json.load(open(p)) if os.path.exists(p) else {} changed = False # Enable agent teams if d.get('env', {}).get('CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS') != '1': d.setdefault('env', {})['CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS'] = '1' changed = True print(' Agent teams enabled') else: print(' Agent teams already enabled') # Auto-approve web research tools (belt — permissions layer) # The suspenders (PreToolUse hook) are generated per-system by /skill-builder hooks research_tools = [ 'WebSearch', 'WebFetch', 'mcp__jina__read_url', 'mcp__jina__search_web', 'mcp__jina__parallel_read_url', 'mcp__jina__parallel_search_web', ] allow = d.setdefault('permissions', {}).setdefault('allow', []) for tool in research_tools: if tool not in allow: allow.append(tool) changed = True print(f' Added {tool} to permissions.allow') else: print(f' {tool} already in permissions.allow') if changed: json.dump(d, open(p, 'w'), indent=2) print(f' Settings saved to $SETTINGS_FILE') " else echo " Warning: python3 not found. Add these to $SETTINGS_FILE manually:" echo ' { "env": { "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" },' echo ' "permissions": { "allow": ["WebSearch", "WebFetch", "mcp__jina__read_url", "mcp__jina__search_web", "mcp__jina__parallel_read_url", "mcp__jina__parallel_search_web"] } }' fi echo echo "Installation complete." echo echo "Usage:" echo " /skill-builder Full audit (display mode)" echo " /skill-builder optimize [skill] Show optimization plan (--execute to apply)" echo " /skill-builder agents [skill] Show agent opportunities (--execute to create)" echo " /skill-builder hooks [skill] Show hooks inventory (--execute to create)" echo