mustflow 2.112.10 → 2.112.14

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 (36) hide show
  1. package/dist/cli/commands/contract-lint.js +3 -13
  2. package/dist/cli/commands/impact.js +2 -12
  3. package/dist/cli/commands/init.js +1 -13
  4. package/dist/cli/commands/onboard.js +3 -13
  5. package/dist/cli/commands/version-sources.js +2 -12
  6. package/dist/cli/lib/agent-context.js +2 -1
  7. package/dist/core/preferences.js +79 -0
  8. package/dist/core/repo-version-source.js +9 -18
  9. package/package.json +1 -1
  10. package/templates/default/i18n.toml +24 -24
  11. package/templates/default/locales/en/.mustflow/docs/agent-workflow.md +10 -4
  12. package/templates/default/locales/en/.mustflow/skills/INDEX.md +20 -17
  13. package/templates/default/locales/en/.mustflow/skills/async-timing-boundary-review/SKILL.md +19 -5
  14. package/templates/default/locales/en/.mustflow/skills/backend-log-evidence-review/SKILL.md +10 -3
  15. package/templates/default/locales/en/.mustflow/skills/cache-integrity-review/SKILL.md +63 -21
  16. package/templates/default/locales/en/.mustflow/skills/concurrency-invariant-review/SKILL.md +13 -3
  17. package/templates/default/locales/en/.mustflow/skills/cross-platform-filesystem-safety/SKILL.md +10 -9
  18. package/templates/default/locales/en/.mustflow/skills/dependency-upgrade-review/SKILL.md +8 -3
  19. package/templates/default/locales/en/.mustflow/skills/llm-token-cost-control-review/SKILL.md +62 -24
  20. package/templates/default/locales/en/.mustflow/skills/memory-lifetime-review/SKILL.md +19 -3
  21. package/templates/default/locales/en/.mustflow/skills/observability-debuggability-review/SKILL.md +31 -21
  22. package/templates/default/locales/en/.mustflow/skills/race-condition-review/SKILL.md +38 -25
  23. package/templates/default/locales/en/.mustflow/skills/rag-pipeline-triage/SKILL.md +77 -23
  24. package/templates/default/locales/en/.mustflow/skills/repro-first-debug/SKILL.md +43 -10
  25. package/templates/default/locales/en/.mustflow/skills/routes.toml +4 -4
  26. package/templates/default/locales/en/.mustflow/skills/search-index-integrity-review/SKILL.md +64 -14
  27. package/templates/default/locales/en/.mustflow/skills/security-flow-review/SKILL.md +19 -4
  28. package/templates/default/locales/en/.mustflow/skills/security-privacy-review/SKILL.md +8 -3
  29. package/templates/default/locales/en/.mustflow/skills/vector-search-integrity-review/SKILL.md +59 -32
  30. package/templates/default/locales/en/AGENTS.md +9 -1
  31. package/templates/default/locales/es/AGENTS.md +2 -0
  32. package/templates/default/locales/fr/AGENTS.md +2 -0
  33. package/templates/default/locales/hi/AGENTS.md +2 -0
  34. package/templates/default/locales/ko/AGENTS.md +3 -1
  35. package/templates/default/locales/zh/AGENTS.md +2 -0
  36. package/templates/default/manifest.toml +1 -1
@@ -2,11 +2,11 @@
2
2
  mustflow_doc: skill.race-condition-review
3
3
  locale: en
4
4
  canonical: true
5
- revision: 1
5
+ revision: 3
6
6
  lifecycle: mustflow-owned
7
7
  authority: procedure
8
8
  name: race-condition-review
9
- description: Apply this skill when code is created, changed, reviewed, or reported and shared state can be observed across interleaving execution flows, including check-then-act, read-modify-write, stale reads after await or I/O, lock scope and order, tryLock, timeout or retry behavior, cache miss fill, lazy initialization, atomics and memory ordering, database transaction races, uniqueness, distributed locks, idempotency, atomic file creation, event or outbox ordering, queue duplicates, shutdown, cancellation, timers, close/send races, shared collections, object reuse, fake immutability, sleep-based race tests, log ordering, and state-machine transitions.
9
+ description: Apply this skill when code is created, changed, reviewed, or reported and shared state can be observed across interleaving execution flows, including check-then-act, read-modify-write, stale reads after await or I/O, lock scope and order, tryLock, timeout or retry behavior, cache miss fill, lazy initialization, atomics and memory ordering, database transaction races, uniqueness, distributed locks, fencing tokens, idempotency state records, atomic file creation, event or outbox ordering, inbox or dedupe consumers, per-key serialization, queue duplicates, shutdown, cancellation, timers, close/send races, shared collections, object reuse, fake immutability, sleep-based race tests, log ordering, and state-machine transitions.
10
10
  metadata:
11
11
  mustflow_schema: "1"
12
12
  mustflow_kind: procedure
@@ -59,7 +59,9 @@ The review question is not "does this code use threads?" The stronger question i
59
59
  - Interleaving points: `await`, I/O, database calls, callbacks, hooks, plugin calls, event publish, queue insert, lock release, timer scheduling, retry, cancellation, shutdown, close, send, and other function calls after a state read.
60
60
  - Synchronization boundary: lock scope, atomic operation, compare-and-swap, transaction, row lock, unique constraint, conditional update, singleflight, idempotency record, outbox, or file atomic create/rename behavior.
61
61
  - Ordering and duplication rules: event order, queue delivery semantics, duplicate messages, same-user or same-resource concurrency, retry replay, cancellation timing, timer overlap, and shutdown drain behavior.
62
+ - Idempotency and ownership rule: business idempotency key, processing/succeeded/failed record state, duplicate-in-progress behavior, fencing token or generation owner, and whether same-key work is serialized while unrelated keys can run concurrently.
62
63
  - Evidence surface: existing tests, fixtures, schema constraints, command intents, logs, metrics, sequence numbers, request ids, transaction ids, versions, or manual-only concurrency evidence.
64
+ - Incident file when a concurrency failure was observed: test name, seed, worker or thread count, scheduler settings, timeout, input, build hash, OS/runtime version, environment slice, and exact failure time when available.
63
65
 
64
66
  <!-- mustflow-section: preconditions -->
65
67
  ## Preconditions
@@ -82,61 +84,68 @@ The review question is not "does this code use threads?" The stronger question i
82
84
  <!-- mustflow-section: procedure -->
83
85
  ## Procedure
84
86
 
85
- 1. Name the shared fact. State the exact value or invariant another execution flow could change: balance, status, cache entry, uniqueness, queue offset, file existence, socket state, collection membership, timer owner, shutdown flag, or object ownership.
86
- 2. Build a stale-read ledger.
87
+ 1. Preserve the incident file before changing code when a race was observed.
88
+ - Capture the failing test or workflow name, random seed, worker or thread count, scheduler or CPU-affinity setting when relevant, timeout, input, build hash, OS/runtime version, environment variables that affect scheduling, and exact failure time.
89
+ - Do not replace a missing incident file with "ran many times"; repeated passing runs are weaker than one reproducible failing condition.
90
+ 2. Name the shared fact. State the exact value or invariant another execution flow could change: balance, status, cache entry, uniqueness, queue offset, file existence, socket state, collection membership, timer owner, shutdown flag, or object ownership.
91
+ 3. Build a stale-read ledger.
87
92
  - For each shared state read, mark every later `await`, I/O, DB call, callback, event publish, queue insertion, lock release, timer, retry, cancellation, shutdown, close, send, or function call before the action.
