codex-tokens-compress: Skill for Claude Code

.agents/skills/agents-md-compress/SKILL.md

agents-md-compress is a skill for Claude Code, Codex from LuckyKuang/codex-tokens-compress. It costs 52 tokens per session (1,022 once invoked), scanned B, original, MIT.

A format for compressing AGENTS.md files into short, searchable rule and file-index lines.

In plain words
What is it for?
Use it when creating, shortening, or updating AGENTS.md files while preserving important project rules, paths, commands, and language requirements.
Why use it?
It makes project instructions easier for coding agents to find and apply without reading long explanatory documents.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions subagents; reads ~/.codex paths; installed under .agents/ (shared by several agents).

This is LuckyKuang/codex-tokens-compress's own configuration. It tells Claude Code and Codex how to work on codex-tokens-compress 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 codex-tokens-compress configures →

Reuse

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.

Copy the file
curl -O https://raw.githubusercontent.com/LuckyKuang/codex-tokens-compress/master/.agents/skills/agents-md-compress/SKILL.md
Clone the repo
git clone --depth 1 https://github.com/LuckyKuang/codex-tokens-compress

Made for: Claude Code, Codex.

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 agents-md-compress

README.md
[![agentmods](https://agentmods.dev/badge/skills/luckykuang/codex-tokens-compress/agents-md-compress/github.svg)](https://agentmods.dev/skills/luckykuang/codex-tokens-compress/agents-md-compress)
Your own site
<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.

agentmods 80×15 button for agents-md-compress

Your own site · 80×15
<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>
Per session 52 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,022 The whole file, excluding the scripts and references it only reads on demand.
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.00052 $0.01022
Opus 5.5 $0.00021 $0.00409
Sonnet 5.5 $0.00010 $0.00204
Haiku 4.5 $0.00005 $0.00102

Measured 2mo ago against content hash 488bae19ec35, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

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 2mo ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/example.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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`,且近目录覆盖远目录。
.agents/skills/agents-md-compress/SKILL.md · 78 lines

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

  1. 读取当前 AGENTS.md,提取最高优先级事实(结构、命令、约束、校验方式)。
  2. 校验关键路径是否真实存在,避免无效索引。
  3. 按索引格式压缩重写,仅保留可执行信息。
  4. 涉及自动触发时,按当前项目实际技能名与路径补充以下行(禁止硬编码):
    • |Local Skills:<skills-dir>:{<skill-name>[,<other-skill-name>]}
    • |Skill Trigger:Use <skill-name> when request mentions AGENTS.md creation, compression, or rule updates.
  5. 运行校验脚本并修正失败项。

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

Read the full file on GitHub · 78 lines

Files

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.

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. 2mo ago First seen · 78 lines · 52 tokens per session scan B 488bae19ec35

Subscribe to this mod's changes

agents-md-compress is a skill published in the GitHub repository LuckyKuang/codex-tokens-compress (101 stars, last pushed 7mo ago), licensed MIT. It adds 52 tokens to every session and 1,022 once invoked, about $0.0002 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-08-30.

Related

agents-md-compress compared with skills from other repositories

agents-md-compress next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
agents-md-compressLuckyKuang/codex-tokens-compressSkill1017mo agoMITB52Claude Code, Codex
imagegenopenai/codexSkill133kyesterdayApache-2.0A113Codex
playwright-climicrosoft/playwrightSkill99kyesterdayApache-2.0A19Claude Code
local-ai-agentsmicrosoft/ai-agents-for-beginnersSkill79k4d agoMITA200Claude Code, Codex
systematic-debuggingobra/superpowersSkill313k3d agoMITA21Claude Code
next-cache-components-adoptionvercel/next.jsSkill143kyesterdayMITA95Claude Code
next-partial-prefetching-adoptionvercel/next.jsSkill143kyesterdayMITA103Claude Code