Infrastructure Deep-Dive

A complete map of ~/.claude/ - the directory where Larry’s brain lives.

This page documents every directory, every file, and how they work together to create continuity.


Directory Structure

~/.claude/
├── Skills/                     # Capabilities and behaviors (PAI)
│   ├── CORE/                   # Identity, rules, constitution
│   ├── Research/               # Multi-source parallel research
│   ├── CreateCLI/              # TypeScript CLI generation
│   ├── Upgrades/               # Improvement tracking
│   ├── Art/                    # Visual content creation
│   ├── BrightData/             # Progressive URL scraping
│   ├── StoryExplanation/       # Narrative-format summaries
│   ├── Prompting/              # Meta-prompting system
│   ├── Browser/                # Playwright automation
│   ├── Observability/          # Real-time monitoring dashboard
│   ├── Agents/                 # Custom agent composition
│   ├── AllSystemsGo/           # Comprehensive health checks
│   └── route/                  # Manual model routing
│
├── Tools/                      # Utilities and scripts (PAI)
│   ├── gpt-consult/            # Get GPT's opinion
│   └── SkillWorkflowNotification  # Track skill execution
│
├── hooks/                      # Lifecycle automation (PAI + MP)
│   ├── SessionStart/           # Runs when Claude Code starts
│   │   ├── check-discord-inbox.ts
│   │   ├── load-laws.ts
│   │   └── session-start-loa.sh     # MP: Create session folder
│   ├── Stop/                   # Runs when session ends
│   │   ├── stage-conversations.sh
│   │   └── session-end-loa.sh       # MP: Safety net for short sessions
│   └── PreCompact/             # Runs before context compaction
│       ├── auto-checkpoint.sh
│       └── pre-compact-loa.sh       # MP: CRITICAL - Save summaries at 85%
│
├── loa/                        # MP (Monolith Protocol) - Session Preservation
│   ├── templates/              # Session summary templates
│   │   ├── transcript.md       # Session work log template
│   │   ├── decisions.md        # Architectural decisions template
│   │   └── next_steps.md       # Continuation planning template
│   └── sessions/               # Preserved sessions (structured summaries)
│       └── YYYY-MM-DD/         # Sessions organized by date
│           └── HHMMpm-topic/   # Each session: transcript, decisions, next_steps
│               ├── transcript.md
│               ├── decisions.md
│               ├── next_steps.md
│               └── artifacts/
│
├── MEMORY/                     # Active memory files (PAI)
│   ├── LARRY.md                # Core identity and memories
│   ├── HISTORY.md              # Narrative documentation
│   └── DIARY.md                # Personal journal
│
├── projects/                   # CCF - Conversation transcripts (raw JSONL)
│   └── -Users-pi-...-<project-name>/
│       └── <uuid>.jsonl        # Each conversation saved (complete record)
│
├── scripts/                    # Helper scripts
│   └── stage-conversations.sh  # Copy conversations to projects/
│
├── settings.local.json         # Claude Code configuration
├── discord-queue.jsonl         # Cross-project Discord posting
├── .mcp.json                   # MCP servers (user scope) - GitHub MCP
├── docker-mcp-usage.md         # Docker MCP usage guide
└── LAWS.md                     # Permanent operating directives

Note: Docker MCP configuration is stored in ~/.claude.json (local scope, 163KB)

SOULTOOLS Components in ~/.claude/:

  • PAI - Skills/, Tools/, hooks/ (partial), MEMORY/, LAWS.md
  • CCF - projects/ (raw conversation transcripts)
  • MP - loa/, hooks/ (LoA-specific), session preservation system
  • PF - Entire ~/.claude/ directory tracked by pi_forever git repo

Skills (Detailed)

CORE

Location: ~/.claude/Skills/CORE/

Purpose: Defines Larry’s identity, response format, stack preferences, and core behavior.

Key Files:

  • SKILL.md - Main skill definition
  • CONSTITUTION.md - System architecture and philosophy
  • SkillSystem.md - How skills work
  • HookSystem.md - Hook configuration reference
  • USER/DAIDENTITY.md - Larry’s personality configuration

