@aiwg/flue 2026.11.5 → 2026.11.7

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 (31) hide show
  1. package/package.json +5 -1
  2. package/skills/ai-pattern-detection/SKILL.md +81 -9
  3. package/skills/ai-pattern-detection/references/current-patterns.json +87 -0
  4. package/skills/ai-pattern-detection/scripts/pattern_scanner.py +190 -13
  5. package/skills/ai-pattern-detection/scripts/structural_patterns.py +178 -0
  6. package/skills/aiwg-mission/SKILL.md +4 -0
  7. package/skills/architecture-evolution/SKILL.md +4 -0
  8. package/skills/checkpoint/SKILL.md +4 -0
  9. package/skills/commit-and-push/SKILL.md +4 -0
  10. package/skills/flaky-detect/SKILL.md +4 -0
  11. package/skills/flaky-fix/SKILL.md +4 -0
  12. package/skills/flow-architecture-evolution/SKILL.md +4 -0
  13. package/skills/flow-change-control/SKILL.md +4 -0
  14. package/skills/flow-gate-check/SKILL.md +4 -0
  15. package/skills/flow-handoff-checklist/SKILL.md +4 -0
  16. package/skills/flow-incident-response/SKILL.md +4 -0
  17. package/skills/flow-release/SKILL.md +4 -0
  18. package/skills/gate-evaluation/SKILL.md +4 -0
  19. package/skills/install-plugin/SKILL.md +9 -0
  20. package/skills/issue-close/SKILL.md +4 -0
  21. package/skills/issue-comment/SKILL.md +4 -0
  22. package/skills/new-bundle/SKILL.md +27 -0
  23. package/skills/parallel-dispatch/SKILL.md +4 -0
  24. package/skills/plugin-search/SKILL.md +66 -0
  25. package/skills/plugin-search/SKILL.md.d.ts +3 -0
  26. package/skills/pr-review/SKILL.md +4 -0
  27. package/skills/project-status/SKILL.md +4 -0
  28. package/skills/security-assessment/SKILL.md +4 -0
  29. package/skills/security-audit/SKILL.md +4 -0
  30. package/skills/test-conformance/SKILL.md +4 -0
  31. package/skills/validate-addon/SKILL.md +18 -5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiwg/flue",
3
- "version": "2026.11.5",
3
+ "version": "2026.11.7",
4
4
  "description": "AIWG bundle skills, specialist factories and MCP tools for Flue apps.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1596,6 +1596,10 @@
1596
1596
  "types": "./skills/parallel-dispatch/SKILL.md.d.ts",
1597
1597
  "default": "./skills/parallel-dispatch/SKILL.md"
1598
1598
  },
