@dzhechkov/p-replicator 1.12.0 → 1.13.2
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/.dz-manifest.json +281 -65
- package/CHANGELOG.md +148 -1
- package/LICENSE +21 -0
- package/MULTIPLATFORM_ROADMAP.md +1 -1
- package/README/eng/01_quickstart.md +2 -2
- package/README/eng/02_user_guide.md +1 -1
- package/README/eng/03_admin_guide.md +2 -2
- package/README/eng/05_architecture.md +1 -1
- package/README/eng/README.md +2 -1
- package/README/ru/01_quickstart.md +2 -2
- package/README/ru/02_user_guide.md +1 -1
- package/README/ru/03_admin_guide.md +2 -2
- package/README/ru/05_architecture.md +1 -1
- package/README/ru/README.md +2 -1
- package/README/ru/html/index.html +8 -8
- package/README.md +150 -9
- package/bin/cli.js +0 -0
- package/package.json +10 -11
- package/sbom.json +604 -64
- package/scripts/check-pipeline-gaps.sh +510 -21
- package/src/commands/init.js +1 -1
- package/src/rule-components.json +5 -1
- package/src/utils.js +33 -3
- package/templates/.claude/agents/product-discoverer.md +38 -0
- package/templates/.claude/agents/replicate-coordinator.md +11 -1
- package/templates/.claude/commands/feature.md +72 -6
- package/templates/.claude/commands/go.md +6 -8
- package/templates/.claude/commands/harvest.md +5 -7
- package/templates/.claude/commands/replicate.md +169 -44
- package/templates/.claude/commands/start.md +28 -7
- package/templates/.claude/hooks/capture-source-path.cjs +795 -0
- package/templates/.claude/hooks/check-canon.cjs +493 -0
- package/templates/.claude/hooks/check-embed-contract.cjs +374 -0
- package/templates/.claude/hooks/check-external-deps.cjs +288 -0
- package/templates/.claude/hooks/check-file-ownership.cjs +424 -0
- package/templates/.claude/hooks/check-handoff-manifest.cjs +367 -0
- package/templates/.claude/hooks/check-job-contract.cjs +501 -0
- package/templates/.claude/hooks/check-look-origin.cjs +240 -0
- package/templates/.claude/hooks/check-look-trace.cjs +385 -0
- package/templates/.claude/hooks/check-metric-source.cjs +296 -0
- package/templates/.claude/hooks/check-model-cost.cjs +470 -0
- package/templates/.claude/hooks/check-ports.cjs +27 -6
- package/templates/.claude/hooks/check-review-contract.cjs +205 -0
- package/templates/.claude/hooks/check-source-version.cjs +312 -0
- package/templates/.claude/hooks/check-swarm-receipts.cjs +197 -0
- package/templates/.claude/hooks/check-webhook-contract.cjs +535 -0
- package/templates/.claude/hooks/statusline.cjs +2 -2
- package/templates/.claude/rules/embeddable-widget.md +73 -0
- package/templates/.claude/rules/feature-lifecycle.md +5 -6
- package/templates/.claude/rules/incoming-webhooks.md +99 -0
- package/templates/.claude/rules/long-running-job.md +73 -0
- package/templates/.claude/rules/model-call-cost.md +85 -0
- package/templates/.claude/rules/replicate-pipeline.md +122 -52
- package/templates/.claude/skills/brutal-honesty-review/SKILL.md +9 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/SKILL.md +4 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/03-generate-p0.md +46 -1
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/04-generate-p1.md +7 -1
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/06-package-deliver.md +20 -2
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/claude-md-strategy.md +7 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/automation-commands.md +17 -0
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/feature-lifecycle-ent.md +43 -5
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/feature-lifecycle.md +43 -7
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/start-command.md +19 -1
- package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/swarm-file-evidence.md +151 -0
- package/templates/.claude/skills/goap-research-ed25519/SKILL.md +37 -22
- package/templates/.claude/skills/goap-research-ed25519/references/negative-results.md +94 -0
- package/templates/.claude/skills/goap-research-ed25519/scripts/check_report_evidence.py +368 -4
- package/templates/.claude/skills/goap-research-ed25519/scripts/ed25519_verifier.py +122 -5
- package/templates/.claude/skills/goap-research-ed25519/scripts/evidence_fetch.py +33 -16
- package/templates/.claude/skills/goap-research-ed25519/scripts/quote_provenance.py +342 -0
- package/templates/.claude/skills/goap-research-ed25519/scripts/test_ed25519_verifier.py +60 -0
- package/templates/.claude/skills/goap-research-ed25519/scripts/test_evidence_provenance.py +139 -6
- package/templates/.claude/skills/goap-research-ed25519/scripts/test_quote_provenance.py +274 -0
- package/templates/.claude/skills/goap-research-ed25519/scripts/test_suite_completeness.py +2 -1
- package/templates/.claude/skills/knowledge-extractor/SKILL.md +4 -0
- package/templates/.claude/skills/pipeline-forge/SKILL.md +18 -23
- package/templates/.claude/skills/pipeline-forge/examples/replicate-analysis.md +7 -2
- package/templates/.claude/skills/pipeline-forge/references/patterns-catalog.md +19 -1
- package/templates/.claude/skills/pipeline-forge/references/self-extracted-patterns.md +17 -6
- package/templates/.claude/skills/pipeline-forge/references/skill-anatomy.md +0 -1
- package/templates/.claude/skills/requirements-validator/SKILL.md +18 -5
- package/templates/.claude/skills/requirements-validator/references/feature-report-contracts.md +67 -0
- package/templates/.claude/skills/requirements-validator/references/scoring-system.md +15 -6
- package/templates/.claude/skills/reverse-engineering-unicorn/modules/025-cjm-prototype.md +21 -1
- package/templates/.claude/skills/sparc-prd-mini/SKILL.md +173 -725
- package/tests/e2e/feature-contour.test.js +176 -0
- package/tests/fixtures/feature-contour/docs/features/demo-gate/01_specification.md +15 -0
- package/tests/fixtures/feature-contour/docs/features/demo-gate/02_pseudocode.md +19 -0
- package/tests/fixtures/feature-contour/docs/features/demo-gate/03_architecture.md +3 -0
- package/tests/fixtures/feature-contour/docs/features/demo-gate/04_refinement.md +3 -0
- package/tests/fixtures/feature-contour/docs/features/demo-gate/05_completion.md +7 -0
- package/tests/fixtures/feature-contour/docs/features/demo-gate/review-report.md +11 -0
- package/tests/fixtures/feature-contour/docs/features/demo-gate/validation-report.md +10 -0
- package/tests/fixtures/feature-contour/tests/demo.test.js +16 -0
- package/tests/snapshot/baseline.json +64 -40
- package/tests/unit/capture-source-path.test.js +492 -0
- package/tests/unit/check-canon.test.js +403 -0
- package/tests/unit/check-embed-contract.test.js +422 -0
- package/tests/unit/check-external-deps.test.js +363 -0
- package/tests/unit/check-file-ownership.test.js +388 -0
- package/tests/unit/check-handoff-manifest.test.js +410 -0
- package/tests/unit/check-job-contract.test.js +514 -0
- package/tests/unit/check-look-origin.test.js +180 -0
- package/tests/unit/check-look-trace.test.js +420 -0
- package/tests/unit/check-metric-source.test.js +325 -0
- package/tests/unit/check-model-cost.test.js +425 -0
- package/tests/unit/check-ports.test.js +46 -2
- package/tests/unit/check-review-contract.test.js +181 -0
- package/tests/unit/check-source-version.test.js +344 -0
- package/tests/unit/check-swarm-receipts.test.js +231 -0
- package/tests/unit/check-webhook-contract.test.js +536 -0
- package/tests/unit/db-port-rule.test.js +8 -2
- package/tests/unit/detection-ladder-registry.test.js +2 -2
- package/tests/unit/generator-swarm-contract.test.js +287 -0
- package/tests/unit/guard-honest-input-meta.test.js +64 -0
- package/tests/unit/honest-failure-rules.test.js +106 -9
- package/tests/unit/look-phase-contract.test.js +231 -0
- package/tests/unit/negative-conclusion-gate.test.js +300 -0
- package/tests/unit/quote-provenance.test.js +122 -0
- package/tests/unit/sync-templates-guard.test.js +46 -3
- package/tests/unit/traceability-completion-gate.test.js +267 -0
- package/tests/unit/utils.test.js +40 -3
|
@@ -39,7 +39,8 @@ From the Instrument Map this module uses:
|
|
|
39
39
|
> gate in `.claude/rules/replicate-pipeline.md` ("What Gets Generated vs Pre-shipped").
|
|
40
40
|
> For these items, **VERIFY they exist — do NOT regenerate or overwrite them:**
|
|
41
41
|
> - Commands: `start.md` (Item 4), `myinsights.md` (Item 5), `feature.md` (Item 6)
|
|
42
|
-
> - Rules: `git-workflow.md` (Item 7), `insights-capture.md` (Item 8), `feature-lifecycle.md` (Item 9)
|
|
42
|
+
> - Rules: `git-workflow.md` (Item 7), `insights-capture.md` (Item 8), `feature-lifecycle.md` (Item 9),
|
|
43
|
+
> `swarm-file-evidence.md` (Item 9b)
|
|
43
44
|
> - Config: `.claude/settings.json` + `.claude/hooks/` scripts (Item 10)
|
|
44
45
|
>
|
|
45
46
|
> Treat their "Generate `.claude/...`" instructions as "confirm present; enhance content
|
|
@@ -238,6 +239,11 @@ Key generation steps:
|
|
|
238
239
|
**Critical rule:** /start MUST reference actual docs in `docs/`, never hallucinate
|
|
239
240
|
code from memory. Every Phase 2 Task includes explicit doc references.
|
|
240
241
|
|
|
242
|
+
**Second critical rule:** Phase 2 dispatches parallel Tasks, so the generated command MUST carry
|
|
243
|
+
the "Positive file receipt (required)" block from the template. Every package Task gets its own
|
|
244
|
+
`WORK_UNIT_ID` and absolute `TRACE_PATH`, and Phase 3 may not begin until
|
|
245
|
+
`node .claude/hooks/check-swarm-receipts.cjs <manifest>` exits 0 (see Item 9b).
|
|
246
|
+
|
|
241
247
|
**Output path:** `.claude/commands/start.md`
|
|
242
248
|
|
|
243
249
|
---
|
|
@@ -291,6 +297,8 @@ Phase 3: IMPLEMENT (swarm + parallel tasks)
|
|
|
291
297
|
Read validated SPARC docs as source of truth
|
|
292
298
|
Use @planner, @architect, implementation agents
|
|
293
299
|
Modular design for reuse
|
|
300
|
+
Positive file receipt: one WORK_UNIT_ID + absolute TRACE_PATH per unit,
|
|
301
|
+
terminal Status: line last, verified before merge (see Item 9b)
|
|
294
302
|
Commit per logical unit: feat(<feature-name>): <what>
|
|
295
303
|
|
|
296
304
|
Phase 4: REVIEW (brutal-honesty-review, swarm)
|
|
@@ -365,6 +373,38 @@ Generate `.claude/rules/feature-lifecycle.md` with:
|
|
|
365
373
|
|
|
366
374
|
**Output path:** `.claude/rules/feature-lifecycle.md`
|
|
367
375
|
|
|
376
|
+
The generated rule MUST carry the "Positive file receipt (required)" block from Section 3 of the
|
|
377
|
+
template verbatim. A lifecycle that dispatches parallel agents without it is INCOMPLETE, and
|
|
378
|
+
`06-package-deliver.md` CHECK 7b fails delivery on it.
|
|
379
|
+
|
|
380
|
+
---
|
|
381
|
+
|
|
382
|
+
#### Item 9b: swarm-file-evidence.md rule
|
|
383
|
+
|
|
384
|
+
**Template:** `view() references/templates/swarm-file-evidence.md` (Section 1)
|
|
385
|
+
> CRITICAL: COPY the full template. Do NOT compress or summarize.
|
|
386
|
+
|
|
387
|
+
Generate `.claude/rules/swarm-file-evidence.md` — the contract that makes a parallel unit's result
|
|
388
|
+
a FILE rather than a reply.
|
|
389
|
+
|
|
390
|
+
**Why this item exists, in one paragraph you should not skip:** a worker that died looks exactly
|
|
391
|
+
like a worker that is still running, because both are silent. Silence therefore reads as "in
|
|
392
|
+
progress", and a coordinator can report in good faith that a review is running when no review
|
|
393
|
+
exists — the absence of a receipt is indistinguishable from unfinished work. Declaring the result
|
|
394
|
+
to be a file at a named path collapses that ambiguity: no file, no work, and a machine can say so.
|
|
395
|
+
|
|
396
|
+
- **Do NOT overwrite** an existing `.claude/rules/swarm-file-evidence.md` — a project created by
|
|
397
|
+
`npx @dzhechkov/p-replicator init` already has it, pre-shipped and protected by the
|
|
398
|
+
do-not-overwrite gate.
|
|
399
|
+
- Generate it when the path is ABSENT, which is the case for every toolkit produced into a project
|
|
400
|
+
this package never initialised. That is the whole point of this item: the cure has to travel with
|
|
401
|
+
the generated toolkit, not only with the installer.
|
|
402
|
+
- Also copy `templates/.claude/hooks/check-swarm-receipts.cjs` (or regenerate it from
|
|
403
|
+
Section 3 of the template) so the contract has its deterministic half — text alone is layer 2 and
|
|
404
|
+
fails silently.
|
|
405
|
+
|
|
406
|
+
**Output path:** `.claude/rules/swarm-file-evidence.md` (+ `.claude/hooks/check-swarm-receipts.cjs`)
|
|
407
|
+
|
|
368
408
|
---
|
|
369
409
|
|
|
370
410
|
#### Item 10: settings.json hooks
|
|
@@ -559,6 +599,8 @@ Generate items in this order to resolve dependencies:
|
|
|
559
599
|
4. Item 7: git-workflow.md (rule, no deps)
|
|
560
600
|
5. Item 8: insights-capture.md (rule, no deps)
|
|
561
601
|
6. Item 9: feature-lifecycle.md (rule, references skills from step 1)
|
|
602
|
+
6b. Item 9b: swarm-file-evidence.md (rule + check-swarm-receipts.cjs; every later item that
|
|
603
|
+
dispatches parallel agents references it, so it must exist before them)
|
|
562
604
|
7. Item 4: /start command (references docs, rules, skills)
|
|
563
605
|
8. Item 5: /myinsights command (references insights-capture rule)
|
|
564
606
|
9. Item 6: /feature command (references lifecycle skills, rules)
|
|
@@ -587,6 +629,8 @@ P0 Mandatory Generated:
|
|
|
587
629
|
[x] .claude/rules/git-workflow.md 0.8 KB
|
|
588
630
|
[x] .claude/rules/insights-capture.md 1.9 KB
|
|
589
631
|
[x] .claude/rules/feature-lifecycle.md 2.4 KB
|
|
632
|
+
[x] .claude/rules/swarm-file-evidence.md 2.6 KB
|
|
633
|
+
[x] .claude/hooks/check-swarm-receipts.cjs (0/1/2)
|
|
590
634
|
[x] .claude/settings.json 1.2 KB
|
|
591
635
|
[x] 6 lifecycle skills copied (sparc-prd-mini, explore,
|
|
592
636
|
goap-research, problem-solver-enhanced,
|
|
@@ -659,6 +703,7 @@ This module reads the following reference/template files during execution:
|
|
|
659
703
|
| `view() references/templates/start-command.md` | /start command template with placeholder fill instructions | Item 4: /start |
|
|
660
704
|
| `view() references/templates/feature-lifecycle.md` | Skill copying protocol (Sec 1), /feature command template (Sec 2), feature-lifecycle rule template (Sec 3), CLAUDE.md integration (Sec 4) | Items 6, 9, 11-16 |
|
|
661
705
|
| `view() references/templates/insights-system.md` | /myinsights command template (Sec 1), insights-capture rule template (Sec 2), Stop hook template (Sec 3), CLAUDE.md integration (Sec 4) | Items 5, 8, 10 |
|
|
706
|
+
| `view() references/templates/swarm-file-evidence.md` | swarm-file-evidence rule body (Sec 1), the positive file receipt seam to paste into every dispatch site (Sec 2), the `check-swarm-receipts.cjs` 0/1/2 checker + manifest shape (Sec 3), placement map (Sec 4) | Items 4, 6, 9, 9b |
|
|
662
707
|
|
|
663
708
|
These files are part of the cc-toolkit-generator-enhanced skill at:
|
|
664
709
|
`.claude/skills/cc-toolkit-generator-enhanced/references/`
|
|
@@ -245,13 +245,15 @@ IF has_ddd:
|
|
|
245
245
|
- Phase 2: VALIDATE (requirements-validator swarm, 7 agents, score >= 70)
|
|
246
246
|
- Phase 3: IMPLEMENT (parallel agents per Bounded Context)
|
|
247
247
|
- Phase 4: REVIEW (brutal-honesty-review swarm, 6 agents)
|
|
248
|
+
- Positive file receipt block VERBATIM in Phase 3 (P0 Item 9b installs the rule it cites)
|
|
248
249
|
- Output to docs/features/<feature-name>/ with full subdirectory structure
|
|
249
250
|
|
|
250
251
|
6b. Generate .claude/rules/feature-lifecycle-ent.md
|
|
251
252
|
- When to use /feature-ent vs /feature decision matrix
|
|
252
253
|
- Enterprise planning rules (full idea2prd-manual, mandatory DDD)
|
|
253
254
|
- Enterprise validation rules (7 agents, extended scope)
|
|
254
|
-
- Enterprise implementation rules (Task per Bounded Context
|
|
255
|
+
- Enterprise implementation rules (Task per Bounded Context, each with its own
|
|
256
|
+
WORK_UNIT_ID and absolute TRACE_PATH — the positive file receipt block VERBATIM)
|
|
255
257
|
- Enterprise review rules (6 agents, ADR + fitness verification)
|
|
256
258
|
|
|
257
259
|
6c. Copy skill directories with path rewrite:
|
|
@@ -468,6 +470,10 @@ All of the following must pass before proceeding to Phase 5:
|
|
|
468
470
|
|
|
469
471
|
- [ ] `/feature-ent` command includes all 4 phases with checkpoints
|
|
470
472
|
- [ ] `feature-lifecycle-ent.md` rule includes decision matrix (/feature vs /feature-ent)
|
|
473
|
+
- [ ] `/feature-ent` Phase 3 and `feature-lifecycle-ent.md` Implementation each carry the positive
|
|
474
|
+
file receipt block (`WORK_UNIT_ID`, absolute `TRACE_PATH`, terminal `Status:` line, refusal to
|
|
475
|
+
merge without it) and cite `.claude/rules/swarm-file-evidence.md`. A Bounded-Context agent
|
|
476
|
+
that died is silent exactly like one still working, so only the file separates them
|
|
471
477
|
- [ ] `idea2prd-manual/` skill copied with ALL path rewrites applied (3 external skill paths)
|
|
472
478
|
- [ ] `goap-research-ed25519/` skill copied completely
|
|
473
479
|
- [ ] No duplicate skill copies (explore, problem-solver-enhanced already in P0)
|
package/templates/.claude/skills/cc-toolkit-generator-enhanced/modules/06-package-deliver.md
CHANGED
|
@@ -61,7 +61,8 @@ CHECK 3: /start command
|
|
|
61
61
|
- File exists at .claude/commands/start.md
|
|
62
62
|
- Contains complete project generation instructions
|
|
63
63
|
- Includes all packages from IPM
|
|
64
|
-
- Uses Task tool for parallelism where appropriate
|
|
64
|
+
- Uses Task tool for parallelism where appropriate, under the positive file receipt contract
|
|
65
|
+
(see CHECK 7b — a parallel Task without a TRACE_PATH is a delivery failure)
|
|
65
66
|
- Includes Docker health check verification
|
|
66
67
|
- References actual SPARC/idea2prd docs (not hallucinated paths)
|
|
67
68
|
- IF has_database: includes DB migration + seed steps
|
|
@@ -87,6 +88,23 @@ CHECK 7: feature-lifecycle.md rule
|
|
|
87
88
|
- Documents the 4-phase lifecycle protocol
|
|
88
89
|
- Includes phase skip guidance
|
|
89
90
|
|
|
91
|
+
CHECK 7b: the swarm file-evidence contract reached the toolkit [FAIL-CLOSED]
|
|
92
|
+
- File exists at .claude/rules/swarm-file-evidence.md
|
|
93
|
+
- File exists at .claude/hooks/check-swarm-receipts.cjs
|
|
94
|
+
- EVERY generated artifact that dispatches parallel agents names WORK_UNIT_ID and an absolute
|
|
95
|
+
TRACE_PATH and refuses merge without a terminal receipt. At minimum:
|
|
96
|
+
[ ] .claude/commands/feature.md (Phase 3, and Phase 2/4 by reference)
|
|
97
|
+
[ ] .claude/rules/feature-lifecycle.md (Implementation)
|
|
98
|
+
[ ] .claude/commands/start.md (Phase 2 package Tasks)
|
|
99
|
+
[ ] .claude/commands/feature-ent.md IF DDD
|
|
100
|
+
[ ] .claude/rules/feature-lifecycle-ent.md IF DDD
|
|
101
|
+
[ ] .claude/commands/go.md, run.md IF automation commands generated
|
|
102
|
+
- The check is TEXTUAL and mechanical: grep each file for `TRACE_PATH`. A file that dispatches
|
|
103
|
+
agents and does not name it FAILS delivery — there is no "the coordinator will remember".
|
|
104
|
+
- Why fail-closed: a worker that died is silent and a worker that is running is silent, so a
|
|
105
|
+
toolkit without this contract cannot tell the two apart and will report progress on work that
|
|
106
|
+
stopped. Shipping that is shipping a defect, not an omission.
|
|
107
|
+
|
|
90
108
|
CHECK 8: 6 lifecycle skills
|
|
91
109
|
- All 6 skills copied to .claude/skills/:
|
|
92
110
|
[ ] sparc-prd-mini/SKILL.md
|
|
@@ -433,6 +451,7 @@ Compile the complete file tree of everything produced, annotated with phase and
|
|
|
433
451
|
| |-- git-workflow.md <- P0 [size] [PASS/FAIL]
|
|
434
452
|
| |-- insights-capture.md <- P0 [size] [PASS/FAIL]
|
|
435
453
|
| |-- feature-lifecycle.md <- P0 [size] [PASS/FAIL]
|
|
454
|
+
| |-- swarm-file-evidence.md <- P0 [size] [PASS/FAIL]
|
|
436
455
|
| |-- feature-lifecycle-ent.md <- P1 IF DDD [size] [PASS/FAIL]
|
|
437
456
|
| |-- secrets-management.md <- P0 IF external APIs [size] [PASS/FAIL]
|
|
438
457
|
| |-- domain-model.md <- P0 IF DDD [size] [PASS/FAIL]
|
|
@@ -515,7 +534,6 @@ IF any P0 mandatory check fails:
|
|
|
515
534
|
|
|
516
535
|
FAILED CHECKS:
|
|
517
536
|
- [Check N]: [description of what failed and where]
|
|
518
|
-
- [Check N]: [description of what failed and where]
|
|
519
537
|
|
|
520
538
|
Auto-fix attempted: [Y/N]
|
|
521
539
|
Remaining failures after auto-fix: [count]
|
package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/claude-md-strategy.md
CHANGED
|
@@ -73,6 +73,13 @@ These are identical regardless of pipeline.
|
|
|
73
73
|
- Use `Task` tool for independent subtasks
|
|
74
74
|
- Run tests, linting, type-checking in parallel
|
|
75
75
|
- For complex features: spawn specialized agents
|
|
76
|
+
- **Every parallel unit delivers a FILE, not a reply.** Give each one a unique `WORK_UNIT_ID` and an
|
|
77
|
+
absolute `TRACE_PATH`; it writes a substantive body ending in `Status: completed` or
|
|
78
|
+
`Status: failed` there before its one-line pointer. A dead worker and a working worker are both
|
|
79
|
+
silent, so silence is never progress. Verify before merging with
|
|
80
|
+
`node .claude/hooks/check-swarm-receipts.cjs <manifest>` (0 = all completed, 1 = a unit is
|
|
81
|
+
undelivered or failed, 2 = the check did not run). Full contract:
|
|
82
|
+
`.claude/rules/swarm-file-evidence.md`.
|
|
76
83
|
|
|
77
84
|
## Swarm Agents
|
|
78
85
|
| Scenario | Agents | Parallelism |
|
|
@@ -165,6 +165,23 @@ Then evaluate the feature to determine the right pipeline:
|
|
|
165
165
|
- Run tests in parallel with implementation of unrelated components
|
|
166
166
|
- Never parallelize tasks that have data dependencies
|
|
167
167
|
|
|
168
|
+
### Positive file receipt (required)
|
|
169
|
+
|
|
170
|
+
Before dispatch, allocate one `RUN_ID` and, for every unit, a unique `WORK_UNIT_ID` plus an
|
|
171
|
+
absolute `TRACE_PATH` unique to `(RUN_ID, WORK_UNIT_ID)`; record the launch instant and pass both
|
|
172
|
+
fields to the worker. Each worker must write a substantive body ending in `Status: completed` or
|
|
173
|
+
`Status: failed` to `TRACE_PATH` before it returns its one-line pointer. Before merge, verify every
|
|
174
|
+
path is a regular non-symlink file, non-whitespace, post-launch, and terminal. Narrative output or
|
|
175
|
+
silence is never a receipt. Name missing, stale, partial, unreadable, duplicate, failed, dead-PID,
|
|
176
|
+
or probe-error units and refuse merge, aggregation, or completion until every required receipt is
|
|
177
|
+
valid and completed. Run `node .claude/hooks/check-swarm-receipts.cjs <manifest>` — exit 0 all
|
|
178
|
+
completed, exit 1 undelivered or failed, exit 2 the check did not run. See
|
|
179
|
+
`.claude/rules/swarm-file-evidence.md` for mechanics and the bounded non-atomic-write exception.
|
|
180
|
+
|
|
181
|
+
This matters most in an AUTONOMOUS loop, where nobody is watching: a worker that died is silent and
|
|
182
|
+
a worker that is running is silent, so the loop keeps reporting progress on work that stopped hours
|
|
183
|
+
ago. The file receipt is what turns that into a red exit code instead of a comfortable narrative.
|
|
184
|
+
|
|
168
185
|
## Git Strategy
|
|
169
186
|
|
|
170
187
|
- Commit after each logical unit of work (not giant commits)
|
|
@@ -149,8 +149,8 @@ Use swarm of agents to validate:
|
|
|
149
149
|
| validator-coherence | All docs cross-ref | PRD↔DDD↔ADR↔C4 consistency |
|
|
150
150
|
|
|
151
151
|
**Iterative loop (max 3 iterations):**
|
|
152
|
-
1. Run all validators in parallel (Task tool)
|
|
153
|
-
2. Aggregate gaps and blocked items
|
|
152
|
+
1. Run all validators in parallel (Task tool), under the positive file receipt contract below
|
|
153
|
+
2. Aggregate gaps and blocked items — only from validators whose receipt is terminal-completed
|
|
154
154
|
3. Fix gaps in documents
|
|
155
155
|
4. Re-validate
|
|
156
156
|
5. Repeat until: no BLOCKED items, average score ≥70
|
|
@@ -175,9 +175,24 @@ When documentation is ready for implementation:
|
|
|
175
175
|
4. Generate tests from Gherkin .feature files
|
|
176
176
|
5. Validate Fitness Functions during implementation
|
|
177
177
|
6. Save frequent commits to GitHub
|
|
178
|
+
7. Validate every trace before merge or integration
|
|
179
|
+
|
|
180
|
+
#### Positive file receipt (required)
|
|
181
|
+
|
|
182
|
+
Before dispatch, allocate one `RUN_ID` and, for every unit, a unique `WORK_UNIT_ID` plus an
|
|
183
|
+
absolute `TRACE_PATH` unique to `(RUN_ID, WORK_UNIT_ID)`; record the launch instant and pass both
|
|
184
|
+
fields to the worker. Each worker must write a substantive body ending in `Status: completed` or
|
|
185
|
+
`Status: failed` to `TRACE_PATH` before it returns its one-line pointer. Before merge, verify every
|
|
186
|
+
path is a regular non-symlink file, non-whitespace, post-launch, and terminal. Narrative output or
|
|
187
|
+
silence is never a receipt. Name missing, stale, partial, unreadable, duplicate, failed, dead-PID,
|
|
188
|
+
or probe-error units and refuse merge, aggregation, or completion until every required receipt is
|
|
189
|
+
valid and completed. Run `node .claude/hooks/check-swarm-receipts.cjs <manifest>` — exit 0 all
|
|
190
|
+
completed, exit 1 undelivered or failed, exit 2 the check did not run. See
|
|
191
|
+
`.claude/rules/swarm-file-evidence.md` for mechanics and the bounded non-atomic-write exception.
|
|
178
192
|
|
|
179
193
|
**Implementation rules:**
|
|
180
|
-
- Each Bounded Context gets its own Task for parallel execution
|
|
194
|
+
- Each Bounded Context gets its own Task for parallel execution, with its own `WORK_UNIT_ID` and
|
|
195
|
+
`TRACE_PATH`
|
|
181
196
|
- Reference docs (pseudocode, DDD tactical, ADR), don't hallucinate code
|
|
182
197
|
- Commit after each logical unit: `feat(<feature-name>): <what>`
|
|
183
198
|
- Run tests from .feature files in parallel with implementation
|
|
@@ -207,8 +222,9 @@ Use swarm of agents for review:
|
|
|
207
222
|
Process:
|
|
208
223
|
1. Run brutal-honesty-review on implementation
|
|
209
224
|
2. Verify ADR compliance — each decision reflected in code
|
|
210
|
-
3. Verify Fitness Functions pass
|
|
211
|
-
|
|
225
|
+
3. Verify Fitness Functions pass — every review agent delivers under the same positive file
|
|
226
|
+
receipt contract as Phase 3; a reviewer that returned nothing did not review
|
|
227
|
+
4. Fix identified issues (use Task tool for parallel fixes, same contract)
|
|
212
228
|
5. Save frequent commits: `fix(<feature-name>): <what>`
|
|
213
229
|
6. Benchmark performance after implementation
|
|
214
230
|
7. Re-review critical findings until clean
|
|
@@ -302,6 +318,24 @@ Enterprise features with complex domains follow the 4-phase lifecycle:
|
|
|
302
318
|
|
|
303
319
|
### Implementation (Phase 3)
|
|
304
320
|
- One parallel Task per Bounded Context
|
|
321
|
+
|
|
322
|
+
#### Positive file receipt (required)
|
|
323
|
+
|
|
324
|
+
Before dispatch, allocate one `RUN_ID` and, for every unit, a unique `WORK_UNIT_ID` plus an
|
|
325
|
+
absolute `TRACE_PATH` unique to `(RUN_ID, WORK_UNIT_ID)`; record the launch instant and pass both
|
|
326
|
+
fields to the worker. Each worker must write a substantive body ending in `Status: completed` or
|
|
327
|
+
`Status: failed` to `TRACE_PATH` before it returns its one-line pointer. Before merge, verify every
|
|
328
|
+
path is a regular non-symlink file, non-whitespace, post-launch, and terminal. Narrative output or
|
|
329
|
+
silence is never a receipt. Name missing, stale, partial, unreadable, duplicate, failed, dead-PID,
|
|
330
|
+
or probe-error units and refuse merge, aggregation, or completion until every required receipt is
|
|
331
|
+
valid and completed. Run `node .claude/hooks/check-swarm-receipts.cjs <manifest>` — exit 0 all
|
|
332
|
+
completed, exit 1 undelivered or failed, exit 2 the check did not run. See
|
|
333
|
+
`.claude/rules/swarm-file-evidence.md` for mechanics and the bounded non-atomic-write exception.
|
|
334
|
+
|
|
335
|
+
Why the file and not the reply: a worker that died looks exactly like a worker still running —
|
|
336
|
+
both are silent — so a coordinator can report in good faith that a Bounded Context is under way
|
|
337
|
+
when nothing is running. A named file turns that into a fact a machine can check.
|
|
338
|
+
|
|
305
339
|
- Read pseudocode .pseudo files — don't hallucinate code
|
|
306
340
|
- Enforce aggregate invariants from DDD tactical docs
|
|
307
341
|
- Generate test stubs from Gherkin .feature files
|
|
@@ -388,6 +422,10 @@ Complex domain features use the enterprise lifecycle: `/feature-ent [name]`
|
|
|
388
422
|
3. **IMPLEMENT** — parallel agents per Bounded Context from validated docs
|
|
389
423
|
4. **REVIEW** — brutal-honesty-review swarm (6 agents) → ADR + fitness verified
|
|
390
424
|
|
|
425
|
+
Every swarm phase delivers under `.claude/rules/swarm-file-evidence.md`: each parallel unit writes
|
|
426
|
+
a file at a named `TRACE_PATH`, and an agent's reply is a pointer, never the result. Verify with
|
|
427
|
+
`node .claude/hooks/check-swarm-receipts.cjs <manifest>` before merging anything.
|
|
428
|
+
|
|
391
429
|
Use `/feature` for simple features, `/feature-ent` for complex domain features.
|
|
392
430
|
|
|
393
431
|
Available enterprise lifecycle skills in `.claude/skills/`:
|
|
@@ -133,8 +133,8 @@ Use swarm of agents to validate:
|
|
|
133
133
|
| validator-coherence | All SPARC files | Cross-reference consistency |
|
|
134
134
|
|
|
135
135
|
**Iterative loop (max 3 iterations):**
|
|
136
|
-
1. Run all validators in parallel (Task tool)
|
|
137
|
-
2. Aggregate gaps and blocked items
|
|
136
|
+
1. Run all validators in parallel (Task tool), under the positive file receipt contract below
|
|
137
|
+
2. Aggregate gaps and blocked items — only from validators whose receipt is terminal-completed
|
|
138
138
|
3. Fix gaps in SPARC documents
|
|
139
139
|
4. Re-validate
|
|
140
140
|
5. Repeat until: no BLOCKED items, average score ≥70
|
|
@@ -156,10 +156,24 @@ When SPARC plan is ready for implementation:
|
|
|
156
156
|
- Implementation agents — parallel Task tool for independent modules
|
|
157
157
|
3. **Make implementation modular** for reuse in other cases and applications
|
|
158
158
|
4. Save frequent commits to GitHub
|
|
159
|
-
5. Spawn concurrent tasks to speed up development
|
|
159
|
+
5. Spawn concurrent tasks to speed up development, under the contract below
|
|
160
|
+
6. Validate every trace before merge or integration
|
|
161
|
+
|
|
162
|
+
#### Positive file receipt (required)
|
|
163
|
+
|
|
164
|
+
Before dispatch, allocate one `RUN_ID` and, for every unit, a unique `WORK_UNIT_ID` plus an
|
|
165
|
+
absolute `TRACE_PATH` unique to `(RUN_ID, WORK_UNIT_ID)`; record the launch instant and pass both
|
|
166
|
+
fields to the worker. Each worker must write a substantive body ending in `Status: completed` or
|
|
167
|
+
`Status: failed` to `TRACE_PATH` before it returns its one-line pointer. Before merge, verify every
|
|
168
|
+
path is a regular non-symlink file, non-whitespace, post-launch, and terminal. Narrative output or
|
|
169
|
+
silence is never a receipt. Name missing, stale, partial, unreadable, duplicate, failed, dead-PID,
|
|
170
|
+
or probe-error units and refuse merge, aggregation, or completion until every required receipt is
|
|
171
|
+
valid and completed. Run `node .claude/hooks/check-swarm-receipts.cjs <manifest>` — exit 0 all
|
|
172
|
+
completed, exit 1 undelivered or failed, exit 2 the check did not run. See
|
|
173
|
+
`.claude/rules/swarm-file-evidence.md` for mechanics and the bounded non-atomic-write exception.
|
|
160
174
|
|
|
161
175
|
**Implementation rules:**
|
|
162
|
-
- Each module gets its own Task for parallel execution
|
|
176
|
+
- Each module gets its own Task for parallel execution, with its own `WORK_UNIT_ID` and `TRACE_PATH`
|
|
163
177
|
- Reference SPARC docs, don't hallucinate code
|
|
164
178
|
- Commit after each logical unit: `feat(<feature-name>): <what>`
|
|
165
179
|
- Run tests in parallel with implementation
|
|
@@ -185,8 +199,9 @@ Use swarm of agents for review:
|
|
|
185
199
|
| testing | Test coverage | Edge cases, missing tests |
|
|
186
200
|
|
|
187
201
|
Process:
|
|
188
|
-
1. Run brutal-honesty-review on implementation
|
|
189
|
-
|
|
202
|
+
1. Run brutal-honesty-review on implementation — every review agent delivers under the same
|
|
203
|
+
positive file receipt contract as Phase 3; a reviewer that returned nothing did not review
|
|
204
|
+
2. Fix identified issues (use Task tool for parallel fixes, same contract)
|
|
190
205
|
3. Save frequent commits: `fix(<feature-name>): <what>`
|
|
191
206
|
4. Benchmark after implementation
|
|
192
207
|
5. Re-review critical findings until clean
|
|
@@ -265,8 +280,25 @@ Every new feature MUST follow the 4-phase lifecycle:
|
|
|
265
280
|
- Run tests in parallel with development
|
|
266
281
|
- Format: `feat(<feature-name>): <description>`
|
|
267
282
|
|
|
283
|
+
#### Positive file receipt (required)
|
|
284
|
+
|
|
285
|
+
Before dispatch, allocate one `RUN_ID` and, for every unit, a unique `WORK_UNIT_ID` plus an
|
|
286
|
+
absolute `TRACE_PATH` unique to `(RUN_ID, WORK_UNIT_ID)`; record the launch instant and pass both
|
|
287
|
+
fields to the worker. Each worker must write a substantive body ending in `Status: completed` or
|
|
288
|
+
`Status: failed` to `TRACE_PATH` before it returns its one-line pointer. Before merge, verify every
|
|
289
|
+
path is a regular non-symlink file, non-whitespace, post-launch, and terminal. Narrative output or
|
|
290
|
+
silence is never a receipt. Name missing, stale, partial, unreadable, duplicate, failed, dead-PID,
|
|
291
|
+
or probe-error units and refuse merge, aggregation, or completion until every required receipt is
|
|
292
|
+
valid and completed. Run `node .claude/hooks/check-swarm-receipts.cjs <manifest>` — exit 0 all
|
|
293
|
+
completed, exit 1 undelivered or failed, exit 2 the check did not run. See
|
|
294
|
+
`.claude/rules/swarm-file-evidence.md` for mechanics and the bounded non-atomic-write exception.
|
|
295
|
+
|
|
296
|
+
Why the file and not the reply: a worker that died looks exactly like a worker still running —
|
|
297
|
+
both are silent — so a coordinator can report in good faith that work is under way when none is.
|
|
298
|
+
A named file turns that into a fact a machine can check.
|
|
299
|
+
|
|
268
300
|
### Review (Phase 4)
|
|
269
|
-
- Use brutal-honesty-review with swarm of agents
|
|
301
|
+
- Use brutal-honesty-review with swarm of agents, under the same positive file receipt contract
|
|
270
302
|
- No sugar-coating — find real problems
|
|
271
303
|
- Fix all critical and major issues before marking complete
|
|
272
304
|
- Benchmark performance after implementation
|
|
@@ -323,6 +355,10 @@ New features use the 4-phase lifecycle: `/feature [name]`
|
|
|
323
355
|
3. **IMPLEMENT** — parallel agents from validated docs
|
|
324
356
|
4. **REVIEW** — brutal-honesty-review swarm → fix all criticals
|
|
325
357
|
|
|
358
|
+
Every swarm phase delivers under `.claude/rules/swarm-file-evidence.md`: each parallel unit writes
|
|
359
|
+
a file at a named `TRACE_PATH`, and an agent's reply is a pointer, never the result. Verify with
|
|
360
|
+
`node .claude/hooks/check-swarm-receipts.cjs <manifest>` before merging anything.
|
|
361
|
+
|
|
326
362
|
Available lifecycle skills in `.claude/skills/`:
|
|
327
363
|
- `sparc-prd-mini` (orchestrator, delegates to explore, goap-research, problem-solver-enhanced)
|
|
328
364
|
- `explore` (Socratic questioning → Product Brief)
|
package/templates/.claude/skills/cc-toolkit-generator-enhanced/references/templates/start-command.md
CHANGED
|
@@ -54,8 +54,25 @@ Generate:
|
|
|
54
54
|
{{PACKAGE_FILE_LIST}}
|
|
55
55
|
|
|
56
56
|
**Commits:** {{PACKAGE_COMMITS}}
|
|
57
|
+
**Receipt:** write the substantive summary to `TRACE_PATH`, terminal line last, then reply one line.
|
|
57
58
|
{{/FOR_EACH_PACKAGE}}
|
|
58
59
|
|
|
60
|
+
#### Positive file receipt (required)
|
|
61
|
+
|
|
62
|
+
Before dispatch, allocate one `RUN_ID` and, for every unit, a unique `WORK_UNIT_ID` plus an
|
|
63
|
+
absolute `TRACE_PATH` unique to `(RUN_ID, WORK_UNIT_ID)`; record the launch instant and pass both
|
|
64
|
+
fields to the worker. Each worker must write a substantive body ending in `Status: completed` or
|
|
65
|
+
`Status: failed` to `TRACE_PATH` before it returns its one-line pointer. Before merge, verify every
|
|
66
|
+
path is a regular non-symlink file, non-whitespace, post-launch, and terminal. Narrative output or
|
|
67
|
+
silence is never a receipt. Name missing, stale, partial, unreadable, duplicate, failed, dead-PID,
|
|
68
|
+
or probe-error units and refuse merge, aggregation, or completion until every required receipt is
|
|
69
|
+
valid and completed. Run `node .claude/hooks/check-swarm-receipts.cjs <manifest>` — exit 0 all
|
|
70
|
+
completed, exit 1 undelivered or failed, exit 2 the check did not run. See
|
|
71
|
+
`.claude/rules/swarm-file-evidence.md` for mechanics and the bounded non-atomic-write exception.
|
|
72
|
+
|
|
73
|
+
Phase 3 may not begin until that check exits 0. A package Task that produced no trace produced no
|
|
74
|
+
package, however confidently it reported.
|
|
75
|
+
|
|
59
76
|
### Phase 3: Integration (sequential)
|
|
60
77
|
|
|
61
78
|
1. **Verify cross-package imports** (shared modules used correctly)
|
|
@@ -177,7 +194,8 @@ Check Architecture.md for database presence:
|
|
|
177
194
|
### Key Principles
|
|
178
195
|
|
|
179
196
|
1. **Docs as source of truth** — every Task must reference specific docs, never generate from memory
|
|
180
|
-
2. **Maximize parallelism** — independent packages run as parallel Tasks
|
|
197
|
+
2. **Maximize parallelism** — independent packages run as parallel Tasks, each delivering its own
|
|
198
|
+
file receipt; a Task's reply is a pointer, never the result
|
|
181
199
|
3. **Atomic commits** — one commit per logical change, not one giant commit
|
|
182
200
|
4. **Full integration** — Phase 3 MUST include Docker build + start + health check (+ DB if applicable)
|
|
183
201
|
5. **Error recovery** — git commits after each phase ensure progress is saved
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
# Swarm File Evidence Templates
|
|
2
|
+
|
|
3
|
+
> The swarm contract, in the form the GENERATOR emits it. Everything below is written INTO the
|
|
4
|
+
> target project — it is not guidance for this skill.
|
|
5
|
+
>
|
|
6
|
+
> WHY THIS FILE EXISTS. A worker that died looks exactly like a worker that is still running: both
|
|
7
|
+
> are silent. Silence therefore reads as `in progress`, and a coordinator reports in good faith
|
|
8
|
+
> that the review is running when no review exists. The absence of a receipt is indistinguishable
|
|
9
|
+
> from unfinished work, and so it reads as progress. The cure is to declare the RESULT of every
|
|
10
|
+
> parallel unit to be a FILE at a named path: no file, no work — and that is a fact a machine can
|
|
11
|
+
> establish, not a feeling a reader has to trust.
|
|
12
|
+
>
|
|
13
|
+
> MEASURED 2026-09-01 (the defect this closes): the generated feature lifecycle told the toolkit to
|
|
14
|
+
> launch parallel agents 22 times and required a file result zero times, while the package that
|
|
15
|
+
> emits it had already carried the cure in nine of its own files. The generator reproduced in every
|
|
16
|
+
> consumer project a defect its author had already fixed at home.
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## 1. Rule Template: `swarm-file-evidence.md`
|
|
21
|
+
|
|
22
|
+
**Output path:** `.claude/rules/swarm-file-evidence.md`
|
|
23
|
+
|
|
24
|
+
**Do NOT overwrite** an existing file at that path — `npx @dzhechkov/p-replicator init` pre-ships
|
|
25
|
+
this rule, and a project initialised that way already has it. Generate it only when the path is
|
|
26
|
+
absent, which is the case for every toolkit produced into a project this package never initialised.
|
|
27
|
+
|
|
28
|
+
Emit the body below VERBATIM. It is byte-identical to the pre-shipped rule, and
|
|
29
|
+
`tests/unit/generator-swarm-contract.test.js` asserts that identity, so the two cannot drift.
|
|
30
|
+
|
|
31
|
+
```markdown
|
|
32
|
+
# Swarm File Evidence
|
|
33
|
+
|
|
34
|
+
## Rule
|
|
35
|
+
|
|
36
|
+
Every parallel work unit has a named file result. A narrative reply is only a pointer; silence is
|
|
37
|
+
neither progress nor completion. The coordinator may aggregate only positive, attributable terminal
|
|
38
|
+
receipts from the assigned files.
|
|
39
|
+
|
|
40
|
+
## Mechanics
|
|
41
|
+
|
|
42
|
+
1. Before dispatch, allocate a run-unique `RUN_ID` and a unique `WORK_UNIT_ID`. Resolve one absolute
|
|
43
|
+
`TRACE_PATH` per `(RUN_ID, WORK_UNIT_ID)`, record its pre-launch state, and pass both fields to the
|
|
44
|
+
worker. Two workers never share a path.
|
|
45
|
+
2. The worker writes a substantive Markdown body to a temporary regular file in the same directory,
|
|
46
|
+
appends exactly `Status: completed` or `Status: failed` as the final line, renames it to
|
|
47
|
+
`TRACE_PATH`, then returns a one-line pointer. The terminal marker is written last.
|
|
48
|
+
3. Before merge, synthesis, or completion, the coordinator checks each assigned path: absolute and
|
|
49
|
+
unique; regular and non-symlink; readable and non-whitespace; absent before launch or observably
|
|
50
|
+
changed after launch; final line terminal. It reads the file as the payload and reports
|
|
51
|
+
`valid receipts / required receipts` with every failed `WORK_UNIT_ID` and path.
|
|
52
|
+
4. `Status: completed` permits consumption. `Status: failed` is a delivered failure and blocks a
|
|
53
|
+
successful aggregate. Missing, empty, stale, partial, unreadable, duplicate, or probe-error
|
|
54
|
+
evidence is undelivered or inconclusive. A dead PID stops waiting as failure; a live PID may only
|
|
55
|
+
extend waiting. Neither PID state proves delivery.
|
|
56
|
+
|
|
57
|
+
## Bounded exception
|
|
58
|
+
|
|
59
|
+
If atomic rename is unavailable, write directly to `TRACE_PATH` and append the terminal marker last;
|
|
60
|
+
until that line exists the file is partial. Host-authoritative liveness may extend a deadline, but it
|
|
61
|
+
cannot replace the file result or turn missing evidence into success.
|
|
62
|
+
|
|
63
|
+
## Observable violation → replacement
|
|
64
|
+
|
|
65
|
+
| Observable violation | Required replacement |
|
|
66
|
+
|---|---|
|
|
67
|
+
| Task report exists but `TRACE_PATH` does not | Name the unit/path, mark undelivered, and refuse aggregation. |
|
|
68
|
+
| File is empty, stale, symlinked, unreadable, or non-terminal | Keep the evidence out of the aggregate and rerun or diagnose that unit. |
|
|
69
|
+
| Status says `running` but its recorded PID is dead | Close the unit as failed; do not report continued work from silence. |
|
|
70
|
+
| Fewer than all required receipts are terminal-completed | Report the partial ratio and refuse completion. |
|
|
71
|
+
|
|
72
|
+
## Self-check
|
|
73
|
+
|
|
74
|
+
For every parallel unit, point to its assignment containing `WORK_UNIT_ID` and absolute `TRACE_PATH`,
|
|
75
|
+
then point to the coordinator check performed before aggregation. Exercise missing, empty, stale,
|
|
76
|
+
partial, failed, dead-PID, and probe-error traces; only a fresh substantive file ending in
|
|
77
|
+
`Status: completed` may satisfy delivery.
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## 2. Seam Template: the positive file receipt
|
|
83
|
+
|
|
84
|
+
**Paste this block VERBATIM into every generated instruction that dispatches parallel agents** —
|
|
85
|
+
the `/feature` and `/feature-ent` commands, the `feature-lifecycle` rules, `/start` Phase 2, the
|
|
86
|
+
autonomous `/run` and `/go` loops, and any pipeline a project builds with `pipeline-forge`.
|
|
87
|
+
It is short on purpose: a contract nobody can afford to repeat is a contract that gets dropped.
|
|
88
|
+
|
|
89
|
+
```markdown
|
|
90
|
+
#### Positive file receipt (required)
|
|
91
|
+
|
|
92
|
+
Before dispatch, allocate one `RUN_ID` and, for every unit, a unique `WORK_UNIT_ID` plus an
|
|
93
|
+
absolute `TRACE_PATH` unique to `(RUN_ID, WORK_UNIT_ID)`; record the launch instant and pass both
|
|
94
|
+
fields to the worker. Each worker must write a substantive body ending in `Status: completed` or
|
|
95
|
+
`Status: failed` to `TRACE_PATH` before it returns its one-line pointer. Before merge, verify every
|
|
96
|
+
path is a regular non-symlink file, non-whitespace, post-launch, and terminal. Narrative output or
|
|
97
|
+
silence is never a receipt. Name missing, stale, partial, unreadable, duplicate, failed, dead-PID,
|
|
98
|
+
or probe-error units and refuse merge, aggregation, or completion until every required receipt is
|
|
99
|
+
valid and completed. See `.claude/rules/swarm-file-evidence.md` for mechanics and the bounded
|
|
100
|
+
non-atomic-write exception.
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## 3. The deterministic half: `check-swarm-receipts.cjs`
|
|
104
|
+
|
|
105
|
+
Section 2 is layer-2 text — it is read every run and violated in silence. The layer-1 half is a
|
|
106
|
+
utility that answers the same question without a model in the loop:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
node .claude/hooks/check-swarm-receipts.cjs .claude/traces/<RUN_ID>/receipts.json
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Three exit codes, and the third is the point:
|
|
113
|
+
|
|
114
|
+
| Exit | Meaning | Coordinator's obligation |
|
|
115
|
+
|------|---------|--------------------------|
|
|
116
|
+
| `0` | every receipt is fresh, substantive and `Status: completed` | may aggregate |
|
|
117
|
+
| `1` | at least one unit is undelivered or delivered `Status: failed` | refuse merge; name the units |
|
|
118
|
+
| `2` | THE CHECK DID NOT RUN — no manifest, malformed assignment, unreadable trace, or a still-live worker | refuse merge; this is an unknown, never a pass |
|
|
119
|
+
|
|
120
|
+
The coordinator writes the manifest BEFORE dispatch, which is what makes freshness checkable at all
|
|
121
|
+
— `launchMs` cannot be recovered afterwards:
|
|
122
|
+
|
|
123
|
+
```json
|
|
124
|
+
{
|
|
125
|
+
"runId": "feature-auth-2026-09-01T12-00-00Z",
|
|
126
|
+
"launchMs": 1756728000000,
|
|
127
|
+
"units": [
|
|
128
|
+
{ "workUnitId": "api", "tracePath": "/abs/project/.claude/traces/<RUN_ID>/api.md", "pid": 12345 },
|
|
129
|
+
{ "workUnitId": "docs", "tracePath": "/abs/project/.claude/traces/<RUN_ID>/docs.md" }
|
|
130
|
+
]
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
`pid` is optional and can only move an ABSENT trace between "undelivered" and "still waiting". A
|
|
135
|
+
live worker may extend waiting; liveness has never been delivery.
|
|
136
|
+
|
|
137
|
+
## 4. Where the generator must place all of this
|
|
138
|
+
|
|
139
|
+
| Generated artifact | What must appear |
|
|
140
|
+
|---|---|
|
|
141
|
+
| `.claude/rules/swarm-file-evidence.md` | Section 1 verbatim, unless the path already exists |
|
|
142
|
+
| `.claude/commands/feature.md` — Phase 3 | Section 2 block |
|
|
143
|
+
| `.claude/rules/feature-lifecycle.md` — Implementation | Section 2 block |
|
|
144
|
+
| `.claude/commands/feature-ent.md` + `feature-lifecycle-ent.md` | Section 2 block |
|
|
145
|
+
| `.claude/commands/start.md` — Phase 2 | Section 2 block |
|
|
146
|
+
| Autonomous loop commands (`/run`, `/go`) | Section 2 block |
|
|
147
|
+
| Any `pipeline-forge` pipeline with a swarm stage | Section 2 block |
|
|
148
|
+
| `CLAUDE.md` lifecycle section | one line naming the rule, so the contract is discoverable |
|
|
149
|
+
|
|
150
|
+
A generated toolkit that dispatches parallel agents anywhere and carries none of this is INCOMPLETE
|
|
151
|
+
— `06-package-deliver.md` fails delivery on it.
|