pre: Instructions file for Claude Code

CLAUDE.md

pre CLAUDE.md is an instructions file for Claude Code from pre-ceo/pre. It costs 2,617 tokens per session, scanned B, original, MIT.

Project instructions for the pre system, which connects Claude Code agents to a local message bus through MCP. They describe the repository structure, security rules, token source, and the files that must change together for MCP endpoint changes.

In plain words
What is it for?
Use them when changing the master server, MCP client, MCP tools, tool registration, authentication flow, or related project architecture.
Why use it?
They give coding agents the constraints needed to modify this system without bypassing its MCP path, token handling, caller checks, or audit controls.

Instructions file for Claude Code

Written for Claude Code: PreToolUse hook event. Also seen: mentions CLAUDE.md; mentions Claude Code.

This is pre-ceo/pre's own configuration. It tells Claude Code how to work on pre 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 pre configures →

View source ↗ pre-ceo/pre
Reuse

Borrowing it

Nothing to install: this file belongs to pre-ceo/pre. 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/pre-ceo/pre/main/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/pre-ceo/pre

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 pre CLAUDE.md

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

Your own site · 80×15
<a href="https://agentmods.dev/instructions/pre-ceo/pre/claude-md"><img src="https://agentmods.dev/badge/instructions/pre-ceo/pre/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 2,617 This file is loaded in full into every session.
When invoked 2,617 The same file — it is already loaded in full.
Security scan B 2 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.02617 $0.02617
Opus 5.5 $0.01047 $0.01047
Sonnet 5.5 $0.00523 $0.00523
Haiku 4.5 $0.00262 $0.00262

Measured 2mo ago against content hash 03f97b549aa7, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

pre 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 2mo 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.

- ssh + sudo 远端命令需在 `ssh_sudo_allowlist` 命中才放行.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

- HTTP `/api/v1/*` 端口存在主要给浏览器 GUI (`pre_ui`); **agent 不应自己 curl HTTP**
CLAUDE.md · 182 lines

How it starts

The opening of the file, as written. The whole thing — 182 lines — stays where its author put it; the contents beside it link to each section on GitHub.

pre — 给 Claude Code agent 看的项目说明

本项目实现 Claude Code 的 PreToolUse / Stop hook + Master/Node/Driver 消息总线. 在这个仓库内工作时, 请遵循以下原则.

项目定位

  • 平台代码层 (portable, git-tracked).
  • 用户级规则与运行时状态在 pre_rule (sibling 仓库, 不入此 git).
  • 浏览器 GUI 在 pre_ui (sibling 仓库).

Agent 接入路径

MCP 是 agent ↔ master 主路径, 不是可选附件:

  • agent 通过 stdio JSON-RPC 调 pre_mcp 子进程
  • 子进程在本机 loopback 经 HTTP 转发到 master
  • 沿途强制 caller-id 前缀校验 / 跨 node read_pane 拒绝 / 60/min 限频 / 独立 audit
  • HTTP /api/v1/* 端口存在主要给浏览器 GUI (pre_ui); agent 不应自己 curl HTTP

修改这一路径时连带改 4 处:

  1. src/master/server.py — HTTP endpoint 行为
  2. pre_mcp/master_client.py — facade 调 endpoint
  3. pre_mcp/tools.py — tool 包装层 + 校验
  4. pre_mcp/__main__.py — FastMCP @mcp.tool() 注册

Token 来源 — 唯一出入口 ~/.pre/env

所有本机 caller 通过 ~/.pre/env 取对应 PRE_<KIND>_SECRET. agent 不得自己 curl HTTP — 强制走 MCP. master 端按 (role, source IP) 差异化校验, 异常组合 → audit + WARNING-master-caller-class-anomaly-{ts}.md finding.

5 类初始 token (chmod 600, 不入 git):

env key role 用途 校验
PRE_NODE_SECRET node src/node/ ↔ master ws + /files role=node, ws Upgrade /node
PRE_MCP_SECRET mcp pre_mcp 子进程 → master HTTP loopback mcp + agent_id binding + 必 loopback
PRE_HOOK_SECRET hook hook/runtime/CLI → master HTTP loopback hook + 必 loopback
PRE_GUI_SECRET gui pre_ui browser (master /auth/init 颁发) role=gui
PRE_OPERATOR_SECRET operator 运维手敲 + admin 操作 scope=admin.*

Caller 侧:

  • master / hook / runtime / scripts / node: from common.token_resolver import resolve as _resolve_token
    • _resolve_token("hook") (或对应 kind). 单点 ~/.pre/env, fail-fast (找不到 raise).
  • pre_mcp 子进程 不能 import src/common (CLAUDE.md 隔离硬约束); 自己读 os.environ["PRE_MCP_SECRET"], 行为对齐 token_resolver._load_env_file.

加新 token 类型 (例 cron / audit-reader):

  1. src/master/auth.py:ROLE_DEFAULT_SCOPES 加 role + scopes
  2. src/master/server.py:_classify_caller 白名单加 (role, path, IP) 行
  3. scripts/pre_token.py issue --role <new> 颁发, raw 写 ~/.pre/env 的 PRE_<KIND>_SECRET
  4. src/common/token_resolver.py:_KIND_TO_ENV_KEY 加映射, caller 侧 _resolve_token("<new>")

Read the full file on GitHub · 182 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. 2mo ago First seen · 182 lines · 2,617 tokens per session scan B 03f97b549aa7

Subscribe to this mod's changes

pre CLAUDE.md is an instructions file published in the GitHub repository pre-ceo/pre (5 stars, last pushed 5mo ago), licensed MIT. It adds 2,617 tokens to every session, about $0.0105 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-31.

Related

pre CLAUDE.md compared with instructions from other repositories

pre CLAUDE.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
pre CLAUDE.mdpre-ceo/preInstructions file55mo agoMITB2,617Claude Code
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,685GitHub Copilot
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,086GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file280k2d agoMITA4,325Codex, OpenCode