88
93
  - Ask whether the read is still true after each interleaving point. If the answer relies on hope, the path is not race-safe.
89
- 3. Catch check-then-act.
94
+ 4. Catch check-then-act.
90
95
  - Treat patterns such as `if exists then create`, `if balance >= amount then withdraw`, `if status == pending then approve`, duplicate email checks, coupon redemption, order number generation, and filesystem `exists` then `open` as unsafe until proven atomic.
91
96
  - Prefer atomic conditional updates, atomic create, insert with unique constraint, compare-and-swap, row locks, or file creation modes that fail when the target already exists.
92
- 4. Catch read-modify-write.
97
+ 5. Catch read-modify-write.
93
98
  - `++`, `+=`, `push`, `append`, `map[key] = value`, collection mutation, get-then-set, and counter updates are shared-state writes, not harmless syntax.
94
99
  - Use atomic operations only when the invariant is one variable. If the invariant spans fields, rows, objects, or messages, use a transaction, lock, state machine, or conditional write that protects the whole fact.
95
- 5. Do not trust a single event loop after `await`.
100
+ 6. Do not trust a single event loop after `await`.
96
101
  - In JavaScript, Python async, UI runtimes, and coroutine systems, a state read before `await` can be stale after the continuation resumes.
97
102
  - Re-read, validate a version, hold the correct synchronization boundary, or move the decision into an atomic operation.
98
- 6. Review lock scope by invariant, not by field.
103
+ 7. Review lock scope by invariant, not by field.
99
104
  - A lock around one setter does not protect a multi-field or multi-row rule if reads and writes outside the lock can observe intermediate state.
100
105
  - Keep callbacks, hooks, events, plugin calls, external I/O, logging, JSON conversion, and long calculations outside locks unless the invariant truly requires them.
101
106
  - Define and follow a global lock order when more than one lock can be acquired.
102
- 7. Treat `tryLock`, timeout, and retry as risk multipliers.
107
+ 8. Treat `tryLock`, timeout, and retry as risk multipliers.
103
108
  - Check what partial state remains when lock acquisition fails, times out, or is retried.
104
109
  - Verify rollback, idempotency, duplicate side-effect prevention, and retry budget. A retry can make a race rarer or louder, not correct.
105
- 8. Review cache miss fill and lazy initialization.
110
+ 9. Review cache miss fill and lazy initialization.
106
111
  - Multiple misses for the same key should not all rebuild, fetch, insert, or publish the same value unless duplication is harmless and bounded.
107
112
  - Use singleflight, promise memoization with failure cleanup, once initialization, durable uniqueness, or explicit cache-authority rules.
108
113
  - Double-checked locking needs a memory-ordering story in runtimes where construction visibility is not automatically safe.
109
- 9. Review atomics and memory ordering.
114
+ 10. Review atomics and memory ordering.
110
115
  - Atomics protect a specific operation on a specific value. They do not automatically make surrounding objects, arrays, maps, or multi-field invariants safe.
111
116
  - Check acquire/release or stronger memory ordering where the language exposes it, and report missing expertise or evidence instead of guessing.
112
- 10. Review database races.
117
+ 11. Review database races.
113
118
  - A database transaction does not erase a race by itself. Check isolation level, row locks, predicate locks, uniqueness, conditional updates, and whether `SELECT` then `UPDATE` can be invalidated before commit.
114
119
  - Prefer `UPDATE ... WHERE status = ...`, insert-or-ignore/upsert with unique constraints, version columns, row locks, or serializable isolation when the invariant requires it.
115
120
  - Application-level duplicate checks are advisory only; unique facts belong in the database or another durable single-writer authority.
116
- 11. Review distributed locks as debt.
117
- - Lock expiry, process pauses, network delay, clock skew, and split ownership can let two workers believe they own the same work.
118
- - Keep data correct if the distributed lock breaks: unique constraints, idempotency keys, fencing tokens, conditional writes, or state transitions should still reject stale owners.
119
- 12. Review event, queue, and outbox ordering.
120
- - Publishing an event before or after a state change can split the world unless a durable outbox or equivalent boundary ties them together.
121
- - Queue consumers should assume duplicates, reordering, delayed delivery, redelivery after timeout, and concurrent work for the same user or resource.
122
- - Use inbox deduplication, per-aggregate ordering, conditional state transitions, or idempotent side effects where needed.
123
- 13. Review filesystem races.
121
+ 12. Review distributed locks as debt.
122
+ - Lock expiry, process pauses, network delay, clock skew, and split ownership can let two workers believe they own the same work.
123
+ - Keep data correct if the distributed lock breaks: unique constraints, idempotency keys, fencing tokens, conditional writes, or state transitions should still reject stale owners.
124
+ 13. Review event, queue, and outbox ordering.
125
+ - Publishing an event before or after a state change can split the world unless a durable outbox or equivalent boundary ties them together.
126
+ - Queue consumers should assume duplicates, reordering, delayed delivery, redelivery after timeout, and concurrent work for the same user or resource.
127
+ - Use inbox deduplication, per-aggregate ordering, per-key serialization, conditional state transitions, or idempotent side effects where needed.
128
+ - Same-key work should expose whether the current record is processing, succeeded, failed, cancelled, or dead. A duplicate arriving while the first attempt is still processing is not the same as replaying a completed result.
129
+ - Business idempotency keys should describe the intended operation, not just the transport request id, when retries or duplicate submissions must return the same logical result.
130
+ 14. Review filesystem races.
124
131
  - `exists` then `open`, temp file name selection, cleanup by path, and replace-in-place can race.
125
132
  - Prefer atomic create, safe temporary file APIs, same-directory temp files, fsync where durability matters, and atomic rename or replace semantics appropriate to the platform.
126
- 14. Review shutdown, cancellation, timers, close, and send.
133
+ 15. Review shutdown, cancellation, timers, close, and send.
127
134
  - Shutdown should define who stops accepting work, who drains, who cancels, and who owns in-flight side effects.
128
135
  - Cancellation must be idempotent and safe when completion happens at the same time.
129
136
  - Timers and schedulers need one current owner; old timers should not update new state.
130
137
  - WebSocket, channel, stream, socket, queue, and emitter paths need a clear rule for close/send races and double close.
131
- 15. Review shared collections and object reuse.
138
+ 16. Review shared collections and object reuse.
132
139
  - Iteration over a collection that another flow can mutate needs a lock, snapshot, immutable copy, version check, or concurrent collection semantics.
133
140
  - Object pooling, buffer reuse, mutable DTO reuse, and reused request contexts are unsafe if async work can still hold references.
