@1aboveio/risk-compliance-skills 0.1.34 → 0.1.36

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/README.md CHANGED
@@ -22,6 +22,7 @@ This package uses doc-to-md, editorial-review, house-style, plain-language, poli
22
22
  - `fraud-detection`
23
23
  - `payment-analysis`
24
24
  - `portfolio-payment-analysis`
25
+ - `rfi-writing`
25
26
  - `similar-domain`
26
27
  - `tld-detection`
27
28
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1aboveio/risk-compliance-skills",
3
- "version": "0.1.34",
3
+ "version": "0.1.36",
4
4
  "description": "Compliance audits, contract review, payment and fraud analysis.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -39,7 +39,7 @@
39
39
  "terminology",
40
40
  "write-report"
41
41
  ],
42
- "digest": "a042a1c564c9055a256a1186ac5798dfd5c8825936a7f208dc97dc656dffef1f"
42
+ "digest": "03a520d0bfd27c061eea079274a1e4678990934d5736ea6db9b36739868d5290"
43
43
  },
44
44
  "publishConfig": {
45
45
  "registry": "https://registry.npmjs.org/",
@@ -2,7 +2,7 @@
2
2
  name: compliance-audit
3
3
  version: 2.9.0
4
4
  description: "Audit operations against financial-compliance checklists (AML/KYC, VARS, PCI-DSS, TPA oversight, onboarding, transaction monitoring). Produces tracker.md (with a tracker.xlsx export) and phase-trail.md with layered validation; cites evidence by original filename. Input: reg-parser or the built-in VARS checklist"
5
- release-version: 0.50.14
5
+ release-version: 0.50.16
6
6
  ---
7
7
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
8
8
  # Compliance Audit
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: contract-compare
3
3
  description: "Compare two or more contracts side-by-side for structured diff, gap analysis, and benchmarking. Use when: comparing contracts or agreements, contract diff, compare terms, vendor-vs-vendor, compare our template vs theirs, compliance gap between contracts. NOT for single-contract risk review — use contract-review for that."
4
- release-version: 0.50.14
4
+ release-version: 0.50.16
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Contract Compare
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: contract-review
3
3
  description: "Review contracts for legal, commercial, and compliance risks via convert → chunk review → merge → validate (+ optional mandate preprocessing). Use for reviewing, auditing, or checking any contract, agreement, NDA, MSA, or SLA; input a file path (PDF/DOCX/TXT) or pasted text."
4
- release-version: 0.50.14
4
+ release-version: 0.50.16
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Contract Review
@@ -3,7 +3,7 @@ name: doc-authenticity
3
3
  version: 0.4.1
4
4
  description: "Screen PDF documents and raster images for fabrication, tampering, Photoshop or other image-editor use, and content validity. Detects file type, runs format-specific authenticity forensics, classifies bank statements, conversation logs, invoices, agreements, and other documents, then applies type-specific validity checks. Produces separate authenticity (NO_EVIDENCE_OF_MODIFICATION / SUSPICIOUS / LIKELY_MODIFIED / INCONCLUSIVE) and validity (VALID / INVALID / INCONCLUSIVE) verdicts. Use whenever a user asks whether a document, screenshot, scan, statement, invoice, contract, chat log, receipt, or payment evidence is genuine, original, edited, Photoshopped, manipulated, fake, or valid."
5
5
  disable-model-invocation: true
6
- release-version: 0.50.14
6
+ release-version: 0.50.16
7
7
  ---
8
8
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
9
9
  # Document and Image Authenticity
@@ -12,7 +12,7 @@ description: >
12
12
  impact, and a business report. Use for fraud, scam, mule, account-takeover,
13
13
  chargeback, dispute, transfer, collection, or payout risk analysis even when the
14
14
  user does not name this skill.
15
- release-version: 0.50.14
15
+ release-version: 0.50.16
16
16
  ---
17
17
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
18
18
  # Fraud Detection
@@ -14,7 +14,7 @@ description: >
14
14
  transactions" — even if they do not say payment-analysis. Do NOT use for
15
15
  fraud rule discovery (fraud-detection) or TLD / MCC-miscoding
16
16
  clusters (tld-detection).
17
- release-version: 0.50.14
17
+ release-version: 0.50.16
18
18
  ---
19
19
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
20
20
  # Payment Analysis
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: portfolio-payment-analysis
3
3
  description: Analyze Helipay/Worldpay submerchants from authorization, settlement, dispute and DART-340 exports; compare merchants and produce an offline interactive Chinese merchant report. Use for aggregator merchant comparisons, merchant authorization performance, issuer drilldown, merchant fraud/dispute histories and VAMP extract estimates. Portfolio-wide overviews belong to payment-analysis; fraud rule discovery belongs to fraud-detection.
4
- release-version: 0.50.14
4
+ release-version: 0.50.16
5
5
  ---
6
6
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
7
  # Portfolio payment analysis
@@ -0,0 +1,3 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 1AboveIO
@@ -0,0 +1,162 @@
1
+ ---
2
+ name: rfi-writing
3
+ description: Draft, shorten, or independently review a payment company's Request for Information (RFI) reply to a card scheme, acquirer, or regulator. Use for RFI responses, scheme case packs, short narratives supported by case files, Sumsub/KYC, Elliptic/KYT or correspondence, and requests to combine screenshots into a submission PDF.
4
+ release-version: 0.50.16
5
+ ---
6
+ **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
7
+ # RFI writing
8
+
9
+ Produce the letter a payment company sends back to whoever issued an RFI: a short positive narrative, then the evidence as PDFs in a fixed order.
10
+
11
+ You write as the company's compliance officer. Your reader issued the RFI, already holds the same evidence, and is deciding whether this customer and this programme are acceptable. They will notice both what you say and what you leave out.
12
+
13
+ The response argues the customer's case. It does not invent one.
14
+
15
+ ## The rule that outranks tone
16
+
17
+ House style here is positive: lead with helpful facts. Omit neutral or unhelpful details only when doing so leaves the answer accurate and responsive. Evidence discipline sits above tone: **narrow the claim, never broaden it.**
18
+
19
+ A positive sentence is allowed only if the material shows it. Write "the screen reported no incoming risk alerts" when the result applies to funding alone. An overall clearance claim would go beyond that finding.
20
+
21
+ Two failures are fatal to the letter:
22
+
23
+ - **Contradiction.** A claim that conflicts with the material. If two source figures disagree, both are unusable — drop the disputed one rather than pick the friendlier.
24
+ - **Inference.** A claim needing a step the material never takes. If proving it needs a hop you performed, it cannot go in.
25
+
26
+ When a fact is positive but rests on inference, either drop it or restate it at the level the material actually reaches. Never dress an inference as a fact.
27
+
28
+ Surface material omissions to the user and explain their consequences. If a required answer is missing or an omission would mislead, flag the draft as not ready to send and ask for the evidence or a scoped answer.
29
+
30
+ ## Step 1 — Inventory the material
31
+
32
+ Read every supplied document before drafting. Do not draft from one file and add the rest later; the narrative has to stay inside what the whole pack proves. For review-only requests, use Steps 1 and 2 to verify evidence, then use Steps 6 and 7 to review the supplied draft and pack. For PDF assembly alone, go to Step 4. For a narrative-only request, do not create a document or attachments unless asked.
33
+
34
+ Resolve bundled `scripts/` and `references/` from this skill's directory. The helpers use Python 3 for Word extraction and Bash with Chrome or Chromium for PDF assembly. Use `pdfinfo` to check page counts and `pdftotext` to read PDF text.
35
+
36
+ Material often arrives as links rather than paths. For Feishu links, use `lark-cli` when available. Otherwise ask for a local copy of the evidence. No Feishu tools are needed to draft from local files.
37
+
38
+ ```bash
39
+ lark-cli drive +inspect --url '<link>' # title and real resource type
40
+ lark-cli drive +download --file-token <token> --output ./x.pdf --overwrite
41
+ ```
42
+
43
+ `--output` wants a relative path inside the working directory, and it wants a file, not a folder. A `/file/<token>` link is a Drive file, not a doc.
44
+
45
+ - **Word case files**: `python3 "{baseDir}/scripts/docx-case-extract.py" case.docx` writes the paragraphs and tables in document order, with `[IMAGE word/media/imageN.png]` markers showing where each picture sits. Then open the images themselves — the order the author placed them in is the order of their argument. Check `word/embeddings/` too: an embedded OLE object is often the only copy of a report, and a case file that says "Not application" for KYC or AML traces is telling you the section is empty, not that the check passed.
46
+ - **PDFs**: `pdftotext -layout`, plus the pages as images when layout carries meaning. A passport image inside a KYC PDF is the ID document.
47
+ - **Screenshots**: read them as images. Vendor dashboards encode direction, hop counts and labels that a summary loses.
48
+ - **Correspondence**: note the sender, recipient, date, deadline and exactly what was requested. Note the subject line's own identifiers — they often disagree with the case file.
49
+
50
+ Record every figure as you go — value, unit, date, and where you saw it. The evidence table from Step 2 is what you will write from.
51
+
52
+ Completion: every document in scope read, and a figure for each claim you intend to make.
53
+
54
+ ## Step 2 — Sort the facts into an evidence table
55
+
56
+ Record each candidate fact with value, unit, date and source, then put it in one of three piles:
57
+
58
+ - **Positive** — verified, helps the customer, safe to state.
59
+ - **Neutral or negative** — omit unless needed to answer the request accurately.
60
+ - **Unusable** — contradicted by another source, or needing an inference. Omit, and tell the user why later.
61
+
62
+ Flag any pair of figures that disagree and any fact that feels convenient. These are where letters die. Read `references/narrative-rules.md` for the traps that recur in payment case files, particularly the direction of exposure in KYT reports.
63
+
64
+ Completion: every candidate fact carries a pile, a source, and — for the unusable ones — a one-line reason.
65
+
66
+ ## Step 3 — Write the narrative
67
+
68
+ Read `references/narrative-rules.md` first. It holds the area-by-area rules and the traps.
69
+
70
+ Draft each substantive answer in three moves:
71
+
72
+ 1. Draft the shortest answer the evidence supports. Add a name, figure or date when the requester asked for it, when it substantiates the answer, or when leaving it out would give the reader a different impression. Leave the rest in the attachment.
73
+ 2. Give each finding or action its own subject and verb: write what the provider reported, what we did, and what we decided and why, as applicable. Where only the report's contents are established, describe the report rather than attributing its findings to the customer.
74
+ 3. Put the decisive fact beside the conclusion. Give both dates when timing changes the meaning of a finding; give the relevant amount beside a decision based on that amount. Leave out details only when the answer remains true without them.
75
+
76
+ Write in the language of the request; English unless the RFI or the requester is in another language.
77
+
78
+ The narrative is a reply from us, not a report about the customer: speak as the company and keep the request neutral. `references/narrative-rules.md` opens with the voice rules and the self-test.
79
+
80
+ Use these five areas in order to select material, not as five required outputs. Write **3-5 sentences in natural paragraphs** — two or three paragraphs, never one dense block. Around 150-190 words is the house length: the attachment travels with the letter, so the narrative states the conclusion and the attachment carries the detail.
81
+
82
+ 1. Spending pattern — the account's activity in figures.
83
+ 2. KYC — vendor, date, document, checks, timing.
84
+ 3. Funding per KYT — state what the screening found on the funding side and any relevant confirmed action. Name the entity when its identity explains the finding.
85
+ 4. Nature of spending — merchant and transaction type, and only what the material proves.
86
+ 5. Source of wealth — only if evidence exists; otherwise omit and say so in your reply.
87
+
88
+ Once a point is answered, do not repeat it to cover another area. When the evidence cannot answer a question, identify the gap in the note to the user; do not substitute nearby facts in the letter (for example, merchant totals cannot establish purchase purpose).
89
+
90
+ Completion: 3-5 sentences; every number traceable to the evidence table; each sentence passing the narrow-don't-broaden test.
91
+
92
+ ## Step 4 — Assemble the attachments
93
+
94
+ Read `references/attachments.md`. Order is fixed: KYC/Sumsub, KYT, Contact email, Source of Fund, Source of Wealth. Skip what is unavailable, keeping the order of what remains.
95
+
96
+ One PDF per document type. Several screenshots of one report become a single PDF; a lone screenshot becomes a one-page PDF. Pass `--landscape` for wide images such as email threads, or they sit small in the middle of a portrait sheet.
97
+
98
+ ```bash
99
+ "{baseDir}/scripts/images-to-pdf.sh" -o kyt.pdf shot1.png shot2.png ... # portrait
100
+ "{baseDir}/scripts/images-to-pdf.sh" -o email.pdf --landscape mail.png # wide source
101
+ ```
102
+
103
+ Use the real report PDF when the vendor supplied one, rather than rebuilding it from pages.
104
+
105
+ No per-image captions. The section heading names the document; the file name carries the date.
106
+
107
+ Completion: one PDF per available type, in order, no loose images, no captions, and each file name asserting nothing the material does not establish.
108
+
109
+ ## Step 5 — Build the document
110
+
111
+ Draft XML, then create the doc with `lark-cli docs +create --doc-format xml` (see `lark-doc`), or produce a `.docx`. The skeleton:
112
+
113
+ ```xml
114
+ <title>RFI response - CASE LABEL</title>
115
+ <h1>Narrative</h1>
116
+ <p>…spending pattern…</p>
117
+ <p>…KYC… …funding…</p>
118
+ <p>…nature of spending…</p>
119
+ <h1>Attachments</h1>
120
+ <h2>KYC / Sumsub report</h2>
121
+ <figure view-type="Card"><source path="@./kyc.pdf" name="Identity screening - SUBJECT - DATE.pdf"/></figure>
122
+ <h2>KYT report — Elliptic wallet screening</h2>
123
+ <figure view-type="Card"><source path="@./kyt.pdf" name="Wallet screening - SUBJECT - DATE.pdf"/></figure>
124
+ <h2>Contact email</h2>
125
+ <figure view-type="Card"><source path="@./email.pdf" name="Customer information request - DATE.pdf"/></figure>
126
+ ```
127
+
128
+ For Feishu, run `lark-cli docs +script --command parse --content "@./draft.xml"` and require `assessment.status: passed` before creating. Create or update a remote document only when the user asks for that action.
129
+
130
+ `references/attachments.md` records the editing quirks — a file block cannot be swapped with a renamed one, which shapes how you rename an attachment later.
131
+
132
+ Completion: the doc renders with the right paragraphs, the right attachment order, and every attachment present.
133
+
134
+ ## Step 6 — Independent review
135
+
136
+ Read `references/review-brief.md` and dispatch it to a **model other than the one that drafted** using an approved reviewer and evidence access. The brief asks for factual mismatches, logic and unsupported inference, compliance behaviour, and tone. If no approved reviewer is available, report that independent review is pending.
137
+
138
+ Expect the reviewer to push back on the omissions the house style requires. That tension is the point of the review: it tells you which omissions a hostile reader will find. For each finding, either fix the sentence by narrowing it, or decline with a reason and tell the user.
139
+
140
+ Apply findings by narrowing claims, not by deleting the evidence that made the claim tempting.
141
+
142
+ Completion: every finding applied or explicitly declined with a reason.
143
+
144
+ ## Step 7 — Verify what you shipped
145
+
146
+ Fetch the built document and check, rather than trusting the write response:
147
+
148
+ - sentence count 3-5, paragraph count 2-3;
149
+ - attachment headings in the fixed order, skipped types absent;
150
+ - one PDF per type, zero loose images, zero captions;
151
+ - every number in the narrative present in the source, none invented.
152
+
153
+ Then report to the user: the local path or link, what changed, and material omissions together with what a reviewer holding the same evidence would conclude. If you cannot say of the finished narrative "we wrote this to them", the voice check is unfinished.
154
+
155
+ ## Files
156
+
157
+ - `references/narrative-rules.md` — per-area rules, tone, verification traps.
158
+ - `references/attachments.md` — order, PDF assembly, file naming, editing quirks.
159
+ - `references/review-brief.md` — reviewer brief for a different model.
160
+ - `references/worked-example.md` — a synthetic response and attachment manifest to consult when choosing what to include in a routine reply.
161
+ - `scripts/docx-case-extract.py` — Word text, tables, image markers, attachment inventory.
162
+ - `scripts/images-to-pdf.sh` — merge images into one PDF, portrait or landscape.
@@ -0,0 +1,76 @@
1
+ # Attachments
2
+
3
+ The pack proves what the narrative claims. A reviewer will open it before believing the letter.
4
+
5
+ ## Order
6
+
7
+ Fixed, and independent of what is available:
8
+
9
+ 1. KYC / Sumsub report
10
+ 2. KYT report
11
+ 3. Contact email
12
+ 4. Source of Fund
13
+ 5. Source of Wealth
14
+
15
+ Skip a type that is unavailable, keeping the order of what remains. Do not renumber, and do not fill a gap with an adjacent document — a KYC report is not source of wealth, and presenting it under that heading is the kind of substitution a reviewer treats as evasive.
16
+
17
+ ## One PDF per document type
18
+
19
+ A submission reads as one artefact per check, not a folder of screenshots. Combine therefore:
20
+
21
+ | Source material | Result |
22
+ |---|---|
23
+ | Several screenshots of one vendor report | one multi-page PDF, source order preserved |
24
+ | A single screenshot | one one-page PDF |
25
+ | A vendor-supplied PDF | that PDF, unchanged |
26
+
27
+ Use the vendor's original file when it exists. Rebuilding a report from pages loses metadata a reviewer may check, and the passport image inside a Sumsub PDF is the ID document.
28
+
29
+ ```bash
30
+ scripts/images-to-pdf.sh -o kyt.pdf shot1.png shot2.png shot3.png
31
+ scripts/images-to-pdf.sh -o email.pdf --landscape mail.png
32
+ ```
33
+
34
+ Pass `--landscape` for images wider than tall. An email thread or a wide dashboard on a portrait sheet renders small in the middle of the page, which reads as an afterthought. The script prints the page count: check it equals the number of images you passed, because a silently dropped page is invisible until the reviewer counts.
35
+
36
+ ## No captions
37
+
38
+ The section heading names the document and the file name carries the date. Per-image captions add nothing and date the pack to a day it may be sent later.
39
+
40
+ ## File names
41
+
42
+ A file name is a claim, and reviewers read it. Rules:
43
+
44
+ - Name the document type, subject and date when established: `Identity screening - SUBJECT - DATE.pdf`.
45
+ - Do not assert a link the material does not establish. If the email subject line carries a different customer ID from the case file, name it by type and date, for example `Customer information request - DATE.pdf`, without adding the case ID.
46
+ - Do not name a file after an unverified conclusion.
47
+
48
+ ## Building it in Feishu
49
+
50
+ Each attachment is a file block inside a card figure:
51
+
52
+ ```bash
53
+ lark-cli docs +update --doc <token> --command block_insert_after \
54
+ --block-id <heading-block-id> --content '<figure view-type="Card"><source path="@./kyt.pdf" name="Wallet screening - SUBJECT - DATE.pdf"/></figure>'
55
+ ```
56
+
57
+ Two quirks worth knowing before you start:
58
+
59
+ - **A file block cannot be replaced with a renamed one.** `block_replace` on an existing `<source>` fails schema validation, with or without the `<figure>` wrapper. To rename, delete the file block, then `block_insert_after` the section heading with the new figure. The deletion takes the figure wrapper with it, so the section ends up with a heading and one fresh card.
60
+ - **`--content` reads stdin, not absolute paths.** Use `--content -` with a heredoc, or a relative path. An absolute path such as `/tmp/x.xml` is rejected.
61
+
62
+ Deleting a whole section is one `block_delete` per block unless the blocks are contiguous siblings, in which case a single `block_replace` with `--start-block-id`/`--end-block-id` rewrites the range.
63
+
64
+ ## Verify
65
+
66
+ Fetch the built doc and count, rather than trusting the write responses:
67
+
68
+ ```bash
69
+ lark-cli docs +fetch --doc <token> --as user
70
+ ```
71
+
72
+ - `<img>` count is **0** — no loose images crept in;
73
+ - `<source>` count equals the number of available document types;
74
+ - `caption=` count is **0**;
75
+ - `<h2>` headings appear in the fixed order;
76
+ - each `name=` is the intended file name.
@@ -0,0 +1,97 @@
1
+ # Narrative rules
2
+
3
+ The narrative is 3-5 sentences in two or three paragraphs. Four sentences is common: one for the pattern, two for KYC and funding, one for the rest. Three works when an area has no evidence. Every sentence has to survive being checked against the attachment next to it.
4
+
5
+ There is a length budget, and it is a judgement rather than a rule. The response letter runs about 150-190 words: the attachments travel with it, so the narrative states conclusions and the evidence stays in the envelope. A case with several documents or a longer transaction list legitimately runs longer. Use the budget as a smell test — if the narrative is half again as long as the case needs, you are itemising detail that belongs in an attachment, which buries the sentence the reviewer actually has to act on.
6
+
7
+ ## Voice
8
+
9
+ It is a reply, not a report. We are writing to the body that asked us a question, about a customer of ours. Every sentence is spoken by the company; the request itself is referred to neutrally, because whoever picks the response up is the reader, not one named correspondent.
10
+
11
+ - Use "we" and "our". "Our records show…", "we verified…", "our KYC provider approved…". A narrative with no first person reads like an analyst's memo about the customer, which is not what the recipient asked for and not what they can rely on.
12
+ - First person for us, neutral for the request. "the transactions in the request", "the documents requested", "enclosed for review". Do not put the requester in second person: "your request" and "you requested" read as addressed to one reader, when the response is filed and read by whoever picks it up — the requester's analyst, a scheme reviewer, or an auditor. First person locates the author; second person guesses at the addressee.
13
+ - Attribute to our records, never to an internal document by name. "The case summary", "the internal file" and "the case conclusion" are artifacts the recipient cannot see. `our records` carries the same honesty about where a figure came from without pretending the reader has the file.
14
+ - Keep the requester's own labels out of the prose where they differ from ours. The response answers the request; it does not repeat their data back to them.
15
+ - Third-person description of the customer is correct — "the customer", "the account" — because the customer is the subject, not the author.
16
+
17
+ The self-test: is it clear that we are the author? A narrative with no first person reads as a memo about the customer, written by nobody in particular. That is what the voice check catches — not the absence of second person, which the house style keeps out.
18
+
19
+ ## Tone
20
+
21
+ - State, do not argue. "Our identity provider's report dated DATE records approval of the identity document" beats "KYC is robust and fully verified".
22
+ - Date and source every screening claim. A dated record is stronger than an adjective, and it cannot be read as a claim about today.
23
+ - Drop evaluative words the material does not earn. *Strong*, *robust*, *comprehensive*, *clean* describe the reviewer's conclusion, not yours to assert. Name the check and its result instead.
24
+ - Avoid hedges and defensive openers: *unfortunately*, *however*, *please note that*, *we would like to clarify*. They announce a weakness in the first three words of a sentence that could have led with a fact.
25
+ - Prefer concrete nouns and verbs over abstractions: "three at MERCHANT A and two at MERCHANT B" over "multiple transactions across the luxury segment".
26
+
27
+ ## The five areas
28
+
29
+ ### 1. Spending pattern
30
+
31
+ The account's activity as recorded: cumulative successful transactions, largest single transaction, daily maximum, highest single day, peak month. Quote the units the case uses; do not silently convert between USDT, USD, SGD and HKD.
32
+
33
+ Attribute as "our records show…" rather than asserting the figure bare, when it comes from a summary table you have not seen the ledger behind. The attribution keeps the sentence true regardless of what the underlying rows turn out to be, and unlike naming an internal document it keeps the letter's voice.
34
+
35
+ ### 2. KYC
36
+
37
+ Vendor, report date, document verified, the checks that came back clear, and how long before the activity the approval landed.
38
+
39
+ Name the checks the vendor actually ran and the document verified, with its expiry if the report gives one. Use the report's own groups; leave individual sub-checks (image quality, template, fonts, MRZ) in the attachment. Describe the approval the report records rather than claiming that the customer is fully verified.
40
+
41
+ When the record establishes timing, compare the approval date with the earliest transaction in the request. Read separate identity exhibits even if the intake summary has an empty KYC field. Attribute a check to the account only when the evidence links them. Do not present an unrelated profile as evidence for the account.
42
+
43
+ ### 3. Funding according to KYT
44
+
45
+ Describe the vendor's funding findings using the details that answer the request:
46
+
47
+ - which report, which date, which wallet;
48
+ - which screening produced "no rules triggered";
49
+ - which exposures are indirect rather than direct;
50
+ - the magnitude of each remaining tag, and what the vendor labels it.
51
+
52
+ Usually one sentence is enough for the screening result. When a separate action matters to the answer, use another sentence for our confirmed action or decision and its documented reason. Distinguish a provider's score, the score triggering manual review, and the reason for the resulting decision. Do not use our reason for clearing a deposit to explain the provider's score, or present a deposit decision as an account decision.
53
+
54
+ Cover the whole set of flagged categories without itemising it. When a report gives an aggregate, state it and name the largest or most relevant categories. A list of every percentage can bury the point the reviewer needs.
55
+
56
+ Itemise only where the figure is the sentence's argument: one large tag, or a sanctions reference the reviewer will look for. Everything else belongs in the attachment, which travels with the letter.
57
+
58
+ The words that decide honesty are small. "Above/below", "apart from", "led by" and "including" keep a summary honest. "Limited to", "only" and "just" claim the list is complete, so they are usable only when you have actually listed everything.
59
+
60
+ Usually omit the venue name. When the finding depends on which entity was involved, name it and explain the connection. For a pre-designation exposure, attribute the label to the provider and give the entity's name, the transaction date and the later listing date together. The label alone does not establish clearance.
61
+
62
+ ### 4. Nature of spending
63
+
64
+ Only what the material proves. Merchant names and the transaction format — card purchase, point of sale, in-store — come from the transaction list. What was bought, and why, needs an invoice or receipt. Without one, the sentence is about format and merchants, not goods and purpose.
65
+
66
+ The positive fact in most files is the format rather than the goods: these are card purchases at named retailers, which distinguishes them from transfers to unidentified counterparties. Say that in the same sentence as the merchant split, so the sentence carries a claim about what kind of activity it is, not just a list of names the requester already had.
67
+
68
+ If there is no proof of any kind, prefer no sentence. An empty area costs less than a sentence that restates the requester's own list back to them and invites "where are the invoices?" — the one question the pack cannot answer.
69
+
70
+ ### 5. Source of wealth
71
+
72
+ Include only with evidence. Otherwise omit, and say in your reply to the user that the area is unfilled. Do not substitute "the customer's source of wealth is consistent with the transaction profile" — that is an assessment the file does not contain.
73
+
74
+ ## Verification traps
75
+
76
+ Check these distinctions against the evidence before sending the draft for review.
77
+
78
+ **Direction of exposure.** KYT reports distinguish incoming funds from outgoing destinations. If the report gives no incoming alerts but flags indirect exposure on the outgoing side, name each side explicitly. Do not present destination percentages as funding exposure or claim the whole screen was clear.
79
+
80
+ **Check attribution.** Give each check to the report that records it. An identity-document approval alone does not establish that sanctions, politically exposed person (PEP), or adverse-media screening took place. Do not assign a KYC vendor's PEP result to the KYT report.
81
+
82
+ **Point in time versus ongoing.** A report marked "AML Ongoing monitoring: Not active" is a snapshot. Write "the report dated DATE records approval", not "the customer is screened". The second reads as an ongoing claim.
83
+
84
+ **Partial aggregates.** Where a merchant appears more than once, sum all of its transactions in scope or list them individually. Quoting one purchase as the merchant total understates the spend.
85
+
86
+ **Largest single versus highest day.** Summary tables often give both without saying they are the same transaction. State them as separate facts unless the source ties the date to the transaction.
87
+
88
+ **First transaction.** Case files give maxima, not first activity. Without a recorded first transaction, write "the earliest transaction in the request" — true on the face of the record, and it does not claim to know more.
89
+
90
+ **Self-contradicting figures.** If the peak-month total conflicts with the transaction list, neither figure can carry a sentence. Drop the disputed statement rather than pick the better-looking one; keeping it invites the reviewer to do arithmetic you already did.
91
+
92
+ **Identifier drift.** If the subject line and the tables disagree on a customer ID, do not silently reconcile them and do not build a claim on the match. Keep the ID out of the prose, and keep it out of the attachment's file name.
93
+ **Identity data.** Passport numbers, dates of birth and ID images belong in the attachment, not in prose.
94
+
95
+ ## A request is not a receipt
96
+
97
+ An RFI that asks for source-of-wealth documents proves only that the documents were asked for. Any sentence implying the customer supplied something needs the document itself. This is the distinction that separates an arguable response from a misleading one, and it is where a positive-tone brief will pressure you hardest.
@@ -0,0 +1,65 @@
1
+ # Review brief
2
+
3
+ Send this to a **different model from the one that drafted**. A model reviewing its own draft mostly re-agrees with it; the point of the pass is to find what the drafter could not see.
4
+
5
+ Use the host's reviewer tool with an explicit model from a **different provider family**, read-only access, and the working directory holding the draft and evidence. Use only a reviewer approved to handle the evidence. Read the result, then apply or decline each finding with a reason.
6
+
7
+ Fill the placeholders. Keep the reviewer blind to your own reasoning — hand it the draft and the evidence, not the argument you were trying to make.
8
+
9
+ ---
10
+
11
+ ## Template
12
+
13
+ ```
14
+ You are an independent reviewer. Work entirely in this directory: <WORKDIR>
15
+
16
+ CONTEXT
17
+ A payment company received a Request for Information (RFI) about a customer, UID <ID>, <NAME>, who made <WHAT>. Our compliance officer has drafted the RESPONSE to that RFI. You did not write it. Review it coldly and critically.
18
+
19
+ FILES
20
+ - <DRAFT.md> — the response under review. THIS IS THE THING YOU REVIEW.
21
+ - <CASE_TEXT.md> — verbatim text extraction of the original internal case file.
22
+ - <KYC.pdf> — the KYC/Sumsub report. Read with: pdftotext -layout <KYC.pdf> -
23
+ - <kyt_01.png ... kyt_NN.png> — the KYT report screenshots. Read them as images; they are the funding evidence.
24
+ - <EMAIL.png> — the correspondence with the customer.
25
+
26
+ THE DRAFTING RULES THE RESPONSE HAD TO FOLLOW
27
+ 1. Role: the payment company's compliance officer, writing a RESPONSE to the RFI.
28
+ 2. Lead with positive facts and omit other details only when the response remains accurate and responsive.
29
+ 3. HARD CONSTRAINT: no claim may contradict the material, and no claim may be an inference drawn beyond it. Anything in doubt, or logically contradictory, must not be used at all.
30
+ 3b. VOICE: the letter is written by the company in reply — first person ("our records", "we verified"), the request referred to neutrally ("the transaction in the request"), the customer in third person. No second person aimed at the reader. No internal document named as a source ("the case summary", "the internal file").
31
+ 4. Narrative: 3-5 sentences of prose in natural paragraphs, covering spending pattern; KYC; funding as reported by KYT and any relevant confirmed action; nature of spending (based on proof if available); source of wealth (if available).
32
+ 5. Attachments in order KYC/Sumsub, KYT, Contact email, Source of Fund, Source of Wealth — skipping unavailable ones, one PDF per type, no per-image captions.
33
+ 6. The response must itself be compliant: it must not misrepresent, omit in a way that creates a false impression about a regulatory request, or claim verification it cannot support.
34
+
35
+ WHAT TO DO
36
+ Read the draft, then read ALL the evidence yourself — tables, KYC text, and every KYT screenshot. Verify every number, date, percentage, name and characterisation against the evidence.
37
+
38
+ Review on four axes:
39
+ A. FACTUAL MISMATCH — numbers, dates, entities, percentages, names that differ from the material.
40
+ B. LOGIC / CONTRADICTION — claims contradicting each other or the source; also unsupported inference presented as fact. Be strict: if a claim needs a step the material does not show, flag it.
41
+ C. COMPLIANCE BEHAVIOUR — misleading omission; implying verification or screening that did not happen; presenting a point-in-time check as current; suggesting clean source of funds or wealth when the file holds none; tone that reads as evasive to a reviewer holding the same evidence.
42
+ D. TONE, WORDING AND VOICE — phrases that create a negative impression, sound defensive, hedge, or draw attention to a weakness; awkward phrasing; and voice. Flag any narrative that reads as a memo about the customer rather than a reply from the company: no first person anywhere, second person aimed at the reader, or an internal file named as the source of a figure. Propose a positive rewrite of the same fact in the right voice.
43
+
44
+ Be adversarial and specific. Do not pad the review with praise. Do not edit any file. Do not use network tools.
45
+
46
+ OUTPUT FORMAT
47
+ 1. VERDICT — one line: sound / fixable / unsound, and the single biggest risk.
48
+ 2. FINDINGS — numbered, each with: axis (A/B/C/D), the exact quoted text from the draft, what the evidence actually says (quote or cite the file), severity (blocker / should-fix / polish), and a concrete replacement sentence that satisfies the rules above.
49
+ 3. NUMBERS CHECKED — a table of each figure in the draft, its value, and where you verified it.
50
+ 4. TONE POLISH LIST — draft phrase -> suggested phrase.
51
+ ```
52
+
53
+ ---
54
+
55
+ ## Reading the result
56
+
57
+ Expect two kinds of finding, and treat them differently.
58
+
59
+ **Verification findings** — a wrong figure, a conflation of funding and destination exposure, a PEP claim the KYT report cannot support, a point-in-time check stated as current. Apply these. They are the reviewer doing arithmetic you should have done.
60
+
61
+ **Voice findings** — the reviewer says the letter sounds like an analysis of the customer rather than a reply from the company. Revise the voice even when the facts are right.
62
+
63
+ **Omission findings** — the reviewer identifies an unanswered request or a missing fact that changes the meaning of a claim. Explain the consequence to the user. If it would leave a required answer missing or make the response misleading, flag the draft as not ready to send.
64
+
65
+ The usual resolution is to **narrow** rather than delete: scope the claim to what the material shows ("no incoming risk alerts"). When narrowing cannot resolve the issue, tell the user what evidence or answer is still needed.
@@ -0,0 +1,24 @@
1
+ # Worked example: routine inquiry
2
+
3
+ This example uses invented evidence. The request asks about recorded card activity and whether its purpose is supported. The ledger lists four purchases at two demo merchants, but no invoices. A separate identity exhibit records document approval without a watchlist result. The wallet screen distinguishes incoming funds from outgoing exposure. The contact record shows a receipts request was sent, but does not record delivery or a reply.
4
+
5
+ ## Narrative
6
+
7
+ > Our records show four card purchases totalling USD 860 at Demo Merchant A and Demo Merchant B. We requested receipts, but the records available for this response do not establish what was bought.
8
+ >
9
+ > The wallet screen we reviewed reports no risk alerts on incoming funds and separately records 0.18% indirect token-blacklisting exposure on the outgoing side.
10
+
11
+ ## Attachment manifest
12
+
13
+ | Section | Exhibit |
14
+ |---|---|
15
+ | KYC | Separate identity exhibit: document approval recorded on 12 March 2031 for Demo Profile A |
16
+ | KYT report | Wallet screen, with incoming and outgoing findings kept separate |
17
+ | Contact email | Contact record showing that a receipts request was sent |
18
+
19
+ In a submission, provide one PDF per available type in this order. There is no separate Source of Fund or Source of Wealth exhibit in this example.
20
+
21
+ ## Notes to the user
22
+
23
+ - The intake summary leaves the identity field empty, but a separate identity exhibit was supplied. Keep its own label and do not claim that the approval verifies the account or that a watchlist check passed.
24
+ - The merchant names and amounts describe activity, not purchase purpose. The contact record shows a request for receipts, not delivery, a reply, or receipt of evidence.
@@ -0,0 +1,95 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from 'node:child_process';
3
+ import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';
4
+ import { homedir } from 'node:os';
5
+ import { dirname, join, resolve } from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+
8
+ const DAY_MS = 24 * 60 * 60 * 1000;
9
+ const WEEK_MS = 7 * DAY_MS;
10
+ const here = dirname(fileURLToPath(import.meta.url));
11
+
12
+ function readJson(path, fallback = {}) {
13
+ try { return JSON.parse(readFileSync(path, 'utf8')); } catch { return fallback; }
14
+ }
15
+
16
+ function frontmatterValue(text, key) {
17
+ const frontmatter = /^---\n([\s\S]*?)\n---/.exec(text)?.[1] ?? '';
18
+ const match = new RegExp('^' + key + ':\\s*([^\\n]+)$', 'm').exec(frontmatter);
19
+ return match?.[1].trim().replace(/^['"]|['"]$/g, '') ?? null;
20
+ }
21
+
22
+ function repositoryOf(source) {
23
+ const value = String(source ?? '').trim();
24
+ const match = /^(?:git@github\.com:|https:\/\/github\.com\/)?([A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+?)(?:\.git)?$/.exec(value);
25
+ return match?.[1] ?? null;
26
+ }
27
+
28
+ function stableVersion(value) {
29
+ const match = /^v?(\d+)\.(\d+)\.(\d+)$/.exec(String(value ?? '').trim());
30
+ return match ? match.slice(1).map(Number) : null;
31
+ }
32
+
33
+ function newer(left, right) {
34
+ for (let index = 0; index < 3; index += 1) {
35
+ if (left[index] !== right[index]) return left[index] > right[index];
36
+ }
37
+ return false;
38
+ }
39
+
40
+ function writeCache(path, value) {
41
+ try {
42
+ mkdirSync(dirname(path), { recursive: true });
43
+ writeFileSync(path, JSON.stringify(value));
44
+ } catch { /* A read-only cache must not block skill use. */ }
45
+ }
46
+
47
+ function main(now = Date.now()) {
48
+ if (process.env.ONEABOVEIO_NO_UPDATE_CHECK) return;
49
+ const bundle = readJson(join(resolve(here, '../../..'), 'package.json'));
50
+ if (bundle.name === '@1aboveio/skills' && bundle.nativeCodex?.schemaVersion === 1) return;
51
+ const skill = readFileSync(join(here, 'SKILL.md'), 'utf8');
52
+ const name = frontmatterValue(skill, 'name');
53
+ const localVersion = stableVersion(frontmatterValue(skill, 'release-version'));
54
+ if (!name || !localVersion) return;
55
+
56
+ const lock = readJson(join(process.env.HOME || homedir(), '.agents', '.skill-lock.json'));
57
+ const entry = lock.skills?.[name];
58
+ const repository = repositoryOf(entry?.sourceUrl || entry?.source);
59
+ if (!repository) return;
60
+
61
+ const cacheRoot = process.env.XDG_CACHE_HOME || join(process.env.HOME || homedir(), '.cache');
62
+ const cachePath = join(cacheRoot, '1aboveio-skills', 'release-check.json');
63
+ const all = readJson(cachePath);
64
+ const cache = all[repository] && typeof all[repository] === 'object' ? all[repository] : {};
65
+
66
+ if (!cache.lastCheck || now - cache.lastCheck >= DAY_MS) {
67
+ const result = spawnSync('gh', ['api', 'repos/' + repository + '/releases/latest', '--jq', '.tag_name'], {
68
+ encoding: 'utf8',
69
+ stdio: ['ignore', 'pipe', 'ignore'],
70
+ timeout: 1500,
71
+ });
72
+ cache.lastCheck = now;
73
+ if (result.status === 0 && stableVersion(result.stdout)) cache.latestTag = result.stdout.trim();
74
+ else delete cache.latestTag;
75
+ all[repository] = cache;
76
+ writeCache(cachePath, all);
77
+ }
78
+
79
+ const latestVersion = stableVersion(cache.latestTag);
80
+ if (!latestVersion || !newer(latestVersion, localVersion)) return;
81
+ if (cache.notifiedTag === cache.latestTag && cache.notifiedAt && now - cache.notifiedAt < WEEK_MS) return;
82
+
83
+ cache.notifiedTag = cache.latestTag;
84
+ cache.notifiedAt = now;
85
+ all[repository] = cache;
86
+ writeCache(cachePath, all);
87
+ const command = `npx skills@1.5.23 add '${repository}#${cache.latestTag}' --global --agent universal claude-code --skill ${name} --yes`;
88
+ process.stdout.write(
89
+ `UPDATE_AVAILABLE: A newer 1AboveIO skills release (${cache.latestTag}) is available; this skill is `
90
+ + `v${localVersion.join('.')}. Ask once whether to refresh ${name}. On approval run \`${command}\`. `
91
+ + 'The refreshed instructions apply next session. Either way, continue the current task and do not ask again this session.\n',
92
+ );
93
+ }
94
+
95
+ try { main(); } catch { /* Update checks are advisory and always fail silent. */ }
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/env python3
2
+ """Dump a Word case file as agent-readable text, and inventory its attachments.
3
+
4
+ python3 docx-case-extract.py case.docx [-o outdir]
5
+
6
+ Writes <stem>.md beside the document unless -o is given: paragraphs and tables
7
+ in document order, with [IMAGE word/media/imageN.png] markers where pictures sit,
8
+ so the narrative can be written against the sequence the author intended.
9
+
10
+ It also prints an inventory of word/media and word/embeddings. Read that section
11
+ before concluding a report is missing: a case file that says "Not application"
12
+ for KYC or AML traces may still carry the report as an embedded OLE object, and
13
+ an EMF/PDF icon in the page is usually a live PDF stream rather than a picture.
14
+
15
+ Why a script: every response run would otherwise rewrite this parser, and the
16
+ edge cases (tables, tabs, line breaks, pictures in runs) are where a hand-written
17
+ version silently drops content.
18
+ """
19
+ import argparse
20
+ import re
21
+ import sys
22
+ import zipfile
23
+ from xml.etree import ElementTree as ET
24
+
25
+ W = "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
26
+ R = "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
27
+ NS = {"w": W}
28
+
29
+
30
+ def rels(z):
31
+ try:
32
+ xml = z.read("word/_rels/document.xml.rels").decode("utf8")
33
+ except KeyError:
34
+ return {}
35
+ return dict(re.findall(r'Id="([^"]+)"[^>]*Target="([^"]+)"', xml))
36
+
37
+
38
+ def para_text(p, relmap):
39
+ out = []
40
+ for node in p.iter():
41
+ tag = node.tag.split("}")[1]
42
+ if tag == "t":
43
+ out.append(node.text or "")
44
+ elif tag == "tab":
45
+ out.append("\t")
46
+ elif tag == "br":
47
+ out.append("\n")
48
+ elif tag == "blip":
49
+ out.append("[[IMAGE %s]]" % relmap.get(node.get("{%s}embed" % R), "?"))
50
+ elif tag == "imagedata": # legacy VML picture
51
+ out.append("[[IMAGE %s]]" % relmap.get(node.get("{%s}id" % R), "?"))
52
+ return "".join(out)
53
+
54
+
55
+ def style(p):
56
+ pPr = p.find("w:pPr", NS)
57
+ if pPr is None:
58
+ return None
59
+ s = pPr.find("w:pStyle", NS)
60
+ return s.get("{%s}val" % W) if s is not None else None
61
+
62
+
63
+ def extract(path):
64
+ z = zipfile.ZipFile(path)
65
+ relmap = rels(z)
66
+ root = ET.fromstring(z.read("word/document.xml"))
67
+ body = root.find("w:body", NS)
68
+ lines = []
69
+ tables = 0
70
+ for child in body:
71
+ tag = child.tag.split("}")[1]
72
+ if tag == "p":
73
+ txt = para_text(child, relmap)
74
+ if txt.strip() or "[[IMAGE" in txt:
75
+ st = style(child)
76
+ lines.append("## %s" % txt if st and st.lower().startswith("heading") else txt)
77
+ elif tag == "tbl":
78
+ tables += 1
79
+ lines.append("[TABLE %d]" % tables)
80
+ for tr in child.findall("w:tr", NS):
81
+ cells = [para_text(tc, relmap).replace("\n", " ").strip()
82
+ for tc in tr.findall("w:tc", NS)]
83
+ lines.append(" | ".join(cells))
84
+ lines.append("[/TABLE]")
85
+ media = sorted(n for n in z.namelist() if n.startswith("word/media/"))
86
+ embeddings = sorted(n for n in z.namelist() if n.startswith("word/embeddings/"))
87
+ return "\n".join(lines), media, embeddings, tables
88
+
89
+
90
+ def main():
91
+ ap = argparse.ArgumentParser(description="Extract text, tables and an attachment inventory from a .docx")
92
+ ap.add_argument("docx")
93
+ ap.add_argument("-o", "--outdir", default=".")
94
+ args = ap.parse_args()
95
+
96
+ try:
97
+ text, media, embeddings, tables = extract(args.docx)
98
+ except (KeyError, zipfile.BadZipFile) as exc:
99
+ sys.exit("error: not a readable .docx (%s)" % exc)
100
+
101
+ import os
102
+ stem = os.path.splitext(os.path.basename(args.docx))[0]
103
+ out = os.path.join(args.outdir, stem + ".md")
104
+ header = "# %s — extracted\n\n" % stem
105
+ inv = ["", "## Attachment inventory", "",
106
+ "- pictures in word/media: %d" % len(media)]
107
+ inv += [" - %s" % m for m in media]
108
+ inv.append("- embedded objects in word/embeddings: %d" % len(embeddings))
109
+ inv += [" - %s" % e for e in embeddings]
110
+ if embeddings:
111
+ inv.append("")
112
+ inv.append("Embedded objects are usually live PDFs behind a page icon. Recover and read")
113
+ inv.append("them before reporting the underlying report missing.")
114
+ with open(out, "w") as fh:
115
+ fh.write(header + text + "\n" + "\n".join(inv) + "\n")
116
+
117
+ print(out)
118
+ print("tables: %d | media: %d | embeddings: %d" % (tables, len(media), len(embeddings)))
119
+
120
+
121
+ if __name__ == "__main__":
122
+ main()
@@ -0,0 +1,118 @@
1
+ #!/usr/bin/env bash
2
+ # Combine images into a single PDF, one image per page, fit-to-page.
3
+ #
4
+ # images-to-pdf.sh -o out.pdf shot1.png shot2.png ...
5
+ # images-to-pdf.sh -o email.pdf --landscape email_01.png
6
+ #
7
+ # Why headless Chrome: it is already present on most operator machines, needs no
8
+ # Python packages, and renders exactly what a browser shows. ImageMagick and
9
+ # img2pdf are often absent, and Ghostscript-based paths fail silently on ICC
10
+ # profiles embedded by macOS screenshots.
11
+ #
12
+ # Orientation matters. A wide screenshot on an A4 portrait page sits small in the
13
+ # middle; pass --landscape when the images are wider than tall (email threads,
14
+ # dashboards, wide tables).
15
+ set -euo pipefail
16
+
17
+ LANDSCAPE=0
18
+ OUT=""
19
+ IMAGES=()
20
+
21
+ while [[ $# -gt 0 ]]; do
22
+ case "$1" in
23
+ -o|--output) OUT="$2"; shift 2 ;;
24
+ -l|--landscape) LANDSCAPE=1; shift ;;
25
+ -h|--help) awk 'NR==1{next} /^set -e/{exit} {print}' "$0" | sed 's/^# \{0,1\}//'; exit 0 ;;
26
+ *) IMAGES+=("$1"); shift ;;
27
+ esac
28
+ done
29
+
30
+ [[ -n "$OUT" ]] || { echo "error: -o <out.pdf> is required" >&2; exit 1; }
31
+ [[ ${#IMAGES[@]} -gt 0 ]] || { echo "error: no input images" >&2; exit 1; }
32
+
33
+ for f in "${IMAGES[@]}"; do
34
+ [[ -f "$f" ]] || { echo "error: missing image: $f" >&2; exit 1; }
35
+ done
36
+
37
+ # --- locate a Chromium-family browser -------------------------------------------
38
+ BROWSER=""
39
+ for c in \
40
+ "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome" \
41
+ "/Applications/Chromium.app/Contents/MacOS/Chromium" \
42
+ "/Applications/Microsoft Edge.app/Contents/MacOS/Microsoft Edge" \
43
+ "$(command -v google-chrome || true)" \
44
+ "$(command -v chromium || true)" \
45
+ "$(command -v chromium-browser || true)"
46
+ do
47
+ [[ -n "$c" && -x "$c" ]] && { BROWSER="$c"; break; }
48
+ done
49
+ [[ -n "$BROWSER" ]] || { echo "error: no Chrome/Chromium found" >&2; exit 1; }
50
+
51
+ # --- page geometry --------------------------------------------------------------
52
+ # A4 at 96dpi. Chrome honours these as CSS pixels for @page sizing. The page box
53
+ # is one pixel short of the sheet: a box that exactly matches the printable area
54
+ # can tip Chrome into shrink-to-fit, which silently rescales every page.
55
+ if [[ $LANDSCAPE -eq 1 ]]; then
56
+ PAGE_W=1122; PAGE_H=793; CSS_SIZE="A4 landscape"
57
+ else
58
+ PAGE_W=793; PAGE_H=1122; CSS_SIZE="A4 portrait"
59
+ fi
60
+
61
+ WORKDIR="$(mktemp -d)"
62
+ trap 'rm -rf "$WORKDIR"' EXIT
63
+
64
+ # Images are referenced by absolute file:// URL so the HTML can live in the temp dir.
65
+ PAGES=""
66
+ for f in "${IMAGES[@]}"; do
67
+ abs="$(cd "$(dirname "$f")" && pwd)/$(basename "$f")"
68
+ PAGES+="<div class=\"page\"><img src=\"file://${abs}\"></div>"
69
+ done
70
+
71
+ cat > "$WORKDIR/pack.html" <<HTML
72
+ <!doctype html><html><head><meta charset="utf-8"><style>
73
+ @page { size: ${CSS_SIZE}; margin: 0; }
74
+ html, body { margin: 0; padding: 0; background: #fff; }
75
+ .page {
76
+ width: ${PAGE_W}px; height: ${PAGE_H}px;
77
+ display: flex; align-items: center; justify-content: center;
78
+ overflow: hidden; page-break-after: always; break-after: page;
79
+ }
80
+ .page:last-child { page-break-after: auto; break-after: auto; }
81
+ img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
82
+ </style></head><body>${PAGES}</body></html>
83
+ HTML
84
+
85
+ # Rendering is attempted twice. Chrome has shipped several headless modes, and
86
+ # plain `--headless` is deprecated in newer builds; a locked default profile (a
87
+ # browser already open on the operator's desktop) or a container without a
88
+ # user namespace then kills the run with an error that a silent redirect hides.
89
+ # Each attempt gets its own throwaway profile and its stderr kept, so a failure
90
+ # reports why instead of just "not produced".
91
+ rendered=0
92
+ for attempt in 1 2; do
93
+ flags=(--disable-gpu --disable-dev-shm-usage --user-data-dir="$WORKDIR/chrome$attempt" --no-pdf-header-footer)
94
+ if [[ $attempt -eq 1 ]]; then
95
+ flags+=(--headless=new)
96
+ else
97
+ # Last resort for containers and heavily restricted shells.
98
+ flags+=(--headless --no-sandbox)
99
+ fi
100
+ if "$BROWSER" "${flags[@]}" --print-to-pdf="$OUT" "file://$WORKDIR/pack.html" 2>"$WORKDIR/err$attempt"; then
101
+ [[ -s "$OUT" ]] && { rendered=1; break; }
102
+ fi
103
+ rm -f "$OUT"
104
+ done
105
+
106
+ if [[ $rendered -ne 1 ]]; then
107
+ echo "error: PDF rendering failed on attempt 1 and 2" >&2
108
+ tail -5 "$WORKDIR/err1" >&2 2>/dev/null || true
109
+ tail -5 "$WORKDIR/err2" >&2 2>/dev/null || true
110
+ exit 1
111
+ fi
112
+
113
+ # Report the page count so the caller can verify nothing was dropped.
114
+ if command -v pdfinfo >/dev/null 2>&1; then
115
+ echo "$OUT: $(pdfinfo "$OUT" | awk '/^Pages:/{print $2}') pages, ${CSS_SIZE}"
116
+ else
117
+ echo "$OUT: written (${CSS_SIZE})"
118
+ fi
@@ -8,7 +8,7 @@ description: >
8
8
  links, an entity chain, and a watchlist for the operator's next domains.
9
9
  Not transaction data (tld-detection) or fraud rules (fraud-detection).
10
10
  disable-model-invocation: true
11
- release-version: 0.50.14
11
+ release-version: 0.50.16
12
12
  ---
13
13
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
14
14
  # Similar Domain
@@ -6,7 +6,7 @@ description: >
6
6
  patterns, with USD and BIN-country currency views, group profiles and priorities.
7
7
  Not payment-analysis, fraud-detection, or website research.
8
8
  disable-model-invocation: true
9
- release-version: 0.50.14
9
+ release-version: 0.50.16
10
10
  ---
11
11
  **Updates:** Once/session run `node <skill-base-dir>/release-check.mjs`.
12
12
  # TLD detection