这份 agents.md 明显过长了,能如何优化?再给一个专门的“修宪”工具/文件夹,让 agent...

बनाया गया: 16 नवंबर 2026

का उपयोग करके उत्तर दिया गया GPT-6 Thinking द्वारा Chat01

प्रश्न

bad.txt

这份 agents.md 明显过长了,能如何优化?再给一个专门的“修宪”工具/文件夹,让 agent 提议,然后我有空的时候才每个看看是否需要?

विचार

优化与设计修宪机制

我会先把 agents.md 压缩为高优先级原则、工作流和索引,把细则移到专题文件。然后设计一个独立的“修宪提案”目录,自动生成提案,但由你逐项审核、批准和合并。

Designing a reviewable system

I’ll separate permanent rules from optional guidance, then create a proposal-only amendment folder. Agents can submit changes there, while nothing becomes active until you review and approve it manually.

उत्तर

我会把这份内容拆成“必须常驻的规则”和“按需加载的知识”,同时做一套独立的“修宪提案箱”:agent 可以提交候选修改,但不能自行让规则生效;你之后再逐条审议。

विचार

优化与设计修宪机制

我会先把 agents.md 压缩为高优先级原则、工作流和索引,把细则移到专题文件。然后设计一个独立的“修宪提案”目录,自动生成提案,但由你逐项审核、批准和合并。

Designing a reviewable system

I’ll separate permanent rules from optional guidance, then create a proposal-only amendment folder. Agents can submit changes there, while nothing becomes active until you review and approve it manually.

Designed a reviewable constitutional amendment system

Building incrementally

I’m treating the uploaded text as a specification, not as instructions to execute. I’ll extract its durable rules, move detailed guidance into references, and package a proposal-only workflow with explicit human approval.

Refining the workflow

I’m keeping the permanent index short, moving detailed rules into linked documents, and making amendments proposal-only. I’ll include statuses, diffs, rationale, review notes, and a manual approval step without automatic activation.

Built and refined the workflow incrementally

Used skill-creator skill

विचार

Designed AGENTS.md amendment workflow and assessed skill packaging tools

विचार

Searched 4 websites

विचार

Built Constitutional Proposal Governance Toolkit structure

उत्तर

目前最值得保留的是那些确实防止过真实故障的规则;构建环境陷阱、A/B 验证细节、提交格式等都可以从项目根文件移到专题文档。提案工具会保存修改前快照和 diff,审核时还能检测原文件是否已经变化,避免过期提案覆盖新内容。

विचार

Designed AGENTS.md amendment workflow and assessed skill packaging tools

Finishing the package

I’m including compact global/project files, topic documents, a proposal queue, templates, review commands, and tests. The workflow records rationale and diffs, but never activates amendments automatically.

Finished the package

विचार

Completed AGENTS governance refactor, validation, documentation, and packaging

Worked for 10m 6s

उत्तर

建议采用“精简宪法 + 按需加载的细则 + 修宪提案箱”三层结构。 Agent 仍然可以发现问题、总结经验、提出新规则,但不再直接把经验追加进 AGENTS.md。

我检查了上传的内容,发现它实际上包含两份 AGENTS.md,另外还有 Pi harness、Skills 和审查流程注入的上下文:

文件当前长度建议
全局 ~/.pi/agent/AGENTS.md约 11.2 KB收敛为 3–5 KB 的通用行为契约
项目 AscendNPU-IR/AGENTS.md约 21 KB收敛为 2–4 KB 的项目入口与索引
其他注入内容约 16 KB单独管理,不与 AGENTS 混淆

最应该改的不是把文字机械压缩,而是改变规则的生命周期:

发现问题 → 提交提案 → 等待人审 → 批准后生效

目前两条规则尤其需要调整:全局文件要求读懂机制后在同一轮写入文档,而且明确禁止将新知识放到 inbox。这会和你想要的“先提议,我以后再审”直接冲突。

新的提案箱必须是非生效区:里面的内容既不算正式规则,也不随普通任务自动加载,更不能因为 agent 自己提交了提案就自动获得修改宪法的权力。

已做好的“修宪”工具

下载 constitution-proposals Skill

包含提案脚本、使用说明和自动化测试;已通过 Skill 校验。

它有五个命令:

命令作用是否修改正式规则
proposeAgent 提交一份带证据和 diff 的提案否
list查看待审清单否
show查看某个提案否
review人工批准、驳回或暂缓否
apply对已批准提案进行确认后应用是

其中 review 和 apply 要求交互式终端,且 Skill 明确禁止 agent 自行调用。apply 还会检查原文哈希,并创建备份,避免直接覆盖发生变化的文件。

注意:这是一套人为审核工作流,不是安全权限隔离。 如果希望从技术上禁止 agent 绕过审核修改文件,仍需要 Git 分支保护或操作系统权限隔离。

精简后的 AGENTS.md 也准备好了

下载完整重构包

包含精简版 AGENTS、6 份按需加载的专题文档、修宪工具及原始文件备份。

全局 AGENTS

11.2 → 5.2 KB

缩减约 54%

查看候选全局文件

项目 AGENTS

20.9 → 3.9 KB

缩减约 81%

查看候选项目文件

两份文件的常驻内容合计减少约 72%。原本那些编译陷阱、A/B 验证、jj 工作流、commit 规范等并没有简单丢掉,而是按主题移出根文件。Pi 支持这种分层方式:自动加载全局及项目的 AGENTS.md,Skill 的完整内容则按需加载。(github.com github.com)

最终使用方式

安装 Skill 后,日常由 agent 提交提案:

bash
# 用户有空时,从自己的终端查看待审提案 AMEND=~/.pi/agent/skills/constitution-proposals/scripts/amend.py python3 "$AMEND" list python3 "$AMEND" review <id>

审核时可以批准、拒绝或暂缓。批准不等于应用;以后确认要生效,再显式运行 apply。

还有一件容易遗漏的事:你现有的 revise Skill 描述仍然倾向于直接写入知识文档。它也必须调整为“默认提交提案”,否则新旧两套规则会互相打架。重构包的 README 已说明这个迁移步骤。

另外,我发现上传内容中存在一个独立冲突:harness 要求 Conventional Commits,而项目要求 [Module] type: ...。这个需要修改 harness 注入规则,不能仅靠精简 AGENTS.md 解决。

以上都还是候选文件和工具包,没有修改你真实机器上的文件。我建议先安装修宪工具,再人工审阅精简方案;这样以后的 agent 学习就能进入可积压、可追溯、可逐条否决的流程,而不是让 AGENTS.md 持续自我膨胀。

इस प्रश्नोत्तर को साझा करें