mustflow 2.116.4 → 2.117.1
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/package.json +1 -1
- package/templates/default/i18n.toml +152 -8
- package/templates/default/locales/en/.mustflow/skills/INDEX.md +131 -13
- package/templates/default/locales/en/.mustflow/skills/agent-eval-integrity-review/SKILL.md +62 -34
- package/templates/default/locales/en/.mustflow/skills/agent-execution-control-review/SKILL.md +102 -31
- package/templates/default/locales/en/.mustflow/skills/agent-memory-context-governance-review/SKILL.md +163 -0
- package/templates/default/locales/en/.mustflow/skills/agent-planning-recovery-review/SKILL.md +180 -0
- package/templates/default/locales/en/.mustflow/skills/agent-release-bundle-rollout-review/SKILL.md +181 -0
- package/templates/default/locales/en/.mustflow/skills/agent-runtime-isolation-review/SKILL.md +196 -0
- package/templates/default/locales/en/.mustflow/skills/agent-runtime-multi-worker-review/SKILL.md +180 -0
- package/templates/default/locales/en/.mustflow/skills/automation-investment-case-review/SKILL.md +173 -0
- package/templates/default/locales/en/.mustflow/skills/client-platform-strategy-review/SKILL.md +236 -0
- package/templates/default/locales/en/.mustflow/skills/connection-lifecycle-integrity-review/SKILL.md +302 -0
- package/templates/default/locales/en/.mustflow/skills/connection-lifecycle-integrity-review/references/connection-fault-injection-resource-lifetime-validation.md +277 -0
- package/templates/default/locales/en/.mustflow/skills/connection-lifecycle-integrity-review/references/node-stream-transport-lifecycle-checklist.md +381 -0
- package/templates/default/locales/en/.mustflow/skills/credit-ledger-integrity-review/SKILL.md +8 -4
- package/templates/default/locales/en/.mustflow/skills/credit-monetization-integrity-review/SKILL.md +283 -0
- package/templates/default/locales/en/.mustflow/skills/desktop-commercial-distribution-review/SKILL.md +225 -0
- package/templates/default/locales/en/.mustflow/skills/external-prompt-injection-defense/SKILL.md +49 -3
- package/templates/default/locales/en/.mustflow/skills/freemium-ad-monetization-review/SKILL.md +196 -0
- package/templates/default/locales/en/.mustflow/skills/game-economy-monetization-review/SKILL.md +208 -0
- package/templates/default/locales/en/.mustflow/skills/game-liveops-commerce-integrity-review/SKILL.md +237 -0
- package/templates/default/locales/en/.mustflow/skills/growth-distribution-integrity-review/SKILL.md +247 -0
- package/templates/default/locales/en/.mustflow/skills/idempotency-integrity-review/SKILL.md +20 -2
- package/templates/default/locales/en/.mustflow/skills/llm-model-routing-integrity-review/SKILL.md +183 -0
- package/templates/default/locales/en/.mustflow/skills/llm-product-monetization-review/SKILL.md +311 -0
- package/templates/default/locales/en/.mustflow/skills/llm-token-cost-control-review/SKILL.md +15 -1
- package/templates/default/locales/en/.mustflow/skills/localization-market-expansion-review/SKILL.md +224 -0
- package/templates/default/locales/en/.mustflow/skills/memory-lifetime-review/SKILL.md +94 -2
- package/templates/default/locales/en/.mustflow/skills/memory-lifetime-review/references/cross-runtime-memory-stream-reproduction-harness.md +289 -0
- package/templates/default/locales/en/.mustflow/skills/memory-lifetime-review/references/node-memory-resource-backpressure-diagnostics.md +369 -0
- package/templates/default/locales/en/.mustflow/skills/multi-agent-work-coordination/SKILL.md +7 -2
- package/templates/default/locales/en/.mustflow/skills/pricing-model-integrity-review/SKILL.md +288 -0
- package/templates/default/locales/en/.mustflow/skills/product-engagement-retention-review/SKILL.md +234 -0
- package/templates/default/locales/en/.mustflow/skills/product-onboarding-activation-review/SKILL.md +269 -0
- package/templates/default/locales/en/.mustflow/skills/product-portfolio-integrity-review/SKILL.md +233 -0
- package/templates/default/locales/en/.mustflow/skills/prompt-contract-quality-review/SKILL.md +1 -0
- package/templates/default/locales/en/.mustflow/skills/referral-incentive-integrity-review/SKILL.md +206 -0
- package/templates/default/locales/en/.mustflow/skills/retry-policy-integrity-review/SKILL.md +45 -2
- package/templates/default/locales/en/.mustflow/skills/routes.toml +346 -7
- package/templates/default/locales/en/.mustflow/skills/service-portfolio-capital-allocation-review/SKILL.md +245 -0
- package/templates/default/locales/en/.mustflow/skills/subscription-retention-profit-review/SKILL.md +217 -0
- package/templates/default/manifest.toml +97 -1
package/templates/default/locales/en/.mustflow/skills/client-platform-strategy-review/SKILL.md
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
---
|
|
2
|
+
mustflow_doc: skill.client-platform-strategy-review
|
|
3
|
+
locale: en
|
|
4
|
+
canonical: true
|
|
5
|
+
revision: 1
|
|
6
|
+
lifecycle: mustflow-owned
|
|
7
|
+
authority: procedure
|
|
8
|
+
name: client-platform-strategy-review
|
|
9
|
+
description: Apply this skill when a consumer or prosumer product chooses responsive web versus mobile app first, mobile web versus PWA versus cross-platform or native clients, an app as an acquisition or retention surface, native break-even users, operating-system capability dependence, or local-first versus cloud-first desktop data ownership, offline behavior, synchronization, recovery, privacy, and client-platform investment sequencing.
|
|
10
|
+
metadata:
|
|
11
|
+
mustflow_schema: "1"
|
|
12
|
+
mustflow_kind: procedure
|
|
13
|
+
pack_id: mustflow.core
|
|
14
|
+
skill_id: mustflow.core.client-platform-strategy-review
|
|
15
|
+
command_intents:
|
|
16
|
+
- changes_status
|
|
17
|
+
- changes_diff_summary
|
|
18
|
+
- lint
|
|
19
|
+
- build
|
|
20
|
+
- test_related
|
|
21
|
+
- test
|
|
22
|
+
- docs_validate_fast
|
|
23
|
+
- test_release
|
|
24
|
+
- mustflow_check
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# Client Platform Strategy Review
|
|
28
|
+
|
|
29
|
+
<!-- mustflow-section: purpose -->
|
|
30
|
+
## Purpose
|
|
31
|
+
|
|
32
|
+
Choose web, PWA, cross-platform, native, local-first, cloud-first, or hybrid client architecture
|
|
33
|
+
from the product job, operating-system capabilities, complete funnel economics, data authority, and
|
|
34
|
+
failure recovery. Prevent platform prestige, raw install retention, or storage price from replacing
|
|
35
|
+
an actual investment and usability decision.
|
|
36
|
+
|
|
37
|
+
<!-- mustflow-section: use-when -->
|
|
38
|
+
## Use When
|
|
39
|
+
|
|
40
|
+
- A new B2C or prosumer service compares responsive web-first with iOS, Android, or another native
|
|
41
|
+
app-first launch.
|
|
42
|
+
- A product compares mobile web, installable PWA, wrapped web, shared cross-platform client, or
|
|
43
|
+
separate native clients.
|
|
44
|
+
- A proposal treats an app as acquisition, retention, notification, offline, device-capability, or
|
|
45
|
+
checkout infrastructure and needs a break-even user or retained-contribution model.
|
|
46
|
+
- A desktop or mobile product compares local-only, local-first with sync, cloud-first with cache, or
|
|
47
|
+
server-only data ownership.
|
|
48
|
+
- Offline work, device files, collaboration, multi-device recovery, conflict resolution, privacy,
|
|
49
|
+
encryption, account rights, or sync engineering changes the client strategy.
|
|
50
|
+
|
|
51
|
+
<!-- mustflow-section: do-not-use-when -->
|
|
52
|
+
## Do Not Use When
|
|
53
|
+
|
|
54
|
+
- The client platform is already chosen and the task only compares website, Microsoft Store, Mac
|
|
55
|
+
App Store, or hybrid desktop sales and distribution; use
|
|
56
|
+
`desktop-commercial-distribution-review`.
|
|
57
|
+
- The task only implements one frontend framework, native bridge, service worker, cache, installer,
|
|
58
|
+
updater, mobile permission, or platform API; use the matching implementation and platform skill.
|
|
59
|
+
- The task only changes synchronization algorithms, database migrations, encryption, access
|
|
60
|
+
control, backup, or privacy behavior after the authority model is fixed; use the narrower data,
|
|
61
|
+
security, privacy, migration, or architecture skill.
|
|
62
|
+
- The task only selects a framework, vendor, database, or runtime; use `technology-stack-selection`.
|
|
63
|
+
- The task requests current platform-law, tax, app-store contract, or consumer-rights advice. Use
|
|
64
|
+
current official policy and qualified authority; this skill supplies the decision packet.
|
|
65
|
+
|
|
66
|
+
<!-- mustflow-section: required-inputs -->
|
|
67
|
+
## Required Inputs
|
|
68
|
+
|
|
69
|
+
- Product job ledger: target user, first owned value, repeat cadence, session length, acquisition
|
|
70
|
+
source, sharing, search demand, price, payer, support, accessibility, and expected retention.
|
|
71
|
+
- Capability ledger: camera, location, Bluetooth, wearable, background execution, notification,
|
|
72
|
+
widgets, low-latency media, offline duration, filesystem, plugins, secure hardware, and platform
|
|
73
|
+
restrictions.
|
|
74
|
+
- Funnel ledger by eligible user: impression, landing or listing visit, install or open, permission,
|
|
75
|
+
signup, first value, purchase, refund, retained use, support, and contribution.
|
|
76
|
+
- Client cost ledger: design, implementation, shared and platform-specific code, QA devices,
|
|
77
|
+
accessibility, analytics parity, store review, deep links, notifications, checkout restoration,
|
|
78
|
+
OS updates, support, and decommissioning.
|
|
79
|
+
- Data ledger: record and file classes, authoritative owner, size and growth, device count,
|
|
80
|
+
collaboration, offline edits, consistency, deletion, retention, export, backup, restore, audit,
|
|
81
|
+
quota, abuse, and legal authority.
|
|
82
|
+
- Sync and recovery ledger: local database, change log, outbox, server replica, versioning, conflict
|
|
83
|
+
policy, stale client, duplicate, clock, tombstone, account merge, key recovery, device loss, and
|
|
84
|
+
disaster recovery.
|
|
85
|
+
- Current platform ledger: operating-system and browser versions, install and notification behavior,
|
|
86
|
+
payment policy, fees, permitted commerce, signing, review, capability support, region, program,
|
|
87
|
+
source date, and confidence.
|
|
88
|
+
- Experiment ledger: eligible cohort, assignment before channel choice, acquisition source,
|
|
89
|
+
capability need, platform availability, self-selection, promotion, horizon, and guardrails.
|
|
90
|
+
|
|
91
|
+
<!-- mustflow-section: preconditions -->
|
|
92
|
+
## Preconditions
|
|
93
|
+
|
|
94
|
+
- Separate launch surface, installability, native capability, commerce, retention, and data authority.
|
|
95
|
+
One choice does not prove the others.
|
|
96
|
+
- Compare web and app cohorts from the same eligible population or explicitly model self-selection.
|
|
97
|
+
- Define a usable retained outcome and contribution before calculating break-even users.
|
|
98
|
+
- Treat copied development multipliers, fee percentages, conversion lifts, user thresholds, storage
|
|
99
|
+
prices, and platform features as dated assumptions, not built-in defaults.
|
|
100
|
+
- Refresh current platform behavior by OS, browser, region, app type, commerce type, and program
|
|
101
|
+
before changing live product or financial policy.
|
|
102
|
+
- This skill does not authorize developer enrollment, app submission, payment changes, production
|
|
103
|
+
experiments, data migration, cryptographic key access, release, or deployment.
|
|
104
|
+
|
|
105
|
+
<!-- mustflow-section: allowed-edits -->
|
|
106
|
+
## Allowed Edits
|
|
107
|
+
|
|
108
|
+
- Add or refine client strategy, capability matrices, funnel and contribution models, platform
|
|
109
|
+
sequencing, data-authority maps, offline and sync contracts, recovery and privacy policies,
|
|
110
|
+
experiments, events, fixtures, tests, docs, route metadata, and synchronized templates.
|
|
111
|
+
- Add explicit handoffs to frontend, mobile, desktop, payments, store distribution, accessibility,
|
|
112
|
+
sync, database, security, privacy, backup, or migration owners.
|
|
113
|
+
- Replace platform ideology, raw install comparison, gross fee arithmetic, last-write-wins data loss,
|
|
114
|
+
or local-storage marketing with explicit capabilities, economics, authority, and recovery evidence.
|
|
115
|
+
- Do not fork the domain model without evidence, hide platform limitations, weaken privacy or
|
|
116
|
+
accessibility, migrate user data silently, or promise offline, sync, recovery, or encryption that
|
|
117
|
+
the current architecture cannot provide.
|
|
118
|
+
|
|
119
|
+
<!-- mustflow-section: procedure -->
|
|
120
|
+
## Procedure
|
|
121
|
+
|
|
122
|
+
1. Split two primary decisions: client delivery surface and data authority. A web-first launch can
|
|
123
|
+
still use local data, and a native app can still be cloud-authoritative.
|
|
124
|
+
2. Classify whether the operating system is part of the product's core value. Mark required camera,
|
|
125
|
+
continuous location, Bluetooth, wearable, background, notification, widget, low-latency media,
|
|
126
|
+
filesystem, secure hardware, or offline capability and test whether the web path actually meets
|
|
127
|
+
the requirement on each target platform.
|
|
128
|
+
3. Start from the smallest surface that can deliver representative first value. Responsive web is a
|
|
129
|
+
candidate when link, search, sharing, immediate trial, and one code path dominate; native-first
|
|
130
|
+
is a candidate when a required OS capability or app-native usage loop is the product itself.
|
|
131
|
+
4. Treat the web as an acquisition candidate and an installed app as a retention candidate, not as
|
|
132
|
+
universal truths. Measure how each surface changes the complete funnel for the same eligible
|
|
133
|
+
users.
|
|
134
|
+
5. Separate PWA layers. Decide responsive fit, manifest and install, notification, service-worker
|
|
135
|
+
caching, offline reads, offline writes, background behavior, and sync independently. Do not build
|
|
136
|
+
a complex offline layer merely to earn a PWA label.
|
|
137
|
+
6. Sequence capability investment. A reversible candidate is responsive product value, then install
|
|
138
|
+
and notification for proven repeat users, then bounded offline behavior for observed need, then
|
|
139
|
+
shared or native clients when retained contribution can pay for them.
|
|
140
|
+
7. Compare client costs across the full lifecycle. Include duplicated design and implementation,
|
|
141
|
+
platform QA, devices, accessibility, analytics drift, permissions, deep links, authentication,
|
|
142
|
+
payment restoration, store review, OS changes, support, and release coordination.
|
|
143
|
+
8. Use D30-or-product-cadence qualified CAC, not click cost versus install cost. Count a user only
|
|
144
|
+
after representative value and the chosen retention horizon; an app install is not an accepted
|
|
145
|
+
product outcome.
|
|
146
|
+
9. Calculate net contribution per eligible user. Include payment and store costs, refund, variable
|
|
147
|
+
product cost, acquisition, support, platform operations, and retention value. If native contribution
|
|
148
|
+
per user is not higher after variable costs, more users cannot repay fixed native investment.
|
|
149
|
+
10. Derive break-even users from current inputs. Divide incremental fixed and step-fixed native cost
|
|
150
|
+
by incremental retained contribution per comparable active user. Include extra acquisition cost
|
|
151
|
+
and report zero, negative, or unstable denominators instead of manufacturing a threshold.
|
|
152
|
+
11. Run sensitivity around the assumptions that can reverse the result: eligible paid conversion,
|
|
153
|
+
repeat use, app retention lift, store fee, price, refund, native QA cost, new-user share, and
|
|
154
|
+
channel-specific CAC. Report a range, not one magic MAU count.
|
|
155
|
+
12. Correct self-selection. App users may have higher pre-existing intent. Use staged invitations,
|
|
156
|
+
matched cohorts, randomized prompts, or another defensible design before calling observed app
|
|
157
|
+
retention causal.
|
|
158
|
+
13. Map data authority by class. Keep identity, billing, entitlement, organization membership,
|
|
159
|
+
quota, abuse, audit, and legal deletion server-authoritative when central enforcement is required.
|
|
160
|
+
Decide user content authority separately.
|
|
161
|
+
14. Choose local-first when immediate response, offline creation, large personal files, user custody,
|
|
162
|
+
or long-lived device ownership materially creates value. Choose cloud-first when collaboration,
|
|
163
|
+
instant cross-device state, central authorization, audit, recovery, or server-side transactions
|
|
164
|
+
dominate. Treat both as candidates, not ideology.
|
|
165
|
+
15. Prefer explicit hybrids. A local-first client may use encrypted replication and backup; a
|
|
166
|
+
cloud-first client should still use a durable local cache and outbox where interrupted work must
|
|
167
|
+
survive. Name the authority and failure behavior for every data class.
|
|
168
|
+
16. Price local-first engineering honestly. Include local schema migration, corruption handling,
|
|
169
|
+
change logs, retry, deduplication, tombstones, stale clients, conflict UX, compatibility,
|
|
170
|
+
encryption, key recovery, export, and support. Avoid comparing that engineering cost with raw
|
|
171
|
+
object-storage price alone.
|
|
172
|
+
17. Define sync semantics before choosing an algorithm. Cover concurrent edits, delete-versus-edit,
|
|
173
|
+
uniqueness, ordering, access revocation while offline, quota crossing, account merge, and old
|
|
174
|
+
client reappearance. Last write wins and CRDTs do not decide product policy automatically.
|
|
175
|
+
18. Use the simplest conflict model that meets the product. Document versions, three-way merge, or
|
|
176
|
+
conflict copies can be safer than a general collaborative CRDT when simultaneous editing is not
|
|
177
|
+
a core job.
|
|
178
|
+
19. Make privacy claims reconstructable. State what remains only on device, what is replicated,
|
|
179
|
+
whether the service can decrypt it, what telemetry leaves the device, how keys are stored, and
|
|
180
|
+
how loss, export, deletion, remote wipe, and recovery work.
|
|
181
|
+
20. Separate confidentiality from recoverability. End-to-end or client-side encryption can reduce
|
|
182
|
+
provider access while making forgotten-key recovery harder; define recovery keys, trusted-device
|
|
183
|
+
transfer, or explicit irrecoverability without misleading promises.
|
|
184
|
+
21. Measure full outcomes: eligible acquisition, first value, qualified retained use, purchase,
|
|
185
|
+
refund, support, sync conflict, lost work, recovery success, privacy complaints, platform failure,
|
|
186
|
+
and retained contribution.
|
|
187
|
+
22. Promote only a reversible strategy that meets required capabilities, improves retained
|
|
188
|
+
contribution, preserves accessible and honest UX, assigns every data authority, and has a tested
|
|
189
|
+
recovery model before irreversible migration.
|
|
190
|
+
|
|
191
|
+
<!-- mustflow-section: postconditions -->
|
|
192
|
+
## Postconditions
|
|
193
|
+
|
|
194
|
+
- Launch surface, install, native capability, commerce, retention, and data authority decisions are
|
|
195
|
+
explicit rather than collapsed into web versus app ideology.
|
|
196
|
+
- Break-even uses comparable eligible users, full lifecycle costs, incremental retained contribution,
|
|
197
|
+
self-selection controls, and sensitivity ranges.
|
|
198
|
+
- Every data class has an authority, offline behavior, conflict rule, privacy statement, backup, and
|
|
199
|
+
recovery owner.
|
|
200
|
+
- Local-first and cloud-first claims include sync and failure cost rather than raw latency, storage
|
|
201
|
+
price, or marketing language alone.
|
|
202
|
+
|
|
203
|
+
<!-- mustflow-section: verification -->
|
|
204
|
+
## Verification
|
|
205
|
+
|
|
206
|
+
Use configured oneshot command intents when available: `changes_status`, `changes_diff_summary`,
|
|
207
|
+
`lint`, `build`, `test_related`, `test`, `docs_validate_fast`, `test_release`, and
|
|
208
|
+
`mustflow_check`. Do not infer live store, browser, mobile device, payment, notification, signing,
|
|
209
|
+
submission, analytics, migration, sync, encryption, backup, recovery, deployment, or production
|
|
210
|
+
commands.
|
|
211
|
+
|
|
212
|
+
<!-- mustflow-section: failure-handling -->
|
|
213
|
+
## Failure Handling
|
|
214
|
+
|
|
215
|
+
- If required capabilities cannot be verified on a target surface, mark that surface unknown or
|
|
216
|
+
infeasible instead of assuming parity.
|
|
217
|
+
- If comparable funnel cohorts or incremental per-user contribution are missing, report the native
|
|
218
|
+
break-even as non-decision-ready.
|
|
219
|
+
- If the denominator is zero or negative, report that no finite user count repays the modeled native
|
|
220
|
+
investment under those assumptions.
|
|
221
|
+
- If data authority, conflict semantics, key recovery, or lost-device recovery is undefined, do not
|
|
222
|
+
approve local-first or cloud-first migration.
|
|
223
|
+
- If current store or platform policy cannot be refreshed, keep policy-dependent economics dated and
|
|
224
|
+
unverified rather than encoding them as a default.
|
|
225
|
+
|
|
226
|
+
<!-- mustflow-section: output-format -->
|
|
227
|
+
## Output Format
|
|
228
|
+
|
|
229
|
+
- Product job, eligible user, first value, repeat cadence, platform, and required capability
|
|
230
|
+
- Responsive web, PWA, cross-platform, and native capability and lifecycle-cost matrix
|
|
231
|
+
- Comparable funnel, qualified CAC, retained contribution, break-even range, sensitivity, and
|
|
232
|
+
self-selection evidence
|
|
233
|
+
- Data classes, authority, local and server state, offline behavior, conflicts, sync, privacy,
|
|
234
|
+
encryption, backup, export, deletion, and recovery
|
|
235
|
+
- Current platform source and date, files changed, command intents run and skipped checks
|
|
236
|
+
- Remaining client-platform strategy risk
|
package/templates/default/locales/en/.mustflow/skills/connection-lifecycle-integrity-review/SKILL.md
ADDED
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
---
|
|
2
|
+
mustflow_doc: skill.connection-lifecycle-integrity-review
|
|
3
|
+
locale: en
|
|
4
|
+
canonical: true
|
|
5
|
+
revision: 2
|
|
6
|
+
lifecycle: mustflow-owned
|
|
7
|
+
authority: procedure
|
|
8
|
+
name: connection-lifecycle-integrity-review
|
|
9
|
+
description: Apply this skill when TCP sockets, HTTP keep-alive or pooling, HTTP/2 streams or sessions, Node.js streams, Web Streams readers or writers, FIN/RST handling, half-close behavior, destroy or abort races, unconsumed response bodies, backpressure, connection shutdown, transport resource leaks, fault injection, soak tests, or connection-lifetime resolution claims are created, changed, reviewed, debugged, validated, or reported.
|
|
10
|
+
metadata:
|
|
11
|
+
mustflow_schema: "1"
|
|
12
|
+
mustflow_kind: procedure
|
|
13
|
+
pack_id: mustflow.core
|
|
14
|
+
skill_id: mustflow.core.connection-lifecycle-integrity-review
|
|
15
|
+
command_intents:
|
|
16
|
+
- changes_status
|
|
17
|
+
- changes_diff_summary
|
|
18
|
+
- lint
|
|
19
|
+
- build
|
|
20
|
+
- test_related
|
|
21
|
+
- test
|
|
22
|
+
- docs_validate_fast
|
|
23
|
+
- test_release
|
|
24
|
+
- mustflow_check
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
# Connection Lifecycle Integrity Review
|
|
28
|
+
|
|
29
|
+
<!-- mustflow-section: purpose -->
|
|
30
|
+
## Purpose
|
|
31
|
+
|
|
32
|
+
Keep physical connections, transport read and write sides, logical requests, response bodies,
|
|
33
|
+
reader or writer ownership, pool eligibility, and process shutdown from being collapsed into one
|
|
34
|
+
misleading lifecycle flag.
|
|
35
|
+
|
|
36
|
+
The central invariant is not that every connection is destroyed. Graceful FIN paths may never call
|
|
37
|
+
`destroy`. The stronger invariant is that every owned connection record is finalized exactly once,
|
|
38
|
+
and an abortive destroy or reset action is accepted at most once.
|
|
39
|
+
|
|
40
|
+
<!-- mustflow-section: use-when -->
|
|
41
|
+
## Use When
|
|
42
|
+
|
|
43
|
+
- TCP, TLS, HTTP/1.1 keep-alive, HTTP/2 multiplexing, HTTP clients, servers, agents, dispatchers,
|
|
44
|
+
connection pools, upgraded sockets, WebSocket, CONNECT, or raw stream transports change.
|
|
45
|
+
- Code handles `end`, `finish`, `error`, `close`, FIN, RST, timeout, abort, `destroy`,
|
|
46
|
+
`resetAndDestroy`, half-close, pending writes, drain, or shutdown deadlines.
|
|
47
|
+
- A logical request, response body, body reader, stream, or HTTP/2 stream can finish or cancel while
|
|
48
|
+
its physical connection or session remains alive.
|
|
49
|
+
- Response bodies can be partially read, paused, abandoned, discarded, cancelled, or left locked.
|
|
50
|
+
- Slow consumers, backpressure, retries, transforms, adapters, or observability capture can retain
|
|
51
|
+
unbounded buffers.
|
|
52
|
+
- A review or report claims that sockets are leak-free, safely reusable, fully drained, naturally
|
|
53
|
+
terminating, or closed exactly once.
|
|
54
|
+
|
|
55
|
+
<!-- mustflow-section: do-not-use-when -->
|
|
56
|
+
## Do Not Use When
|
|
57
|
+
|
|
58
|
+
- The task only changes HTTP schemas, status codes, or headers with no connection, body, pooling,
|
|
59
|
+
cancellation, streaming, or shutdown behavior; use `api-contract-change` or
|
|
60
|
+
`http-api-semantics-review`.
|
|
61
|
+
- The task only changes compression, CDN caching, SSE replay, WebTransport delivery choice, or proxy
|
|
62
|
+
buffering without transport lifetime risk; use `http-delivery-streaming`.
|
|
63
|
+
- The task is a general retained-object or cleanup review without network or stream lifecycle
|
|
64
|
+
semantics; use `memory-lifetime-review`.
|
|
65
|
+
- The task models a durable business entity lifecycle rather than independently closing transport
|
|
66
|
+
dimensions; use `state-machine-pattern`.
|
|
67
|
+
- No connection, request, body, stream, pool, timer, listener, buffer, or shutdown boundary is
|
|
68
|
+
present to inspect.
|
|
69
|
+
|
|
70
|
+
<!-- mustflow-section: required-inputs -->
|
|
71
|
+
## Required Inputs
|
|
72
|
+
|
|
73
|
+
- Protocol and role: raw TCP, TLS, HTTP/1.1, HTTP/2, WebSocket, CONNECT, client, server, proxy, or
|
|
74
|
+
adapter.
|
|
75
|
+
- Ownership ledger for the physical connection or session, logical request, response body, reader,
|
|
76
|
+
writer, pool slot, timers, listeners, retry entries, and buffer reservations.
|
|
77
|
+
- Event and action ledger distinguishing observed events from local actions such as graceful end,
|
|
78
|
+
cancel, destroy, reset, quarantine, pool return, or forced shutdown.
|
|
79
|
+
- State dimensions for transport, readable side, writable side, pool membership, request, body
|
|
80
|
+
disposition, reader or writer lock, and server or client shutdown when each is relevant.
|
|
81
|
+
- Terminal-cause policy, including which contender records the primary cause and how later causes
|
|
82
|
+
are retained for diagnostics without repeating side effects.
|
|
83
|
+
- Reuse criteria, parser or framing boundary evidence, pending write state, buffered bytes, protocol
|
|
84
|
+
corruption state, and body disposition.
|
|
85
|
+
- Success, half-close, timeout, abort, peer reset, writer error, reader cancel, unconsumed body,
|
|
86
|
+
slow-consumer, and shutdown paths that the implementation supports.
|
|
87
|
+
- Relevant command-intent contract entries for tests, build, docs, release checks, and mustflow
|
|
88
|
+
validation.
|
|
89
|
+
- For Node.js, Web Streams, or Undici-specific work, read
|
|
90
|
+
`references/node-stream-transport-lifecycle-checklist.md` before changing event-order,
|
|
91
|
+
cancellation, body-consumption, active-resource, or natural-exit behavior.
|
|
92
|
+
- For repeated fault injection, soak testing, resource-growth gates, runtime or library attribution,
|
|
93
|
+
operational containment, or permanent-resolution claims, read
|
|
94
|
+
`references/connection-fault-injection-resource-lifetime-validation.md` before designing the
|
|
95
|
+
campaign or accepting its conclusion.
|
|
96
|
+
|
|
97
|
+
<!-- mustflow-section: preconditions -->
|
|
98
|
+
## Preconditions
|
|
99
|
+
|
|
100
|
+
- Higher-priority instructions and `.mustflow/config/commands.toml` have been checked for the
|
|
101
|
+
selected repository.
|
|
102
|
+
- Required inputs are available, or missing protocol and ownership decisions can be reported
|
|
103
|
+
without inventing behavior.
|
|
104
|
+
- Version-sensitive runtime behavior is tied to current official documentation or repository tests;
|
|
105
|
+
supplied reference material is guidance, not proof that every runtime version behaves identically.
|
|
106
|
+
- If general retained-reference risk dominates, also use `memory-lifetime-review`.
|
|
107
|
+
- If races between termination contenders dominate, also use `race-condition-review`.
|
|
108
|
+
- If delivery, cache, reconnect, or proxy semantics dominate, also use `http-delivery-streaming`.
|
|
109
|
+
|
|
110
|
+
<!-- mustflow-section: allowed-edits -->
|
|
111
|
+
## Allowed Edits
|
|
112
|
+
|
|
113
|
+
- Add or tighten lifecycle state, terminal-cause arbitration, connection and request scopes, body
|
|
114
|
+
lease policy, pool quarantine, buffer budgets, shutdown phases, diagnostics, and focused tests.
|
|
115
|
+
- Separate physical connection finalization from logical request and body settlement.
|
|
116
|
+
- Centralize graceful-end and abortive-termination actions so timers, abort signals, writer errors,
|
|
117
|
+
and shutdown do not each perform duplicate cleanup.
|
|
118
|
+
- Add bounded discard, cancellation, drain, grace, or force deadlines where protocol semantics allow.
|
|
119
|
+
- Do not call `destroy` from every completion path merely because repeated destruction is a runtime
|
|
120
|
+
no-op.
|
|
121
|
+
- Do not remove a connection from the active registry before its physical close event is observed.
|
|
122
|
+
- Do not return a connection to a pool from writable/readable flags alone without parser or framing
|
|
123
|
+
boundary and body-disposition evidence.
|
|
124
|
+
- Do not use `unref`, garbage collection, finalization registries, or process exit as connection
|
|
125
|
+
cleanup.
|
|
126
|
+
- Do not weaken event-count, callback-settlement, buffer-bound, natural-exit, or open-handle tests.
|
|
127
|
+
- Do not treat static review, one green reproducer, a flat RSS graph, a restart, or traffic limiting
|
|
128
|
+
as proof that a connection-lifetime defect is permanently resolved.
|
|
129
|
+
|
|
130
|
+
<!-- mustflow-section: procedure -->
|
|
131
|
+
## Procedure
|
|
132
|
+
|
|
133
|
+
1. Draw the ownership layers before editing.
|
|
134
|
+
- Separate physical connection or HTTP/2 session, logical request, response body or stream,
|
|
135
|
+
reader and writer locks, pool lease, and process or server lifecycle.
|
|
136
|
+
- Name which layer owns each timer, listener, pending callback, retry item, buffer reservation,
|
|
137
|
+
and registry entry.
|
|
138
|
+
2. Replace a single closing enum with orthogonal dimensions where shutdown can happen
|
|
139
|
+
independently.
|
|
140
|
+
- Model transport, read side, write side, pool membership, request state, body disposition, and
|
|
141
|
+
reader or writer ownership separately when the protocol permits independent progress.
|
|
142
|
+
- Treat remote and local half-close as valid combinations, not impossible intermediate states.
|
|
143
|
+
3. Separate events from actions.
|
|
144
|
+
- Treat EOF or `end`, write completion or `finish`, `error`, and physical `close` as observed
|
|
145
|
+
events.
|
|
146
|
+
- Treat graceful `end`, cancel, discard, quarantine, `destroy`, reset, and force-close as local
|
|
147
|
+
actions whose admission must be controlled.
|
|
148
|
+
- Do not require an abortive action on a graceful path.
|
|
149
|
+
4. Centralize terminal-cause arbitration.
|
|
150
|
+
- Route timeout, abort signal, writer error, protocol error, peer reset, body abandonment, and
|
|
151
|
+
forced shutdown through one termination admission function.
|
|
152
|
+
- Atomically accept the first terminal cause and at most one abortive action.
|
|
153
|
+
- Record later competing causes as secondary diagnostics without repeating destroy, reset,
|
|
154
|
+
callback settlement, metrics, or registry removal.
|
|
155
|
+
5. Define finalization boundaries.
|
|
156
|
+
- Finalize and remove a physical connection record once, after physical close is observed.
|
|
157
|
+
- Permit a request to settle earlier after its request-scoped timers, listeners, retries, body
|
|
158
|
+
lease, and user result are finalized.
|
|
159
|
+
- Keep connection-core close and error observation alive even after request cleanup.
|
|
160
|
+
6. Write the protocol-specific reuse gate as a conjunction of observable conditions.
|
|
161
|
+
- Require open transport sides, parser or framing boundary, terminal body disposition, no pending
|
|
162
|
+
writes, no reserved buffers, no terminal cause, no protocol corruption, and correct pool owner.
|
|
163
|
+
- Quarantine any HTTP/1.1 connection that observed premature close, truncated framing, parser
|
|
164
|
+
failure, content-length mismatch, reset, or unrecoverable body abandonment.
|
|
165
|
+
- Apply cancellation and reuse at HTTP/2 stream scope unless connection-level GOAWAY, session
|
|
166
|
+
error, or flow-control corruption invalidates the whole session.
|
|
167
|
+
7. Give every response body a disposition and deadline.
|
|
168
|
+
- Require consume, bounded discard, protocol-specific cancel, or failure.
|
|
169
|
+
- Use both byte and wall-clock limits for discard; endless discard is a denial-of-service path.
|
|
170
|
+
- Settle cancellation separately from releasing a reader lock, and release the owner in a
|
|
171
|
+
finally-like boundary.
|
|
172
|
+
8. Make write and backpressure accounting explicit.
|
|
173
|
+
- Stop or pause production after a write or enqueue signal reports backpressure.
|
|
174
|
+
- Settle every accepted write callback or promise exactly once as success or failure.
|
|
175
|
+
- Reserve bytes before enqueueing across readable, writable, adapter, parser, transform, retry,
|
|
176
|
+
discard, and observability layers; do not mistake a high-water mark for a global hard limit.
|
|
177
|
+
9. Build connection and request resource scopes.
|
|
178
|
+
- Register timers, listener removers, retry tokens, body leases, locks, pending writes, buffer
|
|
179
|
+
reservations, and close waiters at creation time.
|
|
180
|
+
- Make disposal idempotent and keep request cleanup from deleting connection-core observers.
|
|
181
|
+
10. Define server and client shutdown as bounded phases.
|
|
182
|
+
- Stop new accepts or requests first, then drain idle and active work, reject new HTTP/2 streams
|
|
183
|
+
when applicable, escalate after a deadline, and wait for physical closes.
|
|
184
|
+
- Track WebSocket, CONNECT, HTTP/2, and other upgraded or separately owned transports explicitly;
|
|
185
|
+
generic HTTP close-all helpers may not own them.
|
|
186
|
+
11. Add observable conservation and cleanup invariants.
|
|
187
|
+
- Compare created, active, and closed connections; started and terminal requests; accepted and
|
|
188
|
+
settled writes; opened and disposed body leases; reserved, current, and released buffers.
|
|
189
|
+
- Keep identifiers in logs or traces and metric labels bounded to reason, protocol, role, or
|
|
190
|
+
mode.
|
|
191
|
+
12. Test races and partial orders, not one pretty sequence.
|
|
192
|
+
- Cover local-first, remote-first, simultaneous FIN, RST, timeout plus abort, pending write plus
|
|
193
|
+
reset, body end plus cancel, paused read, unconsumed body, slow consumer, and shutdown races.
|
|
194
|
+
- Assert event counts, primary cause, accepted destroy count, request result, pool state,
|
|
195
|
+
registry size, pending writes, body disposition, lock ownership, and peak reserved bytes.
|
|
196
|
+
- Add a child-process natural-exit test without `process.exit` when configured test surfaces can
|
|
197
|
+
exercise event-loop handle leaks.
|
|
198
|
+
13. Separate heap retention from event-loop liveness and native resource leakage.
|
|
199
|
+
- An unresolved promise alone does not keep the event loop alive, but a reachable promise chain
|
|
200
|
+
can retain request state.
|
|
201
|
+
- Check active timers, sockets, DNS/TLS work, file descriptors or handles, and heap retaining
|
|
202
|
+
paths with the configured diagnostics available to the repository.
|
|
203
|
+
14. Design fault campaigns around closed cohorts and uncontaminated resource evidence when the task
|
|
204
|
+
requires more than focused lifecycle tests.
|
|
205
|
+
- Separate the system under test from load generators, raw fault peers, proxies, and packet or
|
|
206
|
+
network injectors so their timers and handles do not enter the system ledger.
|
|
207
|
+
- Give each request deterministic bytes, digest, idempotency identity, lifecycle timestamps, and
|
|
208
|
+
exactly one terminal outcome; compare clean and faulted traffic under predeclared load, seed,
|
|
209
|
+
duration, and statistical gates.
|
|
210
|
+
- Keep explicit-agent teardown campaigns separate from pool-reuse steady-state campaigns.
|
|
211
|
+
15. Attribute the owner with differential reproduction before choosing a fix.
|
|
212
|
+
- Repeat the same fault schedule through the full application, a library-only reproducer, a
|
|
213
|
+
runtime-core reproducer, and direct versus production-like network paths where available.
|
|
214
|
+
- Classify application, library, runtime, or environment cause only from the layer where the
|
|
215
|
+
failure appears or disappears, retaining-path evidence, version bisect, or reproducible
|
|
216
|
+
infrastructure mechanics.
|
|
217
|
+
16. Calibrate the conclusion to the evidence.
|
|
218
|
+
- Distinguish fix candidate, mitigation, symptom suppression, and permanent resolution.
|
|
219
|
+
- Require pre-fix failure, post-fix success, compatible correctness and performance regression,
|
|
220
|
+
bounded repeated and soak evidence, and a causal owner before claiming permanent resolution.
|
|
221
|
+
- Treat long-running soak, packet, native-handle, heap, or production-path checks as manual-only
|
|
222
|
+
or missing unless the selected repository configures them.
|
|
223
|
+
17. Verify through configured command intents and report unavailable protocol, fault-injection,
|
|
224
|
+
active-resource, heap, file-descriptor, or natural-exit evidence instead of inventing commands.
|
|
225
|
+
|
|
226
|
+
<!-- mustflow-section: postconditions -->
|
|
227
|
+
## Postconditions
|
|
228
|
+
|
|
229
|
+
- Physical connection, request, body, stream, lock, pool, and shutdown ownership are distinct where
|
|
230
|
+
their lifetimes can diverge.
|
|
231
|
+
- Every connection record has one observable finalization path; graceful paths do not require
|
|
232
|
+
destroy, and abortive paths accept at most one destroy or reset action.
|
|
233
|
+
- Primary terminal cause, secondary contenders, event counts, callback settlement, and registry
|
|
234
|
+
removal are deterministic under supported races.
|
|
235
|
+
- Connection reuse requires framing completion, terminal body disposition, clean transport state,
|
|
236
|
+
zero pending writes or reservations, and protocol-specific eligibility.
|
|
237
|
+
- Response bodies, locks, timers, listeners, retries, buffers, and upgraded connections have bounded
|
|
238
|
+
ownership and shutdown behavior.
|
|
239
|
+
- Tests or explicitly reported evidence gaps cover the highest-risk FIN, RST, timeout, abort,
|
|
240
|
+
cancellation, backpressure, and shutdown paths.
|
|
241
|
+
- Fault and soak conclusions preserve the tested protocol, role, environment, cohort, seed,
|
|
242
|
+
duration, measurement gate, and causal-owner boundary instead of generalizing from one run.
|
|
243
|
+
|
|
244
|
+
<!-- mustflow-section: verification -->
|
|
245
|
+
## Verification
|
|
246
|
+
|
|
247
|
+
Use configured oneshot command intents when available:
|
|
248
|
+
|
|
249
|
+
- `changes_status`
|
|
250
|
+
- `changes_diff_summary`
|
|
251
|
+
- `lint`
|
|
252
|
+
- `build`
|
|
253
|
+
- `test_related`
|
|
254
|
+
- `test`
|
|
255
|
+
- `docs_validate_fast`
|
|
256
|
+
- `test_release`
|
|
257
|
+
- `mustflow_check`
|
|
258
|
+
|
|
259
|
+
Prefer the narrowest configured tests that exercise the changed protocol and lifecycle boundary.
|
|
260
|
+
Do not infer raw packet tools, load generators, heap profilers, active-handle inspectors, open-FD
|
|
261
|
+
commands, or child-process harnesses from this skill.
|
|
262
|
+
|
|
263
|
+
<!-- mustflow-section: failure-handling -->
|
|
264
|
+
## Failure Handling
|
|
265
|
+
|
|
266
|
+
- If protocol and ownership boundaries are unknown, stop and list the missing decisions before
|
|
267
|
+
inventing a universal state machine.
|
|
268
|
+
- If observed event order differs across valid runs, encode the supported partial order and event
|
|
269
|
+
counts instead of forcing one total order.
|
|
270
|
+
- If a second termination contender repeats side effects, centralize admission before patching each
|
|
271
|
+
callback independently.
|
|
272
|
+
- If safe reuse cannot be proved from parser or framing and body evidence, quarantine the connection.
|
|
273
|
+
- If a body cannot be consumed, discarded, or cancelled within bounds, fail the body and retire the
|
|
274
|
+
owning stream or connection at the narrowest safe protocol scope.
|
|
275
|
+
- If shutdown passes only after adding `unref` or `process.exit`, keep the test failing and report the
|
|
276
|
+
live handle or missing owner.
|
|
277
|
+
- If exact runtime behavior is version-sensitive and current official evidence is unavailable,
|
|
278
|
+
narrow the claim and report the freshness gap.
|
|
279
|
+
- If a reproducer turns green without retained-owner, handle, version, or infrastructure evidence,
|
|
280
|
+
report a fix candidate rather than a resolved root cause.
|
|
281
|
+
- If only traffic limiting, isolation, version pinning, or process restart prevents exhaustion,
|
|
282
|
+
report mitigation and preserve the unresolved ownership risk.
|
|
283
|
+
|
|
284
|
+
<!-- mustflow-section: output-format -->
|
|
285
|
+
## Output Format
|
|
286
|
+
|
|
287
|
+
- Protocol, role, and ownership layers reviewed
|
|
288
|
+
- Transport, read, write, pool, request, body, lock, and shutdown states
|
|
289
|
+
- Event versus action ledger
|
|
290
|
+
- Primary and secondary termination-cause policy
|
|
291
|
+
- Finalization and destroy or reset admission result
|
|
292
|
+
- Reuse and quarantine gate
|
|
293
|
+
- Body disposition, reader or writer ownership, and backpressure or buffer budget
|
|
294
|
+
- Resource scopes, timers, listeners, retries, registries, and upgraded transports
|
|
295
|
+
- Shutdown phases and escalation deadline
|
|
296
|
+
- Invariants, fault matrix, event counts, and natural-exit or active-resource evidence
|
|
297
|
+
- Harness isolation, closed-cohort ledger, repeated-fault and soak gates, and clean-traffic isolation
|
|
298
|
+
- Application, library, runtime, or environment attribution evidence
|
|
299
|
+
- Fix candidate, mitigation, symptom suppression, or permanent-resolution classification
|
|
300
|
+
- Command intents run
|
|
301
|
+
- Skipped diagnostics and reasons
|
|
302
|
+
- Remaining connection lifecycle risk
|