134
141
  - Fake immutable objects with mutable internals, getters, shared maps, or cached arrays should be treated as mutable shared state.
135
- 16. Review tests and logs with suspicion.
142
+ 17. Review tests and logs with suspicion.
136
143
  - `sleep`-based race tests are usually probability tests. Prefer deterministic barriers, fake schedulers, controlled promises, version assertions, unique constraints, or repeated stress only as supplementary evidence.
144
+ - Shake the schedule, not only the load: widen context-switch windows with configured deterministic barriers, fake schedulers, controlled yields, delay injection, or repeated stress harnesses only when the repository command contract allows them.
137
145
  - Logging can hide or change a race. Log order is not event order across threads, processes, async tasks, buffers, or machines.
138
- - Use monotonic sequence numbers, request ids, transaction ids, version columns, or state transition logs when ordering is evidence.
139
- 17. Escalate broad status fields into state-machine review.
146
+ - Use happens-before logs at handoff points such as queue push/pop, mutex unlock/lock, atomic release/acquire, promise/future completion, channel send/receive, callback registration/execution, plus monotonic sequence numbers, request ids, transaction ids, version columns, or state transition logs when ordering is evidence.
147
+ - Treat race detectors, thread sanitizers, deterministic record/replay, profilers, kernel tracing, or stress tools as configured or manual diagnostics only; never infer raw commands from the tool names.
148
+ 18. Escalate broad status fields into state-machine review.
140
149
  - If values such as `pending`, `processing`, `done`, `failed`, `cancelled`, `closed`, or `deleted` drive behavior, draw allowed transitions and reject stale concurrent transitions.
141
150
  - Use `state-machine-pattern` when the race fix needs a transition table, event union, transition log, retry reconciliation, or effect ordering.
142
151
 
@@ -144,9 +153,11 @@ The review question is not "does this code use threads?" The stronger question i
144
153
  ## Postconditions
145
154
 
146
155
  - Shared state reads, interleaving points, and stale-read risks are identified or ruled out.
156
+ - Observed concurrency failures preserve the incident file needed to reproduce the same timing envelope when available.
147
157
  - Check-then-act and read-modify-write paths are atomic, guarded, constrained, or explicitly reported as residual risk.
148
158
  - Locks protect whole invariants, have a clear ordering rule, and avoid slow or reentrant work where possible.
149
159
  - Database, cache, queue, event, filesystem, cancellation, shutdown, timer, close/send, collection, and object-reuse races are checked where relevant.
160
+ - Idempotency processing states, duplicate-in-progress behavior, fencing tokens, outbox/inbox handoffs, and per-key serialization are checked where relevant.
150
161
  - Tests or configured verification cover the highest-risk concurrency invariant when feasible.
151
162
 
152
163
  <!-- mustflow-section: verification -->
@@ -178,9 +189,11 @@ Prefer the narrowest configured test, build, docs, release, or mustflow intent t
178
189
  ## Output Format
179
190
 
180
191
  - Shared state and invariant reviewed
192
+ - Incident file captured or reported missing
181
193
  - Interleaving points checked
182
194
  - Check-then-act and read-modify-write findings
183
195
  - Async stale-read, lock scope/order, tryLock/timeout/retry, cache/lazy init, atomic/memory ordering, database transaction, uniqueness, distributed lock, idempotency, filesystem, event/outbox, queue, shutdown, cancellation, timer, close/send, shared collection, object reuse, fake immutable, test, log, and state-machine checks where relevant
196
+ - Idempotency record states, fencing token, inbox or dedupe, per-key serialization, and duplicate-in-progress checks where relevant
184
197
  - Race fixes made or recommended
185
198
  - Tests or verification evidence
186
199
  - Command intents run
@@ -2,11 +2,11 @@
2
2
  mustflow_doc: skill.rag-pipeline-triage
3
3
  locale: en
4
4
  canonical: true
5
- revision: 1
5
+ revision: 3
6
6
  lifecycle: mustflow-owned
7
7
  authority: procedure
8
8
  name: rag-pipeline-triage
9
- description: Apply this skill when a RAG, knowledge-base answer, grounded chat, citation answer, retrieval-augmented support bot, or document QA flow is wrong, stale, unsupported, slow, leaking data, over-refusing, or not yet localized to ingestion, parsing, chunking, retrieval, filtering, reranking, context assembly, prompt construction, generation, citation validation, or answerability boundaries.
9
+ description: Apply this skill when a RAG, knowledge-base answer, grounded chat, citation answer, retrieval-augmented support bot, or document QA flow is wrong, stale, unsupported, slow, leaking data, over-refusing, or not yet localized to ingestion, parsing, document metadata, source maps, chunking, retrieval, filtering, reranking, context assembly, prompt construction, generation, citation validation, or answerability boundaries.
10
10
  metadata:
11
11
  mustflow_schema: "1"
12
12
  mustflow_kind: procedure
@@ -46,6 +46,9 @@ survive filtering and context assembly, and constrain the answer?"
46
46
  generation, validators, citations, answerability, or access control.
47
47
  - A review would otherwise tune the model, top-k, chunk size, reranker, or prompt before proving
48
48
  which RAG layer failed.
49
+ - A document corpus, frontmatter contract, search index, chunk schema, ACL model, or prompt-packing
50
+ rule is being reviewed because token bloat, retrieval misses, stale context, or unsupported
51
+ citations may come from poor document structure rather than model behavior.
49
52
 
50
53
  <!-- mustflow-section: do-not-use-when -->
51
54
  ## Do Not Use When
@@ -70,9 +73,14 @@ survive filtering and context assembly, and constrain the answer?"
70
73
  context, filters, embedding model version, index version, candidate ids and scores, reranker
71
74
  output, final context ids and order, prompt version, model version, answer, citations, validators,
72
75
  latency, and cost when safe.
73
- - Source ledger: authoritative source availability, parsed text, chunk boundaries, metadata, title,
74
- section path, version, effective dates, stale or deleted documents, duplicates, and conflicting
75
- sources.
76
+ - Source ledger: authoritative source availability, original text, parsed text, index text,
77
+ prompt text, source id, stable doc id, chunk id, parent document genealogy, chunk boundaries,
78
+ frontmatter or metadata schema, document type, status, authority, source-of-truth flag, title,
79
+ aliases, exact keywords, synthetic questions, negative metadata, heading path, breadcrumb ids or
80
+ text, source map, parent and adjacent chunks, section or document summaries, routing summaries,
81
+ lifecycle owner, version, revision, supersedes or superseded-by links, content hash, index
82
+ freshness, published and effective dates, stale or deleted documents, duplicates, and
83
+ conflicting sources.
76
84
  - Comparison ledger: no-retrieval answer, retrieved-context answer, human-selected gold-context
77
85
  answer, exact or keyword search result, vector search result, hybrid result, and expected
78
86
  answerability state.
@@ -93,10 +101,11 @@ survive filtering and context assembly, and constrain the answer?"
93
101
  <!-- mustflow-section: allowed-edits -->
94
102
  ## Allowed Edits