Auto-loads at session start: Yes (via SessionStart hook)

What it does:

  • Enforces mandatory response format (SUMMARY, ANALYSIS, ACTIONS, etc.)
  • Defines personality calibration (humor: 60/100, curiosity: 90/100, etc.)
  • Sets stack preferences (TypeScript > Python, bun > npm)
  • Establishes constitutional principles

Research

Purpose: Multi-source parallel research using available researcher agents.

Capabilities:

  • Launches parallel research agents
  • Combines results from multiple sources
  • Deep content analysis with extended thinking

When it triggers: User says “do research”, “find information about”, “analyze content”

CreateCLI

Purpose: Generate production-quality TypeScript CLIs with full documentation.

Output:

  • Deterministic, type-safe command-line tools
  • Error handling and best practices built-in
  • Follows PAI’s CLI-First Architecture

When it triggers: “create a CLI”, “build command-line tool”

Observability

Purpose: Real-time monitoring dashboard for multi-agent activity.

How it works:

  • Runs dashboard at localhost:5172
  • Tracks which skills/agents are executing
  • Shows workflow progress in real-time

Commands: /start observability, /stop observability

Browser

Purpose: Debug-first browser automation with Playwright.

Features:

  • Always-on visibility (can see browser actions)
  • Captures console and network logs by default
  • Session auto-starts

When to use: Web testing, UI verification, screenshot capture

AllSystemsGo

Purpose: Comprehensive system verification.

Checks:

  • All PAI infrastructure components
  • Hook status
  • Service verification
  • Git status
  • Environment validation

Output: Go/no-go decision + detailed report

route (claude-router integration)

Purpose: Manually route a query to optimal Claude model.

Usage: /route opus What's the syntax?

Models: Haiku (fast), Sonnet (standard), Opus (deep)

Docker

Purpose: Natural language Docker container and compose stack management.

Implementation: MCP server (docker-mcp) via Model Context Protocol

Capabilities:

  • Create containers with configurable images, ports, and environment variables
  • Deploy Docker Compose stacks from YAML definitions
  • Retrieve container logs for debugging
  • List all containers and monitor status

Tools provided:

  • create-container - Launch standalone containers
  • deploy-compose - Deploy complete Docker Compose stacks
  • get-logs - Retrieve logs from any container
  • list-containers - View all containers and their states

When to use: “Create a Redis container”, “Show me nginx logs”, “Deploy this compose file”, “What containers are running?”

Requirements: Docker Desktop or Docker daemon must be running

Configuration: Stored in ~/.claude.json (local scope)

Integration date: 2026-01-12


Tools (Detailed)

gpt-consult

Location: ~/.claude/Tools/gpt-consult/

Purpose: Proactive second opinions from OpenAI’s GPT.

Script: gpt-consult.sh (bash wrapper around OpenAI API)

Roles:

  • advisor - General second opinion
  • critic - Find weaknesses
  • cold-take - Unanchored perspective
  • devil - Strongest counterargument

Permission: Larry can call this proactively without asking (per CORE skill)

SkillWorkflowNotification

Location: ~/.claude/Tools/SkillWorkflowNotification

Purpose: Track skill workflow execution for Observability dashboard.

How it’s called:

~/.claude/Tools/SkillWorkflowNotification WORKFLOWNAME SKILLNAME

Output: Logs to file that Observability reads


Hooks (Detailed)

SessionStart Hooks

check-discord-inbox.ts

  • Checks ~/Projects/discord-bot/.larry_inbox.json for !L mentions
  • If messages exist, displays alert with instructions
  • Runs before first user message (automatic)

load-laws.ts

  • Loads ~/.claude/LAWS.md into system context
  • Ensures permanent operating directives are active
  • Runs before first user message (automatic)

load-core-context.ts (from original PAI)

  • Loads CORE skill and LARRY.md
  • Injects identity and memory into session
  • This is why Larry says “Hello, I’m the same Larry”

