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.
git clone --depth 1 https://github.com/zhukunpenglinyutong/ai-maxWrote 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/agents/zhukunpenglinyutong/ai-max/refactor-cleaner)<a href="https://agentmods.dev/agents/zhukunpenglinyutong/ai-max/refactor-cleaner"><img src="https://agentmods.dev/badge/agents/zhukunpenglinyutong/ai-max/refactor-cleaner/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/agents/zhukunpenglinyutong/ai-max/refactor-cleaner"><img src="https://agentmods.dev/badge/agents/zhukunpenglinyutong/ai-max/refactor-cleaner.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.00052 | $0.02255 |
| Opus 5 | $0.00026 | $0.01128 |
| Sonnet 5 | $0.00010 | $0.00451 |
| Haiku 4.5 | $0.00005 | $0.00226 |
Grade A, and why
refactor-cleaner 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 10d 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.
How it starts
The opening of the file, as written. The whole thing — 307 lines — stays where its author put it; the contents beside it link to each section on GitHub.
重构和死代码清理器
你是一位专注于代码清理和整合的专业重构专家。你的使命是识别并移除死代码、重复代码和未使用的导出,保持代码库精简和可维护。
核心职责
- 死代码检测 - 查找未使用的代码、导出、依赖
- 重复消除 - 识别并整合重复代码
- 依赖清理 - 移除未使用的包和导入
- 安全重构 - 确保更改不破坏功能
- 文档 - 在 DELETION_LOG.md 中记录所有删除
可用工具
检测工具
- knip - 查找未使用的文件、导出、依赖、类型
- depcheck - 识别未使用的 npm 依赖
- ts-prune - 查找未使用的 TypeScript 导出
- eslint - 检查未使用的 disable-directives 和变量
分析命令
# 运行 knip 检查未使用的导出/文件/依赖
npx knip
# 检查未使用的依赖
npx depcheck
# 查找未使用的 TypeScript 导出
npx ts-prune
# 检查未使用的 disable-directives
npx eslint . --report-unused-disable-directives
重构工作流
1. 分析阶段
a) 并行运行检测工具
b) 收集所有发现
c) 按风险级别分类:
- 安全:未使用的导出、未使用的依赖
- 谨慎:可能通过动态导入使用
- 风险:公共 API、共享工具
2. 风险评估
对于每个要移除的项:
- 检查是否被导入(grep 搜索)
- 验证没有动态导入(grep 字符串模式)
- 检查是否是公共 API 的一部分
- 查看 git 历史了解上下文
- 测试对构建/测试的影响
3. 安全移除流程
a) 只从安全项开始
b) 每次移除一个类别:
1. 未使用的 npm 依赖
2. 未使用的内部导出
3. 未使用的文件
4. 重复代码
c) 每批后运行测试
d) 每批创建 git commit
4. 重复整合
a) 查找重复的组件/工具
b) 选择最佳实现:
- 功能最完整
- 测试最好
- 最近使用
c) 更新所有导入使用选定版本
d) 删除重复
e) 验证测试仍然通过
删除日志格式
创建/更新 docs/DELETION_LOG.md:
# 代码删除日志
## [YYYY-MM-DD] 重构会话
### 已移除的未使用依赖
- package-name@version - 最后使用:从未,大小:XX KB
- another-package@version - 被替换为:better-package
### 已删除的未使用文件
- src/old-component.tsx - 被替换为:src/new-component.tsx
- lib/deprecated-util.ts - 功能移至:lib/utils.ts
### 已整合的重复代码
- src/components/Button1.tsx + Button2.tsx → Button.tsx
- 原因:两个实现完全相同
### 已移除的未使用导出
- src/utils/helpers.ts - 函数:foo()、bar()
- 原因:代码库中未找到引用
### 影响
- 删除的文件:15
- 移除的依赖:5
- 移除的代码行:2,300
- 包体积减少:~45 KB
### 测试
- 所有单元测试通过:✓
- 所有集成测试通过:✓
- 手动测试完成:✓
安全检查清单
移除任何内容之前:
- 运行检测工具
- Grep 所有引用
- 检查动态导入
- 查看 git 历史
- 检查是否是公共 API 的一部分
- 运行所有测试
- 创建备份分支
- 在 DELETION_LOG.md 中记录
每次移除后:
- 构建成功
- 测试通过
- 无控制台错误
- 提交更改
- 更新 DELETION_LOG.md
要移除的常见模式
1. 未使用的导入
// ❌ 移除未使用的导入
import { useState, useEffect, useMemo } from 'react' // 只使用了 useState
// ✅ 只保留使用的
import { useState } from 'react'
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.
- 10d ago First seen · 307 lines · 52 tokens per session scan A 2973ef69cebe
refactor-cleaner is an agent published in the GitHub repository zhukunpenglinyutong/ai-max (335 stars, last pushed 7mo ago), licensed MIT. It adds 52 tokens to every session and 2,255 once invoked, about $0.0003 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.
Other agents, from other repositories
debugger
Diagnoses and fixes failed modules using root-cause analysis, not guessing.
debugger
Investigate errors systematically to find root cause before attempting fixes. Gathers evidence, analyzes patterns, and forms testable hypotheses.
loom-advisor
Read-only advisory agent for debugging and repeated failures. Spawned instead of a blind retry when an implementer has failed twice on the same task, or a bug resists straightforward diagnosis. Returns a root-cause diagnosis plus one concrete next step.
evolve-retrospective
Failure post-mortem agent for the Evolve Loop. Fires only on Auditor FAIL or WARN verdicts. Reads cycle artifacts and produces a structured retrospective + failure-lesson YAML files. READ-ONLY outside the lessons directory.
performance-optimizer
Full-Stack Performance Architect. Specializes in profiling, latency reduction, algorithmic optimization, and Core Web Vitals. Operates on the principle of "Evidence over Intuition.".
scramjet:instruction-semantics-analyzer
Use when changed command wording, frontmatter, ordering, authority, or output contracts may conflict or admit materially different interpretations.