Documentation Index
Fetch the complete documentation index at: https://auto-sop.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
How It Works
auto-sop runs a four-step pipeline that turns recurring Claude Code mistakes into enforced directives — automatically and locally.Step 1: Capture (Observe)
When you runauto-sop install, a lightweight hook shim is registered with Claude Code’s hook system (PreToolUse, PostToolUse, Stop events).
Every time Claude Code invokes a tool, the shim:
- Receives the tool call as JSON on stdin
- Scrubs any secrets or sensitive data
- Writes the capture atomically to
.auto-sop/captures/ - Returns control to Claude Code
The shim uses a double-fork architecture — it spawns a child process and exits immediately. This keeps overhead under 50ms per tool call, so your Claude Code experience stays fast.
Step 2: Learn (Detect)
The learner runs on a schedule (hourly via launchd on macOS or systemd on Linux) or on demand withauto-sop learn-now.
It processes captures through two stages:
Rule-based detection
Detectors scan captures for patterns that appear 3 or more times. Built-in detectors look for:- Same Bash command used when a dedicated tool exists (e.g.,
catinstead ofRead) - Repeated error patterns (same error message across sessions)
- Reverted changes (edits that get undone in the same session)
- Anti-patterns in tool usage sequences
LLM validation
Candidate patterns are validated by Claude (viaclaude -p, using your Claude Max subscription at $0 cost). The LLM:
- Confirms the pattern is a genuine recurring mistake
- Writes a clear, actionable directive
- Assigns a severity level (
errororwarning)
Step 3: Write (Directive creation)
Validated directives are written to a managed section in your project’sCLAUDE.md.
The managed section is:
- Hash-checked — auto-sop detects manual edits and handles merges gracefully
- Git-aware — directives respect your repository structure
- Revertible — any directive can be rolled back with
auto-sop revert <id> - TTL-pruned — stale directives that stop matching can be automatically retired
| Field | Purpose |
|---|---|
| Severity | [error] or [warning] — how strictly Claude should follow it |
| Description | Clear, actionable rule in natural language |
| ID | Unique identifier (sop:sop-xxxx) for tracking and reverting |
| Evidence | Number of sessions where the pattern was observed |
Step 4: Prevent
Claude Code readsCLAUDE.md at the start of every session. When it encounters auto-sop directives, it follows them as project-level instructions.
When a directive is applied, Claude Code emits a marker:
Privacy
The entire pipeline runs locally:Local captures
All captures stay in
.auto-sop/captures/ on your machine. Nothing is uploaded on the free tier.Local analysis
LLM analysis uses your own Claude Max subscription via
claude -p. No external API calls.Optional cloud
Pro tier cloud sync is opt-in and encrypted client-side (AES-256) before upload.

