fairstay-covenant-tests
v0.1.0
Published
Loan and lease covenant tests for nursing homes: occupancy, rent coverage, debt service coverage, fixed charge coverage and days cash on hand, with cushions, near misses and reporting due dates.
Maintainers
Readme
Fairstay Covenant Tests (fairstay-covenant-tests)
Loan and lease covenant tests for nursing homes: occupancy, rent coverage, debt service coverage, fixed charge coverage and days cash on hand from monthly financials, with cushions, breaches, near misses and compliance reporting due dates. Arithmetic on your statements; your agreement defines each ratio. Loan numbers are masked before results reach the model.
Fairstay Covenant Tests never signs or sends compliance certificates.
Fairstay ver 1 · Financial services · MIT · Node 20 or newer · local files only · resident and staff identifiers masked before results reach the model · built on fairstay-core
npx -y fairstay-covenant-tests demo
npx -y fairstay-covenant-tests mcp --root ./facility-filesWhat the sample data shows
Fictional Cedar Hollow monthly financials from April 2025 to March 2026 (120 beds), tested on 20 April 2026. Occupancy falls from 86% to 79% in January and cash drops in February. Planted:
- Lease occupancy: 79% for the quarter against an 80% minimum, a breach.
- Bank fixed charge coverage: 1.09x against 1.10x, a breach.
- Bank days cash: about 24 days against 30, a breach.
- Lease rent coverage: 1.2x against 1.15x, a near miss.
- HUD debt service coverage passes, but its reporting is due 30 April.
Loan and lease numbers are in phi-canaries.json; they must never reach the model. rules-typo.json misspells a setting, so the check refuses it.
A demo run
npx -y fairstay-covenant-tests demo runs the agent on the fictional files in fixtures/ in a temporary folder. Captured output:
Fairstay Covenant Tests demo (fictional home, residents, staff and vendors)
▶ Test the covenants for March
status: executed decision: allow
5 covenant(s) tested for 2026-03. breach 3, near_miss 1, reporting_due 1, pass 1.
breach Lease occupancy: 79% against a 80% minimum (quarter to 2026-03).
breach Bank fixed charge coverage: 1.09x against a 1.1x minimum (trailing 12 months to 2026-03).
breach Bank days cash: 24.28 days against a 30 days minimum (month to 2026-03).
near_miss Lease rent coverage: 1.2x against a 1.15x minimum (trailing 12 months to 2026-03).
reporting_due HUD debt service coverage reporting for 2026-03 is due 2026-04-30 (10 days).
pass HUD debt service coverage: 2x against a 1.45x minimum (trailing 12 months to 2026-03).
▶ Write the compliance summary
status: executed decision: allow
Covenant compliance written: 5 covenant(s) tested for 2026-03. breach 3, near_miss 1, reporting_due 1, pass 1. Files: evergreen-out/covenants/covenants.csv, evergreen-out/covenants/covenants.html.
▶ Agent tries to send the certificate itself
status: blocked decision: block
reason: Fairstay Covenant Tests never signs or sends compliance certificates.Tools
| Tool | What it does | Policy |
|---|---|---|
| covenants_check | Work out each covenant for the month, with its cushion and reporting date. | runs |
| covenants_write_report | Write covenants.csv (one row per item, with blank owner and decision columns) and covenants.html into out_dir (default evergreen-out/covenants). | runs |
| covenants_recall | Search this agent's own memory of the customer's setup: accepted facts (in use) and facts waiting for a person. | runs |
| covenants_learn | Propose one fact about the customer's setup for this agent to remember. | runs |
| covenants_accept_learning | A named person accepts or rejects a fact waiting in this agent's memory. | one named click, even in Auto (accept_learning) |
| covenants_retire_memory | A named person stops an accepted fact from applying. | one named click, even in Auto (accept_learning) |
| compliance_certificate_send | Fairstay Covenant Tests never signs or sends compliance certificates. | refused |
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.
covenants_check arguments
| Argument | What it is |
|---|---|
| financials (required) | Monthly financials under --root: period, beds, patient days, EBITDAR, rent, interest, principal, operating expenses, cash |
| covenants (required) | Covenant list under --root: name, loan or lease, test (occupancy, rent_coverage, dscr, fccr, days_cash), minimum, test period (month, quarter, ttm), reporting days, delivered date |
| rules | Optional rules JSON: warn_pct, due_warn_days |
| period | Month to test, YYYY-MM (default the latest month in the financials) |
| as_of | Date for reporting deadlines (YYYY-MM-DD, default today) |
| status | Only items with this status |
| limit | Most items to return to the model (the report file always has all of them) |
Columns it reads
Tables can be CSV, TSV, semicolon- or pipe-separated text, Excel .xlsx, JSON or JSONL. Columns are matched by the names below (any case and punctuation), and by their usual names in German, French, Spanish, Portuguese, Italian, Japanese, Chinese and Korean. Dates become YYYY-MM-DD. Columns marked masked hold resident or staff identifiers.
The PointClickCare, MatrixCare and American HealthTech style names were written from public help pages and general knowledge, not checked against real exports. Run npx fairstay-covenant-tests inspect <file> (column names and shapes only, never values) and name any column it misses in remedy-sources.json.
Monthly financials (financials)
| Column | Type | Read from |
|---|---|---|
| period (required) | text | Period, Month, Fiscal Month, Period End |
| beds | number | Beds, Licensed Beds, Operating Beds |
| patient_days | number | Patient Days, Resident Days, Census Days |
| days | number | Days, Days in Period |
| ebitdar | amount | EBITDAR, EBITDARM, Operating Income Before Rent |
| rent | amount | Rent, Lease Expense, Rent Expense |
| interest | amount | Interest, Interest Expense |
| principal | amount | Principal, Principal Payments |
| operating_expenses | amount | Operating Expenses, Total Expenses, Cash Operating Expenses, Opex |
| cash | amount | Cash, Unrestricted Cash, Cash Balance |
Covenants (covenants)
| Column | Type | Read from |
|---|---|---|
| name (required) | text | Covenant, Name, Test |
| loan | text (masked) | Loan, Loan Number, Loan #, Lease, Agreement |
| test (required) | text | Measure, Type, Metric, Ratio |
| min (required) | number | Minimum, Min, Required, Threshold |
| period | text | Test Period, Basis, Measurement Period |
| reporting_days | number | Reporting Days, Due Days, Days After Period |
| delivered_on | date | Delivered, Delivered On, Sent On |
Settings file (covenants_rules)
A small JSON file you pass by path. A misspelled setting is refused by name rather than ignored, so a typo never silently changes a check.
| Setting | What it does |
|---|---|
| warn_pct | Flag cushions under this percent (default 10) |
| due_warn_days | Flag reporting due within this many days (default 14) |
Memory
covenants_learn only proposes a fact; nothing changes until a named person accepts it with covenants_accept_learning, which is one click even in Auto. Facts live in a hash-chained file under .remedy/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.
| Kind | What an accepted fact does |
|---|---|
| covenant_definition | is shown with results. It never changes a test. |
Install
Node 20 or newer. No other runtime dependencies besides fairstay-core and fairclaim-core.
{
"mcpServers": {
"fairstay-covenant-tests": {
"command": "npx",
"args": [
"-y",
"fairstay-covenant-tests",
"mcp",
"--root",
"/path/to/facility-files"
]
}
}
}Claude Code: claude mcp add fairstay-covenant-tests -- npx -y fairstay-covenant-tests mcp --root ., or use the plugin files in this folder.
CLI
fairstay-covenant-tests tools # every tool, its policy and arguments
fairstay-covenant-tests sources # the columns each input is read from
fairstay-covenant-tests inspect <file> # how a file would be read (names and shapes, never values)
fairstay-covenant-tests call covenants_check '{"financials":"<financials>","covenants":"<covenants>"}'
fairstay-covenant-tests eval # the private eval cases on the fictional fixtures
fairstay-covenant-tests demoResident and staff data
Results go to an AI model, so identifiers are masked before they leave the agent: resident and staff names become stable pseudonyms such as PT-3f9a1c2e, record and account numbers become MRN-… or ACCT-…, and e-mails and phone numbers are removed, also inside free text. Report files written to disk keep real names because staff work from them: keep them in a folder only your staff can open. The shared tests check that no fictional identifier from the fixtures reaches any eval result, and the hostile-input check plants spreadsheet formulas, HTML and AI-aimed instructions in the data. This keeps PHI away from the model; it is not a HIPAA compliance determination. Your business associate agreements, access controls and policies still apply.
Limits
- Reads only the files you give it. It does not log in to PointClickCare, MatrixCare, a payer portal, a bank, a state Medicaid portal or a payroll system.
- Medicare, Medicaid and payroll rules are summarised from public material as of 2026 and the numbers are settings you supply; a billing, payroll or legal professional checks them before you rely on them.
- Not legal, tax, accounting, clinical, reimbursement or HIPAA advice. A person decides what to bill, pay, appeal, file or send.
- Every call is written to a hash-chained audit log under
.remedy/in the root. No network calls, no telemetry, no credentials. The bundled data is fictional.