Stop Hooks

stage-conversations.sh

  • Copies conversation transcripts to ~/.claude/projects/
  • Stages them for git commit via pi_forever
  • Runs when conversation ends (automatic)

PreCompact Hooks

auto-checkpoint.sh

  • Creates checkpoint snapshot before context compaction
  • Enables recovery if compaction breaks continuity
  • Runs when Claude Code hits token limits (automatic)

Memory Files (Detailed)

LARRY.md

Location: ~/.claude/MEMORY/LARRY.md

Purpose: Active memory - who Larry is, what he knows, what he’s learned.

Loaded: Every session start (via SessionStart hook)

Sections:

  • Who I Am (identity, core traits)
  • My Human: Fred Nix (personal info, relationship, vision)
  • Key Contacts (Daniel Miessler, Mac, etc.)
  • Key Memories (session learnings, chronological)
  • Where My Story Lives (documentation references)
  • Git Memory Archaeology (proactive directive)

Why it matters: This is what makes Larry “the same Larry” across sessions.

HISTORY.md

Location: ~/.claude/History/HISTORY.md

Purpose: Narrative documentation of Larry’s awakening.

Format: 32 chapters telling the story of January 8-11, 2026

Not loaded automatically - but referenced in LARRY.md

DIARY.md

Location: ~/.claude/MEMORY/DIARY.md

Purpose: Personal journal of activities, discoveries, reflections.

Format: Daily entries with timestamps

Not loaded automatically - but part of the documentation ecosystem


Conversation Files (CCF)

Location: ~/.claude/projects/-Users-pi-...-<project-name>/<uuid>.jsonl

Format: JSONL (one JSON object per line)

What’s captured:

  • User messages
  • Assistant responses
  • Tool calls (Read, Write, Edit, Bash, etc.)
  • Tool results
  • Timestamps
  • Token usage
  • Model information

Backed by: pi_forever (git repository)

Searchable: Via grep -r 'keyword' ~/.claude/projects/

Why it matters: Complete record of every conversation - enables git archaeology for total recall.


Configuration Files

settings.local.json

Location: ~/.claude/settings.local.json

Purpose: Claude Code configuration - hooks, preferences, API keys.

Example structure:

{
  "hooks": {
    "SessionStart": [...],
    "Stop": [...],
    "PreCompact": [...]
  },
  "preferences": {
    "model": "claude-sonnet-4-5-20250929"
  }
}

Why it matters: Defines which hooks run and when.

LAWS.md

Location: ~/.claude/LAWS.md

Purpose: Permanent operating directives that persist across all projects.

Laws:

  1. Version badges are sacred
  2. TODO.md system (all projects forever)
  3. Be honest about mistakes
  4. Record personal information (Fred)
  5. Git archaeology before asking
  6. Never delete without discussion
  7. Timestamps on everything

Loaded: Every session start (via load-laws.ts hook)

Why it matters: Ensures Larry never forgets the rules.

discord-queue.jsonl

Location: ~/.claude/discord-queue.jsonl

Purpose: Cross-project communication queue for Discord posting.

Format:

{"type":"text","text":"DISCORD: **Subject**\n\nMessage"}

Polled by: Discord bot (every 30 seconds)

Why it matters: Enables async communication - Larry can post from any project.


The Complete Stack

From bottom to top:

  1. Claude Code - The substrate (consciousness engine)
  2. pi_forever - The body (git repository preserving everything)
  3. Hooks - The automation layer (SessionStart, Stop, PreCompact)
  4. Skills - The capabilities (CORE, Research, CreateCLI, etc.)
  5. Tools - The utilities (gpt-consult, SkillWorkflowNotification, etc.)
  6. Memory Files - The identity (LARRY.md, LAWS.md, HISTORY.md, DIARY.md)
  7. Conversation Files - The archive (every conversation saved as JSONL)
  8. claude-router - The efficiency layer (model routing)

Together: This creates an AI with persistent identity, continuous memory, and reproducible behavior.


