mustflow 2.115.17 → 2.116.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.
Files changed (26) hide show
  1. package/dist/core/skill-route-resolution.js +34 -3
  2. package/dist/core/source-anchors.js +11 -0
  3. package/package.json +1 -1
  4. package/templates/default/i18n.toml +49 -13
  5. package/templates/default/locales/en/.mustflow/skills/INDEX.md +25 -1
  6. package/templates/default/locales/en/.mustflow/skills/adapter-boundary/SKILL.md +9 -8
  7. package/templates/default/locales/en/.mustflow/skills/agent-execution-control-review/SKILL.md +13 -1
  8. package/templates/default/locales/en/.mustflow/skills/api-contract-change/SKILL.md +2 -1
  9. package/templates/default/locales/en/.mustflow/skills/command-pattern/SKILL.md +11 -7
  10. package/templates/default/locales/en/.mustflow/skills/concurrency-invariant-review/SKILL.md +3 -1
  11. package/templates/default/locales/en/.mustflow/skills/credit-ledger-integrity-review/SKILL.md +4 -1
  12. package/templates/default/locales/en/.mustflow/skills/dual-write-consistency/SKILL.md +170 -0
  13. package/templates/default/locales/en/.mustflow/skills/durable-workflow-orchestration/SKILL.md +167 -0
  14. package/templates/default/locales/en/.mustflow/skills/execution-ledger-integrity-review/SKILL.md +161 -0
  15. package/templates/default/locales/en/.mustflow/skills/idempotency-integrity-review/SKILL.md +5 -3
  16. package/templates/default/locales/en/.mustflow/skills/llm-token-cost-control-review/SKILL.md +5 -1
  17. package/templates/default/locales/en/.mustflow/skills/migration-safety-check/SKILL.md +4 -1
  18. package/templates/default/locales/en/.mustflow/skills/parser-engineering-review/SKILL.md +332 -0
  19. package/templates/default/locales/en/.mustflow/skills/policy-decision-integrity-review/SKILL.md +170 -0
  20. package/templates/default/locales/en/.mustflow/skills/public-json-contract-change/SKILL.md +2 -1
  21. package/templates/default/locales/en/.mustflow/skills/queue-processing-integrity-review/SKILL.md +6 -2
  22. package/templates/default/locales/en/.mustflow/skills/routes.toml +108 -0
  23. package/templates/default/locales/en/.mustflow/skills/state-machine-pattern/SKILL.md +5 -3
  24. package/templates/default/locales/en/.mustflow/skills/structured-concurrency-supervision-review/SKILL.md +155 -0
  25. package/templates/default/locales/en/.mustflow/skills/transaction-boundary-integrity-review/SKILL.md +5 -2
  26. package/templates/default/manifest.toml +47 -1
