Borrowing it
Nothing to install: this file belongs to SailingLoong/LoongPort. 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/SailingLoong/LoongPort/main/CLAUDE.mdgit clone --depth 1 https://github.com/SailingLoong/LoongPortWrote 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/sailingloong/loongport/claude-md)<a href="https://agentmods.dev/instructions/sailingloong/loongport/claude-md"><img src="https://agentmods.dev/badge/instructions/sailingloong/loongport/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/sailingloong/loongport/claude-md"><img src="https://agentmods.dev/badge/instructions/sailingloong/loongport/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.08384 | $0.08384 |
| Opus 5 | $0.04192 | $0.04192 |
| Sonnet 5 | $0.01677 | $0.01677 |
| Haiku 4.5 | $0.00838 | $0.00838 |
Grade B, and why
LoongPort CLAUDE.md scanned grade B with 1 finding 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 2d 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.
Reads agent configuration directoriesmediumAgent snooping
.claude/, .codex/, .gemini/ hold keys, settings and other credentials a mod has no legitimate need for.
| **跨出去了,但能「读宽写窄」** | `model_provider` 标记(写进用户 `~/.codex/config.toml`)、model catalog 文件名 | ✅ **改,但必须留兜底**,见下 | How it starts
The opening of the file, as written. The whole thing — 464 lines — stays where its author put it; the contents beside it link to each section on GitHub.
LoongPort 代码仓规则
产品说明见 LOONGPORT.md(那份给人看:它替用户做什么、六条硬约束、怎么打包)。 本文件只讲写这个仓的代码时怎么决策。
设计档案在另一个仓
设计文档、进度、spec 不在本仓,在同级的档案仓里(需要时用 /add-dir 单次挂载,别常驻)。
维护者本机的具体布局见工作区那份 CLAUDE.md(不入任何仓)。
上一代实现是「参考不复用」:它的 relay 层比现在这版复杂一个数量级(云同步边界、
多 app 展开、更多分支裁决),照搬会把这版简化的成果丢掉。查它的结论(实测记录、
某个设计为什么那样分)是对的,照抄它的实现是错的;那边带行号的引用基于旧的子模块
指针,引用前先 grep -n 复核。
一、最高优先级:能复用 cc-switch 的就复用
这个仓是 cc-switch 的 fork,底层要跟着上游升级。 所以「复用上游」不是风格偏好, 而是决定未来升级成本的架构约束 —— 每一处自己另写的东西,都是将来 merge 上游时要手工 处理的冲突;每一处复用上游的东西,上游改进了我们免费拿到。
判定顺序(自上而下,命中即停)
- 上游已有的组件 / hook / 工具函数 / 类型 → 直接用。
例:折叠用
src/components/ui/collapsible.tsx(Radix 封装,已在仓里), 不要引第三方折叠库、也不要自己写展开动画。 - 上游已有的视觉 token(间距、圆角、选中态、hover 效果)→ 抄它的值。 判据:新页面和旧页面放一起,看不出是两个人写的。
- 上游已有的模式(数据流、命令命名、错误处理形状)→ 照它的形状写。
- 以上都没有 → 才新建,且新建的东西尽量收在自己的目录里
(
src/components/relay/、src-tauri/src/relay/),别散进上游文件。
改上游文件时:改动面越小越好
不得不动上游文件时(如 App.tsx 的视图分流、ProviderList 加一层过滤),
只改必须改的那几行,把逻辑放进自己的新文件里让它调用。
反例:为了实现一个功能把上游某个 600 行组件重构一遍 —— 那等于放弃了那个文件的上游升级。
什么时候可以不复用
- 上游那套语义上不适用:例
ProviderCard服务的是「用户手工配置的 provider」 (可编辑、可删除、可拖拽排序),而 LoongPort 的托管项没有这些操作 —— 硬塞进去会让 两种形态互相污染。这时另建组件是对的,但视觉 token 仍要抄。 - 上游的默认行为对 LoongPort 有害:例 updater 端点指向 cc-switch 自己的发布源,
留着会把用户升级成 cc-switch(见
lib.rs里那段说明)。这类要明确禁用并写清理由。
判据一句话:「不复用」要能说出上游那套具体哪里不适用,说不出就是复用。
二、技术栈事实(别套错工具)
| 项 | 实际 | 常见误判 |
|---|---|---|
| UI 库 | Radix UI + Tailwind v3(shadcn/ui 那套) | 不是 Semi Design、不是 antd、不是 MUI |
| Tailwind | v3.4.x,配置在 tailwind.config.cjs,CSS 用 @tailwind base |
不是 v4 —— 别套 @theme / @import "tailwindcss",v3 不认,样式会当场崩 |
| 图标 | lucide-react |
别引第二个图标库 |
| 样式合并 | clsx + tailwind-merge(cn()) |
别手拼 className 字符串 |
| 后端 | Tauri 2 + Rust,SQLite 走 rusqlite |
— |
src/components/ui/ 下是标准 shadcn 封装(collapsible / accordion / dialog /
select / tabs …,共 23 个),先翻那个目录再考虑新建。
⚠️ 许可证界线:sub2api 是 LGPL-3.0,本仓是 MIT
| 项目 | 许可证 | 我们能做什么 |
|---|---|---|
| cc-switch(本仓 fork 源) | MIT | 可自由复用代码 —— §一「能复用就复用」讲的就是它 |
| sub2api(对接的中转站后端) | LGPL-3.0 或更高 | 只能读,不能抄代码进本仓 |
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.
- 2d ago Changed · +15 lines · +351 tokens per session da7163bf6c00
- 10d ago First seen · 449 lines · 8,033 tokens per session scan B fb6f1189f260
LoongPort CLAUDE.md is an instructions file published in the GitHub repository SailingLoong/LoongPort (123 stars, last pushed yesterday), licensed MIT. It adds 8,384 tokens to every session, about $0.0419 per session on Opus 5. A static security scan graded it B with 1 finding (reads agent configuration directories). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other instructions, from other repositories
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
deepseek-harness AGENTS.md
AGENTS.md instructions for deepseek-ai/deepseek-harness, covering agents.md, pre-stable apis and released session data, repository layout, commands and host sandbox failures.