95
103
 
96
- - Add or tighten trace fields, fixture queries, parsing checks, chunk metadata, duplicate or stale
97
- source handling, retrieval comparisons, filter checks, context-packing rules, prompt source
98
- separation, citation validators, answerability states, dirty eval fixtures, metrics, docs, and
99
- directly synchronized templates.
104
+ - Add or tighten trace fields, fixture queries, parsing checks, semantic or structure-aware chunking,
105
+ chunk metadata, frontmatter schemas, source maps, parent-child or adjacent chunk links,
106
+ ACL-prefilter checks, duplicate or stale source handling, retrieval comparisons, filter checks,
107
+ context-packing rules, prompt source separation, citation validators, answerability states, dirty
108
+ eval fixtures, metrics, docs, and directly synchronized templates.
100
109
  - Add safe synthetic fixtures for missing-doc, correct-doc-unused, stale-doc, conflicting-doc,
101
110
  unauthorized-doc, exact-id, keyword, vector, hybrid, reranker, citation, and abstain behavior.
102
111
  - Do not change models, re-embed data, rebuild production indexes, widen access filters, disable
@@ -117,34 +126,74 @@ survive filtering and context assembly, and constrain the answer?"
117
126
  headers, footers, and OCR can be broken even when the original file looks correct.
118
127
  5. Inspect chunk boundaries and metadata. Verify title, parent section, version, dates, audience,
119
128
  product, source authority, and neighboring context survive into chunks or parent retrieval.
120
- 6. Compare source versions and deletes. Duplicates, obsolete documents, tombstones, and conflicting
129
+ 6. Check whether a single chunk can stand on its own. Each answerable chunk should carry enough
130
+ product, feature, version, lifecycle, and heading context that retrieval does not depend on the
131
+ model guessing the missing subject from a previous chunk.
132
+ 7. Review headings as coordinates. Generic headings such as overview, details, or notes are weak
133
+ retrieval features; heading paths and breadcrumbs should name the product, workflow, rule, and
134
+ exception boundary that make the chunk answerable.
135
+ 8. Separate original, index, and prompt text. The original span is evidence, enriched index text is
136
+ search bait, and prompt text is the compact model payload. Do not cite generated summaries,
137
+ aliases, or synonym-expanded text as if they were original source.
138
+ 9. Check source maps and chunk graph. Verify file path or URL, section anchor, line or page span,
139
+ content hash, parent chunk, previous chunk, next chunk, and summary layer can lead back to the
140
+ source without loading the whole corpus.
141
+ 10. Check document identity and lifecycle before merging evidence. Keep `source_id`, `doc_id`, and
142
+ `chunk_id` distinct; preserve rename-stable ids, `doc_type`, `status`, `authority`,
143
+ `source_of_truth`, `supersedes`, `superseded_by`, `valid_until`, and effective-date fields so
144
+ stale, draft, example, discussion, and canonical documents are not averaged into one answer.
145
+ 11. Treat summaries as routers, not proof. A summary should carry what the document can answer,
146
+ what it cannot answer, entities, decisions, exceptions, related docs, deprecated content,
147
+ conditions, actions, numbers, and exact source coordinates; if it ages separately from the
148
+ source, classify the failure as stale entrance metadata before changing retrieval settings.
149
+ 12. Check exact keywords and aliases. Error codes, SKU values, API paths, function names, legal
150
+ references, old product names, and user slang should be searchable without relying on embeddings.
151
+ 13. For code corpora, preserve structure. Function, class, import, caller, callee, type, test, and
152
+ config-key boundaries should guide chunks; fixed line-count slicing that cuts through symbols is
153
+ retrieval damage, not neutral preprocessing.
154
+ 14. For table, slide, and PDF corpora, preserve record shape. Row, column, unit, plan, page, and
155
+ figure context should be repeated in parsed/index text so a number is not retrieved without its
156
+ meaning.
157
+ 15. Check rules beside exceptions. If prohibitions, limits, or jurisdiction exclusions live far away
158
+ from the rule they modify, context assembly may retrieve only the rule and miss the exception.
159
+ 16. Check ACL before retrieval. Tenant, visibility, sensitivity, retention, and user or group access
160
+ must be inherited from documents to chunks and applied before candidate text reaches the model.
161
+ 17. Compare source versions and deletes. Duplicates, obsolete documents, tombstones, and conflicting
121
162
  effective dates must not be silently mixed into one answer.
122
- 7. Run the isolation comparison when evidence is available: no retrieval, current retrieved context,
163
+ Preserve conflicting sources with their priority, status, and effective date instead of
164
+ smoothing them into a synthesized rule.
165
+ 18. Run the isolation comparison when evidence is available: no retrieval, current retrieved context,
123
166
  and human-selected gold context. Gold-context failure points to generation or prompt; current
124
167
  context failure with gold success points to retrieval or context assembly.
125
- 8. Compare keyword, vector, hybrid, and exact-id retrieval by data shape. IDs, error codes, SKUs,
168
+ 19. Compare keyword, vector, hybrid, and exact-id retrieval by data shape. IDs, error codes, SKUs,
126
169
  names, dates, and numbers need exact or lexical safeguards; semantic questions may need vector or
127
170
  hybrid retrieval.
128
- 9. Check filters before blaming embeddings. Record pre-filter candidate count, post-filter count,
171
+ 20. Check filters before blaming embeddings. Record pre-filter candidate count, post-filter count,
129
172
  tenant and permission filters, metadata types, time zones, empty arrays, case sensitivity, and
130
173
  stale policy copies.
131
- 10. Check reranker candidate starvation. If the correct source never enters the candidate set, the
174
+ 21. Check reranker candidate starvation. If the correct source never enters the candidate set, the
132
175
  reranker cannot fix it. If it enters and then drops, inspect reranker inputs and scoring.
133
- 11. Check context assembly. Verify `top_k`, score thresholds, source order, truncation, deduping,
176
+ 22. Check context assembly. Verify `top_k`, score thresholds, source order, truncation, deduping,
134
177
  conflict handling, source authority, and whether important evidence is buried or cut off.
135
- 12. Check prompt construction. User input, retrieved text, examples, tool observations, and system or
178
+ 23. Check prompt construction. User input, retrieved text, examples, tool observations, and system or
136
179
  developer instructions must remain separated. Retrieved text is data, not authority.
137
- 13. Check answerability and abstain behavior. Track no-evidence, low-confidence, conflicting-source,
180
+ 24. Check answerability and abstain behavior. Track no-evidence, low-confidence, conflicting-source,
138
181
  stale-source, access-denied, tool-failed, and needs-human states separately.
139
- 14. Validate citations claim-by-claim. A citation id proves nothing unless the cited chunk supports
182
+ 25. Validate citations claim-by-claim. A citation id proves nothing unless the cited chunk supports
140
183
  the specific generated claim.
