Scripts

August 16, 2026 · View on GitHub

Utility scripts for Claude Code power users.

Overview

ScriptDescription
pptx-to-pdf.shBatch convert PPTX to PDF via Keynote on macOS (no dependencies)
audit-scan.shSecurity and quality audit of Claude Code setup
check-claude.sh/.ps1Health check for Claude Code installation
clean-reinstall-claude.sh/.ps1Clean reinstall of Claude Code
fresh-context-loop.shRun Claude Code in fresh context loops
session-search.shSearch across Claude Code session histories
cc-sessions.pyAdvanced session search with incremental indexing (Python)
session-stats.shStatistics about Claude Code sessions
bridge.pyBridge: Claude Code → doobidoo → LM Studio
bridge-plan-schema.jsonJSON Schema for bridge plan v1 format
migrate-arguments-syntax.shMigrate v1 → v2 slash command argument syntax (bash)
migrate-arguments-syntax.ps1Migrate v1 → v2 slash command argument syntax (PowerShell)
rtk-benchmark.shBenchmark RTK token savings vs raw commands
sync-claude-config.shSync Claude config files across machines
sonnetplan.shRun Claude with Sonnet replacing Opus (cost optimization alias)
test-prompt-caching.tsVerify Anthropic prompt caching is active (no deps, fetch only)
smart-suggest-roi.pyAnalyze acceptance rate of smart-suggest hook suggestions vs session activity
supply-chain-triage.pyTriage a workstation after an npm supply chain incident (lockfiles, preinstall droppers, payload hashes, startup hooks, revocation watchers, egress)

Bridge Script (Claude Code → LM Studio)

Purpose: Execute Claude Code plans locally via LM Studio for cost savings.

Architecture

┌──────────────┐     store_memory      ┌─────────────────┐
│ Claude Code  │ ─────────────────────►│    doobidoo     │
│   (Opus)     │   tag: "plan"         │   SQLite + Vec  │
│   PLANNER    │   status: "pending"   │ ~/.mcp-memory-  │
└──────────────┘                       │  service/       │
                                       └────────┬────────┘

                                                │ Direct SQLite read

                                       ┌─────────────────┐
                                       │   bridge.py     │
                                       │                 │
                                       │ • PlanReader    │
                                       │ • StepExecutor  │
                                       │ • Validator     │
                                       └────────┬────────┘

                                                │ HTTP POST
                                                │ /v1/chat/completions

                                       ┌─────────────────┐
                                       │    LM Studio    │
                                       │  localhost:1234 │
                                       └─────────────────┘

Requirements

pip install httpx
  • doobidoo MCP server with SQLite backend (~/.mcp-memory-service/)
  • LM Studio running on localhost:1234 with a loaded model

Usage

# Check LM Studio is running
python bridge.py --health

# List pending plans
python bridge.py --list

# Execute all pending plans
python bridge.py

# Execute specific plan
python bridge.py --plan plan_auth_refactor

# Verbose mode
python bridge.py -v

Workflow

1. Claude Code creates the plan

In Claude Code (Opus), store a plan via doobidoo:

store_memory("""
{
  "$schema": "bridge-plan-v1",
  "id": "plan_auth_refactor",
  "status": "pending",
  "context": {
    "project": "/path/to/project",
    "objective": "Refactor authentication to use JWT",
    "files_context": {
      "src/auth.py": "LOAD",
      "src/config.py": "REFERENCE"
    }
  },
  "steps": [
    {
      "id": 1,
      "type": "analysis",
      "description": "Analyze current auth implementation",
      "prompt": "Analyze the authentication code and identify migration points for JWT.",
      "validation": {"type": "non_empty"}
    },
    {
      "id": 2,
      "type": "code_generation",
      "description": "Generate JWT middleware",
      "prompt": "Generate a JWT authentication middleware based on the analysis.",
      "depends_on": [1],
      "validation": {"type": "syntax_check"},
      "file_output": "src/jwt_auth.py"
    }
  ]
}
""", tags=["plan"])

2. Execute via bridge

python bridge.py
# Reads plan from doobidoo SQLite
# Executes each step via LM Studio
# Stores results back in doobidoo

3. Retrieve results in Claude Code

search_by_tag(["result", "plan_auth_refactor"])
# Returns all execution results

Plan Schema

