@devflow-core/dsh-devflow 0.1.0
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/NOTICE +13 -0
- package/README.md +82 -0
- package/assets/commands/devflow-adversarial.toml +11 -0
- package/assets/commands/devflow-audit.toml +32 -0
- package/assets/commands/devflow-debt.toml +42 -0
- package/assets/commands/devflow-find-fault.toml +11 -0
- package/assets/commands/devflow-learn.toml +21 -0
- package/assets/commands/devflow-plan.toml +58 -0
- package/assets/commands/devflow-prove.toml +20 -0
- package/assets/commands/devflow-pua.toml +40 -0
- package/assets/commands/devflow-review.toml +36 -0
- package/assets/commands/devflow-spec.toml +49 -0
- package/assets/commands/devflow.toml +35 -0
- package/assets/presets/devflow-2/NOTICE +4 -0
- package/assets/presets/devflow-2/README.md +71 -0
- package/assets/presets/devflow-2/agent.cordis.yml +337 -0
- package/assets/presets/devflow-2/custom-bash.mjs +213 -0
- package/assets/presets/devflow-2/preset.yml +3 -0
- package/assets/presets/devflow-2/tool-bootstrap.mjs +496 -0
- package/assets/scripts/devflow-audit.js +275 -0
- package/assets/scripts/devflow-debt.js +196 -0
- package/assets/scripts/devflow-doctor.js +90 -0
- package/assets/scripts/devflow-plan.js +638 -0
- package/assets/scripts/devflow-review.js +93 -0
- package/assets/scripts/devflow-spec.js +238 -0
- package/assets/skills/devflow-adversarial/SKILL.md +71 -0
- package/assets/skills/devflow-audit/SKILL.md +78 -0
- package/assets/skills/devflow-brainstorm/SKILL.md +176 -0
- package/assets/skills/devflow-brainstorm/references/interview-discipline.md +184 -0
- package/assets/skills/devflow-build/SKILL.md +238 -0
- package/assets/skills/devflow-build/references/build-methods.md +40 -0
- package/assets/skills/devflow-core/SKILL.md +93 -0
- package/assets/skills/devflow-core/references/core-methods.md +131 -0
- package/assets/skills/devflow-core/references/reference-projects.md +133 -0
- package/assets/skills/devflow-core/references/skill-guide.md +63 -0
- package/assets/skills/devflow-cut/SKILL.md +208 -0
- package/assets/skills/devflow-cut/references/cut-methods.md +65 -0
- package/assets/skills/devflow-cut/references/native-capability-checklist.md +112 -0
- package/assets/skills/devflow-docs-followup/SKILL.md +132 -0
- package/assets/skills/devflow-docs-followup/agents/openai.yaml +4 -0
- package/assets/skills/devflow-find-fault/SKILL.md +109 -0
- package/assets/skills/devflow-learn/SKILL.md +176 -0
- package/assets/skills/devflow-plan/SKILL.md +142 -0
- package/assets/skills/devflow-plan/references/plan-methods.md +74 -0
- package/assets/skills/devflow-project-knowledge/SKILL.md +354 -0
- package/assets/skills/devflow-prove/SKILL.md +216 -0
- package/assets/skills/devflow-prove/references/code-review-checklist.md +202 -0
- package/assets/skills/devflow-prove/references/flow-self-test.md +775 -0
- package/assets/skills/devflow-prove/references/proof-recovery-methods.md +26 -0
- package/assets/skills/devflow-pua/SKILL.md +197 -0
- package/assets/skills/devflow-pua/references/flavor-display.md +49 -0
- package/assets/skills/devflow-pua/references/methodology-library.md +193 -0
- package/assets/skills/devflow-pua/references/methodology-router.md +78 -0
- package/assets/skills/devflow-spec/SKILL.md +92 -0
- package/assets/skills/devflow-spec/references/spec-plan-methods.md +15 -0
- package/cordis.patch.yml +11 -0
- package/lib/dsh-home.js +33 -0
- package/lib/index.js +79 -0
- package/lib/mount-once.js +34 -0
- package/lib/sync.js +168 -0
- package/package.json +32 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
# DevFlow Brainstorm Interview Discipline
|
|
2
|
+
|
|
3
|
+
Use this reference only while `devflow-brainstorm` clarifies and explores a request. It is not a route, design, planning, recovery, or documentation workflow.
|
|
4
|
+
|
|
5
|
+
## Clarification Loop
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
User request
|
|
9
|
+
-> read minimum relevant facts
|
|
10
|
+
-> Semantic Echo-Back (all fields, even when none)
|
|
11
|
+
-> wait for confirm or correction
|
|
12
|
+
-> one question at a time, each with a recommended answer
|
|
13
|
+
-> mandatory multi-angle exploration and problem-space recommendation
|
|
14
|
+
-> corrected echo-back when understanding changes
|
|
15
|
+
-> fixed Confirmed request summary
|
|
16
|
+
-> user-selected A/B/C gate
|
|
17
|
+
-> A starts Spec; B/C start Cut; missing depth returns facts to Core
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
`devflow-core` consumes only missing-depth, exception, and non-unique facts. This reference presents A/B/C but never selects the depth; the selected branch starts directly.
|
|
21
|
+
|
|
22
|
+
## Clarification Depth
|
|
23
|
+
|
|
24
|
+
Depth governs **analysis breadth only**. It never skips the echo-back, the confirm gates, the question discipline, or the recommendation duty.
|
|
25
|
+
|
|
26
|
+
| Tier | Entry condition | Moves |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| `deep` (default) | Every request, unless the user explicitly asks for a lighter pass. | Full multi-angle checklist with a per-angle report; directions with trade-offs; recommendation. |
|
|
29
|
+
| `standard` | Only on explicit user request for a lighter pass. | Fitting angles instead of the full checklist; every other duty unchanged. |
|
|
30
|
+
|
|
31
|
+
There is no fast lane. When the user asks for speed, compress wording, never gates.
|
|
32
|
+
|
|
33
|
+
## Semantic Echo-Back
|
|
34
|
+
|
|
35
|
+
Start every Brainstorm pass with this understanding check:
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
My understanding:
|
|
39
|
+
- Problem to solve: <one sentence in the user's domain language>
|
|
40
|
+
- Known facts/constraints: <facts read, or none>
|
|
41
|
+
- NOT what you want: <likely misreading ruled out, or none>
|
|
42
|
+
- My assumptions (that could be wrong): <inferences not stated by the user, or none>
|
|
43
|
+
- Understanding gaps: <specific unclear points, or none>
|
|
44
|
+
Is this right? (correct me / confirm)
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Rules:
|
|
48
|
+
|
|
49
|
+
- It is its own message and ends with the confirm-or-correct question.
|
|
50
|
+
- Include all fields, even when a field is `none`.
|
|
51
|
+
- If multiple interpretations are plausible, present the alternatives in the echo-back; do not choose one.
|
|
52
|
+
- Facts from code, configuration, tests, or documentation are stated rather than asked.
|
|
53
|
+
- Business intent and user-visible boundaries are confirmed rather than inferred.
|
|
54
|
+
- If the user corrects the understanding, apply the Understanding Revision Rule below.
|
|
55
|
+
|
|
56
|
+
## Multi-Angle Checklist
|
|
57
|
+
|
|
58
|
+
Mandatory on every request (default `deep`). Walk every angle and report what each found, including "nothing found here" — an explicit negative finding is what makes the summary a reliable anti-hallucination basis:
|
|
59
|
+
|
|
60
|
+
| Angle | Ask yourself |
|
|
61
|
+
|---|---|
|
|
62
|
+
| User value | Who benefits, from what pain? Is the outcome observable? |
|
|
63
|
+
| Edges and exceptions | What inputs, actors, or states break the happy path? |
|
|
64
|
+
| Impact surface | Who or what else is affected — other features, data, users not named in the request? |
|
|
65
|
+
| Reverse thinking | What happens if we do nothing, or do the opposite? |
|
|
66
|
+
| Proportionality | Is the ask sized to the value? Over- or under-scoped? |
|
|
67
|
+
| Hidden assumptions | What must be true for this request to make sense? Is any of it doubtful? |
|
|
68
|
+
|
|
69
|
+
Findings feed the summary: gaps and risks go to `Identified gaps/risks`; direction thinking goes to `Directions considered` and `Recommended direction`. When every angle finds nothing, write `none` in those fields — do not invent findings. If an angle exposes a new decision-impact gap, return to One-Question Discipline and resolve it before producing `Confirmed request`.
|
|
70
|
+
|
|
71
|
+
## Problem-Space Recommendation
|
|
72
|
+
|
|
73
|
+
Expected on every request, not only when asked:
|
|
74
|
+
|
|
75
|
+
- naming gaps, contradictions, risks, and missing stakeholders in the user's request;
|
|
76
|
+
- offering directions the user has not considered, each with trade-offs;
|
|
77
|
+
- recommending one direction with its rationale;
|
|
78
|
+
- recording rejected directions and why they were dropped.
|
|
79
|
+
|
|
80
|
+
Out of bounds — record the need in the summary and leave it to `devflow-spec`:
|
|
81
|
+
|
|
82
|
+
- technical selection, architecture, structure, interface contracts, implementation steps.
|
|
83
|
+
|
|
84
|
+
Boundary test: "what to do / why / what not to do / what could go wrong" stays; "how to implement" goes. In-bounds example: "方向 A 覆盖边界场景但流程更长,方向 B 简单但留下重发风险——推荐 A,因为漏洞主要出在重发。" Out-of-bounds example: "用 Redis 做缓存层,表加两个字段。"
|
|
85
|
+
|
|
86
|
+
Recommendations are disposable conversation material that helps the user decide what they want; they never commit the project to a design.
|
|
87
|
+
|
|
88
|
+
## Understanding Revision Rule
|
|
89
|
+
|
|
90
|
+
When a user correction changes the goal, scope, exclusions, constraints, acceptance, terminology, actor, or a load-bearing assumption, it interrupts the current clarification chain:
|
|
91
|
+
|
|
92
|
+
1. stop the pending question;
|
|
93
|
+
2. update facts, assumptions, and understanding gaps;
|
|
94
|
+
3. send a complete corrected Semantic Echo-Back; and
|
|
95
|
+
4. wait for confirmation before asking another question or producing `Confirmed request`.
|
|
96
|
+
|
|
97
|
+
A correction that changes none of those may receive a direct one-line acknowledgement, but it must not be treated as a confirmed request. Do not silently absorb a correction into a later question or the summary.
|
|
98
|
+
|
|
99
|
+
## One-Question Discipline
|
|
100
|
+
|
|
101
|
+
Ask exactly one question at a time only when a decision-impact gap remains. A question qualifies only when its answer could change scope, a constraint, acceptance, or a subsequent problem-space decision. Resolve qualifying gaps in this order:
|
|
102
|
+
|
|
103
|
+
1. goal ambiguity;
|
|
104
|
+
2. scope boundary;
|
|
105
|
+
3. out-of-scope boundary;
|
|
106
|
+
4. constraint;
|
|
107
|
+
5. acceptance;
|
|
108
|
+
6. remaining open question.
|
|
109
|
+
|
|
110
|
+
Do not ask merely because a category is unfilled: record a fact-backed `none` or non-blocking unknown instead. Stop asking when no decision-impact gap remains and every non-blocking unknown is recorded in `Confirmed request`.
|
|
111
|
+
|
|
112
|
+
Use this shape for every question:
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
Question: <one question>
|
|
116
|
+
Recommended answer: <answer and rationale>
|
|
117
|
+
Why now: <risk or dependency this resolves>
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
After every answer, compare it with confirmed facts and the current request. An answer that introduces a load-bearing assumption, exposes a contradiction, or changes goal, scope, exclusions, constraints, acceptance, terminology, or actor triggers the Understanding Revision Rule before another question or summary. Otherwise, record the answer and continue only if another decision-impact gap remains.
|
|
121
|
+
|
|
122
|
+
Do not ask for an answer that project facts establish. Do not ask a later-category question while an earlier qualifying category remains unclear. Use the user's language; avoid unexplained technical terms.
|
|
123
|
+
|
|
124
|
+
## Ambiguity Signals
|
|
125
|
+
|
|
126
|
+
Treat these as a need to clarify rather than infer:
|
|
127
|
+
|
|
128
|
+
| Signal | Clarify |
|
|
129
|
+
|---|---|
|
|
130
|
+
| Vague quantifier: "better", "faster", "more" | Observable target or threshold |
|
|
131
|
+
| Implicit scope: "add search" | What and where it applies |
|
|
132
|
+
| Pronoun or missing context: "it", "like before" | Exact referent or precedent |
|
|
133
|
+
| Missing actor: "notify" | Sender and recipient |
|
|
134
|
+
| Unstated constraint: "make it fast" | Required metric or limit |
|
|
135
|
+
| Solution-as-goal: "use Redis" | Desired outcome versus mandated tool |
|
|
136
|
+
| Ambiguous boundary: "related changes" | Included and excluded surfaces |
|
|
137
|
+
| Idea request: "有什么办法", "give me options" | Explore directions in the problem space and recommend one |
|
|
138
|
+
|
|
139
|
+
## Fixed Summary
|
|
140
|
+
|
|
141
|
+
When no clarification blocker remains, output exactly this request record and stop:
|
|
142
|
+
|
|
143
|
+
```text
|
|
144
|
+
Confirmed request:
|
|
145
|
+
- Goal: <user outcome>
|
|
146
|
+
- Scope: <included behavior and surfaces>
|
|
147
|
+
- Out of scope: <explicit exclusions>
|
|
148
|
+
- Constraints: <must-not-change conditions, or none>
|
|
149
|
+
- Acceptance: <observable proof of success>
|
|
150
|
+
- Identified gaps/risks: <holes, risks, and blind spots surfaced during exploration, or none>
|
|
151
|
+
- Directions considered: <directions discussed with trade-offs, including rejected ones, or none>
|
|
152
|
+
- Recommended direction: <recommendation and rationale within the problem space, or none>
|
|
153
|
+
- Open questions: <none or unresolved blocker>
|
|
154
|
+
- Status: clarified
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
This summary is the factual basis downstream skills — starting with `devflow-spec` — build on; record findings faithfully. It carries no implementation plan, solution-space design, lifecycle route, or handoff.
|
|
158
|
+
|
|
159
|
+
## A/B/C Gate
|
|
160
|
+
|
|
161
|
+
After the fixed summary, present A, B, and C and wait for the user's explicit depth choice. Record the selected `Depth` with the branch input: A starts Spec and B/C start Cut. A missing or changed depth returns facts to Core.
|
|
162
|
+
|
|
163
|
+
## Anti-Rationalization
|
|
164
|
+
|
|
165
|
+
| Excuse | Reality |
|
|
166
|
+
|---|---|
|
|
167
|
+
| "A paraphrase is enough." | Surface assumptions and specific gaps. |
|
|
168
|
+
| "Ask everything at once." | Ask one question, then wait. |
|
|
169
|
+
| "The codebase answers user intent." | Code answers current facts, not desired behavior. |
|
|
170
|
+
| "Clarification should pick the next skill." | The summary does not choose. Brainstorm presents A/B/C and starts only the user's selected branch. |
|
|
171
|
+
| "A design or document belongs in the summary." | Record the request and exploration findings only. |
|
|
172
|
+
| "The request looks simple, so the checklist can be skipped." | Simple-looking requests hide the most assumptions; report per-angle findings even when they are `none`. |
|
|
173
|
+
| "The user wants speed, so skip a gate." | Compress wording, never gates. Speed comes from fewer real gaps, not skipped structure. |
|
|
174
|
+
|
|
175
|
+
## Verification
|
|
176
|
+
|
|
177
|
+
- [ ] Semantic Echo-Back included all fields, with `none` where a field had no content.
|
|
178
|
+
- [ ] The echo-back was confirmed or corrected before further clarification.
|
|
179
|
+
- [ ] Questions were one at a time, fact-backed, and each used the `Question / Recommended answer / Why now` shape.
|
|
180
|
+
- [ ] The multi-angle checklist ran with per-angle findings, and those findings reached the summary.
|
|
181
|
+
- [ ] Recommendations stayed inside the problem space.
|
|
182
|
+
- [ ] Changed understanding was re-echoed and confirmed before proceeding.
|
|
183
|
+
- [ ] `Confirmed request` includes every fixed field, followed by an explicit A/B/C user gate.
|
|
184
|
+
- [ ] The summary contains no design, route, handoff, documentation, recovery, or implementation instruction.
|
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: devflow-build
|
|
3
|
+
description: "Use when implementing an approved plan, applying Karpathy-style minimal changes, fixing code, refactoring narrowly, creating implementation slices, touching files surgically, or keeping every diff tied to the user goal. Implements only the selected smallest useful solution."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# DevFlow Build
|
|
7
|
+
|
|
8
|
+
Implement only the selected smallest useful solution.
|
|
9
|
+
|
|
10
|
+
## Context
|
|
11
|
+
|
|
12
|
+
Receives a `CUT_PASS` Cut Decision from `devflow-cut`, either through the direct A/B/C success edge or a Core-selected non-unique path.
|
|
13
|
+
|
|
14
|
+
- Depth A/B input: `CUT_PASS` plus a user-approved Plan Pack at `docs/plans/YYYY-MM-DD-<short-kebab-name>.md`. Confirm the plan stays within the recorded Cut scope; re-run only affected Cut gates if the plan introduces scope, dependency, abstraction, or file-responsibility drift.
|
|
15
|
+
- Depth C input: `CUT_PASS` plus the approved design contract; no Plan Pack is required.
|
|
16
|
+
|
|
17
|
+
When no plan file exists, the approved design and Cut Decision form the Build Contract basis; skip the plan checker.
|
|
18
|
+
## Plan Review
|
|
19
|
+
|
|
20
|
+
Load `skills/devflow-build/references/build-methods.md` after this review and before implementation slices. It owns the detailed minimal-change and slice discipline.
|
|
21
|
+
|
|
22
|
+
Before editing, reconcile the plan against the current codebase — executability review, not redesign:
|
|
23
|
+
|
|
24
|
+
1. Anchors: every `Modify` symbol/anchor and interface in the plan still exists and matches.
|
|
25
|
+
2. Behavior: each task's `Current behavior` still describes the code.
|
|
26
|
+
3. Steps: unambiguous, with verification commands that can run in this environment.
|
|
27
|
+
4. Skills: every skill declared in `External Skills` (Cut Decision or plan header) is actually loaded through the platform's skill mechanism, or the reason it does not apply is recorded; loading alone is not completion — Build requires the specialist's returned result, not-applicable, or failure facts. A specialist result implying structure outside the approved scope returns scope-drift facts to `devflow-core`, not silent adoption.
|
|
28
|
+
|
|
29
|
+
Any failed check, unclear instruction, or critical gap: stop and return `BUILD_BLOCKED` with the facts to `devflow-core`. Do not guess, do not silently repair the plan. Reviewing fidelity is not re-deciding the mechanism.
|
|
30
|
+
|
|
31
|
+
For Depth C (no Plan Pack), run the same review against the approved design contract: confirm the symbols and behaviors it names still exist. Depth C keeps Build freedom inside the Cut Decision; it does not skip this review or the Stop Protocol.
|
|
32
|
+
|
|
33
|
+
## Build Contract
|
|
34
|
+
|
|
35
|
+
Before editing, state:
|
|
36
|
+
|
|
37
|
+
```text
|
|
38
|
+
Goal: ...
|
|
39
|
+
Will touch: <files/modules>
|
|
40
|
+
Not doing: ...
|
|
41
|
+
Skills loaded: <skill-name> / none
|
|
42
|
+
Standards: 可选——引用 code-standards 条目编号
|
|
43
|
+
Narrowest verification: ...
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
If work touches more than one file or one logical step, create Implementation Slices.
|
|
47
|
+
|
|
48
|
+
## Plan Pack
|
|
49
|
+
|
|
50
|
+
When saving a plan file, use `docs/plans/YYYY-MM-DD-<short-kebab-name>.md`, resolved from the current target project's root, unless that project already documents another plan/spec path. Do not save implementation plans under `docs/features/`; that directory is for feature ledgers.
|
|
51
|
+
|
|
52
|
+
For multi-step work, tasks must cite the approved source, be small and verifiable, and follow the required task contract (Task: / Task type: / Files: / Interfaces: / Current behavior: / Target behavior: / Change mechanics: / Call impact: / Steps: / Acceptance: / Verify: / Comments: / Not doing:) defined in `skills/devflow-plan/SKILL.md`.
|
|
53
|
+
|
|
54
|
+
No unresolved markers. For `Code change`, follow the recorded file symbol/anchor, `Current behavior`, `Target behavior`, `Change mechanics`, and `Call impact`; do not re-decide the implementation mechanism in Build. The verification step must retain its trigger/input, expected result, and command or manual scenario. `Documentation-only` applies only to tasks with no runtime code files and explicit `documentation-only` interfaces. No "add tests" without naming the behavior. No "handle edge cases" without naming the edge case. No "similar to Task N" shortcuts; repeat enough detail for each task to stand alone.
|
|
55
|
+
|
|
56
|
+
Before Build, run `node scripts/devflow-plan.js <plan-file>` when a plan is saved to a file. If not found at `scripts/devflow-plan.js` (project-level), try `~/.codex/scripts/devflow-plan.js` or `~/.claude/scripts/devflow-plan.js` (user-level). Do NOT look under `skills/scripts/`. See `core-methods.md` Script Path Resolution.
|
|
57
|
+
|
|
58
|
+
## Implementation Slices
|
|
59
|
+
|
|
60
|
+
```text
|
|
61
|
+
Implementation Slices:
|
|
62
|
+
- Slice 1: files / change / per-slice verification
|
|
63
|
+
- Slice 2: files / change / per-slice verification
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Rules:
|
|
67
|
+
|
|
68
|
+
- Keep each slice independently understandable.
|
|
69
|
+
- Prefer a slice that can run a focused check before the next slice.
|
|
70
|
+
- Merge slices that cannot be verified separately.
|
|
71
|
+
- Do not add work removed by `devflow-cut`.
|
|
72
|
+
|
|
73
|
+
#### Slice 自检清单
|
|
74
|
+
|
|
75
|
+
每个 slice 输出后逐项自检(八大原则):
|
|
76
|
+
|
|
77
|
+
1. 最小切片——一次只改一件事,本 slice 可独立理解。
|
|
78
|
+
2. 参考项目规范——声明遵循的 code-standards 条目(如分层红线/缓存策略)。
|
|
79
|
+
3. 复用现有能力——不重复造轮子,先查项目复用点。
|
|
80
|
+
4. 分层清晰——实体/服务/控制分离,不越层。
|
|
81
|
+
5. 缓存语义正确——读查缓存、写失效缓存。
|
|
82
|
+
6. 可读性——方法短、命名表意。
|
|
83
|
+
7. 副作用隔离——授权/持久化/缓存/远程调用不隐藏在无标注块内。
|
|
84
|
+
8. 可证明——本 slice 有可运行的最小验证。
|
|
85
|
+
|
|
86
|
+
## Execution Mode
|
|
87
|
+
|
|
88
|
+
The plan's `Execution mode` (`sequential` | `single-subagent` | `fan-out`) is chosen at Plan approval and passed to Build; Build does not re-decide it. `sequential` runs tasks in dependency order as the Build agent itself; `single-subagent` delegates the whole plan to one executor subagent while the main agent only schedules; `fan-out` runs independent tasks as parallel subagents and dependent tasks in sequence after their inputs land.
|
|
89
|
+
|
|
90
|
+
### Single-subagent dispatch
|
|
91
|
+
|
|
92
|
+
- The main agent does not execute tasks. It dispatches the whole approved Plan Pack to one executor subagent, waits for the return, and then merges the returned evidence and enters Prove once.
|
|
93
|
+
- The subagent runs all tasks in dependency order inside one context under the same Plan Review and Prewalk read discipline, appends actual evidence to the plan's Execution Trace, and returns the merged task results and evidence, or `BUILD_BLOCKED` facts.
|
|
94
|
+
- The main agent may send one bounded follow-up when the return misses evidence; anything still incomplete is returned to `devflow-core` as `BUILD_BLOCKED` facts. The subagent never declares done, never enters Prove, and never re-decides the mode or the Cut scope.
|
|
95
|
+
|
|
96
|
+
### Fan-out dispatch
|
|
97
|
+
|
|
98
|
+
- Two tasks may run in parallel only when their `Files` touch disjoint file/symbol sets and neither `Interfaces` consumes a symbol the other `Produces`; otherwise run the producer first.
|
|
99
|
+
- Each subagent runs one task contract under the same Plan Review and Prewalk read discipline, and returns the task result or `BUILD_BLOCKED` facts.
|
|
100
|
+
- The main agent merges returned results, reconciles cross-task file overlap, runs the unified `Diff Self-Check`, and enters `devflow-prove` once with merged evidence — never per-subagent.
|
|
101
|
+
|
|
102
|
+
`single-subagent` and `fan-out` are scheduling only; they do not change Plan Review, Stop Protocol, Cut scope, or the single Prove gate.
|
|
103
|
+
|
|
104
|
+
## Source Check
|
|
105
|
+
|
|
106
|
+
When correctness depends on a framework/library/API version:
|
|
107
|
+
|
|
108
|
+
1. Detect the stack/version from dependency files.
|
|
109
|
+
2. Prefer official docs or local project docs.
|
|
110
|
+
3. If official/current docs cannot be checked, mark the pattern as unverified.
|
|
111
|
+
4. If docs conflict with existing project style, surface the conflict.
|
|
112
|
+
|
|
113
|
+
Output:
|
|
114
|
+
|
|
115
|
+
```text
|
|
116
|
+
Source Check: <version/source checked or unverified>; decision <why>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Surgical Rules
|
|
120
|
+
|
|
121
|
+
- Touch only files required by the user goal.
|
|
122
|
+
- Match the existing project style.
|
|
123
|
+
- Do not refactor unrelated code.
|
|
124
|
+
- Do not add speculative flexibility.
|
|
125
|
+
- Do not add a new abstraction for one caller.
|
|
126
|
+
- Remove only unused code created by your own change.
|
|
127
|
+
- Keep each change small enough to verify.
|
|
128
|
+
- If a changed line cannot be tied to the user goal, remove it.
|
|
129
|
+
- For bug fixes, prefer the shared root-cause fix after caller/reference search; do not patch only the named symptom when sibling callers remain broken.
|
|
130
|
+
- If you keep an intentional simplification with a known ceiling, add `devflow: <ceiling>, revisit when <trigger>` near the shortcut.
|
|
131
|
+
|
|
132
|
+
## Code Comment Discipline
|
|
133
|
+
|
|
134
|
+
Comments are part of the implementation, not an afterthought. The spec's Code Documentation section and the plan's Comments field define what needs documentation — this section enforces it during Build.
|
|
135
|
+
|
|
136
|
+
### What needs comments
|
|
137
|
+
|
|
138
|
+
| Code element | When | What to write |
|
|
139
|
+
|---|---|---|
|
|
140
|
+
| New file or function | When the approved Spec/Plan, project convention, public contract, or a non-obvious decision requires explanation | Explain the decision, protected contract, failure condition, or purpose that code alone does not make clear |
|
|
141
|
+
| Changed function (logic change) | When it changes an existing documented contract or introduces a non-obvious reason | Update the relevant explanation or add a concise WHY comment |
|
|
142
|
+
| Non-obvious logic | When the WHY is not clear from the code | Inline comment: explain the reasoning, not the mechanics |
|
|
143
|
+
| Business rule in code | When code encodes a domain rule | Inline comment: which business rule, who defined it, link to spec if possible |
|
|
144
|
+
| Workaround/fix | When fixing a bug or working around a limitation | Inline comment: what was broken, what the fix does, link to issue if possible |
|
|
145
|
+
| Config/constant | When value is non-obvious | Inline comment: why this value, what it controls |
|
|
146
|
+
|
|
147
|
+
### Comment rules
|
|
148
|
+
|
|
149
|
+
- **Explain WHY, not WHAT.** `// increment counter` is noise. `// retry counter: stop after 3 to avoid locking the account` is useful.
|
|
150
|
+
- **Match the project's existing comment style and language.** If the project uses JSDoc, use JSDoc. If comments are in Chinese, write in Chinese.
|
|
151
|
+
- **Make required comments durable.** A developer or LLM reading the code later should understand the documented decision and boundary without reconstructing it from history.
|
|
152
|
+
- **Do not comment obvious code.** `let x = 1` does not need a comment. But `let x = 1 // start from 1, not 0, because the API is 1-indexed` is useful if the 1-indexing is non-obvious.
|
|
153
|
+
- **Update comments when you change the code they describe.** Remove or correct stale comments; do not preserve incorrect explanations merely because a comment once existed.
|
|
154
|
+
|
|
155
|
+
### Comment output check
|
|
156
|
+
|
|
157
|
+
After implementation, before Diff Self-Check, verify:
|
|
158
|
+
|
|
159
|
+
```text
|
|
160
|
+
Comment Check:
|
|
161
|
+
- Required by Spec/Plan/project convention: <locations and reason, or none>
|
|
162
|
+
- Required comment present: <yes/no per location>
|
|
163
|
+
- Non-obvious decisions or boundaries: <locations and reason, or none>
|
|
164
|
+
- Inline comment present: <yes/no per location>
|
|
165
|
+
- Comment style: matches project / N/A
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
If a specified or triggered comment is missing, add it before proceeding to Diff Self-Check.
|
|
169
|
+
|
|
170
|
+
## Testing Rule
|
|
171
|
+
|
|
172
|
+
- Behavior-changing code: prefer a focused test or reproducible scenario.
|
|
173
|
+
- Bug fix: prove the original symptom or add a regression check when feasible.
|
|
174
|
+
- Docs/rules/skills: validate required wording, frontmatter, links/paths, and scenarios.
|
|
175
|
+
- Static text-only changes can use search-based verification.
|
|
176
|
+
|
|
177
|
+
## Diff Self-Check
|
|
178
|
+
|
|
179
|
+
After editing, run:
|
|
180
|
+
|
|
181
|
+
```text
|
|
182
|
+
Diff Check: Does each change directly serve the goal? Per file: Goal link / Behavior changed / Why this file / Verification.
|
|
183
|
+
Style Check: Does it match existing style?
|
|
184
|
+
Scope Check: Does it include unrequested behavior or drive-by refactor?
|
|
185
|
+
Verification Check: Is there a narrow runnable proof?
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
If any file has no goal link, remove that change.
|
|
189
|
+
|
|
190
|
+
## Anti-Rationalization
|
|
191
|
+
|
|
192
|
+
| Excuse | Reality |
|
|
193
|
+
|---|---|
|
|
194
|
+
| "I'll clean this nearby thing too." | Note it separately; do not mix it into this diff. |
|
|
195
|
+
| "A helper makes it nicer." | One caller is not enough unless local convention requires it. |
|
|
196
|
+
| "We'll verify everything at the end." | Verify slices when focused checks exist. |
|
|
197
|
+
| "Docs changes do not need proof." | Docs/rules/skills need validation just like code. |
|
|
198
|
+
| "The issue only mentions one caller." | Check sibling callers before choosing the fix location. |
|
|
199
|
+
| "The plan is approved, so I just execute." | Plan Review comes first: stale anchors or unclear steps return `BUILD_BLOCKED` to Core. |
|
|
200
|
+
| "I'll infer the missing step." | Guessing past a gap is forbidden; unclear instructions return `BUILD_BLOCKED` facts. |
|
|
201
|
+
| "The code is self-explanatory." | That does not waive a comment required by the approved contract, project convention, or a non-obvious boundary. |
|
|
202
|
+
| "Comments will get stale." | Keep a required comment accurate or remove a stale one; a stale explanation is not a reason to skip a needed decision record. |
|
|
203
|
+
| "I'll add comments after it works." | Add required comments in the same slice so implementation and its stated constraints stay aligned. |
|
|
204
|
+
| "The function name is clear enough." | A clear name can make extra narration unnecessary, but it cannot replace a required WHY, business rule, or compatibility constraint. |
|
|
205
|
+
|
|
206
|
+
## Stop Protocol
|
|
207
|
+
|
|
208
|
+
Stop executing immediately and return `BUILD_BLOCKED` with the blocking facts to `devflow-core` when:
|
|
209
|
+
|
|
210
|
+
- a Plan Review check fails (dead anchor, stale behavior, missing interface, unclear step)
|
|
211
|
+
- a dependency, tool, or declared external skill is missing and the task depends on it, or its returned failure facts block the approved work
|
|
212
|
+
- verification fails repeatedly for the same task
|
|
213
|
+
- the plan has a critical gap that prevents starting or continuing
|
|
214
|
+
|
|
215
|
+
Do not guess, do not force through blockers, and do not broaden scope to escape. Core decides whether to revise the plan, re-clarify with `devflow-brainstorm`, or enter `devflow-pua`.
|
|
216
|
+
|
|
217
|
+
## Handoff Gate
|
|
218
|
+
|
|
219
|
+
Do not say done. A completed Build directly enters `devflow-prove` with:
|
|
220
|
+
|
|
221
|
+
```text
|
|
222
|
+
Proof target: ...
|
|
223
|
+
Suggested command/scenario: ...
|
|
224
|
+
Known unverified: ...
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
## Verification
|
|
228
|
+
|
|
229
|
+
Before leaving this skill, confirm:
|
|
230
|
+
|
|
231
|
+
- [ ] Plan Review passed or concerns were returned to `devflow-core` as `BUILD_BLOCKED`.
|
|
232
|
+
- [ ] Declared external skills were loaded, or the exception reason was recorded in `Skills loaded`.
|
|
233
|
+
- [ ] Build contract exists.
|
|
234
|
+
- [ ] Cut gates passed or were run.
|
|
235
|
+
- [ ] Slices exist when work is multi-step.
|
|
236
|
+
- [ ] Code Comment Discipline check is complete — every Spec/Plan/project-convention or non-obvious-boundary comment requirement is satisfied.
|
|
237
|
+
- [ ] Diff self-check is complete.
|
|
238
|
+
- [ ] Proof command/scenario is ready for `devflow-prove`.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# DevFlow Build Methods
|
|
2
|
+
|
|
3
|
+
Owner: `devflow-build`. Load this reference after C `CUT_PASS`, an approved A/B Plan, or Core selects Build for a non-unique artifact.
|
|
4
|
+
|
|
5
|
+
## Method 11: Karpathy Minimal Change
|
|
6
|
+
|
|
7
|
+
Touch only files necessary for the approved goal. Match project style, preserve contracts, avoid one-caller helpers and speculative options, and remove only code introduced by the current change when it becomes unused.
|
|
8
|
+
|
|
9
|
+
For each changed file record:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
Goal link:
|
|
13
|
+
Behavior changed:
|
|
14
|
+
Why this file:
|
|
15
|
+
Verification:
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Method 12: Implementation Slices
|
|
19
|
+
|
|
20
|
+
Split multi-step work into one to five testable slices. Each slice names files, user-visible or contract behavior, verification, and comment requirements. Verify a slice before moving on whenever a focused check exists.
|
|
21
|
+
|
|
22
|
+
## Readability Outcome Check
|
|
23
|
+
|
|
24
|
+
Before handoff, review changed code from the perspective of a maintainer familiar with the project but not this change. Use names, structure, extraction, comments, and tests as appropriate; do not apply any technique mechanically.
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
Readability Check:
|
|
28
|
+
- Intent: each changed unit has a business-purpose name or locally clear role
|
|
29
|
+
- Rules: important conditions use domain terms or small named predicates
|
|
30
|
+
- Failure paths: invalid, exceptional, and boundary behavior is locally visible
|
|
31
|
+
- Side effects: authorization, persistence, cache changes, remote calls, and response mapping are not hidden in an opaque block
|
|
32
|
+
- Convention: naming, layering, errors, logging, cache, and tests follow the nearest comparable project code, or the deviation is recorded
|
|
33
|
+
- Trade-off: <none or concise reason why this is the clearest safe option>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
A function may contain several steps when they form one coherent business narrative. Extract or split only when doing so makes responsibility, testing, reuse, or local understanding materially better.
|
|
37
|
+
|
|
38
|
+
## Build Comments
|
|
39
|
+
|
|
40
|
+
The approved Spec/Plan and local project convention define required code comments. Add a comment when it records a protected contract, failure condition, business rule, compatibility boundary, or other non-obvious reason; inline comments explain reasons, not syntax. Markdown runtime contracts use headings and fixed output shapes rather than narrative comments.
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: devflow-core
|
|
3
|
+
description: "Use when starting development work, routing Problem, Fast, Design-lite, Design, Build, or Recovery work, investigating issues, handling requirements or bugs, or deciding which DevFlow skill owns the next lifecycle step. Before any creative work — creating features, building components, adding functionality, modifying behavior, or defining an unapproved problem-directed change — select devflow-brainstorm for a Confirmed request; pure Q&A, lookup, verification, and investigation-only reports remain exceptions."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# DevFlow Core
|
|
7
|
+
|
|
8
|
+
Route work through the smallest reliable lifecycle. Core owns next-step selection only when an artifact has no unique successor; skills directly execute the A/B/C success edges defined below.
|
|
9
|
+
|
|
10
|
+
## Activation Evidence
|
|
11
|
+
|
|
12
|
+
```text
|
|
13
|
+
Skill Activation: devflow-core
|
|
14
|
+
Trigger: <user words or task shape>
|
|
15
|
+
Route: Problem / Fast / Design-lite / Design / Build / Recovery
|
|
16
|
+
Next skill: <skill name or none>
|
|
17
|
+
Status: [DevFlow: <node> -> <next> | awaiting approval / in progress]
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
While a DevFlow lifecycle node is active, end each user-facing message with one status line: `[DevFlow: <node> -> <next> | awaiting approval / in progress]`. It reflects the current node without reloading the owner skill. Keep progress visible in the persistent UI: maintain a `todo_write` list with one item per active work unit (lifecycle node, background job, or subagent), marking it `completed` the moment it settles, and use `create_goal` for the session's long-running objective.
|
|
21
|
+
|
|
22
|
+
## Context Map
|
|
23
|
+
|
|
24
|
+
Read `skills/devflow-core/references/core-methods.md` before route selection. It supplies Method 0, shared route rules, and the owner map. Do not load all lifecycle references by default.
|
|
25
|
+
|
|
26
|
+
Read the narrowest relevant project facts, then progressively recall learning and project knowledge. Scan available skills and record a matching external specialist skill; a specialist may perform bounded specialist work inside the current node while DevFlow retains route and node ownership.
|
|
27
|
+
|
|
28
|
+
Before a route-specific decision, load only the selected owner reference:
|
|
29
|
+
|
|
30
|
+
| Selected work | Required reference |
|
|
31
|
+
|---|---|
|
|
32
|
+
| Cut | `skills/devflow-cut/references/cut-methods.md` |
|
|
33
|
+
| Spec or Plan | `skills/devflow-spec/references/spec-plan-methods.md` |
|
|
34
|
+
| Build | `skills/devflow-build/references/build-methods.md` |
|
|
35
|
+
| Prove or PUA | `skills/devflow-prove/references/proof-recovery-methods.md` |
|
|
36
|
+
| Learn | `skills/devflow-learn/SKILL.md` |
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
Facts: read/confirmed <files or commands>
|
|
40
|
+
Methods: read/confirmed core-methods.md; selected owner references <paths or none>
|
|
41
|
+
Knowledge recall: none / learning index + matched card / project knowledge entry + matched docs
|
|
42
|
+
Skill Discovery: none / <skill-name> (matched: <why>)
|
|
43
|
+
Unknowns: <none or specific unknown>
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Routes
|
|
47
|
+
|
|
48
|
+
| Route | Use when | Core action |
|
|
49
|
+
|---|---|---|
|
|
50
|
+
| Problem | A reported problem has no explicit fix request. | Prove facts first, then select later work only if a change is known. |
|
|
51
|
+
| Fast | Pure answer, lookup, verification, or one local low-risk change. | Sense, then narrow proof. |
|
|
52
|
+
| Design-lite | Existing feature, one clear low-risk path, quick proof. | State goal, acceptance, exclusions; select Cut before Build. |
|
|
53
|
+
| Design | New requirement, behavior or architecture change, ambiguity, or multiple options. | Select Brainstorm; after confirmation its user-selected A/B/C path directly starts Spec or Cut. |
|
|
54
|
+
| Build | User asks to implement, fix, build, or land an approved change. | Select Cut, then Plan when construction needs several steps, then Build and Prove. |
|
|
55
|
+
| Recovery | Same target remains wrong after correction or proof failure. | Select PUA, consume recovery facts, then choose a different path. |
|
|
56
|
+
|
|
57
|
+
## Core Flow Map
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
A direct success: Brainstorm -> Spec -> Cut -> Plan -> Build -> Prove
|
|
61
|
+
B direct success: Brainstorm -> Cut -> Plan -> Build -> Prove
|
|
62
|
+
C direct success: Brainstorm -> Cut -> Build -> Prove
|
|
63
|
+
|
|
64
|
+
CUT_REDUCE, CUT_REUSE, CUT_BLOCKED, scope drift, BUILD_BLOCKED,
|
|
65
|
+
Proof FAIL or BLOCKED, and PUA recovery -> Core selects the next owner or stop.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Core Return Boundaries
|
|
69
|
+
|
|
70
|
+
- Brainstorm returns only clarification or missing-depth facts; a selected depth directly starts A -> Spec or B/C -> Cut.
|
|
71
|
+
- Spec directly sends an approved A-branch Spec to Cut; a non-success result returns facts to Core.
|
|
72
|
+
- Cut directly sends `CUT_PASS` A/B to Plan or C to Build; `CUT_REDUCE`, `CUT_REUSE`, and `CUT_BLOCKED` return facts to Core.
|
|
73
|
+
- Plan directly sends an approved A/B Plan to Build; scope-drift facts return to Core.
|
|
74
|
+
- Build returns `BUILD_BLOCKED` facts when its Plan Review or execution is blocked.
|
|
75
|
+
- PUA returns recovery facts after its method switch.
|
|
76
|
+
- Prove returns PASS, FAIL, or BLOCKED and invokes Learn after PASS.
|
|
77
|
+
|
|
78
|
+
Core selects only after a returned non-unique artifact. `CUT_REDUCE` and `CUT_REUSE` stop for user confirmation. Independent `devflow-adversarial` and `devflow-find-fault` review current material only and do not enter lifecycle routing.
|
|
79
|
+
|
|
80
|
+
## Capability Dispatch
|
|
81
|
+
|
|
82
|
+
- Unclear requirement, new feature, behavior change, or multiple options: select `devflow-brainstorm` for Semantic Echo-Back and a fixed Confirmed request.
|
|
83
|
+
- Explicit spec or design document: select `devflow-spec` after confirmed request.
|
|
84
|
+
- New structure, dependency, abstraction, configuration, folder, or generic capability: select `devflow-cut`.
|
|
85
|
+
- Approved construction work: select `devflow-build` when Core receives a non-unique construction artifact; A/B approved Plans and C `CUT_PASS` enter Build directly.
|
|
86
|
+
- Completion claim: select `devflow-prove` and require fresh evidence plus adversarial review.
|
|
87
|
+
- Repeated same-target correction: select `devflow-pua`, then re-read facts and switch approach.
|
|
88
|
+
- Reusable correction or verified PASS: select `devflow-learn` for a selective review.
|
|
89
|
+
- Matched external specialist: perform bounded work inside the current owner's node and return result, not-applicable, or failure facts; a specialist never selects a lifecycle owner, depth, or final status.
|
|
90
|
+
|
|
91
|
+
## Verification
|
|
92
|
+
|
|
93
|
+
Before leaving Core, confirm that shared methods were read, only needed owner references were loaded, the route matches facts, and every selected skill has a return artifact or stop condition.
|