@aiwg/flue 2026.11.7 → 2026.11.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiwg/flue",
3
- "version": "2026.11.7",
3
+ "version": "2026.11.8",
4
4
  "description": "AIWG bundle skills, specialist factories and MCP tools for Flue apps.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -59,16 +59,17 @@ findings.
59
59
  ### Structural and Campaign Checks
60
60
 
61
61
  Paragraph-final explicit moral/lesson openers (3–10 words) are cut tier; generic
62
- subjects alone never trigger a closer finding. Numbers, identifiers and protected
63
- spans suppress moral findings. Adjacent sentences sharing the first two tokens
62
+ subjects alone never trigger a closer finding. Numbers, identifiers and code
63
+ suppress moral findings; quoted scenario names within authored prose are allowed. Adjacent sentences sharing the first two tokens
64
64
  must have parallel predicates with an aligned polarity flip or one listed antonym
65
65
  (cut). Different predicates sharing a negated opener are insufficient. Four
66
66
  consecutive statements of 1–4 words in one paragraph form a check-tier fragment
67
67
  run. Questions and identical-sentence-only runs are excluded. Headings, blank
68
68
  lines and protected whole lines break sequences; wrapped prose lines do not.
69
69
 
70
- Colon reveals are watch tier only for a short setup that withholds a complement
71
- and a short sentence-final punchline. Mere colon frequency and neighboring
70
+ Colon reveals are watch tier for a short setup that withholds a complement
71
+ and a short sentence-final punchline, or an explicit defect revealed through
72
+ a conditional consequence. Mere colon frequency and neighboring
72
73
  findings never suffice. Lists, definitions, digits/citations, code and quotation
73
74
  introductions are excluded. Ambiguous technical introductions remain unflagged.
74
75
 
@@ -96,15 +97,26 @@ explicit size error; split larger sets. Related-location output can still grow
96
97
  with repetition inside an allowed set. A single-document campaign may report
97
98
  repeated sentences; phrases and skeletons require distinct documents.
98
99
 
100
+ The #4138 reproduction also detects a withheld defect followed by an `if`
101
+ condition and a short consequence (`one bug: if …, nothing stopped`). The
102
+ conditional and consequence together may contain up to sixteen words; ordinary
103
+ lists, definitions, code and numeric references stay excluded.
104
+
105
+ A short consequence, a one-word repair (`fixed`, `patched`, `repaired` or
106
+ `resolved`) and a final explicit moral also form a fragment run. The consequence
107
+ may be the final comma clause of a longer sentence. This covers `nothing stopped.
108
+ fixed. always test …` while preserving the four-statement threshold for generic
109
+ staccato. Moral endings allow a quoted scenario name within authored prose
110
+ (`always test the "switch is gone" case`); entirely quoted text and inline code
111
+ remain protected. The negate/assert category includes the short corrective
112
+ frame `it doesn't anymore` (also `it does not anymore`).
113
+
99
114
  These checks are heuristic. Short generic statements and factual technical
100
- negations remain residuals for review; explicit moral openers can be useful
101
- instructions. The original #4138 paragraph has only two short trailing sentences,
102
- so it does not meet the four-sentence fragment threshold. Its colon introduces a
103
- conditional/list and its moral contains a protected quotation, so these are
104
- explicitly scoped out. Its mirrored comma pair is detected as `antithesis-pair`.
105
- A standalone “it doesn't anymore” is a factual correction rather than a sufficient
106
- negate/assert trigger. The reproduction still flags the aside, antonym pair,
107
- negated evidence and negated alternative on all three surfaces.
115
+ negations remain residuals for review; explicit moral openers and short
116
+ corrections can be useful instructions. Findings call for contextual review.
117
+ The reproduction produces all six requested categories across Python,
118
+ validation and contextual diagnostics, with the comma pair reported as
119
+ `antithesis-pair` and the aside as `labelled-significance`.
108
120
 
109
121
  ### Contextual Patterns (Check Frequency)
110
122
 
@@ -27,7 +27,7 @@
27
27
  {
28
28
  "id": "negate-then-assert",
29
29
  "tier": "check",
30
- "pattern": "\\b(?:(?:is|are|was|were)\\s+not|isn't|aren't)\\s+(?:evidence|proof|a substitute|a replacement|the same|enough|just|only|about)\\b|\\b(?:it|this|that)\\s+does\\s+not\\s+(?:mean|prove|imply)\\b",
30
+ "pattern": "\\b(?:(?:is|are|was|were)\\s+not|isn't|aren't)\\s+(?:evidence|proof|a substitute|a replacement|the same|enough|just|only|about)\\b|\\b(?:it|this|that)\\s+does\\s+not\\s+(?:mean|prove|imply)\\b|\\bit\\s+(?:doesn't|does not)\\s+anymore\\b",
31
31
  "message": "Negated assertion frames the claim.",
32
32
  "fix": "State the positive claim, retaining negation when it corrects a misconception."
33
33
  },
@@ -55,9 +55,9 @@
55
55
  ],
