@double-codeing/flow2spec 3.0.7 → 3.0.9
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/README.en.md +114 -0
- package/README.md +78 -75
- package/docs/architecture.en.md +122 -0
- package/docs/commands-reference.en.md +605 -0
- package/docs/design-principles.en.md +592 -0
- package/docs/directory-conventions.en.md +49 -0
- package/docs/usage-guide.en.md +165 -0
- package/docs/usage-scenarios.en.md +222 -0
- package/package.json +1 -1
- package/templates/skills/f2s-ctx-build/SKILL.md +1 -0
- package/docs/Flow2Spec-/346/274/224/350/256/262/347/250/277.md +0 -411
- package/docs/images//346/212/200/350/203/275/351/227/255/347/216/257/345/233/276.png +0 -0
|
@@ -0,0 +1,592 @@
|
|
|
1
|
+
[中文](./Flow2Spec-设计说明.md) | [English](./design-principles.en.md)
|
|
2
|
+
|
|
3
|
+
# Flow2Spec Design Principles
|
|
4
|
+
|
|
5
|
+
## Problem Statement
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
❌ Current State ✅ After Flow2Spec
|
|
9
|
+
|
|
10
|
+
Architecture conventions ──┐ .Knowledge/
|
|
11
|
+
Technical designs ──┼──► scattered ├── manifest-routing.json
|
|
12
|
+
Module boundaries ──┤ unstructured ├── matchers/
|
|
13
|
+
Team experience ──┘ reinterpreted ├── topics/
|
|
14
|
+
every time ├── stock-docs/
|
|
15
|
+
└── req-docs/
|
|
16
|
+
|
|
17
|
+
AI can read the project anytime
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Core Design
|
|
23
|
+
|
|
24
|
+
### 1. Separation of Knowledge and Rules
|
|
25
|
+
|
|
26
|
+
```mermaid
|
|
27
|
+
graph LR
|
|
28
|
+
subgraph K[".Knowledge/ Knowledge Layer"]
|
|
29
|
+
K1[Architecture Docs]
|
|
30
|
+
K2[Technical Designs]
|
|
31
|
+
K3[Routing Index]
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
subgraph R["Config Root Execution Layer"]
|
|
35
|
+
R1[.cursor/rules/]
|
|
36
|
+
R2[.claude/rules/]
|
|
37
|
+
R3[.codex/AGENTS.md]
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
K -->|Knowledge Input| AI[AI Tools]
|
|
41
|
+
R -->|Rule Constraints| AI
|
|
42
|
+
|
|
43
|
+
note1["Knowledge evolves with the project"] -.-> K
|
|
44
|
+
note2["Rules evolve with tool upgrades"] -.-> R
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### 2. Progressive Routing
|
|
50
|
+
|
|
51
|
+
```mermaid
|
|
52
|
+
graph LR
|
|
53
|
+
T[Task] --> M[manifest-routing\nRead routing table]
|
|
54
|
+
M -->|Keyword match| MT[matchers/xxx.json\nRead only this shard]
|
|
55
|
+
MT -->|Hit| TP[topics/xxx.md]
|
|
56
|
+
TP --> V{Gap Check}
|
|
57
|
+
V -->|Pass| ACT[Execute]
|
|
58
|
+
V -->|Insufficient| Q[Ask user for clarification]
|
|
59
|
+
M -->|No match| FB[fallback-triage\nStructured triage]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
### 3. Skill Maintenance Loop
|
|
65
|
+
|
|
66
|
+
```mermaid
|
|
67
|
+
graph LR
|
|
68
|
+
K[".Knowledge/"] --> AI["Next Session\nAI"]
|
|
69
|
+
AI --> C["Code\nChanges"]
|
|
70
|
+
|
|
71
|
+
C -->|"Fix Bug"| FIX["f2s-kb-fix"] --> K
|
|
72
|
+
C -->|"New Capability"| FEAT["f2s-kb-feat"] --> K
|
|
73
|
+
C -->|"Session End"| SYNC["f2s-kb-sync"] --> K
|
|
74
|
+
C -->|"Commit Code"| CMT["f2s-git-commit\nGate Check"]
|
|
75
|
+
CMT -->|"Not in KB, remind\n→ kb-sync/kb-feat"| K
|
|
76
|
+
|
|
77
|
+
D1["Architecture Docs"] -->|f2s-doc-arch| FIN["f2s-doc-final"]
|
|
78
|
+
D2["PDF Proposal"] -->|f2s-doc-pdf| FIN
|
|
79
|
+
FIN --> CTX["f2s-ctx-build"] --> K
|
|
80
|
+
|
|
81
|
+
OLD["Existing Code/Docs"] -->|f2s-doc-add| K
|
|
82
|
+
|
|
83
|
+
NR["New Requirement"] --> CL["f2s-req-clarify"] --> BE["f2s-req-backend"]
|
|
84
|
+
BE --> IMPL["implement-tech-design"] -->|f2s-kb-feat| K
|
|
85
|
+
|
|
86
|
+
GIT["After Git Merge"] -->|f2s-kb-merge| K
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Seven entry points · `f2s-git-commit` is the knowledge discipline gate at commit time · `.Knowledge/` is the single convergence point · Knowledge drives AI, AI drives the next development cycle
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
### 4. Task Checklist and Cross-Session Continuation
|
|
94
|
+
|
|
95
|
+
```mermaid
|
|
96
|
+
graph LR
|
|
97
|
+
SKILL["f2s-kb-feat / f2s-kb-fix\nimplement-tech-design"] -->|"changeTracking: true"| TJ[".task/active/\ntask.md · todo.json"]
|
|
98
|
+
RP["f2s-req-plan\n(always created)"] --> TJ
|
|
99
|
+
|
|
100
|
+
TJ --> NS[First message of new session]
|
|
101
|
+
NS -->|Keyword match| LD["Load remaining checklist\n+ linkedSkill context"]
|
|
102
|
+
LD --> RS[Continue per original skill constraints]
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Tasks do not get lost when a session ends · Keywords enable automatic continuation without re-explaining context · Skill constraints are fully restored
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Design Highlights
|
|
110
|
+
|
|
111
|
+
### A. Routing and Context Loading
|
|
112
|
+
|
|
113
|
+
#### 1. matchers sharded, not embedded in manifest
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
❌ Embedded in manifest ✅ Independent shards
|
|
117
|
+
|
|
118
|
+
manifest.json (full read every time) manifest-routing.json
|
|
119
|
+
├── task1: keywords:[...] → ├── task1 → m-order.json ──► read only this one
|
|
120
|
+
├── task2: keywords:[...] ├── task2 → m-payment.json
|
|
121
|
+
└── task3: keywords:[...] └── task3 → m-refund.json
|
|
122
|
+
|
|
123
|
+
Updating keywords doesn't touch routing structure
|
|
124
|
+
Per-routing token cost is fixed
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### 2. topicDependencies: dependencies on topics
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
❌ Attached at task level ✅ Attached at topic level
|
|
131
|
+
|
|
132
|
+
taskA → [dep, main] topicDependencies:
|
|
133
|
+
taskB → [main] ← forgot main: [dep]
|
|
134
|
+
taskC → [main] ← forgot
|
|
135
|
+
Any path loading main
|
|
136
|
+
Forgot when adding new task automatically brings in prerequisite
|
|
137
|
+
→ silent failure dependencies
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
#### 3. topics store summaries, rules files store full text
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
.Knowledge/topics/implement-tech-design.md ← lightweight, loaded during routing
|
|
144
|
+
┌──────────────────────────────────────────┐
|
|
145
|
+
│ Topic id, path conventions, next pointer │
|
|
146
|
+
│ ~100 lines │
|
|
147
|
+
└──────────────────────────────────────────┘
|
|
148
|
+
↓ read only after hit
|
|
149
|
+
.claude/rules/f2s-implement-tech-design.md ← full text, loaded during execution
|
|
150
|
+
┌──────────────────────────────────────────┐
|
|
151
|
+
│ Complete execution constraints, │
|
|
152
|
+
│ mandatory steps, prohibitions, │
|
|
153
|
+
│ boundary descriptions │
|
|
154
|
+
│ ~500 lines │
|
|
155
|
+
└──────────────────────────────────────────┘
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Routing layer stays lightweight · Execution details load on demand · The two evolve independently
|
|
159
|
+
|
|
160
|
+
#### 4. Full-scan prohibition is a hard constraint
|
|
161
|
+
|
|
162
|
+
```
|
|
163
|
+
Read order (mandatory)
|
|
164
|
+
|
|
165
|
+
1. manifest-routing.json ← read the routing table first
|
|
166
|
+
2. matchers/xxx.json ← read only the matched shard
|
|
167
|
+
3. index.md ← on demand, confirm semantics
|
|
168
|
+
4. stock-docs / req-docs ← on demand, supplement context
|
|
169
|
+
5. Business source code ← last resort
|
|
170
|
+
|
|
171
|
+
❌ Before reading manifest, full-repo unbounded scan is prohibited
|
|
172
|
+
❌ Within the same task line, manifest already read, do not re-read in full
|
|
173
|
+
❌ index.md must not be alternated with manifest as a "checklist" to replace decisions
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
#### 5. Skill trigger words in the description field
|
|
177
|
+
|
|
178
|
+
```yaml
|
|
179
|
+
name: f2s-kb-sync
|
|
180
|
+
description: >
|
|
181
|
+
Sync implemented capabilities to the knowledge base.
|
|
182
|
+
Triggers: f2s-kb-sync, full sync, knowledge base sync, implemented capabilities
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
User input → Agent scans description for semantic match → triggers corresponding skill
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Trigger words are in the `description` field · not in the skill body · higher hit rate · bilingual coverage reduces missed triggers
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
### B. Knowledge Structure
|
|
194
|
+
|
|
195
|
+
#### 1. stock-docs vs req-docs semantic prohibition
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
stock-docs/ req-docs/
|
|
199
|
+
Architecture docs / Final draft Requirements / Technical designs
|
|
200
|
+
|
|
201
|
+
↓ used for ↓ used for
|
|
202
|
+
Knowledge routing / Background Drive coding implementation
|
|
203
|
+
reference
|
|
204
|
+
|
|
205
|
+
✅ May be read ✅ May be read
|
|
206
|
+
❌ Cannot be used as coding input ✅ Input for implement-tech-design
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Prevents: driving implementation with outdated reference docs → code diverging from the latest design
|
|
210
|
+
|
|
211
|
+
#### 2. init is idempotent
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
flow2spec init can be safely re-run
|
|
215
|
+
|
|
216
|
+
✅ Does ❌ Does NOT
|
|
217
|
+
┌─────────────────────┐ ┌─────────────────────┐
|
|
218
|
+
│ Fill missing │ │ Write business │
|
|
219
|
+
│ directories/templates│ │ document content │
|
|
220
|
+
│ Install rules/skills │ │ Update routing │
|
|
221
|
+
│ │ │ keywords │
|
|
222
|
+
│ Align package-level │ │ Overwrite existing │
|
|
223
|
+
│ structure │ │ knowledge content │
|
|
224
|
+
└─────────────────────┘ └─────────────────────┘
|
|
225
|
+
|
|
226
|
+
Structural operations ≠ Business semantics The two have no overlapping responsibilities
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
#### 3. Knowledge versioning
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
git log .Knowledge/
|
|
233
|
+
|
|
234
|
+
a3f1c2 f2s-kb-feat: add refund state machine routing
|
|
235
|
+
b7e9d1 f2s-kb-fix: fix RestTemplate injection conventions
|
|
236
|
+
c2a8f0 f2s-ctx-build: onboard order service architecture docs
|
|
237
|
+
d5b3e9 f2s-kb-sync: consolidate payment retry queue design
|
|
238
|
+
|
|
239
|
+
Code changes + Knowledge changes → same commit or adjacent commits
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Knowledge has versions · is reviewable · is traceable · is blameable
|
|
243
|
+
|
|
244
|
+
#### 4. No accumulation of historical negation
|
|
245
|
+
|
|
246
|
+
```
|
|
247
|
+
❌ Wrong approach (knowledge base grows bloated) ✅ Correct approach (only current truth)
|
|
248
|
+
|
|
249
|
+
RestTemplate convention (updated 2026-05) RestTemplate must be injected via Bean
|
|
250
|
+
~~Previously incorrectly used new RestTemplate()~~ Direct new RestTemplate() is prohibited
|
|
251
|
+
→ No longer related to direct instantiation
|
|
252
|
+
→ Old approach deprecated, now uses Bean injection
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
Rewrite in place with each fix · don't layer history · the knowledge base always describes only the present
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
### C. Execution Constraints
|
|
260
|
+
|
|
261
|
+
#### 1. Mandatory steps are constraints, not suggestions
|
|
262
|
+
|
|
263
|
+
```
|
|
264
|
+
implement-tech-design execution flow
|
|
265
|
+
|
|
266
|
+
Input normalization
|
|
267
|
+
↓
|
|
268
|
+
Read proposal and context
|
|
269
|
+
↓
|
|
270
|
+
★ Output implementation task list ← cannot skip
|
|
271
|
+
↓
|
|
272
|
+
★ Confirm before implementing ← cannot skip
|
|
273
|
+
↓
|
|
274
|
+
Implement per task list
|
|
275
|
+
↓
|
|
276
|
+
Output pending checklist and reminders ← cannot skip
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
Suggestions → can be skipped · Constraints → must be explicitly addressed before proceeding
|
|
280
|
+
|
|
281
|
+
#### 2. fallback is itself a procedurally-defined topic
|
|
282
|
+
|
|
283
|
+
```mermaid
|
|
284
|
+
graph TD
|
|
285
|
+
F[Enter fallback-triage] --> S1{Route matched?}
|
|
286
|
+
S1 -->|Matched but insufficient context| EXP[Expand dependency topics\nfill gaps and continue]
|
|
287
|
+
S1 -->|Not matched| Q[Ask user:\nHas this domain been documented?]
|
|
288
|
+
Q -->|Yes| HINT[Routing entry missing\nsuggest adding routing]
|
|
289
|
+
Q -->|No| CHOICE[Drill into source code\nor add req-docs]
|
|
290
|
+
Q -->|Not sure| STOP[Stop execution\nwait for clear instructions]
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
No match ≠ silent failure · degradation itself has a clear procedure
|
|
296
|
+
|
|
297
|
+
#### 3. manifest / index write authority hard constraint
|
|
298
|
+
|
|
299
|
+
```
|
|
300
|
+
Sub-agents MAY write Sub-agents MUST NOT touch
|
|
301
|
+
──────────────────── ────────────────────
|
|
302
|
+
Code implementation files manifest-routing.json ← always written by main agent
|
|
303
|
+
stock-docs content files .Knowledge/index.md ← always written by main agent
|
|
304
|
+
topics content files (diff mode)
|
|
305
|
+
matchers/*.json (diff mode)
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
When multiple sub-agents run in parallel, shared state files are written single-point by the main agent to prevent concurrent conflicts
|
|
309
|
+
|
|
310
|
+
#### 4. Document changes vs code changes: different splitting strategies
|
|
311
|
+
|
|
312
|
+
```
|
|
313
|
+
Code sub-packages Document sub-packages
|
|
314
|
+
──────────────────── ────────────────────
|
|
315
|
+
✅ Can delegate to sub-agents ❌ Not split by default, main agent writes directly
|
|
316
|
+
✅ Sub-agents write directly If outsourcing is necessary →
|
|
317
|
+
Sub-side only outputs before/after diff snippets
|
|
318
|
+
Main agent reviews and merges
|
|
319
|
+
❌ Full-file rewrite is strictly prohibited
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
Rationale: documents need to guarantee "current truth coverage / consistent style / no accumulation of historical negation" · requires the writer to see the full context
|
|
323
|
+
|
|
324
|
+
#### 5. Task checklist and cross-session continuation
|
|
325
|
+
|
|
326
|
+
```
|
|
327
|
+
Keyword-based automatic continuation example
|
|
328
|
+
|
|
329
|
+
First sentence of a new session: "There's still an issue with payment callback"
|
|
330
|
+
↓
|
|
331
|
+
Matches each entry's keywords in todo.json
|
|
332
|
+
↓
|
|
333
|
+
Hit { name: "payment_callback_fix", keywords: ["payment", "callback"] }
|
|
334
|
+
↓
|
|
335
|
+
Load task.md (show remaining steps)
|
|
336
|
+
linkedSkill = "f2s-kb-fix" → load SKILL.md
|
|
337
|
+
↓
|
|
338
|
+
Skill's write rules / style requirements / self-check checklist are fully restored
|
|
339
|
+
User doesn't need to re-describe context, can continue directly
|
|
340
|
+
|
|
341
|
+
✅ No need to say "continue the previous task"
|
|
342
|
+
✅ Skill constraints are fully restored, consistent with the first invocation
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
```
|
|
346
|
+
todo.json write authority constraint
|
|
347
|
+
|
|
348
|
+
Main agent ── read / write todo.json ✅
|
|
349
|
+
Sub-agent ── read todo.json ✅
|
|
350
|
+
Sub-agent ── write todo.json ❌
|
|
351
|
+
|
|
352
|
+
Rationale: when multiple sub-agents write concurrently,
|
|
353
|
+
concurrent writes cause entries to overwrite each other
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
Lifecycle is driven by skills · keyword routing enables cross-session automatic continuation · linkedSkill ensures full restoration of skill constraints
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
### D. Agent Orchestration
|
|
361
|
+
|
|
362
|
+
#### 1. subAgent × switchAgentVerification are orthogonal
|
|
363
|
+
|
|
364
|
+
```
|
|
365
|
+
switchAgentVerification
|
|
366
|
+
false true
|
|
367
|
+
subAgent ┌────────────┬─────────────────┐
|
|
368
|
+
true → │ Parallel │ Parallel │
|
|
369
|
+
│ execution │ execution │
|
|
370
|
+
│ Writer-side │ Sub writes→Main │
|
|
371
|
+
│ self-verify │ verifies │
|
|
372
|
+
│ │ Main writes→Sub │
|
|
373
|
+
│ │ verifies │
|
|
374
|
+
├────────────┼─────────────────┤
|
|
375
|
+
false → │ Sequential │ Sequential │
|
|
376
|
+
│ execution │ execution │
|
|
377
|
+
│ Main agent │ Main agent │
|
|
378
|
+
│ self- │ self-verifies │
|
|
379
|
+
│ verifies │ (no sub-side │
|
|
380
|
+
│ │ for cross-check) │
|
|
381
|
+
└────────────┴─────────────────┘
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
Two orthogonal dimensions · independently configurable · default is bottom-left
|
|
385
|
+
|
|
386
|
+
#### 2. Confirmation authority cannot be delegated to sub-agents
|
|
387
|
+
|
|
388
|
+
```mermaid
|
|
389
|
+
graph LR
|
|
390
|
+
S1[Step 1: Gather materials] -->|subAgent=true may parallelize| SUB[Sub-agent]
|
|
391
|
+
SUB -->|Read-only, no writes| S2
|
|
392
|
+
|
|
393
|
+
S2[Step 2: Output outline\nUser confirms] -->|Must be main agent| USER[User]
|
|
394
|
+
USER -->|Confirm| S3
|
|
395
|
+
|
|
396
|
+
S3[Step 3: Write] -->|subAgent=true may parallelize| SUB2[Sub-agent]
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
User dialogue only flows through the main agent · confirmation decisions cannot bypass the user · sub-agents only execute, never decide
|
|
402
|
+
|
|
403
|
+
#### 3. Skills can override global subAgent configuration
|
|
404
|
+
|
|
405
|
+
```
|
|
406
|
+
flow2spec.config.json f2s-req-clarify SKILL.md
|
|
407
|
+
subAgent: true This skill does not split by default:
|
|
408
|
+
regardless of subAgent value,
|
|
409
|
+
the clarification process stays
|
|
410
|
+
entirely in the main session
|
|
411
|
+
|
|
412
|
+
Rationale: requirement clarification depends heavily on continuous same-session follow-up
|
|
413
|
+
splitting would break context, degrading clarification quality
|
|
414
|
+
```
|
|
415
|
+
|
|
416
|
+
Global configuration is the upper bound for allowing splits · each skill decides for itself whether splitting is appropriate · config being true does not guarantee splitting
|
|
417
|
+
|
|
418
|
+
#### 4. f2s-kb-sync: outline first, write after confirmation
|
|
419
|
+
|
|
420
|
+
```mermaid
|
|
421
|
+
graph LR
|
|
422
|
+
T[Trigger f2s-kb-sync] --> O[Output update outline]
|
|
423
|
+
O --> U{User confirms}
|
|
424
|
+
U -->|Confirm| W[Write to .Knowledge/]
|
|
425
|
+
U -->|Modify| O
|
|
426
|
+
U -->|Cancel| STOP[No write]
|
|
427
|
+
```
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
Writing is a destructive operation · the outline is the user's only chance to correct · nothing is written before confirmation
|
|
432
|
+
|
|
433
|
+
#### 5. Zero-input inference
|
|
434
|
+
|
|
435
|
+
```
|
|
436
|
+
f2s-kb-sync three input modes
|
|
437
|
+
|
|
438
|
+
Mode 1: User explicitly provides capability list "Sync the refund state machine into the knowledge base"
|
|
439
|
+
Mode 2: User provides supplementary materials @src/refund/ @docs/proposal.md
|
|
440
|
+
Mode 3: Zero input "f2s-kb-sync" (just this one sentence)
|
|
441
|
+
↓
|
|
442
|
+
Agent infers based on session context
|
|
443
|
+
what was implemented and what is worth consolidating
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
Session context itself is an information source · no need for users to organize and re-input
|
|
447
|
+
|
|
448
|
+
#### 5.1 How execution switches reach the Agent (multi-platform prompts)
|
|
449
|
+
|
|
450
|
+
`flow2spec.config.json` determines **`subAgent` / `switchAgentVerification` / `changeTracking`**, but AI products **do not guarantee** that the file is automatically opened at session start. The design uses **multiple weak constraint layers** to reduce the probability of "running `f2s-*` without reading the config", while avoiding maintaining a verbose duplicate of `.codex/topics/f2s-config-check.md` in `.Knowledge`:
|
|
451
|
+
|
|
452
|
+
| Mechanism | Design Intent |
|
|
453
|
+
| --- | --- |
|
|
454
|
+
| **Cursor `f2s-config-check.mdc`** | Rule-layer enforcement: "Read before skill body." |
|
|
455
|
+
| **Claude `f2s-config-inject` PreToolUse** | Injects parsed results when calling **`f2s-*` Skill**; **missing file / broken JSON / hook exception** still outputs a note with default semantics, no silent failure. |
|
|
456
|
+
| **Codex `AGENTS.md` + `renderProjectConfigBlock`** | Top-level **Read** hard constraint + **init snapshot table** (if inconsistent with disk, Read takes precedence). |
|
|
457
|
+
| **Knowledge base `config-precheck` topic** | When routing hits, provides only **summary** and a pointer to the Codex full text, **not** a substitute for Read JSON. |
|
|
458
|
+
|
|
459
|
+
**Authority remains** the **Read** result of the project-root JSON; each layer is a prompt, not a second source of truth. For the complete operational table and paths, see **[Usage Guide § 1. `f2s-*` and `flow2spec.config.json`](./usage-guide.en.md)**.
|
|
460
|
+
|
|
461
|
+
#### 6. Skills don't restate unified entry rules, only reference them
|
|
462
|
+
|
|
463
|
+
```
|
|
464
|
+
Each SKILL.md's orchestration section reads:
|
|
465
|
+
|
|
466
|
+
subAgent / switchAgentVerification semantics
|
|
467
|
+
are defined in the unified entry as the sole source of truth,
|
|
468
|
+
not restated here.
|
|
469
|
+
↓
|
|
470
|
+
Cursor/Claude → rules/f2s-flow2spec-unified-entry.*
|
|
471
|
+
Codex → .codex/topics/f2s-flow2spec-unified-entry.md
|
|
472
|
+
|
|
473
|
+
15 skills, each only writes its own unique orchestration constraints
|
|
474
|
+
Common rules are defined in one place; modifying one location affects all
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
---
|
|
478
|
+
|
|
479
|
+
### E. Pluggable Architecture
|
|
480
|
+
|
|
481
|
+
#### 1. Tools are pluggable: one knowledge base, any tool combination
|
|
482
|
+
|
|
483
|
+
```
|
|
484
|
+
flow2spec init cursor claude codex ← all three tools installed
|
|
485
|
+
flow2spec init claude ← only Claude
|
|
486
|
+
flow2spec init cursor codex ← skip Claude
|
|
487
|
+
|
|
488
|
+
.Knowledge/ stays the same, tools can be added or removed at any time
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
The same `.Knowledge/` drives all tools · adding/removing tools does not affect knowledge content · new tools integrate with zero rebuild
|
|
492
|
+
|
|
493
|
+
#### 2. Knowledge topics are pluggable: add/remove without side effects
|
|
494
|
+
|
|
495
|
+
```
|
|
496
|
+
Adding a topic Removing a topic
|
|
497
|
+
───────────────────── ─────────────────────
|
|
498
|
+
1. Write topics/xxx.md f2s-ctx-rm stock-docs/xxx.md
|
|
499
|
+
2. Write matchers/m-xxx.json ↓
|
|
500
|
+
3. Register in manifest-routing Automatically cleans up topics/ + manifest
|
|
501
|
+
+ index references
|
|
502
|
+
|
|
503
|
+
Other topics remain completely unaffected
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
New topics simply declare dependencies in `topicDependencies` · if they don't, they're independent · removal has no side effects
|
|
507
|
+
|
|
508
|
+
#### 3. Skills are pluggable: self-contained units, project-level overrides package-level
|
|
509
|
+
|
|
510
|
+
```
|
|
511
|
+
Package-level skills (shipped with flow2spec init) Project-level skills (placed in config root/skills/)
|
|
512
|
+
|
|
513
|
+
f2s-kb-sync/SKILL.md my-domain-skill/SKILL.md
|
|
514
|
+
f2s-doc-arch/SKILL.md my-review-skill/SKILL.md
|
|
515
|
+
...
|
|
516
|
+
|
|
517
|
+
If names don't conflict they coexist · same name → project-level overrides package-level · they're unaware of each other
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
Skills describe their own trigger words via the `description` field · no registry needed · no global config changes needed · effective upon deployment
|
|
521
|
+
|
|
522
|
+
#### 4. Routing vocabulary is pluggable: shard isolation, local updates
|
|
523
|
+
|
|
524
|
+
Vocabulary changes only modify the corresponding `matchers/m-xxx.json`, with zero diff for other routes; see structure in "[A. Routing and Context Loading → matchers sharding](#1-matchers-sharded-not-embedded-in-manifest)".
|
|
525
|
+
|
|
526
|
+
Vocabulary changes are localized · merge conflicts are minimized · new routes don't affect existing ones
|
|
527
|
+
|
|
528
|
+
#### 5. Execution model is pluggable: config switches per project
|
|
529
|
+
|
|
530
|
+
```
|
|
531
|
+
flow2spec.config.json
|
|
532
|
+
|
|
533
|
+
subAgent: false → main agent throughout, low overhead, suitable for small projects
|
|
534
|
+
subAgent: true → allow sub-agent parallelization, suitable for large-scale changes
|
|
535
|
+
|
|
536
|
+
switchAgentVerification: false → writer-side self-verify, daily use
|
|
537
|
+
switchAgentVerification: true → cross-verification, high-confidence critical scenarios
|
|
538
|
+
|
|
539
|
+
changeTracking.feat/fix/implement: false → no task checklist created
|
|
540
|
+
changeTracking.feat/fix/implement: true → automatic task checklist creation when corresponding skills run, supporting cross-session continuation
|
|
541
|
+
|
|
542
|
+
Three orthogonal dimensions · each skill can further refine and override global config
|
|
543
|
+
```
|
|
544
|
+
|
|
545
|
+
Change one line of config to switch execution strategy · no skill files need modification · new projects work out of the box, existing projects upgrade on demand
|
|
546
|
+
|
|
547
|
+
---
|
|
548
|
+
|
|
549
|
+
## Strengths and Limitations
|
|
550
|
+
|
|
551
|
+
```
|
|
552
|
+
✅ Strengths ⚠️ Limitations
|
|
553
|
+
|
|
554
|
+
Precise context Upfront investment: knowledge must be built via skills
|
|
555
|
+
└─ Routing loads only relevant docs Scale threshold: overhead > benefit for small projects
|
|
556
|
+
|
|
557
|
+
Cross-tool sharing Requires team discipline
|
|
558
|
+
└─ Write knowledge once, use in all └─ Skills reduce friction, don't eliminate it
|
|
559
|
+
|
|
560
|
+
Tool-agnostic Learning curve
|
|
561
|
+
└─ Switch tools without rebuilding └─ stock/req boundary, routing structure aren't intuitive
|
|
562
|
+
|
|
563
|
+
Sustainable
|
|
564
|
+
└─ Maintenance tied to development actions
|
|
565
|
+
```
|
|
566
|
+
|
|
567
|
+
---
|
|
568
|
+
|
|
569
|
+
## Who Is It For
|
|
570
|
+
|
|
571
|
+
```
|
|
572
|
+
Project Scale
|
|
573
|
+
Small ◄──────────► Large
|
|
574
|
+
┌──────────┬────────────┐
|
|
575
|
+
Short │ Not │ Can use │
|
|
576
|
+
Term │ needed │ │
|
|
577
|
+
├──────────┼────────────┤
|
|
578
|
+
Long │ Can use │ Highly │
|
|
579
|
+
Term │ │ recommended│
|
|
580
|
+
└──────────┴────────────┘
|
|
581
|
+
|
|
582
|
+
Best suited when: has scale · long-term iteration · multi-tool or multi-person AI collaboration
|
|
583
|
+
```
|
|
584
|
+
|
|
585
|
+
---
|
|
586
|
+
|
|
587
|
+
## Related Documents
|
|
588
|
+
|
|
589
|
+
- [Usage Guide](./usage-guide.en.md)
|
|
590
|
+
- [Commands Reference](./commands-reference.en.md)
|
|
591
|
+
- [Architecture](./architecture.en.md)
|
|
592
|
+
- [Usage Scenarios](./usage-scenarios.en.md)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
[中文](./README-目录与路径约定.md) | [English](./directory-conventions.en.md)
|
|
2
|
+
|
|
3
|
+
# Directory and Path Conventions
|
|
4
|
+
|
|
5
|
+
## Core Boundary
|
|
6
|
+
|
|
7
|
+
- `.Knowledge/`: Business knowledge documents and index only
|
|
8
|
+
- `Config Root` (`.cursor/.claude/.codex`): Rules and skill entry points
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Directory Responsibilities
|
|
13
|
+
|
|
14
|
+
| Path | Responsibility |
|
|
15
|
+
| --- | --- |
|
|
16
|
+
| `.Knowledge/stock-docs/` | Architecture, final drafts, reference documents |
|
|
17
|
+
| `.Knowledge/req-docs/` | Requirement clarification, technical proposals |
|
|
18
|
+
| `.Knowledge/topics/` | Topic routing documents (for rules and workflow execution) |
|
|
19
|
+
| `.Knowledge/template/` | Templates for final drafts / technical proposals |
|
|
20
|
+
| `.Knowledge/index.md` | Human-readable index |
|
|
21
|
+
| `.Knowledge/manifest-routing.json` | Machine-readable routing skeleton (task/topic/dependencies) |
|
|
22
|
+
| `.Knowledge/matchers/*.json` | Keyword fragments (`id/includeAny`), directly linked by `manifest-routing.taskToTopicRules[].matcherPath` |
|
|
23
|
+
| `.Knowledge/migration-report.md` | Migration comparison table and deletion path list written by `f2s-kb-migrate` |
|
|
24
|
+
| `.task/` | Change tracking task directory (`active/` for in-progress, `completed/` for archived with directory name in the format **`<YYYYMMDD>-<task-name>`** (date first), `todo.json` for active task index); created only when `changeTracking.*` is `true` or `f2s-req-plan` is explicitly invoked |
|
|
25
|
+
| `Config Root/rules/` | Rule files (Cursor `.mdc`, Claude `.md`) |
|
|
26
|
+
| `Config Root/skills/` | Skill definitions (`SKILL.md`) |
|
|
27
|
+
| `Config Root/template/` | (Deprecated) No longer written to; historical directories may be cleaned up |
|
|
28
|
+
| `.codex/AGENTS.md` | Codex unified entry point and loading instructions |
|
|
29
|
+
| `flow2spec.config.json` | Project root configuration, controls `subAgent`, `switchAgentVerification`, `changeTracking` (nested object with `feat` / `fix` / `implement` sub-items) |
|
|
30
|
+
|
|
31
|
+
> See [Usage Guide Section 1](./usage-guide.en.md) for multi-platform references and path tables (detail maintained in a single table); **the authoritative source remains `Read(flow2spec.config.json)`**.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Path Constraints
|
|
36
|
+
|
|
37
|
+
1. `.Knowledge/topics` is the knowledge routing topic layer; it is allowed and encouraged to be maintained via `f2s-*` skills.
|
|
38
|
+
2. `f2s-ctx-build` reads from `.Knowledge/stock-docs` and updates `.Knowledge/topics`, `.Knowledge/index.md`, `.Knowledge/manifest-routing.json`, `.Knowledge/matchers/*.json`.
|
|
39
|
+
3. Implementation tasks uniformly read from `.Knowledge/req-docs/*.md`.
|
|
40
|
+
4. `manifest-routing.json` and `matchers/*.json` are maintained by `f2s-*` skill workflows; `.Knowledge/manifest-matchers.json` is no longer used (`flow2spec init` will delete legacy files).
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Related Documents
|
|
45
|
+
|
|
46
|
+
- [Usage Guide](./usage-guide.en.md)
|
|
47
|
+
- [Commands Reference](./commands-reference.en.md)
|
|
48
|
+
- [Architecture](./architecture.en.md)
|
|
49
|
+
- [Usage Scenarios](./usage-scenarios.en.md)
|