@@ -0,0 +1,332 @@
1
+ ---
2
+ mustflow_doc: skill.parser-engineering-review
3
+ locale: en
4
+ canonical: true
5
+ revision: 1
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: parser-engineering-review
9
+ description: Apply this skill when a lexer, tokenizer, grammar, parser, CST, AST lowering pass, operator table, error recovery path, incremental parser, Unicode source-position layer, large-input path, parser resource limit, or parser fuzz harness is created, changed, reviewed, debugged, or reported.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.parser-engineering-review
15
+ command_intents:
16
+ - changes_status
17
+ - changes_diff_summary
18
+ - lint
19
+ - build
20
+ - test_related
21
+ - test
22
+ - test_audit
23
+ - docs_validate_fast
24
+ - test_release
25
+ - mustflow_check
26
+ ---
27
+
28
+ # Parser Engineering Review
29
+
30
+ <!-- mustflow-section: purpose -->
31
+ ## Purpose
32
+
33
+ Review parser pipelines as product boundaries rather than valid-input recognizers. Preserve source
34
+ truth, produce stable trees and diagnostics, converge after edits, keep position units explicit, and
35
+ fail within bounded CPU and memory on malformed or hostile input.
36
+
37
+ <!-- mustflow-section: use-when -->
38
+ ## Use When
39
+
40
+ - Lexer rules, modes, trivia, raw or cooked token values, or token spans change.
41
+ - Grammar, parser algorithm, CST shape, AST lowering, operator precedence or associativity,
42
+ formatter grouping, or semantic handoff changes.
43
+ - Invalid-input diagnostics, repair, synchronization, delimiter handling, or IDE recovery changes.
44
+ - Incremental parsing, source buffers, changed ranges, cancellation, Unicode positions, streaming
45
+ decode, large-file behavior, parser limits, or fuzzing needs implementation or review.
46
+ - A parser correctness, performance, or security claim needs current code and test evidence.
47
+
48
+ <!-- mustflow-section: do-not-use-when -->
49
+ ## Do Not Use When
50
+
51
+ - The task only consumes or edits an ordinary structured configuration file; use
52
+ `structured-config-change` or the closest installed route for that format.
53
+ - The task is a broad hot-path or benchmark review with no parser boundary; use the applicable
54
+ performance skill.
55
+ - The stable parse tree already exists and only domain-state or type modeling changes; use
56
+ `type-state-modeling-review` or the closest installed route.
57
+ - The task only changes upload, archive, transport, or container limits outside the parser pipeline;
58
+ use the applicable security or boundary skill.
59
+ - The task is cosmetic formatting with no parse-print, grouping, or source-preservation contract.
60
+
61
+ <!-- mustflow-section: required-inputs -->
62
+ ## Required Inputs
63
+
64
+ - The bytes or text accepted, supported encodings, source-position consumers, and maximum expected
65
+ input size.
66
+ - Lexer rules and modes, grammar or parser code, tree schemas, lowering and formatting paths, and
67
+ current valid and invalid fixtures.
68
+ - The parser role: batch compiler, editor service, protocol boundary, configuration loader, query
69
+ engine, or another explicit consumer.
70
+ - Existing resource limits, incremental snapshot model, diagnostics contract, fuzz harness, and
71
+ configured command intents.
72
+ - For review-only work with incomplete inputs, continue from the supplied artifact only when the
73
+ visible lexer or parser boundary can support concrete findings. Mark every missing contract,
74
+ implementation path, fixture, and runtime result as unknown; do not turn those gaps into edits or
75
+ confirmed defects.
76
+
77
+ <!-- mustflow-section: preconditions -->
78
+ ## Preconditions
79
+
80
+ - Read the nearest instructions and command contract before running project commands.
81
+ - Decide whether the task changes language semantics, only implementation, or both. Do not silently
82
+ change accepted syntax, precedence, recovery, normalization, or compatibility behavior.
83
+ - Record unknown encoding, recovery, or resource-limit behavior as unknown instead of inventing it.
84
+
85
+ <!-- mustflow-section: allowed-edits -->
86
+ ## Allowed Edits
87
+
88
+ - Lexer, parser, grammar, token, CST, AST, lowering, formatter, diagnostic, source-buffer,
89
+ incremental-analysis, budget, and fuzz-harness files required by the selected parser boundary.
90
+ - Focused fixtures, property tests, benchmarks, schemas, generated-parser inputs, and directly
91
+ synchronized documentation or templates.
92
+ - Do not replace the parsing algorithm, normalize source text, or widen accepted syntax without
93
+ evidence that the compatibility, recovery, and resource contracts remain correct.
94
+
95
+ <!-- mustflow-section: procedure -->
96
+ ## Procedure
97
+
98
+ ### 1. Freeze the parser contract
99
+
100
+ Write a compact ledger before editing:
101
+
102
+ - Input boundary: bytes, decoded text, chunks, encoding, and full-consumption rule.
103
+ - Output boundary: lossless CST, AST, semantic value, diagnostics, changed ranges, or combinations.
104
+ - Operating mode: batch, interactive, streaming, strict, compatible, or recovery-first.
105
+ - Compatibility boundary: accepted syntax, contextual keywords, newline rules, normalization, and
106
+ malformed-input behavior that callers already observe.
107
+ - Risk boundary: expected size, maximum size, latency target, cancellation owner, and untrusted input.
108
+
109
+ ### 2. Map the real pipeline
110
+
111
+ Trace bytes through decode, source storage, lexing, tokens and trivia, CST, AST lowering, semantic
112
+ validation, formatting, and downstream analysis. Identify every place that copies, decodes,
113
+ normalizes, expands, retries, caches, or converts positions. A limit on only the final parser input
114
+ does not bound earlier transformations.
115
+
116
+ ### 3. Make source and position truth explicit
117
+
118
+ - Use half-open byte spans as the canonical source anchor when an original byte stream is the input
119
+ contract. For a text-native host boundary, declare its canonical unit explicitly and retain a
120
+ lossless mapping to wire bytes whenever decoding, diagnostics, or security claims depend on them.
121
+ Keep byte offset, UTF-16 offset, Unicode scalar index, line index, and display column as distinct
122
+ types or named conversions; never compare them as interchangeable integers.
123
+ - Preserve raw source separately from decoded or cooked token values. Maintain a mapping when
124
+ escapes, normalization, or decoding changes length.
125
+ - Treat NUL as data unless the format forbids it. Recognize a BOM only where the format permits it,
126
+ normally at stream start. Define CRLF handling and avoid splitting UTF-8 sequences or UTF-16
127
+ surrogate pairs across chunks and edits.
128
+ - Use grapheme clusters or display width only for user-interface columns. Do not make them the
129
+ parser's storage coordinate.
130
+
131
+ ### 4. Enforce lexer progress and fidelity
132
+
133
+ - Require every lexer step to reach EOF, consume at least one input unit, or emit a bounded
134
+ synthetic token while changing state. An error token must cover real input unless it represents a
135
+ declared zero-width insertion.
136
+ - Declare longest-match behavior and lexical precedence. Separate prefix, infix, postfix, trivia,
137
+ contextual keyword, and mode-specific decisions instead of relying on rule order folklore.
138
+ - Make mode stacks and restart checkpoints serializable when incremental lexing is supported.
139
+ - Preserve token raw spans, trivia, invalid bytes or characters, and recovery provenance needed by a
140
+ lossless CST and precise diagnostics.
141
+
142
+ ### 5. Separate CST, AST, and semantic meaning
143
+
144
+ - Let a lossless CST account for every source byte exactly once through tokens, trivia, skipped
145
+ input, and error nodes. Represent missing tokens as zero-width nodes at a precise insertion point.
146
+ - Lower CST to AST in a separate pass. Preserve explicit grouping when formatting, refactoring, or
147
+ diagnostics depend on the user's parentheses.
148
+ - Keep name resolution, type rules, assignment validity, and other semantic rejection outside the
149
+ syntax layer unless the grammar contract explicitly owns them.
150
+
151
+ ### 6. Choose the parser algorithm from the operating contract
152
+
153
+ - Prefer recursive descent with Pratt parsing for a new deterministic language with complex
154
+ expressions, readable recovery, and hand-maintained grammar.
155
+ - Prefer PEG when ordered choice and long contextual prefixes are central, while budgeting memoized
156
+ state and making cuts or commits explicit.
157
+ - Prefer IELR or LR when a large declarative grammar and conflict reports are more valuable than
158
+ hand-written control flow.
159
+ - Use GLR only for genuine ambiguity that the product intends to preserve or resolve later. Budget
160
+ parse-forest growth and ambiguity work explicitly.
161
+
162
+ Do not choose from a slogan such as "fastest parser." Judge recovery quality, output shape,
163
+ incremental restart state, grammar evolution, ambiguity, and hostile-input cost together.
164
+
165
+ ### 7. Make operator behavior executable
166
+
167
+ - Store each operator's left binding power, right binding power, fixity, chain policy, grouping
168
+ restrictions, and AST constructor in one executable table used by parser tests and formatter logic.
169
+ - In a Pratt loop that continues while the next left binding power is at least the current minimum,
170
+ encode left associativity as `lbp = p, rbp = p + 1` and right associativity as
171
+ `lbp = p, rbp = p`. Verify the actual loop comparison before applying this formula.
172
+ - Parse prefix, infix, and postfix roles separately. Treat calls, indexing, member access, and other
173
+ postfix forms as a repeatable chain.
174
+ - Decide exponent-versus-unary binding, comparison chaining, non-associative operators, ternary or
175
+ mixfix delimiters, forbidden operator-group mixing, and newline restrictions explicitly.
176
+ - Test AST shape for operator pairs and triples. Evaluation tests alone can hide a wrong tree when
177
+ values happen to coincide.
178
+
179
+ ### 8. Make speculation transactional
180
+
181
+ Use mark, rewind, and commit semantics for ambiguous prefixes. Do not publish diagnostics, mutate
182
+ symbol state, allocate irreversible semantic objects, or advance shared cursors before commitment.
183
+ Bound speculative work and memoization under the same parser budget.
184
+
185
+ ### 9. Recover with bounded progress
186
+
187
+ - At every recovery site, consume input, insert one declared missing token, synchronize to a bounded
188
+ set, or exit the current production. Cap insertions, deletions, repairs, diagnostics, and skipped
189
+ distance.
190
+ - Make synchronization sets depend on grammar context and delimiter depth. Track open delimiters so
191
+ an inner error does not discard an outer construct.
192
+ - Preserve Missing and Error nodes plus repair provenance. Suppress cascades that are downstream of
193
+ the same repair, but do not hide independent errors.
194
+ - Emit structured diagnostics with stable code, primary span, related spans, expected items, repair,
195
+ and fix confidence. Never use a prettier message as a substitute for a correct span and tree.
196
+
197
+ ### 10. Prove incremental convergence
198
+
199
+ - Use immutable, versioned snapshots. Apply the exact edit to the old tree and discard results whose
200
+ source version is stale.
201
+ - Store enough restart state for lexical mode, delimiter or indentation context, and parser state.
202
+ Reparse until both token content and restart state converge; a fixed character radius is not a
203
+ correctness boundary.
204
+ - Prefer relative subtree positions and aggregate lengths so a prefix edit does not rewrite every
205
+ following absolute offset. Use rope, piece-tree, or equivalent chunked storage instead of forcing
206
+ a full source string.
207
+ - Make parsing cancellable and expose changed ranges. Invalidate downstream semantic dependencies
208
+ from those ranges rather than recomputing everything or trusting subtree reuse alone.
209
+ - Compare incremental output with a fresh full parse after edit sequences, including edits near
210
+ quotes, comments, escapes, indentation, delimiters, and mode transitions.
211
+
212
+ ### 11. Bound storage and large-input work
213
+
214
+ - Avoid per-callback or per-node source copies. Define whether callbacks borrow stable chunks and how
215
+ long those chunks remain valid.
216
+ - Prefer compact nodes, arenas, tree buffers, and indexed side tables over one heavyweight object per
217
+ token or node. Measure retained source, token, tree, diagnostic, and downstream-analysis memory.
218
+ - Support partial parsing only with a declared incomplete-tree contract and cancellation behavior.
219
+ - Measure p50, p95, and p99 edit latency, bytes reread, nodes reused, allocations, post-processing
220
+ time, and peak memory. Throughput on one clean file is not incremental-performance evidence.
221
+
222
+ ### 12. Share one hostile-input budget
223
+
224
+ Define one `ParseBudget` that follows the input through decode, decompression or expansion, lexing,
225
+ parsing, recovery, and post-processing. Include applicable counters such as `wireBytes`,
226
+ `decodedBytes`, `expandedBytes`, `tokenCount`, `nodeCount`, `maxDepth`, `maxContainerItems`,
227
+ `scalarBytes`, `numberDigits`, `workUnits`, and a deadline.
228
+
229
+ Declare what charges each counter, whether the charge occurs before allocation or side effects, and
230
+ the stable error returned on exhaustion. Pass the same budget object or a bounded child view through
231
+ nested and composed parsers; do not reset counters at transformation or subgrammar boundaries.
232
+
233
+ - Count while reading or producing data, not after materializing it. Bound expansion by absolute
234
+ bytes, ratio, operation count, and nesting depth.
235
+ - Bound breadth as well as nesting: token count, node count, container items, scalar length, numeric
236
+ digits, repairs, diagnostics, and retained chunks.
237
+ - Charge work units for scans, backtracking, memo entries, ambiguity branches, decode operations, and
238
+ recovery attempts. A wall-clock timeout is a final stop, not the primary complexity model.
239
+ - Use a linear-time regular-expression engine or structurally safe patterns for untrusted text.
240
+ Streaming does not remove token-count or retention limits.
241
+ - Validate and execute the same immutable parse result for the same source version. Reusing the same
242
+ parser implementation for an unvalidated second parse is not sufficient. If reparsing is
243
+ unavoidable, revalidate input identity, source version, limits, and the exact result before any
244
+ side effect. Isolate complex native or generated parsers in a process when a crash or memory fault
245
+ must not take down the caller.
246
+ - Apply aggregate concurrency budgets, bounded logs, and no automatic retry for deterministic parser
247
+ exhaustion.
248
+
249
+ ### 13. Build a parser-specific test matrix
250
+
251
+ Cover all applicable lanes:
252
+
253
+ - Valid corpus, invalid corpus, and near-valid single insert, delete, and replace mutations.
254
+ - Token-span coverage, lossless CST reconstruction, parse-print-parse grouping, and full-consumption
255
+ properties.
256
+ - Operator pair and triple AST matrices, postfix chains, ternary forms, comparison chains, and
257
+ forbidden mixes.
258
+ - Full-parse versus incremental-parse differential tests over versioned edit sequences.
259
+ - One-shot input versus multiple chunk partitions, including boundaries inside multibyte sequences,
260
+ escapes, numbers, comments, and delimiters.
261
+ - Normalized differential oracles against an independent implementation when available, plus
262
+ round-trip and metamorphic properties that do not require identical internal trees.
263
+ - Structured grammar-aware mutation, sanitizer or fault-injection lanes where supported, and
264
+ boundary cases immediately below, at, and above every budget.
265
+ - Growth-rate checks for time, work units, allocations, and retained bytes. Preserve the triggering
266
+ phenomenon while shrinking failures, then keep the minimized input as a regression seed.
267
+
268
+ ### 14. Implement the narrowest complete correction
269
+
270
+ Change the smallest owning layer that restores the contract, then synchronize dependent lexer,
271
+ tree, lowering, formatter, diagnostic, incremental, budget, test, documentation, and template
272
+ surfaces. Do not fix a parser bug only in a downstream consumer that leaves other callers exposed.
273
+
274
+ ### 15. Verify each claim
275
+
276
+ Use the narrowest configured intents that cover the changed language, generated parser, tests,
277
+ documentation, and release surface. Distinguish directly verified behavior, code-supported
278
+ inference, and remaining unknowns. A passing valid corpus does not prove recovery, incrementality,
279
+ Unicode correctness, or hostile-input safety.
280
+
281
+ <!-- mustflow-section: postconditions -->
282
+ ## Postconditions
283
+
284
+ - Input is consumed fully or rejected explicitly, and every preserved source unit has an accountable
285
+ raw span.
286
+ - Lexer, speculation, recovery, and incremental reparsing have observable progress or budget exits.
287
+ - Position units and conversions are explicit at every external boundary.
288
+ - Operator grouping is defined by executable data and proven by AST-shape tests.
289
+ - Incremental results are compared against full parses across state-changing edits.
290
+ - Malformed, wide, deep, expanding, and chunked inputs have bounded fixtures and budget behavior.
291
+ - Verification records separate results, supported inferences, skipped checks, and remaining risk.
292
+
293
+ <!-- mustflow-section: verification -->
294
+ ## Verification
295
+
296
+ - Inspect the change with `changes_status` and `changes_diff_summary` when configured.
297
+ - Use `lint` and `build` when parser source, generated grammar, or type contracts change.
298
+ - Prefer `test_related`; use `test` when shared parser behavior or broad fixtures change, and
299
+ `test_audit` when test-selection or coverage claims need evidence.
300
+ - Use `docs_validate_fast` for changed documentation, `test_release` for packaged grammar, template,
301
+ or public parser surfaces, and `mustflow_check` for Mustflow document or contract changes.
302
+ - Record unconfigured, blocked, timed-out, or environment-dependent checks instead of replacing them
303
+ with raw commands.
304
+
305
+ <!-- mustflow-section: failure-handling -->
306
+ ## Failure Handling
307
+
308
+ - If the accepted language or compatibility contract is unclear, stop semantic edits and report the
309
+ smallest disputed examples with their current trees and diagnostics.
310
+ - If the parser can fail to advance, exhaust a budget, overflow recursion, or retain unbounded input,
311
+ treat it as a correctness or availability defect before tuning messages or throughput.
312
+ - If incremental and full parses disagree, disable or narrow reuse at the smallest unsafe boundary;
313
+ do not bless the incremental tree from visual similarity.
314
+ - If position units cannot be mapped exactly, preserve raw spans and mark derived positions unknown
315
+ rather than guessing a column.
316
+ - If a configured verification fails, preserve the failure output, activate the applicable failure
317
+ triage procedure, and do not broaden the change until the failure is classified.
318
+
319
+ <!-- mustflow-section: output-format -->
320
+ ## Output Format
321
+
322
+ Report:
323
+
324
+ - Parser role and contract boundary.
325
+ - Source, token, tree, operator, recovery, incremental, Unicode, storage, and budget decisions that
326
+ were applicable.
327
+ - Files changed and compatibility behavior preserved or intentionally changed.
328
+ - Positive, boundary, counterexample, chunking, differential, and resource-limit evidence.
329
+ - Configured verification intents and results.
330
+ - Remaining ambiguity, unverified scale, environment limits, and residual parser risk.
331
+ - For review-only work, report files changed and verification intents as none or not run, rather
332
+ than implying that an implementation or runtime check occurred.
@@ -0,0 +1,170 @@
1
+ ---
2
+ mustflow_doc: skill.policy-decision-integrity-review
3
+ locale: en
4
+ canonical: true
5
+ revision: 1
6
+ lifecycle: mustflow-owned
7
+ authority: procedure
8
+ name: policy-decision-integrity-review
9
+ description: Apply this skill when a policy object, specification, decision table, rule engine, capability policy, approval rule, limit, masking rule, or default-deny path returns allow, deny, require-approval, downgrade, or obligations from versioned actor, resource, action, context, and budget facts.
10
+ metadata:
11
+ mustflow_schema: "1"
12
+ mustflow_kind: procedure
13
+ pack_id: mustflow.core
14
+ skill_id: mustflow.core.policy-decision-integrity-review
15
+ command_intents:
16
+ - changes_status
17
+ - changes_diff_summary
18
+ - lint
19
+ - build
20
+ - test_related
21
+ - test
22
+ - test_audit
23
+ - docs_validate_fast
24
+ - test_release
25
+ - mustflow_check
26
+ ---
27
+
28
+ # Policy Decision Integrity Review
29
+
30
+ <!-- mustflow-section: purpose -->
31
+ ## Purpose
32
+
33
+ Make allow, deny, approval, downgrade, masking, limit, and obligation decisions deterministic,
34
+ versioned, explainable, conflict-safe, and bound to enforcement. Separate whether an action is
35
+ permitted from how an already permitted action is implemented.
36
+
37
+ <!-- mustflow-section: use-when -->
38
+ ## Use When
39
+
40
+ - Code creates or changes a policy object, specification, decision table, rule engine, approval
41
+ rule, default-deny rule, capability scope, limit, masking obligation, or policy version.
42
+ - A boolean cannot represent required outcomes such as allow, deny, require approval, downgrade,
43
+ redact, rate-limit, or continue with obligations.
44
+ - Policy facts, configuration timing, rule precedence, approval delay, or version drift can change
45
+ the decision between evaluation and effect.
46
+
47
+ <!-- mustflow-section: do-not-use-when -->
48
+ ## Do Not Use When
49
+
50
+ - Authentication, session establishment, actor-resource ownership, or permission enforcement is the
51
+ whole task; use the applicable auth or access-control skill.
52
+ - Code selects an interchangeable implementation such as Stripe versus Adyen; use
53
+ `strategy-pattern`. Deciding whether an actor may refund under policy version 7 belongs here.
54
+ - A Mustflow command intent grants agent execution authority; use `command-contract-authoring`.
55
+ - One entity transition guard is the whole rule; use `state-machine-pattern`.
56
+ - The task only models invalid domain states or ledger-backed balances; use
57
+ `type-state-modeling-review` or `credit-ledger-integrity-review`.
58
+
59
+ <!-- mustflow-section: required-inputs -->
60
+ ## Required Inputs
61
+
62
+ - Policy-input ledger: actor, resource, action, context, normalized facts, provenance, freshness, and
63
+ trusted owner.
64
+ - Rule ledger: stable ID, version, predicate, scope, priority, effective window, and obligations.
65
+ - Decision ledger: outcome, reason code, matched rules, obligations, decision ID, and policy version.
66
+ - Conflict and default ledger: precedence, no-match behavior, missing-fact behavior, and fail-open or
67
+ fail-closed choice.
68
+ - Snapshot and enforcement ledger: pinned version, approval binding, expiry, recheck rule, and exact
69
+ effect gate.
70
+ - Decision-table, boundary, conflict, stale-fact, and version-change tests.
71
+
72
+ <!-- mustflow-section: preconditions -->
73
+ ## Preconditions
74
+
75
+ - Read the nearest instructions, command contract, policy source of truth, fact loaders, enforcement
76
+ path, approval persistence, configuration or rollout path, and current tests.
77
+ - State the policy question in actor-resource-action terms or another equally bounded decision.
78
+ - Treat raw requests, model output, provider claims, cache entries, and stale summaries as untrusted
79
+ until normalized by their owning boundary.
80
+
81
+ <!-- mustflow-section: allowed-edits -->
82
+ ## Allowed Edits
83
+
84
+ - Add or tighten normalized fact types, policy rules, decision tables, structured outcomes, reason
85
+ codes, obligations, version snapshots, conflict resolution, approval binding, enforcement rechecks,
86
+ focused tests, docs, and directly synchronized templates.
87
+ - Keep identity proof, external claim translation, command mechanics, state transitions, and balance
88
+ invariants in their owning procedures.
89
+ - Do not hide rule conflicts behind array order, broad boolean defaults, current-time globals,
90
+ mutable configuration reads mid-run, or UI-only enforcement.
91
+
92
+ <!-- mustflow-section: procedure -->
93
+ ## Procedure
94
+
95
+ 1. Write the decision question and enumerate actor, resource, action, context, and requested effect.
96
+ 2. Normalize trusted facts before policy evaluation. Record provenance and freshness for tenant,
97
+ ownership, membership, risk, budget, time, environment, and approval facts.
98
+ 3. Return a structured decision containing outcome, reason code, obligations, policy version,
99
+ decision ID, matched rules, and safe evidence pointers. Do not return only `true` or `false` when
100
+ callers must approve, mask, downgrade, limit, or explain.
101
+ 4. Give every rule a stable ID, version, scope, priority, effective window, and owner. Keep policy
102
+ meaning out of handler order and provider configuration where possible.
103
+ 5. Define conflict precedence for allow, deny, approval, and obligations. State whether deny wins,
104
+ obligations merge, approval can override, or one scoped rule supersedes another.
105
+ Human approval must not silently override a deny; require an explicit versioned rule bound to the
106
+ exact action whenever approval is allowed to supersede another decision.
107
+ 6. Define deterministic no-match, missing, stale, and unknown-fact behavior. Security- or
108
+ money-relevant uncertainty must not become accidental allow.
109
+ 7. Pin one policy snapshot for a command or run. Do not read mutable rules repeatedly and combine
110
+ decisions from different versions without an explicit migration rule.
111
+ 8. Bind the decision to the exact actor, resource, action, normalized parameters or digest, policy
112
+ version, obligations, expiry, and effect it gates.
113
+ Delegated capabilities must use attenuation only: a child capability may narrow actor or subject,
114
+ tenant, resource, actions, effects, expiry, call count, or cost, but must never widen its parent
115
+ grant. Bind the chain to parent capability ID, issuer, policy version, and revocation state, and
116
+ consume call and cost limits atomically at the trusted effect boundary.
117
+ Canonicalize normalized parameters before binding or hashing them; define how omitted and default
118
+ arguments compare so equivalent calls do not produce ambiguous decision identities.
119
+ 9. After a long approval wait or material fact change, revalidate the binding or recompute under a
120
+ declared version rule before executing. Record why an old approval remains valid or expires.
121
+ 10. Enforce obligations such as masking, maximum amount, read-only mode, selected region, extra
122
+ audit, or rate limit at the trusted effect boundary, not only in UI or planning code.
123
+ 11. Test the full decision table where bounded, plus boundary values, pairwise rule conflicts,
124
+ no-match, default deny, missing and stale facts, changed-after-approval, version migration, and
125
+ decision-to-effect mismatch.
126
+ 12. Persist safe decision metadata and reason codes when audit or replay needs them. Avoid raw PII,
127
+ secrets, model reasoning, or broad request bodies.
128
+
129
+ <!-- mustflow-section: postconditions -->
130
+ ## Postconditions
131
+
132
+ - Every material decision exposes outcome, reason, obligations, version, and binding evidence.
133
+ - No-match, conflict, stale fact, policy drift, and changed-after-approval paths are deterministic.
134
+ - Evaluation and enforcement use the same actor, resource, action, parameters, policy version, and
135
+ obligations or perform an explicit recheck.
136
+ - Strategy selection, authentication, command authority, lifecycle, and ledger invariants remain in
137
+ their owning procedures.
138
+
139
+ <!-- mustflow-section: verification -->
140
+ ## Verification
141
+
142
+ - Use configured `changes_status` and `changes_diff_summary` for scope evidence.
143
+ - Use `lint`, `build`, and `test_related` for policy implementation and decision matrices; use `test`
144
+ or `test_audit` for shared rule engines or coverage claims.
145
+ - Use `docs_validate_fast`, `test_release`, and `mustflow_check` for public rules, package, template,
146
+ or Mustflow changes.
147
+ - Report unavailable production-policy, rollout, approval-delay, or authorization evidence instead
148
+ of inventing commands.
149
+
150
+ <!-- mustflow-section: failure-handling -->
151
+ ## Failure Handling
152
+
153
+ - If the policy question, trusted facts, or conflict precedence cannot be named, stop policy edits
154
+ and report the ambiguous decision.
155
+ - If enforcement cannot bind to the evaluated actor, resource, action, and version, report a TOCTOU
156
+ gap and do not approve the path from evaluation tests alone.
157
+ - If uncertainty currently allows a sensitive effect, fail closed or require approval according to
158
+ the declared product rule; do not invent a universal deny when availability policy differs.
159
+ - If verification fails, preserve the decision row and expected obligation, then use
160
+ `failure-triage` before broadening the change.
161
+
162
+ <!-- mustflow-section: output-format -->
163
+ ## Output Format
164
+
165
+ - Policy question, trusted inputs, source of truth, and snapshot version
166
+ - Rule IDs, precedence, defaults, outcomes, reason codes, and obligations
167
+ - Approval binding, enforcement, expiry, and recheck decisions
168
+ - Decision-table, conflict, stale-fact, drift, and TOCTOU evidence
169
+ - Files changed and compatibility impact
170
+ - Command intents run, skipped checks, and remaining policy-decision risk
@@ -2,7 +2,7 @@
2
2
  mustflow_doc: skill.public-json-contract-change
