Borrowing it
Nothing to install: this file belongs to LuckyKuang/codex-tokens-compress. 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/LuckyKuang/codex-tokens-compress/master/.agents/skills/agents-md-compress/SKILL.mdgit clone --depth 1 https://github.com/LuckyKuang/codex-tokens-compressWrote 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/skills/luckykuang/codex-tokens-compress/agents-md-compress)<a href="https://agentmods.dev/skills/luckykuang/codex-tokens-compress/agents-md-compress"><img src="https://agentmods.dev/badge/skills/luckykuang/codex-tokens-compress/agents-md-compress/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/skills/luckykuang/codex-tokens-compress/agents-md-compress"><img src="https://agentmods.dev/badge/skills/luckykuang/codex-tokens-compress/agents-md-compress.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.01022 |
| Opus 5 | $0.00026 | $0.00511 |
| Sonnet 5 | $0.00010 | $0.00204 |
| Haiku 4.5 | $0.00005 | $0.00102 |
Grade B, and why
agents-md-compress 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 12d 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.
- 官方目录事实必须准确表述:mcp/config 位于 `~/.codex/config.toml` 或 `.codex/config.toml`;trusted project 下可沿 `repo root -> cwd` 逐级加载多个 `.codex/config.toml`,且近目录覆盖远目录。 How it starts
The opening of the file, as written. The whole thing — 78 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Agents Md Compress
Core Objective
将冗长 AGENTS 文档压缩为高密度、可检索、可执行的索引文档,提升规则命中率与一致性。
Core Thinking
- 优先“检索导向推理”,避免仅依赖预训练记忆。
- 用“被动上下文”降低决策成本:关键规则直接放在 AGENTS 顶部,减少额外检索动作。
- 用“结构化索引行”替代解释性段落,提升解析稳定性。
必须保留关键指令行:
|IMPORTANT: Prefer retrieval-led reasoning over pre-training-led reasoning for any project tasks.
Hard Format Constraints
- 第一行必须是
# AGENTS.md。 - 除标题外,所有非空行必须以
|开头。 - 优先使用以下两种表达:
- 文件索引:
|Category:path:{file1,file2,file3} - 命令/规则:
|Category:value1|value2|value3
- 文件索引:
- 删除长段落、代码块、深层标题(
##/###)。 - 目标文档通常控制在 15-35 行;超长时拆分到
references/。
Language Policy (Mandatory)
- 规则说明文本默认使用目标项目主要语言(中文或英文);若仓库已有语言规则,优先遵循仓库规则。
- 路径、命令、文件名、目录名、代码标识(类名/方法名/注解/配置键)保留英文。
- 不修改 mandatory
|IMPORTANT:行英文原文。
Meta Directory Policy (Mandatory)
- 官方目录事实必须准确表述:repo skills 位于
.agents/skills,user skills 位于$HOME/.agents/skills,admin skills 位于/etc/codex/skills(或企业约定系统目录),system skills 由 Codex 内置。 - 官方目录事实必须准确表述:project subagents 位于
.codex/agents,user subagents 位于~/.codex/agents。 - 官方目录事实必须准确表述:mcp/config 位于
~/.codex/config.toml或.codex/config.toml;trusted project 下可沿repo root -> cwd逐级加载多个.codex/config.toml,且近目录覆盖远目录。 - 项目可在官方事实之上增加更严格目录约束(例如“本仓库
.codex仅保留agents/与config.toml”),但必须显式标注为“项目约束”,不得写成官方硬性规则。
Execution Workflow
- 读取当前
AGENTS.md,提取最高优先级事实(结构、命令、约束、校验方式)。 - 校验关键路径是否真实存在,避免无效索引。
- 按索引格式压缩重写,仅保留可执行信息。
- 涉及自动触发时,按当前项目实际技能名与路径补充以下行(禁止硬编码):
|Local Skills:<skills-dir>:{<skill-name>[,<other-skill-name>]}|Skill Trigger:Use <skill-name> when request mentions AGENTS.md creation, compression, or rule updates.
- 运行校验脚本并修正失败项。
Quality Gate
运行:
python <skill-root>/scripts/example.py AGENTS.md- 若
python不可用,执行等价静态校验:标题行、|IMPORTANT:、标题后行前缀、禁用##/###/code fence。
通过标准:
- 标题行正确。
- 存在
|IMPORTANT:行。 - 标题后非空行全部以
|开头。 - 不含
##/###/代码围栏。 - 语言策略满足:说明遵循目标项目语言,命令类元素英文。
Reference Loading Guide
按需加载,不要一次性全读:
- 压缩模板与示例:
references/api_reference.md - 原则、符号、格式边界:
references/compression_principles.md - 检查清单与反例:
references/checklists_and_antipatterns.md - 定期维护策略:
references/maintenance.md
What ships with it
5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
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.
- 12d ago First seen · 78 lines · 52 tokens per session scan B 488bae19ec35
agents-md-compress is a skill published in the GitHub repository LuckyKuang/codex-tokens-compress (100 stars, last pushed 5mo ago), licensed MIT. It adds 52 tokens to every session and 1,022 once invoked, about $0.0003 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 skills, from other repositories
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.
local-ai-agents
Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…
next-cache-components-adoption
Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…
insight-error-page
Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…
next-cache-components-optimizer
Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…
next-partial-prefetching-adoption
Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…