@double-codeing/flow2spec 3.0.8 → 3.0.11
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 -80
- package/cli.js +36 -1
- package/docs/README-/345/221/275/344/273/244/350/257/264/346/230/216.md +227 -71
- package/docs/architecture.en.md +122 -0
- package/docs/commands-reference.en.md +651 -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/knowledge/manifest-routing.json +3 -0
- package/templates/rules/f2s-task.mdc +8 -0
- package/templates/skills/f2s-ctx-build/SKILL.md +1 -0
- package/templates/skills/f2s-req-plan/SKILL.md +101 -58
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
[中文](./README-体系与原理.md) | [English](./architecture.en.md)
|
|
2
|
+
|
|
3
|
+
# Architecture & Principles
|
|
4
|
+
|
|
5
|
+
Flow2Spec's goal is to separate "business knowledge curation" from "Agent capability loading":
|
|
6
|
+
|
|
7
|
+
- **Knowledge layer**: `.Knowledge` (documents and index)
|
|
8
|
+
- **Execution layer**: config root `rules/skills` (natively loaded by each tool)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 1. Two-Layer Structure
|
|
13
|
+
|
|
14
|
+
| Layer | Location | Role |
|
|
15
|
+
| --- | --- | --- |
|
|
16
|
+
| Knowledge layer | `.Knowledge/` | Stores business documents, index, routing |
|
|
17
|
+
| Execution layer | `.cursor/.claude/.codex` | Stores rules and skill entry points |
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## 2. Progressive Reading
|
|
22
|
+
|
|
23
|
+
The recommended unified order:
|
|
24
|
+
|
|
25
|
+
1. `.Knowledge/manifest-routing.json`
|
|
26
|
+
2. `.Knowledge/matchers/<matcher>.json` (on demand: directly located by `manifest-routing.taskToTopicRules[].matcherPath`)
|
|
27
|
+
3. `.Knowledge/index.md`
|
|
28
|
+
4. The matched `stock-docs` / `req-docs` documents
|
|
29
|
+
5. Source code drill-down when necessary
|
|
30
|
+
|
|
31
|
+
After reading, execute the four-step pipeline `match -> expand -> verify -> act`: expand dependency topics after hitting the primary candidate, perform gap analysis, execute only when confidence is sufficient; clarify first when confidence is low.
|
|
32
|
+
|
|
33
|
+
Simultaneously, loading behavior is governed by the config root entry points (Flow2Spec package rules: `f2s-flow2spec-unified-entry.mdc` / `f2s-flow2spec-unified-entry.md`; legacy business repos commonly use `main.md(c)`; and `AGENTS.md`).
|
|
34
|
+
Codex does not read the `rules/` directory; execution constraints are carried through `.codex/AGENTS.md` + `skills/`.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 3. Key Chains
|
|
39
|
+
|
|
40
|
+
- Documentation curation chain: `f2s-doc-arch` -> `f2s-doc-final` -> `f2s-ctx-build`
|
|
41
|
+
- Implementation chain: `.Knowledge/req-docs/*.md` -> `implement-tech-design` -> code
|
|
42
|
+
- Maintenance chain: `f2s-kb-fix` / `f2s-kb-feat` / `f2s-kb-sync` / `f2s-kb-merge`
|
|
43
|
+
- Requirements planning chain: `f2s-req-plan` (planning + implementation, always creates task checklist)
|
|
44
|
+
- Change tracking chain: `changeTracking.*` config -> `f2s-task` rules (automatic) -> `.task/` task checklist -> cross-session continuation
|
|
45
|
+
- Package template/routing shape alignment with config root: `f2s-kb-upgrade` (**do not** equate running `flow2spec init` alone with "knowledge base upgrade"); migrate legacy repo structure into `.Knowledge`: `f2s-kb-migrate`
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 4. Agent Execution Model
|
|
50
|
+
|
|
51
|
+
Flow2Spec controls execution behavior through two fields in the project root `flow2spec.config.json`: `subAgent` and `switchAgentVerification`.
|
|
52
|
+
|
|
53
|
+
**How the Agent reads the above truth values**: multi-end prompts + **Read** as authority, see [usage-guide.en.md § 1 (the only detailed table)](./usage-guide.en.md); design summary see [design-principles.en.md § 4, 5.1](./design-principles.en.md).
|
|
54
|
+
|
|
55
|
+
### 4.1 Primary/Sub Agent Responsibility Division Principle
|
|
56
|
+
|
|
57
|
+
**`subAgent: false` (default)**: All `f2s-*` skills execute sequentially within the primary agent, no parallel decomposition.
|
|
58
|
+
|
|
59
|
+
**`subAgent: true`**: When the scale threshold agreed upon in the skill body is reached, sub-agents may be spawned for parallel processing. Responsibility boundaries are as follows:
|
|
60
|
+
|
|
61
|
+
| Role | Responsibility Boundary |
|
|
62
|
+
|------|----------|
|
|
63
|
+
| Primary agent | Overall planning, determining task granularity and allocation strategy, aggregating sub-agent output, verifying cross-unit consistency, final write-to-disk |
|
|
64
|
+
| Sub agent | Processes the assigned unit (module/document/topic), outputs results in the agreed format, does not make cross-unit decisions |
|
|
65
|
+
|
|
66
|
+
The decomposition boundaries for sub-agents are progressively defined by each `f2s-*` skill body (e.g., thresholds for module count, document count, code line count). **There is currently no unified stage table at the template layer**; the skill body takes precedence.
|
|
67
|
+
|
|
68
|
+
### 4.2 Verification Ownership Principle
|
|
69
|
+
|
|
70
|
+
**Default (whoever writes to disk verifies)**: Verification after write-to-disk or changes is performed within the agent that wrote to disk. If a sub-agent wrote, the sub-agent self-verifies; if the primary agent wrote, the primary agent self-verifies.
|
|
71
|
+
|
|
72
|
+
**Cross-verification (`switchAgentVerification: true`)**: The counterpart agent bears the verification responsibility, suitable for scenarios requiring higher confidence. The enabling conditions must be **satisfied simultaneously**:
|
|
73
|
+
|
|
74
|
+
1. Configuration `switchAgentVerification: true`
|
|
75
|
+
2. The currently executing `f2s-*` skill body **explicitly states** that the step depends on this field
|
|
76
|
+
|
|
77
|
+
Cross-verification rules:
|
|
78
|
+
|
|
79
|
+
| Writer | Verifier | Prerequisite |
|
|
80
|
+
|--------|--------|----------|
|
|
81
|
+
| Sub-agent writes | Primary agent verifies | No additional conditions |
|
|
82
|
+
| Primary agent writes | Sub-agent verifies | Requires `subAgent: true` and that sub-tasks have actually been decomposed; otherwise, the primary agent self-verifies |
|
|
83
|
+
|
|
84
|
+
Design intent: Cross-verification introduces an external perspective, reducing the blind spots in the writer's self-verification, but increases execution overhead. It is therefore an explicit opt-in rather than the default behavior.
|
|
85
|
+
|
|
86
|
+
### 4.3 Change Tracking (changeTracking)
|
|
87
|
+
|
|
88
|
+
`changeTracking` is a third dimension independent of `subAgent` / `switchAgentVerification`. It controls whether the skill automatically creates a task checklist that can be continued across sessions during execution.
|
|
89
|
+
|
|
90
|
+
```json
|
|
91
|
+
{
|
|
92
|
+
"changeTracking": {
|
|
93
|
+
"feat": false,
|
|
94
|
+
"fix": false,
|
|
95
|
+
"implement": false
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
- Each skill sub-item is independently controlled and does not affect each other
|
|
101
|
+
- When enabled: automatically checks `.task/todo.json` before skill execution, creates or resumes tasks; automatically archives upon completion
|
|
102
|
+
- Cross-session: when a new session describes related content, the `f2s-task` rule (`alwaysApply`) loads the remaining checklist and corresponding skill context after keyword matching
|
|
103
|
+
- `f2s-req-plan` is not constrained by this configuration and always creates a task checklist
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## 5. Design Benefits
|
|
108
|
+
|
|
109
|
+
1. Share the same business knowledge source across tools
|
|
110
|
+
2. Does not break the rule loading conventions of Claude/Cursor/Codex
|
|
111
|
+
3. Controls task routing and dependencies via `manifest-routing` + `matcherPath` shards (`matchers/*.json`), reducing misreading and full scans
|
|
112
|
+
4. Clear primary/sub-agent responsibility boundaries: the primary agent always holds the global view, sub-agents focus on unit processing, consistency is ensured by the primary agent
|
|
113
|
+
5. Configurable verification ownership: default self-verification by the writer keeps overhead low; cross-verification can be enabled on demand to boost confidence in critical scenarios
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## 6. Related Documents
|
|
118
|
+
|
|
119
|
+
- [Usage Guide](./usage-guide.en.md)
|
|
120
|
+
- [Commands Reference](./commands-reference.en.md)
|
|
121
|
+
- [Directory Conventions](./directory-conventions.en.md)
|
|
122
|
+
- [Usage Scenarios](./usage-scenarios.en.md)
|