mustflow 2.115.5 → 2.115.11

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.
Files changed (30) hide show
  1. package/package.json +1 -1
  2. package/templates/default/i18n.toml +57 -21
  3. package/templates/default/locales/en/.mustflow/docs/agent-workflow.md +13 -1
  4. package/templates/default/locales/en/.mustflow/skills/INDEX.md +16 -7
  5. package/templates/default/locales/en/.mustflow/skills/ada-code-change/SKILL.md +293 -0
  6. package/templates/default/locales/en/.mustflow/skills/astro-code-change/SKILL.md +10 -2
  7. package/templates/default/locales/en/.mustflow/skills/completion-evidence-gate/SKILL.md +14 -1
  8. package/templates/default/locales/en/.mustflow/skills/core-web-vitals-field-review/SKILL.md +2 -2
  9. package/templates/default/locales/en/.mustflow/skills/deno-code-change/SKILL.md +291 -0
  10. package/templates/default/locales/en/.mustflow/skills/dependency-upgrade-review/SKILL.md +12 -6
  11. package/templates/default/locales/en/.mustflow/skills/elysia-code-change/SKILL.md +3 -3
  12. package/templates/default/locales/en/.mustflow/skills/hono-code-change/SKILL.md +2 -2
  13. package/templates/default/locales/en/.mustflow/skills/instruction-conflict-scope-check/SKILL.md +23 -12
  14. package/templates/default/locales/en/.mustflow/skills/nestjs-code-change/SKILL.md +5 -7
  15. package/templates/default/locales/en/.mustflow/skills/node-code-change/SKILL.md +2 -2
  16. package/templates/default/locales/en/.mustflow/skills/pascal-code-change/SKILL.md +301 -0
  17. package/templates/default/locales/en/.mustflow/skills/performance-measurement-integrity-review/SKILL.md +324 -0
  18. package/templates/default/locales/en/.mustflow/skills/php-code-change/SKILL.md +327 -0
  19. package/templates/default/locales/en/.mustflow/skills/python-code-change/SKILL.md +11 -7
  20. package/templates/default/locales/en/.mustflow/skills/routes.toml +36 -0
  21. package/templates/default/locales/en/.mustflow/skills/skill-authoring/SKILL.md +35 -9
  22. package/templates/default/locales/en/.mustflow/skills/skill-refresh/SKILL.md +10 -1
  23. package/templates/default/locales/en/.mustflow/skills/source-freshness-check/SKILL.md +13 -6
  24. package/templates/default/locales/en/.mustflow/skills/svelte-code-change/SKILL.md +16 -5
  25. package/templates/default/locales/en/.mustflow/skills/tauri-code-change/SKILL.md +3 -2
  26. package/templates/default/locales/en/.mustflow/skills/threejs-code-change/SKILL.md +207 -0
  27. package/templates/default/locales/en/.mustflow/skills/typescript-code-change/SKILL.md +23 -16
  28. package/templates/default/locales/en/.mustflow/skills/version-freshness-check/SKILL.md +12 -6
  29. package/templates/default/locales/en/AGENTS.md +8 -1
  30. package/templates/default/manifest.toml +43 -1
