LoongPort: Instructions file for Codex

AGENTS.md

LoongPort AGENTS.md is an instructions file for Codex, OpenCode from SailingLoong/LoongPort. It costs 9,403 tokens per session, scanned B, original, MIT.

Repository instructions for AI-assisted work in the SailingLoong/LoongPort project. They point agents to the project rules and define what evidence and approvals to record when delivering changes.

In plain words
What is it for?
Use them to guide implementation, review, testing evidence, pull-request handoff, CI validation, and release records in that repository.
Why use it?
They reduce confusion about which rules apply and prevent planned, partially tested, or unapproved work from being presented as complete.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: reads ~/.codex paths; mentions AGENTS.md; mentions Codex.

This is SailingLoong/LoongPort's own configuration. It tells Codex and OpenCode how to work on LoongPort 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 LoongPort configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/SailingLoong/LoongPort/main/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/SailingLoong/LoongPort

Made for: Codex, OpenCode.

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 LoongPort AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/sailingloong/loongport/agents-md/github.svg)](https://agentmods.dev/instructions/sailingloong/loongport/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/sailingloong/loongport/agents-md"><img src="https://agentmods.dev/badge/instructions/sailingloong/loongport/agents-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 LoongPort AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/sailingloong/loongport/agents-md"><img src="https://agentmods.dev/badge/instructions/sailingloong/loongport/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 9,403 This file is loaded in full into every session.
When invoked 9,403 The same file — it is already loaded in full.
Security scan B 1 finding. 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.09403 $0.09403
Opus 5.5 $0.03761 $0.03761
Sonnet 5.5 $0.01881 $0.01881
Haiku 4.5 $0.00940 $0.00940

Measured 9d ago against content hash e8fa92f47df5, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade B, and why

LoongPort AGENTS.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 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.

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 文件名 | ✅ **改,但必须留兜底**,见下 |
AGENTS.md · 506 lines

How it starts

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

LoongPort 代码仓规则

产品说明见 LOONGPORT.md(那份给人看:它替用户做什么、六条硬约束、怎么打包)。 本文件只讲写这个仓的代码时怎么决策。

设计档案在另一个仓

设计文档、进度、spec 不在本仓,在同级的档案仓里(需要时用 /add-dir 单次挂载,别常驻)。 维护者本机的具体布局见工作区那份 AGENTS.md(不入任何仓)。

上一代实现是「参考不复用」:它的 relay 层比现在这版复杂一个数量级(云同步边界、 多 app 展开、更多分支裁决),照搬会把这版简化的成果丢掉。查它的结论(实测记录、 某个设计为什么那样分)是对的,照抄它的实现是错的;那边带行号的引用基于旧的子模块 指针,引用前先 grep -n 复核。

一、最高优先级:能复用 cc-switch 的就复用

这个仓是 cc-switch 的 fork,底层要跟着上游升级。 所以「复用上游」不是风格偏好, 而是决定未来升级成本的架构约束 —— 每一处自己另写的东西,都是将来 merge 上游时要手工 处理的冲突;每一处复用上游的东西,上游改进了我们免费拿到。

判定顺序(自上而下,命中即停)

  1. 上游已有的组件 / hook / 工具函数 / 类型 → 直接用。 例:折叠用 src/components/ui/collapsible.tsx(Radix 封装,已在仓里), 不要引第三方折叠库、也不要自己写展开动画。
  2. 上游已有的视觉 token(间距、圆角、选中态、hover 效果)→ 抄它的值。 判据:新页面和旧页面放一起,看不出是两个人写的。
  3. 上游已有的模式(数据流、命令命名、错误处理形状)→ 照它的形状写。
  4. 以上都没有 → 才新建,且新建的东西尽量收在自己的目录里 (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 或更高 只能读,不能抄代码进本仓

Read the full file on GitHub · 506 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. 9d ago Changed · +486 lines · +8,888 tokens per session scan A → B e8fa92f47df5
  2. 22d ago First seen · 20 lines · 515 tokens per session scan A db06c16033c2

Subscribe to this mod's changes

LoongPort AGENTS.md is an instructions file published in the GitHub repository SailingLoong/LoongPort (138 stars, last pushed today), licensed MIT. It adds 9,403 tokens to every session, about $0.0376 per session on Opus 5.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-10-06.

Related

Other instructions, from other repositories