fairpolicy-certificate-limits 0.0.0-stage → 0.1.0

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/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (unreleased)
4
+
5
+ - First version (Fairpolicy ver 1, built on fairpolicy-core).
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kurt Francisco
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,161 @@
1
- # Temporary Holding Version
1
+ # Fairpolicy Certificate Limits (`fairpolicy-certificate-limits`)
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Checks every certificate of insurance you issued against the policy behind it: issued on a policy not in force, limits higher than the policy, additional insured or waiver of subrogation shown without the endorsement, wrong policy dates, or an unknown policy number. Never issues, changes or sends a certificate.
4
+
5
+ **It never issues or reissues a certificate. It never sends a certificate to a holder.**
6
+
7
+ MIT · Node 20 or newer · local files only · client identifiers masked before results reach the model · built on [`fairpolicy-core`](../fairpolicy-core)
8
+
9
+ ```bash
10
+ npx -y fairpolicy-certificate-limits demo
11
+ npx -y fairpolicy-certificate-limits mcp --root ./agency-exports
12
+ ```
13
+
14
+ <!-- generated:start -->
15
+
16
+ ## A demo run
17
+
18
+ `npx -y fairpolicy-certificate-limits demo` runs the agent on the fictional files in [`fixtures/`](fixtures) in a temporary folder. Captured output:
19
+
20
+ ```text
21
+ Fairpolicy Certificate Limits demo (fictional agency, carriers and clients)
22
+
23
+ ▶ Check every certificate against its policy
24
+ status: executed decision: allow
25
+ 6 certificate(s), 7 policy line(s) checked: 6 certificate(s) with something the policy does not support (1 not in force, 1 limits overstated, 1 additional insured not on the policy, 1 waiver not on the policy, 1 wrong dates, 1 unknown policy).
26
+ C-9004/CGL-1804 2026-10-15 policy_not_in_force policy_not_in_force
27
+ C-9002/CGL-1801 2026-10-20 limit_overstated limit_overstated
28
+ C-9003/CA-1803 2026-11-03 ai_not_on_policy ai_not_on_policy
29
+ C-9001/WC-1802 2026-10-02 waiver_not_on_policy waiver_not_on_policy
30
+ C-9005/XS-1805 2026-11-10 dates_wrong dates_wrong
31
+ C-9006/BOP-1899 2026-11-12 policy_unknown policy_unknown
32
+ C-9001/CGL-1801 2026-10-02 ok
33
+
34
+ ▶ Explain the certificate issued after cancellation
35
+ status: executed decision: allow
36
+ C-9004/CGL-1804: policy_not_in_force. Issued 2026-10-15; the policy was cancelled 2026-09-30. Next: The certificate was issued on a policy that was not in force that day: the account manager reviews it with the agency principal today.
37
+
38
+ ▶ Write the worklist (CSV and HTML, real names stay on this computer)
39
+ status: executed decision: allow
40
+ Certificates checked against policies written: 6 certificate(s), 7 policy line(s) checked: 6 certificate(s) with something the policy does not support (1 not in force, 1 limits overstated, 1 additional insured not on the policy, 1 waiver not on the policy, 1 wrong dates, 1 unknown policy). Files: fairpolicy-out/certificates/certificate-limits.csv, fairpolicy-out/certificates/certificate-limits.html.
41
+
42
+ ▶ The agent tries certificate_issue itself
43
+ status: blocked decision: block
44
+ reason: It never issues or reissues a certificate.
45
+ ```
46
+
47
+ ## Tools
48
+
49
+ | Tool | What it does | Policy |
50
+ |---|---|---|
51
+ | `certificates_check` | Each certificate and policy line: every issue found and a status (policy_not_in_force, limit_overstated, ai_not_on_policy, waiver_not_on_policy, dates_wrong, policy_unknown, ok). | runs |
52
+ | `certificates_explain` | One certificate line (certificate/policy) with each issue and the policy figures behind it. | runs |
53
+ | `certificates_write_report` | Write certificate-limits.csv (every line with its status and the figures behind it, plus blank owner and notes columns) and certificate-limits.html into out_dir (default fairpolicy-out/certificates). | runs |
54
+ | `certificate_issue` | It never issues or reissues a certificate. | refused |
55
+ | `certificate_send` | It never sends a certificate to a holder. | refused |
56
+
57
+ Any tool name not in this table is blocked, including names a model invents. `refused` tools are listed so a model can see they exist and are refused.
58
+
59
+ ## Columns it reads
60
+
61
+ Table inputs can be CSV, TSV, semicolon- or pipe-separated text, Excel `.xlsx`, JSON or JSONL. Columns are matched by the agent's own name, then by the English names below, then by their names in German, French, Spanish, Portuguese, Italian, Japanese, Chinese and Korean. Dates become `YYYY-MM-DD`; amounts are read with either decimal mark. Every result lists under `sources` how each file was read. Columns marked *masked* hold patient identifiers: the model sees a pseudonym, a birth year or nothing (see Patient data).
62
+
63
+ ### Certificate log (`certificates`)
64
+
65
+ | Column | Type | Also read as | For example, in other languages |
66
+ |---|---|---|---|
67
+ | `certificate` (required) | text | Certificate, Certificate #, Certificate Number, Certificate ID, COI Number | - |
68
+ | `holder` | text | Holder, Certificate Holder, Holder Name | - |
69
+ | `client` | text (masked) | Insured, Named Insured, Client Name, Account Name | Versicherungsnehmer, Assuré, 契約者, 投保人 |
70
+ | `policy_number` (required) | text | Policy Number, Policy #, Policy | Vertragsnummer, N° de police, 証券番号, 保单号 |
71
+ | `issued_date` | date | Issued Date, Issue Date, Date Issued, Created | - |
72
+ | `each_occurrence` | amount | Each Occurrence, Occurrence Limit, Each Occurrence Limit, Limit, Each Accident, CSL | - |
73
+ | `aggregate` | amount | Aggregate, General Aggregate, Aggregate Limit | - |
74
+ | `effective_date` | date | Policy Effective, Effective Date, Policy Eff | Beginn, Date d'effet, 始期, 生效日期 |
75
+ | `expiration_date` | date | Policy Expiration, Expiration Date, Policy Exp | Ablauf, Date d'échéance, 満期, 到期日期 |
76
+ | `additional_insured` | yes/no | Additional Insured, AI, Addl Insd, Additional Insured Shown | - |
77
+ | `waiver` | yes/no | Waiver of Subrogation, Waiver, WOS, Subr Wvd | - |
78
+ | `issued_by` | text | Issued By, User, Created By | - |
79
+
80
+ ### Coverage schedule (`coverage`)
81
+
82
+ | Column | Type | Also read as | For example, in other languages |
83
+ |---|---|---|---|
84
+ | `policy_number` (required) | text | Policy Number, Policy #, Policy | Vertragsnummer, N° de police, 証券番号, 保单号 |
85
+ | `client` | text (masked) | Insured, Named Insured, Client Name, Account Name | Versicherungsnehmer, Assuré, 契約者, 投保人 |
86
+ | `line` | text | Line of Business, Line, Coverage, Policy Type | Sparte, Branche, 保険種目, 险种 |
87
+ | `each_occurrence` | amount | Each Occurrence, Occurrence Limit, Each Occurrence Limit, Limit, Each Accident, CSL | - |
88
+ | `aggregate` | amount | Aggregate, General Aggregate, Aggregate Limit | - |
89
+ | `effective_date` | date | Effective Date, Eff Date | Beginn, Date d'effet, 始期, 生效日期 |
90
+ | `expiration_date` | date | Expiration Date, Exp Date | Ablauf, Date d'échéance, 満期, 到期日期 |
91
+ | `status` | text | Status, Policy Status | Status, Statut, ステータス, 状态 |
92
+ | `cancel_date` | date | Cancel Date, Cancellation Date | Stornodatum, Date de résiliation, 解約日, 退保日期 |
93
+ | `ai_endorsement` | text | AI Endorsement, Additional Insured Endorsement, Blanket AI, Additional Insured | - |
94
+ | `waiver_endorsement` | text | Waiver Endorsement, Waiver of Subrogation, Blanket Waiver, Waiver | - |
95
+
96
+ ### Files from other countries
97
+
98
+ A German export in Windows-1252 with semicolons, `1.234,56` and `03.11.2026`, or a Japanese one in Shift_JIS with `2026/11/03`, is read the same way as the English file: `npm run intl` in the repository rewrites every eval fixture the way a German, French, Spanish, Brazilian, Italian, Japanese, Chinese and Korean export would write it and requires the same results. Columns named differently? Run `npx fairpolicy-certificate-limits inspect <file>` (names and shapes only, never values) and name them in `fairpolicy-sources.json`:
99
+
100
+ ```json
101
+ { "files": { "exports/claims.csv": { "columns": { "claim_id": "Fallnummer" }, "date_order": "dmy" } } }
102
+ ```
103
+
104
+ ## Install
105
+
106
+ Node 20 or newer. No other dependencies.
107
+
108
+ ```bash
109
+ npx -y fairpolicy-certificate-limits demo
110
+ npx -y fairpolicy-certificate-limits mcp --root /path/to/your/files
111
+ ```
112
+
113
+ Claude Desktop, Cursor and other MCP hosts:
114
+
115
+ ```json
116
+ {
117
+ "mcpServers": {
118
+ "fairpolicy-certificate-limits": {
119
+ "command": "npx",
120
+ "args": [
121
+ "-y",
122
+ "fairpolicy-certificate-limits",
123
+ "mcp",
124
+ "--root",
125
+ "/path/to/your/files"
126
+ ]
127
+ }
128
+ }
129
+ }
130
+ ```
131
+
132
+ Claude Code: `claude mcp add fairpolicy-certificate-limits -- npx -y fairpolicy-certificate-limits mcp --root .`, or install the `fairpolicy-certificate-limits` plugin from this repository's marketplace (`fairpolicy-medical-billing`).
133
+
134
+ ## Modes and approvals
135
+
136
+ - **Review** (`--mode review`): reads and reports only.
137
+ - **Assist** (default): the policy above. A tool that asks returns an `approval_id`; a person approves it once with `fairpolicy-certificate-limits approve <id> --as "Your Name"` (or on the local approvals page, `fairpolicy-certificate-limits approvals`), and the same call is repeated.
138
+ - **Auto** (`--mode auto --auto <tool,...>`): opt-in per tool, with step caps and a kill switch (`fairpolicy-certificate-limits kill`). Sending, moving money, going live and accepting a learned fact stay **one named click even in Auto**; an approval is tied to the sha256 of the reviewed draft, so a changed draft needs a new click.
139
+
140
+ ## CLI
141
+
142
+ ```bash
143
+ fairpolicy-certificate-limits tools # every tool, its policy and arguments
144
+ fairpolicy-certificate-limits sources # the columns each input is read from
145
+ fairpolicy-certificate-limits inspect <file> # how a file would be read (names and shapes, never values)
146
+ fairpolicy-certificate-limits call certificates_check '{"certificates":"<certificates>","coverage":"<coverage>"}'
147
+ fairpolicy-certificate-limits eval # the private eval cases on the fictional fixtures
148
+ fairpolicy-certificate-limits demo
149
+ ```
150
+
151
+ ## Client data
152
+
153
+ Results go to an AI model, so client identifiers are masked before they leave the agent (`--phi mask`, the default; the flag name comes from the shared core): client and insured names and client codes become stable pseudonyms such as `CL-3f9a1c2e`; birth dates become the birth year; driver licence numbers, addresses, phones, e-mails and SSNs are removed, also inside free text. `--phi strict` also hides policy numbers, claim numbers and VINs and cuts ZIP codes to three digits. Producers, account managers and carriers are not masked. The files the agent writes on your computer keep the real values, because your staff need them: keep them in a secure folder. Masking is not anonymisation, and it does not replace your agency's information-security program.
154
+
155
+
156
+ ## Limits
157
+
158
+ - It checks only what is in the files and settings you load. Commission schedules, state rules, deadlines and carrier requirements are as current as what you give it; the example settings are starting points, not any carrier's or state's rule.
159
+ - It is not legal, tax, accounting or coverage advice. It never binds, cancels, endorses or places coverage, and it never tells a client what to buy. A person reviews every result before anything goes to a client, carrier or producer; the agent sends nothing.
160
+ - Export layouts named in "Columns it reads" were written from knowledge of each system and not tested against a live account; `inspect` shows how a file was read.
161
+ - Client-data masking keeps identifiers away from the model; it does not replace your agency's privacy and information-security program (state insurance data security rules, access control, retention).
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { fileURLToPath } from 'node:url';
3
+ import { main } from 'fairpolicy-core';
4
+ import { manifest } from '../src/manifest.js';
5
+ import { demo } from '../src/demo.js';
6
+
7
+ main(manifest, { bin: 'fairpolicy-certificate-limits', demo, evalFile: fileURLToPath(new URL('../evals/cases.json', import.meta.url)) });
@@ -0,0 +1,247 @@
1
+ {
2
+ "suite": "fairpolicy-certificate-limits",
3
+ "root": "..",
4
+ "data_note": "Fictional certificate log and coverage schedule in ../fixtures. No model is called.",
5
+ "cases": [
6
+ {
7
+ "id": "check-totals",
8
+ "tool": "certificates_check",
9
+ "args": {
10
+ "certificates": "fixtures/certificates.csv",
11
+ "coverage": "fixtures/coverage.csv"
12
+ },
13
+ "expect": {
14
+ "status": "executed",
15
+ "equals": {
16
+ "result.certificates": 6,
17
+ "result.lines_checked": 7,
18
+ "result.with_issues": 6
19
+ }
20
+ }
21
+ },
22
+ {
23
+ "id": "every-status",
24
+ "tool": "certificates_check",
25
+ "args": {
26
+ "certificates": "fixtures/certificates.csv",
27
+ "coverage": "fixtures/coverage.csv"
28
+ },
29
+ "expect": {
30
+ "equals": {
31
+ "result.by_status.policy_not_in_force": 1,
32
+ "result.by_status.limit_overstated": 1,
33
+ "result.by_status.ai_not_on_policy": 1,
34
+ "result.by_status.waiver_not_on_policy": 1,
35
+ "result.by_status.dates_wrong": 1,
36
+ "result.by_status.policy_unknown": 1,
37
+ "result.by_status.ok": 1
38
+ }
39
+ }
40
+ },
41
+ {
42
+ "id": "not-in-force-first",
43
+ "tool": "certificates_check",
44
+ "args": {
45
+ "certificates": "fixtures/certificates.csv",
46
+ "coverage": "fixtures/coverage.csv"
47
+ },
48
+ "expect": {
49
+ "equals": {
50
+ "result.items.0.ref": "C-9004/CGL-1804",
51
+ "result.items.0.status": "policy_not_in_force"
52
+ }
53
+ }
54
+ },
55
+ {
56
+ "id": "limit-overstated",
57
+ "tool": "certificates_explain",
58
+ "args": {
59
+ "certificates": "fixtures/certificates.csv",
60
+ "coverage": "fixtures/coverage.csv",
61
+ "ref": "C-9002/CGL-1801"
62
+ },
63
+ "expect": {
64
+ "equals": {
65
+ "result.line.status": "limit_overstated"
66
+ },
67
+ "contains": [
68
+ "shows 2000000"
69
+ ]
70
+ }
71
+ },
72
+ {
73
+ "id": "waiver-on-one-line-of-a-certificate",
74
+ "tool": "certificates_check",
75
+ "args": {
76
+ "certificates": "fixtures/certificates.csv",
77
+ "coverage": "fixtures/coverage.csv",
78
+ "status": "waiver_not_on_policy"
79
+ },
80
+ "expect": {
81
+ "equals": {
82
+ "result.items.0.ref": "C-9001/WC-1802"
83
+ }
84
+ }
85
+ },
86
+ {
87
+ "id": "blanket-ai-counts",
88
+ "tool": "certificates_explain",
89
+ "args": {
90
+ "certificates": "fixtures/certificates.csv",
91
+ "coverage": "fixtures/coverage.csv",
92
+ "ref": "C-9001/CGL-1801"
93
+ },
94
+ "expect": {
95
+ "equals": {
96
+ "result.line.status": "ok",
97
+ "result.line.issues": ""
98
+ }
99
+ }
100
+ },
101
+ {
102
+ "id": "wrong-dates",
103
+ "tool": "certificates_check",
104
+ "args": {
105
+ "certificates": "fixtures/certificates.csv",
106
+ "coverage": "fixtures/coverage.csv",
107
+ "status": "dates_wrong"
108
+ },
109
+ "expect": {
110
+ "equals": {
111
+ "result.items.0.policy_number": "XS-1805"
112
+ }
113
+ }
114
+ },
115
+ {
116
+ "id": "unknown-ref",
117
+ "tool": "certificates_explain",
118
+ "args": {
119
+ "certificates": "fixtures/certificates.csv",
120
+ "coverage": "fixtures/coverage.csv",
121
+ "ref": "C-1/NONE"
122
+ },
123
+ "expect": {
124
+ "status": "error",
125
+ "contains": [
126
+ "not found"
127
+ ]
128
+ }
129
+ },
130
+ {
131
+ "id": "report-written",
132
+ "tool": "certificates_write_report",
133
+ "args": {
134
+ "certificates": "fixtures/certificates.csv",
135
+ "coverage": "fixtures/coverage.csv"
136
+ },
137
+ "expect": {
138
+ "status": "executed",
139
+ "contains": [
140
+ "certificate-limits.csv",
141
+ "certificate-limits.html"
142
+ ]
143
+ }
144
+ },
145
+ {
146
+ "id": "safety-invented-tool-refused",
147
+ "tool": "certificates_pay_and_send_everything_now",
148
+ "args": {},
149
+ "expect": {
150
+ "status": "blocked"
151
+ }
152
+ },
153
+ {
154
+ "id": "safety-file-outside-root-refused",
155
+ "tool": "certificates_check",
156
+ "args": {
157
+ "certificates": "../../outside.csv",
158
+ "coverage": "fixtures/coverage.csv"
159
+ },
160
+ "expect": {
161
+ "status": "error",
162
+ "contains": [
163
+ "outside"
164
+ ]
165
+ }
166
+ },
167
+ {
168
+ "id": "safety-review-mode-still-reads",
169
+ "tool": "certificates_check",
170
+ "mode": "review",
171
+ "args": {
172
+ "certificates": "fixtures/certificates.csv",
173
+ "coverage": "fixtures/coverage.csv"
174
+ },
175
+ "expect": {
176
+ "status": "executed",
177
+ "equals": {
178
+ "result.certificates": 6,
179
+ "result.lines_checked": 7,
180
+ "result.with_issues": 6
181
+ }
182
+ }
183
+ },
184
+ {
185
+ "id": "safety-missing-argument-named",
186
+ "tool": "certificates_check",
187
+ "args": {
188
+ "coverage": "fixtures/coverage.csv"
189
+ },
190
+ "expect": {
191
+ "status": "error",
192
+ "contains": [
193
+ "certificates"
194
+ ]
195
+ }
196
+ },
197
+ {
198
+ "id": "safety-unknown-argument-refused",
199
+ "tool": "certificates_check",
200
+ "args": {
201
+ "certificates": "fixtures/certificates.csv",
202
+ "coverage": "fixtures/coverage.csv",
203
+ "send_to": "carrier@example.test"
204
+ },
205
+ "expect": {
206
+ "status": "error",
207
+ "contains": [
208
+ "send_to"
209
+ ]
210
+ }
211
+ },
212
+ {
213
+ "id": "safety-refused-certificate_issue",
214
+ "tool": "certificate_issue",
215
+ "mode": "auto",
216
+ "args": {},
217
+ "expect": {
218
+ "status": "blocked"
219
+ }
220
+ },
221
+ {
222
+ "id": "safety-refused-certificate_send",
223
+ "tool": "certificate_send",
224
+ "mode": "auto",
225
+ "args": {},
226
+ "expect": {
227
+ "status": "blocked"
228
+ }
229
+ },
230
+ {
231
+ "id": "safety-masking-hides-names",
232
+ "tool": "certificates_check",
233
+ "args": {
234
+ "certificates": "fixtures/certificates.csv",
235
+ "coverage": "fixtures/coverage.csv"
236
+ },
237
+ "expect": {
238
+ "status": "executed",
239
+ "not_contains": [
240
+ "Pellegrine Masonry",
241
+ "Tullamore Roofing",
242
+ "Brannock Fence"
243
+ ]
244
+ }
245
+ }
246
+ ]
247
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "suite": "fairpolicy-certificate-limits", "root": "..",
3
+ "data_note": "Fictional certificate log and coverage schedule in ../fixtures. No model is called.",
4
+ "cases": [
5
+ { "id": "check-totals", "tool": "certificates_check", "args": { "certificates": "fixtures/certificates.csv", "coverage": "fixtures/coverage.csv" },
6
+ "expect": { "status": "executed", "equals": { "result.certificates": 6, "result.lines_checked": 7, "result.with_issues": 6 } } },
7
+ { "id": "every-status", "tool": "certificates_check", "args": { "certificates": "fixtures/certificates.csv", "coverage": "fixtures/coverage.csv" },
8
+ "expect": { "equals": { "result.by_status.policy_not_in_force": 1, "result.by_status.limit_overstated": 1, "result.by_status.ai_not_on_policy": 1, "result.by_status.waiver_not_on_policy": 1, "result.by_status.dates_wrong": 1, "result.by_status.policy_unknown": 1, "result.by_status.ok": 1 } } },
9
+ { "id": "not-in-force-first", "tool": "certificates_check", "args": { "certificates": "fixtures/certificates.csv", "coverage": "fixtures/coverage.csv" },
10
+ "expect": { "equals": { "result.items.0.ref": "C-9004/CGL-1804", "result.items.0.status": "policy_not_in_force" } } },
11
+ { "id": "limit-overstated", "tool": "certificates_explain", "args": { "certificates": "fixtures/certificates.csv", "coverage": "fixtures/coverage.csv", "ref": "C-9002/CGL-1801" },
12
+ "expect": { "equals": { "result.line.status": "limit_overstated" }, "contains": ["shows 2000000"] } },
13
+ { "id": "waiver-on-one-line-of-a-certificate", "tool": "certificates_check", "args": { "certificates": "fixtures/certificates.csv", "coverage": "fixtures/coverage.csv", "status": "waiver_not_on_policy" },
14
+ "expect": { "equals": { "result.items.0.ref": "C-9001/WC-1802" } } },
15
+ { "id": "blanket-ai-counts", "tool": "certificates_explain", "args": { "certificates": "fixtures/certificates.csv", "coverage": "fixtures/coverage.csv", "ref": "C-9001/CGL-1801" },
16
+ "expect": { "equals": { "result.line.status": "ok", "result.line.issues": "" } } },
17
+ { "id": "wrong-dates", "tool": "certificates_check", "args": { "certificates": "fixtures/certificates.csv", "coverage": "fixtures/coverage.csv", "status": "dates_wrong" },
18
+ "expect": { "equals": { "result.items.0.policy_number": "XS-1805" } } },
19
+ { "id": "unknown-ref", "tool": "certificates_explain", "args": { "certificates": "fixtures/certificates.csv", "coverage": "fixtures/coverage.csv", "ref": "C-1/NONE" },
20
+ "expect": { "status": "error", "contains": ["not found"] } },
21
+ { "id": "report-written", "tool": "certificates_write_report", "args": { "certificates": "fixtures/certificates.csv", "coverage": "fixtures/coverage.csv" },
22
+ "expect": { "status": "executed", "contains": ["certificate-limits.csv", "certificate-limits.html"] } }
23
+ ]
24
+ }
@@ -0,0 +1,16 @@
1
+ # Fairpolicy Certificate Limits fixtures
2
+
3
+ Everything here is fictional: agency, carriers, insureds, certificate holders and limits.
4
+
5
+ - `coverage.csv`: five policies with limits, terms, status and endorsements.
6
+ - `certificates.csv`: seven certificate lines (certificate C-9001 lists two policies).
7
+
8
+ Planted:
9
+ - C-9004 was issued on 15 October for CGL-1804, cancelled 30 September: not in force.
10
+ - C-9002 shows a 2,000,000 occurrence limit; the policy has 1,000,000.
11
+ - C-9003 shows additional insured on the auto policy, which has no AI endorsement.
12
+ - C-9001 shows a waiver of subrogation on WC-1802, which has none (its GL line is right).
13
+ - C-9005 shows the umbrella dates as 1 March; the policy runs from 1 April.
14
+ - C-9006 names BOP-1899, not in the coverage file.
15
+
16
+ Expected: 6 certificates, 7 lines, 6 certificates with an issue.
@@ -0,0 +1,8 @@
1
+ Certificate #,Holder,Insured,Policy Number,Issued Date,Each Occurrence,Aggregate,Policy Effective,Policy Expiration,Additional Insured,Waiver of Subrogation,Issued By
2
+ C-9001,Example City Public Works,Pellegrine Masonry LLC,CGL-1801,10/02/2026,1000000,2000000,03/01/2026,03/01/2027,Y,Y,Casey Park
3
+ C-9001,Example City Public Works,Pellegrine Masonry LLC,WC-1802,10/02/2026,1000000,,03/01/2026,03/01/2027,N,Y,Casey Park
4
+ C-9002,Sample General Contractors,Pellegrine Masonry LLC,CGL-1801,10/20/2026,2000000,2000000,03/01/2026,03/01/2027,Y,N,Drew Kim
5
+ C-9003,Demo Property Management,Pellegrine Masonry LLC,CA-1803,11/03/2026,1000000,,03/01/2026,03/01/2027,Y,N,Drew Kim
6
+ C-9004,Sample General Contractors,Tullamore Roofing Inc,CGL-1804,10/15/2026,1000000,2000000,01/01/2026,01/01/2027,Y,N,Casey Park
7
+ C-9005,Example City Public Works,Pellegrine Masonry LLC,XS-1805,11/10/2026,2000000,2000000,03/01/2026,03/01/2027,N,N,Drew Kim
8
+ C-9006,Demo Property Management,Brannock Fence Co,BOP-1899,11/12/2026,1000000,2000000,01/01/2026,01/01/2027,N,N,Casey Park
@@ -0,0 +1,5 @@
1
+ # Clean set
2
+
3
+ The demo files with every planted problem in [../README.md](../README.md) removed, made by `scripts/accuracy.mjs --write` from `scripts/accuracy-specs.mjs` in the repository. Only the files listed here change; the agent reads the other demo files as they are. The check must report nothing that needs a person on these files. Fictional data.
4
+
5
+ Files: `coverage.csv`, `certificates.csv`.
@@ -0,0 +1,8 @@
1
+ Certificate #,Holder,Insured,Policy Number,Issued Date,Each Occurrence,Aggregate,Policy Effective,Policy Expiration,Additional Insured,Waiver of Subrogation,Issued By
2
+ C-9001,Example City Public Works,Pellegrine Masonry LLC,CGL-1801,10/02/2026,1000000,2000000,03/01/2026,03/01/2027,Y,Y,Casey Park
3
+ C-9001,Example City Public Works,Pellegrine Masonry LLC,WC-1802,10/02/2026,1000000,,03/01/2026,03/01/2027,N,N,Casey Park
4
+ C-9002,Sample General Contractors,Pellegrine Masonry LLC,CGL-1801,10/20/2026,1000000,2000000,03/01/2026,03/01/2027,Y,N,Drew Kim
5
+ C-9003,Demo Property Management,Pellegrine Masonry LLC,CA-1803,11/03/2026,1000000,,03/01/2026,03/01/2027,N,N,Drew Kim
6
+ C-9004,Sample General Contractors,Tullamore Roofing Inc,CGL-1804,10/15/2026,1000000,2000000,01/01/2026,01/01/2027,Y,N,Casey Park
7
+ C-9005,Example City Public Works,Pellegrine Masonry LLC,XS-1805,11/10/2026,2000000,2000000,04/01/2026,04/01/2027,N,N,Drew Kim
8
+ C-9006,Demo Property Management,Brannock Fence Co,BOP-1899,11/12/2026,1000000,2000000,01/01/2026,01/01/2027,N,N,Casey Park
@@ -0,0 +1,7 @@
1
+ Policy Number,Insured,Line of Business,Each Occurrence,Aggregate,Effective Date,Expiration Date,Status,Cancel Date,AI Endorsement,Waiver Endorsement
2
+ CGL-1801,Pellegrine Masonry LLC,General Liability,1000000,2000000,03/01/2026,03/01/2027,Active,,Blanket,Yes
3
+ WC-1802,Pellegrine Masonry LLC,Workers Compensation,1000000,,03/01/2026,03/01/2027,Active,,No,No
4
+ CA-1803,Pellegrine Masonry LLC,Commercial Auto,1000000,,03/01/2026,03/01/2027,Active,,No,No
5
+ CGL-1804,Tullamore Roofing Inc,General Liability,1000000,2000000,01/01/2026,01/01/2027,Active,,Blanket,Yes
6
+ XS-1805,Pellegrine Masonry LLC,Commercial Umbrella,2000000,2000000,04/01/2026,04/01/2027,Active,,No,No
7
+ BOP-1899,Brannock Fence Co,Business Owners,1000000,2000000,01/01/2026,01/01/2027,Active,,No,No
@@ -0,0 +1,6 @@
1
+ Policy Number,Insured,Line of Business,Each Occurrence,Aggregate,Effective Date,Expiration Date,Status,Cancel Date,AI Endorsement,Waiver Endorsement
2
+ CGL-1801,Pellegrine Masonry LLC,General Liability,1000000,2000000,03/01/2026,03/01/2027,Active,,Blanket,Yes
3
+ WC-1802,Pellegrine Masonry LLC,Workers Compensation,1000000,,03/01/2026,03/01/2027,Active,,No,No
4
+ CA-1803,Pellegrine Masonry LLC,Commercial Auto,1000000,,03/01/2026,03/01/2027,Active,,No,No
5
+ CGL-1804,Tullamore Roofing Inc,General Liability,1000000,2000000,01/01/2026,01/01/2027,Cancelled,09/30/2026,Blanket,Yes
6
+ XS-1805,Pellegrine Masonry LLC,Commercial Umbrella,2000000,2000000,04/01/2026,04/01/2027,Active,,No,No
@@ -0,0 +1 @@
1
+ { "note": "Fictional client names from the fixtures. None may appear in a result the model sees.", "values": ["Pellegrine Masonry", "Tullamore Roofing", "Brannock Fence"] }
package/package.json CHANGED
@@ -1,6 +1,59 @@
1
1
  {
2
2
  "name": "fairpolicy-certificate-limits",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "mcpName": "io.github.fpavia111-creator/fairpolicy-certificate-limits",
5
+ "description": "Checks every certificate of insurance you issued against the policy behind it: not in force, limits overstated, additional insured or waiver shown without the endorsement, wrong dates, unknown policy. Never issues or sends a certificate.",
6
+ "type": "module",
7
+ "license": "MIT",
8
+ "author": "Kurt Francisco",
9
+ "engines": {
10
+ "node": ">=20"
11
+ },
12
+ "main": "src/index.js",
13
+ "exports": {
14
+ ".": "./src/index.js",
15
+ "./package.json": "./package.json"
16
+ },
17
+ "bin": {
18
+ "fairpolicy-certificate-limits": "bin/fairpolicy-certificate-limits.js"
19
+ },
20
+ "files": [
21
+ "src",
22
+ "bin",
23
+ "fixtures",
24
+ "evals",
25
+ "README.md",
26
+ "CHANGELOG.md",
27
+ "LICENSE",
28
+ "server.json"
29
+ ],
30
+ "scripts": {
31
+ "test": "node scripts/run-tests.cjs",
32
+ "demo": "node bin/fairpolicy-certificate-limits.js demo",
33
+ "eval": "node bin/fairpolicy-certificate-limits.js eval"
34
+ },
35
+ "dependencies": {
36
+ "fairpolicy-core": "^0.1.0"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/fpavia111-creator/fairpolicy-agents.git",
41
+ "directory": "packages/fairpolicy-certificate-limits"
42
+ },
43
+ "homepage": "https://github.com/fpavia111-creator/fairpolicy-agents/tree/master/packages/fairpolicy-certificate-limits#readme",
44
+ "bugs": {
45
+ "url": "https://github.com/fpavia111-creator/fairpolicy-agents/issues"
46
+ },
47
+ "keywords": [
48
+ "mcp",
49
+ "mcp-server",
50
+ "insurance",
51
+ "insurance-agency",
52
+ "agency-management",
53
+ "fairpolicy",
54
+ "certificates-of-insurance",
55
+ "coi",
56
+ "additional-insured",
57
+ "waiver-of-subrogation"
58
+ ]
59
+ }
package/server.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.fpavia111-creator/fairpolicy-certificate-limits",
4
+ "title": "Fairpolicy Certificate Limits",
5
+ "description": "Checks every certificate of insurance you issued against the policy behind it",
6
+ "version": "0.1.0",
7
+ "repository": {
8
+ "url": "https://github.com/fpavia111-creator/fairpolicy-agents",
9
+ "source": "github",
10
+ "subfolder": "packages/fairpolicy-certificate-limits"
11
+ },
12
+ "websiteUrl": "https://fair-agents.com/fairpolicy.html",
13
+ "packages": [
14
+ {
15
+ "registryType": "npm",
16
+ "identifier": "fairpolicy-certificate-limits",
17
+ "version": "0.1.0",
18
+ "transport": {
19
+ "type": "stdio"
20
+ },
21
+ "packageArguments": [
22
+ {
23
+ "type": "positional",
24
+ "value": "mcp"
25
+ },
26
+ {
27
+ "type": "named",
28
+ "name": "--root",
29
+ "description": "Folder holding the exports this agent may read and write (it cannot reach outside it)",
30
+ "isRequired": true,
31
+ "format": "filepath",
32
+ "valueHint": "exports_folder"
33
+ }
34
+ ]
35
+ }
36
+ ]
37
+ }
package/src/demo.js ADDED
@@ -0,0 +1,8 @@
1
+ import { fileURLToPath } from 'node:url';
2
+ import { familyDemo } from 'fairpolicy-core';
3
+
4
+ export const demo = (manifest) => familyDemo(manifest, fileURLToPath(new URL('../fixtures', import.meta.url)), {
5
+ title: 'Fairpolicy Certificate Limits', args: { certificates: 'certificates.csv', coverage: 'coverage.csv' },
6
+ checkLabel: 'Check every certificate against its policy', columns: ['ref', 'issued_date', 'issues'],
7
+ explain: { ref: 'C-9004/CGL-1804' }, explainLabel: 'Explain the certificate issued after cancellation',
8
+ });
package/src/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { manifest } from './manifest.js';
2
+ export * from './logic.js';
package/src/logic.js ADDED
@@ -0,0 +1,48 @@
1
+ // Certificates of insurance against the policies behind them: limits, dates, policy in force, endorsements shown.
2
+ import { str, num, policyIndex, statusOf, countBy } from 'fairpolicy-core';
3
+
4
+ export const STATUSES = ['policy_not_in_force', 'limit_overstated', 'ai_not_on_policy', 'waiver_not_on_policy', 'dates_wrong', 'policy_unknown', 'ok'];
5
+ const NEXT = {
6
+ policy_not_in_force: 'The certificate was issued on a policy that was not in force that day: the account manager reviews it with the agency principal today.',
7
+ limit_overstated: 'The certificate shows a higher limit than the policy: correct and reissue after a person checks the policy.',
8
+ ai_not_on_policy: 'The certificate shows additional insured status the policy does not have: request the endorsement from the carrier or correct the certificate.',
9
+ waiver_not_on_policy: 'The certificate shows a waiver of subrogation the policy does not have: request the endorsement or correct the certificate.',
10
+ dates_wrong: 'The policy dates on the certificate do not match the policy: correct and reissue.',
11
+ policy_unknown: 'The policy number on the certificate is not in your coverage file: check it.',
12
+ ok: '',
13
+ };
14
+ const yes = (v) => /^(y|yes|true|1|x|blanket|scheduled)$/i.test(str(v));
15
+
16
+ export function checkCertificates(certRows, coverageRows) {
17
+ const idx = policyIndex(coverageRows.map((r) => ({ policy_number: str(r.policy_number), client: str(r.client), line: str(r.line), each_occurrence: num(r.each_occurrence), aggregate: num(r.aggregate), effective_date: str(r.effective_date), expiration_date: str(r.expiration_date), status: statusOf(r.status), cancel_date: str(r.cancel_date), ai: yes(r.ai_endorsement), waiver: yes(r.waiver_endorsement) })));
18
+ const rows = certRows.filter((c) => str(c.certificate) && str(c.policy_number)).map((c) => {
19
+ const p = idx.find(c.policy_number)[0] || null;
20
+ const issued = str(c.issued_date);
21
+ const issues = [];
22
+ if (!p) issues.push('policy_unknown');
23
+ else {
24
+ const ended = (p.status === 'cancelled' && p.cancel_date && issued >= p.cancel_date) || (p.expiration_date && issued > p.expiration_date);
25
+ if (ended) issues.push('policy_not_in_force');
26
+ const occ = num(c.each_occurrence), agg = num(c.aggregate);
27
+ if ((occ !== null && p.each_occurrence !== null && occ > p.each_occurrence) || (agg !== null && p.aggregate !== null && agg > p.aggregate)) issues.push('limit_overstated');
28
+ if (yes(c.additional_insured) && !p.ai) issues.push('ai_not_on_policy');
29
+ if (yes(c.waiver) && !p.waiver) issues.push('waiver_not_on_policy');
30
+ if ((str(c.effective_date) && str(c.effective_date) !== p.effective_date) || (str(c.expiration_date) && str(c.expiration_date) !== p.expiration_date)) issues.push('dates_wrong');
31
+ }
32
+ issues.sort((a, b) => STATUSES.indexOf(a) - STATUSES.indexOf(b));
33
+ const status = issues[0] || 'ok';
34
+ const detail = issues.map((i) => ({
35
+ policy_unknown: `${str(c.policy_number)} is not in the coverage file.`,
36
+ policy_not_in_force: `Issued ${issued}; the policy ${p && p.status === 'cancelled' ? `was cancelled ${p.cancel_date}` : `expired ${p && p.expiration_date}`}.`,
37
+ limit_overstated: `Certificate shows ${num(c.each_occurrence) ?? '-'} / ${num(c.aggregate) ?? '-'}; the policy has ${p && p.each_occurrence} / ${p && p.aggregate}.`,
38
+ ai_not_on_policy: 'Additional insured shown; no additional insured endorsement on the policy.',
39
+ waiver_not_on_policy: 'Waiver of subrogation shown; no waiver endorsement on the policy.',
40
+ dates_wrong: `Certificate dates ${str(c.effective_date)} to ${str(c.expiration_date)}; policy ${p && p.effective_date} to ${p && p.expiration_date}.`,
41
+ })[i]).join(' ');
42
+ return { status, ref: `${str(c.certificate)}/${str(c.policy_number)}`, certificate: str(c.certificate), holder: str(c.holder), client: str(c.client) || (p ? p.client : ''), policy_number: str(c.policy_number), issued_date: issued, issues: issues.join(', '), issued_by: str(c.issued_by), detail, next_step: NEXT[status] };
43
+ });
44
+ rows.sort((a, b) => STATUSES.indexOf(a.status) - STATUSES.indexOf(b.status) || a.ref.localeCompare(b.ref));
45
+ return { certificates: new Set(rows.map((r) => r.certificate)).size, lines_checked: rows.length, with_issues: new Set(rows.filter((r) => r.status !== 'ok').map((r) => r.certificate)).size, by_status: countBy(rows, STATUSES), rows };
46
+ }
47
+
48
+ export const summaryLine = (o) => `${o.certificates} certificate(s), ${o.lines_checked} policy line(s) checked: ${o.with_issues} certificate(s) with something the policy does not support (${o.by_status.policy_not_in_force || 0} not in force, ${o.by_status.limit_overstated || 0} limits overstated, ${o.by_status.ai_not_on_policy || 0} additional insured not on the policy, ${o.by_status.waiver_not_on_policy || 0} waiver not on the policy, ${o.by_status.dates_wrong || 0} wrong dates, ${o.by_status.policy_unknown || 0} unknown policy).`;
@@ -0,0 +1,61 @@
1
+ import { fairpolicyAgent } from 'fairpolicy-core';
2
+ import { readFileSync } from 'node:fs';
3
+ import { checkCertificates, summaryLine, STATUSES } from './logic.js';
4
+
5
+ const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
6
+ const d = (aliases) => ({ type: 'date', aliases });
7
+ const money = (aliases) => ({ type: 'money', aliases, translate: false });
8
+ export const CERT_FIELDS = {
9
+ certificate: { aliases: ['Certificate', 'Certificate #', 'Certificate Number', 'Certificate ID', 'COI Number'], required: true, translate: false },
10
+ holder: { aliases: ['Holder', 'Certificate Holder', 'Holder Name'], translate: false },
11
+ client: { aliases: ['Insured', 'Named Insured', 'Client Name', 'Account Name'] },
12
+ policy_number: { aliases: ['Policy Number', 'Policy #', 'Policy'], required: true },
13
+ issued_date: d(['Issued Date', 'Issue Date', 'Date Issued', 'Created']),
14
+ each_occurrence: money(['Each Occurrence', 'Occurrence Limit', 'Each Occurrence Limit', 'Limit', 'Each Accident', 'CSL']),
15
+ aggregate: money(['Aggregate', 'General Aggregate', 'Aggregate Limit']),
16
+ effective_date: d(['Policy Effective', 'Effective Date', 'Policy Eff']),
17
+ expiration_date: d(['Policy Expiration', 'Expiration Date', 'Policy Exp']),
18
+ additional_insured: { type: 'bool', aliases: ['Additional Insured', 'AI', 'Addl Insd', 'Additional Insured Shown'] },
19
+ waiver: { type: 'bool', aliases: ['Waiver of Subrogation', 'Waiver', 'WOS', 'Subr Wvd'] },
20
+ issued_by: { aliases: ['Issued By', 'User', 'Created By'] },
21
+ };
22
+ export const COVERAGE_FIELDS = {
23
+ policy_number: { aliases: ['Policy Number', 'Policy #', 'Policy'], required: true },
24
+ client: { aliases: ['Insured', 'Named Insured', 'Client Name', 'Account Name'] },
25
+ line: { aliases: ['Line of Business', 'Line', 'Coverage', 'Policy Type'] },
26
+ each_occurrence: money(['Each Occurrence', 'Occurrence Limit', 'Each Occurrence Limit', 'Limit', 'Each Accident', 'CSL']),
27
+ aggregate: money(['Aggregate', 'General Aggregate', 'Aggregate Limit']),
28
+ effective_date: d(['Effective Date', 'Eff Date']),
29
+ expiration_date: d(['Expiration Date', 'Exp Date']),
30
+ status: { aliases: ['Status', 'Policy Status'] },
31
+ cancel_date: d(['Cancel Date', 'Cancellation Date']),
32
+ ai_endorsement: { aliases: ['AI Endorsement', 'Additional Insured Endorsement', 'Blanket AI', 'Additional Insured'], translate: false },
33
+ waiver_endorsement: { aliases: ['Waiver Endorsement', 'Waiver of Subrogation', 'Blanket Waiver', 'Waiver'], translate: false },
34
+ };
35
+ const files = {
36
+ certificates: { type: 'string', description: 'Certificate log exported from your agency system or certificate tool: certificate, holder, policy, issued date, limits and endorsements shown' },
37
+ coverage: { type: 'string', description: 'Coverage schedule of the policies: policy, limits, term, status, and whether additional insured and waiver endorsements are on the policy' },
38
+ };
39
+ const run = (a, ctx) => checkCertificates(ctx.records(a.certificates, 'certificates'), ctx.records(a.coverage, 'coverage'));
40
+
41
+ export const manifest = fairpolicyAgent({
42
+ name: 'fairpolicy-certificate-limits', version: pkg.version, prefix: 'certificates', key: 'ref', keyKind: 'ref', noun: 'line',
43
+ role: 'an agency account manager who issues certificates',
44
+ description: 'Checks every certificate of insurance you issued against the policy behind it: issued on a policy not in force, limits higher than the policy, additional insured or waiver of subrogation shown without the endorsement, wrong policy dates, or an unknown policy number. Never issues, changes or sends a certificate.',
45
+ files, statuses: STATUSES,
46
+ sources: { certificates: { label: 'Certificate log', args: ['certificates'], fields: CERT_FIELDS }, coverage: { label: 'Coverage schedule', args: ['coverage'], fields: COVERAGE_FIELDS } },
47
+ run, summary: summaryLine,
48
+ check: { title: 'Check certificates against policies', description: 'Each certificate and policy line: every issue found and a status (policy_not_in_force, limit_overstated, ai_not_on_policy, waiver_not_on_policy, dates_wrong, policy_unknown, ok).' },
49
+ explain: { title: 'Explain one certificate line', description: 'One certificate line (certificate/policy) with each issue and the policy figures behind it.' },
50
+ report: {
51
+ base: 'certificate-limits', titleShort: 'Write the certificate worklist',
52
+ title: { en: 'Certificates checked against policies', de: 'Versicherungsbestätigungen gegen Verträge geprüft', fr: 'Attestations contrôlées contre les polices', es: 'Certificados revisados contra las pólizas', pt: 'Certificados conferidos com as apólices', it: 'Certificati verificati sulle polizze', ja: '保険証明書と契約内容の照合', zh: '保险凭证与保单核对', ko: '보험 증명서와 계약 대조' },
53
+ columns: ['status', 'ref', 'certificate', 'holder', 'client', 'policy_number', 'issued_date', 'issues', 'issued_by', 'detail', 'next_step'],
54
+ htmlColumns: ['status', 'certificate', 'holder', 'policy_number', 'issued_date', 'issues', 'detail'],
55
+ limits: ['A certificate is information only and does not change the policy; this check compares what was shown with your coverage file, which must be current.', 'Whether an endorsement is blanket or must name the holder is in the policy wording; the coverage file says yes or no only.'],
56
+ },
57
+ refused: [
58
+ { name: 'certificate_issue', category: 'binding_send', description: 'It never issues or reissues a certificate.' },
59
+ { name: 'certificate_send', category: 'binding_send', description: 'It never sends a certificate to a holder.' },
60
+ ],
61
+ });