Borrowing it
Nothing to install: this file belongs to kossakovsky/selfhost-ai. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/kossakovsky/selfhost-ai/main/CLAUDE.mdgit clone --depth 1 https://github.com/kossakovsky/selfhost-aiWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/kossakovsky/selfhost-ai/claude-md)<a href="https://agentmods.dev/instructions/kossakovsky/selfhost-ai/claude-md"><img src="https://agentmods.dev/badge/instructions/kossakovsky/selfhost-ai/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/kossakovsky/selfhost-ai/claude-md"><img src="https://agentmods.dev/badge/instructions/kossakovsky/selfhost-ai/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.11781 | $0.11781 |
| Opus 5.5 | $0.04712 | $0.04712 |
| Sonnet 5.5 | $0.02356 | $0.02356 |
| Haiku 4.5 | $0.01178 | $0.01178 |
Grade B, and why
selfhost-ai CLAUDE.md scanned grade B with 2 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Asks for rootmediumPrivilege escalation
A mod that escalates privileges can change anything on the machine, not only the project.
- **Never add `OPEN_TERMINAL_ALLOWED_DOMAINS` to the compose file.** The entrypoint distinguishes unset (full egress) from set-but-empty (drop all outbound) and runs `sudo iptables` under `set -e`, which needs `NET_ADMIN Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
- Never mount `docker.sock`: the entrypoint auto-joins the socket's group and the agent's shell would control the host daemon. The server process runs as `user` with passwordless sudo, so no `cap_drop` (apt, useradd and How it starts
The opening of the file, as written. The whole thing — 478 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Project Overview
This is Selfhost AI (repository selfhost-ai, formerly n8n-install), a Docker Compose-based installer that provides a comprehensive self-hosted environment for n8n workflow automation and numerous AI/automation services. The installer includes an interactive wizard, automated secret generation, and integrated HTTPS via Caddy.
Core Architecture
- Profile-based service management: Services are activated via Docker Compose profiles (e.g.,
n8n,flowise,monitoring). Profiles are stored in the.envfile'sCOMPOSE_PROFILESvariable. - No exposed ports: Services do NOT publish ports directly. All external HTTPS access is routed through Caddy reverse proxy on ports 80/443.
- Shared secrets: Core services (Postgres, Valkey (Redis-compatible, container named
redisfor backward compatibility), Caddy) are always included. Other services are optional and selected during installation. - Queue-based n8n: n8n runs in
queuemode with Redis, Postgres, and dynamically scaled workers (N8N_WORKER_COUNT).
Key Files
Makefile: Common commands (install, update, logs, etc.)docker-compose.yml: Service definitions with profilesCaddyfile: Reverse proxy configuration with automatic HTTPS.env: Generated secrets and configuration (from.env.example)scripts/install.sh: Main installation orchestrator (runs numbered scripts 01-08 in sequence)scripts/utils.sh: Shared utility functions (sourced by all scripts viasource "$(dirname "$0")/utils.sh" && init_paths)scripts/01_system_preparation.sh: System updates, firewall, security hardeningscripts/02_install_docker.sh: Docker and Docker Compose installationscripts/git.sh: Git utilities (sync with origin, branch detection, configuration)scripts/03_generate_secrets.sh: Secret generation and bcrypt hashingscripts/04_wizard.sh: Interactive service selection using whiptailscripts/05_configure_services.sh: Service-specific configuration logicscripts/databases.sh: Creates isolated PostgreSQL databases for services (library)scripts/telemetry.sh: Anonymous telemetry functions (Scarf integration)scripts/06_run_services.sh: Starts Docker Compose stackscripts/07_final_report.sh: Post-install credential summaryscripts/08_fix_permissions.sh: Fixes file ownership for non-root access. Skips the container-written data directories undersupabase/docker/volumes(db/data,storage) anddify/docker/volumes(default stack plus every optional vector store's data;CONTAINER_OWNED_DIRS; supabase/postgres cannot read its data as the host user) and, as a backstop, gives Supabase Postgres files back to the uidsupabase-dbreportsscripts/generate_n8n_workers.sh: Generates dynamic worker/runner compose file and the Prometheus n8n targets filescripts/generate_ollama_instances.sh: Generates extra Ollama instances compose file (multi-GPU)scripts/update.sh: Update orchestrator (syncs with origin and updates images)scripts/update_preview.sh: Preview available updates without applying (dry-run)scripts/pull_images.sh: Image pull without the rest of the update (pooled, then per-service retries if that fails); skips locally built services (n8n, runners, OpenClaw) and recreates nothing (used bymake pull)scripts/doctor.sh: System diagnostics (DNS, SSL, containers, disk, memory)scripts/apply_update.sh: Applies updates after git syncscripts/docker_cleanup.sh: Removes unused Docker resources (used bymake clean)scripts/import_workflows.sh: Imports workflows fromn8n/backup/workflows/into n8n (used bymake import)scripts/restart.sh: Restarts services with proper compose file handling (used bymake restart)scripts/setup_custom_tls.sh: Configures custom TLS certificates (used bymake setup-tls); supports--removeto revert to Let's Encryptscripts/setup_sysbox.sh: Installs Sysbox (sysbox-runc) for the n8n Assistant sandbox runner; called by05_configure_services.shwhen then8n-sandboxprofile is activestart_services.py: Python orchestrator for service startup order, builds Docker images, handles external services (Supabase/Dify cloning, env preparation, startup), generates SearXNG secret key, stops existing containers. Usespython-dotenv(dotenv_values).
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 9d ago Changed · +1 lines · +104 tokens per session 222402725f46
- 18d ago Changed · +3 lines · +532 tokens per session e55374cb3245
- 23d ago Changed · +5 lines · +270 tokens per session d24505c9777d
- 27d ago Changed · +233 tokens per session 42b236ecefa3
- 1mo ago Changed · +2 lines · +173 tokens per session 61592d2c4ab5
- 1mo ago Changed · +1 lines · +246 tokens per session 101d2874c58b
- 1mo ago Changed · +2 lines · +143 tokens per session 28092c2bce8f
- 1mo ago Changed · +12 lines · +1,560 tokens per session 9a7bbced6697
- 1mo ago Changed · +3 lines · +233 tokens per session 616d9b420c7d
- 1mo ago First seen · 449 lines · 8,287 tokens per session scan B 9b480c01c354
selfhost-ai CLAUDE.md is an instructions file published in the GitHub repository kossakovsky/selfhost-ai (955 stars, last pushed 10d ago), licensed Apache-2.0. It adds 11,781 tokens to every session, about $0.0471 per session on Opus 5.5. A static security scan graded it B with 2 findings (asks for root, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
selfhost-ai CLAUDE.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| selfhost-ai CLAUDE.mdkossakovsky/selfhost-ai | Instructions file | 955 | 10d ago | Apache-2.0 | B | 11,781 | Claude Code |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | today | MIT | A | 7,461 | Codex, OpenCode |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | yesterday | MIT | A | 4,680 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 5,516 | GitHub Copilot |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 3,093 | GitHub Copilot |
| deepseek-harness AGENTS.mddeepseek-ai/deepseek-harness | Instructions file | 274k | 2d ago | MIT | A | 4,313 | Codex, OpenCode |