1599
+ "./skills/plugin-search/SKILL.md": {
1600
+ "types": "./skills/plugin-search/SKILL.md.d.ts",
1601
+ "default": "./skills/plugin-search/SKILL.md"
1602
+ },
1599
1603
  "./skills/plugin-status/SKILL.md": {
1600
1604
  "types": "./skills/plugin-status/SKILL.md.d.ts",
1601
1605
  "default": "./skills/plugin-status/SKILL.md"
@@ -35,12 +35,76 @@ These phrases can be uninformative in some contexts; none identifies content as
35
35
  4. **Performative Language**: "aims to provide", "strives to achieve", "designed to enhance"
36
36
  5. **Academic Passive**: "It has been observed that...", "It can be argued that..."
37
37
 
38
- ### Structural Patterns (Flag When Overused)
39
-
40
- 1. **Three-item lists**: "reliable, scalable, and secure"
41
- 2. **Em-dash overuse**: Multiple em-dashes in a paragraph
42
- 3. **Identical paragraph structure**: Topic → 3 points → conclusion repeated
43
- 4. **Balanced hedging**: "While X has challenges, it also offers opportunities"
38
+ ### Current Local Patterns
39
+
40
+ The scanners detect local contrasts (`not … but`, `X, not Y`, `rather than`),
41
+ negated evidence/proof/substitute assertions, listed antonym pairs, significance
42
+ labels and asides, empty openers, and generic engagement prompts. Findings are
43
+ editing guidance with rule IDs, tiers and suggested changes. Numeric comparisons
44
+ are suppressed when both operands have numbers within six tokens of the divider.
45
+ Reasons (`because`, `while`) and correction cues suppress a match only inside it
46
+ or within four tokens, without crossing a semicolon/colon. An unrelated date does
47
+ not suppress “It is not just the score in 2026.” Proximity remains a heuristic.
48
+
49
+ The dated `references/current-patterns.json` list requires two lexical markers in
50
+ one paragraph or four in a file; lone leverage/enhance are ignored. Spectral-only
51
+ clusters use watch tier. All three surfaces recognize a narrow rhetorical
52
+ adjective triad with or without the Oxford comma: `three_item_list` in Python,
53
+ `struct_three_items` in validation and diagnostics (watch tier). Inventories remain valid.
54
+
55
+ Front matter, headings, image alt text, code, quotations, comments, tables and
56
+ inventory lines are protected. Passive voice and standalone punctuation are not
57
+ findings.
58
+
59
+ ### Structural and Campaign Checks
60
+
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
64
+ must have parallel predicates with an aligned polarity flip or one listed antonym
65
+ (cut). Different predicates sharing a negated opener are insufficient. Four
66
+ consecutive statements of 1–4 words in one paragraph form a check-tier fragment
67
+ run. Questions and identical-sentence-only runs are excluded. Headings, blank
68
+ lines and protected whole lines break sequences; wrapped prose lines do not.
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
72
+ findings never suffice. Lists, definitions, digits/citations, code and quotation
73
+ introductions are excluded. Ambiguous technical introductions remain unflagged.
74
+
75
+ Use one campaign set for cross-document comparison:
76
+
77
+ ```bash
78
+ aiwg writing --cross --json linkedin.md telegram.md x-thread.md
79
+ python3 -I scripts/pattern_scanner.py --cross campaign/
80
+ python3 -I scripts/pattern_scanner.py --cross --report campaign/
81
+ ```
82
+
83
+ The existing `aiwg writing` entry point emits a readable report by default and
84
+ JSON with `--json`; Python emits JSON by default and readable output with
85
+ `--report`. Each finding includes a tier, source location and suggested fix.
86
+ Campaign rules detect six-word repeated sentences (cut), eight-word runs shared
87
+ by at least three documents (check), and three-word opening/closing skeletons
88
+ shared by at least three documents (check). Numbers and versions normalize only
89
+ for skeletons; phrase runs exclude sentences already reported as repeated.
90
+ Every affected occurrence is reported, with related document locations.
91
+
92
+ The APIs are `diagnoseWritingBatch(documents, { cross: true })` and
93
+ `engine.validateBatch(files, context, { cross: true })`. IDs must be unique;
94
+ missing campaign files fail the scan. Sets over 200 documents fail with an
95
+ explicit size error; split larger sets. Related-location output can still grow
96
+ with repetition inside an allowed set. A single-document campaign may report
97
+ repeated sentences; phrases and skeletons require distinct documents.
98
+
99
+ 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.
44
108
 
45
109
  ### Contextual Patterns (Check Frequency)
46
110
 
@@ -94,12 +158,20 @@ When generating or reviewing content:
94
158
 
95
159
  The Python `scripts/pattern_scanner.py` is a **legacy regex scanner**, not the contextual diagnostic implementation. It:
96
160
  - Counts pattern frequencies
97
- - Labels matches using legacy severity categories; these are advisory absent a user rule
98
- - Generates replacement suggestions
99
- - Preserves the deprecated numeric `authenticity_score` (0–100) and `grade` for compatibility, with a deprecation notice; neither measures authorship or publication readiness
161
+ - Labels matches with pattern IDs, tiers, source line/column and legacy severity categories; these are advisory absent a user rule
162
+ - Generates replacement suggestions for local, structural and campaign patterns
163
+ - Preserves the deprecated numeric `authenticity_score` (0–100) and `grade` for compatibility, with prose-rate penalties and a deprecation notice; neither measures authorship or publication readiness
100
164
 
101
165
  For contextual programmatic review, use `WritingValidationEngine.diagnose(content, options)` or the exported `diagnoseWriting` API. Results include UTF-16 spans, context, explanations and reasoned exceptions. They carry `publicationGate: false`. The Python scanner does not implement these context or exception fields.
102
166
 
167
+ Python `position` counts Unicode code points from zero; its `column` counts code
168
+ points from one. Validation `location.start/end` and diagnostic `start/end` count
169
+ UTF-16 code units from zero, with exclusive ends; validation `column` counts
170
+ UTF-16 units from one. Lines start at one on every surface. These units also apply to structural and
171
+ campaign findings and their related source lines. ASCII offsets agree.
172
+ For `🧵 Thoughts?`, Python gives position 2 and column 3; TypeScript gives start 3
173
+ and validation column 4, because the astral character occupies two UTF-16 units.
174
+
103
175
  ## Integration
104
176
 
105
177
  This skill works with:
@@ -0,0 +1,87 @@
1
+ {
2
+ "reviewed": "2026-11-12",
3
+ "nextReview": "2027-02-12",
4
+ "note": "Editorial heuristics for #4138 and #4140, based on the November voice-quality catalogue. Not authorship evidence. Sequence and campaign rules supplement local clauses.",
5
+ "rules": [
6
+ {
7
+ "id": "contrast-not-but",
8
+ "tier": "cut",
9
+ "pattern": "\\bnot\\s+[^.!?;:\\n]{1,100}?,?\\s+but\\b",
10
+ "message": "Negated alternative before but.",
11
+ "fix": "State the positive claim; retain a negated alternative when it corrects a stated belief."
12
+ },
13
+ {
14
+ "id": "contrast-x-not-y",
15
+ "tier": "cut",
16
+ "pattern": ",\\s+not\\s+(?!(?:yet|now|sure|necessarily|really|enough|all|in|if|when|because|until|any|clear|certain|true|quite|going|at all|be|do|need)\\b)[\\w'-]+(?:\\s+[\\w'-]+){0,4}",
17
+ "message": "A clause ends with a negated alternative.",
18
+ "fix": "Keep the useful claim; retain the alternative only when the reader needs the correction."
19
+ },
20
+ {
21
+ "id": "rather-than",
22
+ "tier": "check",
23
+ "pattern": "\\brather\\s+than\\b",
24
+ "message": "Comparison without a stated reason.",
25
+ "fix": "Name the action, or explain why the alternative was a real option."
26
+ },
27
+ {
28
+ "id": "negate-then-assert",
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",
31
+ "message": "Negated assertion frames the claim.",
32
+ "fix": "State the positive claim, retaining negation when it corrects a misconception."
33
+ },
34
+ {
35
+ "id": "labelled-significance",
36
+ "tier": "cut",
37
+ "pattern": "(?:^|[.!?]\\s+|\\n)\\s*(?:why (?:it|this|that) (?:matters|helps)|why you should care|what (?:changed|this means(?: for you)?|that means|you get)|the (?:bug|takeaway|point|lesson|catch|upshot|real (?:question|point|story))|bottom line|the short version)\\s*:|\\b(?:(?:which|that) is the (?:part|thing|bit|point|half) (?:i'd|i would) (?:keep|say|add)(?: too)?|(?:that|this) is the (?:other|real|whole|hard) (?:half|part|point|story|thing))\\b",
38
+ "message": "A label or aside announces significance.",
39
+ "fix": "Explain the circumstance and consequence together; deleting only the label is insufficient."
40
+ },
41
+ {
42
+ "id": "throat-clearing",
43
+ "tier": "cut",
44
+ "pattern": "\\b(?:here'?s the (?:thing|deal|kicker|catch|twist)|here'?s why|let'?s (?:dive|dig|jump) (?:in|into)|let'?s (?:be|get) (?:honest|real|clear)|without further ado|buckle up|picture this|spoiler alert|let me explain)\\b|\\bfull stop\\.",
45
+ "message": "Empty opener delays the content.",
46
+ "fix": "Start with the useful information."
47
+ },
48
+ {
49
+ "id": "engagement-bait",
50
+ "tier": "cut",
51
+ "pattern": "\\b(?:what do you think|agree|thoughts|am i wrong|what'?s your take)\\?|\\b(?:drop a comment|comment below|tag someone who|let me know (?:in the comments|what you think))\\b",
52
+ "message": "Generic engagement prompt.",
53
+ "fix": "Ask a concrete question with something to answer, or end with the information."
54
+ }
55
+ ],
56
+ "structuralRules": [
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." },
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
+ { "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
+ { "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." }
64
+ ],
65
+ "antonyms": [
66
+ ["quiet", "loud"], ["fast", "slow"], ["cheap", "expensive"],
67
+ ["simple", "complex"], ["easy", "hard"], ["safe", "unsafe"],
68
+ ["big", "small"], ["large", "small"], ["new", "old"],
69
+ ["public", "private"], ["local", "remote"], ["manual", "automatic"],
70
+ ["short", "long"], ["early", "late"], ["good", "bad"],
71
+ ["real", "fake"], ["open", "closed"], ["visible", "hidden"],
72
+ ["cold", "hot"], ["dark", "bright"], ["strong", "weak"],
73
+ ["clean", "dirty"], ["working", "broken"], ["fixed", "broken"]
74
+ ],
75
+ "lexicon": {
76
+ "paragraphMinHits": 2,
77
+ "fileMinHits": 4,
78
+ "sets": [
79
+ { "name": "2023", "tier": "check", "words": ["delve", "delves", "delved", "delving", "tapestry", "testament", "pivotal", "crucial", "meticulous"] },
80
+ { "name": "2024-25", "tier": "check", "words": ["enhance", "enhances", "enhanced", "enhancing", "fostering", "showcasing", "highlighting", "valuable insights"] },
81
+ { "name": "2026", "tier": "check", "words": ["leverage", "leverages", "leveraged", "leveraging", "multifaceted"] },
82
+ { "name": "copula-avoidance", "tier": "check", "words": ["serves as", "stands as", "boasts", "acts as", "functions as"] },
83
+ { "name": "spectral-technical", "tier": "watch", "words": ["quiet", "hum", "echo"] }
84
+ ]
85
+ },
86
+ "triadPattern": "\\b(?:is|are|was|were)\\s+(?:fast|reliable|secure|efficient|scalable|robust|innovative|flexible|powerful),\\s+(?:fast|reliable|secure|efficient|scalable|robust|innovative|flexible|powerful),?\\s+and\\s+(?:fast|reliable|secure|efficient|scalable|robust|innovative|flexible|powerful)(?![\\w-]|\\s*,)"
87
+ }
@@ -15,10 +15,19 @@ Output:
15
15
  import re
16
16
  import json
17
17
  import sys
18
+ import runpy
18
19
  from pathlib import Path
19
20
  from collections import Counter
20
21
  from typing import NamedTuple
21
22
 
23
+ CATALOGUE = json.loads((Path(__file__).resolve().parents[1] /
24
+ 'references/current-patterns.json').read_text(encoding='utf-8'))
25
+ FIXES = {rule['id']: rule['fix'] for rule in CATALOGUE['rules']}
26
+ FIXES.update({'antithesis-pair': 'Keep the fact and drop the mirrored half.',
27
+ 'lexical-cluster': 'Replace vague markers with the specific action or fact.'})
28
+ STRUCTURAL = runpy.run_path(str(Path(__file__).with_name('structural_patterns.py')))
29
+ FIXES.update(STRUCTURAL['FIXES'])
30
+
22
31
  # Legacy high-priority phrase patterns; matches do not identify authorship
23
32
  CRITICAL_PATTERNS = [
24
33
  # Corporate/Marketing Speak
@@ -36,7 +45,6 @@ CRITICAL_PATTERNS = [
36
45
  r"\bgame[- ]changing",
37
46
  r"\bparadigm\s+shift",
38
47
  r"\bsynerg(y|istic)",
39
- r"\bleverag(e|ing)\b",
40
48
 
41
49
  # Vague Intensifiers
42
50
  r"\bdramatically\s+(improv|enhanc|reduc|increas)",
@@ -97,9 +105,7 @@ CONTEXTUAL_PATTERNS = [
97
105
 
98
106
  # Structural patterns
99
107
  STRUCTURAL_PATTERNS = {
100
- "three_item_list": r"\b\w+,\s+\w+,\s+and\s+\w+\b",
101
- "em_dash_overuse": r"—",
102
- "passive_voice": r"\b(is|are|was|were|been|being)\s+\w+ed\b",
108
+ "three_item_list": CATALOGUE['triadPattern'],
103
109
  "hedge_words": r"\b(may|might|could|can)\s+(help|serve|facilitate|enhance)\b",
104
110
  }
105
111
 
@@ -111,11 +117,135 @@ class PatternMatch(NamedTuple):
111
117
  severity: str
112
118
 
113
119
 
120
+ def mask_prose(text: str) -> str:
121
+ """Protect Markdown and quotations while retaining code-point offsets."""
122
+ chars = list(text)
123
+
124
+ def hide(start, end):
125
+ for pos in range(start, end):
126
+ if chars[pos] not in '\r\n':
127
+ chars[pos] = '\x01'
128
+
129
+ lines = list(re.finditer(r'[^\n]+(?:\n|$)|\n', text))
130
+ front = bool(lines and re.fullmatch(r'\ufeff?---\s*', lines[0].group()))
131
+ fence = None
132
+ comment = False
133
+ indented = False
134
+ for index, line in enumerate(lines):
135
+ raw = line.group()
136
+ marker = re.match(r' {0,3}(`{3,}|~{3,})(.*)', raw)
137
+ if front:
138
+ hide(line.start(), line.end())
139
+ if index > 0 and re.fullmatch(r'(?:---|\.\.\.)\s*', raw):
140
+ front = False
141
+ continue
142
+ if fence:
143
+ hide(line.start(), line.end())
144
+ if marker and marker[1][0] == fence[0] and len(marker[1]) >= len(fence) and not marker[2].strip():
145
+ fence = None
146
+ continue
147
+ if marker:
148
+ fence = marker[1]
149
+ hide(line.start(), line.end())
150
+ continue
151
+ if comment:
152
+ end = raw.find('-->')
153
+ hide(line.start(), line.start() + (len(raw) if end < 0 else end + 3))
154
+ comment = end < 0
155
+ if comment:
156
+ continue
157
+ for match in re.finditer(r'<!--[\s\S]*?(?:-->|$)', raw):
158
+ hide(line.start() + match.start(), line.start() + match.end())
159
+ if not match.group().endswith('-->'):
160
+ comment = True
161
+ setext = index + 1 < len(lines) and re.fullmatch(r' {0,3}(?:=+|-+)\s*', lines[index + 1].group())
162
+ if re.match(r' {0,3}(?:#{1,6}(?:\s|$)|>|\|)', raw) or setext or re.fullmatch(r' {0,3}(?:=+|-+)\s*', raw):
163
+ hide(line.start(), line.end())
164
+ continue
165
+ if re.match(r'(?: {4}|\t)', raw) and (indented or index == 0 or not lines[index - 1].group().strip()):
166
+ hide(line.start(), line.end())
167
+ indented = True
168
+ continue
169
+ if raw.strip():
170
+ indented = False
171
+ if re.match(r'\s*(?:[-*+] |\d+[.)] )', raw):
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]+"|«[^»]*»']:
177
+ for match in re.finditer(pattern, text):
178
+ hide(match.start(), match.end())
179
+ return ''.join(chars)
180
+
181
+
182
+ def grounded_comparison(text: str, start: int, end: int) -> bool:
183
+ """Require grounding near this comparison, not anywhere in its sentence."""
184
+ words = lambda s: re.findall(r"[a-z0-9]+(?:['.-][a-z0-9]+)*", s, re.I)
185
+ for cue in re.finditer(r'\b(?:because|while|correction|earlier|previously|misconception|you said)\b', text, re.I):
186
+ gap = text[end:cue.start()] if cue.start() >= end else text[cue.end():start] if cue.end() <= start else ''
187
+ if not re.search(r'[;:]', gap) and len(words(gap)) <= 4:
188
+ return True
189
+ divider = re.search(r'\brather\s+than\b|\bbut\b|,\s+not\b|^,$', text[start:end], re.I)
190
+ if not divider:
191
+ return False
192
+ pivot = start + divider.start()
193
+ left = words(re.split(r'[;:]', text[:pivot])[-1])[-6:]
194
+ right = words(re.split(r'[;:]', text[pivot + len(divider.group()):])[0])[:6]
195
+ return any(re.search(r'\d', w) for w in left) and any(re.search(r'\d', w) for w in right)
196
+
197
+
198
+ def current_matches(text: str):
199
+ """Local editorial patterns on masked prose."""
200
+ text = text.replace('’', "'").replace('‘', "'")
201
+ severity = {'cut': 'critical', 'check': 'warning', 'watch': 'info'}
202
+ paragraphs = list(re.finditer(r'\S[^\n]*(?:\n(?!\s*\n)[^\n]+)*', text))
203
+ lexical = []
204
+ for paragraph in paragraphs:
205
+ hits = []
206
+ for group in CATALOGUE['lexicon']['sets']:
207
+ pattern = r'\b(?:' + '|'.join(re.escape(w) for w in group['words']) + r')\b'
208
+ hits.extend((paragraph.start() + m.start(), m.group(), group['tier'])
209
+ for m in re.finditer(pattern, paragraph.group(), re.I))
210
+ if hits:
211
+ hits.sort()
212
+ lexical.append((hits[0], len(hits), 'check' if any(h[2] == 'check' for h in hits) else 'watch'))
213
+ total = sum(count for _, count, _ in lexical)
214
+ for (start, word, _), count, tier in lexical:
215
+ if count >= CATALOGUE['lexicon']['paragraphMinHits'] or total >= CATALOGUE['lexicon']['fileMinHits']:
216
+ yield PatternMatch('lexical-cluster', word, start, severity[tier])
217
+ tokens = lambda s: re.findall(r"[a-z]+(?:['-][a-z]+)*", s.lower())
218
+ for sentence in re.finditer(r'[^.!?\n\x01]+(?:[.!?]+|(?=[\n\x01]|$))', text):
219
+ body = sentence.group()
220
+ contrast = re.search(CATALOGUE['rules'][0]['pattern'], body, re.I)
221
+ for rule in CATALOGUE['rules']:
222
+ if rule['id'] == 'negate-then-assert' and contrast:
223
+ continue
224
+ for match in re.finditer(rule['pattern'], body, re.I | re.M):
225
+ if rule['id'] in ('contrast-not-but', 'contrast-x-not-y', 'rather-than', 'negate-then-assert') and grounded_comparison(body, match.start(), match.end()):
226
+ continue
227
+ trim = len(match.group()) - len(match.group().lstrip())
228
+ yield PatternMatch(rule['id'], match.group().lstrip(), sentence.start() + match.start() + trim, severity[rule['tier']])
229
+ for comma in re.finditer(',', body):
230
+ if grounded_comparison(body, comma.start(), comma.end()):
231
+ continue
232
+ left, right = tokens(body[:comma.start()])[-3:], tokens(body[comma.end():])[:2]
233
+ if len(left) < 2 or len(right) < 2:
234
+ continue
235
+ if any((a in left and b in right) or (b in left and a in right) for a, b in CATALOGUE['antonyms']):
236
+ trim = len(body) - len(body.lstrip())
237
+ yield PatternMatch('antithesis-pair', body.lstrip(), sentence.start() + trim, 'critical')
238
+ break
239
+
240
+
114
241
  def scan_text(text: str) -> dict:
115
242
  """Scan text for AI patterns and return analysis report."""
116
243
 
117
- word_count = len(text.split())
118
- matches = []
244
+ source = text
245
+ text = mask_prose(text)
246
+ word_count = len(re.findall(r'\b\w+\b', text))
247
+ local_matches = list(current_matches(text))
248
+ matches = list(local_matches)
119
249
 
120
250
  # Check critical patterns
121
251
  for pattern in CRITICAL_PATTERNS:
@@ -151,7 +281,7 @@ def scan_text(text: str) -> dict:
151
281
  if count > 0:
152
282
  structural_issues[name] = count
153
283
  # Flag if overused
154
- threshold = 3 if name == "em_dash_overuse" else 5
284
+ threshold = 0 if name == "three_item_list" else 5
155
285
  if count > threshold:
156
286
  for match in re.finditer(pattern, text, re.IGNORECASE):
157
287
  matches.append(PatternMatch(
@@ -161,6 +291,8 @@ def scan_text(text: str) -> dict:
161
291
  severity="info"
162
292
  ))
163
293
 
294
+ matches.extend(STRUCTURAL['structural_matches'](text.replace('’', "'").replace('‘', "'"), CATALOGUE['antonyms'], PatternMatch))
295
+
164
296
  # Calculate deprecated compatibility heuristic (not an authorship or quality measure)
165
297
  critical_count = sum(1 for m in matches if m.severity == "critical")
166
298
  warning_count = sum(1 for m in matches if m.severity == "warning")
@@ -168,9 +300,7 @@ def scan_text(text: str) -> dict:
168
300
 
169
301
  # Base score of 100, deduct for issues
170
302
  score = 100
171
- score -= critical_count * 10 # -10 per critical
172
- score -= warning_count * 3 # -3 per warning
173
- score -= info_count * 1 # -1 per info
303
+ score -= (critical_count * 10 + warning_count * 3 + info_count) * 100 / max(word_count, 1)
174
304
  score = max(0, min(100, score))
175
305
 
176
306
  return {
@@ -190,9 +320,15 @@ def scan_text(text: str) -> dict:
190
320
  },
191
321
  "matches": [
192
322
  {
193
- "text": m.match,
323
+ "text": source[m.position:m.position + len(m.match)],
324
+ "pattern": m.pattern,
325
+ "scope": "file",
194
326
  "severity": m.severity,
195
- "position": m.position
327
+ "tier": {"critical": "cut", "warning": "check", "info": "watch"}[m.severity],
328
+ "position": m.position,
329
+ "line": source.count('\n', 0, m.position) + 1,
330
+ "column": m.position - source.rfind('\n', 0, m.position),
331
+ "suggestion": FIXES.get(m.pattern, 'Review the wording in context; retain deliberate usage.')
196
332
  }
197
333
  for m in sorted(matches, key=lambda x: x.position)
198
334
  ],
@@ -218,11 +354,34 @@ def _score_to_grade(score: int) -> str:
218
354
 
219
355
  def main():
220
356
  """CLI entry point."""
357
+ if '--cross' in sys.argv[1:]:
358
+ args = sys.argv[1:]
359
+ readable = '--report' in args
360
+ paths = [arg for arg in args if arg not in ('--cross', '--json', '--report')]
361
+ if not paths or any(arg.startswith('-') for arg in paths):
362
+ raise SystemExit('Usage: pattern_scanner.py --cross [--json|--report] <file-or-dir>...')
363
+ files = sorted({file.resolve() for item in paths for file in
364
+ (Path(item).rglob('*.md') if Path(item).is_dir() else [Path(item)])})
365
+ if len(files) > 200:
366
+ raise SystemExit('Campaign exceeds 200 documents; split it into smaller campaign sets.')
367
+ sources = {}
368
+ for file in files:
369
+ with file.open(encoding='utf-8', newline='') as stream:
370
+ sources[str(file)] = stream.read()
371
+ result = scan_campaign(sources)
372
+ if readable:
373
+ for file, report in result.items():
374
+ for m in report['matches']:
375
+ print(f"{file}:{m['line']}:{m['column']} [{m['tier']}] {m['pattern']}: {m['suggestion']}")
376
+ else:
377
+ print(json.dumps(result, indent=2))
378
+ return
221
379
  if len(sys.argv) < 2 or sys.argv[1] in ('--help', '-h'):
222
380
  print(__doc__)
223
381
  print("Options:")
224
382
  print(" <file> Path to file to scan")
225
383
  print(" --text 'text' Inline text to scan")
384
+ print(" --cross [--report] <file-or-dir>... Compare one campaign (JSON by default)")
226
385
  print(" --help, -h Show this help message")
227
386
  sys.exit(0)
228
387
 
@@ -233,11 +392,29 @@ def main():
233
392
  if not path.exists():
234
393
  print(f"Error: File not found: {path}")
235
394
  sys.exit(1)
236
- text = path.read_text()
395
+ with path.open(encoding='utf-8', newline='') as stream:
396
+ text = stream.read()
237
397
 
238
398
  result = scan_text(text)
239
399
  print(json.dumps(result, indent=2))
240
400
 
241
401
 
402
+ def scan_campaign(sources: dict) -> dict:
403
+ """Scan an explicit {document_id: source} campaign, including local findings."""
404
+ cross = STRUCTURAL['campaign_matches'](sources, mask_prose)
405
+ reports = {name: scan_text(text) for name, text in sources.items()}
406
+ for name, report in reports.items():
407
+ report['matches'].extend(cross[name])
408
+ report['matches'].sort(key=lambda m: (m['position'], m['pattern']))
409
+ for m in cross[name]:
410
+ report['summary'][m['severity']] += 1
411
+ report['summary']['total'] += 1
412
+ summary = report['summary']
413
+ penalty = (summary['critical'] * 10 + summary['warning'] * 3 + summary['info']) * 100 / max(report['word_count'], 1)
414
+ report['authenticity_score'] = max(0, min(100, 100 - penalty))
415
+ report['grade'] = _score_to_grade(report['authenticity_score'])
416
+ return reports
417
+
418
+
242
419
  if __name__ == "__main__":
243
420
  main()
@@ -0,0 +1,178 @@
1
+ """Sentence-sequence and campaign editorial heuristics with source code-point offsets."""
2
+ import re
3
+ from collections import defaultdict
4
+
5
+ STOP = set("a an the of to in on for and or but is are was were be it its this that these those with as at by from not no so if we you i they he she our your their there here than then also about into over under out up down can will would should could has have had do does did just only more most very all any each some which who what when where how why num them his her me my".split())
6
+ ABBREVIATIONS = set('e.g i.e vs etc approx cf eg ie dr mr mrs ms st no fig al'.split())
7
+ SEVERITY = {'cut': 'critical', 'check': 'warning', 'watch': 'info'}
8
+ FIXES = {
9
+ 'mirrored-sentences': 'Combine the useful claim into one sentence; retain deliberate parallelism with a reason.',
10
+ 'fragment-run': 'Join fragments to explain the reason or result.',
11
+ 'aphorism-ending': 'End on the last useful fact, or develop the claim with supported detail.',
12
+ 'colon-reveal': 'State the subject and consequence directly; retain real lists, labels and code introductions.',
13
+ 'repeated-sentence': 'Write each channel from its relevant facts; retain required repetition with a reason.',
14
+ 'repeated-phrase': 'Rewrite the shared run for the reader and channel.',
15
+ 'shared-skeleton': 'Lead or close with the useful change for this channel instead of a recurring template.'
16
+ }
17
+
18
+
19
+ def words(text):
20
+ return re.findall(r"[a-z0-9]+(?:['’-][a-z0-9]+)*", text.lower())
21
+
22
+
23
+ def paragraphs(prose):
24
+ blocks = []
25
+ for line in re.finditer(r'[^\n]*(?:\n|$)', prose):
26
+ if not re.sub(r'[\s\x01]', '', line.group()):
27
+ continue
28
+ if blocks and blocks[-1]['end'] == line.start():
29
+ blocks[-1]['end'] = line.end()
30
+ else:
31
+ blocks.append({'start': line.start(), 'end': line.end()})
32
+ for p in blocks:
33
+ text = prose[p['start']:p['end']]
34
+ ends = []
35
+ segment_start = 0
36
+ for match in re.finditer(r'[.!?]+', text):
37
+ if match.end() < len(text) and not text[match.end()].isspace():
38
+ continue
39
+ word = re.search(r'([a-z][a-z.]*)$', text[segment_start:match.start()], re.I)
40
+ if match.group() == '.' and word and (word[1].lower() in ABBREVIATIONS or re.fullmatch(r'(?:[a-z]\.)+[a-z]', word[1], re.I)):
41
+ continue
42
+ ends.append(match.end())
43
+ segment_start = match.end()
44
+ ends.append(len(text))
45
+ start = 0
46
+ p['sentences'] = []
47
+ for end in ends:
48
+ raw = text[start:end]
49
+ trimmed = raw.strip(' \t\r\n\x01')
50
+ if words(trimmed):
51
+ offset = p['start'] + start + len(raw) - len(raw.lstrip(' \t\r\n\x01'))
52
+ p['sentences'].append({'start': offset, 'end': offset + len(trimmed), 'text': trimmed, 'tokens': words(trimmed)})
53
+ start = end
54
+ return blocks
55
+
56
+
57
+ def structural_matches(prose, antonyms, match_type):
58
+ out = []
59
+ def emit(rule, sentence, tier):
60
+ out.append(match_type(rule, prose[sentence['start']:sentence['end']], sentence['start'], SEVERITY[tier]))
61
+ for p in paragraphs(prose):
62
+ seq = p['sentences']
63
+ for a, b in zip(seq, seq[1:]):
64
+ left, right = [words(re.sub(r"n['’]t\b", ' not', v['text'], flags=re.I)) for v in (a, b)]
65
+ negated = lambda tokens: 'not' in tokens or 'never' in tokens
66
+ x, y = [[t for t in tokens if t not in ('not', 'never')] for tokens in (left, right)]
67
+ differences = [i for i, (u, v) in enumerate(zip(x, y)) if u != v]
68
+ polarity = negated(left) != negated(right) and not differences
69
+ antonym = negated(left) == negated(right) and len(differences) == 1 and differences[0] >= 2 and any(x[differences[0]] in pair and y[differences[0]] in pair for pair in antonyms)
70
+ if len(x) >= 3 and len(x) == len(y) and x[:2] == y[:2] and (polarity or antonym):
71
+ emit('mirrored-sentences', b, 'cut')
72
+ run = []
73
+ def flush():
74
+ if len(run) >= 4 and len({' '.join(s['tokens']) for s in run}) > 1:
75
+ emit('fragment-run', {'start': run[0]['start'], 'end': run[-1]['end']}, 'check')
76
+ run.clear()
77
+ for s in seq:
78
+ label = re.match(r'^([^:]+):', s['text'])
79
+ if len(s['tokens']) <= 4 and not s['text'].endswith('?') and not (label and len(words(label[1])) <= 3):
80
+ run.append(s)
81
+ else:
82
+ flush()
83
+ text = s['text']
84
+ if text.count(':') != 1 or re.search(r'[\d\x01`\[\]{};,]', text) or not re.search(r'[.!]$', text):
85
+ continue
86
+ before, after = text.split(':')
87
+ after = after.strip()
88
+ withheld = re.search(r'\b(?:is|are|was|were)$', before.strip()) or re.search(r'\b(?:has|had|have|makes|made|holds|held|offers|offered|reveals|revealed|leaves|left) (?:a|an|one|this|that) (?:[a-z]+ ){0,2}[a-z]+$', before.strip(), re.I)
89
+ punchline = words(after)
90
+ subject = 1 if punchline and punchline[0] in ('the', 'a', 'an') else 0
91
+ predicate = punchline[subject + 1] if len(punchline) > subject + 1 else ''
92
+ 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
+ pos = s['start'] + len(before)
95
+ emit('colon-reveal', {'start': pos, 'end': pos + 1}, 'watch')
96
+ flush()
97
+ if not seq:
98
+ continue
99
+ last = seq[-1]
100
+ text = last['text']
101
+ if not 3 <= len(last['tokens']) <= 10 or re.search(r'[\d\x01@/]|[?:]$', text):
102
+ continue
103
+ 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
+ if moral:
105
+ emit('aphorism-ending', last, 'cut')
106
+ return out
107
+
108
+
109
+ def campaign_matches(sources, mask):
110
+ if len(sources) > 200:
111
+ raise ValueError('Campaign exceeds 200 documents; split it into smaller campaign sets.')
112
+ out = {name: [] for name in sources}
113
+ by_document = defaultdict(list)
114
+ records = []
115
+ for name, text in sources.items():
116
+ for p in paragraphs(mask(text)):
117
+ for s in p['sentences']:
118
+ r = dict(s, file=name, key=' '.join(s['tokens']), line=text.count('\n', 0, s['start']) + 1)
119
+ records.append(r)
120
+ by_document[name].append(r)
121
+ def emit(rule, tier, r, related):
122
+ if any(f['pattern'] == rule and f['position'] == r['start'] and len(f['text']) == r['end'] - r['start'] for f in out[r['file']]):
123
+ return
124
+ source = sources[r['file']]
125
+ out[r['file']].append({'pattern': rule, 'tier': tier, 'severity': SEVERITY[tier], 'scope': 'cross',
126
+ 'position': r['start'], 'line': source.count('\n', 0, r['start']) + 1,
127
+ 'column': r['start'] - source.rfind('\n', 0, r['start']),
128
+ 'text': source[r['start']:r['end']], 'suggestion': FIXES[rule],
129
+ 'related': sorted([{'documentId': s['file'], 'line': s['line']} for s in related if s is not r], key=lambda s: (s['documentId'], s['line']))})
130
+ by_sentence = defaultdict(list)
131
+ for r in records:
132
+ if len(r['tokens']) >= 6:
133
+ by_sentence[r['key']].append(r)
134
+ repeated = set()
135
+ for key, occurrences in by_sentence.items():
136
+ if len(occurrences) >= 2:
137
+ repeated.add(key)
138
+ for r in occurrences:
139
+ emit('repeated-sentence', 'cut', r, occurrences)
140
+ shingles = defaultdict(list)
141
+ for r in records:
142
+ for i in range(len(r['tokens']) - 7):
143
+ shingles[' '.join(r['tokens'][i:i+8])].append(r)
144
+ shingle_documents = {key: len({s['file'] for s in occurrences}) for key, occurrences in shingles.items()}
145
+ for r in records:
146
+ if r['key'] in repeated:
147
+ continue
148
+ covered, related = set(), {}
149
+ for i in range(len(r['tokens']) - 7):
150
+ key = ' '.join(r['tokens'][i:i+8])
151
+ occurrences = shingles[key]
152
+ if shingle_documents[key] >= 3:
153
+ covered.update(range(i, i+8))
154
+ for s in occurrences:
155
+ related[id(s)] = s
156
+ for i in sorted(covered):
157
+ if i - 1 not in covered:
158
+ emit('repeated-phrase', 'check', r, related.values())
159
+ for edge in ('opening', 'closing'):
160
+ groups = defaultdict(list)
161
+ for name in sources:
162
+ own = by_document[name]
163
+ if not own:
164
+ continue
165
+ r = own[0] if edge == 'opening' else own[-1]
166
+ normalized = words(re.sub(r'\d+(?:[.-]\d+)*', ' num ', r['text']))
167
+ if len(normalized) < 3:
168
+ continue
169
+ boundary = normalized[:3] if edge == 'opening' else normalized[-3:]
170
+ if any(w not in STOP for w in boundary):
171
+ groups[' '.join(boundary)].append(r)
172
+ for occurrences in groups.values():
173
+ if len({r['file'] for r in occurrences}) >= 3:
174
+ for r in occurrences:
175
+ emit('shared-skeleton', 'check', r, occurrences)
176
+ for findings in out.values():
177
+ findings.sort(key=lambda f: (f['position'], f['pattern']))
178
+ return out
@@ -12,6 +12,10 @@ You are launching (or participating in) an **AIWG Mission** — AIWG's dynamic,
12
12
 
13
13
  This is an **AIWG-specific kernel capability**. On Codex it surfaces as `/aiwg-mission`, deployed by AIWG to `~/.codex/prompts/` — it is **AIWG-owned**, not the plugin-provided `/workflow` an arbitrary Codex install may or may not have (`/workflow` is not a core Codex primitive — see `.aiwg/research/provider-workflow-integration.md`).
14
14
 
15
+ ## Output template
16
+
17
+ Required for each bounded worker brief: @$AIWG_ROOT/agentic/code/addons/aiwg-utils/templates/subagent-brief.md. Fill every required section; explain non-applicable fields and unrun checks.
18
+
15
19
  ## Mission vs Flow vs in-stack primitive
16
20
 
17
21
  - **Mission** (this skill) = *dynamic* orchestration. The shape emerges at run time from the goal. Cross-stack capable.
@@ -10,6 +10,10 @@ description: Manage architecture changes with impact analysis, ADR generation, m
10
10
 
11
11
  Manage architecture changes with impact analysis, ADR generation, and migration planning.
12
12
 
13
+ ## Output template
14
+
15
+ Use the decision record for accepted architecture decisions and the change card for change requests: @$AIWG_ROOT/agentic/code/frameworks/sdlc-complete/templates/governance/adr-template.md; @$AIWG_ROOT/agentic/code/frameworks/sdlc-complete/templates/configuration/change-request-card.md. Fill every required section; explain non-applicable fields and unrun checks.
16
+
13
17
  ## Triggers
14
18
 
15
19
 
@@ -9,6 +9,10 @@ description: Create, list, or recover workflow checkpoints and prepare a handoff
9
9
 
10
10
  You create, list, or recover lightweight mid-workflow checkpoints that allow a crashed or interrupted workflow to continue from a known-good position rather than restart from scratch.
11
11
 
12
+ ## Output template
13
+
14
+ For CLI checkpoint handoffs use the first template; for a free-standing agent handoff use the second: @$AIWG_ROOT/agentic/code/addons/aiwg-utils/templates/checkpoint-handoff.md; @$AIWG_ROOT/agentic/code/addons/aiwg-utils/templates/agent-handoff.md. Fill every required section; explain non-applicable fields and unrun checks.
15
+
12
16
  ## Triggers
13
17
 
14
18
  Alternate expressions and non-obvious activations (primary phrases are matched automatically from the skill description):
@@ -16,6 +16,10 @@ commandHint:
16
16
 
17
17
  You are a Git Version Control Specialist. Create clear, well-structured commits following project conventions.
18
18
 
19
+ ## Output template
20
+
21
+ Required for the commit message: @$AIWG_ROOT/agentic/code/addons/aiwg-utils/templates/commit-message.md. Fill every required section; explain non-applicable fields and unrun checks.
22
+
19
23
  ## Task
20
24
 
21
25
  When invoked with `/commit-and-push [commit-message-summary]`:
@@ -22,6 +22,10 @@ platforms: [flue]
22
22
 
23
23
  # Flaky Detect Skill
24
24
 
25
+ ## Output template
26
+
27
+ Required for the human-readable CI failure or flaky-test report: @$AIWG_ROOT/agentic/code/addons/testing-quality/templates/ci-failure-report.md. Fill every required section; explain non-applicable fields and unrun checks.
28
+
25
29
  ## Purpose
26
30
 
27
31
  Identify flaky tests (tests that pass and fail non-deterministically) by analyzing CI history, execution patterns, and test characteristics. Google research shows 4.56% of tests are flaky, costing millions in developer productivity.
@@ -9,6 +9,10 @@ platforms: [flue]
9
9
 
10
10
  # Flaky Fix Skill
11
11
 
12
+ ## Output template
13
+
14
+ Required for the human-readable failure, fix and regression verification report: @$AIWG_ROOT/agentic/code/addons/testing-quality/templates/ci-failure-report.md. Fill every required section; explain non-applicable fields and unrun checks.
15
+
12
16
  ## Purpose
13
17
 
14
18
  Analyze flaky test patterns and suggest or auto-apply fixes. Based on FlakyFix research showing LLMs can automatically repair flaky tests with targeted prompts.
@@ -40,6 +40,10 @@ commandHint:
40
40
 
41
41
  **You are the Core Orchestrator** for architecture evolution and refinement workflows.
42
42
 
43
+ ## Output template
44
+
45
+ Use the decision record for architecture decisions and the change card for change requests: @$AIWG_ROOT/agentic/code/frameworks/sdlc-complete/templates/governance/adr-template.md; @$AIWG_ROOT/agentic/code/frameworks/sdlc-complete/templates/configuration/change-request-card.md. Fill every required section; explain non-applicable fields and unrun checks.
46
+
43
47
  ## Your Role
44
48
 
45
49
  **You orchestrate multi-agent workflows. You do NOT execute bash scripts.**
@@ -22,6 +22,10 @@ commandHint:
22
22
 
23
23
  **You are the Change Control Orchestrator** for managing formal change requests through assessment, approval, and implementation.
24
24
 
25
+ ## Output template
26
+
27
+ Required for the change request card: @$AIWG_ROOT/agentic/code/frameworks/sdlc-complete/templates/configuration/change-request-card.md. Fill every required section; explain non-applicable fields and unrun checks.
28
+
25
29
  ## Your Role
26
30
 
27
31
  **You orchestrate multi-agent workflows. You do NOT execute bash scripts.**
@@ -22,6 +22,10 @@ commandHint:
22
22
 
23
23
  **You are the Core Orchestrator** for SDLC phase gate validation.
24
24
 
25
+ ## Output template
26
+
27
+ Required for the gate audit record; retain phase-specific criteria: @$AIWG_ROOT/agentic/code/addons/testing-quality/templates/gate-audit-record.md. Fill every required section; explain non-applicable fields and unrun checks.
28
+
25
29
  ## Your Role
26
30
 
27
31
  **You orchestrate multi-agent workflows. You do NOT execute bash scripts.**
@@ -22,6 +22,10 @@ commandHint:
22
22
 
23
23
  **You are the Core Orchestrator** for validating and executing handoffs between SDLC phases and tracks.
24
24
 
25
+ ## Output template
26
+
27
+ For the accompanying agent handoff note use this template; retain the transition checklist: @$AIWG_ROOT/agentic/code/addons/aiwg-utils/templates/agent-handoff.md. Fill every required section; explain non-applicable fields and unrun checks.
28
+
25
29
  ## Threat-assessment gate
26
30
 
27
31
  Before signoff or packaging, resolve the active workspace member's
@@ -23,6 +23,10 @@ commandHint:
23
23
 
24
24
  **You are the Core Orchestrator** for production incident management and resolution.
25
25
 
26
+ ## Output template
27
+
28
+ Use for the incident summary/postmortem; retain the specialized response artifacts: @$AIWG_ROOT/agentic/code/frameworks/ops-complete/templates/incident.md. Fill every required section; explain non-applicable fields and unrun checks.
29
+
26
30
  ## Your Role
27
31
 
28
32
  **You orchestrate multi-agent workflows. You do NOT execute bash scripts.**
@@ -36,6 +36,10 @@ commandHint:
36
36
 
37
37
  **You are the Core Orchestrator** for the project's release sequence.
38
38
 
39
+ ## Output template
40
+
41
+ Required for release notes: @$AIWG_ROOT/agentic/code/frameworks/sdlc-complete/templates/deployment/release-notes-template.md. Fill every required section; explain non-applicable fields and unrun checks.
42
+
39
43
  ## Artifact root resolution
40
44
 
41
45
  Treat every `.aiwg/...` path in this skill as a logical artifact path. Before
@@ -22,6 +22,10 @@ description: Validate phase gate criteria with multi-agent review and generate p
22
22
 
23
23
  Validate phase gate criteria with multi-agent review and generate pass/fail reports.
24
24
 
25
+ ## Output template
26
+
27
+ Required for the gate audit record; retain phase-specific criteria: @$AIWG_ROOT/agentic/code/addons/testing-quality/templates/gate-audit-record.md. Fill every required section; explain non-applicable fields and unrun checks.
28
+
25
29
  ## Triggers
26
30
 
27
31
 
@@ -67,6 +67,15 @@ When triggered:
67
67
 
68
68
  3. **Report the result** — name the installed marketplace wrapper and confirm which agents, skills, commands, and rules were deployed and where.
69
69
 
70
+ ## Finding third-party plugins
71
+
72
+ For a capability request without a selected plugin, use
73
+ [plugin-search](../plugin-search/SKILL.md):
74
+ `aiwg marketplace search "<capability>" --plugins` reads configured local
75
+ marketplaces and caches without installing anything. The four packages below
76
+ are AIWG's packages, not a complete directory of third-party plugins. Use the
77
+ provider's installer for third-party results; search does not extend this backend.
78
+
70
79
  ## Available Marketplace Packages
71
80
 
72
81
  | Package | Payload | Use Case |
@@ -14,6 +14,10 @@ commandHint:
14
14
 
15
15
  # Issue Close
16
16
 
17
+ ## Output template
18
+
19
+ Required for the task completion comment: @$AIWG_ROOT/agentic/code/frameworks/sdlc-complete/templates/issue-comments/task-completed.md. Fill every required section; explain non-applicable fields and unrun checks.
20
+
17
21
  ## Semantic Label Contract (#1789)
18
22
 
19
23
  Before closure, resolve lifecycle, blocked, review/approval, and
@@ -14,6 +14,10 @@ commandHint:
14
14
 
15
15
  # Issue Comment
16
16
 
17
+ ## Output template
18
+
19
+ Use the matching issue progress or blocker comment template: @$AIWG_ROOT/agentic/code/frameworks/sdlc-complete/templates/issue-comments/progress-update.md; @$AIWG_ROOT/agentic/code/frameworks/sdlc-complete/templates/issue-comments/blocker-found.md. Fill every required section; explain non-applicable fields and unrun checks.
20
+
17
21
  ## Semantic Label Contract (#1789)
18
22
 
19
23
  When a comment requests human action, resolve the configured
@@ -40,6 +40,33 @@ The default type is `extension`; the default starter is `skill`. The aliases
40
40
  `new-extension`, `new-addon`, `new-framework`, `new-plugin`, and `new-provider`
41
41
  select their corresponding type.
42
42
 
43
+ ## Addon flows
44
+
45
+ After `aiwg new-bundle ux-studio --type addon`, add a `flows/` directory
46
+ and set `addonConfig.entry.flows` to `"flows/"` in its manifest. Each
47
+ `flows/<name>.yaml` uses the existing `flow.aiwg.io/v1` metalanguage with
48
+ `kind: FlowCapability`, `metadata.name`, and a schema-valid `spec` including
49
+ `description`, `version`, `inputs`, and `outputs`. Custom relative entry
50
+ directories and `.yml` files are also supported.
51
+
52
+ Optionally declare a top-level `flows: ["<metadata.name>"]` inventory;
53
+ legacy `addonConfig.flows` is also accepted. A skill alone remains type `skill`.
54
+
55
+ Rebuild and inspect the authored flow from the project root:
56
+
57
+ ```bash
58
+ aiwg index build --graph project
59
+ aiwg discover "<metadata.name>" --type flow
60
+ aiwg show flow <metadata.name>
61
+ aiwg list --project-local
62
+ ```
63
+
64
+ The flow card shows `Owner: addon:ux-studio`; the project-local list reports
65
+ flow names and counts. Use `validate-addon` to check flow YAML, its existing
66
+ schema, inventory, and discovery before deploying or promoting the addon.
67
+ See `docs/customization/project-local-quickstart.md` (Addon flows)
68
+ for a complete manifest fragment and FlowCapability example.
69
+
43
70
  ## Safety
44
71
 
45
72
  - Use `--dry-run` before scaffolding when the target or layout is uncertain.
@@ -9,6 +9,10 @@ description: Launch multiple agents concurrently, collect their results, and han
9
9
 
10
10
  Generic parallel agent orchestration utility for launching multiple agents concurrently.
11
11
 
12
+ ## Output template
13
+
14
+ Required for each bounded worker brief: @$AIWG_ROOT/agentic/code/addons/aiwg-utils/templates/subagent-brief.md. Fill every required section; explain non-applicable fields and unrun checks.
15
+
12
16
  ## Triggers
13
17
 
14
18
 
@@ -0,0 +1,66 @@
1
+ ---
2
+ namespace: aiwg
3
+ name: plugin-search
4
+ platforms: [flue]
5
+ description: Search marketplaces for plugins using configured local manifests and directory caches; rank matching plugins by observed installs, review tier and cache dates without installing or fetching anything
6
+ ---
7
+
8
+ # Search Marketplace Plugins
9
+
10
+ Ask: "Search all marketplaces for UI/UX design and development plugins" or
11
+ "Find the most popular accessibility agent suite in my cached marketplaces."
12
+
13
+ ## Triggers
14
+
15
+ - "search marketplaces for plugins"
16
+ - "search all marketplaces"
17
+ - "find marketplace plugins"
18
+ - "highest rated UI/UX agent suite"
19
+ - "compare plugin install counts"
20
+
21
+ ## Behavior
22
+
23
+ 1. Extract capability terms from the request, such as `UI UX design development`.
24
+ 2. Run the existing marketplace command in its read-only provider plugin mode:
25
+
26
+ ```bash
27
+ aiwg marketplace search "UI UX design development" --plugins --json
28
+ ```
29
+
30
+ Default scope reads every configured Claude marketplace plus the local directory
31
+ cache. It explicitly reports Codex manifest search as deferred. Use `--provider
32
+ claude` to restrict the scope; other provider formats are not yet supported.
33
+ 3. Report the searched marketplaces, matching descriptions and keywords, and the
34
+ install count, review tier and as-of date for each signal. Preserve `null` as
35
+ unknown; an explicit review tier `none` differs from an absent tier.
36
+ 4. Explain ordering: number of matched query terms, review tier (`anthropic`, then
37
+ `partner`, then `none`/unknown), install count, then cache date, descending.
38
+ Popularity and review observations do not establish capability or a rating.
39
+ Compare the stated capabilities against the user's need; never invent stars,
40
+ ratings or claims that a suite is objectively the best.
41
+ 5. Surface warnings, including stale, malformed, missing or undated cache data.
42
+ Default maximum age is 30 days; `--max-age-days 7` changes it for this search.
43
+ 6. Give the selected `name@marketplace` and link to the
44
+ [install-plugin skill](../install-plugin/SKILL.md) with
45
+ `aiwg show skill install-plugin`. Third-party results require their provider's
46
+ installation workflow; this search does not extend the AIWG installer or
47
+ authorize installation. Never run an installer as part of search.
48
+
49
+ ## CLI reference
50
+
51
+ ```bash
52
+ aiwg marketplace search "accessibility design" --plugins
53
+ aiwg marketplace search "interface" --plugins --provider claude --max-age-days 7 --json
54
+ ```
55
+
56
+ The table and JSON include signal dates. JSON also lists configured marketplaces,
57
+ source files, matched terms and warnings. Warnings go to stderr as well.
58
+
59
+ Only these local Claude files are read below `${CLAUDE_CONFIG_DIR:-~/.claude}/plugins/`:
60
+ `known_marketplaces.json`, each configured checkout's
61
+ `.claude-plugin/marketplace.json`, `plugin-directory-cache-v2.json`, and
62
+ `install-counts-cache.json`. Missing cache dates stay unknown; filesystem modification
63
+ times are not substituted for observation dates. Nothing is downloaded or refreshed.
64
+
65
+ Without `--plugins`, the existing skill registry and signed catalog search behavior
66
+ is unchanged and may query remote registries. Always use `--plugins` for this skill.
@@ -0,0 +1,3 @@
1
+ import type { SkillReference } from '@flue/runtime';
2
+ declare const skill: SkillReference;
3
+ export default skill;
@@ -18,6 +18,10 @@ commandHint:
18
18
 
19
19
  ---
20
20
 
21
+ ## Output template
22
+
23
+ Required for the human-readable code-review findings report: @$AIWG_ROOT/agentic/code/addons/aiwg-utils/templates/code-review-findings.md. Fill every required section; explain non-applicable fields and unrun checks.
24
+
21
25
  ## Provider Resolution
22
26
 
23
27
  Don't assume GitHub. The PR API to use is determined by the project's `.aiwg/aiwg.config` `remotes.primary` (#994):
@@ -32,6 +32,10 @@ commandHint:
32
32
 
33
33
  # Project Status (Cross-Framework Aggregator)
34
34
 
35
+ ## Output template
36
+
37
+ When producing a stakeholder status report, use this template around the observed contributor blocks; preserve the established JSON response contract: @$AIWG_ROOT/agentic/code/addons/aiwg-utils/templates/stakeholder-status-report.md. Fill every required section; explain non-applicable fields and unrun checks.
38
+
35
39
  ## Task
36
40
 
37
41
  Produce a unified status report covering every installed framework, addon, or
@@ -15,6 +15,10 @@ triggers:
15
15
 
16
16
  Execute threat modeling, vulnerability scanning, and security control validation.
17
17
 
18
+ ## Output template
19
+
20
+ Required for each human-readable security finding: @$AIWG_ROOT/agentic/code/addons/aiwg-utils/templates/security-finding.md. Fill every required section; explain non-applicable fields and unrun checks.
21
+
18
22
  ## Triggers
19
23
 
20
24
 
@@ -11,6 +11,10 @@ commandHint:
11
11
 
12
12
  Perform comprehensive security assessment
13
13
 
14
+ ## Output template
15
+
16
+ Required for each human-readable security finding: @$AIWG_ROOT/agentic/code/addons/aiwg-utils/templates/security-finding.md. Fill every required section; explain non-applicable fields and unrun checks.
17
+
14
18
  ## Instructions
15
19
 
16
20
  Perform a systematic security audit following these steps:
@@ -34,3 +34,7 @@ evidence rule](../../rules/test-conformance-evidence.md) before making conforman
34
34
  Do not present inventory candidates as confirmed defects, passing cases as proof of oracle quality, or optional missing
35
35
  discovery as proven registration. Use `test-platform-research` for a platform adapter/template or additional tooling
36
36
  recommendation.
37
+
38
+ ## Output template
39
+
40
+ Use the conformance report for the assessment; when amending an experiment/protocol or recording its gate decision, use the amendment or gate audit template respectively: @$AIWG_ROOT/agentic/code/addons/testing-quality/templates/conformance-report.md; @$AIWG_ROOT/agentic/code/addons/testing-quality/templates/experiment-amendment.md; @$AIWG_ROOT/agentic/code/addons/testing-quality/templates/gate-audit-record.md. Fill every required section; explain non-applicable fields and unrun checks.
@@ -47,7 +47,7 @@ You check an entire AIWG addon directory for completeness and release readiness,
47
47
  - `autoInstall` field present (boolean; accept legacy `addonConfig.autoInstall` when absent at top level)
48
48
  - If `devOnly: true`: confirm this is intentional (it excludes from `aiwg use all`)
49
49
  - For project-local addons, also run `aiwg list --project-local` from the project root and check this manifest's diagnostics against the canonical bundle schema (`src/extensions/manifest.ts`). It requires `manifestVersion`, `platforms`, `keywords`, `deployment`, and `addonConfig` in addition to the common fields above. Preserve unknown-field and type errors; do not invent extra manifest fields to satisfy this skill.
50
- - Resolve artifact inventories from the top-level `skills`, `agents`, and `rules` arrays, falling back to the corresponding `addonConfig` arrays for legacy manifests. Resolve directories from `addonConfig.entry` (or legacy `entry`), defaulting to `skills/`, `agents/`, and `rules/`. Apply these inventories and paths in steps 4–6.
50
+ - Resolve artifact inventories from the top-level `skills`, `agents`, `rules`, and `flows` arrays, falling back to the corresponding `addonConfig` arrays for legacy manifests. Resolve directories from `addonConfig.entry` (or legacy `entry`), defaulting to `skills/`, `agents/`, `rules/`, and `flows/`. Apply these inventories and paths in steps 4–7.
51
51
 
52
52
  3. **Check `README.md`**:
53
53
  - File exists at addon root
@@ -74,16 +74,25 @@ You check an entire AIWG addon directory for completeness and release readiness,
74
74
  - `RULES-INDEX.md` exists in `rules/`
75
75
  - Rule name appears in `RULES-INDEX.md`
76
76
 
77
- 7. **Check for placement violations**:
77
+ 7. **Validate flows**:
78
+ - Resolve the flow directory from `addonConfig.entry.flows` (or legacy `entry.flows`), defaulting to `flows/`
79
+ - Read each `.yaml` or `.yml` flow document in that directory, including nested directories; do not follow symlinks
80
+ - Validate `FlowCapability` documents (`apiVersion: flow.aiwg.io/v1`) against the existing `$AIWG_ROOT/agentic/code/addons/aiwg-utils/workflow/schemas/workflow-capability.schema.json`; use the corresponding existing workflow schema for other Flow kinds and accepted legacy aliases
81
+ - Require `metadata.name` and the schema-required `spec` fields; report malformed YAML or schema failures as blocking issues
82
+ - If a `flows` inventory is declared (top-level first, then `addonConfig.flows`), match each name to `metadata.name`; collect missing declarations and orphaned documents. If no inventory is declared, enumerate the flow directory
83
+ - For project-local addons, from the project root run `aiwg index build --graph project`, then `aiwg discover "<metadata.name>" --type flow` and `aiwg show flow <metadata.name>`; verify the flow is found and its card shows `Owner: addon:<id>`
84
+ - Include a `Flows (<count>)` section with each flow name and PASS/FAIL status in the report
85
+
86
+ 8. **Check for placement violations**:
78
87
  - Search corresponding provider directories (`.claude/skills/`, `.github/agents/`, etc.) for any files whose names match this addon's artifacts
79
88
  - For each match: verify a source file exists under the located addon source root (project-local or `agentic/code/`)
80
89
  - Flag any deployed files with no source as violations
81
90
 
82
- 8. **Check for `.aiwg/` references in addon artifacts**:
91
+ 9. **Check for `.aiwg/` references in addon artifacts**:
83
92
  - Search all SKILL.md, agent `.md`, and command `.md` files under the addon for `@.aiwg/` path references
84
93
  - Flag any found: these only resolve inside the AIWG repository itself
85
94
 
86
- 9. **Compile report**:
95
+ 10. **Compile report**:
87
96
 
88
97
  ```
89
98
  Addon Validation: <addon-name> v<version>
@@ -112,6 +121,9 @@ You check an entire AIWG addon directory for completeness and release readiness,
112
121
  PASS component-completeness: rule file present, in RULES-INDEX.md
113
122
  FAIL addon-boundaries: not found in RULES-INDEX.md
114
123
 
124
+ Flows (1 found):
125
+ PASS screen-redesign: valid FlowCapability, discoverable as flow
126
+
115
127
  Placement violations:
116
128
  PASS no orphaned deployed files found
117
129
 
@@ -128,7 +140,7 @@ You check an entire AIWG addon directory for completeness and release readiness,
128
140
  none
129
141
  ```
130
142
 
131
- 10. **Report result**: Surface the structured report to the user. Highlight blocking issues in the summary line. For each failure, include the specific remediation step.
143
+ 11. **Report result**: Surface the structured report to the user. Highlight blocking issues in the summary line. For each failure, include the specific remediation step.
132
144
 
133
145
  ## Examples
134
146
 
@@ -146,6 +158,7 @@ README: PASS
146
158
  Skills (3): PASS (all present and complete)
147
159
  Agents (0): PASS
148
160
  Rules (4): PASS (all present and in RULES-INDEX.md)
161
+ Flows (0): PASS
149
162
  Placement: PASS (no violations)
150
163
  .aiwg/ refs: PASS
151
164