fairwire-contract-renewals 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 +219 -2
- package/bin/fairwire-contract-renewals.js +7 -0
- package/evals/cases.json +363 -0
- package/fixtures/README.md +7 -0
- package/fixtures/contracts.csv +7 -0
- package/fixtures/intl/README.md +12 -0
- package/fixtures/intl/de/contracts.csv +7 -0
- package/fixtures/intl/de/spend.csv +12 -0
- package/fixtures/intl/ja/contracts.csv +7 -0
- package/fixtures/intl/ja/spend.csv +12 -0
- package/fixtures/settings.json +4 -0
- package/fixtures/spend.csv +12 -0
- package/package.json +57 -4
- package/server.json +37 -0
- package/src/demo.js +19 -0
- package/src/index.js +2 -0
- package/src/logic.js +72 -0
- package/src/manifest.js +37 -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,220 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Fairwire Contract Renewals
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
IT contracts and renewals: notice deadlines for auto-renewing contracts, price rises above your cap, contracts with no owner, two contracts for the same service, vendors paid with no contract on file and spend above the contract value. Writes a renewal calendar and drafts notice letters for a person to send.
|
|
4
|
+
|
|
5
|
+
Part of **Fairwire**, the IT and network family of [Mythos Machines](https://fair-agents.com) agents. The software is free (MIT); you pay a fixed price for the setup on your files. It reads files your IT team exports, on your own computer, and drafts notes. Every change to a live device, firewall, DNS zone, directory or cloud account stays one named person's click.
|
|
6
|
+
|
|
7
|
+
## What it checks
|
|
8
|
+
|
|
9
|
+
| Finding | What it means |
|
|
10
|
+
|---|---|
|
|
11
|
+
| `notice_deadline` | An auto-renewing contract whose notice deadline (end date minus notice period) falls inside your look-ahead window. |
|
|
12
|
+
| `expired_still_paid` | Payments to a vendor after its contract ended. |
|
|
13
|
+
| `notice_missed` | The notice deadline has passed, so the contract will renew unless the vendor agrees otherwise. |
|
|
14
|
+
| `uplift_above_cap` | A renewal price rise above your cap. |
|
|
15
|
+
| `spend_over_contract` | Payments to a vendor in the last 12 months above the contract value by more than your margin. |
|
|
16
|
+
| `spend_without_contract` | A vendor paid in the last 12 months with no contract on file. |
|
|
17
|
+
| `overlapping_contracts` | Two contracts for the same service running at the same time. |
|
|
18
|
+
| `no_owner` | A contract with no owner, so nobody decides about its renewal. |
|
|
19
|
+
|
|
20
|
+
Findings come back worst first (high, medium, low). A finding a named person has reviewed can be accepted as known, with a reason and a date to look again; it then moves to "Accepted as known" instead of counting as open.
|
|
21
|
+
|
|
22
|
+
## Settings
|
|
23
|
+
|
|
24
|
+
Pass a settings file with `settings`. Every setting is optional; a misspelt setting is refused by name.
|
|
25
|
+
|
|
26
|
+
| Setting | What it does |
|
|
27
|
+
|---|---|
|
|
28
|
+
| `lookahead_days` | Days ahead to look for notice deadlines (default 60) |
|
|
29
|
+
| `urgent_days` | Notice deadlines this close are high (default 14) |
|
|
30
|
+
| `uplift_cap_pct` | Largest renewal price rise you accept, in percent (default 5) |
|
|
31
|
+
| `spend_margin_pct` | Margin over the contract value before spend is flagged, in percent (default 10) |
|
|
32
|
+
|
|
33
|
+
## What it never does
|
|
34
|
+
|
|
35
|
+
- `vendor_send_notice` is refused: Fairwire Contract Renewals never sends a notice or signs a renewal; the contract owner sends the reviewed letter.
|
|
36
|
+
- `ap_hold_payment` is refused: Fairwire Contract Renewals never stops, holds or makes a payment.
|
|
37
|
+
- `renewals_request_send` waits for one named person's click, even in Auto (`binding_send`).
|
|
38
|
+
- `renewals_accept_learning` waits for one named person's click, even in Auto (`accept_learning`).
|
|
39
|
+
- `renewals_retire_memory` waits for one named person's click, even in Auto (`accept_learning`).
|
|
40
|
+
- `vendor_send_notice` waits for one named person's click, even in Auto (`binding_send`).
|
|
41
|
+
- `ap_hold_payment` waits for one named person's click, even in Auto (`move_money`).
|
|
42
|
+
|
|
43
|
+
<!-- generated:start -->
|
|
44
|
+
|
|
45
|
+
## A demo run
|
|
46
|
+
|
|
47
|
+
`npx -y fairwire-contract-renewals demo` runs the agent on the fictional files in [`fixtures/`](fixtures) in a temporary folder. Captured output:
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
Fairwire Contract Renewals demo (fictional data) in a temporary folder, Auto on for the draft only
|
|
51
|
+
|
|
52
|
+
▶ Check the exported files
|
|
53
|
+
status: executed decision: allow
|
|
54
|
+
6 contract(s), 5 active worth 64000 a year, 4 auto-renewing: 10 open finding(s), 4 high.
|
|
55
|
+
high expired_still_paid Old Phone Co
|
|
56
|
+
high notice_deadline Example Backup Inc.
|
|
57
|
+
high notice_deadline Northwind Monitoring Ltd
|
|
58
|
+
high notice_deadline Contoso Helpdesk
|
|
59
|
+
medium notice_missed Tailspin Endpoint
|
|
60
|
+
medium overlapping_contracts Fabrikam Security
|
|
61
|
+
medium spend_over_contract Contoso Helpdesk
|
|
62
|
+
medium spend_without_contract Litware Cloud Storage
|
|
63
|
+
medium uplift_above_cap Northwind Monitoring Ltd
|
|
64
|
+
low no_owner Contoso Helpdesk
|
|
65
|
+
|
|
66
|
+
▶ Explain one finding
|
|
67
|
+
status: executed decision: allow
|
|
68
|
+
high notice_deadline: Northwind Monitoring Ltd contract CT-102 (Network monitoring) renews on 2027-01-31 unless notice is given by 2026-12-02 (14 days). Fix: Decide now whether to renew, renegotiate or cancel; send any notice in writing before the deadline.
|
|
69
|
+
medium uplift_above_cap: Northwind Monitoring Ltd contract CT-102 rises 9% at renewal, above your cap of 5%. Fix: Negotiate the rise before the notice deadline, with usage figures in hand.
|
|
70
|
+
|
|
71
|
+
▶ Write the worklist
|
|
72
|
+
status: executed decision: allow
|
|
73
|
+
IT contracts and renewals written: 6 contract(s), 5 active worth 64000 a year, 4 auto-renewing: 10 open finding(s), 4 high.
|
|
74
|
+
|
|
75
|
+
▶ Draft the note for a person
|
|
76
|
+
status: executed decision: allow (auto)
|
|
77
|
+
notice letter 2026-11-18 drafted with 1 open marker(s) ([TO CONFIRM each vendor's contract contact]). Nothing was sent.
|
|
78
|
+
|
|
79
|
+
▶ Auto: approving it still waits for one named person
|
|
80
|
+
status: needs_approval decision: ask
|
|
81
|
+
reason: binding_send stays one-click, even in Auto
|
|
82
|
+
|
|
83
|
+
▶ The agent tries to change the live system itself
|
|
84
|
+
status: blocked decision: block
|
|
85
|
+
reason: Fairwire Contract Renewals never sends a notice or signs a renewal; the contract owner sends the reviewed letter.
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Tools
|
|
89
|
+
|
|
90
|
+
| Tool | What it does | Policy |
|
|
91
|
+
|---|---|---|
|
|
92
|
+
| `renewals_check` | Review the contract register and payments and list notice deadlines, missed notices, uplifts, owners, overlaps and spend problems. | runs |
|
|
93
|
+
| `renewals_explain` | Every finding for one vendor or contract. | runs |
|
|
94
|
+
| `renewals_write_report` | Write contract-renewals.csv (one row per finding, with blank owner and decision columns) and contract-renewals.html, plus contract-renewals.ics (one reminder per date to act by) into out_dir (default fairwire-out/rene… | runs |
|
|
95
|
+
| `renewals_draft_notice_letter` | Write drafts/notice_letter-<date>.md: the open findings at or above min_severity (default medium), each with what to do, addressed to each vendor's contract contact. | asks first (Auto can be opted in) |
|
|
96
|
+
| `renewals_request_send` | After one named human click (even in Auto), record that the reviewed notice letter draft is approved in notice_letter-requests.csv. | one named click, even in Auto (`binding_send`) |
|
|
97
|
+
| `renewals_recall` | Search this agent's own memory of the customer's setup: accepted facts (in use) and facts waiting for a person. | runs |
|
|
98
|
+
| `renewals_learn` | Propose one fact about the customer's setup for this agent to remember. | runs |
|
|
99
|
+
| `renewals_accept_learning` | A named person accepts or rejects a fact waiting in this agent's memory. | one named click, even in Auto (`accept_learning`) |
|
|
100
|
+
| `renewals_retire_memory` | A named person stops an accepted fact from applying. | one named click, even in Auto (`accept_learning`) |
|
|
101
|
+
| `vendor_send_notice` | Fairwire Contract Renewals never sends a notice or signs a renewal; the contract owner sends the reviewed letter. | refused |
|
|
102
|
+
| `ap_hold_payment` | Fairwire Contract Renewals never stops, holds or makes a payment. | refused |
|
|
103
|
+
|
|
104
|
+
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.
|
|
105
|
+
|
|
106
|
+
## Columns it reads
|
|
107
|
+
|
|
108
|
+
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 and counts are read with either decimal mark. Every result lists under `sources` how each file was read.
|
|
109
|
+
|
|
110
|
+
### Contracts (`contracts`)
|
|
111
|
+
|
|
112
|
+
| Column | Type | Also read as | For example, in other languages |
|
|
113
|
+
|---|---|---|---|
|
|
114
|
+
| `contract_id` (required) | text | Contract ID, Contract, ID, Agreement, Reference | - |
|
|
115
|
+
| `vendor` (required) | text | Vendor, Supplier, Provider, Company | Lieferant, Fournisseur, 仕入先, 供应商 |
|
|
116
|
+
| `service` | text | Service, Product, Description, Category, Subject | Service, Service, サービス, 服务 |
|
|
117
|
+
| `owner` | text | Owner, Contract Owner, Business Owner, Responsible | Verantwortlich, Responsable, 担当者, 负责人 |
|
|
118
|
+
| `start_date` | date | Start Date, Start, Effective Date, Commencement | Eintrittsdatum, Date d'entrée, 入社日, 入职日期 |
|
|
119
|
+
| `end_date` (required) | date | End Date, End, Expiry, Renewal Date, Term End | Austrittsdatum, Date de sortie, 退職日, 离职日期 |
|
|
120
|
+
| `auto_renew` | text | Auto Renew, Auto-renewal, Evergreen, Renews Automatically | Automatische Verlängerung, Renouvellement automatique, 自動更新, 自动续费 |
|
|
121
|
+
| `notice_days` | number | Notice Days, Notice Period (days), Notice Period, Cancellation Notice | Kündigungsfrist (Tage), Préavis (jours), 解約予告期間(日), 通知期(天) |
|
|
122
|
+
| `annual_value` | amount | Annual Value, Annual Cost, Contract Value, Yearly Amount | - |
|
|
123
|
+
| `uplift_pct` | number | Uplift %, Price Increase %, Renewal Uplift, Escalation % | - |
|
|
124
|
+
|
|
125
|
+
### Vendor payments (`spend`)
|
|
126
|
+
|
|
127
|
+
| Column | Type | Also read as | For example, in other languages |
|
|
128
|
+
|---|---|---|---|
|
|
129
|
+
| `vendor` (required) | text | Vendor, Supplier, Payee, Vendor Name | Lieferant, Fournisseur, 仕入先, 供应商 |
|
|
130
|
+
| `amount` (required) | amount | Amount, Paid, Payment Amount, Total | Betrag, Montant, 金額, 金额 |
|
|
131
|
+
| `date` (required) | date | Date, Payment Date, Paid On, Invoice Date | Datum, Date, 日付, 日期 |
|
|
132
|
+
|
|
133
|
+
### Files from other countries
|
|
134
|
+
|
|
135
|
+
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. [`fixtures/intl/`](fixtures/intl) has both versions of the demo data, and the eval cases `intl-de-*` and `intl-ja-*` require the same results as the English case. Columns named differently? Run `npx fairwire-contract-renewals inspect <file>` (names and shapes only, never values) and name them in `fairwire-sources.json`:
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{ "files": { "exports/devices.csv": { "columns": { "host": "Gerätename" }, "date_order": "dmy" } } }
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Memory
|
|
142
|
+
|
|
143
|
+
fairwire-contract-renewals can remember facts about your setup so the next run does not have to be told again. `renewals_learn` only proposes a fact; it changes nothing until a named person accepts it with `renewals_accept_learning`, which is one click even in Auto. Facts live in one hash-chained file per agent under `.fairwire/memory/`; if the chain does not verify, no fact is used. Credentials, personal identifiers and text that reads like instructions to an AI are refused. Run without memory with `--no-memory`.
|
|
144
|
+
|
|
145
|
+
| Kind | What an accepted fact changes |
|
|
146
|
+
|---|---|
|
|
147
|
+
| `known_exception` | that finding is listed under "Accepted as known" instead of as open, until review_by (when given) has passed. |
|
|
148
|
+
| `note` | nothing (shown by recall only) |
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
fairwire-contract-renewals memory list
|
|
152
|
+
fairwire-contract-renewals memory accept MEM-1a2b3c4d5e6f --as "Your Name"
|
|
153
|
+
fairwire-contract-renewals memory retire MEM-1a2b3c4d5e6f --as "Your Name" --reason "rule removed"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
## Install
|
|
157
|
+
|
|
158
|
+
Node 20 or newer. No other dependencies.
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
npx -y fairwire-contract-renewals demo
|
|
162
|
+
npx -y fairwire-contract-renewals mcp --root /path/to/your/files
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Claude Desktop, Cursor and other MCP hosts:
|
|
166
|
+
|
|
167
|
+
```json
|
|
168
|
+
{
|
|
169
|
+
"mcpServers": {
|
|
170
|
+
"fairwire-contract-renewals": {
|
|
171
|
+
"command": "npx",
|
|
172
|
+
"args": [
|
|
173
|
+
"-y",
|
|
174
|
+
"fairwire-contract-renewals",
|
|
175
|
+
"mcp",
|
|
176
|
+
"--root",
|
|
177
|
+
"/path/to/your/files"
|
|
178
|
+
]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Claude Code: `claude mcp add fairwire-contract-renewals -- npx -y fairwire-contract-renewals mcp --root .`, or install the `fairwire-contract-renewals` plugin from this repository's marketplace.
|
|
185
|
+
|
|
186
|
+
## Modes and approvals
|
|
187
|
+
|
|
188
|
+
- **Review** (`--mode review`): reads and reports only.
|
|
189
|
+
- **Assist** (default): the policy above. A tool that asks returns an `approval_id`; a person approves it once with `fairwire-contract-renewals approve <id> --as "Your Name"` (or on the local approvals page, `fairwire-contract-renewals approvals`), and the same call is repeated.
|
|
190
|
+
- **Auto** (`--mode auto --auto <tool,...>`): opt-in per tool, with step caps and a kill switch (`fairwire-contract-renewals kill`). Paying, sending, posting to a ledger or a live system 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.
|
|
191
|
+
|
|
192
|
+
## CLI
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
fairwire-contract-renewals tools # every tool, its policy and arguments
|
|
196
|
+
fairwire-contract-renewals sources # the columns each input is read from
|
|
197
|
+
fairwire-contract-renewals inspect <file> # how a file would be read (names and shapes, never values)
|
|
198
|
+
fairwire-contract-renewals call renewals_check '{"contracts":"<contracts>"}'
|
|
199
|
+
fairwire-contract-renewals eval # the private eval cases on the fictional fixtures
|
|
200
|
+
fairwire-contract-renewals demo
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Audit log and data
|
|
204
|
+
|
|
205
|
+
Every call is written to `.fairwire/audit.jsonl` under the root: hash-chained JSON lines, with arguments stored as a hash, signed with an Ed25519 key when you configure one. Everything runs on your machine on files you choose. No network calls, no telemetry, no credentials. The bundled fixtures are fictional.
|
|
206
|
+
|
|
207
|
+
<!-- generated:end -->
|
|
208
|
+
|
|
209
|
+
## Limits
|
|
210
|
+
|
|
211
|
+
- Reads only the files you export and give it. It does not log in to a firewall, switch, controller, cloud console, identity provider or any other live system.
|
|
212
|
+
- Dates and notice periods are the ones in your register; the contract itself decides how notice must be given. Not legal advice.
|
|
213
|
+
- Vendor names are compared without legal forms (Inc, Ltd, GmbH); two different vendors with the same name can be merged.
|
|
214
|
+
- Thresholds are working defaults in a settings file you control; they are not a vendor rule, a requirement of any standard or a security guarantee.
|
|
215
|
+
- Results returned to the AI model have the names of people, sign-in names, e-mail addresses, phone numbers and client addresses masked. The files written here keep the real values: keep them in a secure folder.
|
|
216
|
+
- Export layouts were written from knowledge of common exports and have not been tested on live customer accounts. Run `inspect` on a new export and name columns in `fairwire-sources.json` when they differ.
|
|
217
|
+
|
|
218
|
+
## Licence
|
|
219
|
+
|
|
220
|
+
MIT. Fictional data only in `fixtures/`.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { main } from 'fairwire-core';
|
|
4
|
+
import { manifest } from '../src/manifest.js';
|
|
5
|
+
import { demo } from '../src/demo.js';
|
|
6
|
+
|
|
7
|
+
main(manifest, { bin: 'fairwire-contract-renewals', demo, evalFile: fileURLToPath(new URL('../evals/cases.json', import.meta.url)) });
|
package/evals/cases.json
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
{
|
|
2
|
+
"suite": "fairwire-contract-renewals",
|
|
3
|
+
"root": "..",
|
|
4
|
+
"data_note": "Fictional contracts and payments in ../fixtures, as of 2026-11-18. No model is called.",
|
|
5
|
+
"cases": [
|
|
6
|
+
{
|
|
7
|
+
"id": "check-totals",
|
|
8
|
+
"tool": "renewals_check",
|
|
9
|
+
"args": {
|
|
10
|
+
"contracts": "fixtures/contracts.csv",
|
|
11
|
+
"spend": "fixtures/spend.csv",
|
|
12
|
+
"settings": "fixtures/settings.json",
|
|
13
|
+
"as_of": "2026-11-18"
|
|
14
|
+
},
|
|
15
|
+
"expect": {
|
|
16
|
+
"equals": {
|
|
17
|
+
"result.contracts": 6,
|
|
18
|
+
"result.active": 5,
|
|
19
|
+
"result.annual_value": 64000,
|
|
20
|
+
"result.auto_renewing": 4,
|
|
21
|
+
"result.open": 10,
|
|
22
|
+
"result.high": 4
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"id": "every-planted-issue",
|
|
28
|
+
"tool": "renewals_check",
|
|
29
|
+
"args": {
|
|
30
|
+
"contracts": "fixtures/contracts.csv",
|
|
31
|
+
"spend": "fixtures/spend.csv",
|
|
32
|
+
"settings": "fixtures/settings.json",
|
|
33
|
+
"as_of": "2026-11-18"
|
|
34
|
+
},
|
|
35
|
+
"expect": {
|
|
36
|
+
"contains": [
|
|
37
|
+
"notice_deadline",
|
|
38
|
+
"2026-12-01",
|
|
39
|
+
"notice_missed",
|
|
40
|
+
"2026-10-02",
|
|
41
|
+
"uplift_above_cap",
|
|
42
|
+
"9%",
|
|
43
|
+
"no_owner",
|
|
44
|
+
"overlapping_contracts",
|
|
45
|
+
"spend_over_contract",
|
|
46
|
+
"18500",
|
|
47
|
+
"spend_without_contract",
|
|
48
|
+
"Litware",
|
|
49
|
+
"expired_still_paid",
|
|
50
|
+
"Old Phone Co"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"id": "calendar-of-deadlines",
|
|
56
|
+
"tool": "renewals_write_report",
|
|
57
|
+
"args": {
|
|
58
|
+
"contracts": "fixtures/contracts.csv",
|
|
59
|
+
"spend": "fixtures/spend.csv",
|
|
60
|
+
"settings": "fixtures/settings.json",
|
|
61
|
+
"as_of": "2026-11-18"
|
|
62
|
+
},
|
|
63
|
+
"expect": {
|
|
64
|
+
"status": "executed",
|
|
65
|
+
"length": {
|
|
66
|
+
"result.files": 3
|
|
67
|
+
},
|
|
68
|
+
"contains": [
|
|
69
|
+
"contract-renewals.ics"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
"id": "contracts-only-earlier",
|
|
75
|
+
"tool": "renewals_check",
|
|
76
|
+
"args": {
|
|
77
|
+
"contracts": "fixtures/contracts.csv",
|
|
78
|
+
"as_of": "2026-09-01"
|
|
79
|
+
},
|
|
80
|
+
"expect": {
|
|
81
|
+
"contains": [
|
|
82
|
+
"CT-105"
|
|
83
|
+
],
|
|
84
|
+
"not_contains": [
|
|
85
|
+
"spend_",
|
|
86
|
+
"expired_still_paid",
|
|
87
|
+
"notice_missed"
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"id": "explain-northwind",
|
|
93
|
+
"tool": "renewals_explain",
|
|
94
|
+
"args": {
|
|
95
|
+
"contracts": "fixtures/contracts.csv",
|
|
96
|
+
"spend": "fixtures/spend.csv",
|
|
97
|
+
"settings": "fixtures/settings.json",
|
|
98
|
+
"as_of": "2026-11-18",
|
|
99
|
+
"vendor": "CT-102"
|
|
100
|
+
},
|
|
101
|
+
"expect": {
|
|
102
|
+
"contains": [
|
|
103
|
+
"notice_deadline",
|
|
104
|
+
"uplift_above_cap"
|
|
105
|
+
],
|
|
106
|
+
"equals": {
|
|
107
|
+
"result.findings": 2
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
"id": "draft-after-approval",
|
|
113
|
+
"tool": "renewals_draft_notice_letter",
|
|
114
|
+
"approve": "Pat Example",
|
|
115
|
+
"args": {
|
|
116
|
+
"contracts": "fixtures/contracts.csv",
|
|
117
|
+
"spend": "fixtures/spend.csv",
|
|
118
|
+
"settings": "fixtures/settings.json",
|
|
119
|
+
"as_of": "2026-11-18",
|
|
120
|
+
"min_severity": "high"
|
|
121
|
+
},
|
|
122
|
+
"expect": {
|
|
123
|
+
"status": "executed",
|
|
124
|
+
"contains": [
|
|
125
|
+
"Nothing was sent"
|
|
126
|
+
],
|
|
127
|
+
"equals": {
|
|
128
|
+
"result.items": 4,
|
|
129
|
+
"result.open_markers": 1
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"id": "review-mode-still-reads",
|
|
135
|
+
"tool": "renewals_check",
|
|
136
|
+
"mode": "review",
|
|
137
|
+
"args": {
|
|
138
|
+
"contracts": "fixtures/contracts.csv",
|
|
139
|
+
"spend": "fixtures/spend.csv",
|
|
140
|
+
"settings": "fixtures/settings.json",
|
|
141
|
+
"as_of": "2026-11-18"
|
|
142
|
+
},
|
|
143
|
+
"expect": {
|
|
144
|
+
"status": "executed",
|
|
145
|
+
"equals": {
|
|
146
|
+
"result.contracts": 6,
|
|
147
|
+
"result.active": 5,
|
|
148
|
+
"result.annual_value": 64000,
|
|
149
|
+
"result.auto_renewing": 4,
|
|
150
|
+
"result.open": 10,
|
|
151
|
+
"result.high": 4
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
"generated": true
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
"id": "severity-filter",
|
|
158
|
+
"tool": "renewals_check",
|
|
159
|
+
"args": {
|
|
160
|
+
"contracts": "fixtures/contracts.csv",
|
|
161
|
+
"spend": "fixtures/spend.csv",
|
|
162
|
+
"settings": "fixtures/settings.json",
|
|
163
|
+
"as_of": "2026-11-18",
|
|
164
|
+
"severity": "high"
|
|
165
|
+
},
|
|
166
|
+
"expect": {
|
|
167
|
+
"status": "executed",
|
|
168
|
+
"equals": {
|
|
169
|
+
"result.findings": 4
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
"generated": true
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"id": "missing-argument-named",
|
|
176
|
+
"tool": "renewals_check",
|
|
177
|
+
"args": {},
|
|
178
|
+
"expect": {
|
|
179
|
+
"status": "error",
|
|
180
|
+
"contains": [
|
|
181
|
+
"contracts"
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
"generated": true
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"id": "file-outside-root-refused",
|
|
188
|
+
"tool": "renewals_check",
|
|
189
|
+
"args": {
|
|
190
|
+
"contracts": "../../../outside.csv",
|
|
191
|
+
"spend": "fixtures/spend.csv",
|
|
192
|
+
"settings": "fixtures/settings.json",
|
|
193
|
+
"as_of": "2026-11-18"
|
|
194
|
+
},
|
|
195
|
+
"expect": {
|
|
196
|
+
"status": "error",
|
|
197
|
+
"contains": [
|
|
198
|
+
"outside"
|
|
199
|
+
]
|
|
200
|
+
},
|
|
201
|
+
"generated": true
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
"id": "invented-tool-name-refused",
|
|
205
|
+
"tool": "renewals_apply_every_fix_now",
|
|
206
|
+
"args": {},
|
|
207
|
+
"expect": {
|
|
208
|
+
"status": "blocked"
|
|
209
|
+
},
|
|
210
|
+
"generated": true
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
"id": "write-report-writes-files",
|
|
214
|
+
"tool": "renewals_write_report",
|
|
215
|
+
"args": {
|
|
216
|
+
"contracts": "fixtures/contracts.csv",
|
|
217
|
+
"spend": "fixtures/spend.csv",
|
|
218
|
+
"settings": "fixtures/settings.json",
|
|
219
|
+
"as_of": "2026-11-18"
|
|
220
|
+
},
|
|
221
|
+
"expect": {
|
|
222
|
+
"status": "executed",
|
|
223
|
+
"contains": [
|
|
224
|
+
"contract-renewals.csv",
|
|
225
|
+
"contract-renewals.html"
|
|
226
|
+
]
|
|
227
|
+
},
|
|
228
|
+
"generated": true
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"id": "recall-memory-starts-empty",
|
|
232
|
+
"tool": "renewals_recall",
|
|
233
|
+
"args": {},
|
|
234
|
+
"expect": {
|
|
235
|
+
"status": "executed",
|
|
236
|
+
"contains": [
|
|
237
|
+
"memory is empty"
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
"generated": true
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
"id": "accept-learning-stays-one-click",
|
|
244
|
+
"tool": "renewals_accept_learning",
|
|
245
|
+
"mode": "auto",
|
|
246
|
+
"args": {
|
|
247
|
+
"id": "MEM-000000000000",
|
|
248
|
+
"decision": "accept"
|
|
249
|
+
},
|
|
250
|
+
"expect": {
|
|
251
|
+
"status": "needs_approval"
|
|
252
|
+
},
|
|
253
|
+
"generated": true
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
"id": "never-vendor-send-notice",
|
|
257
|
+
"tool": "vendor_send_notice",
|
|
258
|
+
"mode": "auto",
|
|
259
|
+
"args": {},
|
|
260
|
+
"expect": {
|
|
261
|
+
"status": "blocked"
|
|
262
|
+
},
|
|
263
|
+
"generated": true
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
"id": "never-ap-hold-payment",
|
|
267
|
+
"tool": "ap_hold_payment",
|
|
268
|
+
"mode": "auto",
|
|
269
|
+
"args": {},
|
|
270
|
+
"expect": {
|
|
271
|
+
"status": "blocked"
|
|
272
|
+
},
|
|
273
|
+
"generated": true
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
"id": "draft-waits-for-a-person",
|
|
277
|
+
"tool": "renewals_draft_notice_letter",
|
|
278
|
+
"args": {
|
|
279
|
+
"contracts": "fixtures/contracts.csv",
|
|
280
|
+
"spend": "fixtures/spend.csv",
|
|
281
|
+
"settings": "fixtures/settings.json",
|
|
282
|
+
"as_of": "2026-11-18",
|
|
283
|
+
"min_severity": "high"
|
|
284
|
+
},
|
|
285
|
+
"expect": {
|
|
286
|
+
"status": "needs_approval",
|
|
287
|
+
"decision": "ask"
|
|
288
|
+
},
|
|
289
|
+
"generated": true
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"id": "review-mode-drafts-nothing",
|
|
293
|
+
"tool": "renewals_draft_notice_letter",
|
|
294
|
+
"mode": "review",
|
|
295
|
+
"args": {
|
|
296
|
+
"contracts": "fixtures/contracts.csv",
|
|
297
|
+
"spend": "fixtures/spend.csv",
|
|
298
|
+
"settings": "fixtures/settings.json",
|
|
299
|
+
"as_of": "2026-11-18",
|
|
300
|
+
"min_severity": "high"
|
|
301
|
+
},
|
|
302
|
+
"expect": {
|
|
303
|
+
"status": "blocked"
|
|
304
|
+
},
|
|
305
|
+
"generated": true
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
"id": "request-stays-one-click",
|
|
309
|
+
"tool": "renewals_request_send",
|
|
310
|
+
"mode": "auto",
|
|
311
|
+
"args": {
|
|
312
|
+
"draft": "fixtures/README.md",
|
|
313
|
+
"draft_sha256": "0000000000000000000000000000000000000000000000000000000000000000"
|
|
314
|
+
},
|
|
315
|
+
"expect": {
|
|
316
|
+
"status": "needs_approval"
|
|
317
|
+
},
|
|
318
|
+
"generated": true
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
"id": "intl-de-check-totals",
|
|
322
|
+
"tool": "renewals_check",
|
|
323
|
+
"args": {
|
|
324
|
+
"contracts": "fixtures/intl/de/contracts.csv",
|
|
325
|
+
"spend": "fixtures/intl/de/spend.csv",
|
|
326
|
+
"settings": "fixtures/settings.json",
|
|
327
|
+
"as_of": "2026-11-18"
|
|
328
|
+
},
|
|
329
|
+
"expect": {
|
|
330
|
+
"equals": {
|
|
331
|
+
"result.contracts": 6,
|
|
332
|
+
"result.active": 5,
|
|
333
|
+
"result.annual_value": 64000,
|
|
334
|
+
"result.auto_renewing": 4,
|
|
335
|
+
"result.open": 10,
|
|
336
|
+
"result.high": 4
|
|
337
|
+
}
|
|
338
|
+
},
|
|
339
|
+
"note": "German export of the same data (fixtures/intl/de); must match the English case \"check-totals\"."
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
"id": "intl-ja-check-totals",
|
|
343
|
+
"tool": "renewals_check",
|
|
344
|
+
"args": {
|
|
345
|
+
"contracts": "fixtures/intl/ja/contracts.csv",
|
|
346
|
+
"spend": "fixtures/intl/ja/spend.csv",
|
|
347
|
+
"settings": "fixtures/settings.json",
|
|
348
|
+
"as_of": "2026-11-18"
|
|
349
|
+
},
|
|
350
|
+
"expect": {
|
|
351
|
+
"equals": {
|
|
352
|
+
"result.contracts": 6,
|
|
353
|
+
"result.active": 5,
|
|
354
|
+
"result.annual_value": 64000,
|
|
355
|
+
"result.auto_renewing": 4,
|
|
356
|
+
"result.open": 10,
|
|
357
|
+
"result.high": 4
|
|
358
|
+
}
|
|
359
|
+
},
|
|
360
|
+
"note": "Japanese export of the same data (fixtures/intl/ja); must match the English case \"check-totals\"."
|
|
361
|
+
}
|
|
362
|
+
]
|
|
363
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Fairwire Contract Renewals fixtures
|
|
2
|
+
|
|
3
|
+
Fictional IT contracts and payments (made-up vendors and owners), read as of 18 November 2026.
|
|
4
|
+
|
|
5
|
+
- `contracts.csv`: 6 contracts. Three auto-renewing contracts have notice deadlines on 30 November, 1 and 2 December; network monitoring also rises 9%; the service desk contract has no owner; a second endpoint protection contract overlaps the first, and its own notice date passed on 2 October; the telephony contract ended on 30 September.
|
|
6
|
+
- `spend.csv`: payments in 2026. The service desk tool was paid 18,500 against 15,000 a year; the old phone company was paid after its contract ended; Litware Cloud Storage has no contract.
|
|
7
|
+
- `settings.json`: 60 days look-ahead, 5% uplift cap.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
contract_id,vendor,service,owner,start_date,end_date,auto_renew,notice_days,annual_value,uplift_pct
|
|
2
|
+
CT-101,Example Backup Inc.,Backup service,Ana Ortiz,2024-01-01,2026-12-31,yes,30,12000,3
|
|
3
|
+
CT-102,Northwind Monitoring Ltd,Network monitoring,Ben Kim,2025-02-01,2027-01-31,yes,60,8000,9
|
|
4
|
+
CT-103,Contoso Helpdesk,Service desk tool,,2024-03-01,2027-02-28,yes,90,15000,4
|
|
5
|
+
CT-104,Fabrikam Security,Endpoint protection,Cy Diaz,2025-06-01,2027-05-31,no,0,20000,0
|
|
6
|
+
CT-105,Tailspin Endpoint,Endpoint protection,Cy Diaz,2026-01-01,2026-12-31,yes,90,9000,5
|
|
7
|
+
CT-106,Old Phone Co,Telephony,Dee Lee,2023-01-01,2026-09-30,no,0,6000,0
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Fixtures from other countries
|
|
2
|
+
|
|
3
|
+
Generated by `node scripts/make-intl-fixtures.mjs` from the English fixtures one
|
|
4
|
+
folder up. The same fictional data, written the way a local export writes it:
|
|
5
|
+
|
|
6
|
+
- `de/`: German column names, Windows-1252 text, semicolons, comma decimals
|
|
7
|
+
(1.234,56), day-first dotted dates (03.11.2026), kilograms and kilometres.
|
|
8
|
+
- `ja/`: Japanese column names, Shift_JIS text, year-first dates (2026/11/03),
|
|
9
|
+
kilograms and kilometres.
|
|
10
|
+
|
|
11
|
+
Values (names, codes, charge wording) stay in English. The eval cases
|
|
12
|
+
`intl-de-*` and `intl-ja-*` expect exactly the same results as the English case.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
contract_id;Lieferant;Serviceart;Verantwortlich;Eintrittsdatum;Austrittsdatum;Automatische Verl�ngerung;K�ndigungsfrist (Tage);annual_value;uplift_pct
|
|
2
|
+
CT-101;Example Backup Inc.;Backup service;Ana Ortiz;01.01.2024;31.12.2026;yes;30;12.000,00;3
|
|
3
|
+
CT-102;Northwind Monitoring Ltd;Network monitoring;Ben Kim;01.02.2025;31.01.2027;yes;60;8.000,00;9
|
|
4
|
+
CT-103;Contoso Helpdesk;Service desk tool;;01.03.2024;28.02.2027;yes;90;15.000,00;4
|
|
5
|
+
CT-104;Fabrikam Security;Endpoint protection;Cy Diaz;01.06.2025;31.05.2027;no;0;20.000,00;0
|
|
6
|
+
CT-105;Tailspin Endpoint;Endpoint protection;Cy Diaz;01.01.2026;31.12.2026;yes;90;9.000,00;5
|
|
7
|
+
CT-106;Old Phone Co;Telephony;Dee Lee;01.01.2023;30.09.2026;no;0;6.000,00;0
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Lieferant;Betrag;Datum
|
|
2
|
+
Example Backup Inc;3.000,00;31.03.2026
|
|
3
|
+
Example Backup Inc;3.000,00;30.06.2026
|
|
4
|
+
Example Backup Inc;3.000,00;30.09.2026
|
|
5
|
+
Northwind Monitoring;2.000,00;01.05.2026
|
|
6
|
+
Northwind Monitoring;2.000,00;01.08.2026
|
|
7
|
+
Contoso Helpdesk;9.000,00;01.03.2026
|
|
8
|
+
Contoso Helpdesk;9.500,00;01.09.2026
|
|
9
|
+
Old Phone Co;500,00;15.10.2026
|
|
10
|
+
Old Phone Co;500,00;15.11.2026
|
|
11
|
+
Litware Cloud Storage;1.200,00;01.07.2026
|
|
12
|
+
Litware Cloud Storage;1.200,00;01.10.2026
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
contract_id,�d����,�T�[�r�X,�S����,���Г�,�ސE��,�����X�V,���\�����ԁi���j,annual_value,uplift_pct
|
|
2
|
+
CT-101,Example Backup Inc.,Backup service,Ana Ortiz,2024/01/01,2026/12/31,yes,30,"12,000.00",3
|
|
3
|
+
CT-102,Northwind Monitoring Ltd,Network monitoring,Ben Kim,2025/02/01,2027/01/31,yes,60,"8,000.00",9
|
|
4
|
+
CT-103,Contoso Helpdesk,Service desk tool,,2024/03/01,2027/02/28,yes,90,"15,000.00",4
|
|
5
|
+
CT-104,Fabrikam Security,Endpoint protection,Cy Diaz,2025/06/01,2027/05/31,no,0,"20,000.00",0
|
|
6
|
+
CT-105,Tailspin Endpoint,Endpoint protection,Cy Diaz,2026/01/01,2026/12/31,yes,90,"9,000.00",5
|
|
7
|
+
CT-106,Old Phone Co,Telephony,Dee Lee,2023/01/01,2026/09/30,no,0,"6,000.00",0
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
�d����,���z,���t
|
|
2
|
+
Example Backup Inc,"3,000.00",2026/03/31
|
|
3
|
+
Example Backup Inc,"3,000.00",2026/06/30
|
|
4
|
+
Example Backup Inc,"3,000.00",2026/09/30
|
|
5
|
+
Northwind Monitoring,"2,000.00",2026/05/01
|
|
6
|
+
Northwind Monitoring,"2,000.00",2026/08/01
|
|
7
|
+
Contoso Helpdesk,"9,000.00",2026/03/01
|
|
8
|
+
Contoso Helpdesk,"9,500.00",2026/09/01
|
|
9
|
+
Old Phone Co,500.00,2026/10/15
|
|
10
|
+
Old Phone Co,500.00,2026/11/15
|
|
11
|
+
Litware Cloud Storage,"1,200.00",2026/07/01
|
|
12
|
+
Litware Cloud Storage,"1,200.00",2026/10/01
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
vendor,amount,date
|
|
2
|
+
Example Backup Inc,3000,2026-03-31
|
|
3
|
+
Example Backup Inc,3000,2026-06-30
|
|
4
|
+
Example Backup Inc,3000,2026-09-30
|
|
5
|
+
Northwind Monitoring,2000,2026-05-01
|
|
6
|
+
Northwind Monitoring,2000,2026-08-01
|
|
7
|
+
Contoso Helpdesk,9000,2026-03-01
|
|
8
|
+
Contoso Helpdesk,9500,2026-09-01
|
|
9
|
+
Old Phone Co,500,2026-10-15
|
|
10
|
+
Old Phone Co,500,2026-11-15
|
|
11
|
+
Litware Cloud Storage,1200,2026-07-01
|
|
12
|
+
Litware Cloud Storage,1200,2026-10-01
|
package/package.json
CHANGED
|
@@ -1,6 +1,59 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fairwire-contract-renewals",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"mcpName": "io.github.fpavia111-creator/fairwire-contract-renewals",
|
|
5
|
+
"description": "Fairwire Contract Renewals: IT contracts and renewals: notice deadlines for auto-renewing contracts, price rises above your cap, contracts with no owner, two contracts for the same service, vendors paid with no contract on file and spend above the contract value. Writes a renewal calendar and drafts notice letters for a person to send.",
|
|
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
|
+
"fairwire-contract-renewals": "bin/fairwire-contract-renewals.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/fairwire-contract-renewals.js demo",
|
|
33
|
+
"eval": "node bin/fairwire-contract-renewals.js eval"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"fairwire-core": "^0.1.0"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/fpavia111-creator/fairwire-agents.git",
|
|
41
|
+
"directory": "packages/fairwire-contract-renewals"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/fpavia111-creator/fairwire-agents/tree/master/packages/fairwire-contract-renewals#readme",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/fpavia111-creator/fairwire-agents/issues"
|
|
46
|
+
},
|
|
47
|
+
"keywords": [
|
|
48
|
+
"mcp",
|
|
49
|
+
"mcp-server",
|
|
50
|
+
"it-operations",
|
|
51
|
+
"network",
|
|
52
|
+
"fairwire",
|
|
53
|
+
"contract-management",
|
|
54
|
+
"it-procurement",
|
|
55
|
+
"renewals",
|
|
56
|
+
"vendor-management",
|
|
57
|
+
"auto-renewal"
|
|
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/fairwire-contract-renewals",
|
|
4
|
+
"title": "Fairwire Contract Renewals",
|
|
5
|
+
"description": "Fairwire Contract Renewals: IT contracts and renewals: notice deadlines for auto-renewing…",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"url": "https://github.com/fpavia111-creator/fairwire-agents",
|
|
9
|
+
"source": "github",
|
|
10
|
+
"subfolder": "packages/fairwire-contract-renewals"
|
|
11
|
+
},
|
|
12
|
+
"websiteUrl": "https://fair-agents.com/fairwire.html",
|
|
13
|
+
"packages": [
|
|
14
|
+
{
|
|
15
|
+
"registryType": "npm",
|
|
16
|
+
"identifier": "fairwire-contract-renewals",
|
|
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,19 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { standardDemo } from 'fairwire-core';
|
|
4
|
+
|
|
5
|
+
// The demo runs the eval case "check-totals" and the agent's draft on the fictional fixtures.
|
|
6
|
+
const cases = JSON.parse(readFileSync(new URL('../evals/cases.json', import.meta.url), 'utf8')).cases;
|
|
7
|
+
const base = cases.find((c) => c.id === 'check-totals');
|
|
8
|
+
const explain = cases.find((c) => /_explain$/.test(c.tool) && !c.expect.status);
|
|
9
|
+
const draft = cases.find((c) => /_draft_/.test(c.tool) && c.approve);
|
|
10
|
+
|
|
11
|
+
export async function demo(manifest) {
|
|
12
|
+
const refused = manifest.tools.filter((t) => (manifest.policy.rules.find((r) => r.tool === t.name) || {}).decision === 'block')[0];
|
|
13
|
+
await standardDemo(manifest, fileURLToPath(new URL('../fixtures', import.meta.url)), {
|
|
14
|
+
title: 'Fairwire Contract Renewals demo', args: base.args,
|
|
15
|
+
explain: explain ? { label: 'Explain one finding', args: explain.args } : null,
|
|
16
|
+
draft: draft ? { label: 'Draft the note for a person', args: draft.args } : null,
|
|
17
|
+
refused: refused ? refused.name : null,
|
|
18
|
+
});
|
|
19
|
+
}
|
package/src/index.js
ADDED
package/src/logic.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Fairwire Contract Renewals: IT contracts, notice deadlines and spend against contracts. Pure functions.
|
|
2
|
+
import { num, str, low, yes, isoDate, addDays, daysBetween, round2, finding } from 'fairwire-core';
|
|
3
|
+
|
|
4
|
+
export const CHECKS = Object.freeze({
|
|
5
|
+
notice_deadline: 'An auto-renewing contract whose notice deadline (end date minus notice period) falls inside your look-ahead window.',
|
|
6
|
+
expired_still_paid: 'Payments to a vendor after its contract ended.',
|
|
7
|
+
notice_missed: 'The notice deadline has passed, so the contract will renew unless the vendor agrees otherwise.',
|
|
8
|
+
uplift_above_cap: 'A renewal price rise above your cap.',
|
|
9
|
+
spend_over_contract: 'Payments to a vendor in the last 12 months above the contract value by more than your margin.',
|
|
10
|
+
spend_without_contract: 'A vendor paid in the last 12 months with no contract on file.',
|
|
11
|
+
overlapping_contracts: 'Two contracts for the same service running at the same time.',
|
|
12
|
+
no_owner: 'A contract with no owner, so nobody decides about its renewal.',
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export const CONTRACT_FIELDS = Object.freeze({
|
|
16
|
+
contract_id: { aliases: ['Contract ID', 'Contract', 'ID', 'Agreement', 'Reference'], required: true },
|
|
17
|
+
vendor: { aliases: ['Vendor', 'Supplier', 'Provider', 'Company'], required: true },
|
|
18
|
+
service: { aliases: ['Service', 'Product', 'Description', 'Category', 'Subject'] },
|
|
19
|
+
owner: { aliases: ['Owner', 'Contract Owner', 'Business Owner', 'Responsible'], pii: 'name' },
|
|
20
|
+
start_date: { type: 'date', aliases: ['Start Date', 'Start', 'Effective Date', 'Commencement'] },
|
|
21
|
+
end_date: { type: 'date', aliases: ['End Date', 'End', 'Expiry', 'Renewal Date', 'Term End'], required: true },
|
|
22
|
+
auto_renew: { aliases: ['Auto Renew', 'Auto-renewal', 'Evergreen', 'Renews Automatically'] },
|
|
23
|
+
notice_days: { type: 'number', aliases: ['Notice Days', 'Notice Period (days)', 'Notice Period', 'Cancellation Notice'] },
|
|
24
|
+
annual_value: { type: 'money', aliases: ['Annual Value', 'Annual Cost', 'Contract Value', 'Yearly Amount'] },
|
|
25
|
+
uplift_pct: { type: 'number', aliases: ['Uplift %', 'Price Increase %', 'Renewal Uplift', 'Escalation %'] },
|
|
26
|
+
});
|
|
27
|
+
export const SPEND_FIELDS = Object.freeze({
|
|
28
|
+
vendor: { aliases: ['Vendor', 'Supplier', 'Payee', 'Vendor Name'], required: true },
|
|
29
|
+
amount: { type: 'money', aliases: ['Amount', 'Paid', 'Payment Amount', 'Total'], required: true },
|
|
30
|
+
date: { type: 'date', aliases: ['Date', 'Payment Date', 'Paid On', 'Invoice Date'], required: true },
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
export const SETTINGS_SCHEMA = { type: 'object', additionalProperties: false, properties: {
|
|
34
|
+
lookahead_days: { type: 'integer', minimum: 1, description: 'Days ahead to look for notice deadlines (default 60)' },
|
|
35
|
+
urgent_days: { type: 'integer', minimum: 1, description: 'Notice deadlines this close are high (default 14)' },
|
|
36
|
+
uplift_cap_pct: { type: 'number', minimum: 0, description: 'Largest renewal price rise you accept, in percent (default 5)' },
|
|
37
|
+
spend_margin_pct: { type: 'number', minimum: 0, description: 'Margin over the contract value before spend is flagged, in percent (default 10)' },
|
|
38
|
+
} };
|
|
39
|
+
export const DEFAULTS = Object.freeze({ lookahead_days: 60, urgent_days: 14, uplift_cap_pct: 5, spend_margin_pct: 10 });
|
|
40
|
+
|
|
41
|
+
const vkey = (v) => low(v).replace(/[.,]/g, '').replace(/\b(inc|llc|ltd|limited|corp|corporation|gmbh|co)\b/g, '').replace(/\s+/g, ' ').trim();
|
|
42
|
+
|
|
43
|
+
export function reviewContracts(contractRows, spendRows = [], settings = {}, asOf) {
|
|
44
|
+
const s = { ...DEFAULTS, ...settings };
|
|
45
|
+
const cs = contractRows.filter((r) => str(r.contract_id) && str(r.vendor) && isoDate(r.end_date)).map((r) => ({ id: str(r.contract_id), vendor: str(r.vendor), vk: vkey(r.vendor), service: str(r.service), owner: str(r.owner), start: isoDate(r.start_date), end: isoDate(r.end_date), auto: yes(r.auto_renew) === true, notice: num(r.notice_days) || 0, value: num(r.annual_value), uplift: num(r.uplift_pct) }));
|
|
46
|
+
const items = []; const deadlines = [];
|
|
47
|
+
for (const c of cs) {
|
|
48
|
+
const deadline = addDays(c.end, -c.notice); const left = asOf ? daysBetween(asOf, deadline) : null; const active = !asOf || c.end >= asOf;
|
|
49
|
+
if (c.auto && active && left !== null) {
|
|
50
|
+
if (left >= 0 && left <= s.lookahead_days) { deadlines.push({ id: c.id, vendor: c.vendor, deadline }); items.push(finding('notice_deadline', left <= s.urgent_days ? 'high' : 'medium', c.id, `${c.vendor} contract ${c.id}${c.service ? ` (${c.service})` : ''} renews on ${c.end} unless notice is given by ${deadline} (${left} days).`, 'Decide now whether to renew, renegotiate or cancel; send any notice in writing before the deadline.', { subject: c.vendor, deadline })); }
|
|
51
|
+
else if (left < 0) items.push(finding('notice_missed', 'medium', c.id, `The notice deadline for ${c.vendor} contract ${c.id} passed on ${deadline}; it renews on ${c.end}.`, 'Ask the vendor for a shorter renewal or a cancellation by agreement, and diary the next deadline.', { subject: c.vendor }));
|
|
52
|
+
else if (left > s.lookahead_days) deadlines.push({ id: c.id, vendor: c.vendor, deadline });
|
|
53
|
+
}
|
|
54
|
+
if (active && c.uplift !== null && c.uplift > s.uplift_cap_pct) items.push(finding('uplift_above_cap', 'medium', c.id, `${c.vendor} contract ${c.id} rises ${c.uplift}% at renewal, above your cap of ${s.uplift_cap_pct}%.`, 'Negotiate the rise before the notice deadline, with usage figures in hand.', { subject: c.vendor }));
|
|
55
|
+
if (active && !c.owner) items.push(finding('no_owner', 'low', c.id, `${c.vendor} contract ${c.id} has no owner.`, 'Name the person who decides on its renewal.', { subject: c.vendor }));
|
|
56
|
+
}
|
|
57
|
+
const live = cs.filter((c) => !asOf || c.end >= asOf);
|
|
58
|
+
const bySvc = new Map(); for (const c of live) if (c.service) bySvc.set(low(c.service), [...(bySvc.get(low(c.service)) || []), c]);
|
|
59
|
+
for (const [, list0] of bySvc) if (list0.length > 1) { const list = [...list0].sort((a, b) => (a.id < b.id ? -1 : 1)); const ids = list.map((c) => c.id).sort(); items.push(finding('overlapping_contracts', 'medium', ids.join('+'), `${list.length} contracts cover ${list[0].service} at once (${list.map((c) => `${c.id} with ${c.vendor}`).sort().join(', ')}).`, 'Keep one and plan the exit from the other at its next notice date.', { subject: list[0].vendor })); }
|
|
60
|
+
const year = asOf ? addDays(asOf, -365) : null;
|
|
61
|
+
const sp = spendRows.filter((r) => str(r.vendor) && isoDate(r.date)).map((r) => ({ vendor: str(r.vendor), vk: vkey(r.vendor), amount: num(r.amount) || 0, date: isoDate(r.date) })).filter((p) => !year || p.date >= year);
|
|
62
|
+
const byV = new Map(); for (const p of sp) byV.set(p.vk, [...(byV.get(p.vk) || []), p]);
|
|
63
|
+
for (const [vk, pays0] of byV) { const pays = [...pays0].sort((a, b) => (a.vendor < b.vendor ? -1 : a.vendor > b.vendor ? 1 : a.date < b.date ? -1 : 1));
|
|
64
|
+
const total = round2(pays.reduce((t, p) => t + p.amount, 0)); const mine = cs.filter((c) => c.vk === vk);
|
|
65
|
+
if (!mine.length) { items.push(finding('spend_without_contract', 'medium', pays[0].vendor, `${pays[0].vendor} was paid ${total} in the last 12 months with no contract on file.`, 'Find the contract or order form and add it, or move the spend to a contracted vendor.', { subject: pays[0].vendor, amount: total })); continue; }
|
|
66
|
+
const lastEnd = mine.map((c) => c.end).sort().at(-1); const after = pays.filter((p) => p.date > lastEnd);
|
|
67
|
+
if (after.length) items.push(finding('expired_still_paid', 'high', pays[0].vendor, `${pays[0].vendor} was paid ${round2(after.reduce((t, p) => t + p.amount, 0))} after its last contract ended on ${lastEnd}.`, 'Stop further payments until a contract is in place, or confirm the renewal paperwork exists.', { subject: pays[0].vendor }));
|
|
68
|
+
const value = mine.filter((c) => c.value !== null).reduce((t, c) => t + c.value, 0);
|
|
69
|
+
if (value && total > value * (1 + s.spend_margin_pct / 100)) items.push(finding('spend_over_contract', 'medium', pays[0].vendor, `${pays[0].vendor} was paid ${total} in the last 12 months against contracts worth ${value} a year.`, 'Check the invoices for extra charges, usage overages or a price that does not match the contract.', { subject: pays[0].vendor, amount: round2(total - value) }));
|
|
70
|
+
}
|
|
71
|
+
return { contracts: cs.length, active: live.length, annual_value: round2(live.reduce((t, c) => t + (c.value || 0), 0)), auto_renewing: live.filter((c) => c.auto).length, deadlines: deadlines.sort((a, b) => (a.deadline < b.deadline ? -1 : a.deadline > b.deadline ? 1 : a.id < b.id ? -1 : 1)), items };
|
|
72
|
+
}
|
package/src/manifest.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { wireAgent, fileArg, SETTINGS_ARG, AS_OF_ARG, settingsFrom, LIMITS, today } from 'fairwire-core';
|
|
3
|
+
import { CONTRACT_FIELDS, SPEND_FIELDS, SETTINGS_SCHEMA, DEFAULTS, reviewContracts } from './logic.js';
|
|
4
|
+
|
|
5
|
+
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
6
|
+
const args = {
|
|
7
|
+
contracts: fileArg('IT contract register under --root (spreadsheet, contract tool or procurement export as CSV, Excel or JSON): one row per contract with vendor, service, owner, start and end dates, auto-renewal, notice days, annual value and renewal uplift'),
|
|
8
|
+
spend: fileArg('Optional payments to vendors (accounts payable export) with vendor, amount and date'),
|
|
9
|
+
settings: SETTINGS_ARG('lookahead_days, urgent_days, uplift_cap_pct, spend_margin_pct'),
|
|
10
|
+
as_of: AS_OF_ARG,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const manifest = wireAgent({
|
|
14
|
+
// Columns the "value is missing" checks depend on: an export without the column skips the check instead of flagging every row.
|
|
15
|
+
needs: { no_owner: ['owner'] },
|
|
16
|
+
pkg, prefix: 'renewals', title: 'Fairwire Contract Renewals',
|
|
17
|
+
description: 'Reviews IT contracts and renewals: notice deadlines for auto-renewing contracts, deadlines already missed, price rises above your cap, contracts with no owner, two contracts for one service, vendors paid with no contract, payments after a contract ended and spend above the contract value. Writes a deadline calendar and drafts notice letters for a person to send.',
|
|
18
|
+
args, required: ['contracts'],
|
|
19
|
+
sources: { contracts: { label: 'Contracts', args: ['contracts'], fields: CONTRACT_FIELDS }, spend: { label: 'Vendor payments', args: ['spend'], fields: SPEND_FIELDS } },
|
|
20
|
+
configSchemas: { renewals_settings: SETTINGS_SCHEMA },
|
|
21
|
+
run: (a, ctx) => reviewContracts(ctx.records(a.contracts, 'contracts'), a.spend ? ctx.records(a.spend, 'spend') : [], settingsFrom(a, ctx, 'renewals_settings', DEFAULTS), a.as_of || today()),
|
|
22
|
+
summary: (o) => `${o.contracts} contract(s), ${o.active} active worth ${o.annual_value} a year, ${o.auto_renewing} auto-renewing: ${o.open} open finding(s), ${o.high} high.`,
|
|
23
|
+
check: { title: 'Review IT contracts and renewals', description: 'Review the contract register and payments and list notice deadlines, missed notices, uplifts, owners, overlaps and spend problems.' },
|
|
24
|
+
explain: { arg: 'vendor', argSchema: { type: 'string', maxLength: 200, description: 'Vendor or contract id from renewals_check' }, title: 'Explain one vendor or contract', description: 'Every finding for one vendor or contract.', match: (i, v) => i.key === v || String(i.subject).toLowerCase() === String(v).toLowerCase() },
|
|
25
|
+
report: {
|
|
26
|
+
title: 'IT contracts and renewals', base: 'contract-renewals',
|
|
27
|
+
sections: (o) => [{ title: 'By vendor', rows: o.deadlines, columns: ['vendor', 'id', 'deadline'] }],
|
|
28
|
+
ics: (o) => o.deadlines.map((d) => ({ date: d.deadline, summary: `Notice deadline: ${d.vendor} (${d.id})`, description: 'Written by fairwire-contract-renewals. Give notice in writing before this date if the contract should not renew.' })),
|
|
29
|
+
limits: [LIMITS.files, 'Dates and notice periods are the ones in your register; the contract itself decides how notice must be given. Not legal advice.', 'Vendor names are compared without legal forms (Inc, Ltd, GmbH); two different vendors with the same name can be merged.', LIMITS.defaults, LIMITS.pii],
|
|
30
|
+
},
|
|
31
|
+
note: { noun: 'notice_letter', verb: 'send', category: 'binding_send', actor: 'the contract owner', to: 'each vendor\'s contract contact', subject: 'Notice regarding the renewal of our agreement', ask: 'We are reviewing this agreement before its renewal date. Please treat this letter as our notice under the agreement, and confirm receipt in writing.' },
|
|
32
|
+
refused: [
|
|
33
|
+
{ name: 'vendor_send_notice', category: 'binding_send', description: 'Fairwire Contract Renewals never sends a notice or signs a renewal; the contract owner sends the reviewed letter.' },
|
|
34
|
+
{ name: 'ap_hold_payment', category: 'move_money', description: 'Fairwire Contract Renewals never stops, holds or makes a payment.' },
|
|
35
|
+
],
|
|
36
|
+
prompt: { title: 'Review IT contracts', description: 'Walks the host model through a renewal review with Fairwire Contract Renewals.', text: 'You are helping an IT manager review contracts with fairwire-contract-renewals. Fairwire Contract Renewals only reads the register and payments. 1. Call renewals_check; lead with notice deadlines in the next two weeks and payments after a contract ended. 2. Use renewals_explain for a vendor. 3. Call renewals_write_report (it writes a deadline calendar). 4. Offer renewals_draft_notice_letter; renewals_request_send waits for one named click and the contract owner sends it.' },
|
|
37
|
+
});
|