Create

Sign in to ReadmeX

or

How we handle your data: Privacy Policy

ReadmeX

Your AI reading companion

What would you like to catch up on?

Pick a briefing, or ask your own question.

Your community and people briefings stay personal to you.

Story

A Practical Guide to Cutting AI Agent Rule Token Costs

AI summary

A Juejin AI guide argues that project rules and system prompts are resent with conversation history on every model request, creating recurring input-token costs. It recommends keeping hard constraints resident, moving task-specific procedures into on-demand Skills, and merging duplicate or conflicting rules, while providing a reusable audit prompt and a Python script named rule_audit.py. In a seven-file example, the author estimates 23,721 resident tokens, but says this figure is an approximation based on 1.6 characters per token.

In-depth insight

The guide gives AI-agent developers a concrete way to measure resident configuration and reorganize rules without removing important safety or quality constraints.

核心结论:规则不是写给你看的,是每次提问都重新发给模型一遍的。所以「不要、不许、禁止」这类只在出事时才生效的句子,会变成每一轮都在付费、却几乎不出力的常驻文本。一条被大量转发的实测是同等任务下 token 消耗增加 46%;本文再用一份真实在用的规则目录复算,7 个规则文件常驻约 2.37 万 token,是单条提问的 150 倍以上。解法不是删规则,而是分三层:常驻只留硬约束,特定任务搬进按需加载的 Skill,重复与冲突当场合并。

📦 配套资源:规则体检脚本 rule_audit.py(可直接运行)

#Anthropic#Claude Code#Microsoft#Cursor#Trae#Agent Skills#rule_audit.py

Original · 15 min readRead the original
Group chat

No comments yet. Start the conversation.