@@ -0,0 +1,301 @@
1
+ ---
2
+ mustflow_doc: skill.pascal-code-change
3
+ locale: en
4
+ canonical: true
5
+ revision: 2
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: pascal-code-change
9
+ description: Apply this skill when Pascal or Object Pascal source, Delphi or Free Pascal compiler behavior, RAD Studio or Lazarus projects, RTL, VCL, FireMonkey, LCL, generics, managed records, packages, DLLs, threading, synchronization, async I/O, C or C++ interop, tests, or deployment behavior are created, changed, reviewed, migrated, or upgraded.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.pascal-code-change
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
+ # Pascal Code Change
28
+
29
+ <!-- mustflow-section: purpose -->
30
+ ## Purpose
31
+
32
+ Preserve Pascal language-mode, compiler, RTL, type, range-check, managed-value, UI-thread,
33
+ concurrency, ABI, package, platform, and deployment contracts. Keep Delphi and Free Pascal or
34
+ Lazarus behavior separate unless current evidence proves a portable shared contract.
35
+
36
+ <!-- mustflow-section: use-when -->
37
+ ## Use When
38
+
39
+ - Pascal or Object Pascal units, programs, libraries, packages, forms, generics, records, classes,
40
+ interfaces, exceptions, tests, or compiler directives change.
41
+ - Delphi, RAD Studio, RTL, VCL, FireMonkey, WebBroker, or platform target behavior changes.
42
+ - Free Pascal, Lazarus, LCL, RTL, compiler mode, target, package, threading, or pas2js behavior changes.
43
+ - Threads, synchronization, callbacks, async I/O, COM, DLLs, C or C++ interop, layout, strings,
44
+ memory ownership, or release packaging changes.
45
+
46
+ <!-- mustflow-section: do-not-use-when -->
47
+ ## Do Not Use When
48
+
49
+ - The changed surface is only C or C++ and no Pascal-owned binding or package contract changes.
50
+ - The task asks only for the latest Delphi, Lazarus, or Free Pascal version; use source-freshness
51
+ guidance unless durable code or documentation changes too.
52
+ - A Delphi-only feature is proposed for an FPC target, or an FPC development feature for a stable
53
+ release, without an explicit migration or conditional compilation plan.
54
+
55
+ <!-- mustflow-section: required-inputs -->
56
+ ## Required Inputs
57
+
58
+ - Compiler family and version, language mode, RTL, IDE, target OS and architecture, build profile,
59
+ project and package metadata, search paths, conditional symbols, directives, and CI image.
60
+ - Application model: console, service, VCL, FireMonkey, LCL, WebBroker, library, package, mobile,
61
+ embedded, pas2js, WebAssembly, or another target.
62
+ - Public units, package and DLL surfaces, managed types, generics, record and class ownership,
63
+ range and overflow policy, enum and set serialization, strings, arrays, pointers, exceptions,
64
+ RTTI, initialization and finalization, BPL or DLL lifetime, and form resources.
65
+ - Concurrency ledger: UI or main thread, workers, thread pool, queues, synchronization, cancellation,
66
+ captured values, callbacks, COM apartments, async I/O, shutdown, and exception observation.
67
+ - ABI ledger: calling conventions, scalar widths and signedness, record size and offsets, packing,
68
+ strings and encoding, pointer-length units, allocation owner, opaque handles, errors, and callbacks.
69
+
70
+ <!-- mustflow-section: preconditions -->
71
+ ## Preconditions
72
+
73
+ - Read current project files, compiler directives, target matrix, package dependencies, RTL or
74
+ framework code, tests, and deployment evidence before changing language or runtime assumptions.
75
+ - Refresh official Embarcadero, Free Pascal, Lazarus, platform, and library sources before preserving
76
+ exact version, default, feature, ABI, deprecation, or support claims.
77
+ - Treat version research as dated evidence. The source snapshot reviewed on 2026-07-11 identified
78
+ Delphi or RAD Studio 13.1, Lazarus 4.8, and Free Pascal 3.2.2 as separate stable baselines while
79
+ later Delphi beta and FPC development tracks were prerelease; recheck each track before reuse.
80
+ - Identify which compiler and RTL owns every changed behavior. Similar syntax does not establish
81
+ equivalent threading, memory-manager, exception, ABI, package, or managed-type semantics.
82
+
83
+ <!-- mustflow-section: allowed-edits -->
84
+ ## Allowed Edits
85
+
86
+ - Make focused Pascal, project, package, binding, form-resource, runtime, test, and docs changes
87
+ required by the task.
88
+ - Add explicit domain records, conversion tables, lifetime owners, cancellation state, C wrappers,
89
+ ABI probes, and regression tests where they protect changed behavior.
90
+ - Preserve supported compilers, targets, public unit APIs, package boundaries, form resources,
91
+ calling conventions, and wire or storage formats unless migration is explicit.
92
+ - Do not disable range or overflow checks, widen conditional compilation, share a memory manager,
93
+ swallow worker exceptions, or change packing merely to make one target pass.
94
+
95
+ <!-- mustflow-section: procedure -->
96
+ ## Procedure
97
+
98
+ 1. **Split the compiler, RTL, IDE, and target tracks.**
99
+ - Record Delphi or FPC compiler version, language mode, RTL, Lazarus or RAD Studio version,
100
+ architecture, widget or UI framework, package format, backend, linker, and deployment target.
101
+ - Treat Lazarus and FPC as independent release trains. Keep stable, release-candidate,
102
+ development, pas2js, WebAssembly, LLVM, and platform-preview behavior separately gated.
103
+ - Scope compiler directives with local push and pop mechanisms where supported. Do not let an
104
+ include or unit silently change range, overflow, enum, packing, alignment, or syntax policy.
105
+ - Verify design-time package architecture separately from runtime application architecture.
106
+ 2. **Model domain identity beyond decorative aliases.**
107
+ - Distinguish aliases from new ordinal types, but do not assume a new numeric type is fully opaque;
108
+ verify assignment compatibility under the selected compiler and mode.
109
+ - Wrap values that must never mix in records with private storage, explicit validation, no broad
110
+ implicit conversion, and a deliberate valid or invalid default-record state.
111
+ - Receive external input in a wider raw type, validate it explicitly, then convert to a range type.
112
+ Keep range and overflow checks explicitly enabled for the intended builds and tested boundaries.
113
+ - Use enums for one closed choice, subranges for contiguous ordinal subsets, and sets for bounded
114
+ combinations. Keep reusable enums scoped where supported.
115
+ - Keep internal enums dense and map wire names, database codes, HTTP values, and display text
116
+ explicitly. Never persist `Ord`, raw set bytes, RTTI layout, or compiler-dependent enum storage.
117
+ - Use enum-indexed arrays and set operations for complete mappings and structural transition
118
+ tables, while keeping authorization and business conditions in explicit policy functions.
119
+ 3. **Design managed values and records with copy semantics in mind.**
120
+ - Managed strings, interfaces, dynamic arrays, anonymous methods, variants, and compiler-managed
121
+ records carry runtime-specific lifetime behavior, not thread-safe shared-state semantics.
122
+ - A custom managed record is not automatic unique ownership. Define initialization, assignment,
123
+ copying, moving where supported, finalization, self-assignment, exception, and container behavior.
124
+ - Keep `unmanaged`-style generic constraints separate from stable binary representation claims;
125
+ unmanaged values may still have padding, alignment, endian, and ABI differences.
126
+ - Keep helpers limited to representation and convenience. Core validity, permission, transition,
127
+ and money rules must not depend on which helper is visible through unit order.
128
+ - Do not use raw move, fill, or byte comparison on records containing strings, interfaces,
129
+ dynamic arrays, variants, managed records, or other finalized fields. Use typed assignment,
130
+ initialization, finalization, equality, and serialization.
131
+ - Choose one ownership model for an object exposed as both class and interface. Account for
132
+ Delphi reference counting, FPC COM versus CORBA interfaces, temporary interface lifetime,
133
+ interface cycles, weak references, and explicit owner-backed non-owning contracts.
134
+ - Require derived destructors to override the virtual destructor and tolerate partial construction.
135
+ Keep constructor constraints, class references, and default constructors separate from a real
136
+ factory contract with dependencies and validity rules.
137
+ - Keep dictionary keys immutable and provide equality and hash rules as one policy. Make owning
138
+ collection removal distinct from ownership transfer, and do not infer serialization schema from RTTI.
139
+ 4. **Preserve string, array, and pointer lifetime explicitly.**
140
+ - Treat a pointer derived from a temporary string or array as valid only for the bounded call that
141
+ owns the temporary. If native code retains it, allocate or pin an owned buffer with an explicit
142
+ release path and a lifetime longer than every callback or asynchronous operation.
143
+ - Do not mutate shared copy-on-write strings through raw pointers. Establish uniqueness, capacity,
144
+ write bounds, and final logical length, or write into a separate character buffer and construct
145
+ the string afterward.
146
+ - Distinguish UTF-16 code units, Unicode scalar values, grapheme clusters, encoded byte length,
147
+ and NUL-terminated length. Keep binary data in byte containers rather than `RawByteString`.
148
+ - Dynamic-array assignment aliases one backing store and element writes do not trigger string-like
149
+ copy-on-write. Copy explicitly for snapshots, use `const` for read-only access, and use `var` only
150
+ when replacement or resize is part of the contract.
151
+ - Invalidate every saved element pointer after resize. Represent contiguous foreign or SIMD
152
+ matrices as one buffer plus dimensions and stride rather than nested dynamic arrays.
153
+ - Treat an open array as a call-scoped zero-based view whose source lower bound is lost. Avoid
154
+ temporary array constructors and non-const large open-array parameters in hot or stack-bounded paths.
155
+ - Use pointer arithmetic only with an explicit element type and bounds. Use pointer-sized integer
156
+ types only when integer representation is unavoidable; do not truncate addresses through `Integer`.
157
+ - Use managed `out` only for a genuinely fresh result because the prior value may be finalized
158
+ before entry. Produce into a local temporary and commit by assignment when failure must preserve input.
159
+ 5. **Own unit, package, and process lifecycle explicitly.**
160
+ - Treat interface `uses` as public dependency and initialization-graph change. Keep implementation
161
+ dependencies private and move service startup out of cyclic unit initialization into one bootstrap owner.
162
+ - Make initialization publish only fully built state and make finalization tolerate partial startup.
163
+ Finalization must be idempotent, nonthrowing, and independent of UI, newly created loggers, or
164
+ services that may already be finalized.
165
+ - Do not use compiler-specific `Halt`, class-constructor timing, or unit order as a portable shutdown
166
+ or service-start contract. Generic specializations may create more than one class-level initializer.
167
+ - Treat package loading as immediate code execution. Validate a separate manifest first and roll
168
+ back registration if initialization fails.
169
+ - Before unloading a package, stop new calls, drain active calls and callbacks, unregister factories,
170
+ destroy interfaces and objects, and remove RTTI or class references into its code pages.
171
+ - Keep stateful shared units in one required runtime package. Separate design-time and runtime
172
+ packages, compiler, platform, and configuration output directories, and deploy DCP, DCU, and BPL
173
+ according to their distinct compile-time and runtime roles.
174
+ 6. **Make UI and worker lifetimes nonblocking and observable.**
175
+ - Do not block the UI thread waiting for work that needs synchronization, queued callbacks,
176
+ termination events, or UI message processing. Model completion as success, failure, or cancellation.
177
+ - Treat queue APIs as potentially immediate when called from the main thread unless the selected
178
+ RTL guarantees forced deferral. Make state reentrant-safe before scheduling a callback.
179
+ - Capture immutable result values rather than `Self`, raw pointers, or mutable interfaces. Remove
180
+ pending callbacks during shutdown and still account for callbacks already executing.
181
+ - Treat `FreeOnTerminate` as a no-external-reference policy, not automatic ownership. With an owner,
182
+ request cancellation, await termination without UI dependency, observe the result, then destroy.
183
+ - Treat `Terminate` and OS cancellation calls as requests. Give blocking I/O finite interruption
184
+ paths and retain buffers, overlapped state, and context until a completion result is observed.
185
+ - On FPC Unix targets, establish the selected thread manager before any unit can create threads.
186
+ Ensure console main loops service synchronization callbacks when that RTL requires it.
187
+ 7. **Protect compound state, not just individual variables.**
188
+ - Reference counting and one interlocked counter do not make a compound invariant atomic. Use one
189
+ owned lock or a proved single-word state transition; account for publication, ABA, and reclamation.
190
+ - Use semaphores for counts and queues for data. A pulse, condition, or event is not durable work;
191
+ update state under the lock, signal afterward, and recheck wait predicates in a loop.
192
+ - Lock on a dedicated stable object whose identity cannot change and whose lifetime outlives all
193
+ users. Define one global lock order across normal, error, cancellation, and shutdown paths.
194
+ - Copy state and callback lists under the lock, then release it before logging, callbacks, UI
195
+ queueing, COM, interface release, destructors, allocator calls, or other reentrant code.
196
+ - Observe every worker exception exactly once and map it into the owner-visible completion state.
197
+ A worker stack does not propagate an exception to the thread creator's `try..except` block.
198
+ 8. **Keep native boundaries intentionally narrow.**
199
+ - Put C++ classes, STL, templates, overloads, virtual layout, and exceptions behind an `extern "C"`
200
+ facade. Expose fixed scalars, POD records, pointer-length buffers, opaque handles, and status codes.
201
+ - Match function and callback calling conventions, parameter count, width, signedness, return mode,
202
+ and variadic behavior exactly. Prefer platform and compiler C-type units over `Integer` or `Boolean`.
203
+ - Verify every shared record with C-side size, alignment, and offset probes on each target. Do not
204
+ add `packed` unless the foreign declaration itself requires that exact packing.
205
+ - Define string pointer, length unit, encoding, embedded-NUL rule, ownership, retention, and release.
206
+ Copy borrowed return buffers before their documented validity ends.
207
+ - Allocate and free in the same module or documented allocator family. Do not expose managed Pascal
208
+ strings, arrays, interfaces, variants, classes, open arrays, or anonymous methods through a C ABI.
209
+ - Register callbacks as function, context, calling convention, thread, lifetime, and drain contracts.
210
+ Block new callbacks and wait for in-flight callbacks before destroying context or unloading code.
211
+ - Catch Pascal and C++ exceptions inside their wrappers. Read `GetLastError` or `errno` immediately
212
+ after a documented failing return, before logging or other calls can overwrite it.
213
+ - Initialize COM per thread with the required apartment and marshal interfaces across apartments.
214
+ Shut down by lifetime dependency: stop work, drain callbacks and I/O, destroy handles, then unload.
215
+ 9. **Measure hidden managed and dispatch cost before tuning switches.**
216
+ - Measure representative wall time, allocations, reference-count traffic, copies, stack use,
217
+ generated assembly, and code size. Debug symbols do not add runtime checks; retain symbols and
218
+ map files while treating range, overflow, and assertion policy separately.
219
+ - Use ordinary `const` as an optimization opportunity, not a guaranteed by-reference ABI. Apply
220
+ Delphi forced-reference or FPC `constref` only where the selected compiler, structure size, and
221
+ calling boundary justify it; pass small scalars by value.
222
+ - Reuse output buffers with `var` and an explicit logical count. Grow arrays geometrically or
223
+ allocate once, avoid repeated string concatenation and encoding conversion, and perform encoding
224
+ conversion once at an owned boundary.
225
+ - Keep managed fields out of hot numeric records where practical. Batch virtual and interface
226
+ dispatch so concrete loops remain visible to the optimizer.
227
+ - Resolve RTTI metadata once per type and cache immutable descriptors or generated delegates.
228
+ Do not rediscover schema or wrap every element in a reflective value on a hot path.
229
+ - Convert packed external records into naturally aligned internal records before computation.
230
+ Verify actual inlining and optimization in generated output; `inline`, a higher optimization
231
+ number, WPO, or smart linking is not proof of a faster or equivalent program.
232
+ - For FPC generics, keep type-independent heavy logic in a non-generic core to control repeated
233
+ specialization, compile time, and binary size. Measure the Delphi result too rather than assuming sharing.
234
+ 10. **Gate modern features by the actual release track.**
235
+ - Use Delphi conditional expressions only where both branch type and evaluation remain clear;
236
+ parenthesize them inside larger expressions. Use `NameOf` for refactoring-coupled diagnostics,
237
+ never for stable wire, database, event, or storage names.
238
+ - Verify generic constraint and managed-record support under every supported compiler. Do not
239
+ silently translate Delphi-only semantics into FPC mode switches or vice versa.
240
+ - Audit pointer width, inline assembly, atomics, SIMD, packing, DLLs, COM, and third-party packages
241
+ before claiming a new CPU target such as Windows on Arm is supported.
242
+ - For FireMonkey, separate display timing and GPU residency from Pascal CPU micro-optimization.
243
+ For web or AI components, separate transport support from protocol, auth, session, provider,
244
+ privacy, and deployment contracts.
245
+ 11. **Verify every supported compiler and target boundary.**
246
+ - Cover type mixing, default records, invalid ranges, overflow, enum and set mappings, managed-record
247
+ copies, temporary pointer lifetime, array aliasing and resize, partial construction, unit startup
248
+ failure, package unload, UI reentrancy, cancellation, worker failure, queue and lock behavior,
249
+ shutdown, callback drain, ABI layout, allocator pairing, error capture, COM apartment use, and
250
+ DLL version negotiation.
251
+ - Run configured build, test, package, ABI, and target intents for each changed supported track.
252
+ Report a missing compiler, target, design-time package, device, or ABI probe instead of claiming
253
+ portability from one successful host build.
254
+
255
+ <!-- mustflow-section: postconditions -->
256
+ ## Postconditions
257
+
258
+ - Compiler, RTL, IDE, language mode, target, directive, package, and deployment identity are explicit.
259
+ - Domain type, range, enum, set, managed-record, ownership, threading, cancellation, ABI, callback,
260
+ string, array, pointer, initialization, package, performance, error, and shutdown contracts are observable.
261
+ - Delphi, FPC, Lazarus, stable, prerelease, development, design-time, and runtime evidence are not conflated.
262
+ - Portability and compatibility claims are limited to the compilers, architectures, packages, and
263
+ ABI probes actually verified.
264
+
265
+ <!-- mustflow-section: verification -->
266
+ ## Verification
267
+
268
+ Use configured oneshot intents that cover the changed scope:
269
+
270
+ - `changes_status`
271
+ - `changes_diff_summary`
272
+ - `lint`
273
+ - `build`
274
+ - `test_related`
275
+ - `test`
276
+ - `docs_validate_fast`
277
+ - `test_release`
278
+ - `mustflow_check`
279
+
280
+ <!-- mustflow-section: failure-handling -->
281
+ ## Failure Handling
282
+
283
+ - If compiler, RTL, mode, target, package, or directive identity is unclear, preserve existing
284
+ behavior and report the missing evidence.
285
+ - If range or overflow policy is unknown, validate external values explicitly and do not claim the
286
+ range type alone enforces the boundary.
287
+ - If worker cancellation, callback drain, or shutdown ownership is unclear, keep the lifetime change
288
+ out and report the missing state machine.
289
+ - If ABI layout, calling convention, allocation owner, or string lifetime cannot be verified, keep
290
+ the foreign representation raw and stop before exposing it as a Pascal domain value.
291
+ - If only one compiler or host target is available, report that limitation and do not claim cross-
292
+ compiler, architecture, package, UI-framework, or deployment compatibility.
293
+
294
+ <!-- mustflow-section: output-format -->
295
+ ## Output Format
296
+
297
+ - Compiler, RTL, IDE, language mode, target, package, and deployment tracks
298
+ - Type, range, enum, set, managed-value, ownership, threading, cancellation, ABI, and shutdown decisions
299
+ - Delphi versus FPC or Lazarus compatibility and version-gate decisions
300
+ - Configured intents run and target or ABI evidence obtained
301
+ - Skipped checks and remaining Pascal, package, platform, threading, ABI, or deployment risk
@@ -0,0 +1,324 @@
1
+ ---
2
+ mustflow_doc: skill.performance-measurement-integrity-review
3
+ locale: en
4
+ canonical: true
5
+ revision: 2
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: performance-measurement-integrity-review
9
+ description: Apply this skill when performance counters, timers, histograms, cache ratios, batch or queue throughput, cancellation cost, benchmark results, profiler artifacts, regression gates, or performance logs need review for semantic correctness, concurrency safety, comparable evidence, and sensitive-data containment.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.performance-measurement-integrity-review
15
+ command_intents:
16
+ - changes_status
17
+ - changes_diff_summary
18
+ - build
19
+ - test_related
20
+ - test
21
+ - docs_validate_fast
22
+ - test_release
23
+ - mustflow_check
24
+ ---
25
+
26
+ # Performance Measurement Integrity Review
27
+
28
+ <!-- mustflow-section: purpose -->
29
+ ## Purpose
30
+
31
+ Make performance evidence mean what its name claims. Separate event semantics, units, clocks,
32
+ concurrency guarantees, workload conditions, and privacy boundaries before using a number for an
33
+ optimization claim, alert, budget, or release gate.
34
+
35
+ <!-- mustflow-section: use-when -->
36
+ ## Use When
37
+
38
+ - Code adds or changes counters, gauges, timers, histograms, cache statistics, queue or batch
39
+ measurements, cancellation measurements, benchmark result files, performance budgets, profiler
40
+ artifacts, regression comparison, or automated performance gates.
41
+ - A review must decide whether multithreaded, asynchronous, retried, deduplicated, hedged, batched,
42
+ queued, cancelled, or partially committed work is counted and timed correctly.
43
+ - Performance logs or artifacts can expose paths, repository remotes, URLs, process arguments,
44
+ environment values, source text, heap contents, credentials, personal data, or internal topology.
45
+ - A report claims a benchmark or telemetry series proves a regression, improvement, capacity,
46
+ cache efficiency, throughput, latency, or cancellation cost.
47
+
48
+ <!-- mustflow-section: do-not-use-when -->
49
+ ## Do Not Use When
50
+
51
+ - The task only chooses or implements an optimization and the measurement contract is unchanged;
52
+ use `performance-budget-check`.
53
+ - The task primarily asks whether operators can narrow an incident from general logs, metrics,
54
+ traces, dashboards, or alerts; use `observability-debuggability-review`.
55
+ - The task primarily designs a load generator or test-suite runtime; use the matching load,
56
+ benchmark, or test-performance skill first and this skill only for measurement integrity.
57
+ - A number is a local fixture with no performance meaning, comparison, or public contract.
58
+
59
+ <!-- mustflow-section: required-inputs -->
60
+ ## Required Inputs
61
+
62
+ - Measurement question and decision: what event, duration, resource, ratio, or regression is being
63
+ measured and what action the result may trigger.
64
+ - Event lifecycle: logical command, attempt, accepted, started, completed, committed, acknowledged,
65
+ deduplicated, retried, rejected, dropped, cancelled, rolled back, and terminal boundaries.
66
+ - Unit ledger: request, lookup, key, item, batch, chunk, byte, operation, worker-second, CPU-second,
67
+ wall-second, and any weighting or denominator.
68
+ - Time model: monotonic versus wall clock, process boundary, scheduled arrival, queue wait, service
69
+ time, commit time, end-to-end time, CPU time, nested work, and unfinished work.
70
+ - Concurrency model: update primitive, snapshot guarantee, context propagation, aggregation window,
71
+ reset behavior, sampling, contention, and instrumentation overhead.
72
+ - Workload and comparison evidence: baseline, candidate, environment identity, scenario, input size,
73
+ concurrency, cache state, warmup, repetitions, raw samples, and statistical decision rule.
74
+ - Hardware-counter evidence when used: CPU model and core type, event definitions, counter grouping,
75
+ multiplexing or running percentage, affinity, NUMA placement, working-set size, and normalization
76
+ by attempted or completed logical operation.
77
+ - Cross-layer latency evidence when used: trace identity, phase sequence, clock domain, payload size,
78
+ ingress and handoff boundaries, executor or event-loop queueing, presentation boundary, sampling
79
+ decision, and dropped-event count.
80
+ - Artifact and telemetry boundary: schema version, retention, exporter or collector path, redaction,
81
+ artifact formats, access policy, and recursive secret or path scanning.
82
+ - Relevant tests, benchmark fixtures, profiler outputs, schemas, budgets, and configured command intents.
83
+
84
+ <!-- mustflow-section: preconditions -->
85
+ ## Preconditions
86
+
87
+ - The task matches the Use When conditions and does not match the exclusions.
88
+ - Existing metric, benchmark, profiler, telemetry, redaction, and result-schema conventions have
89
+ been searched before introducing a new shape.
90
+ - Missing workload, snapshot, privacy, or comparison evidence can be reported without inventing it.
91
+ - Apply `security-privacy-review` when sensitive data or trust-boundary policy changes, and apply
92
+ `performance-budget-check` when the task also changes the optimized implementation or budget.
93
+
94
+ <!-- mustflow-section: allowed-edits -->
95
+ ## Allowed Edits
96
+
97
+ - Add or tighten event definitions, metric names, units, lifecycle counters, histograms, context
98
+ propagation, snapshot logic, reset handling, benchmark schemas, comparison rules, budgets,
99
+ artifact sanitization, canary scans, and focused tests tied to the measurement contract.
100
+ - Replace ambiguous averages or ratios with source counters and mergeable distributions whose
101
+ denominator and weighting are explicit.
102
+ - Replace raw paths, remotes, URLs, arguments, environment values, and identifiers with bounded
103
+ logical names, route templates, classifications, or keyed pseudonyms where policy permits.
104
+ - Do not add a telemetry vendor, profiler service, load generator, background process, network call,
105
+ or raw command outside the configured command contract.
106
+ - Do not weaken correctness, privacy, or reproducibility merely to reduce instrumentation overhead.
107
+
108
+ <!-- mustflow-section: procedure -->
109
+ ## Procedure
110
+
111
+ 1. Define each measured event before naming a counter.
112
+ - Separate one logical command from attempts, accepted work, started work, terminal outcomes,
113
+ durable commits, deduplication, retries, hedges, drops, and rollbacks.
114
+ - Place increments at the transition they claim to count. Pool size, queue size, or submit calls
115
+ are not substitutes for started or committed work.
116
+ 2. Define the unit and denominator.
117
+ - Keep request, lookup, key, item, batch, chunk, byte, and resource-time units separate.
118
+ - For cache evidence, distinguish request, key, and byte hit rates plus lookup outcome, load
119
+ outcome, coalesced wait, refresh, negative or stale hit, and served source where relevant.
120
+ - Aggregate source counts before deriving a ratio; do not average per-worker or per-instance ratios.
121
+ 3. Review counter concurrency and snapshot semantics.
122
+ - An atomic increment prevents lost updates; it does not make several independently read totals
123
+ one consistent snapshot.
124
+ - If numerator, denominator, count, and duration must describe one observation window, use a
125
+ joint observation, mergeable histogram, epoch handoff, or explicit synchronization whose cost
126
+ and guarantee are documented.
127
+ - Check overflow, process restart, counter reset, scrape gaps, aggregation-window length, and
128
+ sawtooth batch completion before deriving rates.
129
+ 4. Review timer ownership and clocks.
130
+ - Attach timing state to the operation or trace context, not an assumed worker thread.
131
+ - Use a monotonic clock for elapsed time within one clock domain. Do not subtract monotonic values
132
+ from different processes. Use event timestamps and trace context for distributed timelines and
133
+ state the clock-error boundary.
134
+ - Split wall, CPU, lock wait, I/O wait, queue wait, batch-fill wait, service, commit, ack, and
135
+ end-to-end time when those phases can drive different decisions.
136
+ 5. Preserve parallel and unfinished work semantics.
137
+ - Distinguish elapsed time from cumulative worker time and exclusive time; parent and child timers
138
+ may intentionally overlap and must not be summed as one elapsed duration.
139
+ - Record terminal outcome and duration for failures, timeouts, and observed cancellations. Track
140
+ in-flight age, oldest queued age, and abandoned age so non-completing work is not deleted from
141
+ latency evidence.
142
+ - For offered-load tests, preserve scheduled arrival or another open-loop reference when a
143
+ closed-loop client would hide coordinated omission.
144
+ 6. Bound instrumentation distortion.
145
+ - Check shared-counter contention, false sharing, allocation, label cardinality, clock-read cost,
146
+ event volume, profiler overhead, and sampling bias.
147
+ - Per-thread or striped accumulation trades short-window snapshot precision for lower contention;
148
+ document that trade instead of calling both properties exact.
149
+ - Measure disabled, minimally recorded, and fully recorded modes under the same workload when
150
+ instrumentation can change code layout, inlining, vectorization, allocation, lock hold time,
151
+ exporter backpressure, or tail latency. A no-op sink does not remove event construction cost.
152
+ - Apply sampling before expensive field construction where possible. Tail sampling can reduce
153
+ retained or exported data after recording; it does not refund span creation and attribute work.
154
+ - Observe exporter capacity, queue age or utilization, enqueue failure, and dropped signals. A
155
+ pipeline that drops more telemetry during slow periods can make the measured tail look better.
156
+ - Measure the empty timing or recording path to establish resolution and overhead. For work near
157
+ that floor, batch repeated operations and report the resulting precision limit.
158
+ 7. Model batch, queue, and throughput stages.
159
+ - Record batch, chunk, item, input-byte, and output-byte counts plus batch-size distribution.
160
+ - Separate offered, admitted, started, computed, committed, rejected, expired, dropped, duplicate,
161
+ retried, discarded, and rolled-back work. Report useful throughput and attempted throughput.
162
+ - Split batch-fill wait, admission wait, queue wait, time to first result, processing span, commit,
163
+ acknowledgement, and end-to-end latency. Keep item-weighted and batch-weighted distributions distinct.
164
+ - Condition latency on bounded batch-size or cost classes and inspect stragglers, shard skew,
165
+ head-of-line blocking, busy worker time, CPU time, and active concurrency.
166
+ 8. Treat cancellation as a lifecycle and a resource ledger.
167
+ - Separate requested, accepted, observed by worker, side effects stopped, and terminal cancelled.
168
+ - Measure reaction time, drain time, work completed before observation, work attempted after
169
+ observation, post-cancel CPU or worker time, cleanup, rollback, orphaned side effects, restart
170
+ rework, and backlog recovery when applicable.
171
+ - A cancellation API returning success does not prove execution or side effects stopped.
172
+ 9. Make benchmark evidence comparable.
173
+ - Use a versioned result schema containing scenario and environment identity, commit or build
174
+ identity, raw samples, units, warmup, repetitions, input size, concurrency, cache state, and
175
+ measurement-tool version.
176
+ - Compare base and candidate under the same controlled environment, preferably interleaved on
177
+ the same machine. Gate on a predeclared practical effect threshold and uncertainty rule, not
178
+ one noisy average or a favorable rerun.
179
+ - Combine relative and absolute budgets and cover representative size, concurrency, cache, and
180
+ scaling scenarios. Keep bounded retry policy; never rerun until a desired result appears.
181
+ - Use a fast representative pull-request subset and broader scheduled or merge-queue evidence
182
+ when cost requires tiers. Profile or bisect after a regression is confirmed, not as a substitute
183
+ for a reproducible comparator.
184
+ 10. Validate hardware-counter and cache claims.
185
+ - Disambiguate CPU IPC, meaning retired instructions per CPU cycle, from inter-process
186
+ communication. Spell out the term when both concepts appear in the same scope.
187
+ - Normalize instructions, cycles, misses, and transferred bytes by the same attempted or
188
+ successfully completed logical operation used by the outcome model. Preserve both denominators
189
+ when failures differ between candidates.
190
+ - Treat hit rate as explanatory evidence, not the final optimization result. Review references
191
+ per operation, misses per operation, misses per instruction, cycles per operation, latency,
192
+ throughput, errors, and tail latency together.
193
+ - Confirm each performance-monitoring event's meaning for the actual CPU. Generic cache events,
194
+ speculative accesses, prefetches, and cache levels are not portable semantic contracts.
195
+ - Check whether ratio inputs ran simultaneously. If limited hardware counters were multiplexed,
196
+ preserve running percentages and group dependent events or reject ratios whose overlap is too
197
+ weak for the workload phase length.
198
+ - Keep different hybrid core types separate. Control CPU affinity and memory or NUMA placement
199
+ for the comparison, then repeat under representative scheduler interference.
200
+ - Sweep working sets across relevant cache boundaries and concurrency across one to saturation.
201
+ Compare cold, warmup, steady-state, single-thread, contended, and near-saturation scenarios
202
+ separately. Inspect memory-bound classification, miss latency or source, cache-line ownership,
203
+ and false sharing before attributing an improvement to cache behavior.
204
+ - Do not infer cause from CPU IPC alone. A branch, vectorization, compiler, overlap, or algorithm
205
+ change can alter it; require end-result improvement plus a consistent causal evidence chain.
206
+ 11. Preserve communication outcome and conservation semantics.
207
+ - Keep a logical operation distinct from transport attempts, child work, retries, hedges, and
208
+ units within a partial result. Report logical success, attempt success, attempt amplification,
209
+ full or partial operation outcome, and unit outcome with explicit denominators.
210
+ - Make terminal outcomes mutually exclusive and finalize one logical operation once. Timeout,
211
+ cancellation, transport failure, application failure, rejection, process loss, partial success,
212
+ and full success must not double-decrement in-flight work or double-record duration.
213
+ - Do not divide starts and finishes from the same wall-time window as if they were one cohort.
214
+ For closed reports, group by start cohort through terminal or deadline. For live views, show
215
+ terminal ratios beside in-flight count, oldest age, and the started-versus-finished gap.
216
+ - Separate client outcome, server execution outcome, and delivery outcome. A caller deadline can
217
+ coexist with a later durable server commit; expose late completion and post-cancel work rather
218
+ than overwriting one fact with another.
219
+ - Record all terminal outcomes in one bounded-label duration family, then view outcome-specific
220
+ distributions. Treat cancelled observations as cancellation timing or censored completion
221
+ evidence, not successful completion latency.
222
+ - Define conservation checks such as admitted equals terminal plus in-flight, and requested units
223
+ equal terminal unit outcomes plus remaining units within the stated snapshot tolerance. Use a
224
+ monotonic terminal transition and idempotent unit identity to detect missing or duplicate events.
225
+ 12. Decompose cross-process and user-visible latency.
226
+ - Build one trace-scoped phase sequence from actual input occurrence through frontend queueing,
227
+ preparation, encoding, bridge ingress, decode, executor queue, active execution and waits,
228
+ response encoding and handoff, native receipt, event-loop continuation, framework commit, and
229
+ presentation when those boundaries are observable.
230
+ - Mark every timestamp with its clock domain. Do not directly subtract browser, process, or host
231
+ monotonic clocks. Use bounded ping-pong offset and drift estimation or retain per-domain spans
232
+ with an explicit uncertainty interval.
233
+ - Distinguish async object or future creation, spawn, first poll, active poll time, wait time, and
234
+ completion. Do not hold thread-affine span state across suspension points.
235
+ - Use empty or no-op round trips plus payload-size sweeps to separate bridge fixed cost from
236
+ serialization, copying, and queue noise. Do not halve round-trip time and call it one-way delay
237
+ when the two directions are asymmetric.
238
+ - Treat handler entry as post-routing or post-decode unless an earlier ingress boundary is
239
+ actually instrumented. Likewise, a promise continuation is not native receipt and a state
240
+ assignment or animation-frame callback is not proof of pixels presented.
241
+ - Keep an inseparable interval composite instead of inventing internal timestamps. For each trace,
242
+ compare end-to-end latency with the union of non-overlapping critical-path phases and residual;
243
+ frequent negative or large residuals indicate clock, overlap, or missing-boundary errors.
244
+ - Calculate end-to-end percentiles from complete per-trace paths. Never add layer p99 values,
245
+ because each layer's slowest sample can belong to a different operation.
246
+ 13. Protect performance telemetry and artifacts.
247
+ - Normalize paths before classification and replace them with logical roots; partial substring
248
+ masking is not a path policy. Separate repository identity from remote URL.
249
+ - Parse URLs structurally. Remove user info and fragments, strip or allowlist query values, and
250
+ prefer route templates or endpoint classes over full URLs.
251
+ - Do not dump argument vectors, environments, configs, headers, baggage, or trace state. Emit a
252
+ versioned allowlisted schema and redact at the source plus collector boundary where one exists.
253
+ - Treat raw CPU, heap, allocation, JFR, pprof, trace, benchmark, and compressed artifacts as
254
+ sensitive. Scan final binaries and recursively inspect supported archives and profile formats
255
+ for canary secrets, source paths, remotes, URLs, and credentials before distribution.
256
+ - Use keyed pseudonyms rather than raw hashes for low-entropy sensitive identifiers when stable
257
+ correlation is permitted, and rotate or scope keys according to policy.
258
+ 14. Connect evidence to the decision.
259
+ - State which source counters and distributions produce every ratio, percentile, budget, or alert.
260
+ - Classify the conclusion as configured-test evidence, controlled benchmark evidence, profiler
261
+ evidence, telemetry evidence, static review, manual-only, missing, or not applicable.
262
+ - Reject a gate or claim when its semantics, comparator, privacy boundary, or reproducibility is
263
+ materially unknown.
264
+
265
+ <!-- mustflow-section: postconditions -->
266
+ ## Postconditions
267
+
268
+ - Measured events, lifecycle stages, units, denominators, clocks, snapshot guarantees, reset behavior,
269
+ workload conditions, comparison rules, and privacy boundaries are explicit or reported missing.
270
+ - Retry, dedupe, hedge, batch, queue, cache, cancellation, unfinished-work, and parallel-work semantics
271
+ are not collapsed into misleading totals when they affect the decision.
272
+ - Hardware-counter ratios have defined events, compatible clock and scheduling windows, normalized
273
+ operation denominators, and sufficient simultaneous-running evidence, or are rejected.
274
+ - Communication outcomes obey a stated terminal and unit conservation model, and cross-process
275
+ latency phases preserve clock-domain uncertainty and critical-path semantics.
276
+ - Performance claims and gates are backed by evidence whose scope is no broader than the actual
277
+ scenario, environment, samples, and verification performed.
278
+
279
+ <!-- mustflow-section: verification -->
280
+ ## Verification
281
+
282
+ Use configured oneshot command intents when available:
283
+
284
+ - `changes_status`
285
+ - `changes_diff_summary`
286
+ - `build`
287
+ - `test_related`
288
+ - `test`
289
+ - `docs_validate_fast`
290
+ - `test_release`
291
+ - `mustflow_check`
292
+
293
+ Prefer focused metric-schema, concurrency, reset, histogram, redaction, artifact-scan, benchmark-parser,
294
+ and regression-gate tests. Treat live production telemetry, dedicated benchmark hardware, and external
295
+ profilers as manual-only unless a configured intent explicitly owns them.
296
+
297
+ <!-- mustflow-section: failure-handling -->
298
+ ## Failure Handling
299
+
300
+ - If event meaning or denominator is ambiguous, preserve the raw source counts and stop the derived
301
+ ratio or gate until the contract is named.
302
+ - If a low-contention accumulator cannot provide the required snapshot guarantee, either weaken the
303
+ claim explicitly or choose a bounded synchronization or epoch design and measure its overhead.
304
+ - If base and candidate conditions differ materially, report two observations instead of a regression.
305
+ - If an artifact cannot be inspected or redacted safely, keep it undistributed and report the missing
306
+ verification rather than claiming it is sanitized.
307
+ - If instrumentation changes the hot path materially, reduce or relocate it with a documented loss of
308
+ precision; do not silently keep a distorted benchmark.
309
+
310
+ <!-- mustflow-section: output-format -->
311
+ ## Output Format
312
+
313
+ - Performance measurement boundary reviewed
314
+ - Event, lifecycle, unit, denominator, clock, snapshot, reset, and instrumentation-overhead findings
315
+ - Batch, queue, cache, cancellation, unfinished-work, and parallel-work findings
316
+ - CPU counter, cache hierarchy, PMU scheduling, affinity, NUMA, working-set, and saturation findings
317
+ - Communication outcome, cohort, partial-success, finalize-once, conservation, and late-completion findings
318
+ - Cross-process clock alignment, phase closure, critical-path, residual, and presentation findings
319
+ - Benchmark schema, comparator, scenario, budget, statistical rule, profiling, and bisect findings
320
+ - Telemetry and artifact privacy findings
321
+ - Fixes made or recommended
322
+ - Evidence level and command intents run
323
+ - Skipped verification and reasons
324
+ - Remaining performance-measurement integrity risk