@curdx/flow 2.0.0-beta.1 → 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.
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/agent-preamble/preamble.md +47 -0
- package/agents/flow-planner.md +21 -39
- package/agents/flow-reviewer.md +5 -1
- package/agents/flow-verifier.md +6 -0
- package/cli/install.js +16 -5
- package/commands/review.md +9 -0
- package/commands/spec.md +24 -0
- package/commands/verify.md +13 -0
- package/package.json +1 -1
|
@@ -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.
|
|
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.
|
|
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.
|
package/agents/flow-planner.md
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
-
✓
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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.**
|
package/agents/flow-reviewer.md
CHANGED
|
@@ -187,7 +187,11 @@ else:
|
|
|
187
187
|
|
|
188
188
|
### Step 6: Generate review-report.md
|
|
189
189
|
|
|
190
|
-
|
|
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>
|
package/agents/flow-verifier.md
CHANGED
|
@@ -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/cli/install.js
CHANGED
|
@@ -237,15 +237,26 @@ export async function install(args = []) {
|
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
function printNextSteps() {
|
|
240
|
+
// Detect whether the CLI is globally installed (curdx-flow on PATH) or
|
|
241
|
+
// the user ran us via npx. Tell them the right invocation each time.
|
|
242
|
+
const cliOnPath = has("curdx-flow");
|
|
243
|
+
const cliCmd = cliOnPath ? "curdx-flow" : "npx @curdx/flow";
|
|
244
|
+
|
|
240
245
|
console.log(`\n${color.bold("✅ Install complete")}\n`);
|
|
246
|
+
console.log(`${color.bold("Restart Claude Code")} so the plugin registers all its commands and hooks.\n`);
|
|
241
247
|
console.log(`${color.bold("Next steps")}:\n`);
|
|
242
248
|
console.log(` ${color.dim("# Verify health")}`);
|
|
243
|
-
console.log(`
|
|
244
|
-
console.log(` ${color.dim("#
|
|
245
|
-
console.log(` cd ~/your-project
|
|
246
|
-
console.log(` ${color.dim("# Start using it (inside Claude Code)")}`);
|
|
249
|
+
console.log(` ${cliCmd} doctor\n`);
|
|
250
|
+
console.log(` ${color.dim("# Inside any project, initialize and start a feature spec")}`);
|
|
251
|
+
console.log(` ${color.cyan("cd ~/your-project")}`);
|
|
247
252
|
console.log(` ${color.cyan("claude")}`);
|
|
248
|
-
console.log(` ${color.cyan("/curdx-flow:
|
|
253
|
+
console.log(` ${color.cyan("/curdx-flow:init")}`);
|
|
254
|
+
console.log(` ${color.cyan("/curdx-flow:start my-feature \"<one-line goal>\"")}\n`);
|
|
255
|
+
if (!cliOnPath) {
|
|
256
|
+
console.log(
|
|
257
|
+
`${color.dim("Tip: install the CLI globally for shorter commands —")} ${color.cyan("npm i -g @curdx/flow")}\n`
|
|
258
|
+
);
|
|
259
|
+
}
|
|
249
260
|
console.log(
|
|
250
261
|
`${color.bold("Learn more")}: https://github.com/curdx/curdx-flow/blob/main/docs/getting-started.md\n`
|
|
251
262
|
);
|
package/commands/review.md
CHANGED
|
@@ -91,6 +91,15 @@ Output: test-gap checklist with suggested test cases.
|
|
|
91
91
|
|
|
92
92
|
## Report
|
|
93
93
|
|
|
94
|
+
**Landing check**: sub-agent responses can be truncated. After dispatching review agents, verify the report actually landed on disk:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
REPORT=".flow/specs/$SPEC_NAME/review-report.md"
|
|
98
|
+
if [ ! -f "$REPORT" ] || [ "$(wc -c < "$REPORT" 2>/dev/null | tr -d ' ')" -lt 300 ]; then
|
|
99
|
+
echo "⚠ Report missing or truncated. Re-dispatching flow-reviewer with a terse 'Write the report now, no narration' prompt."
|
|
100
|
+
fi
|
|
101
|
+
```
|
|
102
|
+
|
|
94
103
|
Consolidated output: `.flow/specs/$SPEC_NAME/review-report.md`:
|
|
95
104
|
|
|
96
105
|
```markdown
|
package/commands/spec.md
CHANGED
|
@@ -98,6 +98,30 @@ After each phase completes successfully, update `.state.json`:
|
|
|
98
98
|
}
|
|
99
99
|
```
|
|
100
100
|
|
|
101
|
+
### Artifact landing check (mandatory after every phase)
|
|
102
|
+
|
|
103
|
+
Sub-agent responses can be truncated by the model's output-length limit, which means the `Write` tool call for the phase's Markdown artifact may never fire. Do NOT trust the agent's return value alone — always verify the file actually landed.
|
|
104
|
+
|
|
105
|
+
For each phase just dispatched, run:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
ARTIFACT=".flow/specs/$SPEC_NAME/<phase>.md"
|
|
109
|
+
if [ ! -f "$ARTIFACT" ]; then
|
|
110
|
+
echo "⚠ $ARTIFACT did not land. Re-dispatching <phase> agent with an explicit 'write the file' prompt."
|
|
111
|
+
# Re-dispatch the same agent, but in the prompt, front-load:
|
|
112
|
+
# "Your ONLY job is to call the Write tool with the full <phase>.md content now.
|
|
113
|
+
# Do not explain. Do not narrate. Write the file and stop."
|
|
114
|
+
# This pattern produces an artifact even when prior verbosity caused truncation.
|
|
115
|
+
fi
|
|
116
|
+
|
|
117
|
+
# Minimum-size sanity check — if the file is <500 bytes, the write likely truncated
|
|
118
|
+
if [ -f "$ARTIFACT" ] && [ "$(wc -c < "$ARTIFACT" | tr -d ' ')" -lt 500 ]; then
|
|
119
|
+
echo "⚠ $ARTIFACT looks truncated (<500 bytes). Re-dispatching to complete it."
|
|
120
|
+
fi
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Only advance `.state.json.phase` after both the file exists AND passes the size sanity check. If a re-dispatch also fails to produce the artifact, stop and surface the issue to the user instead of silently advancing — that prevents later phases from consuming an empty upstream file.
|
|
124
|
+
|
|
101
125
|
## Optional planning review
|
|
102
126
|
|
|
103
127
|
If `--review` (or `--review=<dims>`) is present:
|
package/commands/verify.md
CHANGED
|
@@ -67,6 +67,19 @@ If `--strict`:
|
|
|
67
67
|
|
|
68
68
|
### Step 4: Produce `verification-report.md`
|
|
69
69
|
|
|
70
|
+
**Landing check**: sub-agent responses can be truncated by the model's output-length limit. After dispatching `flow-verifier`, verify the report actually landed:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
REPORT=".flow/specs/$SPEC_NAME/verification-report.md"
|
|
74
|
+
if [ ! -f "$REPORT" ] || [ "$(wc -c < "$REPORT" 2>/dev/null | tr -d ' ')" -lt 300 ]; then
|
|
75
|
+
echo "⚠ Report missing or truncated. Re-dispatching flow-verifier with a terse 'write the report now' prompt."
|
|
76
|
+
# Re-dispatch pattern:
|
|
77
|
+
# "Your only job right now is to Write the verification-report.md using the
|
|
78
|
+
# findings you already gathered. Do not re-scan. Do not narrate. Write
|
|
79
|
+
# the file and stop."
|
|
80
|
+
fi
|
|
81
|
+
```
|
|
82
|
+
|
|
70
83
|
Write to `.flow/specs/$SPEC_NAME/verification-report.md`:
|
|
71
84
|
|
|
72
85
|
```markdown
|