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/LiuYihey/Agent-EngineeringWrote 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/rules/liuyihey/agent-engineering/tool-design-data-plane)<a href="https://agentmods.dev/rules/liuyihey/agent-engineering/tool-design-data-plane"><img src="https://agentmods.dev/badge/rules/liuyihey/agent-engineering/tool-design-data-plane/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/rules/liuyihey/agent-engineering/tool-design-data-plane"><img src="https://agentmods.dev/badge/rules/liuyihey/agent-engineering/tool-design-data-plane.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.01902 | $0.01902 |
| Opus 5.5 | $0.00761 | $0.00761 |
| Sonnet 5.5 | $0.00380 | $0.00380 |
| Haiku 4.5 | $0.00190 | $0.00190 |
Grade A, and why
tool-design-data-plane 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 19d 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 — 97 lines — stays where its author put it; the contents beside it link to each section on GitHub.
工具设计指南:模型是控制面,不是数据面
一条总原则
模型负责计划、选择、判断(control plane);字节负责在系统之间流动(data plane)。 工具设计中唯一不能破坏的边界:批量数据不得以 token 形式穿过模型。
判断一个工具是否合格,只问一句:
这份数据的字符,是模型生成的,还是文件/数据库生成的?
只要答案是"模型生成的",就存在成本翻倍、内容失真、上下文丢失三个隐患。
为什么内联批量数据一定出问题
内联(inline)= 数据本体写在 tool call 参数或返回文本里;引用(reference)= 只传 path / id / uri。
| 失效模式 | 机制 |
|---|---|
| 成本与延迟 | 同一份数据付两次费(输入一次、输出一次),且必须串行生成完 |
| 保真度 | 模型输出是概率采样,不是内存拷贝;几百行数字必然串行、错位、凭印象补数 |
| 易失性 | 数据只活在上下文里,被 prune / compaction 裁掉后模型只剩"记忆",开始编造 |
| 规模上限 | 输出受 max_tokens 约束,超出就截断或空回合 |
本仓库实测(session d1c7fd14-1f2,612 条 CD8 设计打分):
- 129 次工具调用:
score_sequence38 次(796 条序列)、run_analysis_code76 次 - 其中 33/76 的分析调用是纯搬运:7 次把 776 行分数敲进代码、26 次合并与长度校验返工
- 同一个会话出现过连续 3 轮
text_len=0, stop_reason=max_tokens的空回合 - 这不是模型"不听话",而是它没有"复制"操作——只有重新生成
决策表
| 场景 | 正确做法 |
|---|---|
| 输入可能是批量数据(序列、行、表) | 支持 input_path(CSV/TSV/JSON/FASTA),内联参数保留但降级为便捷通道 |
| 输出可能超过约 2 KB 或 50 行 | 支持 output_path,返回摘要 + 路径;缺失时保持原行为 |
| 输出是用来推理的(单任务配置、指标、记忆条目) | 保持内联。读工具不要 handle 化 |
数据已经在磁盘上(data/、results/、artifacts/) |
不要新增工具,让 agent 用 run_analysis_code 直接读写 |
| 需要用户看到/下载 | 写 artifacts/ 下,由 sandbox 自动注册 artifact |
阈值不是教条:get_task_info 返回一个任务的完整 launch config 与质量档位是正确的——模型必须看全才能判断。读全 ≠ 搬全。
五条行业标准模式
- Handle over value:返回引用而不是值。代表:OpenAI Code Interpreter 的沙箱文件名、Anthropic Files API 的
file_id、MCP resources 的 URI、ADK artifacts。 - Push compute to data:让模型写查询/程序,数据不动。代表:Text-to-SQL(BigQuery、Databricks Genie)、Code Interpreter。本项目对应
query_table+run_analysis_code。 - Preview + handle:返回 schema、行数、头几行与路径,绝不返回全表。对应
df.head()/df.describe()/ SQLLIMIT+COUNT。 - 双通道输出:机器通道落盘,模型通道只拿摘要。
score_sequence的output_path就是这个形态。 - 类型化契约 + 幂等:边界用 JSON Schema / Pydantic 校验一次;结果按
run_id可重复读取,不必重算。
新增工具的验收清单
- 批量输入可以走
input_path,不必让模型念数据 - 大输出可以走
output_path,且不传时行为完全不变 - 返回文本包含:做了什么、多少行、写到哪、怎么读回来
- 截断必须显式说明(
truncated+ 分页/收窄建议),禁止静默截断 - 写
artifacts/的产物会自动成为聊天里的可下载 artifact - 描述里写明 "read it back with run_analysis_code, do not retype"
- 新增参数同步更新 yaml 描述、CORE.md、wiki、测试
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.
- 19d ago First seen · 97 lines · 1,902 tokens per session scan A 91b1652116a0
tool-design-data-plane is a cursor rule published in the GitHub repository LiuYihey/Agent-Engineering (6 stars, last pushed 7d ago), licensed MIT. It adds 1,902 tokens to every session, about $0.0076 per session on Opus 5.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-11-13.
tool-design-data-plane compared with cursor rules from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| tool-design-data-planeLiuYihey/Agent-Engineering | Cursor rule | 6 | 7d ago | MIT | A | 1,902 | Cursor |
| ponytailDietrichGebert/ponytail | Cursor rule | 203k | 10d ago | MIT | A | 604 | Cursor |
| angular-20angular/angular | Cursor rule | 102k | today | MIT | A | 0 | Cursor |
| dev-standardapache/superset | Cursor rule | 76k | today | Apache-2.0 | A | 1,147 | Cursor |
| prefer-assertions-over-defensive-checksprisma/orm | Cursor rule | 48k | today | Apache-2.0 | A | 0 | Cursor |
| prefer-direct-imports-over-module-mocksprisma/orm | Cursor rule | 48k | today | Apache-2.0 | A | 0 | Cursor |
| shared-plane-packagesprisma/orm | Cursor rule | 48k | today | Apache-2.0 | A | 0 | Cursor |