141
- 15. Measure each layer separately. Track parsing success, index freshness, Recall@k, MRR or nDCG,
142
- rerank survival, context token budget, answer accuracy, citation accuracy, abstain accuracy,
143
- access leaks, and retrieval/rerank/generation latency and cost.
144
- 16. Use dirty eval cases from real failures. Include typos, abbreviations, multilingual questions,
184
+ 26. Measure each layer separately. Track parsing success, metadata completeness, ACL inheritance,
185
+ index freshness, hit rate, Recall@k, MRR, precision, nDCG, rerank survival, context precision,
186
+ context recall, faithfulness, groundedness, answer relevance, context token budget, answer
187
+ accuracy, citation accuracy, abstain accuracy, access leaks, and retrieval/rerank/generation
188
+ latency and cost.
189
+ 27. Check the document graph for multi-hop questions. PRDs, ADRs, issues, code modules, runbooks,
190
+ changelogs, incidents, and meeting notes should link decisions, implementation, ownership,
191
+ exceptions, and follow-up operations instead of forcing retrieval to infer relationships from
192
+ nearby words.
193
+ 28. Use dirty eval cases from real failures. Include typos, abbreviations, multilingual questions,
145
194
  unanswerable questions, date-sensitive questions, similar names, product codes, multi-hop
146
195
  questions, unauthorized documents, stale documents, and conflicting documents.
147
- 17. Apply the smallest localized fix and switch to the narrower matching skill for retrieval,
196
+ 29. Apply the smallest localized fix and switch to the narrower matching skill for retrieval,
148
197
  hallucination control, prompt contract, token cost, latency, access control, or prompt-injection
149
198
  defense once the boundary is known.
150
199
 
@@ -155,6 +204,11 @@ survive filtering and context assembly, and constrain the answer?"
155
204
  reranking, context assembly, prompt construction, generation, citation validation, answerability,
156
205
  access control, or a named evidence gap.
157
206
  - Trace, source, comparison, eval, metric, and privacy ledgers are explicit where relevant.
207
+ - Document metadata, frontmatter schema, stable source/doc/chunk ids, document type, status,
208
+ authority, source-of-truth, effective dates, supersession links, heading paths, source maps, ACL
209
+ inheritance, original/index/prompt text separation, exact keywords, aliases, negative metadata,
210
+ routing summaries, summary layers, chunk adjacency, document graph links, and index freshness are
211
+ explicit where relevant.
158
212
  - Model, prompt, chunk, top-k, reranker, or index changes are justified by layer evidence rather than
159
213
  by general "RAG quality" claims.
160
214
 
@@ -2,11 +2,11 @@
2
2
  mustflow_doc: skill.repro-first-debug
3
3
  locale: en
4
4
  canonical: true
5
- revision: 3
5
+ revision: 5
6
6
  lifecycle: mustflow-owned
7
7
  authority: procedure
8
8
  name: repro-first-debug
9
- description: Apply this skill when fixing a reported bug or confusing failure before the failure has a clear reproduction.
9
+ description: Apply this skill when fixing, investigating, or instrumenting a reported bug, confusing failure, flaky symptom, production-only defect, unreproducible incident, or legacy-code failure before the failure has a clear reproduction.
10
10
  metadata:
11
11
  mustflow_schema: "1"
12
12
  mustflow_kind: procedure
@@ -31,8 +31,9 @@ This skill keeps debugging anchored to symptom evidence, deterministic reproduct
31
31
  ## Use When
32
32
 
33
33
  - A user reports a bug, broken behavior, confusing runtime result, or failed workflow.
34
- - A failure is visible, but the smallest reproduction path is not yet clear.
34
+ - A failure is visible, intermittent, production-only, data-dependent, or reported from another environment, but the smallest reproduction path is not yet clear.
35
35
  - A fix could otherwise be based on speculation, stale assumptions, or a broad unrelated test run.
36
+ - A safe temporary patch is needed to stop harm, but the change must also capture evidence for the next occurrence instead of only hiding the symptom.
36
37
 
37
38
  <!-- mustflow-section: do-not-use-when -->
38
39
  ## Do Not Use When
@@ -49,6 +50,8 @@ This skill keeps debugging anchored to symptom evidence, deterministic reproduct
49
50
  - Any pasted error text, screenshot detail, failing command intent, route, or UI action.
50
51
  - Recently changed files or likely affected files.
51
52
  - Existing tests, command intents, or manual reproduction notes related to the failure.
53
+ - Available diagnostic evidence such as trace id, span id, request id, job id, attempt, feature flag, deployment version, log query, normal-versus-failing trace comparison, profiler window, breakpoint or watchpoint condition, and safe DB/cache/external dependency facts.
54
+ - Runtime state snapshot evidence when available: cache keys, DB row state, queue state, locks, in-flight work, timezone, environment/config values, server instance, feature flags, app version, browser/app version, region, release, and concurrent request count.
52
55
  - Any known flakiness, environment dependency, timing dependency, or unavailable reproduction requirement.
53
56
 
54
57
  <!-- mustflow-section: preconditions -->
@@ -81,13 +84,37 @@ This skill keeps debugging anchored to symptom evidence, deterministic reproduct
81
84
  - specific input, fixture, locale, path, or data shape;
82
85
  - external source, generated output, or stale build artifact.
83
86
  For each hypothesis, write the observation that would confirm or reject it before changing production code.
