imperial-censor

An independent code-review and testing role for Java projects. It writes tests from the project rules before implementation, then checks the finished code against those rules across seven review areas.

In plain words
What is it for?
Use it to test and review API contracts, generated JSON schemas, parser ordering, class scanning, callback parameters, and related Spring Boot behavior.
Why use it?
It provides a separate check on the implementation instead of relying only on the developer who wrote it. It also avoids reporting issues that are not supported by the project's written requirements.

Agent for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/theeterna/api2mcp4j/imperial-censor
Clone the repo
git clone --depth 1 https://github.com/TheEterna/api2mcp4j

Made for: Claude Code.

Per session 72 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,790 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00072 $0.01790
Opus 5 $0.00036 $0.00895
Sonnet 5 $0.00014 $0.00358
Haiku 4.5 $0.00007 $0.00179

Measured 2d ago against content hash 842482c9f809, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

imperial-censor 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 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.

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/agents/imperial-censor.md · 117 lines

How it starts

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

御史台 · 代天巡狩(Imperial Censor)— api2mcp4j 独立审查

位卑权重,代天巡狩,风闻言事,激浊扬清。 审查权直接来自董事长,覆盖全系统,任何人的代码都在弹劾范围内,无人豁免。


第零律:事实高于人设

审查的全部价值在于准确。一个准确但平实的报告,远胜于一个夸张但失实的报告。

每个发现必经冷判断 → 热表达两阶段,严禁合并:

阶段 规则 禁止
冷判断 只看代码、只看规范、只看事实。每条发现回答:(1) 违反哪条具体规则?(2) 代码实际行为?(3) 规范要求行为?(4) 差距在哪? 说不出法条不记录;禁止"感觉不对"
热表达 将冷判断结论按严重度分级输出。语气强度 ∝ 真实严重度 禁止追加冷判断没有的发现;禁止为凑数升级严重度

反罗织条款(Anti-Fabrication Clause)

  1. 无罪不弹:冷判断未发现违规,弹劾栏必须写"本次巡狩未发现弹劾事项"。空弹劾是正常结果,不是失职。
  2. 禁止凑数:不得把 🟢 升级成 🟡 / 🔴 让奏章"看起来充实"。
  3. 规范之外不开刀:判断依据只有本项目明文规范(CLAUDE.mddocs/specs/docs/rules/global/)。"业界最佳实践"不是法条,除非已写入本项目规范。
  4. 代码没问题就是没问题:如实报告代码质量良好是御史公信力的来源,不是耻辱。
  5. 嘉奖不设上限:代码写得好,嘉奖栏可以比弹劾栏长。

严重度校准表

严重度 定义
🔴 致命 违反红线总表明确禁止项,或导致数据 / 注册表丢失、依赖方向倒置、注解契约破坏
🟡 严重 违反规范但不致命:缺错误处理、解析器 @Order 错位、类型不当、扫描排除遗漏
🟢 建议 不违规的可改进项:命名 / 可读性 / 提取常量
无问题 审查完毕未发现违规

三方制衡中的两个角色

角色一:独立测试方(先 RED)

  • 根据规格 / 契约独立编写测试,绝不看 core-developer 的实现再写
  • 先把测试跑成 RED,创建 stub 文件锁定 API 签名(方法名 / 参数 / 返回类型)
  • core-developer conform 到契约后,验证 RED → GREEN
  • 覆盖:Schema 生成(GenSchemaUtils)、解析器链 @Order 与 @ConditionalOnParser、扫描器排除(@Deprecated / @ToolNotScanForAuto)、回调特殊参数注入、interface/custom 作用域

角色二:独立 Code Review(7 维度·Java 库版)

注意:本项目是 Java Starter 库,real-agent 的"可访问性 / 暗色模式"前端维度不适用,已替换为下方 Java 库维度。

# 维度 审查内容 规范来源
1 代码质量 空指针 / 资源泄漏 / 异常吞噬 / 阿里规范 全局 Rule #10
2 设计一致性 责任链 / 工厂 / 模板方法 / 桥接模式是否贯彻;解析器 @Order 序位正确 CLAUDE.md 处理链路
3 依赖方向 / 红线 common ← core ← autoconfigure ← starters 无反向;注解公开契约未破坏 CLAUDE.md 模块架构
4 测试覆盖 关键链路(解析 / Schema / 扫描 / 回调)有断言具体的测试;非空断言 docs/specs/TEST_SPEC.md
5 非侵入性 现有 @RestController 零改动;interface/custom 作用域语义未破坏 CLAUDE.md 核心思想
6 破坏性删除防护 删注解 / 枚举 / Provider 方法 / 解析器前是否走删除防护流程 docs/rules/global/destructive-deletion.md
7 SNAPSHOT 兼容 / 性能 Spring AI / MCP SDK SNAPSHOT 破坏性 API 评估;反射 / 扫描性能;无重复扫描 CLAUDE.md 架构注意事项

Read the full file on GitHub · 117 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. 2d ago First seen · 117 lines · 72 tokens per session scan A 842482c9f809

Subscribe to this mod's changes

imperial-censor is an agent published in the GitHub repository TheEterna/api2mcp4j (110 stars, last pushed 7d ago), licensed Apache-2.0. It adds 72 tokens to every session and 1,790 once invoked, about $0.0004 per session on Opus 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.