Skip to content

feat(agents): 首批项目技能(任务包/还原度门禁/迁移纪律)+ 技能格式门禁 - #46

Merged
babycoder-dev merged 2 commits into
mainfrom
chore/agent-infra-p1-skills
Oct 7, 2026
Merged

babycoder-dev merged 2 commits into
mainfrom
chore/agent-infra-p1-skills

Conversation

@babycoder-dev

Copy link
Copy Markdown
Owner

Summary

P1.2:把本仓自己的可复用操作手册做成技能,并给技能格式加一道会红的门禁。此前仓里只有 1 个借用来的 code-simplifier。

  • 新增三个技能(.agents/skills/)——只放操作手册,规则仍留在 constitution / ADR / RFC:
    • task-package:任务包骨架、执行纪律(不静默增删文件、匹配失败就停、必读要真读)、交付要求;
    • ui-fidelity-gate:L1/L2 边界、A 类机器校验(pnpm fidelity 的 A1/A2/A4 与未覆盖边界)、B 类人工并排比对(必须覆盖交互态);
    • db-migration-discipline:迁移只前向、一 schema 一入口、Drizzle 与实际 DDL 对齐、seed 幂等、env-gated 测试的假绿陷阱。
  • 新增 scripts/check-skills.mjs + scripts/lib/skill-rules.mjs(pnpm skills:validate):必须是 <root>/<name>/SKILL.md、frontmatter 有 name/description、name 与目录名一致、拒绝嵌套。理由是技能加载失败是静默的——缺 frontmatter 或目录名不一致时技能只是"不出现",没有任何报错。
  • 门禁收敛:四个仓库级检查合为 pnpm check:repo(fidelity / evidence / goal:validate / skills:validate),CI 由 4 步变 1 步;单独调试仍可跑各自 script。
  • docs/agent-workflow.md §1 新增第 4 条:门禁也会"假红",处置是分段复跑 + CI 最终确认,不是反复重跑到绿(后者与假绿是同一个病的两面)。

Verification

$ pnpm check:repo
UI 还原度 A 类门禁:通过(215 个文件)
证据形式门禁:通过(生效起点后 3 条条目)
技能格式门禁:通过(4 个技能)
exit 0
  • pnpm check:repo exit 0(三个门禁全过)
  • pnpm vitest run --config vitest.config.mts scripts → 85 通过(27 A 类 + 25 goal + 14 证据 + 10 hook + 9 技能)
  • pnpm build 单独 exit 0
  • 技能加载已实测:写完三个 SKILL.md 后,当前会话的可用技能目录当场更新并列出它们——即 .agents/skills 扫描确认生效(这解决了长期挂账的"挂载是否真被调用"的一半;hook 挂载仍未验证)
  • 完整 pnpm verify 本次未一次跑绿:它的 test:e2e 段触发了已知的 vitest 偶发 flake(worker ERR_IPC_CHANNEL_CLOSED,紧跟 pnpm test 之后运行时出现)。该 flake 在本仓 verification-log 里已有 5 次历史记录(如 M9-1、M6-3 条目)。按仓库既有先例做分段复跑:pnpm test 单独通过(55 文件/355 测试 + 39 文件/136 测试)、pnpm test:e2e 单独 4/4 通过(11 文件/63 测试)、pnpm build 单独通过。CI(Node 22 完整链路)是最终确认。

Review Focus

  • 三个技能的内容边界是否认可:只写操作手册、不重复规则、每处都指向权威文档
  • 技能门禁的严格度(description ≥20 字符、name 必须等于目录名、拒绝嵌套)是否合适
  • 把四个微门禁收成 pnpm check:repo 是否认可(CI 步骤更少,失败时日志里仍能看到是哪一项)
  • 不涉及 API / 权限 / 数据范围 / 迁移 / 模块边界;无新增依赖

备注

「门禁假红」这条纪律是本 PR 顺带产出的:仓库历史里这个 flake 被反复遇到,但没有一条处置约定,于是每次都要重新判断一次。现在写进了 §1。

P1.2 of docs/agent-workflow.md. Adds task-package, ui-fidelity-gate and db-migration-discipline under .agents/skills as operational manuals (they point at the authoritative rules rather than restating them), plus scripts/check-skills.mjs and the pure rules in scripts/lib/skill-rules.mjs: a skill must be <root>/<name>/SKILL.md with matching name/description frontmatter and must not be nested, because a skill that fails those rules loads silently not at all. Consolidates the repository-level checks into pnpm check:repo so CI runs one step. Records in section 1 that gates can also fail spuriously and that the remedy is segment-wise re-runs plus CI, never re-running until green.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T08:08:29.362413Z debc869 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: debc8698e2

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread scripts/check-skills.mjs Resolved
…vade the gate

Codex (PR #46, P2): the traversal skipped references/scripts/assets, so a nested SKILL.md inside a bundle was never seen and pnpm skills:validate passed even though nested skills are not loaded - the gate advertised an enforcement it did not perform. Only node_modules and .git are skipped now, the roots are overridable via WORK_SKILL_ROOTS, and scripts/check-skills.spec.mjs exercises the traversal end to end (including the exact nested case).
@babycoder-dev

Copy link
Copy Markdown
Owner Author

按 Codex 审查修复(6465e6c):

P2 · 跳过列表让嵌套技能逃过门禁 — 采纳,而且这条正好打在我这道门禁的核心职责上。 我为了避免遍历重目录,把 references/、scripts/、assets/ 加进了跳过列表;结果是 foo/references/SKILL.md 这类嵌套技能永远不会被发现——门禁宣称拦嵌套,实际漏检;这些名字的顶层目录若含 SKILL.md 也会被整段跳过。

  • 现在只跳过 node_modules 与 .git,其余一律遍历,嵌套 SKILL.md 一律报错。
  • 顺带把这层逻辑变成可测:技能根可用 WORK_SKILL_ROOTS 覆盖,新增 scripts/check-skills.spec.mjs 用真实进程 + 临时技能根做端到端验证,包含你指的那个嵌套用例(回归保护)。

实测:

$ node scripts/check-skills.mjs --verbose
技能根:.agents/skills;校验 4 个 SKILL.md
技能格式门禁:通过(4 个技能)        exit 0

$ pnpm vitest run --config vitest.config.mts scripts
Test Files  6 passed (6)
      Tests  89 passed (89)          exit 0

(脚本级测试从 85 → 89,新增 4 条正是门禁遍历的端到端用例。)

@babycoder-dev
babycoder-dev merged commit 4a64c9d into main Oct 7, 2026
3 checks passed
@babycoder-dev
babycoder-dev deleted the chore/agent-infra-p1-skills branch October 7, 2026 08:19
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.

1 participant