See bridge-plan-schema.json for the complete JSON Schema.

FieldRequiredDescription
$schemaYesMust be "bridge-plan-v1"
idYesUnique plan ID (e.g., plan_auth_refactor)
statusYespending, in_progress, completed, failed
context.objectiveYesHigh-level goal description
context.projectNoAbsolute path to project root
context.files_contextNoFiles to inject (LOAD) or reference
stepsYesArray of execution steps

Step Types

TypeUse Case
analysisAnalyze code, identify patterns, plan changes
code_generationGenerate new code from scratch
code_modificationModify existing code
decisionMake architectural or design decisions

Validation Types

TypeDescription
non_emptyOutput is not empty (default)
jsonValid JSON output
syntax_checkValid Python syntax
contains_keysJSON contains specific keys

Failure Handling

on_failureBehavior
retry_with_contextRetry with error feedback (default)
skipSkip step, continue execution
haltStop entire plan

Cost Savings

  • Planning (Opus): ~$0.50-2.00 per complex plan
  • Execution (LM Studio): Free (local)
  • ROI: 80-90% cost reduction on implementation tasks

Limitations

LimitationMitigation
Local model quality variesStrict validation + retries
No MCP tools in LM StudioInject file content in context
Limited context windowTruncate old results
No streaming120s timeout per step

Audit Scan

Security and quality audit of your Claude Code configuration.

./audit-scan.sh

Checks:

  • Sensitive data in CLAUDE.md files
  • Permission configurations
  • MCP server security
  • Hook script safety

Health Check

Quick verification of Claude Code installation.

# macOS/Linux
./check-claude.sh

# Windows
./check-claude.ps1

Clean Reinstall

Complete reinstall preserving configurations.

# macOS/Linux
./clean-reinstall-claude.sh

# Windows
./clean-reinstall-claude.ps1

Fresh Context Loop

Run Claude Code with fresh context for long-running tasks.

./fresh-context-loop.sh --iterations 5 --project /path/to/project

Search across all Claude Code session histories.

./session-search.sh "authentication"

Session Manager (Advanced)

Advanced CLI for session search, browse, resume & pattern discovery with incremental indexing.

vs session-search.sh: Faster search (~200ms vs ~400ms), partial ID resume, branch filter, worktree support, incremental JSONL index, and discover subcommand for automated config optimization.

GitHub: FlorianBruniaux/cc-sessions

# Search in current project
cc-sessions search "notion"

# Search all projects
cc-sessions --all search "stripe"

# Filter by date and branch
cc-sessions search "auth" --since 7d --branch develop

# Recent sessions
cc-sessions recent 10

# Resume with partial ID
cc-sessions resume 8d472d

# JSON output for scripting
cc-sessions --json search "prisma" | jq -r '.[].id'

# Discover recurring patterns (n-gram, local, free)
cc-sessions --all discover

# Discover with semantic analysis via claude --print
cc-sessions --all discover --llm

# JSON output for scripting
cc-sessions --all discover --json | jq '.[] | select(.category == "skill")'

Install from GitHub:

curl -sL https://raw.githubusercontent.com/FlorianBruniaux/cc-sessions/main/cc-sessions \
  -o ~/.local/bin/cc-sessions && chmod +x ~/.local/bin/cc-sessions

Or copy locally: cp cc-sessions.py ~/bin/cc-sessions && chmod +x ~/bin/cc-sessions

GitHub repo · Gist


Session Stats

Get statistics about your Claude Code usage.

./session-stats.sh

PPTX to PDF (macOS)

Batch convert PPTX presentations to PDF using Keynote. No LibreOffice, no Python — just macOS + Keynote.

# Convert all PPTX in a folder (recursive)
./pptx-to-pdf.sh ~/Downloads/Prose

# Convert current directory
./pptx-to-pdf.sh

Requirements: macOS + Keynote installed.

Behavior:

  • Recursive: finds all .pptx files in subdirectories
  • Idempotent: skips files where a .pdf already exists
  • Output: PDF created alongside each PPTX, same folder, same name
  • Summary printed at the end

Key gotcha: The script opens files via open -a "Keynote" from the shell, not via AppleScript's own open command. When Keynote opens a PPTX via AppleScript, it sometimes doesn't register the document in its internal list, causing error -1719 on document 1. The shell open + 8-second sleep pattern fixes this reliably.