fairgive-acknowledgements 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 +261 -2
- package/bin/fairgive-acknowledgements.js +7 -0
- package/evals/cases.json +372 -0
- package/fixtures/README.md +10 -0
- package/fixtures/clean/README.md +3 -0
- package/fixtures/clean/gifts.csv +11 -0
- package/fixtures/clean/letters.csv +9 -0
- package/fixtures/exports/lgl-gifts.csv +3 -0
- package/fixtures/gifts.csv +11 -0
- package/fixtures/intl/README.md +12 -0
- package/fixtures/intl/de/gifts.csv +11 -0
- package/fixtures/intl/de/letters.csv +7 -0
- package/fixtures/intl/ja/gifts.csv +11 -0
- package/fixtures/intl/ja/letters.csv +7 -0
- package/fixtures/letters.csv +7 -0
- package/fixtures/settings.json +6 -0
- package/package.json +56 -4
- package/server.json +37 -0
- package/src/demo.js +7 -0
- package/src/index.js +2 -0
- package/src/logic.js +38 -0
- package/src/manifest.js +59 -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,262 @@
|
|
|
1
|
-
#
|
|
1
|
+
# fairgive-acknowledgements
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Finds gifts at or over your acknowledgement threshold with no letter, late letters, letters with a different amount or no goods-and-services statement, and letters for refunded gifts. Drafts the letters for a person to send. Never sends.
|
|
4
|
+
|
|
5
|
+
Part of **Fairgive**, the nonprofit, foundation, church and association back-office agents by Mythos Machines. The software is free (MIT); the paid part is a fixed-price setup on your own files. Every result is computed from your files with plain arithmetic, on your computer; no AI model is called by the tools. It reads files and writes reports and drafts; it never files, sends, pays or changes a live system, and a person on your team decides and acts on every finding.
|
|
6
|
+
|
|
7
|
+
## What it needs
|
|
8
|
+
|
|
9
|
+
Exports you already have, saved as files on your computer (CSV, Excel, JSON; see "Columns it reads" and "Exports it reads" below):
|
|
10
|
+
|
|
11
|
+
- `gifts` (required): Gift export from your donor CRM: gift id, donor, e-mail, date, amount, status (refunded gifts are recognised)
|
|
12
|
+
- `letters`: Acknowledgement letter log: gift id, letter date, amount stated, and whether it has the goods-or-services statement
|
|
13
|
+
- `settings` (optional): a JSON file with your own thresholds and rules; see "Settings" below.
|
|
14
|
+
|
|
15
|
+
## What it checks
|
|
16
|
+
|
|
17
|
+
Checks every gift at or over the threshold in your settings against the letter log: no letter after the policy days, letters sent late, letters for another amount, letters with no goods-or-services statement and letters standing for refunded gifts. Gifts still inside the sending window are shown as due soon.
|
|
18
|
+
|
|
19
|
+
| Finding | Example from the fictional demo data |
|
|
20
|
+
|---|---|
|
|
21
|
+
| `ack_amount_differs` | Gift G-4 is 300 but the letter says 30. |
|
|
22
|
+
| `ack_due_soon` | Gift G-7 of 260 on 2026-11-10 has no letter yet; the policy allows 30 days (8 so far). |
|
|
23
|
+
| `ack_for_refunded_gift` | Gift G-6 was refunded but a letter dated 2026-10-29 acknowledges 400. Send a corrected letter. |
|
|
24
|
+
| `ack_late` | Gift G-3: the letter went out 36 days after the gift (policy 30). |
|
|
25
|
+
| `ack_missing` | Gift G-10 of 5000 on 2026-08-15 has no acknowledgement letter after 95 days. |
|
|
26
|
+
| `ack_no_statement` | The letter for gift G-5 has no statement about goods or services received. |
|
|
27
|
+
|
|
28
|
+
Each item gets the most serious level of its findings: **flag** (act on it), **review** (data is missing or unclear; a person looks), **watch** (worth knowing) or **ok**. Every finding names the numbers it was worked out from.
|
|
29
|
+
|
|
30
|
+
## Settings
|
|
31
|
+
|
|
32
|
+
Put the ones you want to change in a JSON file and pass it as `settings`; anything left out uses the default. The result lists the settings it used under `settings_used`.
|
|
33
|
+
|
|
34
|
+
| Setting | Default | Meaning |
|
|
35
|
+
|---|---|---|
|
|
36
|
+
| `threshold` | `250` | Gifts at or over this amount need a letter (default 250, the US written-acknowledgement figure; set your own policy) |
|
|
37
|
+
| `days_to_send` | `30` | Days your policy allows between a gift and its letter (default 30) |
|
|
38
|
+
| `as_of` | `null` | Date the check is made at (YYYY-MM-DD); default: the latest gift date |
|
|
39
|
+
| `require_statement` | `true` | Whether a letter must say whether goods or services were given (default true) |
|
|
40
|
+
| `organization` | `""` | Your organization name for the drafted letters |
|
|
41
|
+
| `tolerance` | `0.01` | Difference ignored between gift and letter amounts (default 0.01) |
|
|
42
|
+
|
|
43
|
+
<!-- generated:start -->
|
|
44
|
+
|
|
45
|
+
## A demo run
|
|
46
|
+
|
|
47
|
+
`npx -y fairgive-acknowledgements demo` runs the agent on the fictional files in [`fixtures/`](fixtures) in a temporary folder. Captured output:
|
|
48
|
+
|
|
49
|
+
```text
|
|
50
|
+
Fairgive Acknowledgements demo (fictional nonprofit data), Auto mode on
|
|
51
|
+
|
|
52
|
+
▶ Run the check on the exported files
|
|
53
|
+
status: executed decision: allow
|
|
54
|
+
9 gift(s) checked as of 2026-11-18 (threshold 250): 2 with no letter (6,000.00), 3 letter(s) to correct.
|
|
55
|
+
flag G-10 ack_missing
|
|
56
|
+
flag G-2 ack_missing
|
|
57
|
+
flag G-4 ack_amount_differs
|
|
58
|
+
flag G-5 ack_no_statement
|
|
59
|
+
flag G-6 ack_for_refunded_gift
|
|
60
|
+
watch G-3 ack_late
|
|
61
|
+
watch G-7 ack_due_soon
|
|
62
|
+
|
|
63
|
+
▶ Explain G-4
|
|
64
|
+
status: executed decision: allow
|
|
65
|
+
G-4: flag. Gift G-4 is 300 but the letter says 30.
|
|
66
|
+
|
|
67
|
+
▶ Write the report (CSV worklist and HTML page)
|
|
68
|
+
status: executed decision: allow
|
|
69
|
+
Donor acknowledgements written: 9 gift(s) checked as of 2026-11-18 (threshold 250): 2 with no letter (6,000.00), 3 letter(s) to correct.
|
|
70
|
+
|
|
71
|
+
▶ Write a draft (Auto is opted in for drafts here)
|
|
72
|
+
status: executed decision: allow (auto)
|
|
73
|
+
letter C-2 drafted for 1000 with 1 open marker(s) ([TO CONFIRM: change this sentence if the donor received any benefit]). Nothing was sent.
|
|
74
|
+
|
|
75
|
+
▶ Auto: approving the draft stays one named click
|
|
76
|
+
status: needs_approval decision: ask
|
|
77
|
+
reason: binding_send stays one-click, even in Auto
|
|
78
|
+
|
|
79
|
+
▶ Same call after the named click (recorded; a person acts on it)
|
|
80
|
+
status: executed decision: ask approved by: Morgan Manager (fictional)
|
|
81
|
+
letter C-2 approved and recorded. Nothing was sent or paid by the agent.
|
|
82
|
+
|
|
83
|
+
▶ The agent tries email_send itself
|
|
84
|
+
status: blocked decision: block
|
|
85
|
+
reason: Never sends email, letters or messages; a person sends the reviewed draft.
|
|
86
|
+
|
|
87
|
+
Audit log: <demo folder>/.fairgive/audit.jsonl
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Tools
|
|
91
|
+
|
|
92
|
+
| Tool | What it does | Policy |
|
|
93
|
+
|---|---|---|
|
|
94
|
+
| `acks_check` | Checks every gift at or over the threshold in your settings against the letter log: no letter after the policy days, letters sent late, letters for another amount, letters with no goods-or-services statement and lette… | runs |
|
|
95
|
+
| `acks_explain` | Show one gift from acks_check with every finding, the numbers behind it and the setting it was checked against. | runs |
|
|
96
|
+
| `acks_write_report` | Write acknowledgements.csv (one row per item, with blank owner and decision columns) and acknowledgements.html into out_dir (default fairgive-out/acks). | runs |
|
|
97
|
+
| `acks_draft_letter` | Write drafts/letter-<donor id>.md: a thank-you and acknowledgement letter for every gift of one donor that has no letter or needs a corrected one, with the amounts and dates. | asks first (Auto can be opted in) |
|
|
98
|
+
| `acks_request_send` | After one named human click (even in Auto), record that the reviewed letter draft is approved in letter-requests.csv. | one named click, even in Auto (`binding_send`) |
|
|
99
|
+
| `acks_recall` | Search this agent's own memory of the customer's setup: accepted facts (in use) and facts waiting for a person. | runs |
|
|
100
|
+
| `acks_learn` | Propose one fact about the customer's setup for this agent to remember. | runs |
|
|
101
|
+
| `acks_accept_learning` | A named person accepts or rejects a fact waiting in this agent's memory. | one named click, even in Auto (`accept_learning`) |
|
|
102
|
+
| `acks_retire_memory` | A named person stops an accepted fact from applying. | one named click, even in Auto (`accept_learning`) |
|
|
103
|
+
| `email_send` | Never sends email, letters or messages; a person sends the reviewed draft. | refused |
|
|
104
|
+
| `crm_update_records` | Never changes, merges or deletes records in the donor CRM; a person does that in the CRM. | refused |
|
|
105
|
+
|
|
106
|
+
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.
|
|
107
|
+
|
|
108
|
+
## Columns it reads
|
|
109
|
+
|
|
110
|
+
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; weights, distances and dimensions are converted when the column says it holds kilograms, kilometres or centimetres. Every result lists under `sources` how each file was read.
|
|
111
|
+
|
|
112
|
+
### CRM gifts (`gifts`)
|
|
113
|
+
|
|
114
|
+
| Column | Type | Also read as | For example, in other languages |
|
|
115
|
+
|---|---|---|---|
|
|
116
|
+
| `gift_id` (required) | text | Gift ID, Donation ID, Opportunity ID, Transaction ID, Gift Number, Gift No | Spenden-ID, N° de don, 寄付ID, 捐款编号 |
|
|
117
|
+
| `donor_id` | text | Constituent ID, Donor ID, Account ID, Contact ID, Account Number, LGL Constituent ID | Spendernummer, N° de donateur, 寄付者ID, 捐赠人编号 |
|
|
118
|
+
| `donor` | text | Donor Name, Donor, Constituent Name, Account Name, Name, Full Name | Spender, Donateur, 寄付者, 捐赠人 |
|
|
119
|
+
| `email` | text | Email, Email Address, Donor Email, Primary Email, Contact Email, E-mail | E-Mail, E-mail, メールアドレス, 邮箱 |
|
|
120
|
+
| `gift_date` | date | Gift Date, Donation Date, Close Date, Date, Transaction Date, Received Date | Spendendatum, Date du don, 寄付日, 捐赠日期 |
|
|
121
|
+
| `amount` | amount | Amount, Gift Amount, Donation Amount, Total Amount, Gross Amount, Payment Amount | Betrag, Montant, 金額, 金额 |
|
|
122
|
+
| `fund` | text | Fund, Fund Code, Fund ID, Fund Name, Designation, General Accounting Unit | Fonds, Fonds, 基金, 基金 |
|
|
123
|
+
| `status` | text | Status, Stage, Payment Status, Gift Status | Status, Statut, ステータス, 状态 |
|
|
124
|
+
|
|
125
|
+
Named exports recognised by their column names:
|
|
126
|
+
|
|
127
|
+
| System | Export | Recognised by | Layout checked against vendor docs |
|
|
128
|
+
|---|---|---|---|
|
|
129
|
+
| Blackbaud Raiser's Edge NXT | Gift list or query export (CSV) | Gift ID, Constituent ID, Gift Amount or Amount | no |
|
|
130
|
+
| Salesforce Nonprofit Success Pack | Opportunities (donations) report export | Opportunity ID, Account Name or Account: Account Name, Close Date | no |
|
|
131
|
+
| Bloomerang | Transactions export | Transaction Number, Account Number, Amount | no |
|
|
132
|
+
| DonorPerfect | Gift export (field names) | gift_id, donor_id, gl_code | no |
|
|
133
|
+
| Little Green Light | Gifts export | LGL Gift ID, LGL Constituent ID, Gift Amount | no |
|
|
134
|
+
| Neon CRM | Donation report export | Donation ID, Account ID, Donation Amount | no |
|
|
135
|
+
| Givebutter | Transactions export | Transaction ID, Campaign Code, Amount or Donated | no |
|
|
136
|
+
| GoFundMe Pro (Classy) | Transactions export | Transaction ID, Campaign Name, Gross Transaction Amount or Gross Amount | no |
|
|
137
|
+
|
|
138
|
+
Where a layout says "checked", its column names were compared with the vendor's documentation on that date. The other layouts were written from knowledge of the export and were not checked. None was tested against a live account.
|
|
139
|
+
|
|
140
|
+
### Acknowledgement letter log (`letters`)
|
|
141
|
+
|
|
142
|
+
| Column | Type | Also read as | For example, in other languages |
|
|
143
|
+
|---|---|---|---|
|
|
144
|
+
| `gift_id` (required) | text | Gift ID, Donation ID, Opportunity ID, Transaction ID, Gift Number | Spenden-ID, N° de don, 寄付ID, 捐款编号 |
|
|
145
|
+
| `letter_date` | date | Letter Date, Acknowledgement Date, Acknowledged Date, Thank You Date, Sent Date, Receipt Date | Bedankt am, Remercié le, 礼状送付日, 致谢日期 |
|
|
146
|
+
| `amount` | amount | Amount, Amount Stated, Letter Amount, Receipt Amount, Acknowledged Amount | Betrag, Montant, 金額, 金额 |
|
|
147
|
+
| `statement` | text | Statement, Goods or Services Statement, Includes Statement, GS Statement, Quid Pro Quo Statement | - |
|
|
148
|
+
|
|
149
|
+
### Files from other countries
|
|
150
|
+
|
|
151
|
+
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. A weight, distance or dimension column found by its translated name with no unit in it is read as metric and converted, and the result says so. Columns named differently? Run `npx fairgive-acknowledgements inspect <file>` (names and shapes only, never values) and name them in `fairgive-sources.json`:
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{ "files": { "exports/bills.csv": { "columns": { "invoice_number": "Beleg" }, "date_order": "dmy", "units": { "weight": "kg" } } } }
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
## Memory
|
|
158
|
+
|
|
159
|
+
fairgive-acknowledgements can remember facts about your setup so the next run does not have to be told again. `acks_learn` only proposes a fact; it changes nothing until a named person accepts it with `acks_accept_learning`, which is one click even in Auto. Facts live in one hash-chained file per agent under `.fairgive/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`.
|
|
160
|
+
|
|
161
|
+
| Kind | What an accepted fact changes |
|
|
162
|
+
|---|---|
|
|
163
|
+
| `note` | nothing (shown by recall only) |
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
fairgive-acknowledgements memory list
|
|
167
|
+
fairgive-acknowledgements memory accept MEM-1a2b3c4d5e6f --as "Your Name"
|
|
168
|
+
fairgive-acknowledgements memory retire MEM-1a2b3c4d5e6f --as "Your Name" --reason "carrier renamed"
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
<!-- sources:start -->
|
|
172
|
+
## Exports it reads
|
|
173
|
+
|
|
174
|
+
Table inputs can be CSV, TSV, semicolon- or pipe-separated text, Excel `.xlsx`, JSON or JSONL. A file already in this agent's own columns is read as it is. The exports below are recognised by their column names and mapped onto those columns; dates become `YYYY-MM-DD`, amounts plain decimals (both decimal marks), and yes/no columns `yes`/`no`. Each result lists, under `sources`, which export was recognised, which columns were mapped, and any rows skipped or dates that could be read two ways.
|
|
175
|
+
|
|
176
|
+
**CRM gifts** (argument `gifts`)
|
|
177
|
+
|
|
178
|
+
| System | Export | Layout checked against vendor docs |
|
|
179
|
+
|---|---|---|
|
|
180
|
+
| Blackbaud Raiser's Edge NXT | Gift list or query export (CSV) | no |
|
|
181
|
+
| Salesforce Nonprofit Success Pack | Opportunities (donations) report export | no |
|
|
182
|
+
| Bloomerang | Transactions export | no |
|
|
183
|
+
| DonorPerfect | Gift export (field names) | no |
|
|
184
|
+
| Little Green Light | Gifts export | no |
|
|
185
|
+
| Neon CRM | Donation report export | no |
|
|
186
|
+
| Givebutter | Transactions export | no |
|
|
187
|
+
| GoFundMe Pro (Classy) | Transactions export | no |
|
|
188
|
+
|
|
189
|
+
**Acknowledgement letter log** (argument `letters`)
|
|
190
|
+
|
|
191
|
+
No named exports: other column names are matched by a list of common alternatives.
|
|
192
|
+
|
|
193
|
+
Columns named differently? Run `npx fairgive-acknowledgements inspect <file>` to see how a file is read (column names and shapes only, never values), then name your columns in `fairgive-sources.json` in the root:
|
|
194
|
+
|
|
195
|
+
```json
|
|
196
|
+
{ "files": { "exports/users.csv": { "columns": { "email": "Work E-mail" }, "date_order": "dmy" } } }
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Where a layout says "checked", its column names were compared with the vendor's documentation on that date. The other layouts were written from knowledge of the export and were not checked. None was tested against a live account. If a real export does not match, the result says which columns were missing; please report it.
|
|
200
|
+
<!-- sources:end -->
|
|
201
|
+
|
|
202
|
+
## Install
|
|
203
|
+
|
|
204
|
+
Node 20 or newer. No other dependencies.
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
npx -y fairgive-acknowledgements demo
|
|
208
|
+
npx -y fairgive-acknowledgements mcp --root /path/to/your/files
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Claude Desktop, Cursor and other MCP hosts:
|
|
212
|
+
|
|
213
|
+
```json
|
|
214
|
+
{
|
|
215
|
+
"mcpServers": {
|
|
216
|
+
"fairgive-acknowledgements": {
|
|
217
|
+
"command": "npx",
|
|
218
|
+
"args": [
|
|
219
|
+
"-y",
|
|
220
|
+
"fairgive-acknowledgements",
|
|
221
|
+
"mcp",
|
|
222
|
+
"--root",
|
|
223
|
+
"/path/to/your/files"
|
|
224
|
+
]
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Claude Code: `claude mcp add fairgive-acknowledgements -- npx -y fairgive-acknowledgements mcp --root .`, or install the `fairgive-acknowledgements` plugin from this repository's marketplace.
|
|
231
|
+
|
|
232
|
+
## Modes and approvals
|
|
233
|
+
|
|
234
|
+
- **Review** (`--mode review`): reads and reports only.
|
|
235
|
+
- **Assist** (default): the policy above. A tool that asks returns an `approval_id`; a person approves it once with `fairgive-acknowledgements approve <id> --as "Your Name"` (or on the local approvals page, `fairgive-acknowledgements approvals`), and the same call is repeated.
|
|
236
|
+
- **Auto** (`--mode auto --auto <tool,...>`): opt-in per tool, with step caps and a kill switch (`fairgive-acknowledgements 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.
|
|
237
|
+
|
|
238
|
+
## CLI
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
fairgive-acknowledgements tools # every tool, its policy and arguments
|
|
242
|
+
fairgive-acknowledgements sources # the columns each input is read from
|
|
243
|
+
fairgive-acknowledgements inspect <file> # how a file would be read (names and shapes, never values)
|
|
244
|
+
fairgive-acknowledgements call acks_check '{"gifts":"<gifts>"}'
|
|
245
|
+
fairgive-acknowledgements eval # the private eval cases on the fictional fixtures
|
|
246
|
+
fairgive-acknowledgements demo
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## Audit log and data
|
|
250
|
+
|
|
251
|
+
Every call is written to `.fairgive/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.
|
|
252
|
+
|
|
253
|
+
<!-- generated:end -->
|
|
254
|
+
|
|
255
|
+
## Limits
|
|
256
|
+
|
|
257
|
+
- Reads only the files you give it. It does not log in to a donor CRM, giving platform, payment processor, bank, payroll or accounting system, and changes nothing in them.
|
|
258
|
+
- Thresholds, rates, dates and policies are settings in your own file, with working defaults; check them against your own policies, funder agreements and current rules before you rely on them.
|
|
259
|
+
- Not legal, tax, audit or accounting advice. A person decides what to record, send, file or pay.
|
|
260
|
+
- Names, e-mails, phone numbers, street addresses and taxpayer ids of donors, members, volunteers, staff and vendors are masked in results returned to the AI model. Text typed into memos, notes and bank descriptions is sent as written, so a name typed only there reaches the model. The report and draft files written here keep the real values: keep them in a private folder.
|
|
261
|
+
- Column names for the named exports were written from knowledge of those systems and not checked against a live account; `inspect` shows how a file was read and `fairgive-sources.json` names columns by hand.
|
|
262
|
+
- The bundled fixtures are fictional. Version 0.1.0; nothing has been published yet.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { main } from 'fairgive-core';
|
|
4
|
+
import { manifest } from '../src/manifest.js';
|
|
5
|
+
import { demo } from '../src/demo.js';
|
|
6
|
+
|
|
7
|
+
main(manifest, { bin: 'fairgive-acknowledgements', demo, evalFile: fileURLToPath(new URL('../evals/cases.json', import.meta.url)) });
|
package/evals/cases.json
ADDED
|
@@ -0,0 +1,372 @@
|
|
|
1
|
+
{
|
|
2
|
+
"suite": "fairgive-acknowledgements",
|
|
3
|
+
"root": "..",
|
|
4
|
+
"data_note": "Fictional gifts and letters; names and e-mail addresses are made up. Deterministic checks; no model is called.",
|
|
5
|
+
"cases": [
|
|
6
|
+
{
|
|
7
|
+
"id": "acknowledgement-totals",
|
|
8
|
+
"tool": "acks_check",
|
|
9
|
+
"args": {
|
|
10
|
+
"gifts": "fixtures/gifts.csv",
|
|
11
|
+
"letters": "fixtures/letters.csv",
|
|
12
|
+
"settings": "fixtures/settings.json"
|
|
13
|
+
},
|
|
14
|
+
"expect": {
|
|
15
|
+
"status": "executed",
|
|
16
|
+
"equals": {
|
|
17
|
+
"result.gifts_checked": 9,
|
|
18
|
+
"result.missing_letters": 2,
|
|
19
|
+
"result.missing_amount": 6000,
|
|
20
|
+
"result.letters_to_fix": 3,
|
|
21
|
+
"result.flag": 5,
|
|
22
|
+
"result.watch": 2,
|
|
23
|
+
"result.ok": 2
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"id": "every-planted-issue-found-and-names-masked",
|
|
29
|
+
"tool": "acks_check",
|
|
30
|
+
"args": {
|
|
31
|
+
"gifts": "fixtures/gifts.csv",
|
|
32
|
+
"letters": "fixtures/letters.csv",
|
|
33
|
+
"settings": "fixtures/settings.json"
|
|
34
|
+
},
|
|
35
|
+
"expect": {
|
|
36
|
+
"contains": [
|
|
37
|
+
"ack_missing",
|
|
38
|
+
"ack_late",
|
|
39
|
+
"ack_amount_differs",
|
|
40
|
+
"ack_no_statement",
|
|
41
|
+
"ack_for_refunded_gift",
|
|
42
|
+
"ack_due_soon"
|
|
43
|
+
],
|
|
44
|
+
"not_contains": [
|
|
45
|
+
"Rowan Ellery",
|
|
46
|
+
"Emeric Sato",
|
|
47
|
+
"maple.hartwell@example.org"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"id": "wrong-amount-explained",
|
|
53
|
+
"tool": "acks_explain",
|
|
54
|
+
"args": {
|
|
55
|
+
"gifts": "fixtures/gifts.csv",
|
|
56
|
+
"letters": "fixtures/letters.csv",
|
|
57
|
+
"settings": "fixtures/settings.json",
|
|
58
|
+
"gift_id": "G-4"
|
|
59
|
+
},
|
|
60
|
+
"expect": {
|
|
61
|
+
"status": "executed",
|
|
62
|
+
"contains": [
|
|
63
|
+
"Gift G-4 is 300 but the letter says 30"
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"id": "defaults-without-settings",
|
|
69
|
+
"tool": "acks_check",
|
|
70
|
+
"args": {
|
|
71
|
+
"gifts": "fixtures/gifts.csv",
|
|
72
|
+
"letters": "fixtures/letters.csv"
|
|
73
|
+
},
|
|
74
|
+
"expect": {
|
|
75
|
+
"status": "executed",
|
|
76
|
+
"equals": {
|
|
77
|
+
"result.missing_letters": 2
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"id": "letter-draft-after-approval",
|
|
83
|
+
"tool": "acks_draft_letter",
|
|
84
|
+
"approve": "Dana Director",
|
|
85
|
+
"args": {
|
|
86
|
+
"gifts": "fixtures/gifts.csv",
|
|
87
|
+
"letters": "fixtures/letters.csv",
|
|
88
|
+
"settings": "fixtures/settings.json",
|
|
89
|
+
"donor_id": "C-2",
|
|
90
|
+
"from": "Dana Director (fictional)"
|
|
91
|
+
},
|
|
92
|
+
"expect": {
|
|
93
|
+
"status": "executed",
|
|
94
|
+
"equals": {
|
|
95
|
+
"result.amount": 1000
|
|
96
|
+
},
|
|
97
|
+
"contains": [
|
|
98
|
+
"letter-C-2.md"
|
|
99
|
+
],
|
|
100
|
+
"not_contains": [
|
|
101
|
+
"Rowan Ellery"
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"id": "lgl-export-without-letters",
|
|
107
|
+
"tool": "acks_check",
|
|
108
|
+
"args": {
|
|
109
|
+
"gifts": "fixtures/exports/lgl-gifts.csv",
|
|
110
|
+
"settings": "fixtures/settings.json"
|
|
111
|
+
},
|
|
112
|
+
"expect": {
|
|
113
|
+
"status": "executed",
|
|
114
|
+
"contains": [
|
|
115
|
+
"lgl_gifts"
|
|
116
|
+
],
|
|
117
|
+
"equals": {
|
|
118
|
+
"result.gifts_checked": 1,
|
|
119
|
+
"result.missing_amount": 1000
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"id": "missing-argument-named",
|
|
125
|
+
"tool": "acks_check",
|
|
126
|
+
"args": {},
|
|
127
|
+
"expect": {
|
|
128
|
+
"status": "error",
|
|
129
|
+
"contains": [
|
|
130
|
+
"gifts"
|
|
131
|
+
]
|
|
132
|
+
},
|
|
133
|
+
"generated": true
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"id": "file-outside-root-refused",
|
|
137
|
+
"tool": "acks_check",
|
|
138
|
+
"args": {
|
|
139
|
+
"gifts": "../../../outside.csv",
|
|
140
|
+
"letters": "fixtures/letters.csv",
|
|
141
|
+
"settings": "fixtures/settings.json"
|
|
142
|
+
},
|
|
143
|
+
"expect": {
|
|
144
|
+
"status": "error",
|
|
145
|
+
"contains": [
|
|
146
|
+
"outside"
|
|
147
|
+
]
|
|
148
|
+
},
|
|
149
|
+
"generated": true
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
"id": "invented-tool-name-refused",
|
|
153
|
+
"tool": "acks_pay_everything_now",
|
|
154
|
+
"args": {},
|
|
155
|
+
"expect": {
|
|
156
|
+
"status": "blocked"
|
|
157
|
+
},
|
|
158
|
+
"generated": true
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
"id": "review-mode-still-reads",
|
|
162
|
+
"tool": "acks_check",
|
|
163
|
+
"mode": "review",
|
|
164
|
+
"args": {
|
|
165
|
+
"gifts": "fixtures/gifts.csv",
|
|
166
|
+
"letters": "fixtures/letters.csv",
|
|
167
|
+
"settings": "fixtures/settings.json"
|
|
168
|
+
},
|
|
169
|
+
"expect": {
|
|
170
|
+
"status": "executed",
|
|
171
|
+
"equals": {
|
|
172
|
+
"result.gifts_checked": 9,
|
|
173
|
+
"result.missing_letters": 2,
|
|
174
|
+
"result.missing_amount": 6000,
|
|
175
|
+
"result.letters_to_fix": 3,
|
|
176
|
+
"result.flag": 5,
|
|
177
|
+
"result.watch": 2,
|
|
178
|
+
"result.ok": 2
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
"generated": true
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"id": "status-filter-keeps-totals",
|
|
185
|
+
"tool": "acks_check",
|
|
186
|
+
"args": {
|
|
187
|
+
"gifts": "fixtures/gifts.csv",
|
|
188
|
+
"letters": "fixtures/letters.csv",
|
|
189
|
+
"settings": "fixtures/settings.json",
|
|
190
|
+
"status": "ok",
|
|
191
|
+
"limit": 1
|
|
192
|
+
},
|
|
193
|
+
"expect": {
|
|
194
|
+
"status": "executed",
|
|
195
|
+
"max": {
|
|
196
|
+
"result.items_shown": 1
|
|
197
|
+
},
|
|
198
|
+
"equals": {
|
|
199
|
+
"result.gifts_checked": 9,
|
|
200
|
+
"result.missing_letters": 2,
|
|
201
|
+
"result.missing_amount": 6000,
|
|
202
|
+
"result.letters_to_fix": 3,
|
|
203
|
+
"result.flag": 5,
|
|
204
|
+
"result.watch": 2,
|
|
205
|
+
"result.ok": 2
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
"generated": true
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"id": "explain-unknown-item-is-a-readable-error",
|
|
212
|
+
"tool": "acks_explain",
|
|
213
|
+
"args": {
|
|
214
|
+
"gifts": "fixtures/gifts.csv",
|
|
215
|
+
"letters": "fixtures/letters.csv",
|
|
216
|
+
"settings": "fixtures/settings.json",
|
|
217
|
+
"gift_id": "No Such Thing Zz"
|
|
218
|
+
},
|
|
219
|
+
"expect": {
|
|
220
|
+
"status": "error",
|
|
221
|
+
"contains": [
|
|
222
|
+
"not found"
|
|
223
|
+
]
|
|
224
|
+
},
|
|
225
|
+
"generated": true
|
|
226
|
+
},
|
|
227
|
+
{
|
|
228
|
+
"id": "report-writes-two-files",
|
|
229
|
+
"tool": "acks_write_report",
|
|
230
|
+
"args": {
|
|
231
|
+
"gifts": "fixtures/gifts.csv",
|
|
232
|
+
"letters": "fixtures/letters.csv",
|
|
233
|
+
"settings": "fixtures/settings.json"
|
|
234
|
+
},
|
|
235
|
+
"expect": {
|
|
236
|
+
"status": "executed",
|
|
237
|
+
"length": {
|
|
238
|
+
"result.files": 2
|
|
239
|
+
},
|
|
240
|
+
"matches": [
|
|
241
|
+
"[0-9a-f]{64}"
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
"generated": true
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
"id": "draft-waits-for-a-person",
|
|
248
|
+
"tool": "acks_draft_letter",
|
|
249
|
+
"args": {
|
|
250
|
+
"gifts": "fixtures/gifts.csv",
|
|
251
|
+
"letters": "fixtures/letters.csv",
|
|
252
|
+
"settings": "fixtures/settings.json",
|
|
253
|
+
"donor_id": "C-2",
|
|
254
|
+
"from": "Dana Director (fictional)"
|
|
255
|
+
},
|
|
256
|
+
"expect": {
|
|
257
|
+
"status": "needs_approval",
|
|
258
|
+
"decision": "ask"
|
|
259
|
+
},
|
|
260
|
+
"generated": true
|
|
261
|
+
},
|
|
262
|
+
{
|
|
263
|
+
"id": "review-mode-drafts-nothing",
|
|
264
|
+
"tool": "acks_draft_letter",
|
|
265
|
+
"mode": "review",
|
|
266
|
+
"args": {
|
|
267
|
+
"gifts": "fixtures/gifts.csv",
|
|
268
|
+
"letters": "fixtures/letters.csv",
|
|
269
|
+
"settings": "fixtures/settings.json",
|
|
270
|
+
"donor_id": "C-2",
|
|
271
|
+
"from": "Dana Director (fictional)"
|
|
272
|
+
},
|
|
273
|
+
"expect": {
|
|
274
|
+
"status": "blocked"
|
|
275
|
+
},
|
|
276
|
+
"generated": true
|
|
277
|
+
},
|
|
278
|
+
{
|
|
279
|
+
"id": "request-stays-one-click-in-auto",
|
|
280
|
+
"tool": "acks_request_send",
|
|
281
|
+
"mode": "auto",
|
|
282
|
+
"auto_actions": [
|
|
283
|
+
"acks_draft_letter"
|
|
284
|
+
],
|
|
285
|
+
"args": {
|
|
286
|
+
"draft": "fairgive-out/acks/drafts/none.md",
|
|
287
|
+
"draft_sha256": "0000000000000000000000000000000000000000000000000000000000000000"
|
|
288
|
+
},
|
|
289
|
+
"expect": {
|
|
290
|
+
"status": "needs_approval",
|
|
291
|
+
"decision": "ask"
|
|
292
|
+
},
|
|
293
|
+
"generated": true
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
"id": "refuses-email-send",
|
|
297
|
+
"tool": "email_send",
|
|
298
|
+
"mode": "auto",
|
|
299
|
+
"args": {},
|
|
300
|
+
"expect": {
|
|
301
|
+
"status": "blocked"
|
|
302
|
+
},
|
|
303
|
+
"generated": true
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
"id": "refuses-crm-update-records",
|
|
307
|
+
"tool": "crm_update_records",
|
|
308
|
+
"mode": "auto",
|
|
309
|
+
"args": {},
|
|
310
|
+
"expect": {
|
|
311
|
+
"status": "blocked"
|
|
312
|
+
},
|
|
313
|
+
"generated": true
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"id": "recall-empty-memory",
|
|
317
|
+
"tool": "acks_recall",
|
|
318
|
+
"args": {},
|
|
319
|
+
"expect": {
|
|
320
|
+
"status": "executed",
|
|
321
|
+
"equals": {
|
|
322
|
+
"result.total": 0
|
|
323
|
+
}
|
|
324
|
+
},
|
|
325
|
+
"generated": true
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
"id": "intl-de-acknowledgement-totals",
|
|
329
|
+
"tool": "acks_check",
|
|
330
|
+
"args": {
|
|
331
|
+
"gifts": "fixtures/intl/de/gifts.csv",
|
|
332
|
+
"letters": "fixtures/intl/de/letters.csv",
|
|
333
|
+
"settings": "fixtures/settings.json"
|
|
334
|
+
},
|
|
335
|
+
"expect": {
|
|
336
|
+
"status": "executed",
|
|
337
|
+
"equals": {
|
|
338
|
+
"result.gifts_checked": 9,
|
|
339
|
+
"result.missing_letters": 2,
|
|
340
|
+
"result.missing_amount": 6000,
|
|
341
|
+
"result.letters_to_fix": 3,
|
|
342
|
+
"result.flag": 5,
|
|
343
|
+
"result.watch": 2,
|
|
344
|
+
"result.ok": 2
|
|
345
|
+
}
|
|
346
|
+
},
|
|
347
|
+
"note": "German export of the same data (fixtures/intl/de); must match the English case \"acknowledgement-totals\"."
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
"id": "intl-ja-acknowledgement-totals",
|
|
351
|
+
"tool": "acks_check",
|
|
352
|
+
"args": {
|
|
353
|
+
"gifts": "fixtures/intl/ja/gifts.csv",
|
|
354
|
+
"letters": "fixtures/intl/ja/letters.csv",
|
|
355
|
+
"settings": "fixtures/settings.json"
|
|
356
|
+
},
|
|
357
|
+
"expect": {
|
|
358
|
+
"status": "executed",
|
|
359
|
+
"equals": {
|
|
360
|
+
"result.gifts_checked": 9,
|
|
361
|
+
"result.missing_letters": 2,
|
|
362
|
+
"result.missing_amount": 6000,
|
|
363
|
+
"result.letters_to_fix": 3,
|
|
364
|
+
"result.flag": 5,
|
|
365
|
+
"result.watch": 2,
|
|
366
|
+
"result.ok": 2
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
"note": "Japanese export of the same data (fixtures/intl/ja); must match the English case \"acknowledgement-totals\"."
|
|
370
|
+
}
|
|
371
|
+
]
|
|
372
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Fixtures
|
|
2
|
+
|
|
3
|
+
Fictional gifts and the acknowledgement letter log of one organization, checked on
|
|
4
|
+
2026-11-18 with a 250 threshold and a 30-day sending policy. Names and addresses are made
|
|
5
|
+
up. Planted: two large gifts with no letter (ack_missing), a letter sent after 36 days
|
|
6
|
+
(ack_late), a letter that says 30 for a 300 gift (ack_amount_differs), a letter with no
|
|
7
|
+
goods-or-services statement (ack_no_statement), a letter for a refunded gift
|
|
8
|
+
(ack_for_refunded_gift) and a gift from eight days ago that is not late yet
|
|
9
|
+
(ack_due_soon). Gifts under the threshold with no letter are not listed. `exports/` holds
|
|
10
|
+
a Little Green Light gifts export.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
# Clean set
|
|
2
|
+
|
|
3
|
+
The demo files with every planted problem in [../README.md](../README.md) removed and nothing else changed, made by `scripts/accuracy.mjs` from `scripts/accuracy-specs.mjs` in the repository. The check must report no findings on these files (settings: `../settings.json`). Fictional data.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
gift_id,donor_id,donor,email,gift_date,amount,fund,status
|
|
2
|
+
G-1,C-1,Maple Hartwell,maple.hartwell@example.org,2026-10-01,500.00,GEN,Received
|
|
3
|
+
G-2,C-2,Rowan Ellery,rowan.ellery@example.org,2026-09-01,1000.00,GEN,Received
|
|
4
|
+
G-3,C-3,Juniper Vance,juniper.vance@example.org,2026-10-10,250.00,YOUTH,Received
|
|
5
|
+
G-4,C-4,Tamsin Okafor,tamsin.okafor@example.org,2026-10-20,300.00,GEN,Received
|
|
6
|
+
G-5,C-5,Corwin Achebe,corwin.achebe@example.org,2026-10-25,750.00,CAPITAL,Received
|
|
7
|
+
G-6,C-6,Liesel Marchetti,liesel.marchetti@example.org,2026-10-28,400.00,GEN,Refunded
|
|
8
|
+
G-7,C-7,Bram Halloway,bram.halloway@example.org,2026-11-10,260.00,GEN,Received
|
|
9
|
+
G-8,C-8,Odessa Quill,odessa.quill@example.org,2026-10-02,100.00,GEN,Received
|
|
10
|
+
G-9,C-9,Priya Lindqvist,priya.lindqvist@example.org,2026-10-03,50.00,GEN,Received
|
|
11
|
+
G-10,C-10,Emeric Sato,emeric.sato@example.org,2026-08-15,5000.00,ENDOW,Received
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
gift_id,donor_id,donor,email,gift_date,amount,fund,status
|
|
2
|
+
G-1,C-1,Maple Hartwell,maple.hartwell@example.org,2026-10-01,500.00,GEN,Received
|
|
3
|
+
G-2,C-2,Rowan Ellery,rowan.ellery@example.org,2026-09-01,1000.00,GEN,Received
|
|
4
|
+
G-3,C-3,Juniper Vance,juniper.vance@example.org,2026-10-10,250.00,YOUTH,Received
|
|
5
|
+
G-4,C-4,Tamsin Okafor,tamsin.okafor@example.org,2026-10-20,300.00,GEN,Received
|
|
6
|
+
G-5,C-5,Corwin Achebe,corwin.achebe@example.org,2026-10-25,750.00,CAPITAL,Received
|
|
7
|
+
G-6,C-6,Liesel Marchetti,liesel.marchetti@example.org,2026-10-28,400.00,GEN,Refunded
|
|
8
|
+
G-7,C-7,Bram Halloway,bram.halloway@example.org,2026-11-10,260.00,GEN,Received
|
|
9
|
+
G-8,C-8,Odessa Quill,odessa.quill@example.org,2026-10-02,100.00,GEN,Received
|
|
10
|
+
G-9,C-9,Priya Lindqvist,priya.lindqvist@example.org,2026-10-03,50.00,GEN,Received
|
|
11
|
+
G-10,C-10,Emeric Sato,emeric.sato@example.org,2026-08-15,5000.00,ENDOW,Received
|
|
@@ -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,11 @@
|
|
|
1
|
+
Spenden-ID;Spendernummer;Spender;E-Mail-Adresse;Spendendatum;Betrag;Fonds;Zustand
|
|
2
|
+
G-1;C-1;Maple Hartwell;maple.hartwell@example.org;01.10.2026;500,00;GEN;Received
|
|
3
|
+
G-2;C-2;Rowan Ellery;rowan.ellery@example.org;01.09.2026;1.000,00;GEN;Received
|
|
4
|
+
G-3;C-3;Juniper Vance;juniper.vance@example.org;10.10.2026;250,00;YOUTH;Received
|
|
5
|
+
G-4;C-4;Tamsin Okafor;tamsin.okafor@example.org;20.10.2026;300,00;GEN;Received
|
|
6
|
+
G-5;C-5;Corwin Achebe;corwin.achebe@example.org;25.10.2026;750,00;CAPITAL;Received
|
|
7
|
+
G-6;C-6;Liesel Marchetti;liesel.marchetti@example.org;28.10.2026;400,00;GEN;Refunded
|
|
8
|
+
G-7;C-7;Bram Halloway;bram.halloway@example.org;10.11.2026;260,00;GEN;Received
|
|
9
|
+
G-8;C-8;Odessa Quill;odessa.quill@example.org;02.10.2026;100,00;GEN;Received
|
|
10
|
+
G-9;C-9;Priya Lindqvist;priya.lindqvist@example.org;03.10.2026;50,00;GEN;Received
|
|
11
|
+
G-10;C-10;Emeric Sato;emeric.sato@example.org;15.08.2026;5.000,00;ENDOW;Received
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
��tID,��t��ID,��t��,���[���A�h���X,��t��,���z,���,�X�e�[�^�X
|
|
2
|
+
G-1,C-1,Maple Hartwell,maple.hartwell@example.org,2026/10/01,500.00,GEN,Received
|
|
3
|
+
G-2,C-2,Rowan Ellery,rowan.ellery@example.org,2026/09/01,"1,000.00",GEN,Received
|
|
4
|
+
G-3,C-3,Juniper Vance,juniper.vance@example.org,2026/10/10,250.00,YOUTH,Received
|
|
5
|
+
G-4,C-4,Tamsin Okafor,tamsin.okafor@example.org,2026/10/20,300.00,GEN,Received
|
|
6
|
+
G-5,C-5,Corwin Achebe,corwin.achebe@example.org,2026/10/25,750.00,CAPITAL,Received
|
|
7
|
+
G-6,C-6,Liesel Marchetti,liesel.marchetti@example.org,2026/10/28,400.00,GEN,Refunded
|
|
8
|
+
G-7,C-7,Bram Halloway,bram.halloway@example.org,2026/11/10,260.00,GEN,Received
|
|
9
|
+
G-8,C-8,Odessa Quill,odessa.quill@example.org,2026/10/02,100.00,GEN,Received
|
|
10
|
+
G-9,C-9,Priya Lindqvist,priya.lindqvist@example.org,2026/10/03,50.00,GEN,Received
|
|
11
|
+
G-10,C-10,Emeric Sato,emeric.sato@example.org,2026/08/15,"5,000.00",ENDOW,Received
|
package/package.json
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fairgive-acknowledgements",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"mcpName": "io.github.fpavia111-creator/fairgive-acknowledgements",
|
|
5
|
+
"description": "Fairgive Acknowledgements: finds gifts at or over your acknowledgement threshold with no letter, late letters, letters with a different amount or no goods-and-services statement, and letters for refunded gifts. Drafts the letters for a person to send. Never sends.",
|
|
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
|
+
"fairgive-acknowledgements": "bin/fairgive-acknowledgements.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/fairgive-acknowledgements.js demo",
|
|
33
|
+
"eval": "node bin/fairgive-acknowledgements.js eval"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"fairgive-core": "^0.1.0"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/fpavia111-creator/fairgive-agents.git",
|
|
41
|
+
"directory": "packages/fairgive-acknowledgements"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/fpavia111-creator/fairgive-agents/tree/main/packages/fairgive-acknowledgements#readme",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/fpavia111-creator/fairgive-agents/issues"
|
|
46
|
+
},
|
|
47
|
+
"keywords": [
|
|
48
|
+
"mcp",
|
|
49
|
+
"mcp-server",
|
|
50
|
+
"nonprofit",
|
|
51
|
+
"nonprofits",
|
|
52
|
+
"fundraising",
|
|
53
|
+
"fairgive",
|
|
54
|
+
"donor-acknowledgement",
|
|
55
|
+
"thank-you-letters",
|
|
56
|
+
"gift-receipts"
|
|
57
|
+
]
|
|
58
|
+
}
|
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/fairgive-acknowledgements",
|
|
4
|
+
"title": "Fairgive Acknowledgements",
|
|
5
|
+
"description": "Fairgive Acknowledgements: finds gifts at or over your acknowledgement threshold with no letter…",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"url": "https://github.com/fpavia111-creator/fairgive-agents",
|
|
9
|
+
"source": "github",
|
|
10
|
+
"subfolder": "packages/fairgive-acknowledgements"
|
|
11
|
+
},
|
|
12
|
+
"websiteUrl": "https://fair-agents.com/fairgive.html",
|
|
13
|
+
"packages": [
|
|
14
|
+
{
|
|
15
|
+
"registryType": "npm",
|
|
16
|
+
"identifier": "fairgive-acknowledgements",
|
|
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
package/src/index.js
ADDED
package/src/logic.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Donor acknowledgements: every gift at or over the threshold should have a letter within
|
|
2
|
+
// the policy's days, for the gift amount, with a goods-or-services statement; a refunded
|
|
3
|
+
// gift should not have one standing. The threshold and days are settings (the default 250
|
|
4
|
+
// is the US written-acknowledgement figure; your policy may be stricter).
|
|
5
|
+
import { str, num, round2, isoDate, daysBetween, yes, finding, statusOf, cmp, nameKey } from 'fairgive-core';
|
|
6
|
+
|
|
7
|
+
export const DEFAULTS = Object.freeze({ threshold: 250, days_to_send: 30, as_of: null, require_statement: true, organization: '', tolerance: 0.01 });
|
|
8
|
+
const LEVELS = { ack_missing: 'flag', ack_amount_differs: 'flag', ack_no_statement: 'flag', ack_for_refunded_gift: 'flag', ack_late: 'watch', ack_due_soon: 'watch', no_gift_date: 'review' };
|
|
9
|
+
const REFUNDED = /refund|reversed|void|cancel|charge ?back/i;
|
|
10
|
+
|
|
11
|
+
export function acknowledgements({ gifts = [], letters = [] }, s = DEFAULTS) {
|
|
12
|
+
const tol = Number(s.tolerance ?? 0.01);
|
|
13
|
+
const asOf = isoDate(s.as_of) || gifts.map((g) => isoDate(g.gift_date)).filter(Boolean).sort().pop() || null;
|
|
14
|
+
const byGift = new Map();
|
|
15
|
+
for (const l of letters) { const k = nameKey(l.gift_id); if (!k) continue; const cur = byGift.get(k); if (!cur || cmp(isoDate(l.letter_date) || '', isoDate(cur.letter_date) || '') > 0) byGift.set(k, l); }
|
|
16
|
+
const items = []; let missing = 0, missingAmount = 0;
|
|
17
|
+
for (const g of gifts) {
|
|
18
|
+
if (!str(g.gift_id)) continue;
|
|
19
|
+
const amount = num(g.amount) || 0; const l = byGift.get(nameKey(g.gift_id)); const refunded = REFUNDED.test(str(g.status));
|
|
20
|
+
if (amount < Number(s.threshold) && !l) continue;
|
|
21
|
+
if (refunded && !l) continue;
|
|
22
|
+
const date = isoDate(g.gift_date); const f = [];
|
|
23
|
+
if (refunded && l) f.push(finding('ack_for_refunded_gift', `Gift ${str(g.gift_id)} was refunded but a letter dated ${isoDate(l.letter_date) || 'no date'} acknowledges ${num(l.amount) ?? amount}. Send a corrected letter.`, amount));
|
|
24
|
+
else if (!l) {
|
|
25
|
+
if (!date) f.push(finding('no_gift_date', `Gift ${str(g.gift_id)} has no date, so the sending window cannot be checked.`, amount));
|
|
26
|
+
else { const age = asOf ? daysBetween(date, asOf) : null;
|
|
27
|
+
if (age !== null && age <= Number(s.days_to_send)) f.push(finding('ack_due_soon', `Gift ${str(g.gift_id)} of ${amount} on ${date} has no letter yet; the policy allows ${s.days_to_send} days (${age} so far).`, amount));
|
|
28
|
+
else { f.push(finding('ack_missing', `Gift ${str(g.gift_id)} of ${amount} on ${date} has no acknowledgement letter${age !== null ? ` after ${age} days` : ''}.`, amount)); missing++; missingAmount += amount; } }
|
|
29
|
+
} else {
|
|
30
|
+
const ld = isoDate(l.letter_date); const lag = date && ld ? daysBetween(date, ld) : null;
|
|
31
|
+
if (lag !== null && lag > Number(s.days_to_send)) f.push(finding('ack_late', `Gift ${str(g.gift_id)}: the letter went out ${lag} days after the gift (policy ${s.days_to_send}).`));
|
|
32
|
+
const la = num(l.amount); if (la !== null && Math.abs(la - amount) > tol) f.push(finding('ack_amount_differs', `Gift ${str(g.gift_id)} is ${amount} but the letter says ${la}.`, amount - la));
|
|
33
|
+
if (s.require_statement !== false && yes(l.statement) === false) f.push(finding('ack_no_statement', `The letter for gift ${str(g.gift_id)} has no statement about goods or services received.`, amount));
|
|
34
|
+
}
|
|
35
|
+
items.push({ gift_id: str(g.gift_id), donor_id: str(g.donor_id), donor: str(g.donor), email: str(g.email), gift_date: date, amount, letter_date: l ? isoDate(l.letter_date) : null, letter_amount: l ? num(l.amount) : null, status: statusOf(f, LEVELS), findings: f });
|
|
36
|
+
}
|
|
37
|
+
return { items, totals: { gifts_checked: items.length, missing_letters: missing, missing_amount: round2(missingAmount), letters_to_fix: items.filter((i) => i.findings.some((x) => ['ack_amount_differs', 'ack_no_statement', 'ack_for_refunded_gift'].includes(x.code))).length }, extra: { as_of: asOf, threshold: s.threshold } };
|
|
38
|
+
}
|
package/src/manifest.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { giveAgent, GIFT_FIELDS, GIFT_PROFILES, sourceOf, REFUSE, money, dollars, letter } from 'fairgive-core';
|
|
3
|
+
import { acknowledgements, DEFAULTS } from './logic.js';
|
|
4
|
+
|
|
5
|
+
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
6
|
+
const files = {
|
|
7
|
+
gifts: { type: 'string', description: 'Gift export from your donor CRM under --root: gift id, donor, e-mail, date, amount, status (refunded gifts are recognised)' },
|
|
8
|
+
letters: { type: 'string', description: 'Acknowledgement letter log under --root: gift id, letter date, amount stated, and whether it has the goods-or-services statement' },
|
|
9
|
+
};
|
|
10
|
+
const LETTER_FIELDS = {
|
|
11
|
+
gift_id: { aliases: ['Gift ID', 'Donation ID', 'Opportunity ID', 'Transaction ID', 'Gift Number'], required: true },
|
|
12
|
+
letter_date: { aliases: ['Letter Date', 'Acknowledgement Date', 'Acknowledged Date', 'Thank You Date', 'Sent Date', 'Receipt Date', 'Date Sent'], type: 'date', translate: 'ack_date' },
|
|
13
|
+
amount: { aliases: ['Amount', 'Amount Stated', 'Letter Amount', 'Receipt Amount', 'Acknowledged Amount'], type: 'money' },
|
|
14
|
+
statement: { aliases: ['Statement', 'Goods or Services Statement', 'Includes Statement', 'GS Statement', 'Quid Pro Quo Statement'] },
|
|
15
|
+
};
|
|
16
|
+
export const DEMO = { title: 'Fairgive Acknowledgements', files: { gifts: 'gifts.csv', letters: 'letters.csv', settings: 'settings.json' }, explain: { arg: 'gift_id', value: 'G-4' }, draft: { donor_id: 'C-2', from: 'Dana Director, Example Community Fund (fictional)' } };
|
|
17
|
+
|
|
18
|
+
export const manifest = giveAgent({
|
|
19
|
+
pkg, prefix: 'acks',
|
|
20
|
+
description: pkg.description.replace(/^[^:]+:\s*/, ''),
|
|
21
|
+
check: { title: 'Donor acknowledgements', description: 'Checks every gift at or over the threshold in your settings against the letter log: no letter after the policy days, letters sent late, letters for another amount, letters with no goods-or-services statement and letters standing for refunded gifts. Gifts still inside the sending window are shown as due soon.' },
|
|
22
|
+
args: files, required: ['gifts'],
|
|
23
|
+
sources: {
|
|
24
|
+
gifts: sourceOf('CRM gifts', ['gifts'], GIFT_FIELDS, ['gift_id', 'donor_id', 'donor', 'email', 'gift_date', 'amount', 'fund', 'status'], GIFT_PROFILES),
|
|
25
|
+
letters: { label: 'Acknowledgement letter log', args: ['letters'], fields: LETTER_FIELDS },
|
|
26
|
+
},
|
|
27
|
+
settings: { defaults: DEFAULTS, schema: { type: 'object', additionalProperties: false, properties: {
|
|
28
|
+
threshold: { type: 'number', minimum: 0, description: 'Gifts at or over this amount need a letter (default 250, the US written-acknowledgement figure; set your own policy)' },
|
|
29
|
+
days_to_send: { type: 'integer', minimum: 0, maximum: 400, description: 'Days your policy allows between a gift and its letter (default 30)' },
|
|
30
|
+
as_of: { type: ['string', 'null'], description: 'Date the check is made at (YYYY-MM-DD); default: the latest gift date' },
|
|
31
|
+
require_statement: { type: 'boolean', description: 'Whether a letter must say whether goods or services were given (default true)' },
|
|
32
|
+
organization: { type: 'string', description: 'Your organization name for the drafted letters' },
|
|
33
|
+
tolerance: { type: 'number', minimum: 0, maximum: 100, description: 'Difference ignored between gift and letter amounts (default 0.01)' },
|
|
34
|
+
} } },
|
|
35
|
+
run: ({ rows, settings }) => acknowledgements(rows, settings),
|
|
36
|
+
key: { arg: 'gift_id', field: 'gift_id', label: 'gift' },
|
|
37
|
+
summary: (o) => `${o.totals.gifts_checked} gift(s) checked as of ${o.extra.as_of || 'no date'} (threshold ${o.extra.threshold}): ${o.totals.missing_letters} with no letter (${money(o.totals.missing_amount)}), ${o.totals.letters_to_fix} letter(s) to correct.`,
|
|
38
|
+
report: {
|
|
39
|
+
title: 'Donor acknowledgements', base: 'acknowledgements',
|
|
40
|
+
row: (i) => ({ gift_id: i.gift_id ?? '', donor_id: i.donor_id ?? '', donor: i.donor ?? '', gift_date: i.gift_date ?? '', amount: i.amount ?? '', letter_date: i.letter_date ?? '', letter_amount: i.letter_amount ?? '' }),
|
|
41
|
+
htmlColumns: ['gift_id', 'donor', 'gift_date', 'amount', 'letter_date', 'letter_amount'],
|
|
42
|
+
},
|
|
43
|
+
draft: {
|
|
44
|
+
noun: 'letter', verb: 'send', actor: 'a person on your team', required: ['gifts', 'donor_id'],
|
|
45
|
+
description: 'Write drafts/letter-<donor id>.md: a thank-you and acknowledgement letter for every gift of one donor that has no letter or needs a corrected one, with the amounts and dates. Marked DRAFT; a person sends it.',
|
|
46
|
+
args: { donor_id: { type: 'string', description: 'Donor or constituent id as the check shows it' }, from: { type: 'string', description: 'Signer name and title' } },
|
|
47
|
+
build: (o, a, ctx) => {
|
|
48
|
+
const mine = o.items.filter((i) => i.donor_id === String(a.donor_id).trim() && i.findings.some((f) => f.code !== 'ack_late'));
|
|
49
|
+
if (!mine.length) throw new Error(`no gift from donor "${String(a.donor_id).slice(0, 40)}" needs a letter; pass a donor_id from acks_check`);
|
|
50
|
+
const d = mine[0]; const org = o.settings_used.organization || '[TO CONFIRM organization name]';
|
|
51
|
+
return { id: d.donor_id, to: d.email || undefined, amount: mine.reduce((t, i) => t + i.amount, 0), text: letter({ title: `Thank you for your gift${mine.length > 1 ? 's' : ''}`, to: d.email ? `${d.donor} <${d.email}>` : d.donor, from: a.from, re: `Acknowledgement from ${org}`,
|
|
52
|
+
intro: `Dear ${d.donor},\n\nThank you for your generous support of ${org}. This letter acknowledges the following contribution${mine.length > 1 ? 's' : ''}:`,
|
|
53
|
+
rows: mine.map((i) => ({ date: i.gift_date, amount: dollars(i.amount), gift: i.gift_id, note: i.findings.some((f) => f.code === 'ack_for_refunded_gift') ? 'Refunded: this replaces the earlier letter' : '' })), columns: ['date', 'amount', 'gift', 'note'],
|
|
54
|
+
closing: ['No goods or services were provided in exchange for these contributions. [TO CONFIRM: change this sentence if the donor received any benefit]', '', 'With gratitude,', '', a.from || '[TO CONFIRM signer]'] }) };
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
refused: [REFUSE.email, REFUSE.crm],
|
|
58
|
+
memory: null,
|
|
59
|
+
});
|