@double-codeing/flow2spec 3.0.14 → 3.0.16
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.en.md +15 -15
- package/README.md +15 -15
- package/cli.js +2 -2
- package/docs/.mermaid-cache.json +49 -0
- package/docs/.sync-mapping.json +59 -0
- package/docs/en/README.md +12 -0
- package/docs/{architecture.en.md → en/architecture.md} +57 -20
- package/docs/{commands-reference.en.md → en/commands-reference.md} +15 -17
- package/docs/{design-principles.en.md → en/design-principles.md} +26 -7
- package/docs/{directory-conventions.en.md → en/directory-conventions.md} +16 -13
- package/docs/{usage-guide.en.md → en/usage-guide.md} +28 -36
- package/docs/{usage-scenarios.en.md → en/usage-scenarios.md} +8 -34
- package/docs/{README- → }/344/275/223/347/263/273/344/270/216/345/216/237/347/220/206.md +60 -19
- package/docs/{Flow2Spec- → }/344/275/277/347/224/250/346/241/210/344/276/213-/346/250/241/346/213/237/345/257/271/350/257/235.md +9 -33
- package/docs//344/275/277/347/224/250/350/257/264/346/230/216.md +162 -0
- package/docs/{README- → }/345/221/275/344/273/244/350/257/264/346/230/216.md +16 -16
- package/docs/{README- → }/347/233/256/345/275/225/344/270/216/350/267/257/345/276/204/347/272/246/345/256/232.md +17 -12
- package/docs/{Flow2Spec- → }/350/256/276/350/256/241/350/257/264/346/230/216.md +69 -6
- package/package.json +1 -1
- package/templates/knowledge/template//345/220/216/347/253/257/346/212/200/346/234/257/346/250/241/347/211/210.md +1 -1
- package/templates/knowledge/template//347/273/210/347/250/277/346/250/241/347/211/210.md +1 -2
- package/templates/knowledge/template//351/241/271/347/233/256/351/207/214/347/250/213/347/242/221/346/250/241/347/211/210.md +1 -1
- package/templates/knowledge/topics/f2s-req-plan.md +1 -1
- package/templates/knowledge/topics/f2s-task.md +1 -1
- package/templates/rules/f2s-flow2spec-unified-entry.mdc +1 -0
- package/templates/rules/f2s-stock-docs-vs-req-docs.mdc +1 -1
- package/templates/rules/f2s-task.mdc +5 -5
- package/templates/skills/f2s-ctx-build/SKILL.md +5 -3
- package/templates/skills/f2s-ctx-rm/SKILL.md +1 -1
- package/templates/skills/f2s-doc-add/SKILL.md +1 -1
- package/templates/skills/f2s-doc-arch/SKILL.md +16 -3
- package/templates/skills/f2s-doc-milestone/SKILL.md +1 -1
- package/templates/skills/f2s-git-commit/SKILL.md +1 -1
- package/templates/skills/f2s-kb-fix/SKILL.md +1 -1
- package/templates/skills/f2s-kb-sync/SKILL.md +1 -1
- package/templates/skills/stock-docs-vs-req-docs/SKILL.md +1 -1
- package/docs/Flow2Spec/344/275/277/347/224/250/350/257/264/346/230/216.md +0 -163
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[中文](
|
|
1
|
+
[中文](../使用说明.md) | [English](./usage-guide.md)
|
|
2
2
|
|
|
3
3
|
# Flow2Spec Usage Guide
|
|
4
4
|
|
|
@@ -32,7 +32,7 @@ Before executing any **`f2s-*` skill**, the Agent needs to obtain the actual val
|
|
|
32
32
|
| **Codex** | `.codex/AGENTS.md` top-level mandatory step + `{{FLOW2SPEC_PROJECT_CONFIG}}` expansion table | **Read** is a hard requirement; the config table is a **snapshot from the last `flow2spec init`** — when it differs from disk, **Read** takes precedence. The adjacent **`.codex/topics/f2s-config-check.md`** shares its origin with the Cursor rule (including the **changeTracking** detail table); open it **as needed** — it does not need to be grouped with the three "topic long-form" examples as required reading. |
|
|
33
33
|
| **Knowledge Base (optional)** | When `.Knowledge/manifest-routing` hits **`config-precheck`** | `.Knowledge/topics/f2s-config-precheck.md` is a **routing summary** that links to the Codex long-form article; Flow2Spec does **not** maintain a second full copy in `.Knowledge`, nor does it replace a `Read` of the JSON. |
|
|
34
34
|
|
|
35
|
-
For field semantics and default value rules, see [Commands Reference § 6) Sub-Agent Configuration](./commands-reference.
|
|
35
|
+
For field semantics and default value rules, see [Commands Reference § 6) Sub-Agent Configuration](./commands-reference.md). For the design perspective, see [Design Principles § 4.5.1](./design-principles.md).
|
|
36
36
|
|
|
37
37
|
---
|
|
38
38
|
|
|
@@ -40,38 +40,38 @@ For field semantics and default value rules, see [Commands Reference § 6) Sub-A
|
|
|
40
40
|
|
|
41
41
|
Core distinction: `stock-docs/` holds solidified documents (driving knowledge routing), `req-docs/` holds technical designs (driving coding implementation); they are not interchangeable.
|
|
42
42
|
|
|
43
|
-
See [Directory Conventions](./directory-conventions.
|
|
43
|
+
See [Directory Conventions](./directory-conventions.md) for the full directory description.
|
|
44
44
|
|
|
45
45
|
---
|
|
46
46
|
|
|
47
47
|
## 3. Typical Workflows
|
|
48
48
|
|
|
49
|
-
###
|
|
49
|
+
### Change Tracking and Cross-Session Continuation (Recommended)
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
f2s-req-plan
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Provide a path to the technical design document or a requirements description. A draft task checklist is produced first and awaits confirmation. After confirmation, implementation proceeds according to the checklist. A `.task/` task checklist is always created — no `changeTracking` configuration is needed. Suitable for scenarios where you want to see the full picture before starting, or need cross-session progress tracking.
|
|
51
|
+
Enable `changeTracking` per skill in `flow2spec.config.json` (each sub-field is independent):
|
|
56
52
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"changeTracking": {
|
|
56
|
+
"feat": true,
|
|
57
|
+
"fix": true,
|
|
58
|
+
"implement": true
|
|
59
|
+
}
|
|
60
|
+
}
|
|
65
61
|
```
|
|
66
62
|
|
|
67
|
-
|
|
63
|
+
When enabled, `f2s-kb-feat` / `f2s-kb-fix` / `f2s-implement-tech-design` automatically create a checklist under `.task/active/`, check off steps, and archive on completion. In later sessions, the `f2s-task` rule matches related wording and resumes the remaining steps — no need to re-explain context.
|
|
68
64
|
|
|
69
|
-
|
|
65
|
+
If **`changeTracking` is off** but you still need a `.task/` checklist temporarily, call `f2s-req-plan` explicitly (always creates a checklist, ignores config) — a **fallback**, not the default path. See [Commands Reference § f2s-req-plan](./commands-reference.md).
|
|
70
66
|
|
|
71
67
|
### New Feature Development
|
|
72
68
|
|
|
73
69
|
```
|
|
74
|
-
f2s-req-clarify → f2s-req-backend → implement-tech-design
|
|
70
|
+
f2s-req-clarify (one-line requirement or doc) → f2s-req-backend → implement <technical design> (strictly follows implement-tech-design rule)
|
|
71
|
+
After implementation, new capability → f2s-kb-feat
|
|
72
|
+
After implementation, bug fix → f2s-kb-fix
|
|
73
|
+
After debugging → f2s-kb-sync
|
|
74
|
+
Finally → f2s-git-commit
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
When requirements are already clear, `f2s-req-clarify` can be skipped, starting directly from `f2s-req-backend`. After the technical design is written into `req-docs/`, the `implement-tech-design` rule drives coding.
|
|
@@ -80,18 +80,10 @@ When requirements are already clear, `f2s-req-clarify` can be skipped, starting
|
|
|
80
80
|
|
|
81
81
|
```
|
|
82
82
|
New architecture document ingestion: f2s-doc-arch → f2s-doc-final → f2s-ctx-build
|
|
83
|
-
PDF
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
Integrate architecture descriptions or PDF technical designs into the knowledge routing (generates topics/matchers/manifest-routing).
|
|
87
|
-
|
|
88
|
-
### PDF-Based Implementation
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
f2s-doc-pdf → implement-tech-design
|
|
83
|
+
PDF/draft ingestion: f2s-doc-final → f2s-ctx-build
|
|
92
84
|
```
|
|
93
85
|
|
|
94
|
-
|
|
86
|
+
Integrate architecture descriptions or PDF final drafts into knowledge routing (generates topics/matchers/manifest-routing). To ingest a PDF into the knowledge base, use `f2s-doc-final` then `f2s-ctx-build`. `f2s-doc-pdf` only converts a PDF to Markdown under `req-docs/` for editing; it is **not** the recommended path for "PDF straight to coding."
|
|
95
87
|
|
|
96
88
|
### Backfilling Existing Capabilities
|
|
97
89
|
|
|
@@ -122,7 +114,7 @@ f2s-kb-upgrade (Current V2+: already has .Knowledge; includes npm v3.x projects,
|
|
|
122
114
|
|
|
123
115
|
## 4. Agent Execution Configuration
|
|
124
116
|
|
|
125
|
-
Controlled via the project root `flow2spec.config.json`. For complete field rules, see [Commands Reference § 6) Sub-Agent Configuration](./commands-reference.
|
|
117
|
+
Controlled via the project root `flow2spec.config.json`. For complete field rules, see [Commands Reference § 6) Sub-Agent Configuration](./commands-reference.md). **How each client is reminded to read the config, and why `Read` remains authoritative** — see **§ 1** (this § only explains **when** to toggle each switch).
|
|
126
118
|
|
|
127
119
|
**When to enable `subAgent: true`**: When the task is large (multi-module parallel implementation, batch document ingestion, large-scale migration). When enabled, each skill decides whether to actually split based on its own size threshold; tasks below the threshold are still completed within the main agent.
|
|
128
120
|
|
|
@@ -140,7 +132,7 @@ Controlled via the project root `flow2spec.config.json`. For complete field rule
|
|
|
140
132
|
}
|
|
141
133
|
```
|
|
142
134
|
|
|
143
|
-
|
|
135
|
+
Use `f2s-req-plan` only when all `changeTracking` sub-fields are off and you still need a checklist (see § 3 footnote).
|
|
144
136
|
|
|
145
137
|
---
|
|
146
138
|
|
|
@@ -159,7 +151,7 @@ Skills are triggered by matching `name` and `description`. Files are located und
|
|
|
159
151
|
|
|
160
152
|
## 7. Related Documents
|
|
161
153
|
|
|
162
|
-
- [Commands Reference](./commands-reference.
|
|
163
|
-
- [Directory Conventions](./directory-conventions.
|
|
164
|
-
- [Architecture](./architecture.
|
|
165
|
-
- [Usage Scenarios](./usage-scenarios.
|
|
154
|
+
- [Commands Reference](./commands-reference.md)
|
|
155
|
+
- [Directory Conventions](./directory-conventions.md)
|
|
156
|
+
- [Architecture](./architecture.md)
|
|
157
|
+
- [Usage Scenarios](./usage-scenarios.md)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[中文](
|
|
1
|
+
[中文](../使用案例-模拟对话.md) | [English](./usage-scenarios.md)
|
|
2
2
|
|
|
3
3
|
# Flow2Spec Usage Scenarios (Simulated Dialogues)
|
|
4
4
|
|
|
@@ -123,33 +123,7 @@ The following examples revolve around the same e-commerce project, covering the
|
|
|
123
123
|
|
|
124
124
|
---
|
|
125
125
|
|
|
126
|
-
## Scenario 4:
|
|
127
|
-
|
|
128
|
-
**You**
|
|
129
|
-
|
|
130
|
-
> /f2s-doc-pdf /Users/me/Downloads/marketing-coupon-v2.pdf
|
|
131
|
-
|
|
132
|
-
**Agent**
|
|
133
|
-
|
|
134
|
-
> Converted and saved as `.Knowledge/req-docs/marketing-coupon-v2.md`. Filled in the idempotency handling flow description and error code explanations that were missing in the PDF.
|
|
135
|
-
|
|
136
|
-
**You**
|
|
137
|
-
|
|
138
|
-
> Implement according to `.Knowledge/req-docs/marketing-coupon-v2.md`
|
|
139
|
-
|
|
140
|
-
**Agent**
|
|
141
|
-
|
|
142
|
-
> I have read the design document. Task list for implementation:
|
|
143
|
-
>
|
|
144
|
-
> 1. Create `CouponController` (coupon claim, redemption, and return endpoints)
|
|
145
|
-
> 2. Create `CouponService` with inventory deduction and idempotency checks
|
|
146
|
-
> 3. ...
|
|
147
|
-
>
|
|
148
|
-
> Before proceeding, I need to confirm: is the coupon inventory managed via Redis or database row locks?
|
|
149
|
-
|
|
150
|
-
---
|
|
151
|
-
|
|
152
|
-
## Scenario 5: Post-Implementation Knowledge Base Recording
|
|
126
|
+
## Scenario 4: Post-Implementation Knowledge Base Recording
|
|
153
127
|
|
|
154
128
|
**You**
|
|
155
129
|
|
|
@@ -177,7 +151,7 @@ The following examples revolve around the same e-commerce project, covering the
|
|
|
177
151
|
|
|
178
152
|
---
|
|
179
153
|
|
|
180
|
-
## Scenario
|
|
154
|
+
## Scenario 5: Non-compliant Implementation Found, Fix and Sync Knowledge Base
|
|
181
155
|
|
|
182
156
|
**You**
|
|
183
157
|
|
|
@@ -191,7 +165,7 @@ The following examples revolve around the same e-commerce project, covering the
|
|
|
191
165
|
|
|
192
166
|
---
|
|
193
167
|
|
|
194
|
-
## Scenario
|
|
168
|
+
## Scenario 6: Knowledge Base Conflicts After Git Merge
|
|
195
169
|
|
|
196
170
|
**You**
|
|
197
171
|
|
|
@@ -216,7 +190,7 @@ The following examples revolve around the same e-commerce project, covering the
|
|
|
216
190
|
|
|
217
191
|
## Related Documentation
|
|
218
192
|
|
|
219
|
-
- [Usage Guide](./usage-guide.
|
|
220
|
-
- [Commands Reference](./commands-reference.
|
|
221
|
-
- [Directory Conventions](./directory-conventions.
|
|
222
|
-
- [Architecture](./architecture.
|
|
193
|
+
- [Usage Guide](./usage-guide.md)
|
|
194
|
+
- [Commands Reference](./commands-reference.md)
|
|
195
|
+
- [Directory Conventions](./directory-conventions.md)
|
|
196
|
+
- [Architecture](./architecture.md)
|
|
@@ -1,22 +1,63 @@
|
|
|
1
1
|
# 体系与原理
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English](./en/architecture.md)
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Flow2Spec 的目标是把"业务知识沉淀"与"Agent 能力加载"拆开,并在仓库里用 **Memory Coding(记忆编码)** 把「要记住的东西」落盘为可 diff、可评审的 Git 资产。
|
|
6
|
+
|
|
7
|
+
- **知识环**(`.Knowledge/`):业务文档与机读路由(见下文多层结构)
|
|
8
|
+
- **任务环**(`.task/`):跨会话续作清单
|
|
9
|
+
- **规则环**(各工具 `rules` / `AGENTS.md`):规定 Agent **怎么读、怎么做**
|
|
10
|
+
- **技能环**(`f2s-*`):维护知识、触发流程
|
|
11
|
+
|
|
12
|
+
> Flow2Spec ≠ 只有知识库;上述四环同属 Memory Coding,下文「两层结构」描述的是**知识环 vs 工具侧执行落点**的生命周期分工。
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 1. Memory Coding 与仓内四环
|
|
17
|
+
|
|
18
|
+
**Memory Coding**:把必须长期记住的上下文**编码进可提交仓库**——不押在模型私有 Memory、不只在聊天里重复,也不靠全仓向量概率猜。
|
|
19
|
+
|
|
20
|
+
仓内拆成 **四环**(勿说成「三环」把规则与技能合并):
|
|
21
|
+
|
|
22
|
+
| 环 | 落点 | 记什么 |
|
|
23
|
+
| --- | --- | --- |
|
|
24
|
+
| **知识环** | `.Knowledge/` | 路由、主题、存量/需求文档(见 §2 多层) |
|
|
25
|
+
| **任务环** | `.task/` | `todo.json`、checklist、用户代办 |
|
|
26
|
+
| **规则环** | `.cursor/.claude/.codex` 下 rules、`AGENTS.md` | 读取顺序、缺口闸门、实现约束 |
|
|
27
|
+
| **技能环** | 配置根 `skills/*/SKILL.md` | `f2s-kb-feat/fix/sync` 等维护与触发 |
|
|
28
|
+
|
|
29
|
+
与「两层结构」的关系:**知识环**对应「随项目走」的知识层;**规则环 + 技能环**落在各工具配置根,随工具升级迭代;**任务环**与 `.Knowledge/` 并列于仓内,不属于 `.Knowledge/` 目录。
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 2. 知识环内的多层记忆结构
|
|
34
|
+
|
|
35
|
+
`.Knowledge/` 不是扁平「一堆 Markdown」,而是 **横读(渐进式路由)+ 纵链(主题依赖)** 的多层记忆:
|
|
36
|
+
|
|
37
|
+
| 层级 | 路径 / 机制 | 记什么 | 典型读法 |
|
|
38
|
+
| --- | --- | --- | --- |
|
|
39
|
+
| **L0 路由索引** | `manifest-routing.json` | task→topic、`topicDependencies`、`topicPaths` | 会话首读(机读事实源) |
|
|
40
|
+
| **L1 关键词分片** | `matchers/<id>.json` | `includeAny` 触发词 | **match**:只打开命中的一个分片 |
|
|
41
|
+
| **L2 主题摘要** | `topics/<topic>.md` | 硬约束摘要、边界、下一步指针 | **expand**:拉齐依赖主题 |
|
|
42
|
+
| **L3 长文档** | `stock-docs/`、`req-docs/` | 架构终稿、技术方案全文 | 按需下钻背景 |
|
|
43
|
+
| **纵链(横切)** | `topicDependencies` | 通用约定 → 子域 → 白名单 → 本域细则 | **expand** 时按依赖顺序叠层 |
|
|
44
|
+
|
|
45
|
+
**渐进式读取**(`match → expand → verify → act`)作用在 L0–L2(必要时再到 L3):先收窄入口,再展开依赖与缺口检查,最后才改代码。主题级依赖挂一次、所有任务共享,避免每个任务重复声明前置约束。
|
|
46
|
+
|
|
47
|
+
人读导航:`index.md` 仅作语义边界校验,**不**替代 `manifest-routing` 机读链。
|
|
7
48
|
|
|
8
49
|
---
|
|
9
50
|
|
|
10
|
-
##
|
|
51
|
+
## 3. 知识层与执行层(两层结构)
|
|
11
52
|
|
|
12
53
|
| 层 | 位置 | 作用 |
|
|
13
54
|
| --- | --- | --- |
|
|
14
|
-
|
|
|
15
|
-
|
|
|
55
|
+
| 知识层(知识环) | `.Knowledge/` | 保存业务文档、索引、路由(§2 多层) |
|
|
56
|
+
| 执行层(规则环 + 技能环) | `.cursor/.claude/.codex` | 保存规则与技能入口 |
|
|
16
57
|
|
|
17
58
|
---
|
|
18
59
|
|
|
19
|
-
##
|
|
60
|
+
## 4. 渐进式读取
|
|
20
61
|
|
|
21
62
|
统一建议顺序:
|
|
22
63
|
|
|
@@ -33,7 +74,7 @@ Flow2Spec 的目标是把"业务知识沉淀"与"Agent 能力加载"拆开:
|
|
|
33
74
|
|
|
34
75
|
---
|
|
35
76
|
|
|
36
|
-
##
|
|
77
|
+
## 5. 关键链路
|
|
37
78
|
|
|
38
79
|
- 文档沉淀链:`f2s-doc-arch` → `f2s-doc-final` → `f2s-ctx-build`
|
|
39
80
|
- 实现链:`.Knowledge/req-docs/*.md` → `implement-tech-design` → 代码
|
|
@@ -44,13 +85,13 @@ Flow2Spec 的目标是把"业务知识沉淀"与"Agent 能力加载"拆开:
|
|
|
44
85
|
|
|
45
86
|
---
|
|
46
87
|
|
|
47
|
-
##
|
|
88
|
+
## 6. Agent 执行模型
|
|
48
89
|
|
|
49
90
|
Flow2Spec 通过项目根 `flow2spec.config.json` 的 `subAgent`、`switchAgentVerification` 两个字段控制执行行为。
|
|
50
91
|
|
|
51
|
-
**Agent 如何读到上述真值**:多端提示 + **Read** 权威,见 [
|
|
92
|
+
**Agent 如何读到上述真值**:多端提示 + **Read** 权威,见 [使用说明 § 一(唯一详表)](./使用说明.md);设计归纳见 [设计说明 § 四、5.1](./设计说明.md)。
|
|
52
93
|
|
|
53
|
-
###
|
|
94
|
+
### 6.1 主/子 Agent 职责划分原则
|
|
54
95
|
|
|
55
96
|
**`subAgent: false`(默认)**:全部 `f2s-*` 技能在主 agent 内顺序完成,无并行拆分。
|
|
56
97
|
|
|
@@ -63,7 +104,7 @@ Flow2Spec 通过项目根 `flow2spec.config.json` 的 `subAgent`、`switchAgentV
|
|
|
63
104
|
|
|
64
105
|
子 agent 的拆分边界由各 `f2s-*` 技能正文逐步约定(如模块数、文档数、代码行数等门槛),**当前尚未在模板层给出统一阶段表**,以技能正文为准。
|
|
65
106
|
|
|
66
|
-
###
|
|
107
|
+
### 6.2 验证归属原则
|
|
67
108
|
|
|
68
109
|
**默认(谁落盘谁验)**:落盘或变更后的验证在落盘侧 agent 内完成。子 agent 落盘则子 agent 自验,主 agent 落盘则主 agent 自验。
|
|
69
110
|
|
|
@@ -81,7 +122,7 @@ Flow2Spec 通过项目根 `flow2spec.config.json` 的 `subAgent`、`switchAgentV
|
|
|
81
122
|
|
|
82
123
|
设计意图:交叉验证引入外部视角,降低落盘侧的自验盲区,但增加执行开销,因此设为显式 opt-in 而非默认行为。
|
|
83
124
|
|
|
84
|
-
###
|
|
125
|
+
### 6.3 变更追踪(changeTracking)
|
|
85
126
|
|
|
86
127
|
`changeTracking` 是独立于 `subAgent` / `switchAgentVerification` 的第三个维度,控制技能执行时是否自动创建可跨会话续作的任务清单。
|
|
87
128
|
|
|
@@ -102,7 +143,7 @@ Flow2Spec 通过项目根 `flow2spec.config.json` 的 `subAgent`、`switchAgentV
|
|
|
102
143
|
|
|
103
144
|
---
|
|
104
145
|
|
|
105
|
-
##
|
|
146
|
+
## 7. 设计收益
|
|
106
147
|
|
|
107
148
|
1. 跨工具共享同一业务知识源
|
|
108
149
|
2. 不破坏 Claude/Cursor/Codex 的规则加载习惯
|
|
@@ -112,9 +153,9 @@ Flow2Spec 通过项目根 `flow2spec.config.json` 的 `subAgent`、`switchAgentV
|
|
|
112
153
|
|
|
113
154
|
---
|
|
114
155
|
|
|
115
|
-
##
|
|
156
|
+
## 8. 相关文档
|
|
116
157
|
|
|
117
|
-
- [
|
|
118
|
-
- [
|
|
119
|
-
- [
|
|
120
|
-
- [
|
|
158
|
+
- [使用说明](./使用说明.md)
|
|
159
|
+
- [命令说明](./命令说明.md)
|
|
160
|
+
- [目录与路径约定](./目录与路径约定.md)
|
|
161
|
+
- [使用案例-模拟对话](./使用案例-模拟对话.md)
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# Flow2Spec 使用案例(模拟对话)
|
|
2
2
|
|
|
3
|
+
[English](./en/usage-scenarios.md)
|
|
4
|
+
|
|
3
5
|
以下示例围绕同一个电商项目展开,贯穿从需求澄清到上线后维护的完整流程。
|
|
4
6
|
|
|
5
7
|
**前提**:项目已执行 `flow2spec init`,`flow2spec.config.json` 使用默认配置(`subAgent: false`)。`f2s-*` 技能不改动配置根 `rules/`、`skills/` 文件。
|
|
@@ -121,33 +123,7 @@
|
|
|
121
123
|
|
|
122
124
|
---
|
|
123
125
|
|
|
124
|
-
##
|
|
125
|
-
|
|
126
|
-
**你**
|
|
127
|
-
|
|
128
|
-
> /f2s-doc-pdf /Users/me/Downloads/营销优惠券_v2.pdf
|
|
129
|
-
|
|
130
|
-
**Agent**
|
|
131
|
-
|
|
132
|
-
> 已转换并保存为 `.Knowledge/req-docs/营销优惠券_v2.md`,补全了 PDF 中缺失的幂等处理流程描述和错误码说明。
|
|
133
|
-
|
|
134
|
-
**你**
|
|
135
|
-
|
|
136
|
-
> 按方案实现:`.Knowledge/req-docs/营销优惠券_v2.md`
|
|
137
|
-
|
|
138
|
-
**Agent**
|
|
139
|
-
|
|
140
|
-
> 已读取方案,输出实现任务列表:
|
|
141
|
-
>
|
|
142
|
-
> 1. 新建 `CouponController`(领券、核销、退券接口)
|
|
143
|
-
> 2. 新建 `CouponService`,含库存扣减与幂等校验
|
|
144
|
-
> 3. …
|
|
145
|
-
>
|
|
146
|
-
> 实现前确认:优惠券库存是用 Redis 还是数据库行锁?
|
|
147
|
-
|
|
148
|
-
---
|
|
149
|
-
|
|
150
|
-
## 场景五:实现后补录知识库
|
|
126
|
+
## 场景四:实现后补录知识库
|
|
151
127
|
|
|
152
128
|
**你**
|
|
153
129
|
|
|
@@ -175,7 +151,7 @@
|
|
|
175
151
|
|
|
176
152
|
---
|
|
177
153
|
|
|
178
|
-
##
|
|
154
|
+
## 场景五:发现违规实现,修复并同步知识库
|
|
179
155
|
|
|
180
156
|
**你**
|
|
181
157
|
|
|
@@ -189,7 +165,7 @@
|
|
|
189
165
|
|
|
190
166
|
---
|
|
191
167
|
|
|
192
|
-
##
|
|
168
|
+
## 场景六:Git 合并后知识库冲突
|
|
193
169
|
|
|
194
170
|
**你**
|
|
195
171
|
|
|
@@ -214,7 +190,7 @@
|
|
|
214
190
|
|
|
215
191
|
## 相关文档
|
|
216
192
|
|
|
217
|
-
- [
|
|
218
|
-
- [
|
|
219
|
-
- [
|
|
220
|
-
- [
|
|
193
|
+
- [使用说明](./使用说明.md)
|
|
194
|
+
- [命令说明](./命令说明.md)
|
|
195
|
+
- [目录与路径约定](./目录与路径约定.md)
|
|
196
|
+
- [体系与原理](./体系与原理.md)
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
# Flow2Spec 使用说明
|
|
2
|
+
|
|
3
|
+
[English](./en/usage-guide.md)
|
|
4
|
+
|
|
5
|
+
## 一、init 做了什么
|
|
6
|
+
|
|
7
|
+
在业务仓库根执行:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
flow2spec init [cursor|claude|codex ...]
|
|
11
|
+
# 需要强制重置 .Knowledge 到模板时:
|
|
12
|
+
flow2spec init [cursor|claude|codex ...] --reset-knowledge
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
| init 做 | init 不做 |
|
|
17
|
+
| ------------------------------------------- | ---------------------------- |
|
|
18
|
+
| 补齐缺失的目录与模板文件 | 撰写或更新业务文档内容 |
|
|
19
|
+
| 落盘各 agent 配置根 `rules/` `skills/` | 更新 `includeAny` 业务词条 |
|
|
20
|
+
| `manifest-routing` + `matchers/` 包级结构对齐 | 替代 `f2s-*` 技能对业务语义的书写 |
|
|
21
|
+
| `--reset-knowledge` 时强制覆盖 `.Knowledge` 模板文件 | (不加此参数时)覆盖已有 `.Knowledge` 内容 |
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
> **`init` 与「知识库升级」是两件事**:`init` 只做结构补齐,业务语义(topics 内容、路由词条、stock-docs/req-docs)由 `f2s-doc-add`、`f2s-kb-fix`、`f2s-kb-feat`、`f2s-kb-sync`、`f2s-ctx-build` 等技能维护。跨版本升级用 `f2s-kb-upgrade`,**不要把单独 `init` 当作升级命令**。
|
|
25
|
+
|
|
26
|
+
### `f2s-*` 与 `flow2spec.config.json`:多端多重提示(权威仍为磁盘 JSON)
|
|
27
|
+
|
|
28
|
+
执行任意 **`f2s-*` 技能**前,需要让 Agent 拿到 **`subAgent` / `switchAgentVerification` / `changeTracking`** 等实际值。Flow2Spec 在 **不同客户端** 用 **不同机制** 强化这一点;它们彼此**补充**,**不**互相替代,**权威始终**是项目根 **`flow2spec.config.json`**(须用 **Read** 与磁盘一致后再进技能正文)。
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
| 端 | `init` 落盘与行为 | 说明 |
|
|
32
|
+
| --------------- | ------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
33
|
+
| **Cursor** | `.cursor/rules/f2s-config-check.mdc`(`alwaysApply`) | 规则要求:技能正文前先 **Read(`flow2spec.config.json`)**。 |
|
|
34
|
+
| **Claude Code** | `.claude/hooks/f2s-config-inject.js` + `.claude/settings.json`(PreToolUse,`Skill` 匹配) | 在调用 **`f2s-*` Skill** 时注入配置摘要;**文件缺失、JSON 无效或 hook 未预期异常**时也会注入**说明 + 与「文件不存在」一致的默认语义**,避免静默;仍建议在存疑或刚改过配置时 **Read** 核对。 |
|
|
35
|
+
| **Codex** | `.codex/AGENTS.md` 顶部强制步骤 + `{{FLOW2SPEC_PROJECT_CONFIG}}` 展开表 | **Read** 为硬要求;配置表为 **最近一次 `flow2spec init` 的快照**,与磁盘不一致时以 **Read** 为准。同目录 **`.codex/topics/f2s-config-check.md`** 与 Cursor 规则同源(含 **changeTracking** 细表),**按需**打开即可,不必与「专题长文」三条示例并列必读。 |
|
|
36
|
+
| **知识库(可选)** | `.Knowledge/manifest-routing` 命中 **`config-precheck`** 时 | `.Knowledge/topics/f2s-config-precheck.md` 为**路由摘要**,链向 Codex 长文;**不**在 `.Knowledge` 再维护第二份全文,也**不**替代 Read JSON。 |
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
字段语义与默认值规则见 [命令说明 § 6) 子 Agent 配置说明](./命令说明.md)。设计视角见 [设计说明 § 四、5.1](./设计说明.md);口述见 [Flow2Spec-演讲稿 Slide 13b](./Flow2Spec-演讲稿.md)。
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## 二、目录约定
|
|
44
|
+
|
|
45
|
+
核心区分:`stock-docs/` 放沉淀文档(驱动知识路由),`req-docs/` 放技术方案(驱动编码实现),两者不互换。
|
|
46
|
+
|
|
47
|
+
完整目录说明见 [目录与路径约定](./目录与路径约定.md)。
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 三、典型工作场景
|
|
52
|
+
|
|
53
|
+
### 变更追踪与跨会话续作(推荐)
|
|
54
|
+
|
|
55
|
+
在 `flow2spec.config.json` 按技能开启 `changeTracking`(各子项独立):
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"changeTracking": {
|
|
60
|
+
"feat": true,
|
|
61
|
+
"fix": true,
|
|
62
|
+
"implement": true
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
开启后,`f2s-kb-feat` / `f2s-kb-fix` / `f2s-implement-tech-design` 执行时会在 `.task/active/` 自动创建任务清单,逐步勾选,完成后归档。下次会话描述相关内容时,`f2s-task` 规则会匹配并加载剩余步骤,无需重复交代上下文。
|
|
68
|
+
|
|
69
|
+
若你**关闭了** `changeTracking` 但仍临时需要 `.task/` 清单,可显式调用 `f2s-req-plan`(不读配置、始终建清单)——这是兜底用法,非常规主路径;详见 [命令说明 § f2s-req-plan](./命令说明.md)。
|
|
70
|
+
|
|
71
|
+
### 新需求开发
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
f2s-req-clarify 一句话需求或文档 → f2s-req-backend → 实现xx技术方案 (会严格按照implement-tech-design规则走)
|
|
75
|
+
实现完成后需新增能力→ f2s-kb-feat
|
|
76
|
+
实现完成后需修bug→ f2s-kb-fix
|
|
77
|
+
调试完成后-> f2s-kb-sync
|
|
78
|
+
最后->f2s-git-commit
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
需求已明确时可跳过 `f2s-req-clarify`,直接从 `f2s-req-backend` 开始。技术方案落入 `req-docs/` 后,由 `implement-tech-design` 规则驱动编码。
|
|
82
|
+
|
|
83
|
+
### 文档沉淀
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
新增架构文档沉淀:f2s-doc-arch → f2s-doc-final → f2s-ctx-build
|
|
87
|
+
PDF/初稿沉淀: f2s-doc-final → f2s-ctx-build
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
把架构说明或 PDF 终稿纳入知识路由(生成 topics/matchers/manifest-routing)。若仅有 PDF 且要入库,先用 `f2s-doc-final` 转为终稿再 `f2s-ctx-build`;`f2s-doc-pdf` 仅把 PDF 转为 `req-docs/` 下的 Markdown 便于编辑,**不**作为「PDF 直驱编码」的推荐路径。
|
|
91
|
+
|
|
92
|
+
### 存量能力补录
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
f2s-doc-add # 多文件聚合,从源码/文档提取
|
|
96
|
+
f2s-kb-sync # 从当前会话推断已实现能力
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
代码已落地但知识库没有记录时使用。`f2s-doc-add` 适合批量导入,`f2s-kb-sync` 适合会话结束时的即时沉淀。
|
|
100
|
+
|
|
101
|
+
### 日常维护
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
f2s-kb-fix # 修复实现或规则错误,自动同步知识库
|
|
105
|
+
f2s-kb-feat # 新增能力,自动同步知识库
|
|
106
|
+
f2s-kb-sync # 定期同步或补录
|
|
107
|
+
f2s-kb-merge # Git 合并后解决上下文冲突
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 知识库跨版本升级
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
f2s-kb-migrate(流程 V1:旧库)→ f2s-kb-upgrade
|
|
114
|
+
f2s-kb-upgrade(流程现行库 V2+:已有 .Knowledge;含 npm v3.x 等,见技能步骤 0)
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## 四、Agent 执行配置
|
|
120
|
+
|
|
121
|
+
通过项目根 `flow2spec.config.json` 控制,字段完整规则见 [命令说明 § 6) 子 Agent 配置说明](./命令说明.md)。**各端如何被提示读到配置、为何仍以 Read 为权威**见 **§ 一**(本 § 仅说明**何时**打开各开关)。
|
|
122
|
+
|
|
123
|
+
**何时开启 `subAgent: true`**:任务规模较大时(多模块并行实现、批量文档入库、大规模迁移)。开启后各技能按自身规模门槛决定是否实际拆分,未达门槛的仍在主 agent 内完成。
|
|
124
|
+
|
|
125
|
+
**何时开启 `switchAgentVerification: true`**:需要更高落盘一致性时(大规模迁移、重要方案实现)。代价是增加执行轮次;常规维护场景默认 `false` 足够。须搭配 `subAgent: true` 才能触发"主落子验"方向的交叉。
|
|
126
|
+
|
|
127
|
+
**何时开启 `changeTracking.*`**:希望每次技能执行自动留下可续作的任务清单时。各技能子项独立配置,互不影响:
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"changeTracking": {
|
|
132
|
+
"feat": true,
|
|
133
|
+
"fix": false,
|
|
134
|
+
"implement": true
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
`changeTracking` 全关且仍要任务清单时,再考虑 `f2s-req-plan`(见 § 三「变更追踪」脚注)。
|
|
140
|
+
|
|
141
|
+
---
|
|
142
|
+
|
|
143
|
+
## 五、规则改造建议
|
|
144
|
+
|
|
145
|
+
- 项目特化「按技术方案实现」逻辑时,优先调整 **`f2s-implement-tech-design`**:Cursor `.cursor/rules/f2s-implement-tech-design.mdc`,Claude `.claude/rules/f2s-implement-tech-design.md`;Codex 以 `.codex/AGENTS.md` 与相关 `skills/` 为准
|
|
146
|
+
- 再次 `init` 默认仅补齐缺失模板并做包级结构对齐,**不**替代 `f2s-*` 对业务内容的维护;需用模板重置 `.Knowledge` 时加 `--reset-knowledge`
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
## 六、技能标识
|
|
151
|
+
|
|
152
|
+
技能以 `name` 与 `description` 匹配触发,文件位于 `配置根/skills/*/SKILL.md`。
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
## 七、相关文档
|
|
157
|
+
|
|
158
|
+
- [命令说明](./命令说明.md)
|
|
159
|
+
- [目录与路径约定](./目录与路径约定.md)
|
|
160
|
+
- [体系与原理](./体系与原理.md)
|
|
161
|
+
- [使用案例-模拟对话](./使用案例-模拟对话.md)
|
|
162
|
+
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# 工作流与技能说明
|
|
2
2
|
|
|
3
|
+
[English](./en/commands-reference.md)
|
|
4
|
+
|
|
3
5
|
## 1) 文档沉淀(stock-docs 链路)
|
|
4
6
|
|
|
5
7
|
### `f2s-doc-arch`
|
|
@@ -17,7 +19,7 @@
|
|
|
17
19
|
**关联关系**:
|
|
18
20
|
|
|
19
21
|
- **前置**:无
|
|
20
|
-
- **后续**:`f2s-doc-final
|
|
22
|
+
- **后续**:`f2s-doc-final`(规范化终稿)→ `f2s-ctx-build`(**须终稿入参**;初稿不可直驱 build)
|
|
21
23
|
- **输出**:`.Knowledge/stock-docs/<架构说明>_初稿.md`
|
|
22
24
|
|
|
23
25
|
**子 agent 调用**:
|
|
@@ -179,21 +181,19 @@
|
|
|
179
181
|
|
|
180
182
|
**作用**:将 PDF 技术方案转为 Markdown 格式,保存到 `req-docs/`,可补全流程说明。
|
|
181
183
|
|
|
182
|
-
|
|
184
|
+
**工作原理**:将 PDF 中的接口定义、数据模型、时序流程等提取为 Markdown 并落盘 `req-docs/`,便于后续编辑或与 `f2s-req-clarify` / `f2s-req-backend` 衔接。与 `f2s-doc-final` 的区别:`doc-pdf` 输出到 `req-docs/`(实现侧文档目录),`doc-final` 输出到 `stock-docs/` 供 `ctx-build` 入库。**不推荐**把「PDF 转 MD」当作跳过澄清与后端技术方案的直驱编码路径。
|
|
183
185
|
|
|
184
186
|
**使用场景**:
|
|
185
187
|
|
|
186
|
-
-
|
|
187
|
-
- 历史 PDF
|
|
188
|
-
-
|
|
188
|
+
- 跨团队交付物为 PDF,需转为可编辑的 Markdown
|
|
189
|
+
- 历史 PDF 技术方案需纳入 `req-docs/` 管理
|
|
190
|
+
- 为后续 `f2s-req-clarify` / `f2s-req-backend` 提供可读底稿
|
|
189
191
|
|
|
190
192
|
**关联关系**:
|
|
191
193
|
|
|
192
194
|
- **前置**:PDF 文档
|
|
193
195
|
- **输出**:`.Knowledge/req-docs/<方案>.md`
|
|
194
|
-
-
|
|
195
|
-
- 1. 如果是需求实现:提供转换后的方案路径并说明"按技术方案实现",由 `implement-tech-design` 规则驱动编码
|
|
196
|
-
- 1. 如果是转存知识库:走转换终稿流程 `f2s-doc-final` → `f2s-ctx-build`
|
|
196
|
+
- **下一步**(推荐):`f2s-req-clarify` → `f2s-req-backend` → 按 `req-docs/` 中技术方案 MD 触发 `implement-tech-design`;若目标是知识库沉淀则 `f2s-doc-final` → `f2s-ctx-build`
|
|
197
197
|
|
|
198
198
|
**子 agent 调用**:
|
|
199
199
|
|
|
@@ -694,7 +694,7 @@
|
|
|
694
694
|
|
|
695
695
|
### 多端如何「看到」配置(与下文字段表配合)
|
|
696
696
|
|
|
697
|
-
`subAgent` 等写在 **磁盘 JSON**;各产品不保证自动打开文件,故用 **Cursor 规则 / Claude hook / Codex AGENTS 快照表 / 知识库 `config-precheck` 摘要** 多层提示,**权威仍为 Read(`flow2spec.config.json`)**(设计意图见 [
|
|
697
|
+
`subAgent` 等写在 **磁盘 JSON**;各产品不保证自动打开文件,故用 **Cursor 规则 / Claude hook / Codex AGENTS 快照表 / 知识库 `config-precheck` 摘要** 多层提示,**权威仍为 Read(`flow2spec.config.json`)**(设计意图见 [设计说明 § 四、5.1](./设计说明.md),演讲口径见 [Flow2Spec-演讲稿 Slide 13b](./Flow2Spec-演讲稿.md))。**完整路径与表格只维护一处**:[使用说明 § 一、`f2s-`* 与 `flow2spec.config.json](./使用说明.md)`。
|
|
698
698
|
|
|
699
699
|
### `subAgent` 字段
|
|
700
700
|
|
|
@@ -738,22 +738,22 @@
|
|
|
738
738
|
|
|
739
739
|
> `f2s-req-plan` 不受此配置约束,始终创建任务清单。旧版布尔值(`"changeTracking": true/false`)向下兼容,自动展开为三项全开/全关。
|
|
740
740
|
|
|
741
|
-
完整原则与设计意图见 [
|
|
741
|
+
完整原则与设计意图见 [体系与原理 § 4. Agent 执行模型](./体系与原理.md)。
|
|
742
742
|
|
|
743
743
|
---
|
|
744
744
|
|
|
745
745
|
## 7) 快速参考
|
|
746
746
|
|
|
747
|
-
典型工作场景与完整链路见 [
|
|
747
|
+
典型工作场景与完整链路见 [使用说明 § 三、典型工作场景](./使用说明.md)。
|
|
748
748
|
|
|
749
|
-
目录完整说明见 [
|
|
749
|
+
目录完整说明见 [目录与路径约定](./目录与路径约定.md)。
|
|
750
750
|
|
|
751
751
|
---
|
|
752
752
|
|
|
753
753
|
相关文档:
|
|
754
754
|
|
|
755
|
-
- [
|
|
756
|
-
- [
|
|
757
|
-
- [
|
|
758
|
-
- [
|
|
755
|
+
- [使用说明](./使用说明.md)
|
|
756
|
+
- [目录与路径约定](./目录与路径约定.md)
|
|
757
|
+
- [体系与原理](./体系与原理.md)
|
|
758
|
+
- [使用案例-模拟对话](./使用案例-模拟对话.md)
|
|
759
759
|
|