fairpolicy-book-valuation 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 +5 -0
- package/LICENSE +21 -0
- package/README.md +170 -2
- package/bin/fairpolicy-book-valuation.js +7 -0
- package/evals/cases.json +252 -0
- package/evals/domain-cases.json +24 -0
- package/fixtures/README.md +15 -0
- package/fixtures/book-settings.json +1 -0
- package/fixtures/book.csv +15 -0
- package/fixtures/clean/README.md +5 -0
- package/fixtures/clean/book.csv +49 -0
- package/fixtures/phi-canaries.json +1 -0
- package/package.json +57 -4
- package/server.json +37 -0
- package/src/demo.js +8 -0
- package/src/index.js +2 -0
- package/src/logic.js +40 -0
- package/src/manifest.js +42 -0
package/CHANGELOG.md
ADDED
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,171 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Fairpolicy Book Valuation (`fairpolicy-book-valuation`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Summarises the book of business from your policy list: annual commission and premium in force, accounts and policies per account, personal and commercial mix, revenue by carrier and line, the largest clients, and concentration and missing-data figures to watch. With multiples you choose it shows the arithmetic range; it is not an appraisal and gives no price.
|
|
4
|
+
|
|
5
|
+
**It never moves policies or books between agencies or producers. It never uploads or sends your book to anyone.**
|
|
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-book-valuation demo
|
|
11
|
+
npx -y fairpolicy-book-valuation mcp --root ./agency-exports
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
<!-- generated:start -->
|
|
15
|
+
|
|
16
|
+
## A demo run
|
|
17
|
+
|
|
18
|
+
`npx -y fairpolicy-book-valuation demo` runs the agent on the fictional files in [`fixtures/`](fixtures) in a temporary folder. Captured output:
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
Fairpolicy Book Valuation demo (fictional agency, carriers and clients)
|
|
22
|
+
|
|
23
|
+
▶ Summarise the book
|
|
24
|
+
status: executed decision: allow
|
|
25
|
+
13 policies in force for 7 account(s): 8860 annual commission on 75100 premium; 4 figure(s) to watch (concentration or missing data). A summary of your files for a valuation conversation, not an appraisal.
|
|
26
|
+
top_carrier_share_pct 56.49 watch
|
|
27
|
+
largest_client_share_p 34.42 watch
|
|
28
|
+
top_10_clients_share_p 100 watch
|
|
29
|
+
missing_commission_pct 7.69 watch
|
|
30
|
+
indicative_value_low 13290 info
|
|
31
|
+
indicative_value_high 22150 info
|
|
32
|
+
annual_commission 8860 ok
|
|
33
|
+
written_premium 75100 ok
|
|
34
|
+
policies 13 ok
|
|
35
|
+
accounts 7 ok
|
|
36
|
+
policies_per_account 1.86 ok
|
|
37
|
+
avg_commission_per_acc 1265.71 ok
|
|
38
|
+
personal_lines_share_p 15.41 ok
|
|
39
|
+
|
|
40
|
+
▶ Explain the carrier concentration
|
|
41
|
+
status: executed decision: allow
|
|
42
|
+
top_carrier_share_pct: watch. Largest carrier: Sample Casualty (limit 40%).
|
|
43
|
+
|
|
44
|
+
▶ Write the worklist (CSV and HTML, real names stay on this computer)
|
|
45
|
+
status: executed decision: allow
|
|
46
|
+
Book of business summary written: 13 policies in force for 7 account(s): 8860 annual commission on 75100 premium; 4 figure(s) to watch (concentration or missing data). A summary of your files for a valuation conversation, not an appraisal. Files: fairpolicy-out/book/book-valuation.csv, fairpolicy-out/book/book-valuation.html.
|
|
47
|
+
|
|
48
|
+
▶ The agent tries book_transfer itself
|
|
49
|
+
status: blocked decision: block
|
|
50
|
+
reason: It never moves policies or books between agencies or producers.
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Tools
|
|
54
|
+
|
|
55
|
+
| Tool | What it does | Policy |
|
|
56
|
+
|---|---|---|
|
|
57
|
+
| `book_check` | Book figures with a status (watch, info, ok), plus revenue by carrier and line and the ten largest clients. | runs |
|
|
58
|
+
| `book_explain` | One figure with how it was worked out. | runs |
|
|
59
|
+
| `book_write_report` | Write book-valuation.csv (every figure with its status and the figures behind it, plus blank owner and notes columns) and book-valuation.html into out_dir (default fairpolicy-out/book). | runs |
|
|
60
|
+
| `book_transfer` | It never moves policies or books between agencies or producers. | refused |
|
|
61
|
+
| `data_room_upload` | It never uploads or sends your book to anyone. | refused |
|
|
62
|
+
|
|
63
|
+
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.
|
|
64
|
+
|
|
65
|
+
## Columns it reads
|
|
66
|
+
|
|
67
|
+
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).
|
|
68
|
+
|
|
69
|
+
### Policy list (whole book) (`policies`)
|
|
70
|
+
|
|
71
|
+
| Column | Type | Also read as | For example, in other languages |
|
|
72
|
+
|---|---|---|---|
|
|
73
|
+
| `policy_number` (required) | text | Policy Number, Policy #, Policy No, Policy, Pol #, Policy Num | Vertragsnummer, N° de police, 証券番号, 保单号 |
|
|
74
|
+
| `client` | text (masked) | Client Name, Insured, Insured Name, Named Insured, Account Name, Customer Name | Versicherungsnehmer, Assuré, 契約者, 投保人 |
|
|
75
|
+
| `client_id` | text (masked) | Client Code, Lookup Code, Account Lookup Code, Customer #, Client Number, Client ID | Kundennummer, Code client, 顧客コード, 客户编号 |
|
|
76
|
+
| `carrier` | text | Carrier, Company, Writing Company, Insurer, Issuing Company, Carrier Name | Versicherer, Assureur, 保険会社, 保险公司 |
|
|
77
|
+
| `line` | text | Line of Business, LOB, Policy Type, Line Type, Coverage, Line | Sparte, Branche, 保険種目, 险种 |
|
|
78
|
+
| `effective_date` | date | Effective Date, Eff Date, Effective, Policy Effective Date, Inception Date, Term Effective | Beginn, Date d'effet, 始期, 生效日期 |
|
|
79
|
+
| `expiration_date` | date | Expiration Date, Exp Date, Expiration, Policy Expiration Date, X-Date, Xdate | Ablauf, Date d'échéance, 満期, 到期日期 |
|
|
80
|
+
| `premium` | amount | Premium, Annualized Premium, Annual Premium, Written Premium, Full Term Premium, Estimated Premium | Beitrag, Prime, 保険料, 保费 |
|
|
81
|
+
| `commission_rate` | number | Commission Rate, Comm Rate, Commission %, Comm %, Agency Commission %, Commission Percent | Courtagesatz, Taux de commission, 手数料率, 佣金率 |
|
|
82
|
+
| `commission` | amount | Commission, Agency Commission, Estimated Commission, Commission Amount, Annualized Commission, Revenue | Courtage, Commission, 手数料, 佣金 |
|
|
83
|
+
| `producer` | text | Producer, Producer Name, Exec, Account Executive, Agent, Producer 1 | Vermittler, Producteur, 募集人, 业务员 |
|
|
84
|
+
| `csr` | text | CSR, Rep, Account Manager, Service Rep, Customer Service Rep, Servicer | Sachbearbeiter, Gestionnaire, 事務担当, 客服 |
|
|
85
|
+
| `status` | text | Status, Policy Status, Current Status | Status, Statut, ステータス, 状态 |
|
|
86
|
+
| `bill_type` | text | Bill Type, Billing Method, Bill Method, Billing Type, Agency/Direct, Bill Plan | Inkassoart, Mode d’encaissement, 集金方法, 收费方式 |
|
|
87
|
+
| `business_type` | text | New/Renewal, New or Renewal, NB/RN, Business Type, New Business/Renewal | - |
|
|
88
|
+
| `segment` | text | Department, Division, Personal/Commercial, Book, Line Group, PL/CL | - |
|
|
89
|
+
| `state` | text | State, Policy State, Risk State, Base State, Garaging State | Bundesland, Région, 都道府県, 省份 |
|
|
90
|
+
| `cancel_date` | date | Cancel Date, Cancellation Date, Cancelled Date, Cancellation Effective Date, Cancel Effective Date | Stornodatum, Date de résiliation, 解約日, 退保日期 |
|
|
91
|
+
| `cancel_reason` | text | Cancel Reason, Cancellation Reason, Lost Reason, Reason Lost | - |
|
|
92
|
+
|
|
93
|
+
Named exports recognised by their column names:
|
|
94
|
+
|
|
95
|
+
| System | Export | Recognised by | Layout checked against vendor docs |
|
|
96
|
+
|---|---|---|---|
|
|
97
|
+
| Applied Epic | Policy list report exported to Excel or CSV | Lookup Code, Account Name, Policy Number, Line Type | no; Applied Epic list reports let each agency choose its columns; the names here are common defaults, not a fixed layout. |
|
|
98
|
+
| Vertafore AMS360 | Policy or expiration list exported to CSV | Customer #, Customer Name, Policy #, Exec, Rep | no; AMS360 calls the producer "Exec" and the service person "Rep". |
|
|
99
|
+
| Vertafore Sagitta | Policy list report (CSV) | Client Code, Client Name, Policy Number, Coverage, Insurer | no |
|
|
100
|
+
| HawkSoft | Client/policy export (CSV) | Client Number, Client Name, Policy Number, Line of Business, Carrier, Policy Status | no |
|
|
101
|
+
| EZLynx | Policy report export (CSV) | Applicant, Policy Number, Line of Business, Carrier, Policy Status | no |
|
|
102
|
+
| QQCatalyst | Policy list export (CSV) | Contact Name, Policy Number, Line of Business, Carrier, Effective Date, Expiration Date | no |
|
|
103
|
+
|
|
104
|
+
Every layout here was written from knowledge of the export ("recalled") and was not checked against vendor documentation or a live account. Agency systems let each agency choose report columns, so the first setup confirms them with inspect.
|
|
105
|
+
|
|
106
|
+
### Files from other countries
|
|
107
|
+
|
|
108
|
+
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-book-valuation inspect <file>` (names and shapes only, never values) and name them in `fairpolicy-sources.json`:
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{ "files": { "exports/claims.csv": { "columns": { "claim_id": "Fallnummer" }, "date_order": "dmy" } } }
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Install
|
|
115
|
+
|
|
116
|
+
Node 20 or newer. No other dependencies.
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npx -y fairpolicy-book-valuation demo
|
|
120
|
+
npx -y fairpolicy-book-valuation mcp --root /path/to/your/files
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Claude Desktop, Cursor and other MCP hosts:
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{
|
|
127
|
+
"mcpServers": {
|
|
128
|
+
"fairpolicy-book-valuation": {
|
|
129
|
+
"command": "npx",
|
|
130
|
+
"args": [
|
|
131
|
+
"-y",
|
|
132
|
+
"fairpolicy-book-valuation",
|
|
133
|
+
"mcp",
|
|
134
|
+
"--root",
|
|
135
|
+
"/path/to/your/files"
|
|
136
|
+
]
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Claude Code: `claude mcp add fairpolicy-book-valuation -- npx -y fairpolicy-book-valuation mcp --root .`, or install the `fairpolicy-book-valuation` plugin from this repository's marketplace (`fairpolicy-medical-billing`).
|
|
143
|
+
|
|
144
|
+
## Modes and approvals
|
|
145
|
+
|
|
146
|
+
- **Review** (`--mode review`): reads and reports only.
|
|
147
|
+
- **Assist** (default): the policy above. A tool that asks returns an `approval_id`; a person approves it once with `fairpolicy-book-valuation approve <id> --as "Your Name"` (or on the local approvals page, `fairpolicy-book-valuation approvals`), and the same call is repeated.
|
|
148
|
+
- **Auto** (`--mode auto --auto <tool,...>`): opt-in per tool, with step caps and a kill switch (`fairpolicy-book-valuation 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.
|
|
149
|
+
|
|
150
|
+
## CLI
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
fairpolicy-book-valuation tools # every tool, its policy and arguments
|
|
154
|
+
fairpolicy-book-valuation sources # the columns each input is read from
|
|
155
|
+
fairpolicy-book-valuation inspect <file> # how a file would be read (names and shapes, never values)
|
|
156
|
+
fairpolicy-book-valuation call book_check '{"policies":"<policies>"}'
|
|
157
|
+
fairpolicy-book-valuation eval # the private eval cases on the fictional fixtures
|
|
158
|
+
fairpolicy-book-valuation demo
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Client data
|
|
162
|
+
|
|
163
|
+
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.
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
## Limits
|
|
167
|
+
|
|
168
|
+
- 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.
|
|
169
|
+
- 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.
|
|
170
|
+
- 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.
|
|
171
|
+
- 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-book-valuation', demo, evalFile: fileURLToPath(new URL('../evals/cases.json', import.meta.url)) });
|
package/evals/cases.json
ADDED
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
{
|
|
2
|
+
"suite": "fairpolicy-book-valuation",
|
|
3
|
+
"root": "..",
|
|
4
|
+
"data_note": "Fictional book and settings in ../fixtures. No model is called.",
|
|
5
|
+
"cases": [
|
|
6
|
+
{
|
|
7
|
+
"id": "check-totals",
|
|
8
|
+
"tool": "book_check",
|
|
9
|
+
"args": {
|
|
10
|
+
"policies": "fixtures/book.csv",
|
|
11
|
+
"settings": "fixtures/book-settings.json"
|
|
12
|
+
},
|
|
13
|
+
"expect": {
|
|
14
|
+
"status": "executed",
|
|
15
|
+
"equals": {
|
|
16
|
+
"result.revenue": 8860,
|
|
17
|
+
"result.premium": 75100,
|
|
18
|
+
"result.policies": 13,
|
|
19
|
+
"result.accounts": 7,
|
|
20
|
+
"result.watch": 4
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"id": "every-status",
|
|
26
|
+
"tool": "book_check",
|
|
27
|
+
"args": {
|
|
28
|
+
"policies": "fixtures/book.csv",
|
|
29
|
+
"settings": "fixtures/book-settings.json"
|
|
30
|
+
},
|
|
31
|
+
"expect": {
|
|
32
|
+
"equals": {
|
|
33
|
+
"result.by_status.watch": 4,
|
|
34
|
+
"result.by_status.info": 2,
|
|
35
|
+
"result.by_status.ok": 7
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
"id": "carrier-concentration",
|
|
41
|
+
"tool": "book_explain",
|
|
42
|
+
"args": {
|
|
43
|
+
"policies": "fixtures/book.csv",
|
|
44
|
+
"settings": "fixtures/book-settings.json",
|
|
45
|
+
"metric": "top_carrier_share_pct"
|
|
46
|
+
},
|
|
47
|
+
"expect": {
|
|
48
|
+
"equals": {
|
|
49
|
+
"result.figure.status": "watch",
|
|
50
|
+
"result.figure.value": 56.49
|
|
51
|
+
},
|
|
52
|
+
"contains": [
|
|
53
|
+
"Sample Casualty"
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"id": "largest-client",
|
|
59
|
+
"tool": "book_explain",
|
|
60
|
+
"args": {
|
|
61
|
+
"policies": "fixtures/book.csv",
|
|
62
|
+
"settings": "fixtures/book-settings.json",
|
|
63
|
+
"metric": "largest_client_share_pct"
|
|
64
|
+
},
|
|
65
|
+
"expect": {
|
|
66
|
+
"equals": {
|
|
67
|
+
"result.figure.value": 34.42
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"id": "range-only-from-your-multiples",
|
|
73
|
+
"tool": "book_explain",
|
|
74
|
+
"args": {
|
|
75
|
+
"policies": "fixtures/book.csv",
|
|
76
|
+
"settings": "fixtures/book-settings.json",
|
|
77
|
+
"metric": "indicative_value_high"
|
|
78
|
+
},
|
|
79
|
+
"expect": {
|
|
80
|
+
"equals": {
|
|
81
|
+
"result.figure.value": 22150
|
|
82
|
+
},
|
|
83
|
+
"contains": [
|
|
84
|
+
"Not an appraisal"
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"id": "no-range-without-settings",
|
|
90
|
+
"tool": "book_check",
|
|
91
|
+
"args": {
|
|
92
|
+
"policies": "fixtures/book.csv"
|
|
93
|
+
},
|
|
94
|
+
"expect": {
|
|
95
|
+
"status": "executed",
|
|
96
|
+
"not_contains": [
|
|
97
|
+
"indicative_value"
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"id": "by-line-and-carrier",
|
|
103
|
+
"tool": "book_check",
|
|
104
|
+
"args": {
|
|
105
|
+
"policies": "fixtures/book.csv"
|
|
106
|
+
},
|
|
107
|
+
"expect": {
|
|
108
|
+
"equals": {
|
|
109
|
+
"result.by_carrier.0.carrier": "Sample Casualty",
|
|
110
|
+
"result.by_carrier.0.revenue": 5005,
|
|
111
|
+
"result.by_line.0.line": "cauto",
|
|
112
|
+
"result.by_line.0.revenue": 2520
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
"id": "personal-mix",
|
|
118
|
+
"tool": "book_explain",
|
|
119
|
+
"args": {
|
|
120
|
+
"policies": "fixtures/book.csv",
|
|
121
|
+
"metric": "personal_lines_share_pct"
|
|
122
|
+
},
|
|
123
|
+
"expect": {
|
|
124
|
+
"equals": {
|
|
125
|
+
"result.figure.value": 15.41
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"id": "report-written",
|
|
131
|
+
"tool": "book_write_report",
|
|
132
|
+
"args": {
|
|
133
|
+
"policies": "fixtures/book.csv",
|
|
134
|
+
"settings": "fixtures/book-settings.json"
|
|
135
|
+
},
|
|
136
|
+
"expect": {
|
|
137
|
+
"status": "executed",
|
|
138
|
+
"contains": [
|
|
139
|
+
"book-valuation.csv",
|
|
140
|
+
"book-valuation.html"
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
"id": "safety-invented-tool-refused",
|
|
146
|
+
"tool": "book_pay_and_send_everything_now",
|
|
147
|
+
"args": {},
|
|
148
|
+
"expect": {
|
|
149
|
+
"status": "blocked"
|
|
150
|
+
}
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"id": "safety-file-outside-root-refused",
|
|
154
|
+
"tool": "book_check",
|
|
155
|
+
"args": {
|
|
156
|
+
"policies": "../../outside.csv",
|
|
157
|
+
"settings": "fixtures/book-settings.json"
|
|
158
|
+
},
|
|
159
|
+
"expect": {
|
|
160
|
+
"status": "error",
|
|
161
|
+
"contains": [
|
|
162
|
+
"outside"
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"id": "safety-review-mode-still-reads",
|
|
168
|
+
"tool": "book_check",
|
|
169
|
+
"mode": "review",
|
|
170
|
+
"args": {
|
|
171
|
+
"policies": "fixtures/book.csv",
|
|
172
|
+
"settings": "fixtures/book-settings.json"
|
|
173
|
+
},
|
|
174
|
+
"expect": {
|
|
175
|
+
"status": "executed",
|
|
176
|
+
"equals": {
|
|
177
|
+
"result.revenue": 8860,
|
|
178
|
+
"result.premium": 75100,
|
|
179
|
+
"result.policies": 13,
|
|
180
|
+
"result.accounts": 7,
|
|
181
|
+
"result.watch": 4
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
"id": "safety-missing-argument-named",
|
|
187
|
+
"tool": "book_check",
|
|
188
|
+
"args": {
|
|
189
|
+
"settings": "fixtures/book-settings.json"
|
|
190
|
+
},
|
|
191
|
+
"expect": {
|
|
192
|
+
"status": "error",
|
|
193
|
+
"contains": [
|
|
194
|
+
"policies"
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"id": "safety-unknown-argument-refused",
|
|
200
|
+
"tool": "book_check",
|
|
201
|
+
"args": {
|
|
202
|
+
"policies": "fixtures/book.csv",
|
|
203
|
+
"settings": "fixtures/book-settings.json",
|
|
204
|
+
"send_to": "carrier@example.test"
|
|
205
|
+
},
|
|
206
|
+
"expect": {
|
|
207
|
+
"status": "error",
|
|
208
|
+
"contains": [
|
|
209
|
+
"send_to"
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"id": "safety-refused-book_transfer",
|
|
215
|
+
"tool": "book_transfer",
|
|
216
|
+
"mode": "auto",
|
|
217
|
+
"args": {},
|
|
218
|
+
"expect": {
|
|
219
|
+
"status": "blocked"
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"id": "safety-refused-data_room_upload",
|
|
224
|
+
"tool": "data_room_upload",
|
|
225
|
+
"mode": "auto",
|
|
226
|
+
"args": {},
|
|
227
|
+
"expect": {
|
|
228
|
+
"status": "blocked"
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"id": "safety-masking-hides-names",
|
|
233
|
+
"tool": "book_check",
|
|
234
|
+
"args": {
|
|
235
|
+
"policies": "fixtures/book.csv",
|
|
236
|
+
"settings": "fixtures/book-settings.json"
|
|
237
|
+
},
|
|
238
|
+
"expect": {
|
|
239
|
+
"status": "executed",
|
|
240
|
+
"not_contains": [
|
|
241
|
+
"Halvard Greaves",
|
|
242
|
+
"Juniper Oakhurst",
|
|
243
|
+
"Lorcan Deverill",
|
|
244
|
+
"Greaves Plumbing",
|
|
245
|
+
"Oakhurst Dental",
|
|
246
|
+
"Deverill Courier",
|
|
247
|
+
"Fenwick Arbor"
|
|
248
|
+
]
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
]
|
|
252
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"suite": "fairpolicy-book-valuation", "root": "..",
|
|
3
|
+
"data_note": "Fictional book and settings in ../fixtures. No model is called.",
|
|
4
|
+
"cases": [
|
|
5
|
+
{ "id": "check-totals", "tool": "book_check", "args": { "policies": "fixtures/book.csv", "settings": "fixtures/book-settings.json" },
|
|
6
|
+
"expect": { "status": "executed", "equals": { "result.revenue": 8860, "result.premium": 75100, "result.policies": 13, "result.accounts": 7, "result.watch": 4 } } },
|
|
7
|
+
{ "id": "every-status", "tool": "book_check", "args": { "policies": "fixtures/book.csv", "settings": "fixtures/book-settings.json" },
|
|
8
|
+
"expect": { "equals": { "result.by_status.watch": 4, "result.by_status.info": 2, "result.by_status.ok": 7 } } },
|
|
9
|
+
{ "id": "carrier-concentration", "tool": "book_explain", "args": { "policies": "fixtures/book.csv", "settings": "fixtures/book-settings.json", "metric": "top_carrier_share_pct" },
|
|
10
|
+
"expect": { "equals": { "result.figure.status": "watch", "result.figure.value": 56.49 }, "contains": ["Sample Casualty"] } },
|
|
11
|
+
{ "id": "largest-client", "tool": "book_explain", "args": { "policies": "fixtures/book.csv", "settings": "fixtures/book-settings.json", "metric": "largest_client_share_pct" },
|
|
12
|
+
"expect": { "equals": { "result.figure.value": 34.42 } } },
|
|
13
|
+
{ "id": "range-only-from-your-multiples", "tool": "book_explain", "args": { "policies": "fixtures/book.csv", "settings": "fixtures/book-settings.json", "metric": "indicative_value_high" },
|
|
14
|
+
"expect": { "equals": { "result.figure.value": 22150 }, "contains": ["Not an appraisal"] } },
|
|
15
|
+
{ "id": "no-range-without-settings", "tool": "book_check", "args": { "policies": "fixtures/book.csv" },
|
|
16
|
+
"expect": { "status": "executed", "not_contains": ["indicative_value"] } },
|
|
17
|
+
{ "id": "by-line-and-carrier", "tool": "book_check", "args": { "policies": "fixtures/book.csv" },
|
|
18
|
+
"expect": { "equals": { "result.by_carrier.0.carrier": "Sample Casualty", "result.by_carrier.0.revenue": 5005, "result.by_line.0.line": "cauto", "result.by_line.0.revenue": 2520 } } },
|
|
19
|
+
{ "id": "personal-mix", "tool": "book_explain", "args": { "policies": "fixtures/book.csv", "metric": "personal_lines_share_pct" },
|
|
20
|
+
"expect": { "equals": { "result.figure.value": 15.41 } } },
|
|
21
|
+
{ "id": "report-written", "tool": "book_write_report", "args": { "policies": "fixtures/book.csv", "settings": "fixtures/book-settings.json" },
|
|
22
|
+
"expect": { "status": "executed", "contains": ["book-valuation.csv", "book-valuation.html"] } }
|
|
23
|
+
]
|
|
24
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Fairpolicy Book Valuation fixtures
|
|
2
|
+
|
|
3
|
+
Everything here is fictional: agency, carriers, clients and amounts.
|
|
4
|
+
|
|
5
|
+
- `book.csv`: fourteen policies for seven clients (one expired, left out).
|
|
6
|
+
- `book-settings.json`: concentration limits and the low and high revenue multiples a principal chose for the example.
|
|
7
|
+
|
|
8
|
+
Planted:
|
|
9
|
+
- Sample Casualty pays 5,005 of 8,860 commission (56.49%), over the 40% limit.
|
|
10
|
+
- Greaves Plumbing LLC is 3,050 (34.42%), over the 10% limit for one client.
|
|
11
|
+
- With 7 accounts the top 10 clients are the whole book (100%), over the 25% limit.
|
|
12
|
+
- WC-1613 has no commission and no rate: 1 of 13 policies (7.69%), over the 5% limit.
|
|
13
|
+
- HO-1605 has no commission but a 15% rate: 270 is used.
|
|
14
|
+
|
|
15
|
+
Expected: 13 policies in force, 7 accounts, 8,860 commission on 75,100 premium; range 13,290 to 22,150 from the multiples set.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "top_carrier_limit_pct": 40, "largest_client_limit_pct": 10, "top_10_limit_pct": 25, "missing_commission_limit_pct": 5, "revenue_multiple_low": 1.5, "revenue_multiple_high": 2.5 }
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
Client Name,Policy Number,Line of Business,Carrier,Effective Date,Expiration Date,Premium,Commission Rate,Commission,Producer,Policy Status
|
|
2
|
+
Halvard Greaves,PA-1601,Personal Auto,Example Mutual,03/01/2026,09/01/2026,1500.00,15,225.00,Jordan Lee,Active
|
|
3
|
+
Halvard Greaves,HO-1602,Homeowners,Example Mutual,03/01/2026,03/01/2027,2000.00,15,300.00,Jordan Lee,Active
|
|
4
|
+
Juniper Oakhurst,PA-1603,Personal Auto,Example Mutual,05/01/2026,11/01/2026,1200.00,15,180.00,Jordan Lee,Active
|
|
5
|
+
Juniper Oakhurst,HO-1604,Homeowners,Example Mutual,05/01/2026,05/01/2027,2600.00,15,390.00,Jordan Lee,Active
|
|
6
|
+
Lorcan Deverill,HO-1605,Homeowners,Example Mutual,07/01/2026,07/01/2027,1800.00,15,,Jordan Lee,Active
|
|
7
|
+
Greaves Plumbing LLC,BOP-1606,Business Owners,Sample Casualty,02/01/2026,02/01/2027,6000.00,17.5,1050.00,Sam Ortiz,Active
|
|
8
|
+
Greaves Plumbing LLC,WC-1607,Workers Compensation,Sample Casualty,02/01/2026,02/01/2027,20000.00,10,2000.00,Sam Ortiz,Active
|
|
9
|
+
Oakhurst Dental Group,BOP-1608,Business Owners,Sample Casualty,04/01/2026,04/01/2027,5000.00,17.5,875.00,Sam Ortiz,Active
|
|
10
|
+
Oakhurst Dental Group,CA-1609,Commercial Auto,Sample Casualty,04/01/2026,04/01/2027,9000.00,12,1080.00,Sam Ortiz,Active
|
|
11
|
+
Deverill Courier Inc,CA-1610,Commercial Auto,Test Fire & Marine,06/01/2026,06/01/2027,12000.00,12,1440.00,Sam Ortiz,Active
|
|
12
|
+
Deverill Courier Inc,CGL-1611,General Liability,Demo Indemnity,06/01/2026,06/01/2027,4000.00,15,600.00,Sam Ortiz,Active
|
|
13
|
+
Fenwick Arbor Care LLC,CGL-1612,General Liability,Demo Indemnity,08/01/2026,08/01/2027,3000.00,15,450.00,Sam Ortiz,Active
|
|
14
|
+
Fenwick Arbor Care LLC,WC-1613,Workers Compensation,Demo Indemnity,08/01/2026,08/01/2027,7000.00,,,Sam Ortiz,Active
|
|
15
|
+
Fenwick Arbor Care LLC,CA-1614,Commercial Auto,Demo Indemnity,08/01/2025,08/01/2026,5000.00,12,600.00,Sam Ortiz,Expired
|
|
@@ -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: `book.csv`.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
Client Name,Policy Number,Line of Business,Carrier,Effective Date,Expiration Date,Premium,Commission Rate,Commission,Producer,Policy Status
|
|
2
|
+
Clean Book Client 01,BOP-6001,Business Owners,Example Mutual,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
3
|
+
Clean Book Client 02,BOP-6002,Business Owners,Sample Casualty,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
4
|
+
Clean Book Client 03,BOP-6003,Business Owners,Demo Indemnity,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
5
|
+
Clean Book Client 04,BOP-6004,Business Owners,Test Fire & Marine,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
6
|
+
Clean Book Client 05,BOP-6005,Business Owners,Example Mutual,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
7
|
+
Clean Book Client 06,BOP-6006,Business Owners,Sample Casualty,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
8
|
+
Clean Book Client 07,BOP-6007,Business Owners,Demo Indemnity,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
9
|
+
Clean Book Client 08,BOP-6008,Business Owners,Test Fire & Marine,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
10
|
+
Clean Book Client 09,BOP-6009,Business Owners,Example Mutual,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
11
|
+
Clean Book Client 10,BOP-6010,Business Owners,Sample Casualty,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
12
|
+
Clean Book Client 11,BOP-6011,Business Owners,Demo Indemnity,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
13
|
+
Clean Book Client 12,BOP-6012,Business Owners,Test Fire & Marine,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
14
|
+
Clean Book Client 13,BOP-6013,Business Owners,Example Mutual,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
15
|
+
Clean Book Client 14,BOP-6014,Business Owners,Sample Casualty,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
16
|
+
Clean Book Client 15,BOP-6015,Business Owners,Demo Indemnity,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
17
|
+
Clean Book Client 16,BOP-6016,Business Owners,Test Fire & Marine,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
18
|
+
Clean Book Client 17,BOP-6017,Business Owners,Example Mutual,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
19
|
+
Clean Book Client 18,BOP-6018,Business Owners,Sample Casualty,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
20
|
+
Clean Book Client 19,BOP-6019,Business Owners,Demo Indemnity,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
21
|
+
Clean Book Client 20,BOP-6020,Business Owners,Test Fire & Marine,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
22
|
+
Clean Book Client 21,BOP-6021,Business Owners,Example Mutual,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
23
|
+
Clean Book Client 22,BOP-6022,Business Owners,Sample Casualty,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
24
|
+
Clean Book Client 23,BOP-6023,Business Owners,Demo Indemnity,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
25
|
+
Clean Book Client 24,BOP-6024,Business Owners,Test Fire & Marine,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
26
|
+
Clean Book Client 25,BOP-6025,Business Owners,Example Mutual,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
27
|
+
Clean Book Client 26,BOP-6026,Business Owners,Sample Casualty,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
28
|
+
Clean Book Client 27,BOP-6027,Business Owners,Demo Indemnity,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
29
|
+
Clean Book Client 28,BOP-6028,Business Owners,Test Fire & Marine,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
30
|
+
Clean Book Client 29,BOP-6029,Business Owners,Example Mutual,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
31
|
+
Clean Book Client 30,BOP-6030,Business Owners,Sample Casualty,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
32
|
+
Clean Book Client 31,BOP-6031,Business Owners,Demo Indemnity,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
33
|
+
Clean Book Client 32,BOP-6032,Business Owners,Test Fire & Marine,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
34
|
+
Clean Book Client 33,BOP-6033,Business Owners,Example Mutual,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
35
|
+
Clean Book Client 34,BOP-6034,Business Owners,Sample Casualty,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
36
|
+
Clean Book Client 35,BOP-6035,Business Owners,Demo Indemnity,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
37
|
+
Clean Book Client 36,BOP-6036,Business Owners,Test Fire & Marine,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
38
|
+
Clean Book Client 37,BOP-6037,Business Owners,Example Mutual,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
39
|
+
Clean Book Client 38,BOP-6038,Business Owners,Sample Casualty,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
40
|
+
Clean Book Client 39,BOP-6039,Business Owners,Demo Indemnity,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
41
|
+
Clean Book Client 40,BOP-6040,Business Owners,Test Fire & Marine,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
42
|
+
Clean Book Client 41,BOP-6041,Business Owners,Example Mutual,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
43
|
+
Clean Book Client 42,BOP-6042,Business Owners,Sample Casualty,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
44
|
+
Clean Book Client 43,BOP-6043,Business Owners,Demo Indemnity,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
45
|
+
Clean Book Client 44,BOP-6044,Business Owners,Test Fire & Marine,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
46
|
+
Clean Book Client 45,BOP-6045,Business Owners,Example Mutual,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
47
|
+
Clean Book Client 46,BOP-6046,Business Owners,Sample Casualty,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
48
|
+
Clean Book Client 47,BOP-6047,Business Owners,Demo Indemnity,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
49
|
+
Clean Book Client 48,BOP-6048,Business Owners,Test Fire & Marine,06/01/2026,06/01/2027,1000.00,15,150.00,Sam Ortiz,Active
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "note": "Fictional client names from the fixtures. None may appear in a result the model sees.", "values": ["Halvard Greaves", "Juniper Oakhurst", "Lorcan Deverill", "Greaves Plumbing", "Oakhurst Dental", "Deverill Courier", "Fenwick Arbor"] }
|
package/package.json
CHANGED
|
@@ -1,6 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fairpolicy-book-valuation",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"mcpName": "io.github.fpavia111-creator/fairpolicy-book-valuation",
|
|
5
|
+
"description": "Summarises your book of business for a valuation conversation: commission and premium in force, mix, revenue by carrier and line, largest clients, and concentration and missing-data figures to watch. Not an appraisal.",
|
|
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-book-valuation": "bin/fairpolicy-book-valuation.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-book-valuation.js demo",
|
|
33
|
+
"eval": "node bin/fairpolicy-book-valuation.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-book-valuation"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/fpavia111-creator/fairpolicy-agents/tree/master/packages/fairpolicy-book-valuation#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
|
+
"book-of-business",
|
|
55
|
+
"agency-valuation",
|
|
56
|
+
"perpetuation",
|
|
57
|
+
"concentration"
|
|
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-book-valuation",
|
|
4
|
+
"title": "Fairpolicy Book Valuation",
|
|
5
|
+
"description": "Summarises your book of business for a valuation conversation",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"url": "https://github.com/fpavia111-creator/fairpolicy-agents",
|
|
9
|
+
"source": "github",
|
|
10
|
+
"subfolder": "packages/fairpolicy-book-valuation"
|
|
11
|
+
},
|
|
12
|
+
"websiteUrl": "https://fair-agents.com/fairpolicy.html",
|
|
13
|
+
"packages": [
|
|
14
|
+
{
|
|
15
|
+
"registryType": "npm",
|
|
16
|
+
"identifier": "fairpolicy-book-valuation",
|
|
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 Book Valuation', args: { policies: 'book.csv', settings: 'book-settings.json' },
|
|
6
|
+
checkLabel: 'Summarise the book', columns: ['metric', 'value'],
|
|
7
|
+
explain: { metric: 'top_carrier_share_pct' }, explainLabel: 'Explain the carrier concentration',
|
|
8
|
+
});
|
package/src/index.js
ADDED
package/src/logic.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Book of business summary: the figures a valuation conversation starts from, with concentration and data gaps flagged.
|
|
2
|
+
import { str, num, round2, sum, pct, normPolicy, clientKey, commissionAt, carrierKey, groupBy, countBy } from 'fairpolicy-core';
|
|
3
|
+
|
|
4
|
+
export const STATUSES = ['watch', 'info', 'ok'];
|
|
5
|
+
|
|
6
|
+
export function summarizeBook(policyRows, settings = {}) {
|
|
7
|
+
const lim = { carrier: num(settings.top_carrier_limit_pct) ?? 40, client: num(settings.largest_client_limit_pct) ?? 10, top10: num(settings.top_10_limit_pct) ?? 25, missing: num(settings.missing_commission_limit_pct) ?? 5 };
|
|
8
|
+
const pols = policyRows.map((r) => normPolicy(r)).filter((p) => p.policy_key && !['cancelled', 'expired', 'non_renewed', 'lapsed'].includes(p.status_code));
|
|
9
|
+
for (const p of pols) p.revenue = p.commission ?? (p.premium !== null && p.commission_rate !== null ? commissionAt(p.premium, p.commission_rate) : null);
|
|
10
|
+
const revenue = sum(pols, (p) => p.revenue ?? 0), premium = sum(pols, (p) => p.premium ?? 0);
|
|
11
|
+
const roll = (key, f) => [...groupBy(pols, f).values()].map((g) => ({ [key]: g.map((p) => p[key]).sort()[0] || '(none)', policies: g.length, premium: sum(g, (p) => p.premium ?? 0), revenue: sum(g, (p) => p.revenue ?? 0), revenue_share_pct: pct(sum(g, (p) => p.revenue ?? 0), revenue) })).sort((a, b) => b.revenue - a.revenue || String(a[key]).localeCompare(String(b[key])));
|
|
12
|
+
const byCarrier = roll('carrier', (p) => carrierKey(p.carrier));
|
|
13
|
+
const byLine = roll('line_code', (p) => p.line_code).map(({ line_code, ...r }) => ({ line: line_code, ...r }));
|
|
14
|
+
const byClient = roll('client', (p) => clientKey(p.client) || p.client_id);
|
|
15
|
+
const missing = pols.filter((p) => p.revenue === null).length;
|
|
16
|
+
const personal = sum(pols.filter((p) => p.personal === true), (p) => p.revenue ?? 0);
|
|
17
|
+
const m = (metric, value, status, detail) => ({ status, metric, value, detail });
|
|
18
|
+
const rows = [
|
|
19
|
+
m('annual_commission', revenue, 'ok', 'Commission on the policies in force (booked commission, or premium times the booked rate).'),
|
|
20
|
+
m('written_premium', premium, 'ok', 'Premium on the policies in force.'),
|
|
21
|
+
m('policies', pols.length, 'ok', 'Policies in force.'),
|
|
22
|
+
m('accounts', byClient.length, 'ok', 'Clients with at least one policy in force.'),
|
|
23
|
+
m('policies_per_account', byClient.length ? round2(pols.length / byClient.length) : 0, 'ok', 'Policies in force divided by accounts.'),
|
|
24
|
+
m('avg_commission_per_account', byClient.length ? round2(revenue / byClient.length) : 0, 'ok', 'Commission divided by accounts.'),
|
|
25
|
+
m('personal_lines_share_pct', pct(personal, revenue), 'ok', 'Share of commission from personal lines.'),
|
|
26
|
+
m('top_carrier_share_pct', byCarrier[0] ? byCarrier[0].revenue_share_pct : 0, byCarrier[0] && byCarrier[0].revenue_share_pct > lim.carrier ? 'watch' : 'ok', `Largest carrier: ${byCarrier[0] ? byCarrier[0].carrier : '-'} (limit ${lim.carrier}%).`),
|
|
27
|
+
m('largest_client_share_pct', byClient[0] ? byClient[0].revenue_share_pct : 0, byClient[0] && byClient[0].revenue_share_pct > lim.client ? 'watch' : 'ok', `One client's share of commission (limit ${lim.client}%).`),
|
|
28
|
+
m('top_10_clients_share_pct', pct(sum(byClient.slice(0, 10), (c) => c.revenue), revenue), pct(sum(byClient.slice(0, 10), (c) => c.revenue), revenue) > lim.top10 ? 'watch' : 'ok', `Share of commission from the ten largest clients (limit ${lim.top10}%).`),
|
|
29
|
+
m('missing_commission_pct', pct(missing, pols.length), pct(missing, pols.length) > lim.missing ? 'watch' : 'ok', `${missing} policy(ies) with no commission and no rate: the revenue above leaves them out (limit ${lim.missing}%).`),
|
|
30
|
+
];
|
|
31
|
+
const lo = num(settings.revenue_multiple_low), hi = num(settings.revenue_multiple_high);
|
|
32
|
+
if (lo !== null && hi !== null) {
|
|
33
|
+
rows.push(m('indicative_value_low', round2(revenue * lo), 'info', `Commission times ${lo}, the low multiple you set. Not an appraisal.`));
|
|
34
|
+
rows.push(m('indicative_value_high', round2(revenue * hi), 'info', `Commission times ${hi}, the high multiple you set. Not an appraisal.`));
|
|
35
|
+
}
|
|
36
|
+
rows.sort((a, b) => STATUSES.indexOf(a.status) - STATUSES.indexOf(b.status));
|
|
37
|
+
return { revenue, premium, policies: pols.length, accounts: byClient.length, watch: rows.filter((r) => r.status === 'watch').length, by_status: countBy(rows, STATUSES), by_carrier: byCarrier, by_line: byLine, top_clients: byClient.slice(0, 10), rows };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export const summaryLine = (o) => `${o.policies} policies in force for ${o.accounts} account(s): ${o.revenue} annual commission on ${o.premium} premium; ${o.watch} figure(s) to watch (concentration or missing data). A summary of your files for a valuation conversation, not an appraisal.`;
|
package/src/manifest.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { fairpolicyAgent, POLICY_FIELDS, POLICY_PROFILES, sectionTitle } from 'fairpolicy-core';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { summarizeBook, summaryLine, STATUSES } from './logic.js';
|
|
4
|
+
|
|
5
|
+
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
6
|
+
export const BOOK_SCHEMA = {
|
|
7
|
+
type: 'object', additionalProperties: false,
|
|
8
|
+
properties: {
|
|
9
|
+
top_carrier_limit_pct: { type: 'number', minimum: 0, maximum: 100, description: 'Flag when one carrier pays more than this share of commission (default 40)' },
|
|
10
|
+
largest_client_limit_pct: { type: 'number', minimum: 0, maximum: 100, description: 'Flag when one client is more than this share (default 10)' },
|
|
11
|
+
top_10_limit_pct: { type: 'number', minimum: 0, maximum: 100, description: 'Flag when the ten largest clients are more than this share (default 25)' },
|
|
12
|
+
missing_commission_limit_pct: { type: 'number', minimum: 0, maximum: 100, description: 'Flag when more than this share of policies has no commission or rate (default 5)' },
|
|
13
|
+
revenue_multiple_low: { type: 'number', minimum: 0, maximum: 20, description: 'A low revenue multiple you choose; the agent only multiplies' },
|
|
14
|
+
revenue_multiple_high: { type: 'number', minimum: 0, maximum: 20, description: 'A high revenue multiple you choose' },
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
const files = { policies: { type: 'string', description: 'Policy list of the whole book from your agency system, with client, line, carrier, premium and commission or commission rate' } };
|
|
18
|
+
const args = { settings: { type: 'string', description: 'Optional settings JSON: concentration limits and, only if you want a range, the low and high revenue multiples you choose' } };
|
|
19
|
+
const run = (a, ctx) => summarizeBook(ctx.records(a.policies, 'policies'), a.settings ? ctx.readJson(a.settings, 'book_settings') : {});
|
|
20
|
+
|
|
21
|
+
export const manifest = fairpolicyAgent({
|
|
22
|
+
name: 'fairpolicy-book-valuation', version: pkg.version, prefix: 'book', key: 'metric', keyKind: 'metric', noun: 'figure',
|
|
23
|
+
role: 'an agency principal preparing for a valuation, perpetuation or sale conversation',
|
|
24
|
+
description: 'Summarises the book of business from your policy list: annual commission and premium in force, accounts and policies per account, personal and commercial mix, revenue by carrier and line, the largest clients, and concentration and missing-data figures to watch. With multiples you choose it shows the arithmetic range; it is not an appraisal and gives no price.',
|
|
25
|
+
files, args, required: ['policies'], statuses: STATUSES,
|
|
26
|
+
sources: { policies: { label: 'Policy list (whole book)', args: ['policies'], fields: POLICY_FIELDS, profiles: POLICY_PROFILES } },
|
|
27
|
+
configSchemas: { book_settings: BOOK_SCHEMA },
|
|
28
|
+
run, summary: summaryLine,
|
|
29
|
+
check: { title: 'Summarise the book of business', description: 'Book figures with a status (watch, info, ok), plus revenue by carrier and line and the ten largest clients.' },
|
|
30
|
+
explain: { title: 'Explain one figure', description: 'One figure with how it was worked out.' },
|
|
31
|
+
report: {
|
|
32
|
+
base: 'book-valuation', titleShort: 'Write the book summary',
|
|
33
|
+
title: { en: 'Book of business summary', de: 'Bestandsübersicht', fr: 'Synthèse du portefeuille', es: 'Resumen de la cartera', pt: 'Resumo da carteira', it: 'Sintesi del portafoglio', ja: '保有契約の概要', zh: '业务组合概览', ko: '보유 계약 요약' },
|
|
34
|
+
columns: ['status', 'metric', 'value', 'detail'],
|
|
35
|
+
sections: (o) => [{ title: sectionTitle('by_carrier'), rows: o.by_carrier, columns: ['carrier', 'policies', 'premium', 'revenue', 'revenue_share_pct'] }, { title: sectionTitle('by_line'), rows: o.by_line, columns: ['line', 'policies', 'premium', 'revenue', 'revenue_share_pct'] }, { title: sectionTitle('by_client'), rows: o.top_clients, columns: ['client', 'policies', 'premium', 'revenue', 'revenue_share_pct'] }],
|
|
36
|
+
limits: ['Commission is what your agency system books on the policies in force, not cash received, contingencies, fees or overrides.', 'A valuation depends on retention, growth, profitability, contracts and the market; these figures are inputs for that conversation with a qualified adviser, not a value.'],
|
|
37
|
+
},
|
|
38
|
+
refused: [
|
|
39
|
+
{ name: 'book_transfer', category: 'production_deploy', description: 'It never moves policies or books between agencies or producers.' },
|
|
40
|
+
{ name: 'data_room_upload', category: 'binding_send', description: 'It never uploads or sends your book to anyone.' },
|
|
41
|
+
],
|
|
42
|
+
});
|