3
3
  locale: en
4
4
  canonical: true
5
- revision: 2
5
+ revision: 3
6
6
  lifecycle: mustflow-owned
7
7
  authority: procedure
8
8
  name: public-json-contract-change
@@ -43,6 +43,7 @@ Protect automation consumers from silent JSON, JSONL, stream, schema, fixture, a
43
43
  - The task changes only human-readable CLI text, color, help wording, warnings, or deprecations; use `cli-output-contract-review`.
44
44
  - The JSON is an HTTP, OpenAPI, GraphQL, RPC, or SDK request/response contract; use `api-contract-change`.
45
45
  - The task is only a broad template or docs alignment check with no JSON contract; use `contract-sync-check` or a narrower template skill.
46
+ - The JSON is a private persisted workflow/checkpoint or execution-ledger representation; use the owning `durable-workflow-orchestration` or `execution-ledger-integrity-review` skill for meaning, plus `migration-safety-check` for old-to-new schema transformation.
46
47
 
47
48
  <!-- mustflow-section: required-inputs -->
48
49
  ## Required Inputs
@@ -2,7 +2,7 @@
2
2
  mustflow_doc: skill.queue-processing-integrity-review
3
3
  locale: en
4
4
  canonical: true
5
- revision: 1
5
+ revision: 2
6
6
  lifecycle: mustflow-owned