56
56
  "structuralRules": [
57
57
  { "id": "mirrored-sentences", "tier": "cut", "scope": "file", "trigger": "Adjacent sentences share the first two tokens and aligned predicates; exactly one polarity flip or listed antonym supplies a real contrast. Different verbs with a negated opener are insufficient.", "fix": "Combine the useful claim; retain deliberate parallelism with a reason." },
58
- { "id": "aphorism-ending", "tier": "cut", "scope": "file", "trigger": "Paragraph-final explicit moral/lesson opener of 3–10 words; exclude numbers, identifiers and protected spans. Generic closers are not detected.", "fix": "End on the last useful fact or support the claim." },
59
- { "id": "colon-reveal", "tier": "watch", "scope": "file", "trigger": "Setup of 4–12 words ending in a withheld complement, then a sentence-final punchline of 2–10 words. Frequency never triggers a finding. Exclude lists/definitions, digits/citations and protected material.", "fix": "State the subject and consequence directly." },
60
- { "id": "fragment-run", "tier": "check", "scope": "file", "trigger": "At least four consecutive statements with 1–4 words in one prose paragraph; questions break runs and identical-sentence-only runs are excluded.", "fix": "Join fragments to explain the reason or result." },
58
+ { "id": "aphorism-ending", "tier": "cut", "scope": "file", "trigger": "Paragraph-final explicit moral/lesson opener of 3–10 words; allow quoted scenario names inside authored prose but exclude numbers, identifiers, code and wholly quoted statements. Generic closers are not detected.", "fix": "End on the last useful fact or support the claim." },
59
+ { "id": "colon-reveal", "tier": "watch", "scope": "file", "trigger": "Setup of 4–12 words ending in a withheld complement, then a sentence-final punchline of 2–10 words. Also detect a withheld defect followed by an if-clause and a short consequence (at most 16 words after the colon). Frequency never triggers a finding. Exclude lists/definitions, digits/citations and protected material.", "fix": "State the subject and consequence directly." },
60
+ { "id": "fragment-run", "tier": "check", "scope": "file", "trigger": "At least four consecutive statements with 1–4 words in one prose paragraph; questions break runs and identical-sentence-only runs are excluded. Also detect a short consequence, a one-word repair and a final explicit moral; the consequence may follow a conditional comma.", "fix": "Join fragments to explain the reason or result." },
61
61
  { "id": "repeated-sentence", "tier": "cut", "scope": "cross", "trigger": "At least six words repeated within an explicit campaign; case and punctuation are ignored, numbers are retained.", "fix": "Write each channel from its relevant facts." },
62
62
  { "id": "repeated-phrase", "tier": "check", "scope": "cross", "trigger": "An eight-word run inside one sentence shared by at least three distinct documents; overlapping runs merge, affected sentences receive one phrase finding, repeated sentences are excluded.", "fix": "Rewrite the shared run for the reader and channel." },
63
63
  { "id": "shared-skeleton", "tier": "check", "scope": "cross", "trigger": "First or last three words of the first or last prose sentence shared by three distinct documents, including a content word; numbers and versions normalize to num.", "fix": "Lead or close with the useful change for this channel." }
@@ -117,7 +117,7 @@ class PatternMatch(NamedTuple):
117
117
  severity: str
118
118
 
119
119
 
120
- def mask_prose(text: str) -> str:
120
+ def mask_prose(text: str, protect_quotes=True) -> str:
121
121
  """Protect Markdown and quotations while retaining code-point offsets."""
122
122
  chars = list(text)
123
123
 
@@ -170,10 +170,12 @@ def mask_prose(text: str) -> str:
170
170
  indented = False
171
171
  if re.match(r'\s*(?:[-*+] |\d+[.)] )', raw):
172
172
  hide(line.start(), line.end())
173
- for pattern in [r'(`+)(?!`)(?:[^`]|(?!\1)`)*?\1(?!`)',
174
- r'!\[[^\]\n]*\](?:\([^\n]*?\)|\[[^\]\n]*\])',
175
- r'(?:!?\[[^\]\n]*\])?\((?:https?://)[^\s)]*\)|https?://[^\s<>]+',
176
- r'“[^”]*”|"[^"\n]+"|«[^»]*»']:
173
+ patterns = [r'(`+)(?!`)(?:[^`]|(?!\1)`)*?\1(?!`)',
174
+ r'!\[[^\]\n]*\](?:\([^\n]*?\)|\[[^\]\n]*\])',
175
+ r'(?:!?\[[^\]\n]*\])?\((?:https?://)[^\s)]*\)|https?://[^\s<>]+']
176
+ if protect_quotes:
177
+ patterns.append(r'“[^”]*”|"[^"\n]+"|«[^»]*»')
178
+ for pattern in patterns:
177
179
  for match in re.finditer(pattern, text):
178
180
  hide(match.start(), match.end())
179
181
  return ''.join(chars)
@@ -291,7 +293,7 @@ def scan_text(text: str) -> dict:
291
293
  severity="info"
292
294
  ))
293
295
 
