Skip to content

docs: 将项目规范迁至 AGENTS.md 并保留 Claude 兼容入口 - #279

Merged
lishuceo merged 3 commits into
mainfrom
docs/agents-instructions-migration
Sep 26, 2026
Merged

lishuceo merged 3 commits into
mainfrom
docs/agents-instructions-migration

Conversation

@lishuceo

@lishuceo lishuceo commented Sep 26, 2026 •

Copy link
Copy Markdown
Owner

项目规范原先仅维护在 CLAUDE.md,CI 审查、技能模板和活动文档也硬编码该入口。本次将规范全文迁到 AGENTS.md,并让 CLAUDE.md 只保留一行 @AGENTS.md;后续规范维护统一修改 AGENTS.md。

保留 stub 有已验证的兼容原因:锁定的 Agent SDK 0.3.156 附带 Claude Code 2.1.156,低于原生加载 AGENTS.md 的 2.1.277 门槛。两个 claude-code-action@v1 workflow 使用网关且未固定 CLI 版本,不能用本机 2.1.283 的版本推断其能力。官方加载规则支持通过该导入方式共享指引。

  • 更新两个 CI workflow、四个项目技能及其生成模板、README、活动计划和运行时提示词引用;其他目标仓库仍可使用 CLAUDE.md。
  • 保留 SDK settingSources 默认值和调用方覆盖行为,包括 [];不升级依赖或改变权限、技能发现及工作区重启逻辑。
  • PR 审查 workflow 将 --model opus 改为 --model anthropic/claude-opus-5-5,使用网关要求的完整模型标识。
  • 研究和已完成计划保留历史引用;旧路由设计标注为历史方案。修正 session 文档中“CLAUDE.md 内容参与 prompt hash 并自动重置会话”的过时描述。

验证:

  • git diff --check 通过。
  • npm run typecheck 通过;npm run lint 无错误,202 条警告。
  • npm run docs:check 及根目录 AGENTS.md / CLAUDE.md 的额外 Markdown lint 通过。
  • 两个 workflow 的 YAML 解析通过;审查模型已按网关要求明确指定为 anthropic/claude-opus-5-5,模型修复通过结构比较确认仅改动这一项。
  • 本地模拟 API 冒烟测试通过:SDK CLI 2.1.156 与 CLI 2.1.283 均通过 stub 加载 AGENTS.md;settingSources: [] 不加载项目指引。测试不调用真实模型。
  • CI 同范围回归通过:TMPDIR=/var/tmp npx --no-install vitest run --exclude='**/quality.test.ts' --exclude='**/integration.test.ts',100 个测试文件 / 1744 项测试全部通过。使用 /var/tmp 是为了避开本环境 /tmp/.git 对非 Git 目录用例的干扰;该干扰在未修改基线上也可复现。

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 2s —— View job


I'll analyze this and get back to you.

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 1s —— View job


I'll analyze this and get back to you.

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Claude encountered an error after 2s —— View job


I'll analyze this and get back to you.

@github-actions

github-actions Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @lishuceo's task in 1m 7s —— View job


PR review: approved ✅

  • Checked for my earlier inline comments (there were none)
  • Read the PR intent and the full diff
  • Compared the new AGENTS.md with the old CLAUDE.md, and checked the code, workflow, skill and doc references
  • Posted the summary comment

I found no issues at confidence ≥75, so I left no inline comments.

  • Migration is complete: all of the old CLAUDE.md text is now in AGENTS.md. The only additions are the compatibility section and the reworded settingSources gotcha. CLAUDE.md is now just @AGENTS.md.
  • Design doc fix is correct: the session doc now says the system prompt hash is only used for logging. That matches src/claude/executor.ts:824-835, which only logs when the hash changes.
  • Links and code: the anchor link resolves. settingSources behaviour is unchanged, including passing []. The src/ changes only touch comments and prompt text.

One optional suggestion, below the threshold: the reworded settingSources gotcha drops the old note that permissions.allow is checked before canUseTool. It's still useful to know when debugging blocked MCP tools, so consider keeping a line about it.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Approved

I found no issues at confidence ≥75. There were no earlier review comments of mine to resolve.

  • Migration is complete: git diff origin/main:CLAUDE.md HEAD:AGENTS.md shows the full text was carried over. The only changes are a new Instruction Loading Compatibility section and a rewrite of the settingSources gotcha. The root CLAUDE.md is now just @AGENTS.md.
  • Doc fix matches the code: docs/design/thread-session-mapping.md now describes systemPromptHash as diagnostic only. That matches src/claude/executor.ts:824-835, which hashes only knowledge plus the base prompt and just logs a message when the hash changes.
  • Links resolve: AGENTS.md#instruction-loading-compatibility points at a real heading.
  • settingSources behaviour is unchanged: settingSourcesOverride ?? [...] stays as it was, so passing [] still works. The src/ changes only touch comments and prompt text.
  • Workflows: --model anthropic/claude-opus-5-5 is set in pr-review.yml.

Optional, below the threshold: the rewritten settingSources gotcha drops the old note that permissions.allow in project/local settings is checked before canUseTool. That's still useful to know when debugging MCP tools that get blocked. Consider keeping one line about it.

Overall: a careful, well-scoped docs migration.

@lishuceo
lishuceo merged commit bc21682 into main Sep 26, 2026
4 checks passed
@lishuceo
lishuceo deleted the docs/agents-instructions-migration branch September 26, 2026 13:24
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