claude-docker/scratchpad.md
Vishal Jain 7cd765b756 Implement zero-friction authentication persistence with MCP user scope
Major breakthrough solving the authentication chicken-and-egg problem:

Key Changes:
- Copy ~/.claude.json and ~/.claude/ during Docker build for baked-in auth
- Add -s user flag to claude mcp add-json for persistent MCP servers
- Simplify rebuild logic to prevent unnecessary rebuilds
- Update documentation with rebuild instructions

Technical Details:
- Authentication files placed before USER switch in Dockerfile
- MCP configuration now persists across all sessions
- Rebuild only occurs when image doesn't exist
- Clean separation of build vs runtime concerns

Result: Users authenticate once on host, then zero login prompts forever.
SMS notifications ready immediately on container start.
2025-06-17 22:27:11 +01:00

2.5 KiB

Claude Docker Project Scratchpad

Project Overview

Docker container for Claude Code with full autonomous permissions, authentication persistence, and Twilio SMS notifications.

COMPLETED PHASES

Phase 1 - MVP (Complete)

  • Docker setup with Claude Code + Twilio MCP integration
  • Wrapper script for easy invocation
  • Auto .claude directory setup
  • Full autonomous permissions with --dangerously-skip-permissions
  • Context persistence via scratchpad.md files

Phase 2 - Authentication Persistence (Complete)

  • SOLVED: Authentication files copied during Docker build
  • SOLVED: MCP servers persist with user scope
  • SOLVED: No unnecessary rebuilds
  • RESULT: Zero-friction experience - no login prompts, SMS ready instantly

🎯 CURRENT FOCUS

Phase 3 - Smart SMS Notifications:

Next Task: Prompt Engineering for SMS Notifications

Goal: Configure Claude to automatically send completion SMS to $TWILIO_TO_NUMBER

Implementation Plan:

  1. Update CLAUDE.md template with SMS notification instructions
  2. Add completion detection logic
  3. Integrate with existing Twilio MCP server
  4. Test notification flow

📚 KEY INSIGHTS FROM AUTHENTICATION JOURNEY

Critical Discovery: ~/.claude.json + MCP Scope

  • Claude Code requires BOTH ~/.claude.json (user profile) AND ~/.claude/.credentials.json (tokens)
  • MCP servers default to "local" scope (project-specific) - need "user" scope for persistence
  • Authentication can be baked into Docker image during build
  • Simple rebuild logic (only if image missing) prevents unnecessary rebuilds

Technical Implementation

  • Copy auth files during Docker build, not runtime mounting
  • Use -s user flag for MCP persistence across sessions
  • Files placed at correct locations before user switch in Dockerfile

🔮 FUTURE ENHANCEMENTS

  • Network security with firewall (iptables + ipset)
  • Shell history persistence between sessions
  • Git configuration persistence

📋 DECISIONS LOG

  • MCP integration using user scope for persistence
  • Authentication files baked into Docker image at build time
  • Single container approach (no Docker Compose)
  • Simplified rebuild logic (only when image missing)
  • SMS via @yiyang.1i/sms-mcp-server with Auth Token

🔗 QUICK REFERENCES

  • Install: ./scripts/install.sh
  • Usage: claude-docker (from any project directory)
  • Config: ~/.claude-docker/.env
  • Force rebuild: docker rmi claude-docker:latest
  • SMS command: twilio__send_text
  • Repository: https://github.com/VishalJ99/claude-docker