294
- matches.extend(STRUCTURAL['structural_matches'](text.replace('’', "'").replace('‘', "'"), CATALOGUE['antonyms'], PatternMatch))
296
+ matches.extend(STRUCTURAL['structural_matches'](text.replace('’', "'").replace('‘', "'"), CATALOGUE['antonyms'], PatternMatch, mask_prose(source, protect_quotes=False)))
295
297
 
296
298
  # Calculate deprecated compatibility heuristic (not an authorship or quality measure)
297
299
  critical_count = sum(1 for m in matches if m.severity == "critical")
@@ -54,7 +54,8 @@ def paragraphs(prose):
54
54
  return blocks
55
55
 
56
56
 
57
- def structural_matches(prose, antonyms, match_type):
57
+ def structural_matches(prose, antonyms, match_type, quoted_prose=None):
58
+ quoted_prose = prose if quoted_prose is None else quoted_prose
58
59
  out = []
59
60
  def emit(rule, sentence, tier):
60
61
  out.append(match_type(rule, prose[sentence['start']:sentence['end']], sentence['start'], SEVERITY[tier]))
@@ -81,7 +82,7 @@ def structural_matches(prose, antonyms, match_type):
81
82
  else:
82
83
  flush()
83
84
  text = s['text']
84
- if text.count(':') != 1 or re.search(r'[\d\x01`\[\]{};,]', text) or not re.search(r'[.!]$', text):
85
+ if text.count(':') != 1 or re.search(r'[\d\x01`\[\]{};]', text) or not re.search(r'[.!]$', text):
85
86
  continue
86
87
  before, after = text.split(':')
87
88
  after = after.strip()
@@ -90,19 +91,28 @@ def structural_matches(prose, antonyms, match_type):
90
91
  subject = 1 if punchline and punchline[0] in ('the', 'a', 'an') else 0
91
92
  predicate = punchline[subject + 1] if len(punchline) > subject + 1 else ''
92
93
  clause = punchline and (subject == 1 or punchline[0] in ('it', 'this', 'that', 'we', 'you', 'they', 'he', 'she', 'nothing', 'everything')) and re.fullmatch(r'(?:is|are|was|were|can|will|must|has|had|does|[a-z]+(?:s|ed))', predicate)
93
- if clause and 4 <= len(words(before)) <= 12 and 2 <= len(words(after)) <= 10 and withheld and not re.search(r'^(?:["“]|[-*+]|\x01)', after) and not re.search(r'\b(?:and|or)\b|:|[?!]', after, re.I):
94
+ conditional = re.match(r'^if\b[^,;:]+,\s*(?:nothing|everything|it|this|that|the [a-z]+)\s+(?:[a-z]+(?:s|ed)|is|was|can|will)\b', after, re.I) and not re.search(r'\b(?:and|or)\b|[?!]', after, re.I) and len(punchline) <= 16
95
+ if conditional and re.search(r'\b(?:bug|defect|flaw|failure|problem)$', before.strip(), re.I) and 4 <= len(words(before)) <= 12 and withheld:
96
+ pos = s['start'] + len(before)
97
+ emit('colon-reveal', {'start': pos, 'end': pos + 1}, 'watch')
98
+ if clause and ',' not in after and 4 <= len(words(before)) <= 12 and 2 <= len(words(after)) <= 10 and withheld and not re.search(r'^(?:["“]|[-*+]|\x01)', after) and not re.search(r'\b(?:and|or)\b|:|[?!]', after, re.I):
94
99
  pos = s['start'] + len(before)
95
100
  emit('colon-reveal', {'start': pos, 'end': pos + 1}, 'watch')
96
101
  flush()
97
102
  if not seq:
98
103
  continue
99
104
  last = seq[-1]
100
- text = last['text']
101
- if not 3 <= len(last['tokens']) <= 10 or re.search(r'[\d\x01@/]|[?:]$', text):
105
+ text = quoted_prose[last['start']:last['end']].replace('’', "'").replace('‘', "'")
106
+ if not 3 <= len(words(text)) <= 10 or re.search(r'[\d\x01@/]|[?:]$', text):
102
107
  continue
103
108
  moral = re.match(r"^(?:(?:always|never|remember)\b|the (?:point|lesson|moral)\b|(?:that's|that is|it's|it is|this is) the (?:point|lesson|moral)\b)", text, re.I)
104
109
  if moral:
105
110
  emit('aphorism-ending', last, 'cut')
111
+ if len(seq) >= 3 and not any(m.pattern == 'fragment-run' and m.position + len(m.match) == last['end'] for m in out) and re.fullmatch(r'(?:fixed|patched|repaired|resolved)[.!]', seq[-2]['text'], re.I):
112
+ consequence = seq[-3]
113
+ tail = consequence['text'].split(',')[-1].lstrip()
114
+ if 1 <= len(words(tail)) <= 4 and not re.search(r'[?:\x01]', tail):
115
+ emit('fragment-run', {'start': consequence['end'] - len(tail), 'end': last['end']}, 'check')
106
116
  return out
107
117
 
108
118