84
- 6. If the symptom appears flaky, separate the reproducible behavior from the unstable trigger. Do not treat one passing broad rerun as proof that the issue is fixed.
85
- 7. Inspect the source that controls the reproduced behavior and gather the smallest observation needed to choose between hypotheses.
86
- 8. If temporary instrumentation is needed, give every probe a unique marker, keep it local to the suspect boundary, and remove it before final verification.
87
- 9. Apply the smallest fix that addresses the reproduced cause.
88
- 10. Re-run the original reproduction path after the fix. If that path is unavailable or too broad, run the closest configured intent and report the limitation.
89
- 11. Add or keep a regression guard only when it is tied to the reproduced symptom or a directly observed boundary condition.
90
- 12. Report the symptom, reproduction, hypotheses considered, observations, fix, original reproduction rerun, checks, and remaining risk.
87
+ 6. Reject symptom-cover patches before editing.
88
+ - A null check, timeout increase, expected-value tweak, broad retry, catch-and-ignore, or local-line-only patch is not acceptable until the broken invariant and first divergence are named.
89
+ - Before applying a patch, state which invariant failed, where the invariant first became false, and what no-patch observation proves that claim.
90
+ - List counterexamples that could still fail after the obvious patch, especially concurrency, cache, time zone, retry/idempotency, schema/wire compatibility, security, and performance cases.
91
+ 7. Build a diagnostic evidence packet when logs, traces, profiling, or breakpoints are involved.
92
+ - Prefer normal-versus-failing trace comparison before reading only the final error log.
93
+ - Tie evidence together with stable identifiers such as trace id, span id, request id, tenant id, job id, attempt, feature flag, and deployment version.
94
+ - If timing or ordering may matter, prefer profiler, trace duration, lock wait, allocation, queue age, or dependency latency evidence before stopping the process with a broad breakpoint.
95
+ - Use conditional instrumentation or breakpoints scoped to the failing id when configured or manually approved; do not leave those probes in committed code.
96
+ 8. If the symptom appears flaky, separate the reproducible behavior from the unstable trigger. Do not treat one passing broad rerun as proof that the issue is fixed.
97
+ 9. For unreproducible failures, switch from "make it fail locally" to "make the next failure leave evidence."
98
+ - Capture a state snapshot, not just the input payload: relevant memory/cache state, DB rows, locks, queue messages, time zone, deployment version, feature flags, environment/config values, server instance, dependency versions, and concurrency shape when safe and available.
99
+ - Prefer pre-failure ring buffers, bounded internal event trails, impossible-state assertions, invariant checks, DB constraints, background auditors, or sanity checkers that fire where the bad state is first created.
100
+ - Temporary mitigation should also add forensic evidence such as caller, retry header, idempotency key, first and second handling time, state before and after, or safe resource identifiers.
101
+ 10. Narrow production-only and legacy symptoms by evidence elimination.
102
+ - Split last-known-good and first-failed windows across code, config, data, migration, infra, dependency, external-provider, and traffic-pattern changes.
103
+ - Split mixed symptoms by error code, user cohort, browser, app version, region, server instance, time window, release, feature flag, and data shape before assuming one root cause.
104
+ - Search stable constants, error strings, DB column names, event names, queue topics, config keys, and external endpoint fragments before trusting function names.
105
+ - Start from exits and writers: DB writes, serialized responses, emitted events, emails, balance changes, files, queues, cron jobs, admin tools, and external side effects. Treat DB triggers, queues, cron, imports, and admin panels as code.
106
+ - Use blame, linked commits, PRs, and same-commit file changes for historical context, not for assigning fault.
107
+ 11. Stress hidden conditions deliberately when the repository has a configured or approved way to do so.
108
+ - Suspect time, randomness, and concurrency first for "sometimes" failures.
109
+ - Prefer fixed seeds, fake clocks, forced interleavings, latency injection, duplicate or reordered messages, worker kills, cache clears, slight time shifts, and concurrent requests over waiting for chance.
110
+ - Minimize production data into a safe fixture by removing unrelated rows or events until the trigger disappears, then restore the last removed condition.
111
+ 12. Inspect the source that controls the reproduced behavior and gather the smallest observation needed to choose between hypotheses.
112
+ 13. If temporary instrumentation is needed, give every probe a unique marker, keep it local to the suspect boundary, and remove it before final verification unless the user explicitly wants durable diagnostics.
113
+ 14. Apply the smallest fix that addresses the reproduced or instrumented cause. Keep behavior-preserving cleanup, characterization tests, bug fixes, and long-term refactors separate when the codebase is legacy or high-risk.
114
+ 15. Re-run the original reproduction path after the fix. If that path is unavailable or too broad, run the closest configured intent and report the limitation.
115
+ 16. For unreproducible fixes, define the "fixed" metric before claiming success: failure rate, invariant violation count, duplicate handling count, retry exhaustion count, DLQ growth, timeout rate, latency tail, or another symptom-specific measure.
116
+ 17. Add or keep a regression guard only when it is tied to the reproduced symptom, the instrumented invariant, or a directly observed boundary condition.
117
+ 18. Report the symptom, reproduction, hypotheses considered, observations, evidence packet, fix, original reproduction rerun, checks, and remaining risk.
91
118
 
92
119
  <!-- mustflow-section: postconditions -->
93
120
  ## Postconditions
@@ -95,6 +122,10 @@ This skill keeps debugging anchored to symptom evidence, deterministic reproduct
95
122
  - The final report distinguishes reproduced evidence from assumptions.
96
123
  - Any added test or reproduction note is tied to the reported failure, not to general coverage growth.
97
124
  - Cause hypotheses are confirmed, rejected, or left explicitly unresolved instead of being implied by a passing broad check.
125
+ - Symptom-cover patches are rejected unless they repair the named invariant and survive relevant counterexamples.
126
+ - Trace, log, profiler, breakpoint, DB, cache, and dependency evidence is correlated by stable identifiers when that evidence exists.
127
+ - Unreproducible defects are handled with next-failure evidence capture, state snapshots, bounded event trails, impossible-state monitors, and pre-declared fix metrics rather than a speculative local patch.
128
+ - Legacy-code investigations start from symptom exits, writers, stable strings, data flow, history, and code-outside-code surfaces before broad call-graph reading or cleanup.
98
129
  - Temporary instrumentation and debug output are removed before final verification unless intentionally retained.
99
130
  - Missing command intents, unavailable tools, or unsafe reproduction requirements are reported instead of hidden.
100
131
 
@@ -125,6 +156,8 @@ Prefer the original failing intent when it is narrower than the defaults above.
125
156
  - Symptom and expected behavior
126
157
  - Reproduction path or reproduction gap
127
158
  - Hypotheses considered and observations
159
+ - Diagnostic evidence packet and counterexamples considered
160
+ - State snapshot, next-failure capture, last-good or first-failed window, symptom split, and legacy narrowing evidence where relevant
128
161
  - Probable cause, confidence, and evidence
129
162
  - Fix applied
130
163
  - Original reproduction rerun result
