@xenonbyte/req-2-plan 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +172 -0
- package/README.zh-CN.md +158 -0
- package/bin/r2p.js +38 -0
- package/docs/req-to-plan-design.md +277 -0
- package/package.json +47 -0
- package/requirements.txt +1 -0
- package/tools/r2p +10 -0
- package/tools/r2p-continue +10 -0
- package/tools/r2p-gap-open +10 -0
- package/tools/r2p-gap-resolve +10 -0
- package/tools/r2p-reopen +10 -0
- package/tools/r2p-start +10 -0
- package/tools/r2p-status +10 -0
- package/tools/r2p-switch +10 -0
- package/tools/r2p-tier-lock +10 -0
- package/tools/workflow_cli/__init__.py +0 -0
- package/tools/workflow_cli/__main__.py +5 -0
- package/tools/workflow_cli/agent_shortcuts.py +778 -0
- package/tools/workflow_cli/agent_templates/claude/SKILL.md +34 -0
- package/tools/workflow_cli/agent_templates/claude/commands/r2p-continue.md +16 -0
- package/tools/workflow_cli/agent_templates/claude/commands/r2p-gap-open.md +8 -0
- package/tools/workflow_cli/agent_templates/claude/commands/r2p-gap-resolve.md +8 -0
- package/tools/workflow_cli/agent_templates/claude/commands/r2p-reopen.md +8 -0
- package/tools/workflow_cli/agent_templates/claude/commands/r2p-start.md +10 -0
- package/tools/workflow_cli/agent_templates/claude/commands/r2p-status.md +8 -0
- package/tools/workflow_cli/agent_templates/claude/commands/r2p-switch.md +8 -0
- package/tools/workflow_cli/agent_templates/claude/commands/r2p-tier-lock.md +8 -0
- package/tools/workflow_cli/agent_templates/codex/skills/r2p-continue/SKILL.md +12 -0
- package/tools/workflow_cli/agent_templates/codex/skills/r2p-gap-open/SKILL.md +12 -0
- package/tools/workflow_cli/agent_templates/codex/skills/r2p-gap-resolve/SKILL.md +12 -0
- package/tools/workflow_cli/agent_templates/codex/skills/r2p-reopen/SKILL.md +12 -0
- package/tools/workflow_cli/agent_templates/codex/skills/r2p-start/SKILL.md +14 -0
- package/tools/workflow_cli/agent_templates/codex/skills/r2p-status/SKILL.md +12 -0
- package/tools/workflow_cli/agent_templates/codex/skills/r2p-switch/SKILL.md +12 -0
- package/tools/workflow_cli/agent_templates/codex/skills/r2p-tier-lock/SKILL.md +12 -0
- package/tools/workflow_cli/agent_templates/gemini/commands/r2p-continue.toml +4 -0
- package/tools/workflow_cli/agent_templates/gemini/commands/r2p-gap-open.toml +4 -0
- package/tools/workflow_cli/agent_templates/gemini/commands/r2p-gap-resolve.toml +4 -0
- package/tools/workflow_cli/agent_templates/gemini/commands/r2p-reopen.toml +4 -0
- package/tools/workflow_cli/agent_templates/gemini/commands/r2p-start.toml +4 -0
- package/tools/workflow_cli/agent_templates/gemini/commands/r2p-status.toml +4 -0
- package/tools/workflow_cli/agent_templates/gemini/commands/r2p-switch.toml +4 -0
- package/tools/workflow_cli/agent_templates/gemini/commands/r2p-tier-lock.toml +4 -0
- package/tools/workflow_cli/artifact.py +228 -0
- package/tools/workflow_cli/cli.py +1779 -0
- package/tools/workflow_cli/gates.py +471 -0
- package/tools/workflow_cli/install.py +900 -0
- package/tools/workflow_cli/install_cli.py +158 -0
- package/tools/workflow_cli/link_expander.py +102 -0
- package/tools/workflow_cli/models.py +504 -0
- package/tools/workflow_cli/output.py +91 -0
- package/tools/workflow_cli/repo_baseline.py +137 -0
- package/tools/workflow_cli/state.py +621 -0
- package/tools/workflow_cli/tier.py +201 -0
- package/tools/workflow_cli/tier_keywords.yaml +45 -0
- package/tools/workflow_cli/version.py +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 xenonbyte
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
English | [简体中文](README.zh-CN.md)
|
|
2
|
+
|
|
3
|
+
# req-2-plan
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@xenonbyte/req-2-plan)
|
|
6
|
+
[](https://nodejs.org)
|
|
7
|
+
[](./LICENSE)
|
|
8
|
+
|
|
9
|
+
> Turn a raw requirement into an approved, executor-neutral implementation PLAN — the same staged workflow across Claude Code, Codex, and Gemini.
|
|
10
|
+
|
|
11
|
+
`req-2-plan` installs and manages the `r2p` requirement-to-PLAN workflow for AI
|
|
12
|
+
agent platforms. The workflow is a staged, gated pipeline: a requirement moves
|
|
13
|
+
through **requirement brief → risk discovery → DESIGN → SPEC → PLAN**, and each
|
|
14
|
+
stage must clear a quality gate and a human/main checkpoint before it hands off.
|
|
15
|
+
The result is a plan another agent or engineer can execute without re-deciding
|
|
16
|
+
scope.
|
|
17
|
+
|
|
18
|
+
The npm package is an installer. From one shared source it generates per-platform
|
|
19
|
+
agent skills and commands and installs them into Claude Code, Codex, and Gemini,
|
|
20
|
+
so the workflow behaves identically on all three.
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- **Staged, gated pipeline** — every stage clears a quality gate and a checkpoint before handoff; nothing advances on a guess.
|
|
25
|
+
- **One lifecycle CLI** — `r2p install`, `r2p uninstall`, `r2p status`, `r2p version`, `r2p help`, using only the Python standard library.
|
|
26
|
+
- **Multi-platform from one source** — generates skills for `claude`, `codex`, and `gemini`.
|
|
27
|
+
- **Owned-only, manifest-backed install** — uninstall removes only files `r2p` created; pre-existing user files are backed up and preserved.
|
|
28
|
+
- **Compact agent skills** — eight `r2p-*` wrappers drive the daily loop.
|
|
29
|
+
|
|
30
|
+
## Supported platforms
|
|
31
|
+
|
|
32
|
+
| Platform | Skill format |
|
|
33
|
+
|---|---|
|
|
34
|
+
| `claude` | Command files (`commands/r2p-*.md`) |
|
|
35
|
+
| `codex` | Skill directories (`skills/r2p-*/SKILL.md`) |
|
|
36
|
+
| `gemini` | Command TOML (`commands/r2p-*.toml`) |
|
|
37
|
+
|
|
38
|
+
## Installation
|
|
39
|
+
|
|
40
|
+
Requirements: **Node.js 18+** and **Python 3** (available as `python3` or `python`).
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install -g @xenonbyte/req-2-plan
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Check the lifecycle CLI:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
r2p version
|
|
50
|
+
r2p status
|
|
51
|
+
r2p help
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
> [!NOTE]
|
|
55
|
+
> The lifecycle commands need only the Python standard library, but the daily
|
|
56
|
+
> `r2p-*` skills depend on `pyyaml`. Install it from a checkout with
|
|
57
|
+
> `python3 -m pip install --user -r requirements.txt`, or directly with
|
|
58
|
+
> `python3 -m pip install --user "pyyaml>=6.0"`.
|
|
59
|
+
|
|
60
|
+
`r2p install` writes platform templates into each agent's home directory, shared
|
|
61
|
+
command wrappers under `~/.req-to-plan/bin/`, and a manifest at
|
|
62
|
+
`~/.req-to-plan/install/<platform>.yaml`. The manifest records every managed path
|
|
63
|
+
so uninstall removes only files `r2p` created and restores backups for files that
|
|
64
|
+
existed beforehand.
|
|
65
|
+
|
|
66
|
+
## Usage
|
|
67
|
+
|
|
68
|
+
### Quick start
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
r2p install # install all platforms (default)
|
|
72
|
+
r2p-start "Add rate limiting" # start a workflow run
|
|
73
|
+
r2p-continue # advance it stage by stage
|
|
74
|
+
r2p status # see what is installed
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Lifecycle commands
|
|
78
|
+
|
|
79
|
+
Install all platforms, one platform, or a comma-separated list:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
r2p install
|
|
83
|
+
r2p install --platform claude
|
|
84
|
+
r2p install --platform claude,codex,gemini
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Report install status per platform — installed version, drift (missing files or
|
|
88
|
+
version mismatch), or an invalid manifest. `status` is read-only; add `--json`
|
|
89
|
+
for machine-readable output:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
r2p status
|
|
93
|
+
r2p status --json
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
Uninstall one platform, a list, or all (omit `--platform`):
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
r2p uninstall --platform claude
|
|
100
|
+
r2p uninstall --platform claude,codex,gemini
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
> [!WARNING]
|
|
104
|
+
> `r2p install` overwrites an existing install — no confirmation flag is needed.
|
|
105
|
+
> Pre-existing user files are backed up before any overwrite, and uninstall never
|
|
106
|
+
> deletes a file `r2p` did not create.
|
|
107
|
+
|
|
108
|
+
### Workflow skills
|
|
109
|
+
|
|
110
|
+
After install, the platform skills call these shared `r2p-*` wrappers — one per
|
|
111
|
+
step of running a workflow:
|
|
112
|
+
|
|
113
|
+
| Skill | What it does |
|
|
114
|
+
|---|---|
|
|
115
|
+
| `r2p-start` | Start a new run from a requirement (text, or `--file <path>` to read a document's contents). |
|
|
116
|
+
| `r2p-continue` | Continue the active run — advance it to its next stop (gate, checkpoint, or repair). |
|
|
117
|
+
| `r2p-status` | Inspect the current run, or all runs, read-only. |
|
|
118
|
+
| `r2p-switch` | Point the active run at a different `--work-id`. |
|
|
119
|
+
| `r2p-tier-lock` | Lock the active run's complexity tier (`--base light\|standard`). |
|
|
120
|
+
| `r2p-reopen` | Reopen a closed run from a specific `--stage`. |
|
|
121
|
+
| `r2p-gap-open` | Route an upstream gap on an open run back to its `--owner-stage`; downstream artifacts become stale and must be re-derived. |
|
|
122
|
+
| `r2p-gap-resolve` | Close a gap `--route-id` after the owner stage is re-worked and passes `gate-quality`. |
|
|
123
|
+
|
|
124
|
+
> [!TIP]
|
|
125
|
+
> Add `~/.req-to-plan/bin` to your `PATH` to run the `r2p-*` wrappers directly:
|
|
126
|
+
>
|
|
127
|
+
> ```bash
|
|
128
|
+
> export PATH="$HOME/.req-to-plan/bin:$PATH"
|
|
129
|
+
> ```
|
|
130
|
+
|
|
131
|
+
### When to use which skill
|
|
132
|
+
|
|
133
|
+
Most runs only need `r2p-start`, then repeated `r2p-continue`. The other skills
|
|
134
|
+
cover specific situations.
|
|
135
|
+
|
|
136
|
+
**Lock the tier** — once per run, when `r2p-continue` stops with `tier_not_locked`:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
r2p-tier-lock --work-id <id> --base standard --modifiers migration,safety --confirm
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
`--base standard` raises the rigor floor; the `migration`, `safety`, and
|
|
143
|
+
`cross_project` modifiers force a subagent review at the DESIGN / SPEC / PLAN
|
|
144
|
+
checkpoints.
|
|
145
|
+
|
|
146
|
+
**Reopen a closed run** — revisit a run that was closed at the PLAN checkpoint,
|
|
147
|
+
restarting from an earlier stage (this seeds a new linked run):
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
r2p-reopen --from <closed-id> --stage spec --reason "spec gap found"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**Route an upstream gap** — on an *open* run, when a later stage finds that an
|
|
154
|
+
earlier stage owns a wrong or missing decision. `gap-open` sends the run back to
|
|
155
|
+
the owner stage and marks everything downstream stale; after you re-work the
|
|
156
|
+
owner past `gate-quality`, `gap-resolve` closes the route so the owner can be
|
|
157
|
+
re-approved and the downstream re-derived:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
r2p-gap-open --work-id <id> --owner-stage design --required-action "fixed-window burst flaw"
|
|
161
|
+
# then re-work the owner stage until it passes gate-quality (r2p-continue guides this)
|
|
162
|
+
r2p-gap-resolve --work-id <id> --route-id R-1
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
> [!NOTE]
|
|
166
|
+
> Reopen is for a *closed* run; gap routing is for an *open* one. `r2p-continue`
|
|
167
|
+
> walks you through both repair flows with `needs_repair` and `needs_gap_resolve`
|
|
168
|
+
> stops.
|
|
169
|
+
|
|
170
|
+
## License
|
|
171
|
+
|
|
172
|
+
[MIT](./LICENSE) © xenonbyte
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
[English](README.md) | 简体中文
|
|
2
|
+
|
|
3
|
+
# req-2-plan
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@xenonbyte/req-2-plan)
|
|
6
|
+
[](https://nodejs.org)
|
|
7
|
+
[](./LICENSE)
|
|
8
|
+
|
|
9
|
+
> 把原始需求变成一份获批、执行器中立的实现 PLAN——同一套分阶段工作流,在 Claude Code、Codex、Gemini 上一致运行。
|
|
10
|
+
|
|
11
|
+
`req-2-plan` 为 AI agent 平台安装并管理 `r2p` 需求到 PLAN 的工作流。该工作流是一条
|
|
12
|
+
分阶段、门控的流水线:需求依次经过 **requirement brief → risk discovery → DESIGN →
|
|
13
|
+
SPEC → PLAN**,每个阶段都要先过一道 quality gate 和一个人工/主控 checkpoint 才能交给
|
|
14
|
+
下游。产出是一份另一个 agent 或工程师无需重新决策范围就能执行的计划。
|
|
15
|
+
|
|
16
|
+
这个 npm 包是安装器:它从一份共享源生成各平台的 agent skill 与命令,并安装进
|
|
17
|
+
Claude Code、Codex、Gemini,让工作流在三个平台上表现一致。
|
|
18
|
+
|
|
19
|
+
## Features
|
|
20
|
+
|
|
21
|
+
- **分阶段、门控流水线**——每个阶段交接前都通过一道 quality gate 和一个 checkpoint;不靠猜推进。
|
|
22
|
+
- **单一生命周期 CLI**——`r2p install`、`r2p uninstall`、`r2p status`、`r2p version`、`r2p help`,只依赖 Python 标准库。
|
|
23
|
+
- **一份源、多平台**——为 `claude`、`codex`、`gemini` 生成 skill。
|
|
24
|
+
- **owned-only、manifest 背书的安装**——卸载只删 `r2p` 创建的文件;已存在的用户文件会被备份并保留。
|
|
25
|
+
- **紧凑的 agent 技能**——八个 `r2p-*` wrapper 驱动日常循环。
|
|
26
|
+
|
|
27
|
+
## Supported platforms
|
|
28
|
+
|
|
29
|
+
| 平台 | 技能格式 |
|
|
30
|
+
|---|---|
|
|
31
|
+
| `claude` | 命令文件(`commands/r2p-*.md`) |
|
|
32
|
+
| `codex` | 技能目录(`skills/r2p-*/SKILL.md`) |
|
|
33
|
+
| `gemini` | 命令 TOML(`commands/r2p-*.toml`) |
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
环境要求:**Node.js 18+** 与 **Python 3**(以 `python3` 或 `python` 提供)。
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install -g @xenonbyte/req-2-plan
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
检查生命周期 CLI:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
r2p version
|
|
47
|
+
r2p status
|
|
48
|
+
r2p help
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
> [!NOTE]
|
|
52
|
+
> 生命周期命令只需 Python 标准库,但日常 `r2p-*` 技能依赖 `pyyaml`。在仓库 checkout
|
|
53
|
+
> 内用 `python3 -m pip install --user -r requirements.txt` 安装,或直接
|
|
54
|
+
> `python3 -m pip install --user "pyyaml>=6.0"`。
|
|
55
|
+
|
|
56
|
+
`r2p install` 把各平台模板写入对应 agent 的 home 目录、在 `~/.req-to-plan/bin/` 下写入
|
|
57
|
+
共享命令 wrapper,并生成 `~/.req-to-plan/install/<platform>.yaml` 清单。清单记录每个
|
|
58
|
+
受管路径,因此卸载只移除 `r2p` 创建的文件,并为安装前已存在的文件还原备份。
|
|
59
|
+
|
|
60
|
+
## Usage
|
|
61
|
+
|
|
62
|
+
### Quick start
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
r2p install # 安装全部平台(默认)
|
|
66
|
+
r2p-start "Add rate limiting" # 启动一次工作流
|
|
67
|
+
r2p-continue # 逐阶段推进
|
|
68
|
+
r2p status # 查看已安装情况
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Lifecycle commands
|
|
72
|
+
|
|
73
|
+
安装全部平台、单个平台,或逗号分隔的列表:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
r2p install
|
|
77
|
+
r2p install --platform claude
|
|
78
|
+
r2p install --platform claude,codex,gemini
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
按平台报告安装状态——已装版本、漂移(缺文件或版本不匹配)、或 manifest 无效。`status`
|
|
82
|
+
只读;加 `--json` 得到机器可读输出:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
r2p status
|
|
86
|
+
r2p status --json
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
卸载单个平台、列表,或全部(省略 `--platform`):
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
r2p uninstall --platform claude
|
|
93
|
+
r2p uninstall --platform claude,codex,gemini
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
> [!WARNING]
|
|
97
|
+
> `r2p install` 直接覆盖已有安装——无需确认参数。覆盖前会先备份已存在的用户文件,
|
|
98
|
+
> 而卸载绝不删除非 `r2p` 创建的文件。
|
|
99
|
+
|
|
100
|
+
### Workflow skills
|
|
101
|
+
|
|
102
|
+
安装后,平台 skill 调用这些共享的 `r2p-*` wrapper——运行一次工作流的每一步各一个:
|
|
103
|
+
|
|
104
|
+
| Skill | 作用 |
|
|
105
|
+
|---|---|
|
|
106
|
+
| `r2p-start` | 从需求启动一次新运行(文本,或用 `--file <path>` 读取文档内容)。 |
|
|
107
|
+
| `r2p-continue` | 继续当前运行——推进到下一个停点(gate、checkpoint 或修复)。 |
|
|
108
|
+
| `r2p-status` | 查看当前运行或全部运行,只读。 |
|
|
109
|
+
| `r2p-switch` | 把活动运行指向另一个 `--work-id`。 |
|
|
110
|
+
| `r2p-tier-lock` | 锁定活动运行的复杂度 tier(`--base light\|standard`)。 |
|
|
111
|
+
| `r2p-reopen` | 从指定 `--stage` 重开一个已关闭的运行。 |
|
|
112
|
+
| `r2p-gap-open` | 把 open run 的上游缺口路由回其 `--owner-stage`;下游 artifact 失效、需重新派生。 |
|
|
113
|
+
| `r2p-gap-resolve` | owner 阶段重做并通过 `gate-quality` 后,关闭一个 `--route-id` 缺口路由。 |
|
|
114
|
+
|
|
115
|
+
> [!TIP]
|
|
116
|
+
> 把 `~/.req-to-plan/bin` 加入 `PATH`,即可直接运行 `r2p-*` wrapper:
|
|
117
|
+
>
|
|
118
|
+
> ```bash
|
|
119
|
+
> export PATH="$HOME/.req-to-plan/bin:$PATH"
|
|
120
|
+
> ```
|
|
121
|
+
|
|
122
|
+
### When to use which skill
|
|
123
|
+
|
|
124
|
+
大多数运行只需 `r2p-start`,然后反复 `r2p-continue`。其余技能针对特定情形。
|
|
125
|
+
|
|
126
|
+
**锁定 tier**——每个 run 一次,当 `r2p-continue` 停在 `tier_not_locked` 时:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
r2p-tier-lock --work-id <id> --base standard --modifiers migration,safety --confirm
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
`--base standard` 抬高刚性下限;`migration`、`safety`、`cross_project` 这几个 modifier
|
|
133
|
+
会在 DESIGN / SPEC / PLAN 检查点强制子 agent 审查。
|
|
134
|
+
|
|
135
|
+
**重开已关闭的 run**——回到一个已在 PLAN 检查点关闭的运行,从更早的阶段重新开始
|
|
136
|
+
(会派生一个带血缘的新 run):
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
r2p-reopen --from <closed-id> --stage spec --reason "spec gap found"
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
**回路上游缺口**——在一个**开着的** run 上,当后面的阶段发现更早的阶段拥有一个错误或
|
|
143
|
+
缺失的决策时。`gap-open` 把 run 退回 owner 阶段并把所有下游标记 stale;待你把 owner
|
|
144
|
+
重做到通过 `gate-quality`,`gap-resolve` 关闭路由,让 owner 可被重新批准、下游重新派生:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
r2p-gap-open --work-id <id> --owner-stage design --required-action "fixed-window burst flaw"
|
|
148
|
+
# 然后把 owner 阶段重做到通过 gate-quality(r2p-continue 会引导这步)
|
|
149
|
+
r2p-gap-resolve --work-id <id> --route-id R-1
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
> [!NOTE]
|
|
153
|
+
> reopen 针对**已关闭**的 run;gap 路由针对**开着**的 run。`r2p-continue` 会用
|
|
154
|
+
> `needs_repair` 和 `needs_gap_resolve` 停点带你走完这两种修复流程。
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
[MIT](./LICENSE) © xenonbyte
|
package/bin/r2p.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
|
|
4
|
+
const { spawnSync } = require("node:child_process");
|
|
5
|
+
const path = require("node:path");
|
|
6
|
+
|
|
7
|
+
const repoRoot = path.resolve(__dirname, "..");
|
|
8
|
+
const args = ["-m", "tools.workflow_cli.install_cli", ...process.argv.slice(2)];
|
|
9
|
+
const env = {
|
|
10
|
+
...process.env,
|
|
11
|
+
PYTHONPATH: process.env.PYTHONPATH
|
|
12
|
+
? `${repoRoot}${path.delimiter}${process.env.PYTHONPATH}`
|
|
13
|
+
: repoRoot,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
function runPython(command) {
|
|
17
|
+
return spawnSync(command, args, {
|
|
18
|
+
cwd: repoRoot,
|
|
19
|
+
env,
|
|
20
|
+
stdio: "inherit",
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let result = runPython("python3");
|
|
25
|
+
if (result.error && result.error.code === "ENOENT") {
|
|
26
|
+
result = runPython("python");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (result.error) {
|
|
30
|
+
console.error(`r2p: failed to start Python: ${result.error.message}`);
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (result.signal) {
|
|
35
|
+
process.kill(process.pid, result.signal);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
process.exit(result.status ?? 1);
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
# req-to-plan — 需求与设计文档(项目权威 SSOT)
|
|
2
|
+
|
|
3
|
+
> 本文档是 req-to-plan 的权威入口文档(single-source-of-truth):承载背景、目标、
|
|
4
|
+
> 架构与质量模型。它是 `docs/` 下唯一保留的文档,因此**自包含**——不依赖任何外部
|
|
5
|
+
> 文档。机器事实(exit code、状态、状态转移、tier 表、命令与参数名)的唯一真相在
|
|
6
|
+
> 代码 `tools/workflow_cli/`,本文档只做高层描述、不复述,以免成为漂移源。本文档与
|
|
7
|
+
> 代码在机器事实上冲突时,以**代码为准**,本文档即缺陷。
|
|
8
|
+
>
|
|
9
|
+
> **可执行性边界**:本文档里的"强制"首先是产品/流程规则;其中由 CLI 机械检查的子集见
|
|
10
|
+
> §5.5。尚未机械化的语义规则必须由 agent 生成、子 agent 审查和人工/主控检查点执行。
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 0. 本文档的范围
|
|
15
|
+
|
|
16
|
+
**本文档负责**:问题陈述、目标与质量底线、端到端架构、跨阶段质量模型。
|
|
17
|
+
|
|
18
|
+
**本文档不负责(也不复述)**:
|
|
19
|
+
|
|
20
|
+
- 机器事实——exit code、状态、`ALLOWED_TRANSITIONS`、tier 表、命令与参数名。它们由
|
|
21
|
+
代码 `tools/workflow_cli/` 定义,本文档只引用模块名、不抄写其值。
|
|
22
|
+
- 载体语法——具体 CLI 参数、`r2p-*` agent 快捷命令、安装细节。它们以代码与
|
|
23
|
+
`--help` 为准。
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 1. 背景
|
|
28
|
+
|
|
29
|
+
### 1.1 问题
|
|
30
|
+
|
|
31
|
+
把一个原始需求变成"工程师或 agent 不必重新决策范围就能执行"的东西,是绝大多数"AI 把
|
|
32
|
+
东西做错"的根源。失败几乎不在编码环节,而在上游,且反复呈现四种形态:
|
|
33
|
+
|
|
34
|
+
1. **范围漂移**——做出来的不是被要求的,因为设计开始前范围从未被冻结。
|
|
35
|
+
2. **歧义下推**——一个未决问题(用哪个方案?契约是什么?)被悄悄交给离决策权最远的
|
|
36
|
+
人解决,通常是实现者在猜。
|
|
37
|
+
3. **空心规格**——一份*看起来*完整(段落齐全)但实质为空的计划:不可测的"契约"、
|
|
38
|
+
套话式的否决理由、把目标复述一遍的验收标准。
|
|
39
|
+
4. **仍在做决策的计划**——一份"计划"里还留着未决的设计选择,执行时不得不重开设计。
|
|
40
|
+
|
|
41
|
+
单遍 prompting("给我写个 X 的计划")把这四种失败压进同一遍、没有任何检查点,于是
|
|
42
|
+
一个都抓不住。
|
|
43
|
+
|
|
44
|
+
### 1.2 方法
|
|
45
|
+
|
|
46
|
+
req-to-plan 用**分阶段、门控的流水线**替代单遍:每个阶段只拥有一种权威、不能行使别的
|
|
47
|
+
阶段的权威,且必须通过一道可证伪的质量门、再由人工/主控检查点冻结,才能交给下游:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
原始需求
|
|
51
|
+
-> 需求简报 Requirement Brief (拥有:做什么、范围、验收)
|
|
52
|
+
-> 风险与问题发现 Risk & Question Discovery (拥有:阻塞项、假设、风险、输入)
|
|
53
|
+
-> 设计 DESIGN (拥有:唯一方案 + 理由 + 边界)
|
|
54
|
+
-> 规格 SPEC (拥有:可测的行为契约)
|
|
55
|
+
-> 计划 PLAN (拥有:执行器中立的任务、排序、回滚)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 1.3 在生态中的定位
|
|
59
|
+
|
|
60
|
+
这条流水线属于**规格驱动开发(spec-driven development)**家族(GitHub spec-kit 的
|
|
61
|
+
specify→plan→tasks;AWS Kiro 的 requirements→design→tasks)中加固的一员。相比该家族
|
|
62
|
+
额外加了:
|
|
63
|
+
|
|
64
|
+
- **Stage-Gate 纪律**——每次交接有一道质量门(进入/退出标准)加一个人工/主控检查点。
|
|
65
|
+
- **双向可追溯**——每个下游条目都导入一个稳定的上游 ID 并必须闭合它
|
|
66
|
+
(闭合标记或路由;具体闭合取值以代码为准),从而需求可追到任务、也可反追。
|
|
67
|
+
- **变更影响路由**——下游阶段发现上游缺了某个决策时,往回路由给拥有它的阶段而不是
|
|
68
|
+
自己猜(上游缺口路由;具体状态名以代码 `RunStatus` 为准),并伴随失效标记(`stale`)级联
|
|
69
|
+
(这是设计原则;当前 CLI 操作面的实现边界见 §6)。
|
|
70
|
+
- **Agent/CLI 分离**——CLI 管状态、校验结构;Agent 生成语义内容。CLI 从不写 artifact
|
|
71
|
+
正文。
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## 2. 目标与非目标
|
|
76
|
+
|
|
77
|
+
### 2.1 目标
|
|
78
|
+
|
|
79
|
+
- **G1 — 设计前冻结范围。** 需求简报检查点批准前不开始设计;DESIGN 不得重定义需求。
|
|
80
|
+
- **G2 — 权威本地且不可转移。** PLAN 不发明契约;SPEC 不发明设计;DESIGN 不重定义
|
|
81
|
+
需求;风险发现把阻塞项路由给其拥有者而不是自己解决。
|
|
82
|
+
- **G3 — 每个 artifact 可证伪。** 每条承重断言都带一个能证明它错的东西(可测条件、
|
|
83
|
+
反例、决策的失效条件)。见 §5。
|
|
84
|
+
- **G4 — 评审稳定地找缺陷,而不是只查缺段落。** 检查点评审按利益相关者视角、配每阶段
|
|
85
|
+
缺陷分类来读,从而抓住*空心达标*(段落在但是空的),而不是橡皮图章。
|
|
86
|
+
- **G5 — 完整可追溯。** 检查点批准前,每个导入的上游 ID 都有且仅有一个下游闭合状态。
|
|
87
|
+
- **G6 — 投入随复杂度伸缩。** 复杂度 tier 设定刚性下限;小任务用轻量 artifact,但
|
|
88
|
+
绝不跳过 DESIGN。
|
|
89
|
+
- **G7 — 执行器与平台中立的产物。** PLAN 可被另一个 agent 或工程师在 claude / codex /
|
|
90
|
+
gemini 上直接执行,无需重新决策方向。
|
|
91
|
+
|
|
92
|
+
### 2.2 质量底线(可度量的退出条件)
|
|
93
|
+
|
|
94
|
+
一个阶段 artifact 只有在满足以下条件时才算*完成*:
|
|
95
|
+
|
|
96
|
+
- 每条契约 / 决策 / 任务都**具体且可测**(评审者能说出"什么观察会证伪它");
|
|
97
|
+
- 每个导入的上游 ID 都有显式**闭合**状态;
|
|
98
|
+
- 每个选定决策都记录其**被否决的备选项,以及该决策应被重新考虑的条件**(不只是"它为何
|
|
99
|
+
好");
|
|
100
|
+
- 没有任何段落是**空心**的——段落在但内容套话,与缺段落一样判定为不合格。
|
|
101
|
+
|
|
102
|
+
### 2.3 非目标
|
|
103
|
+
|
|
104
|
+
- **不是执行器。** req-to-plan 止步于一份获批的 PLAN,不写应用代码。
|
|
105
|
+
- **不绑定实现栈。** PLAN 执行器中立。
|
|
106
|
+
- **不自动批准。** 子 agent 产出证据与建议;冻结 artifact 必须由人工/主控检查点裁决。
|
|
107
|
+
- **不是通用文档工具。** 它只治理*本工作流*的 artifact。
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## 3. 核心概念
|
|
112
|
+
|
|
113
|
+
下表只作定位。**具体取值(状态串、tier 名、命令/参数名)一律以右列代码为准,本文档
|
|
114
|
+
不复述**——这是 §0 的纪律。
|
|
115
|
+
|
|
116
|
+
| 概念 | 一句话含义 | 代码归属(取值的唯一真相) |
|
|
117
|
+
|---|---|---|
|
|
118
|
+
| Work-id / run | 一个需求的工作流实例(id 形如 `WF-<日期>-<slug>`) | `models.py`, `state.py` |
|
|
119
|
+
| Artifact | 带 YAML frontmatter、按阶段顺序编号的阶段产物文件 | `artifact.py` |
|
|
120
|
+
| Stage | 工作流阶段枚举;包含入口 `raw_requirement`、五个规划阶段和关闭哨兵 | `models.py`(`Stage`) |
|
|
121
|
+
| Run 状态 | run 生命周期状态机;取值与合法转移以代码为准 | `models.py`(`RunStatus`, `ALLOWED_TRANSITIONS`) |
|
|
122
|
+
| Artifact 状态 | 单个 artifact 的状态字段,与 run 状态是**两套不同取值** | `artifact.py` |
|
|
123
|
+
| Quality Gate | 阶段退出标准;CLI 机械检查结构子集,语义标准由检查点评审执行 | `gates.py`;语义标准见 §5 + 检查点评审 |
|
|
124
|
+
| Checkpoint | 人工/主控冻结决策;唯一能批准(approve)的环节 | `state.py` |
|
|
125
|
+
| Tier | 复杂度下限,决定所需刚性;档位取值与估算以代码为准 | `tier.py`(`TierBase`), `tier_keywords.yaml` |
|
|
126
|
+
| 追溯链 | `Risk Plan Input → DESIGN Plan Input → SPEC-PLAN-* → PLAN item`,逐级闭合 | `models.py`, `state.py` |
|
|
127
|
+
| 失效标记 | 下游导入了已变更上游输入时打的标记(如 `stale`) | `artifact.py` |
|
|
128
|
+
|
|
129
|
+
**不可协商项**(使 G2 可执行的权威边界):
|
|
130
|
+
|
|
131
|
+
- 需求简报不选设计。
|
|
132
|
+
- DESIGN 不重定义需求。
|
|
133
|
+
- SPEC 不发明缺失的设计决策。
|
|
134
|
+
- PLAN 不发明缺失的契约、不选执行器特定格式。
|
|
135
|
+
- 子 agent 产出证据,不产出检查点批准。
|
|
136
|
+
- 上游修复后,被修阶段必须重新通过其 Quality Gate 与 Checkpoint,下游 artifact 才能
|
|
137
|
+
再次被批准。
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## 4. 流水线
|
|
142
|
+
|
|
143
|
+
除入口摄取外,每个规划阶段都是:**进入门 → 工作步骤 → Quality Gate → 检查点评审 →
|
|
144
|
+
人工/主控检查点**。子 agent 审查在带代码定义的高风险 modifier 的 DESIGN / SPEC / PLAN
|
|
145
|
+
上是强制要求,也是普通阶段的推荐审查方式;具体 modifier 取值与匹配规则以
|
|
146
|
+
`tools/workflow_cli/` 为准。最终批准仍只能由人工/主控检查点完成。下表给各阶段的本质
|
|
147
|
+
(权威/禁区/产物)。
|
|
148
|
+
|
|
149
|
+
> **注意(诚实声明):各阶段逐步执行的方法论——如何具体产出每种 artifact、各门的检查
|
|
150
|
+
> 清单与模板——当前不在本仓库内。** 它随旧 `*-workflow.md` 文档一并移除,仅存于 git
|
|
151
|
+
> 历史。本文档只确立权威边界与质量底线(§2、§5),不是逐步操作手册;CLI 代码做的是
|
|
152
|
+
> 状态管理与结构校验,也不含语义方法论。需要逐步细节时,从 git 历史取回相应
|
|
153
|
+
> `*-workflow.md` 并入本文档或另存,不要假设它能"运行时凭空生成"。现有 agent 模板只负责
|
|
154
|
+
> 驱动 `r2p-*` 停点和命令,不提供完整 artifact 写作方法论。
|
|
155
|
+
|
|
156
|
+
| 阶段 | 拥有的权威 | 不得做 | 关键产物 |
|
|
157
|
+
|---|---|---|---|
|
|
158
|
+
| **原始需求** | 捕获用户原始输入、生成 run 与 tier 初估证据 | 改写需求含义、补全范围 | `00-raw-requirement.md`、`01-intake-brief.md` |
|
|
159
|
+
| **需求简报** | 目标、范围、非范围、验收、来源出处 | 选方案 | 稳定简报、范围清单、验收标准 |
|
|
160
|
+
| **风险与问题发现** | 阻塞项、假设、风险、讨论点、下游输入 | 解决不属于自己的阻塞项 | 风险清单、设计触发器、spec/plan 输入 |
|
|
161
|
+
| **DESIGN** | 唯一方案 + 理由、边界、迁移、回滚、变更点 | 重定义需求 | Option Analysis(推荐/最小/被否决)、变更点清单、Spec/Plan 输入 |
|
|
162
|
+
| **SPEC** | 从 DESIGN 派生的可测行为契约 | 发明缺失的设计 | 契约(具体/可测/可追溯)、验收场景、`SPEC-PLAN-*` |
|
|
163
|
+
| **PLAN** | 执行器中立的任务、排序、验证、回滚、停止条件 | 发明契约、选执行器格式 | `PLAN-TASK-*`、契约到任务映射、回滚/安全计划 |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## 5. 质量模型(强制门控标准与执行边界)
|
|
168
|
+
|
|
169
|
+
各门已经把*结构*管得很好;残余风险是**空心达标**——一份 artifact 通过了每一道结构门,
|
|
170
|
+
实质却是空的。LLM 生成尤其易犯此病:它擅长把模板填得令人信服。质量模型是同时加固生成
|
|
171
|
+
与评审、对抗空心的唯一杠杆,**以下各项是阶段完成的强制退出条件——不满足即判不合格,
|
|
172
|
+
等同于缺段落,不再作为"建议"**。其中可被 CLI 机械检查的项目见 §5.5;其余项目必须在
|
|
173
|
+
生成、子 agent 审查和检查点批准时执行。
|
|
174
|
+
|
|
175
|
+
> **让每条承重断言可证伪,然后按"找反例"而非"查齐全"来评审。**
|
|
176
|
+
|
|
177
|
+
### 5.1 生成——强制对比式、可证伪内容(门控)
|
|
178
|
+
|
|
179
|
+
只要断言("推荐方案:X")就会招来套话。质量住在对比与翻转条件里。每条承重断言必须带一个
|
|
180
|
+
**falsifier**:能证明它错的观察。门控要求:
|
|
181
|
+
|
|
182
|
+
- **DESIGN**——对每个选定决策做 pre-mortem:「什么条件会让我们退回某个被否决方案?」
|
|
183
|
+
- **SPEC**——每条契约必须带**一个通过示例 + 一个违反示例**(Specification by Example)。
|
|
184
|
+
- **PLAN**——每个任务的验证步骤必须写明「什么结果算失败」。
|
|
185
|
+
|
|
186
|
+
falsifier 字段天然抗套话:`收益:提升性能` 可以随便写;`失效于:突发请求超过限额 2 倍时,
|
|
187
|
+
因固定窗口在突发中途重置而被放行` 写不出来就说明没想清楚。**缺 falsifier = 门不过。**
|
|
188
|
+
|
|
189
|
+
### 5.2 评审——用 Perspective-Based Reading(多视角)替代单遍通读(门控)
|
|
190
|
+
|
|
191
|
+
不再"派一个子 agent 评审 SPEC",而是派**多个视角子 agent**,各自从一个利益相关者视角、
|
|
192
|
+
带固定问题集(= 每阶段缺陷分类)读同一份 artifact。这是需求/设计评审中实证最强的技术。
|
|
193
|
+
|
|
194
|
+
下列是几个**代表性原型视角**,用于示范问题集与审查身份;它们不穷尽——§5.4 可按阶段特化
|
|
195
|
+
或扩充专门视角(如 SRE、迁移/回滚、成本对手、执行 agent)。每个阶段实际必须覆盖的最小
|
|
196
|
+
视角以 §5.4 的阶段化表为准:§5.4 是强制规则,本节只提供视角的通用语义示范。一个 reviewer
|
|
197
|
+
可以覆盖多个视角,但审查记录必须分别回答被覆盖视角的问题。缺少 §5.4 要求的阶段视角时,
|
|
198
|
+
该检查点评审不构成有效评审:
|
|
199
|
+
|
|
200
|
+
- **测试者**——"我能不能为每条契约写出一个会失败的测试?哪条不可测?"
|
|
201
|
+
- **实现者**——"哪里欠规格到无法直接动手?哪里还藏着未解的设计选择?"
|
|
202
|
+
- **对手/操作者**——"什么输入打穿它?哪条破坏性路径没有 guard?"
|
|
203
|
+
- **追溯审计**——"每个导入 ID 的闭合是*真覆盖*还是空心?"
|
|
204
|
+
|
|
205
|
+
### 5.3 修复——分级、局部、原视角复检(门控)
|
|
206
|
+
|
|
207
|
+
- 评审发现项必须带 **severity**(blocker / major / minor);minor 不阻断检查点,但
|
|
208
|
+
blocker / major 未闭合不得批准。
|
|
209
|
+
- 一次修复只重验**受影响的导入条目**(用闭合 ID 圈定影响半径),不整篇重读。
|
|
210
|
+
- **发现缺陷的那个视角复检其修复**,杜绝改一处、坏一处的评审循环。
|
|
211
|
+
|
|
212
|
+
### 5.4 各阶段强制门控项
|
|
213
|
+
|
|
214
|
+
本表是检查点评审的阶段化最低要求;它替代"每阶段固定同一组 reviewer"的理解。若代码或
|
|
215
|
+
运行配置对某阶段增加高风险审查要求,新增要求与本表叠加。
|
|
216
|
+
|
|
217
|
+
| 阶段 | 生成必带的 falsifier | 必覆盖的评审视角 | 要判为不合格的空心缺陷 |
|
|
218
|
+
|---|---|---|---|
|
|
219
|
+
| 需求简报 | 每条验收:证明其未达成的*可观测*结果 | 用户/操作者 + 测试者 | 验收不可观测;把目标复述当验收 |
|
|
220
|
+
| 风险发现 | 每个风险:触发输入/条件 + 不处理的最坏结果 | 对手 + SRE | 风险无触发条件;风险未路由到拥有者 |
|
|
221
|
+
| DESIGN | 每个决策:应退回某被否决方案的条件 | 实现者 + 迁移/回滚 + 成本对手 | 套话式否决理由;最小方案形同虚设 |
|
|
222
|
+
| SPEC | 每条契约:一个通过示例 + 一个违反示例 | 测试者(写不出失败测试=不可测)+ 实现者 | 标"可测"却写不出测试;场景复述需求 |
|
|
223
|
+
| PLAN | 每个任务验证:什么结果算失败 | 执行 agent + 回滚 + 追溯审计 | 任务藏隐含决策;验证不可判定;闭合对不上 |
|
|
224
|
+
|
|
225
|
+
### 5.5 当前实现覆盖与缺口
|
|
226
|
+
|
|
227
|
+
当前 `tools/workflow_cli/` 已经机械执行的检查子集如下;其中一部分属于 Quality Gate,另有
|
|
228
|
+
检查点批准前置的独立检查。具体 exit code、字段名、锚点格式、modifier 取值和命令参数以
|
|
229
|
+
代码与 `--help` 为准,本文档只记录实现覆盖范围:
|
|
230
|
+
|
|
231
|
+
- tier 必须先锁定;
|
|
232
|
+
- artifact 正文不能为空;
|
|
233
|
+
- 被引用的上游 ID 必须带显式闭合标记;
|
|
234
|
+
- artifact 内定义的 ID 不能重复;
|
|
235
|
+
- SPEC 必须包含非空、非占位的外部文档检查清单,或显式说明没有外部依赖;
|
|
236
|
+
- 达到代码定义任务锚点要求的 PLAN 必须包含任务锚点;启用 TDD 骨架要求的任务必须提供带非空
|
|
237
|
+
信息标记且正文非空的 `Skeleton` 代码块;
|
|
238
|
+
- 命中代码定义高风险 modifier 的 DESIGN / SPEC / PLAN,在检查点批准前必须存在版本匹配的
|
|
239
|
+
subagent review 文件;文件是否确由只读 reviewer 生成、内容是否有效,仍由 agent / 主控语义审查确认。
|
|
240
|
+
|
|
241
|
+
当前尚未由 CLI 机械证明、但仍是检查点批准前的强制语义要求:
|
|
242
|
+
|
|
243
|
+
- falsifier / pre-mortem / 通过与违反示例是否真实有效;
|
|
244
|
+
- 多视角审查是否覆盖 §5.2 的视角,以及审查发现是否按 severity 闭合;
|
|
245
|
+
- subagent review 文件是否来自隔离只读审查,以及是否覆盖对应阶段的必要视角;
|
|
246
|
+
- `DEFERRED`、`N/A`、`OUT-OF-SCOPE` 等闭合是否合理,而不是绕过追溯;
|
|
247
|
+
- PLAN 是否真正执行器中立、没有隐藏设计选择;
|
|
248
|
+
- 下游重新派生是否完整反映了上游修复。
|
|
249
|
+
|
|
250
|
+
因此,当前可行的落地方式是:CLI 阻断结构性缺陷,agent 负责生成语义内容,子 agent /
|
|
251
|
+
人工/主控检查点按 §5.1-§5.4 阻断空心达标。若希望这些语义标准也自动化,需要在
|
|
252
|
+
`gates.py` 或独立审查器中新增可测试规则,并为对应 fixture 添加回归测试。
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## 6. 变更传播
|
|
257
|
+
|
|
258
|
+
下游阶段绝不悄悄修补已批准的上游 artifact:发现上游缺口时,应把缺口交还给拥有该决策的
|
|
259
|
+
阶段;拥有阶段修复并重新通过其 Quality Gate + Checkpoint;受影响的下游导入项应失效并重新
|
|
260
|
+
派生(若 ID 无法干净 remap 则整篇重建)后再重新过门。
|
|
261
|
+
|
|
262
|
+
**当前实现边界**:上游缺口路由的状态模型(`RunStatus.UPSTREAM_GAP_ROUTING`、`OpenRoute`、
|
|
263
|
+
`StaleArtifact` 及相关 state helper)现已通过 operator 操作面暴露。未关闭的 run 用 `gap-open`
|
|
264
|
+
把缺口路由回 owner 阶段——下游 artifact 被标记失效、其已批准 checkpoint 失效、run 退回 owner
|
|
265
|
+
的重做态;owner 重做并通过 `gate-quality` 后用 `gap-resolve` 闭合路由,再经常规
|
|
266
|
+
review/approve/advance 重新派生下游。二者也暴露为 `r2p-gap-open` / `r2p-gap-resolve` shortcut。
|
|
267
|
+
已在 PLAN 检查点关闭的 run 仍用 `run-reopen` 重开。路由与失效进度在 `status-run`
|
|
268
|
+
(`open_routes_detail` / `stale_artifacts` / `outstanding_stale`)与 `status-next` 可见。
|
|
269
|
+
**具体命令语法、状态名与合法转移集合一律以代码和 `--help` 为准。**
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## 约定
|
|
274
|
+
|
|
275
|
+
- 本文档语言:简体中文。
|
|
276
|
+
- §5 质量模型为**强制门控标准**,非建议。
|
|
277
|
+
- 机器事实唯一真相在 `tools/workflow_cli/`;本文档只做高层描述。
|