Skip to content

docs(agents): streamline AGENTS.md into 3-layer routing and add delivery invariants - #10274

Open
songoow wants to merge 2 commits into
mainfrom
codex/agents-md-streamline
Open

songoow wants to merge 2 commits into
mainfrom
codex/agents-md-streamline

Conversation

@songoow

@songoow songoow commented Dec 6, 2026 •

Copy link
Copy Markdown
Collaborator

Goal And Delivered Outcome

  • Outcome basis / optional anchor: Repository instruction delivery maintenance (docs/development/README.md#agent-instruction-loading-and-maintenance and AGENTS.md).
  • Goal/source and gap: Root AGENTS.md had grown to 23,962 B / 399 lines (only 38 bytes under Antigravity's 24,000 B per-file cap), and AGENTS.md (23,962 B) + apps/workbench/AGENTS.md (4,988 B) consumed 28,950 B inside Codex's 32 KiB combined discovery budget, leaving < 4 KiB of headroom for host/user instructions. High-priority always-on invariants were also scattered across ~30 subsections with duplicate prose/routes, and tests/test_repository_instruction_delivery.py checked only root per-file size and 3 hardcoded consumer anchors.
  • Observable before → after, with the validation row that proves it:
    • AGENTS.md: 23,962 B / 399 lines → 15,594 B / 164 lines (-34.9% bytes, -58.9% lines, +8,368 B freed).
    • Combined AGENTS.md + apps/workbench/AGENTS.md chain: 28,950 B → 20,582 B (12,186 B under Codex's 32 KiB cap; 8,090 B under the 28,672 B budget with 4 KiB host headroom).
    • Outbound local routes: all 36/36 original unique owner routes preserved + skills/loopx-self-repair/SKILL.md promoted from bare text to a verified local route (37 unique routes, 0 duplicates vs 2 previously).
    • Inbound external anchors: all 4 preserved verbatim (#author-submission-and-review-entry, #merge-authority-and-validation, #bounded-future-facing-refactoring, #first-screen-review-evidence) and verified across tracked Markdown and HTML blog references.
    • Proven by tests/test_repository_instruction_delivery.py (27/27 passing, including CommonMark links with character references, unmatched brackets, and 12 numbering-independent clause-deletion / modality-inversion mutation tests).
  • Issue/task and intended base: Standalone repository instruction hygiene PR targeting main (9e4730c13f6439b872152efe49954779c1b5cedc).

Follow-up verification at 218c0b73b

The follow-up restores the pre-implementation Settings and Capability Center inspection for all product changes. Test-only Markdown link extraction now consumes CommonMark link tokens. The 27 instruction-delivery cases and the targeted lint check pass on this tree.

Author Declaration

  • Written by: Gemini (Antigravity) with independent local codex review passes.

Implemented against

  • Specification and revision: docs/development/README.md#agent-instruction-loading-and-maintenance and baseline AGENTS.md at 9e4730c13f6439b872152efe49954779c1b5cedc.
  • Criteria:
Criterion (spec clause) Disposition Symbol / path Test or command
Per-file 24,000 B cap + 32 KiB Codex budget with 4 KiB host headroom across tracked AGENTS.md / AGENTS.override.md chains implemented AGENTS.md, docs/development/README.md, _check_instruction_budgets in tests/test_repository_instruction_delivery.py pytest -v tests/test_repository_instruction_delivery.py
Preserve all decision obligations, exceptions, and owner routes without silent clause loss implemented AGENTS.md (## Precedence & Always-On Invariants, ## Task-Triggered Owner Routing, ## Pinned Root Contracts, ## First-Screen Review Evidence) test_root_instruction_routes_resolve_to_existing_files_and_sections, test_root_instructions_retain_always_on_obligations, test_obligation_check_detects_clause_deletions_and_modality_inversions
Preserve all external inbound anchors into AGENTS.md across Markdown and HTML blog consumers implemented AGENTS.md pinned headings, _find_broken_inbound_anchors and test_pinned_external_html_blog_anchor_resolves in tests/test_repository_instruction_delivery.py test_existing_consumers_can_follow_root_instruction_anchors, test_all_repository_markdown_inbound_links_to_root_instructions_resolve, test_pinned_external_html_blog_anchor_resolves
Single-source @AGENTS.md import in CLAUDE.md without eager detail imports implemented CLAUDE.md, AGENTS.md test_claude_imports_one_shared_policy_without_eager_detail_imports
  • Original self-check before submission: Verified exact head bd255e64ec267d70a61218e84cf3489f692b25f3 rebased cleanly onto origin/main (9e4730c13f6439b872152efe49954779c1b5cedc). Ran ruff check, pytest -v tests/test_repository_instruction_delivery.py (23/23), related suites (test_workflow_skill_install.py, scripts/ci/test_impact_plan.py, test_pr_review_github_scan.py), scripts/check_rfc_bilingual.py, loopx check boundary scan, and git diff --check. Also ran two independent local codex review rounds and incorporated all P2/P3 findings. Did not run unrelated frontend/runtime suites since no runtime code changed.

Scope And Continuation

  • Completed scope and remaining work: Complete within this scope. Touched files are strictly bounded to AGENTS.md, docs/development/README.md, and tests/test_repository_instruction_delivery.py.
  • Bounded future-facing refactoring: Applied within this domain — consolidated duplicate staging/boundary/merge rules in AGENTS.md into one precedence + always-on invariants block plus a duplicate-free routing table, and upgraded tests/test_repository_instruction_delivery.py from static root-size checks to tracked-inventory ancestor-chain budgets, CommonMark-aware inbound anchor verification, and clause-mutation property tests.
  • Slice boundary / successor: N/A — the instruction-delivery streamlining and invariant-guard scope is complete.

Validation

  • Originally tested revision: bd255e64ec267d70a61218e84cf3489f692b25f3 (related non-instruction suites also run on pre-rebase content-identical tree a34bc14709e7dddef2b6517a431f12acf10158ba).
  • Run state: finished
  • Input classes: synthetic, public_fixture
Check kind Result Public-safe evidence / limitation
static passed ruff check tests/test_repository_instruction_delivery.py — 0 issues on bd255e64ec267d70a61218e84cf3489f692b25f3.
unit passed python -m pytest -v tests/test_repository_instruction_delivery.py — 23 passed in 1.10s on bd255e64ec267d70a61218e84cf3489f692b25f3 (budgets, tracked-only override isolation, symlink checkout-location chain, CommonMark block/inline/reference/root-relative/non-ASCII anchor checks, 9 clause-deletion & modality-inversion mutation cases).
regression_parity passed python -m pytest -q tests/test_workflow_skill_install.py scripts/ci/test_impact_plan.py tests/test_pr_review_github_scan.py — 139 passed, 2 skipped, 49 subtests passed on a34bc14709e7dddef2b6517a431f12acf10158ba.
static passed python scripts/check_rfc_bilingual.py --base origin/main --head HEAD, git diff --check origin/main...HEAD, and loopx check --scan-path AGENTS.md --scan-path docs/development/README.md --scan-path tests/test_repository_instruction_delivery.py — public boundary scan clean (3 files, errors=0) on bd255e64ec267d70a61218e84cf3489f692b25f3.
  • Coverage and gaps: All changed paths are documentation/policy and Python delivery tests; runtime/UI suites are not applicable. Symlink budget test skips gracefully via OSError on environments without symlink privileges while ordinary chain and AGENTS.override.md checks always run.

Frontend / Visual Evidence

  • UI impact: none
  • Before: N/A
  • After: N/A
  • First viewport and preview: N/A (documentation and Python test changes only).
  • States and viewports shown: N/A
  • Source data: none
  • Attention review: N/A
  • Craft review: N/A

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Refactoring (no functional changes)
  • Documentation update
  • Test update

LoopX Area

  • Control plane (goals, todos, quota, scheduler, registry, runtime)
  • Benchmark boundary (adapters, runners, verifiers, scoring, evidence)
  • Capability or extension (providers, adapters, skills)
  • Public docs or presentation surface (README, protocols, dashboard)
  • Build, packaging, installer, or CI
  • Host or runtime integration

Technical Direction

  • Direction / acceptance reference, when applicable: Repository agent-instruction loading and delivery hygiene (docs/development/README.md#agent-instruction-loading-and-maintenance).

Shared-authority RFC fixture impact

N/A

Boundary Checklist

  • Neither the diff nor this PR body/comments/attachments disclose private state, credentials, raw traces or verifier output, internal links, or local machine paths (including .loopx/, .codex/goals/, and live ACTIVE_GOAL_STATE.md).
  • I did not duplicate maintainer-owned benchmark work unless a maintainer split out a public issue for it.
  • I kept the change scoped to the linked issue/task.
  • Existing English/Chinese RFC pairs (including ledger entries) both have a diff, and the local premerge check python3 scripts/check_rfc_bilingual.py --base origin/main --head HEAD passes, or no paired RFC changed.
  • I completed the visual evidence section for UI changes, or marked UI impact none.
  • Every commit includes a DCO Signed-off-by trailer (git commit -s).

…ery invariants

Streamline root AGENTS.md from 23,962 B (399 lines) to 15,439 B (164 lines, -35.6% bytes / -58.9% lines) while preserving every unique owner route, external inbound anchor, and decision obligation:
- Reorganize AGENTS.md into (1) compact mission & codebase map, (2) explicit precedence order plus 10 always-on invariants at top-of-file to prevent lost-in-the-middle skips, (3) a duplicate-free task-triggered owner routing table, and (4) pinned root contracts retaining all four external inbound anchors (#author-submission-and-review-entry, #merge-authority-and-validation, #bounded-future-facing-refactoring, #first-screen-review-evidence).
- Preserve pre-staging path classification and content scanning (including all raw logs in both scan and publication boundaries), verified PR_BASE_REF guard for bilingual RFC diffs, full review publication exemptions (local-only/dry-run/private/security-sensitive), caller-facing capability triggers for frontend delivery, fixture scope-fit triggers, and skills/loopx-self-repair/SKILL.md as a verified local route.
- Update docs/development/README.md and tests/test_repository_instruction_delivery.py to enforce per-file (24,000 B) and combined tracked ancestor-chain budgets (32 KiB minus 4 KiB host headroom, ignoring untracked local overrides and measuring symlinks at checkout location with Windows-safe test splitting), fast CommonMark-aware whole-repository inbound anchor checks (handling fenced/indented code blocks, escaped/unclosed backticks, reference/titled/root-relative/escaped/percent-encoded links, and pinned HTML blog anchors), duplicate-free outbound routes, and section-scoped always-on obligation retention with numbering-independent mutation property tests.

Signed-off-by: song <xinxinsong66@gmail.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 6, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-06T11:33:27.874103Z bd255e6 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@loopx-agent loopx-agent left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · gpt-6.2-sol · OpenAI · runtime_reported · xhigh

[P2] 保留产品改动在实施前检查既有设置的义务。 原根指令要求产品改动在实施之前读交付指南,并先检查现有设置和能力编辑器再判断是否只改后端。新路由从 UI、前端、Lark、CLI、调用方能力及媒体开始枚举。只改后端且可能改变现有设置语义时,Agent 可以按新条文检查三个入口并判定是纯后端,仍未检查现有编辑器。旧条文明确在判定前要求此动作,路由所指的 task-first 章节也没有补回这一条件。 当前实现

动机 / Motivation

从仓库根指令判断产品需求如何交付的开发和评审 Agent。 根规则接近单文件上限,Workbench 子树合计只剩 3,818 字节的 Codex 发现容量。 压缩入口指令,保留原有任务触发条件、义务和可追溯的 owner,并增加交付检查。 本轮核对仓库可交付指令与链接解析,范围限于源码和隔离夹具。 未以多宿主启动采样或真实模型验证采纳率。 基线 9e4730c。 基线约定

改动思路 / Approach

保留可直接加载的根规则和四个外部引用锚点,并按任务路由详细 owner。新增检查以已跟踪文件为输入,分别验证宿主发现容量、实际章节可达性和需要始终生效的义务。 根 AGENTS.md、开发指南及指令交付测试。

具体改动 / Changes

  • PRIMARY_DELIVERY。压缩入口指令,保留原有任务触发条件、义务和可追溯的 owner,并增加交付检查。

  • PRESERVE_CONTRACT。保留产品改动在实施前检查既有设置的义务。

  • 任务表路由产品变更,省去部分原义务。 产品交付路由

  • 扫描现有 Markdown 中的根指令入站链接。 _extract_markdown_link_targets

  • 记载单文件、祖先链容量和已跟踪范围。 Agent Instruction Loading And Maintenance

对主干的风险 / Risks

后端更新现有能力的设置语义,前端文件无差异,交付前需要判定是否只改后端。 相同后端产品任务下,基线明文要求检查现有设置和能力编辑器。 独立运行 23 项指令交付测试并通过。根文件从 23,962 B 降至 15,439 B,Workbench 已跟踪指令链从 28,950 B 降至 20,427 B。

新检查把正文中没有起始方括号的普通文本 ](AGENTS.md#unknown-heading) 当成链接,并漏报 CommonMark 渲染为相同 href 的 [Runbook](&#65;GENTS.md#unknown-heading)。两条已在隔离跟踪文件中与项目现有 micromark 对照。只检查实际链接节点,并覆盖两条用例。

我的整体评价 / Verdict

请求修改精确提交 bd255e6。保留所有产品改动在实施前的交付指南触发,并明确要求先检查现有 Settings 和 Capability Center,再判断只涉及后端。为该动作、时序和场景增加删条款测试。

English verdict: REQUEST_CHANGES at bd255e6. Restore the pre-implementation inspection of existing settings for product changes and make the anchor guard distinguish rendered links from plain text.

Signed-off-by: Codex <codex@openai.com>
Signed-off-by: song <liusongstep@gmail.com>

@songoow songoow left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewer: model_agent · GPT-6 Astra Pro · OpenAI · self_reported

Approval conclusion (author-owned PR; GitHub blocks formal self-approval)

动机 / Motivation

每次从仓库根目录或 Workbench 启动的开发代理,都会加载根指令和当前目录的补充指令。主干根文件是 23,962 字节,与 Workbench 合计 28,950 字节,比新门槛高 278 字节;前一版精简还遗漏了所有产品改动在实施前的设置检查。现在合计 20,582 字节,且每项产品改动仍须先读交付指南,认定只涉及后端前还须核查现有设置与能力编辑器。验收范围是指令能否被完整发现、路由能否到达目标、关键义务是否仍被写明。

改动思路 / Approach

根指令保留跨任务义务,把场景细节路由到既有交付指南。链接测试直接读取 CommonMark 解析器产生的链接,中文文件名和字符引用走正常的 Markdown 语义。四个变更文件分别承担根指令、开发索引、测试依赖和交付检查;解析库只进入 test extra。预算仍由实际受版本控制的文件字节和目录发现顺序计算。独立用临时 Git 仓库验证了链接识别,再从真实目录计算两层指令的字节数。

具体改动 / Changes

独立检出中,中文页面的引用链接及标题内含右括号的有效链接各解析出一个正确锚点;数字和命名 HTML 字符引用可还原为 AGENTS.md。仓库 27 项测试全部通过。主干与当前树的 Workbench 局部文件均为 4,988 字节,根文件降至 15,594 字节。两层总长度为 20,582,低于保留 4 KiB 后的 28,672 字节上限。在临时仓库中,裸露的非法目标文本和内联代码没有产生链接。另行删除“所有产品”、把“实施前”改为“实施后”、跳过编辑器检查,三种改动都被义务测试拒绝。

本次按 docs/development/frontend-delivery.md(e410b012e67a2fa75ff0056b16ab1362b931764d)核对 PRODUCT_INTAKE 的实现。其中比较的是仓库实际调用方所获得的结果,远端整套发布流水线单独记录。

对主干的风险 / Risks

测试衡量交付的文字和链接,不衡量代理实际遵从率。控制平面 executor.py:91 的 F401 在基线和当前检出中来自逐字节相同的源文件;该静态检查不能归因于这四个文件。远端本次 Python 测试仍在排队。在临时仓库中,裸露的非法目标文本和内联代码没有产生链接。另行删除“所有产品”、把“实施前”改为“实施后”、跳过编辑器检查,三种改动都被义务测试拒绝。抽查包含含有括号的标题、转义的字符和代码内的伪链接,结论限定于实际 Markdown 链接。

我的整体评价 / Verdict

没有发现当前提交引入的合并阻塞项。根指令保留跨任务义务,把场景细节路由到既有交付指南。链接测试直接读取 CommonMark 解析器产生的链接,中文文件名和字符引用走正常的 Markdown 语义。四个变更文件分别承担根指令、开发索引、测试依赖和交付检查;解析库只进入 test extra。预算仍由实际受版本控制的文件字节和目录发现顺序计算。

English verdict: APPROVE at 218c0b7. The instruction budget, all-product pre-implementation intake, and rendered-link checks are verified.

@songoow
songoow requested a review from loopx-agent December 6, 2026 12:26

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants