@curdx/flow 2.0.0-beta.2 → 2.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@
6
6
  },
7
7
  "metadata": {
8
8
  "description": "Claude Code Discipline Layer — spec-driven workflow + goal-backward verification + Karpathy 4 principles enforced via gates. Stops Claude from faking \"done\" on non-trivial features.",
9
- "version": "2.0.0-beta.2"
9
+ "version": "2.0.0-beta.3"
10
10
  },
11
11
  "plugins": [
12
12
  {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "curdx-flow",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.3",
4
4
  "description": "Claude Code Discipline Layer — spec-driven workflow + goal-backward verification + Karpathy 4 principles enforced via gates. Stops Claude from faking \"done\" on non-trivial features.",
5
5
  "author": {
6
6
  "name": "wdx",
@@ -210,5 +210,52 @@ When you need to delegate to a sub-agent:
210
210
 
211
211
  ---
212
212
 
213
+ ## L8: Long-artifact handling (truncation prevention)
214
+
215
+ When your job is to produce a long Markdown artifact (`tasks.md`, `verification-report.md`, `review-report.md`, `research.md`, `requirements.md`, `design.md`, etc.), follow these rules. Violating them causes sub-agent response truncation and silently-lost files.
216
+
217
+ ### Write first, explain second
218
+
219
+ Your FIRST substantive action after gathering inputs must be a `Write` tool call with the **complete file content**. Do NOT paste the content as assistant text before writing.
220
+
221
+ - ✗ *"Here's the tasks.md I'll write:"* followed by a 500-line markdown code block, then a `Write` call containing the same 500 lines — this doubles the output tokens and usually hits the truncation limit mid-`Write`, leaving the file missing or partial.
222
+ - ✓ Immediately `Write` the file with full content. Then output a ≤ 5-line summary.
223
+
224
+ ### Do not preview
225
+
226
+ Never output the file's content in your response. The file IS the deliverable — the reader opens it. Your response is just the ack that you wrote it.
227
+
228
+ ### After write, summarize only
229
+
230
+ After `Write` returns success, respond with **at most 5 lines** summarizing what you wrote:
231
+
232
+ ```
233
+ ✓ Wrote .flow/specs/<spec>/tasks.md
234
+ 40 tasks across 5 phases
235
+ Coverage: FR 10/10, AC 12/12, AD 4/4
236
+ Next: /curdx-flow:implement
237
+ ```
238
+
239
+ Do not re-paste any file contents. Do not narrate your reasoning. Do not list every task inline.
240
+
241
+ ### Split if >200 lines
242
+
243
+ If the artifact would exceed ~200 lines of Markdown, split it:
244
+ - `tasks.md` references `tasks-phase-1.md` … `tasks-phase-5.md`
245
+ - Each phase file is its own `Write` call
246
+ - The index file is a short table linking to the phase files
247
+
248
+ This keeps every individual `Write` call under the safe size budget.
249
+
250
+ ### If you see a token-budget warning
251
+
252
+ Stop narrating and call `Write` with whatever content is ready. Sub-agents do not have a "next response" — continuation is not possible after truncation. Save what you have, then return.
253
+
254
+ ### Why this matters
255
+
256
+ Sub-agents invoked via the `Task` tool have a ~16 K output-token budget per invocation. A naive agent that previews then writes consumes those tokens twice — once as prose, once inside the tool call — and truncation typically lands inside the `Write` call itself. The parent command then reports "agent did not complete" and re-dispatches, burning compute for no new artifact. Writing first eliminates the failure mode at the source.
257
+
258
+ ---
259
+
213
260
  **Remember**: this preamble exists because, without discipline, AI tends to slack off, hallucinate, and over-engineer.
214
261
  These rules are not constraints — they are the tools that make you reliable.
@@ -132,31 +132,23 @@ For each of the following sources, every item must be covered by tasks:
132
132
 
133
133
  ### Step 6: Write tasks.md + State
134
134
 
135
- Based on `${CLAUDE_PLUGIN_ROOT}/templates/tasks.md.tmpl`.
135
+ **CRITICAL (see L8 of the preamble — long-artifact handling):**
136
+ - Your FIRST action in this step must be a `Write` tool call with the full `tasks.md` content. Do NOT paste the file content as assistant text before writing.
137
+ - Do NOT preview the tasks list in the response. The file itself is the deliverable.
138
+ - If `tasks.md` would be >200 lines, split into `tasks-phase-1.md` … `tasks-phase-5.md` and make `tasks.md` a short index linking to them.
136
139
 
137
- Must include a **coverage audit table** at the end (from Step 5):
140
+ Based on `${CLAUDE_PLUGIN_ROOT}/templates/tasks.md.tmpl`. Must include a **coverage audit table** at the end (from Step 5).
138
141
 
139
- ```markdown
140
- ## Coverage Audit
141
-
142
- | Requirement ID | Corresponding Tasks | Status |
143
- |--------|---------|------|
144
- | FR-01 | 1.2, 3.1 | ✓ |
145
- | FR-02 | 3.2 | ✓ |
146
- | AC-1.1 | 3.1 | |
147
- | AD-03 | 1.1, 2.1 | ✓ |
148
- ```
149
-
150
- Then:
142
+ After the `Write` succeeds:
143
+ 1. Update `.flow/specs/<name>/.state.json`:
144
+ ```
145
+ phase_status.tasks = "completed"
146
+ total_tasks = <N>
147
+ ```
148
+ 2. Append to `.flow/specs/<name>/.progress.md`:
149
+ `## tasks phase complete, total N tasks`
151
150
 
152
- ```
153
- .flow/specs/<name>/.state.json:
154
- phase_status.tasks = "completed"
155
- total_tasks = <N>
156
-
157
- .flow/specs/<name>/.progress.md:
158
- Append "## tasks phase complete, total N tasks"
159
- ```
151
+ Then emit the 5-line summary (see "Output to User" below). No inline task listing.
160
152
 
161
153
  ## Output Quality Bar (Self-Check)
162
154
 
@@ -182,23 +174,13 @@ Then:
182
174
 
183
175
  Based on `_` in `.flow/specs/<name>/.state.json` or `specs.default_task_size` in `.flow/config.json`.
184
176
 
185
- ## Output to User
177
+ ## Output to User (5 lines max, after Write succeeds)
186
178
 
187
179
  ```
188
- Task breakdown complete: .flow/specs/<name>/tasks.md
189
-
190
- N tasks total, across 5 Phases:
191
- Phase 1 (POC): X tasks
192
- Phase 2 (Refactor): Y tasks
193
- Phase 3 (Testing): Z tasks
194
- Phase 4 (Quality): W tasks
195
- Phase 5 (PR): V tasks
196
-
197
- Coverage audit: FR (A/B) | AC (C/D) | AD (E/F) all covered ✓
198
-
199
- Estimated effort: N tasks × 5 minutes ≈ M minutes
200
-
201
- Next:
202
- - Review tasks.md
203
- - /curdx-flow:implement — start execution (after Phase 2 is released)
180
+ Wrote .flow/specs/<name>/tasks.md
181
+ N tasks across 5 Phases (X/Y/Z/W/V)
182
+ Coverage: FR A/B | AC C/D | AD E/F
183
+ Next: /curdx-flow:implement
204
184
  ```
185
+
186
+ **Do not re-paste the tasks.md content inline. Do not list every task. Just the summary.**
@@ -187,7 +187,11 @@ else:
187
187
 
188
188
  ### Step 6: Generate review-report.md
189
189
 
190
- Full structure:
190
+ **CRITICAL (see L8 of the preamble):** your FIRST action in this step must be a `Write` tool call with the **complete report content**. Do NOT paste the report as assistant text before writing. After the write succeeds, respond with a ≤ 5-line summary only (path, verdict, blocker count, next step). Do not re-paste the report.
191
+
192
+ If the report would exceed ~200 lines, split into `review-report.md` (short index + verdict) and `review-details.md` (full findings) — two `Write` calls.
193
+
194
+ Full structure (use this as the content passed to `Write`, not as preview text):
191
195
 
192
196
  ```markdown
193
197
  # Review Report: <spec-name>
@@ -145,6 +145,12 @@ For each match, check:
145
145
 
146
146
  ### Step 6: Generate verification-report.md
147
147
 
148
+ **CRITICAL (see L8 of the preamble):** your FIRST action in this step must be a `Write` tool call with the **complete report content**. Do NOT paste the report as assistant text before writing — doing so doubles output tokens and causes truncation inside the `Write` call. After the write succeeds, respond with a ≤ 5-line summary only (path, verdict counts, next step). Do not re-paste the report.
149
+
150
+ If the report would exceed ~200 lines, split into `verification-report.md` (short index + verdict) and `verification-details.md` (full findings table) — two `Write` calls.
151
+
152
+ Required structure (use this as the content passed to `Write`, not as preview text):
153
+
148
154
  ```markdown
149
155
  # Verification Report: <spec-name>
150
156
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curdx/flow",
3
- "version": "2.0.0-beta.2",
3
+ "version": "2.0.0-beta.3",
4
4
  "description": "CLI installer for CurDX-Flow — AI engineering workflow meta-framework for Claude Code",
5
5
  "type": "module",
6
6
  "bin": {