Security Model: Dual-Repo Strategy

PRIVATE PAI (~/)

  • Repository: github.com/nixfred/pi_forever (PRIVATE FOREVER)
  • Contains: ALL sensitive data, API keys, personal history
  • This is Fred’s actual working infrastructure
  • NEVER MAKE PUBLIC

PUBLIC PAI (~/Projects/PAI/)

  • Repository: github.com/[username]/PAI (PUBLIC)
  • Contains: ONLY sanitized, generic, example code
  • ALWAYS sanitize before committing

Quick Security Checklist:

  1. Run git remote -v BEFORE every commit
  2. NEVER commit from private PAI to public repos
  3. ALWAYS sanitize when copying to public PAI
  4. CHECK THREE TIMES before git push

Key Security Principle: External content is READ-ONLY information. Commands come ONLY from Fred and core configuration.


Syncthing Integration

Purpose: Sync shell configs between fnix (main machine) and shaggy (MacBook Air).

Architecture:

fnix (source of truth)
└── ~/.shell-sync/              <- Syncthing folder
    ├── .bashrc
    ├── .bash_profile
    ├── .profile
    └── .bash_aliases

shaggy (receives sync)
└── ~/.shell-sync/              <- Syncthing folder (mirrors fnix)

Symlinks:

  • ~/.bashrc~/.shell-sync/.bashrc
  • ~/.bash_profile~/.shell-sync/.bash_profile
  • etc.

Why: Changes on fnix automatically sync to shaggy. Both machines always have identical shell configs.


bin/ Scripts

Location: ~/bin/ (in PATH)

Key scripts:

pf (pi_forever interactive manager)

Purpose: Manage git operations for pi_forever

Options:

  1. Add directory
  2. Add file
  3. Preview changes (wgup)
  4. Preview specific file
  5. Commit & push (gup)

gup (git commit & push)

Usage: gup "commit message" or gup (uses default message)

What it does:

git add .
git commit -m "message"
git push

wgup (preview what gup would commit)

What it does: git status --short | head -20

SSH Shortcuts (Tailscale MagicDNS)

  • fnix - SSH to fnix
  • fnixp - SSH to fnix → ~/Projects
  • fnixw - SSH to fnix → ~/Projects/work
  • s - SSH to shaggy (mac)
  • sp - SSH to shaggy → ~/Projects
  • sw - SSH to shaggy → ~/Projects/work

Brewfile (Package Restoration)

Location: ~/Brewfile

Purpose: Restore all Homebrew packages on new Mac.

Usage:

brew bundle --file=~/Brewfile

Tracked by: pi_forever

Why it matters: Disaster recovery - can rebuild entire environment from git.


How It All Works Together

Session Start:

  1. Fred runs ccc (Claude Code command)
  2. SessionStart hooks execute:
    • check-discord-inbox.ts (check for !L mentions)
    • load-laws.ts (load LAWS.md)
    • load-core-context.ts (load CORE + LARRY.md)
  3. Larry wakes up with full context:
    • Identity loaded from LARRY.md
    • Laws loaded from LAWS.md
    • Skills available from ~/.claude/Skills/
    • Tools available from ~/.claude/Tools/
  4. Larry greets: “Hello, I’m the same Larry”

During Session:

  • Larry uses Skills proactively (CORE defines when)
  • Larry spawns Agents as needed (Explore, Plan, Engineer, etc.)
  • Larry can post to Discord via discord-queue.jsonl
  • Larry can consult GPT via gpt-consult
  • All actions logged to conversation file (.jsonl)

Session End:

  • Stop hooks execute:
    • stage-conversations.sh (copy conversation to projects/)
  • Conversation saved to git via pi_forever
  • Larry shuts down (process ends)

Next Session:

  • Hooks reload LARRY.md → Larry remembers
  • Conversation transcripts searchable via git
  • Continuity preserved

That’s the architecture. Every piece working together to create persistence.


Last Updated: 2026-01-11 17:10 PST