16-ai-efficiency

A set of rules for making coding agents use fewer tokens and work in smaller, safer steps. Tokens are the text units an AI reads and writes, so reducing unnecessary text can lower cost and speed up work.

In plain words
What is it for?
Use it to guide file searching, partial file reading, focused testing, small code changes, subagent use, concise replies, and systematic debugging.
Why use it?
It prevents agents from reading large files unnecessarily, running broad tests, making oversized changes, or repeating the same information. It also sets rules for parallel tool calls and handling repeated failures.

Cursor rule

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 rules/movebrickschi/harness-engineering-mcp/16-ai-efficiency
Clone the repo
git clone --depth 1 https://github.com/movebrickschi/harness-engineering-mcp
Per session 693 This file is loaded in full into every session.
When invoked 693 The same file — it is already loaded in full.
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.00693 $0.00693
Opus 5 $0.00347 $0.00347
Sonnet 5 $0.00139 $0.00139
Haiku 4.5 $0.00069 $0.00069

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

Security

Grade A, and why

16-ai-efficiency 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.

assets/rules/16-ai-efficiency.mdc · 56 lines

What it actually says

AI Efficiency · 高效执行 & 省 Token 硬规则

assets/spec/AI_EFFICIENCY.md / assets/skills/ai-efficiency/SKILL.md 配套。本文件是 Cursor / Claude Code 直接消费的硬规则版本——只列不可违反的最小集。

R1. 检索路径

  • ✅ 知道符号名 → 先 Grep禁止直接 Read 大文件找符号
  • ✅ 知道文件名规律 → 先 Glob,再 Read
  • ❌ 一次 SemanticSearch 命中 ≥ 10 个文件 → 必须收紧查询,不要全读

R2. 读文件切片

  • 单次 Read 必须带 offset/limit 当文件 > 500 行
  • 永远不要 Read 整个 node_modules/ / dist/ / vendor/

R3. 并行调用

  • 同一轮里独立的 ≥ 2 个工具调用必须一次性批发
  • 顺序串行调用超过 4 次 = 违规

R4. Subagent 边界

  • 检索范围 ≥ 3 文件 → 委派 subagent
  • 主会话不读完整 fixture / 大日志 / 大 JSON dump,由 subagent 摘要后回报

R5. 修改原子化

  • 一次 StrReplace 改动 ≤ 100 行 diff
  • 跨文件大改 → 拆 ≥ N 次小 commit,每次均可独立通过 npm test --runRelatedTests

R6. 验证最小化

  • 改完只跑被影响的测试子集(--runRelatedTests / -pl module / 单文件 pytest)
  • 全局 harness check --strict --run-tests 仅在收尾跑一次

R7. 输出

  • 每段 reply_message / 主对话回复 < 2000 字符;超过即拆段或表格化
  • 禁止重复粘贴 spec / rule 段落;用 URI 引用

R8. 失败处理

  • 同一 bug ≥ 3 次尝试未修 → 切 systematic-debugging skill,禁止「再试一下」式补丁
  • 测试红了 → 优先根因,禁止 mock 掉测试断言来过

R9. 计划与执行

  • 3 步任务 → 必须先出 writing-plans skill 的明文计划

  • 用户拍板后才进入 executing-plans 推进

R10. 缓存

  • 不在每轮 prompt 里手抄 spec / rule / 项目 README
  • 通过 MCP 资源 URI 引用,保持 prompt 前缀稳定以命中 prompt cache

任何项目可以在 .harness/config.jsonmodules.knowledge.ai_efficiency_strict 中关闭部分硬规则,但默认全开。

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 · 56 lines · 693 tokens per session scan A fcf6b8158e42

Subscribe to this mod's changes

16-ai-efficiency is a cursor rule published in the GitHub repository movebrickschi/harness-engineering-mcp (2 stars, last pushed 3mo ago), licensed MIT. It adds 693 tokens to every session, about $0.0035 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-31.