paperless-brain: Instructions file for Claude Code

CLAUDE.md

paperless-brain CLAUDE.md is an instructions file for Claude Code from vailsen/paperless-brain. It costs 19,242 tokens per session, scanned A, original, MIT.

Project instructions for PaperlessBrain, an AI-powered web interface for searching and chatting with a Paperless-ngx document archive. The archive can contain documents such as invoices, contracts, and letters, and the app runs with NiceGUI, FastAPI, Claude, or Ollama.

In plain words
What is it for?
Use them when developing or deploying PaperlessBrain, installing its optional features, starting the local app, managing versions, or publishing a release.
Why use it?
They give a coding agent the project's purpose, local development command, dependencies, deployment process, and key repository rules.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: mentions CLAUDE.md; mentions Claude Code.

This is vailsen/paperless-brain's own configuration. It tells Claude Code how to work on paperless-brain itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything paperless-brain configures →

Reuse

Borrowing it

Nothing to install: this file belongs to vailsen/paperless-brain. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/vailsen/paperless-brain/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/vailsen/paperless-brain

Made for: Claude Code.

Wrote 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.

agentmods badge for paperless-brain CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/vailsen/paperless-brain/claude-md/github.svg)](https://agentmods.dev/instructions/vailsen/paperless-brain/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/vailsen/paperless-brain/claude-md"><img src="https://agentmods.dev/badge/instructions/vailsen/paperless-brain/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.

agentmods 80×15 button for paperless-brain CLAUDE.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/vailsen/paperless-brain/claude-md"><img src="https://agentmods.dev/badge/instructions/vailsen/paperless-brain/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 19,242 This file is loaded in full into every session.
When invoked 19,242 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.19242 $0.19242
Opus 5.5 $0.07697 $0.07697
Sonnet 5.5 $0.03848 $0.03848
Haiku 4.5 $0.01924 $0.01924

Measured yesterday against content hash 285039b923ba, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

paperless-brain CLAUDE.md scanned grade A with 0 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 yesterday.

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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

CLAUDE.md · 1,152 lines

How it starts

The opening of the file, as written. The whole thing — 1,152 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.

What this is

PaperlessBrain — AI-powered frontend for Paperless-ngx. Built with NiceGUI + FastAPI. Lets users chat with their document archive (invoices, contracts, letters) via Claude or Ollama LLMs, with full tool-call agentic loop.

Running

# Local dev
python main.py
# App runs at http://0.0.0.0:8080

# Release: tag it; CI publishes latest / lean / the version
git tag vX.Y.Z && git push origin main --tags   # .github/workflows/release.yml

The dev server deploys itself: every merge to main, and every manual "Run workflow" on any branch, publishes :dev (never :latest), and a systemd timer on the server (paperlessbrain-autodeploy, every 2 min) pulls it, restarts both containers and prunes old images. It waits up to 3 h for a running Werkbank run, which a restart would stop. Watchtower is gone: it recreated containers past Compose and raced manual deploys.

Dependencies

Single source of truth: pyproject.toml (direct deps only, range pins; name paperless-brain, version from config/version.py via hatchling). The old requirements*.txt files are gone.

# GPU machine (dev)
pip install -e ".[crawl,i18n]"

# CPU-only (LXC/Docker) — +cpu torch wheel outranks the CUDA build on PyPI
pip install --extra-index-url https://download.pytorch.org/whl/cpu -e ".[crawl,i18n]"
playwright install chromium   # only needed with the [crawl] extra

# Docker
docker build -t paperless-brain .                    # full
docker build --build-arg LEAN=1 -t paperless-brain . # no crawl4ai/chromium
docker compose up -d

Extras: [crawl] = crawl4ai + headless Chromium (JS-heavy page fetching — app degrades to trafilatura-only without it); [i18n] = pybabel workflow.

Configuration

All settings via .env file (loaded by config/settings.py via pydantic-settings). Required keys:

  • APP_PATH — absolute path to repo root (with trailing slash)
  • PAPERLESS_URL, PAPERLESS_SUPERUSER_TOKEN — Paperless-ngx API
  • IGNORE_INBOX_TAG_AT_SYNC — tag name to skip during sync
  • EMBEDDING_MODEL, CHROMA_PATH, CHROMA_COLLECTION, EXTRACTION_SIDECAR_PATH, THUMB_PATH
  • OLLAMA_SERVER, OLLAMA_INGEST_MODEL — optional, vision LLM for ingestion (both also settable in Settings > Processing, which wins). Chat and Werkbank never read them — those use per-user models with their own base_url. OLLAMA_SERVER additionally names the host the WoL/shutdown buttons control; without it that is inferred from the first local-lane model in the registry.
  • Every Anthropic SDK client comes from services/anthropic_client.async_client. SDK 2.x sends the key as Authorization: Bearer; for a custom base URL the factory moves it back to X-Api-Key (gateways read that). Sampling parameters are never sent on the Anthropic path (2026-10-21 rejects them with a 400).
  • No provider API key belongs in .env. Every chat/research/vision model is managed per user in the UI (Settings > AI Models, services/model_registry.py): one entry per service (backend anthropic / openai_compatible, base URL, key, lane) with any number of models below it — which is what makes AI gateways (OpenRouter, Requesty, LiteLLM, Portkey …) work with no code.
    • get_models() stays the flat view (one dict per model, service fields merged in). Everything that runs a model reads that; only the settings editor sees the tree.
    • A model is referenced by its display name, everywhere (chat choice, ingest model, memo/dream model, Werkbank). The ingest model is a global setting resolved in whichever user's registry triggers the sync, so a per-user id would not do. Hence display names are unique across all services (enforced on save), and a rename re-points the stored choices.
    • Every model dropdown goes through app_ui/model_picker.model_select, which groups by service. Never a raw ui.select over model names.
    • The flat list of older versions (llm_models) is migrated on first read and left in place as a fallback copy. A base URL is normalized on save — a pasted /chat/completions or /v1/messages doubled the path and produced a bare 404.
  • SEARXNG_HOST — self-hosted SearXNG instance
  • STORAGE_SECRET — NiceGUI session secret

Read the full file on GitHub · 1,152 lines

Changes

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.

  1. yesterday Changed · +6 lines · +123 tokens per session 285039b923ba
  2. 2d ago Changed · +59 lines · +1,052 tokens per session 66992fb0358d
  3. 3d ago Changed · +59 lines · +963 tokens per session ca7155def141
  4. 4d ago Changed · +14 lines · +294 tokens per session f1f5ce2f7d08
  5. 6d ago Changed · +3 lines · +438 tokens per session a20fc6262473
  6. 7d ago Changed · +98 lines · +2,990 tokens per session c927d6df560f
  7. 14d ago Changed · +17 lines · +394 tokens per session 334f1c013fa9
  8. 15d ago Changed · +59 lines · +1,150 tokens per session 953ccfdf3d6b
  9. 17d ago Changed · +12 lines · +173 tokens per session 546b942e5dee
  10. 19d ago First seen · 825 lines · 11,665 tokens per session scan A 40b4e4494104

Subscribe to this mod's changes

paperless-brain CLAUDE.md is an instructions file published in the GitHub repository vailsen/paperless-brain (31 stars, last pushed 2d ago), licensed MIT. It adds 19,242 tokens to every session, about $0.0770 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

paperless-brain CLAUDE.md compared with instructions from other repositories

paperless-brain CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
paperless-brain CLAUDE.mdvailsen/paperless-brainInstructions file312d agoMITA19,242Claude Code
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143kyesterdayMITA7,461Codex, OpenCode
langchain AGENTS.mdlangchain-ai/langchainInstructions file149kyesterdayMITA4,680Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA5,516GitHub Copilot
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195kyesterdayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file274k2d agoMITA4,313Codex, OpenCode