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.
curl -O https://raw.githubusercontent.com/vailsen/paperless-brain/main/CLAUDE.mdgit clone --depth 1 https://github.com/vailsen/paperless-brainWrote 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/vailsen/paperless-brain/claude-md)<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.
<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>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.19242 | $0.19242 |
| Opus 5.5 | $0.07697 | $0.07697 |
| Sonnet 5.5 | $0.03848 | $0.03848 |
| Haiku 4.5 | $0.01924 | $0.01924 |
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.
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 APIIGNORE_INBOX_TAG_AT_SYNC— tag name to skip during syncEMBEDDING_MODEL,CHROMA_PATH,CHROMA_COLLECTION,EXTRACTION_SIDECAR_PATH,THUMB_PATHOLLAMA_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 ownbase_url.OLLAMA_SERVERadditionally 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 asAuthorization: Bearer; for a custom base URL the factory moves it back toX-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 (backendanthropic/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 rawui.selectover 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/completionsor/v1/messagesdoubled the path and produced a bare 404.
SEARXNG_HOST— self-hosted SearXNG instanceSTORAGE_SECRET— NiceGUI session secret
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.
- yesterday Changed · +6 lines · +123 tokens per session 285039b923ba
- 2d ago Changed · +59 lines · +1,052 tokens per session 66992fb0358d
- 3d ago Changed · +59 lines · +963 tokens per session ca7155def141
- 4d ago Changed · +14 lines · +294 tokens per session f1f5ce2f7d08
- 6d ago Changed · +3 lines · +438 tokens per session a20fc6262473
- 7d ago Changed · +98 lines · +2,990 tokens per session c927d6df560f
- 14d ago Changed · +17 lines · +394 tokens per session 334f1c013fa9
- 15d ago Changed · +59 lines · +1,150 tokens per session 953ccfdf3d6b
- 17d ago Changed · +12 lines · +173 tokens per session 546b942e5dee
- 19d ago First seen · 825 lines · 11,665 tokens per session scan A 40b4e4494104
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.
paperless-brain CLAUDE.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| paperless-brain CLAUDE.mdvailsen/paperless-brain | Instructions file | 31 | 2d ago | MIT | A | 19,242 | 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 | yesterday | 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 |