agentleFS
icefort-aiicefort-ai/config/CLAUDE.md

config

CLAUDE.md41 starsChanged 17 months agoMITView on GitHub

Why This Pattern? - Simpler deployment (single server binary) - No proxy configuration complexity - Consistent behavior between dev/prod - Server-Sent Events work reliably CRITICAL for automation: Always use the ./scripts/ commands to avoid timeouts: Why these scripts matter: - The old ./start-dev.sh waits 10+ seconds doing health checks,

  • Installs packages
  • Sends data out

The file

We split this CLAUDE.md into the rules it gives an agent

9 rules. About 0 are common, 3 are distinctive, and 6 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 6

    Very specific

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

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    No proxy configuration complexity

    line 109
  2. Very specific:

    CRITICAL for automation: Always use the ./scripts/ commands to avoid timeouts:

    line 125
  3. Very specific:

    All packages use ESM ("type": "module") with .js imports

    line 203
  4. Very specific:

    Create adapter class extending BaseAdapter

    line 211
  5. Very specific:

    Add adapter to CoreService.registerAdapters()

    line 213
  6. Very specific:

    Test with both detect() false and true cases

    line 214
  7. Distinctive:

    Use the web interface to visually verify configuration detection and editing

    line 217
  8. Very specific:

    Test file watching by manually editing config files while app is running

    line 218
  9. Distinctive:

    Verify backup creation and restoration functionality

    line 219

≈ “Common” is an estimate: at least 1 in 5 of the 12,729 CLAUDE.md 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
CLAUDE.md

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Essential Commands

Development Workflow

# Install dependencies (requires pnpm)
pnpm install

# Build all packages and apps
pnpm build

# Build only core package
pnpm --filter @snowfort/config-core run build

# Build only web app (includes server)
pnpm --filter @snowfort/config-web run build

# IMPORTANT: Web development uses build-first workflow
# NOT hot-reload like typical React apps

# For web development - USE THESE COMMANDS (they avoid timeouts):
./scripts/start.sh   # Quick start (exits immediately)
./scripts/status.sh  # Check if server is running
./scripts/stop.sh    # Stop server
./scripts/logs.sh    # View server output
./scripts/restart.sh # Restart server

# Run linting across all packages
pnpm lint

# Run type checking
pnpm typecheck

# Clean all build outputs
pnpm clean

Testing & Running

# Start web development server (RECOMMENDED - avoids timeouts)
./scripts/start.sh

# Check server status and health
./scripts/status.sh

# View server logs
./scripts/logs.sh

# Stop development server
./scripts/stop.sh

# Test CLI binary
node bin/sfconfig.js --help
node bin/sfconfig.js web
node bin/sfconfig.js web --port 3000

# Run tests
pnpm test

Server Management

# Start server (builds and starts, exits immediately)
./scripts/start.sh

# Check if server is running and healthy
./scripts/status.sh

# Stop server cleanly
./scripts/stop.sh

# Restart server (stop + start)
./scripts/restart.sh

# View server logs (recent)
./scripts/logs.sh

# Follow live logs
./scripts/logs.sh -f

# If port conflicts occur, use stop then start
./scripts/stop.sh && ./scripts/start.sh

API Testing

# Test API endpoints (server must be running)
curl http://localhost:4040/api/state
curl -X POST -H "Content-Type: application/json" \
  -d '{"claude-code": {"verbose": true}}' \
  http://localhost:4040/api/patch

Development Workflow Notes

Web Development Pattern

This project uses a build-first development workflow, NOT the typical React hot-reload pattern:

  1. Build Step Required: Frontend must be built before running (pnpm build)
  2. Integrated Server: Express serves both built React frontend AND API endpoints
  3. Single Port: Everything runs on port 4040 (no proxying needed)
  4. Production-like: Development closely mirrors production deployment

Why This Pattern?

  • Simpler deployment (single server binary)
  • No proxy configuration complexity
  • Consistent behavior between dev/prod
  • Server-Sent Events work reliably

