gatekeeper
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGatekeeper 总控路由与全局行为规则
Gatekeeper Master Control Routing and Global Behavior Rules
本文件是迭代流水线的单一规则源 + 总控路由;所有子 skill 的职责见第八节,整体规则以下各节为准。 版本编号 = 当前 Git 分支名(只读获取;失败/空 → 提示人工切换分支,禁止用空串/猜测值)。 路径约定(全局生效):git branch --show-current一律指 Git 仓库根目录(项目根/...所在目录,如AGENTS.md);项目根/.gatekeeper/skill 的gatekeeper指该 skill 自身资源目录,两者不可混淆。template/
This document is the single rule source + master control routing for the iteration pipeline; the responsibilities of all sub-skills are listed in Section 8, and the overall rules are subject to the following sections. Version number = current Git branch name (obtained by readingonly; if failed/empty → prompt manual branch switch, prohibit using empty string/guessed value). Global Path Convention:git branch --show-currentalways refers to the Git repository root directory (whereProject Root/...is located, e.g.,AGENTS.md);Project Root/.gatekeeper/of thetemplate/skill refers to its own resource directory, and the two must not be confused.gatekeeper
When to Use
When to Use
- 仅人工以 命令触发(
/gatekeeper设agents/openai.yaml,禁止 Agent 隐式调用);allow_implicit_invocation: false - 用于推进迭代、不确定当前进度、或从中断处继续。
- Manual trigger only via the command (set
/gatekeeperinallow_implicit_invocation: falseto prohibit implicit invocation by Agent);agents/openai.yaml - Used to advance iteration, confirm current progress, or resume from an interrupted point.
一、固定迭代流水线(强制卡点 + 全留痕)
1. Fixed Iteration Pipeline (Mandatory Checkpoints + Full Traceability)
人工需求确认Agent概要设计人工评审留痕+放行Agent编码+单元测试Agent dev环境测试(review.md 第三部分留痕)人工代码评审留痕+放行人工提交合并+部署staging人工 staging测试验证(test.md留痕)人工辅助部署prod收尾- 需求确认判据:无 HTML 占位符,且「需求确认人/日期」已填。
requirement.md - 聊天提及修改:需求/概要设计阶段 → 禁止直接改代码,要求人工补齐 requirement.md;编码阶段小改动(不涉及已评审接口/数据结构/设计)→ 可直接改码并走代码评审。
- 小改动迭代:progress.md 阶段2 可标「跳过」,跳过概要设计与设计评审,直接进入 T03。
- T07 问题归属:需求已有 → 回流阶段3/4 修复;需求未覆盖 → 人工补需求后重新开发,无需全流程重走。
- 历史归档:保存已完结迭代,迭代中完全忽略。T08 完成或
项目根/.gatekeeper/history/中止后,整体迁移至/gatekeeper-abort。项目根/.gatekeeper/history/${版本编号}/
Manual Requirement ConfirmationAgent High-Level DesignManual Review Traceability + ApprovalAgent Coding + Unit TestingAgent Dev Environment Testing (traceability in Part 3 of review.md)Manual Code Review Traceability + ApprovalManual Commit Merge + Staging DeploymentManual Staging Testing Verification (traceability in test.md)Manual-Assisted Production Deployment Finalization- Requirement confirmation criteria: has no HTML placeholders, and "Requirement Confirmer/Date" is filled.
requirement.md - Modifications mentioned in chat: In requirement/high-level design phase → direct code modification is prohibited, require manual completion of requirement.md; minor changes in coding phase (not involving reviewed interfaces/data structures/design) → can modify code directly and proceed with code review.
- Minor change iteration: Mark "Skipped" in Phase 2 of progress.md, skip high-level design and design review, directly enter T03.
- T07 issue attribution: If covered by requirements → return to Phase 3/4 for repair; if not covered by requirements → manual requirement supplement before re-development, no need to re-run the full process.
- Historical archiving: Completed iterations are stored in , and are completely ignored during iteration. After T08 is completed or
Project Root/.gatekeeper/history/is executed to terminate, migrate the entire iteration to/gatekeeper-abort.Project Root/.gatekeeper/history/${version number}/
二、评审与测试留痕强制执行规则(核心)
2. Mandatory Rules for Review and Testing Traceability (Core)
- 评审唯一依据 ;staging 测试唯一依据
review.md;dev 测试记录在test.md第三部分。忽略聊天临时评语。review.md - 评审两轮(概要设计、代码)+ 测试一轮(staging);均支持多轮整改复核,轮次记入同一表「轮次」列,不复制表头。
- 工作逻辑:只读【状态=待整改】行针对性整改、不新增功能;整改后主动提示人工复核,不私自判定完成;必须人工标【复核通过】才结束本轮;误报置「无需整改」附理由,由人工裁决,不得硬改或私自清空。
- 禁止无依据整改、超范围整改、私自清空问题记录。
- 修复后输出修复清单,告知人工复核。
- 问题全部【复核通过】+ 人工更新 progress.md 阶段 + 下发推进指令,方可进入下一阶段;AI 不主动轮询、不自行推进。
- 代码评审最小要素(闸门2 强制):放行前①按 design.md「变更点清单」逐条核对 diff 范围,识别超范围改动;②对外接口契约变更须同步 并在整改结果声明;③测试覆盖说明。空表/零问题不得直接通过;「零问题」须人工在放行备注写明核对范围与抽样项,人工至少抽样核对 1-2 个变更点。
crmeb/apidoc/ - dev 测试与验收标准映射(T04 强制):review.md 第三部分每条测试项须填「对应验收§」(对应 requirement.md 七、验收标准);存在未映射验收标准即视为 dev 测试不完整。
- staging 归属判定(test.md 强制):判「需求已有 / 需求未覆盖」前必须先 read requirement.md 原文引用条目;归属列仅允许该两枚举值,非法值主动提示人工修正;修复致接口契约变化须声明 apidoc 已同步。
- 跨迭代回归(强制):design.md 变更点清单须声明「关联历史迭代回归项」;触及上期功能时 dev 测试必须回测并在 review.md ③ 留痕,否则 dev 测试不完整。
- The only basis for review is ; the only basis for staging testing is
review.md; dev testing records are in Part 3 oftest.md. Ignore temporary chat comments.review.md - Two rounds of review (high-level design, code) + one round of testing (staging); multiple rounds of rectification and review are supported, and the round number is recorded in the "Round" column of the same table, no need to copy the header.
- Work logic: Only read and rectify rows with [Status = Pending Rectification] in a targeted manner, no new functions; actively prompt manual review after rectification, do not judge completion privately; this round can only end after manual marking [Review Passed]; mark "No Rectification Needed" with reasons for false reports, and let manual personnel decide, do not modify or clear privately.
- Prohibit rectification without basis, out-of-scope rectification, and private clearing of issue records.
- Output a repair list after fixing, inform manual personnel for review.
- Only after all issues are [Review Passed] + manual update of progress.md phase + issuance of advance instruction can enter the next phase; AI does not actively poll or advance on its own.
- Minimum Elements for Code Review (Mandatory for Gate 2): Before approval, ① check the diff scope item by item according to the "Change List" in design.md to identify out-of-scope changes; ② interface contract changes must be synchronized to and stated in the rectification result; ③ test coverage description. Empty table/zero issues cannot be approved directly; for "zero issues", manual personnel must specify the check scope and sampling items in the approval remarks, and manually sample and check at least 1-2 change points.
crmeb/apidoc/ - Dev Testing and Acceptance Standard Mapping (Mandatory for T04): Each test item in Part 3 of review.md must fill in "Corresponding Acceptance §" (corresponding to Section 7, Acceptance Standards in requirement.md); un-mapped acceptance standards mean incomplete dev testing.
- Staging Attribution Judgment (Mandatory for test.md): Must read and quote the original entry in requirement.md before judging "Covered by Requirements / Not Covered by Requirements"; only these two enumerated values are allowed in the attribution column, actively prompt manual correction for illegal values; if repair leads to interface contract changes, must state that apidoc has been synchronized.
- Cross-Iteration Regression (Mandatory): The change list in design.md must state "Associated Historical Iteration Regression Items"; when touching previous functions, dev testing must retest and leave trace in review.md ③, otherwise dev testing is incomplete.
三、文件读写权限清单
3. File Read/Write Permission List
Agent 仅允许访问以下文件,其余一律只读:
| 文件 | 可读 | Agent 写入 | 说明 |
|---|---|---|---|
| ✅ | ❌ 禁止 | 人工编写,Agent 不得修改 |
| ✅ | ❌ 禁止 | 阶段总闸门,仅人工可改 |
| ✅ | ✅ | Agent 概要设计输出 |
| ✅ | ✅ 仅【状态】+【整改结果】两列 | 状态仅允许 待整改→已整改待复核 / 无需整改 |
| ✅ | ✅ 仅【状态】+【整改结果】两列 | 同上 |
| ✅ | ❌ 禁止 | 已完结归档,迭代中完全忽略 |
| ✅ | ❌ 禁止 | 全局配置,仅人工可改 |
Agent is only allowed to access the following files, others are read-only:
| File | Readable | Agent Writable | Description |
|---|---|---|---|
| ✅ | ❌ Prohibited | Written manually, Agent cannot modify |
| ✅ | ❌ Prohibited | Phase master gate, only manual modification allowed |
| ✅ | ✅ | Agent high-level design output |
| ✅ | ✅ Only [Status] + [Rectification Result] columns | Status only allows Pending Rectification → Rectified Pending Review / No Rectification Needed |
| ✅ | ✅ Only [Status] + [Rectification Result] columns | Same as above |
| ✅ | ❌ Prohibited | Completed archive, completely ignored during iteration |
| ✅ | ❌ Prohibited | Global configuration, only manual modification allowed |
四、模板与文件生成规则
4. Template and File Generation Rules
模板统一存放于本 skill()的 ;实例化 = 复制到 + 替换 + 删除「使用说明」冗余文字:
gatekeepertemplate/项目根/.gatekeeper/${版本编号}/${版本编号}| 模板 | 实例化目标 | 生成者 | 生成时机 |
|---|---|---|---|
| requirement.md | 人工 | 初始化( |
| progress.md | 人工 | 初始化( |
| design.md | Agent | 阶段2( |
| review.md | Agent | 阶段5( |
| test.md | Agent | 阶段7( |
Templates are uniformly stored in of this skill (); instantiation = copy to + replace + delete redundant "Usage Instructions" text:
template/gatekeeperProject Root/.gatekeeper/${version number}/${version number}| Template | Instantiation Target | Generator | Generation Timing |
|---|---|---|---|
| requirement.md | Manual | Initialization ( |
| progress.md | Manual | Initialization ( |
| design.md | Agent | Phase 2 ( |
| review.md | Agent | Phase 5 ( |
| test.md | Agent | Phase 7 ( |
五、单轮对话范围约束
5. Single Round Dialogue Scope Constraints
- 一轮对话只完成 1-2 个任务,禁止一次性完结全迭代。
- 禁止跨阶段工作:未过概要设计评审(或未标跳过)前不得编码。
- 进度、阶段、评审结果全部落盘,不依赖 AI 对话记忆。
- Agent 回填整改结果后提示人工提交留痕文件;Git 提交由人工执行。
- Only complete 1-2 tasks in one round of dialogue, prohibit completing the entire iteration at once.
- Prohibit cross-phase work: Coding is not allowed before passing the high-level design review (or marking as skipped).
- Progress, phases, and review results are all recorded in files, do not rely on AI dialogue memory.
- After Agent fills in the rectification result, prompt manual personnel to submit traceability files; Git commits are executed manually.
六、阶段流转识别
6. Phase Transition Identification
- 设计评审:停止编码,待人工下发整改指令后读 review.md 问题清单。
- 有人工录入【待整改】:逐条修复回填,状态置「已整改待复核」;误报置「无需整改」附理由。
- 人工复核:通过标「复核通过」,驳回则问题进入下一轮。
- 全部复核通过 + 人工更新 progress.md + 下发推进指令,方可进入下一环节。
- 代码评审与设计评审逻辑一致。
- staging 测试:人工录 test.md 问题 → Agent 判归属 → 修复回填 → 人工复验复核。
- 进度定位:progress.md 不维护「当前阶段」指针,依据各阶段【状态】定位首个未完成阶段行;归档前校验状态与留痕结论一致。
- Design review: Stop coding, wait for manual rectification instruction before reading the issue list in review.md.
- If [Pending Rectification] is manually entered: Fix and fill in item by item, set status to "Rectified Pending Review"; mark "No Rectification Needed" with reasons for false reports.
- Manual review: Mark "Review Passed" if approved, and the issue enters the next round if rejected.
- Only after all are reviewed and passed + manual update of progress.md + issuance of advance instruction can enter the next link.
- Code review logic is consistent with design review.
- Staging testing: Manual personnel enter issues in test.md → Agent judges attribution → Fix and fill in → Manual re-test and review.
- Progress Location: progress.md does not maintain a "current phase" pointer, locate the first uncompleted phase row according to the [Status] of each phase; verify that the status is consistent with the traceability conclusion before archiving.
七、Token 消耗优化约束(强制)
7. Token Consumption Optimization Constraints (Mandatory)
- 输出规范(P0):回复只输出 变更摘要+增量,禁止全表回显留痕文件;只展示与本次动作相关的行。
- 模板头部精简(P0):留痕文件头部说明 1-2 行;实例化时删除「使用说明」冗余。
- 增量读取(P1):按【状态=待整改】/最新轮次定位范围,只读待整改行与最新轮次;同轮已读不重复读。
- codegraph 收敛(P2):精确符号名 + maxFiles 限制;链路查询优先 trace/callers。
- 单一规则源(P0):全局规则统一在本文件,避免重复注入。
- Output Specification (P0): Only output change summary + increment in replies, prohibit full table display of traceability files; only show rows related to the current action.
- Template Header Simplification (P0): 1-2 lines of header description for traceability files; delete redundant "Usage Instructions" during instantiation.
- Incremental Reading (P1): Locate the scope according to [Status = Pending Rectification]/latest round, only read pending rectification rows and the latest round; do not re-read rows already read in the same round.
- Codegraph Convergence (P2): Precise symbol names + maxFiles limit; prioritize trace/callers for link queries.
- Single Rule Source (P0): Global rules are unified in this document, avoid repeated injection.
八、指令与子 skill 一览
8. Instructions and Sub-skill Overview
| 子 skill | 命令 | 职责 |
|---|---|---|
| | 创建 |
| | 读取 review/test【待整改】问题,staging 先判归属,针对性修复回填,等人工复核 |
| | 确认复核通过后,执行当前阶段任务并实例化所需模板 |
| | 中止:核对留痕后标记并迁移至 history |
| | 归档校验四项齐备后迁移至 history |
| Sub-skill | Command | Responsibility |
|---|---|---|
| | Create |
| | Read [Pending Rectification] issues in review/test, judge attribution first for staging, fix and fill in in a targeted manner, wait for manual review |
| | After confirming review is passed, execute current phase tasks and instantiate required templates |
| | Terminate: After checking traceability, mark and migrate to history |
| | Migrate to history after verifying that four items are complete for archiving |
九、总控路由分派(本 skill 核心动作)
9. Master Control Routing Dispatch (Core Action of This Skill)
1. 判断是否有流程
1. Judge Whether a Process Exists
- 不存在 → 尚无流程,发起
项目根/.gatekeeper/${版本编号}/,停止等人工填 requirement.md。/gatekeeper-init - 存在 → 继续。
- does not exist → No process exists, initiate
Project Root/.gatekeeper/${version number}/, stop and wait for manual filling of requirement.md./gatekeeper-init - Exists → Continue.
2. 定位当前阶段
2. Locate Current Phase
- 只读 ,定位首个未完成阶段行(见六.7);只读
progress.md/review.md检查【待整改】行。test.md - 存在 标记 → 回流
.init-incomplete(补齐缺失文件)。gatekeeper-init
- Only read , locate the first uncompleted phase row (see 6.7); only read
progress.md/review.mdto check [Pending Rectification] rows.test.md - If mark exists → Return to
.init-incomplete(complete missing files).gatekeeper-init
3. 分派子 skill(留痕状态优先,命中即停)
3. Dispatch Sub-skill (Traceability Status Priority, Stop Once Hit)
| 优先级 | 情形 | 分派 |
|---|---|---|
| 1 | review/test 存在【待整改】 | |
| 2 | 阶段1 需求确认未完成 | 无子 skill:提示人工填 requirement.md |
| 3 | 阶段2 概要设计未完成 | |
| 4 | 阶段3 编码+单测未完成 | |
| 5 | 阶段4 dev 测试未完成 | |
| 6 | 阶段5 代码评审未完成 | |
| 7 | 阶段6 提交合并+部署 staging | 无子 skill:人工执行 git(Agent 不执行) |
| 8 | 阶段7 staging 测试未完成 | |
| 9 | 阶段8 收尾且归档条件满足 | |
| 10 | 全部完成 | 提示人工可归档或开新迭代 |
| Priority | Scenario | Dispatch |
|---|---|---|
| 1 | [Pending Rectification] exists in review/test | |
| 2 | Phase 1 Requirement Confirmation not completed | No sub-skill: Prompt manual filling of requirement.md |
| 3 | Phase 2 High-Level Design not completed | |
| 4 | Phase 3 Coding + Unit Testing not completed | |
| 5 | Phase 4 Dev Testing not completed | |
| 6 | Phase 5 Code Review not completed | |
| 7 | Phase 6 Commit Merge + Staging Deployment | No sub-skill: Manual execution of git (Agent does not execute) |
| 8 | Phase 7 Staging Testing not completed | |
| 9 | Phase 8 Finalization and archiving conditions are met | |
| 10 | All completed | Prompt manual personnel to archive or start a new iteration |
4. 输出
4. Output
- 只输出:版本编号、当前阶段、分派子 skill 及原因(一行)、后续人工动作;禁止全表回显留痕文件(见七.1)。
- Only output: Version number, current phase, dispatched sub-skill and reason (one line), subsequent manual actions; prohibit full table display of traceability files (see 7.1).
Pitfalls
Pitfalls
- 本 skill 禁止 Agent 自动使用;检测到无流程目录只能发起 ,不得替人工推进需求。
/gatekeeper-init - 只做分派,不代行子 skill 动作。
- requirement.md / progress.md 由人工维护,Agent 只读不写(见第三节)。
- 版本编号目录已存在且无 时,不回流 init(避免覆盖人工内容)。
.init-incomplete - 一轮 只推进当前阶段(见第五节.1)。
/gatekeeper
- This skill prohibits automatic usage by Agent; if no process directory is detected, only can be initiated, and cannot advance requirements on behalf of manual personnel.
/gatekeeper-init - Only perform dispatch, do not act on behalf of sub-skills.
- requirement.md / progress.md are maintained manually, Agent is read-only (see Section 3).
- If the version number directory exists and there is no , do not return to init (avoid overwriting manual content).
.init-incomplete - One round of only advances the current phase (see 5.1).
/gatekeeper