7
7
  authority: procedure
8
8
  name: queue-processing-integrity-review
@@ -49,6 +49,9 @@ The core question is not "is the worker running?" It is "when does this code dec
49
49
  - The task is primarily transaction isolation, rollback, outbox, after-commit, or read-decision-write atomicity; use `transaction-boundary-integrity-review` first and this skill for broker settlement.
50
50
  - The task is primarily database query speed, cache correctness, API latency, or generic hot-path performance with no broker, worker, or redelivery surface.
51
51
  - The queue path is read-only telemetry where dropped or duplicate messages are explicitly acceptable and no state, audit, billing, permission, notification, or external side effect depends on it.
52
+ - The main problem is producer database commit versus broker publish convergence; use `dual-write-consistency` and keep this skill for producer confirmation and consumer settlement evidence.
53
+ - The queued work is a resumable multi-step business workflow with checkpoints, callbacks, or compensation; use `durable-workflow-orchestration`.
54
+ - The main problem is unjoined child tasks, cancellation propagation, deadlines, or orphan work after a handler returns; use `structured-concurrency-supervision-review`.
52
55
 
53
56
  <!-- mustflow-section: required-inputs -->
54
57
  ## Required Inputs
@@ -99,10 +102,11 @@ The core question is not "is the worker running?" It is "when does this code dec
99
102
  - Require permanent-failure classification, retry count, backoff, jitter, DLQ threshold, and a reason that helps replay or discard safely.
100
103
  5. Check producer confirmation.
101
104
  - A producer that only calls `send` or `publish` may not know the broker durably accepted the message.
102
- - If local DB commit and queue publish are separate, require outbox, transactional publish support, reconciliation, or a reported split-brain risk.
105
+ - If local DB commit and queue publish are separate, route the convergence protocol to `dual-write-consistency`; do not redefine it as queue settlement.
103
106
  6. Review async handler ownership.
104
107
  - If processing returns a promise, future, coroutine, goroutine, thread, or background task, settlement must wait for the actual work or explicitly record durable handoff.
105
108
  - Fire-and-forget work after ack is message loss unless the handoff itself is durable and observable.
109
+ - Route parent-child join, cancellation, deadline, and orphan prevention to `structured-concurrency-supervision-review` when the handler spawns child tasks.
106
110
  7. Review batch settlement.
107
111
  - Batch commit after mixed success can skip failed items.
108
112
  - Per-item failure handling, partial commit boundaries, ordered stop-on-failure behavior, or replay-safe idempotency should be explicit.