Common Pitfalls to Avoid

  • ❌ Don't run pnpm dev (vite only) expecting API to work
  • ❌ Don't add proxy configurations to vite.config.ts
  • ❌ Don't assume hot-reload development workflow
  • ❌ Don't use ./start-dev.sh (causes timeouts in Claude Code)
  • ❌ Don't assume typical React dev patterns - always examine server code first to understand the intended architecture
  • ✅ Always build first, then run the integrated server
  • ✅ Use ./scripts/start.sh for automation (exits immediately, no timeouts)
  • ✅ Use ./scripts/status.sh to verify server started successfully

Claude Code Operational Best Practices

CRITICAL for automation: Always use the ./scripts/ commands to avoid timeouts:

  1. Starting the server:
    ./scripts/start.sh    # Builds, starts, exits immediately
    ./scripts/status.sh   # Verify it started (run separately)
  2. Checking server status:
    ./scripts/status.sh   # Shows PID, health check, URL
  3. Viewing logs:
    ./scripts/logs.sh     # Recent logs
    ./scripts/logs.sh -f  # Follow live (only for manual debugging)
  4. Stopping/restarting:
    ./scripts/stop.sh     # Clean shutdown
    ./scripts/restart.sh  # Stop + start

Why these scripts matter:

  • The old ./start-dev.sh waits 10+ seconds doing health checks, causing Claude Code tool timeouts
  • New scripts start the server and exit immediately, then you check status separately
  • Proper backgrounding with log redirection and PID management
  • Avoids the "server started but command timed out" confusion

Architecture Overview

Core Service Pattern

The application uses a centralized CoreService that manages configuration state and acts as an event emitter. The web interface consumes this service:

  • Web: Express server hosts CoreService and exposes REST API + Server-Sent Events

Engine Adapter System

New AI CLI tools are supported through the EngineAdapter interface. Each adapter implements:

  • detect() - Check if configuration file exists
  • read() - Parse configuration from disk
  • validate(data) - JSON schema validation
  • write(data) - Safe atomic writes with backup
  • getConfigPath() - Resolve configuration file location

Current adapters: ClaudeAdapter (~/.claude.json), CodexAdapter (~/.codex/config.json)

Workspace Structure

packages/core/     # CoreService, adapters, backup system
apps/web/         # React SPA + Express server
bin/sfconfig.js   # CLI entry point using commander

State Management & Real-time Updates

  • File Watching: Core service uses chokidar to watch config files
  • Event Broadcasting: State changes emit events to connected clients
  • IPC Communication:
    • Web: Server-Sent Events (/api/events) for real-time browser updates

Safe Configuration Editing

  • Schema Validation: AJV validation before any writes
  • Automatic Backups: Timestamped .json files in .sfconfig-backups/
  • Atomic Operations: Failed writes never corrupt original files
  • Deep Merging: Patch operations preserve unknown configuration fields

Web Server Architecture

The web app has dual build outputs:

  • Frontend: Vite builds React SPA to apps/web/dist/
  • Backend: TypeScript compiles server to apps/web/dist-server/
  • Static Serving: Express serves built frontend and handles SPA routing

Key Implementation Notes

TypeScript Configuration

  • Core package uses moduleResolution: "bundler" for modern ESM
  • Web server uses moduleResolution: "node" for Express compatibility
  • All packages use ESM ("type": "module") with .js imports

Error Handling Patterns

  • Validation errors include engine ID and JSON pointer location
  • Configuration read failures gracefully return empty objects
  • Backup restoration is atomic (success/failure, no partial states)

Adding New Engine Support

  1. Create adapter class extending BaseAdapter
  2. Implement JSON schema in adapter
  3. Add adapter to CoreService.registerAdapters()
  4. Test with both detect() false and true cases

Development & Testing Requirements

  • Use the web interface to visually verify configuration detection and editing
  • Test file watching by manually editing config files while app is running
  • Verify backup creation and restoration functionality

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.