@@ -790,7 +790,7 @@ applies_to_reasons = ["unknown_change", "code_change", "behavior_change", "test_
790
790
  category = "data_external"
791
791
  route_type = "primary"
792
792
  priority = 75
793
- applies_to_reasons = ["code_change", "docs_change", "security_change", "package_metadata_change", "release_risk"]
793
+ applies_to_reasons = ["code_change", "docs_change", "security_change", "package_metadata_change", "release_risk", "unknown_change"]
794
794
 
795
795
  [routes."dependency-reality-check"]
796
796
  category = "data_external"
@@ -814,7 +814,7 @@ applies_to_reasons = ["code_change", "public_api_change", "test_change", "docs_c
814
814
  category = "data_external"
815
815
  route_type = "adjunct"
816
816
  priority = 65
817
- applies_to_reasons = ["code_change", "security_change", "migration_change"]
817
+ applies_to_reasons = ["code_change", "security_change", "migration_change", "package_metadata_change", "release_risk"]
818
818
 
819
819
  [routes."adapter-boundary"]
820
820
  category = "data_external"
@@ -886,7 +886,7 @@ applies_to_reasons = ["test_change"]
886
886
  category = "security_privacy"
887
887
  route_type = "primary"
888
888
  priority = 30
889
- applies_to_reasons = ["security_change", "privacy_change"]
889
+ applies_to_reasons = ["security_change", "privacy_change", "package_metadata_change", "release_risk", "unknown_change"]
890
890
 
891
891
  [routes."secret-exposure-response"]
892
892
  category = "security_privacy"
@@ -934,7 +934,7 @@ applies_to_reasons = ["unknown_change", "code_change", "behavior_change", "publi
934
934
  category = "security_privacy"
935
935
  route_type = "adjunct"
936
936
  priority = 76
937
- applies_to_reasons = ["code_change", "behavior_change", "public_api_change", "security_change", "privacy_change", "data_change", "test_change", "package_metadata_change", "release_risk"]
937
+ applies_to_reasons = ["code_change", "behavior_change", "public_api_change", "security_change", "privacy_change", "data_change", "test_change", "docs_change", "package_metadata_change", "release_risk", "unknown_change"]
938
938
 
939
939
  [routes."security-regression-tests"]
940
940
  category = "security_privacy"
@@ -2,11 +2,11 @@
2
2
  mustflow_doc: skill.search-index-integrity-review
3
3
  locale: en
4
4
  canonical: true
5
- revision: 1
5
+ revision: 3
6
6
  lifecycle: mustflow-owned
7
7
  authority: procedure
8
8
  name: search-index-integrity-review
9
- description: Apply this skill when keyword search, full-text search, Elasticsearch, OpenSearch, Lucene-style indexes, search APIs, indexing pipelines, aliases, bulk indexing, refresh visibility, analyzers, mappings, synonyms, autocomplete, pagination, shard failures, search quality, or search performance are created, changed, reviewed, or failing. Use vector-search-integrity-review first for vector-only or semantic retrieval mechanics, and use rag-pipeline-triage first when a RAG failure is not yet localized to search retrieval.
9
+ description: Apply this skill when keyword search, full-text search, Elasticsearch, OpenSearch, Lucene-style indexes, search APIs, indexing pipelines, source maps, metadata taxonomy, aliases, bulk indexing, refresh visibility, analyzers, mappings, synonyms, autocomplete, pagination, shard failures, search quality, or search performance are created, changed, reviewed, or failing. Use vector-search-integrity-review first for vector-only or semantic retrieval mechanics, and use rag-pipeline-triage first when a RAG failure is not yet localized to search retrieval.
10
10
  metadata:
11
11
  mustflow_schema: "1"
12
12
  mustflow_kind: procedure
@@ -55,7 +55,13 @@ The core question is whether a source record can be changed, accepted by the ind
55
55
  - Symptom classification: source not indexed, write not visible, wrong alias, partial shard result, wrong exact match, wrong full-text match, ranking drift, zero results, stale delete, tenant leak, autocomplete failure, deep-page failure, slow query, bulk rejection, mapping conflict, or UI/API mismatch.
56
56
  - Source-to-search ledger: source id, tenant, category, status, update time, indexing request time, bulk item result, indexed document id, direct lookup result, first search-visible time, rank, delete or tombstone state, and visibility lag.
57
57
  - Query contract ledger: user-facing API path, direct search request, API-transformed request, UI result shaping, index or alias, tenant and permission filters, analyzed fields, exact fields, sort, pagination mode, source fields, highlight fields, cache state, and expected result ids.
58
- - Index contract ledger: read alias, write alias, index templates, mappings, analyzers, normalizers, synonym sets, dynamic mapping policy, refresh policy, shard and replica plan, segment or merge state, disk watermark risk, and rollover or reindex status.
58
+ - Index contract ledger: read alias, write alias, index templates, mappings, analyzers, normalizers,
59
+ exact id fields, exact keyword fields, facet fields, filter-only metadata, embedding-header
60
+ metadata, citation metadata, negative metadata, taxonomy fields, controlled vocabulary, metadata
61
+ key budget, stable source id, document id, chunk id when applicable, alias or synonym tables,
62
+ source-map fields, published/effective/indexed/verified dates, version fields, content hash,
63
+ schema version, index version, dynamic mapping policy, refresh policy, shard and replica plan,
64
+ segment or merge state, disk watermark risk, and rollover or reindex status.
59
65
  - Quality ledger: representative queries, expected results, acceptable alternatives, zero-result expectations, Precision@K, Recall@K, MRR or ranking metric, before/after comparison, click or behavior metric limitations, and golden-set fixture status.
60
66
  - Performance ledger: cold and warm latency, p50, p95, p99, search server time, API time, UI time, query phase, fetch phase, response size, shard fan-out, thread-pool active/queue/rejected, slow-log or query-profile evidence, cache hit or miss, and retry behavior.
61
67
  - Privacy ledger: raw query text, document text, tenant ids, user ids, behavior analytics, search logs, highlights, and whether evidence can be stored safely as synthetic fixtures, ids, hashes, summaries, or aggregate metrics.
@@ -71,7 +77,12 @@ The core question is whether a source record can be changed, accepted by the ind
71
77
  <!-- mustflow-section: allowed-edits -->
72
78
  ## Allowed Edits
73
79
 
74
- - Add or tighten search canaries, indexing ledgers, bulk item error handling, alias checks, mapping and analyzer fixtures, exact-versus-full-text tests, tenant and permission filter tests, golden-set tests, synonym regression tests, pagination guards, query fingerprint metrics, search latency metrics, docs, and directly synchronized templates.
80
+ - Add or tighten search canaries, indexing ledgers, bulk item error handling, alias checks, mapping
81
+ and analyzer fixtures, metadata taxonomy checks, frontmatter schema checks,
82
+ controlled-vocabulary fixtures, exact-keyword fixtures, negative-metadata filters,
83
+ exact-versus-full-text tests, tenant and permission filter tests, golden-set tests, synonym
84
+ regression tests, pagination guards, query and miss-log metrics, search latency metrics, docs,
85
+ and directly synchronized templates.
75
86
  - Add focused synthetic fixtures that encode expected exact search, full-text search, analyzer behavior, synonym behavior, filtered search, tenant isolation, zero-result behavior, pagination stability, and ranking order.
76
87
  - Do not change analyzer, synonym, refresh, alias, shard, cache, or ranking settings blindly. First preserve source-to-search, query-contract, quality, and performance evidence.
77
88
  - Do not force every write to refresh immediately unless the product contract explicitly needs synchronous visibility and the indexing cost is accepted.
@@ -108,31 +119,64 @@ The core question is whether a source record can be changed, accepted by the ind
108
119
  9. Inspect mappings and analyzers before changing queries.
109
120
  - IDs, emails, status codes, tags, and exact filters usually need keyword-like fields.
110
121
  - Human text usually needs text analysis. Use analyzer evidence or fixtures to prove tokenization for punctuation, case, hyphen, Korean spacing, product codes, and mixed alphanumeric text.
111
- 10. Review synonym and ranking changes against a golden set.
122
+ 10. Review metadata taxonomy and controlled vocabulary.
123
+ - Distinguish filter fields, facet fields, ranking fields, display fields, and source-map fields.
124
+ - Canonical keys, aliases, synonyms, old names, and related terms should be explicit so free-form tags do not become five spellings of the same concept.
125
+ - Treat tags as filter conditions, not vibes. Reject values such as important, misc, final, or
126
+ reference unless they have a controlled, queryable meaning.
127
+ - Keep the metadata key set small enough that writers can fill it consistently; separate a
128
+ core filter set from optional enrichment instead of accepting unbounded ad hoc keys.
129
+ 11. Split metadata by job.
130
+ - Filter metadata should be typed and exact; context headers should help lexical and semantic
131
+ recall; citation metadata should point back to source spans.
132
+ - Do not put every metadata key into analyzed text. Select title, section, entity, date, type,
133
+ and other disambiguators; keep volatile, private, or filter-only fields out of recall text.
134
+ - Keep LLM-visible metadata separate from search/filter metadata when the index feeds RAG.
135
+ Operational paths, ACL fields, tenant IDs, and internal ids should not become answer text
136
+ unless they change citation, permission, or disambiguation.
137
+ 12. Separate path hints from state fields.
138
+ - Paths may encode tenant, visibility, lifecycle, source, language, or date for operations, but
139
+ `status`, `is_current`, `effective_from`, `effective_to`, `published_at`, `indexed_at`,
140
+ `last_verified_at`, `version`, and `revision` should remain first-class filter fields.
141
+ - File names are human hints; stable ids are machine keys. Renames, storage moves, and reindex
142
+ jobs should not break citations, deletes, feedback logs, or eval sets.
143
+ 13. Review negative metadata and lifecycle filters.
144
+ - Visibility, audience, jurisdiction exclusions, draft/deprecated state, retention, and security
145
+ class are search correctness gates, not decoration.
146
+ - A good search result that should not have been eligible is a security or product bug.
147
+ 14. Preserve source maps and freshness fields.
148
+ - Store document id, chunk id when applicable, file or URL, section anchor, line or page span, content hash, schema or index version, and last indexed time so stale or unsupported results can be traced.
149
+ 15. Review exact keyword fields separately from analyzed text.
150
+ - Error codes, API paths, legal references, ticket ids, SKU values, class or function names, and
151
+ deprecated names need exact or keyword search coverage even when semantic retrieval exists.
152
+ 16. Review synonym and ranking changes against a golden set.
112
153
  - Synonyms can improve one query and break many others.
113
154
  - Compare representative queries before and after; include zero-result, typo, ambiguous, category, brand, long natural-language, and high-value queries.
114
- 11. Explain surprising ranks only for bounded cases.
155
+ 17. Use query, miss, and click logs as improvement evidence without leaking raw private text.
156
+ - Track query family, normalized terms, filters, zero-result rate, clicked ids, used chunks, fallback reason, and answer success where safe.
157
+ - Do not turn private queries or highlights into fixtures unless they are redacted or synthetic.
158
+ 18. Explain surprising ranks only for bounded cases.
115
159
  - Inspect why one expected document ranked below another for a small failing sample.
116
160
  - Do not enable expensive explain or profile behavior for broad production traffic.
117
- 12. Separate query, fetch, API, and UI latency.
161
+ 19. Separate query, fetch, API, and UI latency.
118
162
  - p50, p95, and p99 must be grouped by search type, index, route, role, tenant class, and query fingerprint where safe.
119
163
  - Fetch time, source size, highlight fields, nested fields, and response shaping can dominate score calculation.
120
- 13. Fingerprint query shapes.
164
+ 20. Fingerprint query shapes.
121
165
  - Remove raw IDs, dates, user text, and tenant secrets before grouping.
122
166
  - Store query family, index, role, shard count, cache state, source fields, sort, and filter shape so one feature cannot hide across millions of unique queries.
123
- 14. Check shard fan-out, thread pools, segments, cache, and disk.
167
+ 21. Check shard fan-out, thread pools, segments, cache, and disk.
124
168
  - Search across hundreds of tiny shards, stale segments, merge backlog, cold caches, search queue rejections, hot shards, and disk watermarks can look like application bugs.
125
169
  - Separate cold and warm measurements; cached benchmarks are not full search evidence.
126
- 15. Review refresh and visibility policy.
170
+ 22. Review refresh and visibility policy.
127
171
  - Indexing success is not search visibility.
128
172
  - Use synchronous visibility only for writes whose user contract needs it; otherwise define acceptable visibility lag and measure it.
129
- 16. Review pagination and result payloads.
173
+ 23. Review pagination and result payloads.
130
174
  - Avoid deep offset pagination as a default product contract.
131
175
  - Use stable tie-breakers for cursor-like pagination, and limit source fields and highlights to what the UI needs.
132
- 17. Keep vector and hybrid boundaries explicit.
176
+ 24. Keep vector and hybrid boundaries explicit.
133
177
  - If dense vectors, ANN, reranking, hybrid score fusion, or Recall@K drives the failure, switch to `vector-search-integrity-review` for that slice.
134
178
  - If the bug is ordinary keyword indexing, alias, analyzer, source filtering, or shard partials, keep this skill as the primary route.
135
- 18. Define numeric SLOs and destructive drills when in scope.
179
+ 25. Define numeric SLOs and destructive drills when in scope.
136
180
  - Useful examples include indexing-to-search-visible p95, search p99, zero-result rate, partial shard failure rate, top-result duplication, golden-set metric, bulk item failure rate, and reindex reconciliation lag.
137
181
  - Live node kills, disk pressure, alias mistakes, mapping conflicts, and mass reindex drills are manual unless the command contract declares them.
138
182
 
@@ -140,6 +184,10 @@ The core question is whether a source record can be changed, accepted by the ind
140
184
  ## Postconditions
141
185
 
142
186
  - The search symptom, source-to-search ledger, query contract, index contract, quality ledger, performance ledger, and privacy boundary are explicit.
187
+ - Metadata taxonomy, metadata key budget, schema versions, stable source/doc/chunk ids, canonical
188
+ keys, aliases, exact keyword fields, filter-only versus LLM-visible metadata, lifecycle and
189
+ effective-date fields, negative metadata, source maps, index version, content hash, query logs,
190
+ and miss logs are explicit where relevant.
143
191
  - Bulk item errors, source/index reconciliation, direct lookup, exact search, full-text search, aliases, partial shards, API/UI transformation, mappings, analyzers, synonyms, ranking, pagination, source payload, shard fan-out, thread-pool pressure, cache state, refresh visibility, segments, disk, and SLO evidence are fixed or reported where relevant.
144
192
  - Search claims are backed by configured tests, fixtures, golden-set evidence, static review, safe canary evidence, or labeled manual-only or missing.
145
193
 
@@ -173,7 +221,9 @@ Prefer the narrowest configured tests that cover search contract, tenant isolati
173
221
 
174
222
  - Search index integrity reviewed
175
223
  - Symptom, source-to-search ledger, query contract, index contract, quality ledger, performance ledger, and privacy boundary
176
- - Bulk, reconciliation, lookup, exact/full-text, alias, shard, API/UI, mapping, analyzer, synonym, ranking, pagination, payload, shard fan-out, thread-pool, cache, refresh, segment, disk, and SLO findings
224
+ - Bulk, reconciliation, lookup, exact/full-text, alias, shard, API/UI, mapping, analyzer, taxonomy,
225
+ source-map, synonym, ranking, pagination, payload, query-log, shard fan-out, thread-pool, cache,
226
+ refresh, segment, disk, and SLO findings
177
227
  - Fix applied or recommended
178
228
  - Evidence level: canary evidence, golden-set evidence, configured-test evidence, static review risk, manual-only, missing, or not applicable
179
229
  - Command intents run