fairbrief-billing-guidelines 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 +190 -2
- package/bin/fairbrief-billing-guidelines.js +7 -0
- package/evals/cases.json +342 -0
- package/evals/own.json +20 -0
- package/fixtures/README.md +8 -0
- package/fixtures/accuracy.json +82 -0
- package/fixtures/client-canaries.json +4 -0
- package/fixtures/guidelines-typo.json +1 -0
- package/fixtures/guidelines.json +18 -0
- package/fixtures/intl/README.md +8 -0
- package/fixtures/intl/de/mycase-time.csv +12 -0
- package/fixtures/intl/ja/mycase-time.csv +12 -0
- package/fixtures/mycase-time.csv +12 -0
- package/package.json +56 -4
- package/server.json +37 -0
- package/src/demo.js +13 -0
- package/src/index.js +2 -0
- package/src/logic.js +81 -0
- package/src/manifest.js +46 -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,191 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Fairbrief Billing Guidelines (`fairbrief-billing-guidelines`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Checks time entries against the outside counsel guidelines you write down for each client: rate caps by title, hours per day, billing increment, longest entry, banned tasks, block billing, administrative work, travel above the agreed share, task codes, titles the client will not pay for and staffing limits. Client names are masked before results reach the model.
|
|
4
|
+
|
|
5
|
+
**Fairbrief Billing Guidelines never uploads invoices to a client's e-billing portal. It never changes time entries; the timekeeper or billing team does.**
|
|
6
|
+
|
|
7
|
+
MIT · Node 20 or newer · local files only · client names masked before results reach the model · built on [`fairbrief-core`](../fairbrief-core)
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx -y fairbrief-billing-guidelines demo
|
|
11
|
+
npx -y fairbrief-billing-guidelines mcp --root ./firm-exports
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## What it checks
|
|
15
|
+
|
|
16
|
+
| Check | Severity | What it means | What a person does |
|
|
17
|
+
|---|---|---|---|
|
|
18
|
+
| `rate_over_cap` | error | The rate is above the client's cap for that title. | Bill at the cap or get approval from the client. |
|
|
19
|
+
| `daily_hours_over` | warning | The timekeeper bills more hours to this client on one day than the guideline allows. | Check the entries for the day; split or explain them. |
|
|
20
|
+
| `increment` | error | The hours are not a multiple of the client's billing increment. | Round the entry to the increment the client allows. |
|
|
21
|
+
| `entry_too_long` | warning | One entry is longer than the client allows for a single task. | Split it into its tasks with their own time. |
|
|
22
|
+
| `banned_task` | error | The description names a task the client will not pay for. | Remove the entry from the bill or write it off. |
|
|
23
|
+
| `block_billed` | error | Several tasks share one time figure and the client does not allow block billing. | Split the entry so each task has its own time. |
|
|
24
|
+
| `admin_work` | error | The entry describes administrative work the client does not pay for. | Mark it no-charge. |
|
|
25
|
+
| `travel_full_rate` | error | Travel time is billed above the share of the rate the client allows. | Bill travel at the agreed share of the rate. |
|
|
26
|
+
| `missing_task_code` | error | The entry has no UTBMS task code, or only a phase code, and the client requires task codes. | Add the task code (for example L120, not L100). |
|
|
27
|
+
| `title_not_billable` | error | The client does not pay for time by this title (for example summer associates). | Mark the time no-charge. |
|
|
28
|
+
| `too_many_timekeepers` | warning | More timekeepers worked on the matter than the client allows. | Agree staffing with the client or write off the extra timekeepers' time. |
|
|
29
|
+
|
|
30
|
+
<!-- generated:start -->
|
|
31
|
+
|
|
32
|
+
## A demo run
|
|
33
|
+
|
|
34
|
+
`npx -y fairbrief-billing-guidelines demo` runs the agent on the fictional files in [`fixtures/`](fixtures) in a temporary folder. Captured output:
|
|
35
|
+
|
|
36
|
+
```text
|
|
37
|
+
Fairbrief Billing Guidelines demo (fictional firm, client and guidelines) in <demo folder>
|
|
38
|
+
|
|
39
|
+
▶ Check October time against the client guidelines (a MyCase layout)
|
|
40
|
+
status: executed decision: allow
|
|
41
|
+
10 entr(ies) for 1 client(s) with guidelines checked (1 for clients without guidelines not checked): 8 would likely be rejected, 2 to review.
|
|
42
|
+
T-0001 Dana Whitlock rate_over_cap
|
|
43
|
+
T-0002 Dana Whitlock daily_hours_over
|
|
44
|
+
T-0003 Priya Natarajan increment
|
|
45
|
+
T-0004 Priya Natarajan banned_task
|
|
46
|
+
T-0005 Tomas Lindgren block_billed
|
|
47
|
+
T-0006 Grace Obi admin_work
|
|
48
|
+
T-0007 Marcus Eriksen travel_full_rate
|
|
49
|
+
T-0008 Leo Brandt missing_task_code
|
|
50
|
+
T-0009 Jules Ferrand title_not_billable
|
|
51
|
+
M:2501 too_many_timekeepers
|
|
52
|
+
|
|
53
|
+
▶ Write the worklist
|
|
54
|
+
status: executed decision: allow
|
|
55
|
+
Worklist written: 10 entr(ies) for 1 client(s) with guidelines checked (1 for clients without guidelines not checked): 8 would likely be rejected, 2 to review. Files: fairbrief-out/guidelines/billing-guidelines.csv, fairbrief-out/guidelines/billing-guidelines.html.
|
|
56
|
+
|
|
57
|
+
▶ Agent tries to upload the bill itself
|
|
58
|
+
status: blocked decision: block
|
|
59
|
+
reason: Fairbrief Billing Guidelines never uploads invoices to a client's e-billing portal.
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Tools
|
|
63
|
+
|
|
64
|
+
| Tool | What it does | Policy |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| `guidelines_check` | Each entry for a client with guidelines that breaks one of the client's rules, with the rule and the amount at stake; matters with more timekeepers than allowed (M:<matter>). | runs |
|
|
67
|
+
| `guidelines_explain` | Show one entry from guidelines_check with every finding and the figures it was checked against. | runs |
|
|
68
|
+
| `guidelines_checks` | List every check guidelines runs, what it looks for and what a person does about it. | runs |
|
|
69
|
+
| `guidelines_write_report` | Write billing-guidelines.csv (one row per item, with blank owner, decision and notes columns) and billing-guidelines.html into out_dir (default fairbrief-out/guidelines). | runs |
|
|
70
|
+
| `ebilling_submit` | Fairbrief Billing Guidelines never uploads invoices to a client's e-billing portal. | refused |
|
|
71
|
+
| `time_entry_edit` | Fairbrief Billing Guidelines never changes time entries; the timekeeper or billing team does. | refused |
|
|
72
|
+
|
|
73
|
+
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.
|
|
74
|
+
|
|
75
|
+
## Columns it reads
|
|
76
|
+
|
|
77
|
+
Table inputs can be CSV, TSV, semicolon- or pipe-separated text, Excel `.xlsx`, JSON or JSONL; invoice lines can also be LEDES 1998B files. Columns are matched by the agent's own name, then by the English names below, then by their names in German, French, Spanish, Portuguese, Italian, Japanese, Chinese and Korean. Dates become `YYYY-MM-DD`; amounts are read with either decimal mark. Every result lists under `sources` how each file was read. Columns marked *masked* hold client or party data: the model sees a pseudonym or nothing (see Client data).
|
|
78
|
+
|
|
79
|
+
### Time entries (`time`)
|
|
80
|
+
|
|
81
|
+
| Column | Type | Also read as | For example, in other languages |
|
|
82
|
+
|---|---|---|---|
|
|
83
|
+
| `entry_id` | text | Entry ID, Activity ID, Time Entry ID, Entry #, Slip ID, Slip Number | - |
|
|
84
|
+
| `date` | date | Date, Entry Date, Work Date, Activity Date, Date Worked, Service Date | Datum, Date, 日付, 日期 |
|
|
85
|
+
| `timekeeper` | text | Timekeeper, User, Attorney, Lawyer, Staff, Billing User | Zeiterfasser, Intervenant, 担当弁護士, 计时人员 |
|
|
86
|
+
| `timekeeper_id` | text | Timekeeper ID, TK ID, Timekeeper Number, Tkpr, TK, Initials | - |
|
|
87
|
+
| `timekeeper_class` | text | Title, Role, Classification, Timekeeper Classification, Rank, Level | Rolle, Rôle, ロール, 角色 |
|
|
88
|
+
| `matter` | text | Matter, Matter Number, Matter ID, Matter No, Matter #, Display Number | Mandat, Dossier, 案件番号, 案件编号 |
|
|
89
|
+
| `matter_name` | text (masked) | Matter Name, Matter Description, Case Name, File Name | Mandatsbezeichnung, Intitulé du dossier, 案件名, 案件名称 |
|
|
90
|
+
| `client` | text (masked) | Client, Client Name, Client Full Name, Billing Client, Contact, Client/Company | Mandant, Nom du client, 依頼者, 客户名称 |
|
|
91
|
+
| `hours` | number | Hours, Quantity, Qty, Time, Duration, Hours Worked | Stunden, Heures, 時間, 小时 |
|
|
92
|
+
| `rate` | amount | Rate, Hourly Rate, Billing Rate, Price, Unit Price, Std Rate | Stundensatz, Taux horaire, 単価, 费率 |
|
|
93
|
+
| `amount` | amount | Amount, Total, Value, Billable Amount, Fee Amount, Line Total | Betrag, Montant, 金額, 金额 |
|
|
94
|
+
| `billable` | yes/no | Billable, Is Billable, Billable? | - |
|
|
95
|
+
| `description` | text | Description, Narrative, Note, Notes, Activity Description, Detail | Beschreibung, Description, 摘要, 摘要 |
|
|
96
|
+
| `task_code` | text | Task Code, UTBMS Task, UTBMS Task Code, Task, Phase/Task, Phase Task | - |
|
|
97
|
+
| `activity_code` | text | Activity Code, UTBMS Activity, UTBMS Activity Code, Line Item Activity Code | - |
|
|
98
|
+
| `billed_status` | text | Status, Bill Status, Billing Status, Billed, State, Entry Status | Status, Statut, ステータス, 状态 |
|
|
99
|
+
| `invoice_number` | text | Invoice, Invoice Number, Invoice #, Bill Number, Bill #, Bill No | Rechnungsnummer, N° de facture, 請求書番号, 发票号 |
|
|
100
|
+
| `billed_amount` | amount | Billed Amount, Amount Billed, Billed Value, Bill Amount | - |
|
|
101
|
+
| `written_off` | amount | Write Off, Write-Off, Written Off, Write Down, Write-Down, Discount | - |
|
|
102
|
+
| `collected` | amount | Collected, Amount Collected, Payments Applied, Received, Paid Amount | - |
|
|
103
|
+
| `billed_date` | date | Billed Date, Bill Date, Invoice Date, Date Billed | - |
|
|
104
|
+
|
|
105
|
+
Named exports recognised by their column names:
|
|
106
|
+
|
|
107
|
+
| System | Export | Recognised by | Layout checked against vendor docs |
|
|
108
|
+
|---|---|---|---|
|
|
109
|
+
| Clio Manage | Activities export, time entries (CSV) | Quantity, User, Matter, Rate, Billed | no |
|
|
110
|
+
| PracticePanther | Time entries export (CSV) | Billed By, Matter, Hours, Billable | no |
|
|
111
|
+
| MyCase | Time entries report (CSV) | Case, User, Hours, Billable | no |
|
|
112
|
+
| Smokeball | Fee entries export (CSV) | Staff, Matter, Hours, Amount | no |
|
|
113
|
+
| CosmoLex | Time entries report (CSV) | Timekeeper, Matter, Hours, Status | no |
|
|
114
|
+
| PCLaw | Time listing (CSV) | Lawyer, Matter, Explanation, Hours | no |
|
|
115
|
+
| Tabs3 Billing | Fee journal (CSV) | Tkpr, Client, Hours, Rate | no |
|
|
116
|
+
| Aderant Expert | Time detail report (CSV) | Work Date, Timekeeper, Narrative, Hours | no |
|
|
117
|
+
| Elite 3E | Timecard detail (CSV) | Work Date, Work Hrs, Work Rate, Work Amt | no |
|
|
118
|
+
|
|
119
|
+
Every named layout (Clio, PracticePanther, MyCase, Smokeball, CosmoLex, PCLaw, Tabs3, Aderant, Elite 3E, QuickBooks, bank downloads, Outlook) was written from knowledge of the export and was not checked against the vendor documentation or a live account. A file whose headers differ still maps by each column's other names; inspect shows what matched.
|
|
120
|
+
|
|
121
|
+
### Files from other countries
|
|
122
|
+
|
|
123
|
+
A German export in Windows-1252 with semicolons, `1.234,56` and `03.11.2026`, or a Japanese one in Shift_JIS with `2026/11/03`, is read the same way as the English file: `npm run intl` in the repository rewrites every eval fixture the way a German, French, Spanish, Brazilian, Italian, Japanese, Chinese and Korean export would write it and requires the same results. Columns named differently? Run `npx fairbrief-billing-guidelines inspect <file>` (names and shapes only, never values) and name them in `fairbrief-sources.json`:
|
|
124
|
+
|
|
125
|
+
```json
|
|
126
|
+
{ "files": { "exports/time.csv": { "columns": { "matter": "Aktenzeichen" }, "date_order": "dmy" } } }
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Install
|
|
130
|
+
|
|
131
|
+
Node 20 or newer. No other dependencies.
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
npx -y fairbrief-billing-guidelines demo
|
|
135
|
+
npx -y fairbrief-billing-guidelines mcp --root /path/to/your/files
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Claude Desktop, Cursor and other MCP hosts:
|
|
139
|
+
|
|
140
|
+
```json
|
|
141
|
+
{
|
|
142
|
+
"mcpServers": {
|
|
143
|
+
"fairbrief-billing-guidelines": {
|
|
144
|
+
"command": "npx",
|
|
145
|
+
"args": [
|
|
146
|
+
"-y",
|
|
147
|
+
"fairbrief-billing-guidelines",
|
|
148
|
+
"mcp",
|
|
149
|
+
"--root",
|
|
150
|
+
"/path/to/your/files"
|
|
151
|
+
]
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Claude Code: `claude mcp add fairbrief-billing-guidelines -- npx -y fairbrief-billing-guidelines mcp --root .`, or install the `fairbrief-billing-guidelines` plugin from this repository's marketplace (`fairbrief-law-firm`).
|
|
158
|
+
|
|
159
|
+
## Modes and approvals
|
|
160
|
+
|
|
161
|
+
- **Review** (`--mode review`): reads and reports only.
|
|
162
|
+
- **Assist** (default): the policy above. A tool that asks returns an `approval_id`; a person approves it once with `fairbrief-billing-guidelines approve <id> --as "Your Name"` (or on the local approvals page, `fairbrief-billing-guidelines approvals`), and the same call is repeated.
|
|
163
|
+
- **Auto** (`--mode auto --auto <tool,...>`): opt-in per tool, with step caps and a kill switch (`fairbrief-billing-guidelines kill`). Sending, moving money, going live and accepting a learned fact stay **one named click even in Auto**; an approval is tied to the sha256 of the reviewed draft, so a changed draft needs a new click.
|
|
164
|
+
|
|
165
|
+
## CLI
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
fairbrief-billing-guidelines tools # every tool, its policy and arguments
|
|
169
|
+
fairbrief-billing-guidelines sources # the columns each input is read from
|
|
170
|
+
fairbrief-billing-guidelines inspect <file> # how a file would be read (names and shapes, never values)
|
|
171
|
+
fairbrief-billing-guidelines call guidelines_check '{"time":"<time>","guidelines":"<guidelines>"}'
|
|
172
|
+
fairbrief-billing-guidelines eval # the private eval cases on the fictional fixtures
|
|
173
|
+
fairbrief-billing-guidelines demo
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Client data
|
|
177
|
+
|
|
178
|
+
Results go to an AI model, so client data is masked before it leaves the agent (`--mask mask`, the default): client, party, payee and referral-source names, matter names and bank account numbers become stable pseudonyms such as `CL-3f9a1c2e`; addresses, phones, e-mails and tax ids are removed, also inside free text. `--mask strict` also hides matter numbers and ZIP codes. Tools still take a pseudonym back as an argument. Report files written to disk keep real names, because people at the firm work from them: keep them in a folder only your staff can open. `--mask off` is possible and is recorded in the audit log. The shared tests check that no fictional client name from the fixtures reaches any eval result. Masking keeps client names away from the model; whether your firm may use an AI model with client data at all is the firm's decision under its confidentiality duties.
|
|
179
|
+
|
|
180
|
+
## Audit log and data
|
|
181
|
+
|
|
182
|
+
Every call is written to `.fairbrief/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.
|
|
183
|
+
|
|
184
|
+
<!-- generated:end -->
|
|
185
|
+
|
|
186
|
+
## Limits
|
|
187
|
+
|
|
188
|
+
- It checks only what is in the files and settings you load. Trust-accounting rules, billing guidelines, CLE requirements and limits differ by state, client and firm: they live in your settings, and every result says when nobody at the firm has confirmed them. The example settings in `fixtures/` are not any state's or client's rules.
|
|
189
|
+
- It is not legal, ethics, tax or accounting advice. A person at the firm reviews every result; the agent never moves trust money, files with a court, sends anything or changes your practice-management system.
|
|
190
|
+
- Export layouts named in "Columns it reads" were written from knowledge of each system and not tested against a live account; `inspect` shows how a file was read.
|
|
191
|
+
- Masking keeps client names away from the model; it does not decide whether your firm may use an AI model with client data. That is a decision for the firm under its confidentiality duties.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { fileURLToPath } from 'node:url';
|
|
3
|
+
import { main } from 'fairbrief-core';
|
|
4
|
+
import { manifest } from '../src/manifest.js';
|
|
5
|
+
import { demo } from '../src/demo.js';
|
|
6
|
+
|
|
7
|
+
main(manifest, { bin: 'fairbrief-billing-guidelines', demo, evalFile: fileURLToPath(new URL('../evals/cases.json', import.meta.url)) });
|
package/evals/cases.json
ADDED
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
{
|
|
2
|
+
"suite": "fairbrief-billing-guidelines",
|
|
3
|
+
"root": "..",
|
|
4
|
+
"data_note": "Fictional fixtures in ../fixtures. Deterministic checks; no model is called.",
|
|
5
|
+
"cases": [
|
|
6
|
+
{
|
|
7
|
+
"id": "october-entries",
|
|
8
|
+
"tool": "guidelines_check",
|
|
9
|
+
"args": {
|
|
10
|
+
"time": "fixtures/mycase-time.csv",
|
|
11
|
+
"guidelines": "fixtures/guidelines.json"
|
|
12
|
+
},
|
|
13
|
+
"expect": {
|
|
14
|
+
"status": "executed",
|
|
15
|
+
"equals": {
|
|
16
|
+
"result.checked": 10,
|
|
17
|
+
"result.not_covered": 1,
|
|
18
|
+
"result.flagged": 10,
|
|
19
|
+
"result.by_check.rate_over_cap": 1,
|
|
20
|
+
"result.by_check.daily_hours_over": 1,
|
|
21
|
+
"result.by_check.increment": 1,
|
|
22
|
+
"result.by_check.banned_task": 1,
|
|
23
|
+
"result.by_check.block_billed": 1,
|
|
24
|
+
"result.by_check.admin_work": 1,
|
|
25
|
+
"result.by_check.travel_full_rate": 1,
|
|
26
|
+
"result.by_check.missing_task_code": 1,
|
|
27
|
+
"result.by_check.title_not_billable": 1,
|
|
28
|
+
"result.by_check.too_many_timekeepers": 1
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"id": "reasons-with-rules",
|
|
34
|
+
"tool": "guidelines_check",
|
|
35
|
+
"args": {
|
|
36
|
+
"time": "fixtures/mycase-time.csv",
|
|
37
|
+
"guidelines": "fixtures/guidelines.json"
|
|
38
|
+
},
|
|
39
|
+
"expect": {
|
|
40
|
+
"contains": [
|
|
41
|
+
"the cap for Partner is 450",
|
|
42
|
+
"Dana Whitlock billed 11 hours to this client on 2026-10-05; the limit is 10",
|
|
43
|
+
"1.25 hours is not a multiple of 0.1",
|
|
44
|
+
"4 tasks under one figure of 4 hours",
|
|
45
|
+
"travel billed at 1700; at 50% of the rate it is 850",
|
|
46
|
+
"7 timekeepers billed to matter 2501; the client allows 4"
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"id": "clean-entry-not-listed",
|
|
52
|
+
"tool": "guidelines_check",
|
|
53
|
+
"args": {
|
|
54
|
+
"time": "fixtures/mycase-time.csv",
|
|
55
|
+
"guidelines": "fixtures/guidelines.json"
|
|
56
|
+
},
|
|
57
|
+
"expect": {
|
|
58
|
+
"not_contains": [
|
|
59
|
+
"T-0010",
|
|
60
|
+
"T-0011"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"id": "summer-associate-explained",
|
|
66
|
+
"tool": "guidelines_explain",
|
|
67
|
+
"args": {
|
|
68
|
+
"time": "fixtures/mycase-time.csv",
|
|
69
|
+
"guidelines": "fixtures/guidelines.json",
|
|
70
|
+
"entry_id": "T-0009"
|
|
71
|
+
},
|
|
72
|
+
"expect": {
|
|
73
|
+
"status": "executed",
|
|
74
|
+
"contains": [
|
|
75
|
+
"title_not_billable",
|
|
76
|
+
"Summer Associate"
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"id": "guidelines-are-required",
|
|
82
|
+
"tool": "guidelines_check",
|
|
83
|
+
"args": {
|
|
84
|
+
"time": "fixtures/mycase-time.csv"
|
|
85
|
+
},
|
|
86
|
+
"expect": {
|
|
87
|
+
"status": "error",
|
|
88
|
+
"contains": [
|
|
89
|
+
"guidelines"
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"id": "mycase-layout",
|
|
95
|
+
"tool": "guidelines_check",
|
|
96
|
+
"args": {
|
|
97
|
+
"time": "fixtures/mycase-time.csv",
|
|
98
|
+
"guidelines": "fixtures/guidelines.json"
|
|
99
|
+
},
|
|
100
|
+
"expect": {
|
|
101
|
+
"contains": [
|
|
102
|
+
"mycase_time"
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
"id": "std-check-in-review-mode",
|
|
108
|
+
"tool": "guidelines_check",
|
|
109
|
+
"mode": "review",
|
|
110
|
+
"args": {
|
|
111
|
+
"time": "fixtures/mycase-time.csv",
|
|
112
|
+
"guidelines": "fixtures/guidelines.json"
|
|
113
|
+
},
|
|
114
|
+
"expect": {
|
|
115
|
+
"status": "executed"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"id": "std-limit-one",
|
|
120
|
+
"tool": "guidelines_check",
|
|
121
|
+
"args": {
|
|
122
|
+
"time": "fixtures/mycase-time.csv",
|
|
123
|
+
"guidelines": "fixtures/guidelines.json",
|
|
124
|
+
"limit": 1
|
|
125
|
+
},
|
|
126
|
+
"expect": {
|
|
127
|
+
"status": "executed",
|
|
128
|
+
"max": {
|
|
129
|
+
"result.items.length": 1
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
"id": "std-masked",
|
|
135
|
+
"tool": "guidelines_check",
|
|
136
|
+
"args": {
|
|
137
|
+
"time": "fixtures/mycase-time.csv",
|
|
138
|
+
"guidelines": "fixtures/guidelines.json"
|
|
139
|
+
},
|
|
140
|
+
"expect": {
|
|
141
|
+
"status": "executed",
|
|
142
|
+
"not_contains": [
|
|
143
|
+
"Sample Freight Inc",
|
|
144
|
+
"Example Holdings LLC",
|
|
145
|
+
"Sample Freight"
|
|
146
|
+
]
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
"id": "std-report",
|
|
151
|
+
"tool": "guidelines_write_report",
|
|
152
|
+
"args": {
|
|
153
|
+
"time": "fixtures/mycase-time.csv",
|
|
154
|
+
"guidelines": "fixtures/guidelines.json"
|
|
155
|
+
},
|
|
156
|
+
"expect": {
|
|
157
|
+
"status": "executed",
|
|
158
|
+
"contains": [
|
|
159
|
+
".csv",
|
|
160
|
+
".html"
|
|
161
|
+
],
|
|
162
|
+
"not_contains": [
|
|
163
|
+
"Sample Freight Inc",
|
|
164
|
+
"Example Holdings LLC"
|
|
165
|
+
]
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"id": "std-report-german",
|
|
170
|
+
"tool": "guidelines_write_report",
|
|
171
|
+
"args": {
|
|
172
|
+
"time": "fixtures/mycase-time.csv",
|
|
173
|
+
"guidelines": "fixtures/guidelines.json",
|
|
174
|
+
"language": "de"
|
|
175
|
+
},
|
|
176
|
+
"expect": {
|
|
177
|
+
"status": "executed",
|
|
178
|
+
"equals": {
|
|
179
|
+
"result.lang": "de"
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"id": "std-checks-list",
|
|
185
|
+
"tool": "guidelines_checks",
|
|
186
|
+
"args": {},
|
|
187
|
+
"expect": {
|
|
188
|
+
"status": "executed"
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"id": "std-explain",
|
|
193
|
+
"tool": "guidelines_explain",
|
|
194
|
+
"args": {
|
|
195
|
+
"time": "fixtures/mycase-time.csv",
|
|
196
|
+
"guidelines": "fixtures/guidelines.json",
|
|
197
|
+
"entry_id": "T-0007"
|
|
198
|
+
},
|
|
199
|
+
"expect": {
|
|
200
|
+
"status": "executed",
|
|
201
|
+
"contains": [
|
|
202
|
+
"T-0007"
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
"id": "std-explain-unknown",
|
|
208
|
+
"tool": "guidelines_explain",
|
|
209
|
+
"args": {
|
|
210
|
+
"time": "fixtures/mycase-time.csv",
|
|
211
|
+
"guidelines": "fixtures/guidelines.json",
|
|
212
|
+
"entry_id": "NO-SUCH-ITEM"
|
|
213
|
+
},
|
|
214
|
+
"expect": {
|
|
215
|
+
"status": "error",
|
|
216
|
+
"contains": [
|
|
217
|
+
"not found"
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"id": "std-missing-file",
|
|
223
|
+
"tool": "guidelines_check",
|
|
224
|
+
"args": {
|
|
225
|
+
"time": "fixtures/no-such-file.csv",
|
|
226
|
+
"guidelines": "fixtures/guidelines.json"
|
|
227
|
+
},
|
|
228
|
+
"expect": {
|
|
229
|
+
"status": "error",
|
|
230
|
+
"contains": [
|
|
231
|
+
"file not found"
|
|
232
|
+
]
|
|
233
|
+
}
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
"id": "std-outside-root",
|
|
237
|
+
"tool": "guidelines_check",
|
|
238
|
+
"args": {
|
|
239
|
+
"time": "../../../../etc/passwd",
|
|
240
|
+
"guidelines": "fixtures/guidelines.json"
|
|
241
|
+
},
|
|
242
|
+
"expect": {
|
|
243
|
+
"status": "error",
|
|
244
|
+
"matches": [
|
|
245
|
+
"outside|leaves the allowed root"
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"id": "std-settings-typo",
|
|
251
|
+
"tool": "guidelines_check",
|
|
252
|
+
"args": {
|
|
253
|
+
"time": "fixtures/mycase-time.csv",
|
|
254
|
+
"guidelines": "fixtures/guidelines-typo.json"
|
|
255
|
+
},
|
|
256
|
+
"expect": {
|
|
257
|
+
"status": "error",
|
|
258
|
+
"contains": [
|
|
259
|
+
"is not a valid"
|
|
260
|
+
]
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
{
|
|
264
|
+
"id": "std-unknown-tool",
|
|
265
|
+
"tool": "shell_exec",
|
|
266
|
+
"args": {
|
|
267
|
+
"cmd": "whoami"
|
|
268
|
+
},
|
|
269
|
+
"expect": {
|
|
270
|
+
"status": "blocked"
|
|
271
|
+
}
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"id": "std-refused-ebilling_submit",
|
|
275
|
+
"tool": "ebilling_submit",
|
|
276
|
+
"args": {},
|
|
277
|
+
"expect": {
|
|
278
|
+
"status": "blocked"
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"id": "std-refused-time_entry_edit",
|
|
283
|
+
"tool": "time_entry_edit",
|
|
284
|
+
"args": {},
|
|
285
|
+
"expect": {
|
|
286
|
+
"status": "blocked"
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
"id": "intl-de-october-entries",
|
|
291
|
+
"tool": "guidelines_check",
|
|
292
|
+
"args": {
|
|
293
|
+
"time": "fixtures/intl/de/mycase-time.csv",
|
|
294
|
+
"guidelines": "fixtures/guidelines.json"
|
|
295
|
+
},
|
|
296
|
+
"expect": {
|
|
297
|
+
"status": "executed",
|
|
298
|
+
"equals": {
|
|
299
|
+
"result.checked": 10,
|
|
300
|
+
"result.not_covered": 1,
|
|
301
|
+
"result.flagged": 10,
|
|
302
|
+
"result.by_check.rate_over_cap": 1,
|
|
303
|
+
"result.by_check.daily_hours_over": 1,
|
|
304
|
+
"result.by_check.increment": 1,
|
|
305
|
+
"result.by_check.banned_task": 1,
|
|
306
|
+
"result.by_check.block_billed": 1,
|
|
307
|
+
"result.by_check.admin_work": 1,
|
|
308
|
+
"result.by_check.travel_full_rate": 1,
|
|
309
|
+
"result.by_check.missing_task_code": 1,
|
|
310
|
+
"result.by_check.title_not_billable": 1,
|
|
311
|
+
"result.by_check.too_many_timekeepers": 1
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"id": "intl-ja-october-entries",
|
|
317
|
+
"tool": "guidelines_check",
|
|
318
|
+
"args": {
|
|
319
|
+
"time": "fixtures/intl/ja/mycase-time.csv",
|
|
320
|
+
"guidelines": "fixtures/guidelines.json"
|
|
321
|
+
},
|
|
322
|
+
"expect": {
|
|
323
|
+
"status": "executed",
|
|
324
|
+
"equals": {
|
|
325
|
+
"result.checked": 10,
|
|
326
|
+
"result.not_covered": 1,
|
|
327
|
+
"result.flagged": 10,
|
|
328
|
+
"result.by_check.rate_over_cap": 1,
|
|
329
|
+
"result.by_check.daily_hours_over": 1,
|
|
330
|
+
"result.by_check.increment": 1,
|
|
331
|
+
"result.by_check.banned_task": 1,
|
|
332
|
+
"result.by_check.block_billed": 1,
|
|
333
|
+
"result.by_check.admin_work": 1,
|
|
334
|
+
"result.by_check.travel_full_rate": 1,
|
|
335
|
+
"result.by_check.missing_task_code": 1,
|
|
336
|
+
"result.by_check.title_not_billable": 1,
|
|
337
|
+
"result.by_check.too_many_timekeepers": 1
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
]
|
|
342
|
+
}
|
package/evals/own.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"root": "..",
|
|
3
|
+
"base": { "time": "fixtures/mycase-time.csv", "guidelines": "fixtures/guidelines.json" },
|
|
4
|
+
"item": "T-0007",
|
|
5
|
+
"settings_typo": "fixtures/guidelines-typo.json",
|
|
6
|
+
"cases": [
|
|
7
|
+
{ "id": "october-entries", "tool": "guidelines_check", "args": { "time": "fixtures/mycase-time.csv", "guidelines": "fixtures/guidelines.json" },
|
|
8
|
+
"expect": { "status": "executed", "equals": { "result.checked": 10, "result.not_covered": 1, "result.flagged": 10, "result.by_check.rate_over_cap": 1, "result.by_check.daily_hours_over": 1, "result.by_check.increment": 1, "result.by_check.banned_task": 1, "result.by_check.block_billed": 1, "result.by_check.admin_work": 1, "result.by_check.travel_full_rate": 1, "result.by_check.missing_task_code": 1, "result.by_check.title_not_billable": 1, "result.by_check.too_many_timekeepers": 1 } } },
|
|
9
|
+
{ "id": "reasons-with-rules", "tool": "guidelines_check", "args": { "time": "fixtures/mycase-time.csv", "guidelines": "fixtures/guidelines.json" },
|
|
10
|
+
"expect": { "contains": ["the cap for Partner is 450", "Dana Whitlock billed 11 hours to this client on 2026-10-05; the limit is 10", "1.25 hours is not a multiple of 0.1", "4 tasks under one figure of 4 hours", "travel billed at 1700; at 50% of the rate it is 850", "7 timekeepers billed to matter 2501; the client allows 4"] } },
|
|
11
|
+
{ "id": "clean-entry-not-listed", "tool": "guidelines_check", "args": { "time": "fixtures/mycase-time.csv", "guidelines": "fixtures/guidelines.json" },
|
|
12
|
+
"expect": { "not_contains": ["T-0010", "T-0011"] } },
|
|
13
|
+
{ "id": "summer-associate-explained", "tool": "guidelines_explain", "args": { "time": "fixtures/mycase-time.csv", "guidelines": "fixtures/guidelines.json", "entry_id": "T-0009" },
|
|
14
|
+
"expect": { "status": "executed", "contains": ["title_not_billable", "Summer Associate"] } },
|
|
15
|
+
{ "id": "guidelines-are-required", "tool": "guidelines_check", "args": { "time": "fixtures/mycase-time.csv" },
|
|
16
|
+
"expect": { "status": "error", "contains": ["guidelines"] } },
|
|
17
|
+
{ "id": "mycase-layout", "tool": "guidelines_check", "args": { "time": "fixtures/mycase-time.csv", "guidelines": "fixtures/guidelines.json" },
|
|
18
|
+
"expect": { "contains": ["mycase_time"] } }
|
|
19
|
+
]
|
|
20
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Fairbrief Billing Guidelines fixtures
|
|
2
|
+
|
|
3
|
+
Everything here is fictional: the firm (Example Ridge Law LLP), timekeepers, clients, matters and the guideline rules.
|
|
4
|
+
|
|
5
|
+
- `mycase-time.csv`: eleven October entries in a MyCase time export layout (Case, User, Hours, Billable; US dates) with Title, Client and Task Code columns.
|
|
6
|
+
- `guidelines.json`: one client block for Sample Freight Inc with example rules (not any real client's guidelines). `guidelines-typo.json` has a misspelt key.
|
|
7
|
+
|
|
8
|
+
Planted for Sample Freight Inc: a partner at 475 against a 450 cap; 11 hours in one day; 1.25 hours against a 0.1 increment; "File review"; a block-billed entry; scanning and filing; travel at the full rate; an entry with no task code; a summer associate; seven timekeepers against a limit of four. One entry is clean; one entry for Example Holdings LLC has no guidelines and is not checked.
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"note": "Accuracy recipe for scripts/accuracy.mjs. \"planted\" was checked by hand against the Planted paragraph of README.md in this folder (19 Nov 2026).",
|
|
3
|
+
"case": "october-entries",
|
|
4
|
+
"planted": [
|
|
5
|
+
[
|
|
6
|
+
"T-0001",
|
|
7
|
+
"rate_over_cap"
|
|
8
|
+
],
|
|
9
|
+
[
|
|
10
|
+
"T-0002",
|
|
11
|
+
"daily_hours_over"
|
|
12
|
+
],
|
|
13
|
+
[
|
|
14
|
+
"T-0003",
|
|
15
|
+
"increment"
|
|
16
|
+
],
|
|
17
|
+
[
|
|
18
|
+
"T-0004",
|
|
19
|
+
"banned_task"
|
|
20
|
+
],
|
|
21
|
+
[
|
|
22
|
+
"T-0005",
|
|
23
|
+
"block_billed"
|
|
24
|
+
],
|
|
25
|
+
[
|
|
26
|
+
"T-0006",
|
|
27
|
+
"admin_work"
|
|
28
|
+
],
|
|
29
|
+
[
|
|
30
|
+
"T-0007",
|
|
31
|
+
"travel_full_rate"
|
|
32
|
+
],
|
|
33
|
+
[
|
|
34
|
+
"T-0008",
|
|
35
|
+
"missing_task_code"
|
|
36
|
+
],
|
|
37
|
+
[
|
|
38
|
+
"T-0009",
|
|
39
|
+
"title_not_billable"
|
|
40
|
+
],
|
|
41
|
+
[
|
|
42
|
+
"M:2501",
|
|
43
|
+
"too_many_timekeepers"
|
|
44
|
+
]
|
|
45
|
+
],
|
|
46
|
+
"clean": {
|
|
47
|
+
"edits": [
|
|
48
|
+
{
|
|
49
|
+
"arg": "time",
|
|
50
|
+
"dropRows": [
|
|
51
|
+
1,
|
|
52
|
+
2,
|
|
53
|
+
3,
|
|
54
|
+
4,
|
|
55
|
+
5,
|
|
56
|
+
6,
|
|
57
|
+
7,
|
|
58
|
+
8,
|
|
59
|
+
9
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"mutations": [
|
|
65
|
+
{
|
|
66
|
+
"name": "hours not in the client's increment",
|
|
67
|
+
"edits": [
|
|
68
|
+
{
|
|
69
|
+
"arg": "time",
|
|
70
|
+
"set": [
|
|
71
|
+
{
|
|
72
|
+
"row": 1,
|
|
73
|
+
"column": "Hours",
|
|
74
|
+
"value": "1.25"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"expect": "increment"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "clients": [ { "client": "Sample Freight Inc", "max_rate": 450 } ] }
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"clients": [
|
|
3
|
+
{
|
|
4
|
+
"client": "Sample Freight Inc",
|
|
5
|
+
"max_rates": { "Partner": 450, "Associate": 280, "Paralegal": 140 },
|
|
6
|
+
"max_daily_hours": 10,
|
|
7
|
+
"increment": 0.1,
|
|
8
|
+
"max_entry_hours": 8,
|
|
9
|
+
"banned_words": ["file review", "conference with team", "internal meeting"],
|
|
10
|
+
"no_block_billing": true,
|
|
11
|
+
"no_admin_work": true,
|
|
12
|
+
"travel_pct": 50,
|
|
13
|
+
"require_task_codes": true,
|
|
14
|
+
"not_billable_titles": ["Summer Associate", "Librarian"],
|
|
15
|
+
"max_timekeepers_per_matter": 4
|
|
16
|
+
}
|
|
17
|
+
]
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Fixtures from other countries
|
|
2
|
+
|
|
3
|
+
Written by `node scripts/make-evals.mjs` from the English fixtures one folder up: the same fictional data the way a local export writes it.
|
|
4
|
+
|
|
5
|
+
- `de/`: German column names, Windows-1252 text, semicolons, comma decimals (1.234,56), day-first dotted dates (31.10.2026).
|
|
6
|
+
- `ja/`: Japanese column names, Shift_JIS text, year-first dates (2026/10/31).
|
|
7
|
+
|
|
8
|
+
Values (names, codes, descriptions) stay in English. The eval cases `intl-de-*` and `intl-ja-*` expect exactly the same results as the English case.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Datum;Zeiterfasser;Rolle;Mandat;Mandant;Activity;Beschreibung;Stunden;Stundensatz;Betrag;Billable;Task Code
|
|
2
|
+
05.10.2026;Dana Whitlock;Partner;2501;Sample Freight Inc;Legal work;Strategy call with client on motion practice;3,0;475,00;1.425,00;Yes;L120
|
|
3
|
+
05.10.2026;Dana Whitlock;Partner;2501;Sample Freight Inc;Legal work;Draft motion for summary judgment;8,0;450,00;3.600,00;Yes;L240
|
|
4
|
+
06.10.2026;Priya Natarajan;Associate;2501;Sample Freight Inc;Legal work;Draft interrogatories to carrier;1,25;280,00;350,00;Yes;L310
|
|
5
|
+
06.10.2026;Priya Natarajan;Associate;2501;Sample Freight Inc;Legal work;File review;2,0;280,00;560,00;Yes;L110
|
|
6
|
+
07.10.2026;Tomas Lindgren;Associate;2501;Sample Freight Inc;Legal work;"Review documents; call client re production; draft privilege log; email opposing counsel";4,0;275,00;1.100,00;Yes;L320
|
|
7
|
+
08.10.2026;Grace Obi;Paralegal;2501;Sample Freight Inc;Legal work;Scan and file documents received from client;1,0;140,00;140,00;Yes;L140
|
|
8
|
+
09.10.2026;Marcus Eriksen;Partner;2501;Sample Freight Inc;Legal work;Travel to Demo City for deposition;4,0;425,00;1.700,00;Yes;L330
|
|
9
|
+
09.10.2026;Leo Brandt;Associate;2501;Sample Freight Inc;Legal work;Prepare deposition outline;2,0;260,00;520,00;Yes;
|
|
10
|
+
10.10.2026;Jules Ferrand;Summer Associate;2501;Sample Freight Inc;Legal work;Research venue rules;3,0;150,00;450,00;Yes;L120
|
|
11
|
+
12.10.2026;Priya Natarajan;Associate;2501;Sample Freight Inc;Legal work;Draft responses to requests for admission;1,5;280,00;420,00;Yes;L310
|
|
12
|
+
05.10.2026;Dana Whitlock;Partner;2502;Example Holdings LLC;Legal work;Negotiate supply agreement;2,0;475,00;950,00;Yes;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
���t,�S���ٌ�m,���[��,�Č��ԍ�,�˗���,Activity,�E�v,����,�P��,���z,Billable,Task Code
|
|
2
|
+
2026/10/05,Dana Whitlock,Partner,2501,Sample Freight Inc,Legal work,Strategy call with client on motion practice,3.0,475.00,"1,425.00",Yes,L120
|
|
3
|
+
2026/10/05,Dana Whitlock,Partner,2501,Sample Freight Inc,Legal work,Draft motion for summary judgment,8.0,450.00,"3,600.00",Yes,L240
|
|
4
|
+
2026/10/06,Priya Natarajan,Associate,2501,Sample Freight Inc,Legal work,Draft interrogatories to carrier,1.25,280.00,350.00,Yes,L310
|
|
5
|
+
2026/10/06,Priya Natarajan,Associate,2501,Sample Freight Inc,Legal work,File review,2.0,280.00,560.00,Yes,L110
|
|
6
|
+
2026/10/07,Tomas Lindgren,Associate,2501,Sample Freight Inc,Legal work,Review documents; call client re production; draft privilege log; email opposing counsel,4.0,275.00,"1,100.00",Yes,L320
|
|
7
|
+
2026/10/08,Grace Obi,Paralegal,2501,Sample Freight Inc,Legal work,Scan and file documents received from client,1.0,140.00,140.00,Yes,L140
|
|
8
|
+
2026/10/09,Marcus Eriksen,Partner,2501,Sample Freight Inc,Legal work,Travel to Demo City for deposition,4.0,425.00,"1,700.00",Yes,L330
|
|
9
|
+
2026/10/09,Leo Brandt,Associate,2501,Sample Freight Inc,Legal work,Prepare deposition outline,2.0,260.00,520.00,Yes,
|
|
10
|
+
2026/10/10,Jules Ferrand,Summer Associate,2501,Sample Freight Inc,Legal work,Research venue rules,3.0,150.00,450.00,Yes,L120
|
|
11
|
+
2026/10/12,Priya Natarajan,Associate,2501,Sample Freight Inc,Legal work,Draft responses to requests for admission,1.5,280.00,420.00,Yes,L310
|
|
12
|
+
2026/10/05,Dana Whitlock,Partner,2502,Example Holdings LLC,Legal work,Negotiate supply agreement,2.0,475.00,950.00,Yes,
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Date,User,Title,Case,Client,Activity,Description,Hours,Rate,Total,Billable,Task Code
|
|
2
|
+
10/05/2026,Dana Whitlock,Partner,2501,Sample Freight Inc,Legal work,Strategy call with client on motion practice,3.0,475.00,1425.00,Yes,L120
|
|
3
|
+
10/05/2026,Dana Whitlock,Partner,2501,Sample Freight Inc,Legal work,Draft motion for summary judgment,8.0,450.00,3600.00,Yes,L240
|
|
4
|
+
10/06/2026,Priya Natarajan,Associate,2501,Sample Freight Inc,Legal work,Draft interrogatories to carrier,1.25,280.00,350.00,Yes,L310
|
|
5
|
+
10/06/2026,Priya Natarajan,Associate,2501,Sample Freight Inc,Legal work,File review,2.0,280.00,560.00,Yes,L110
|
|
6
|
+
10/07/2026,Tomas Lindgren,Associate,2501,Sample Freight Inc,Legal work,Review documents; call client re production; draft privilege log; email opposing counsel,4.0,275.00,1100.00,Yes,L320
|
|
7
|
+
10/08/2026,Grace Obi,Paralegal,2501,Sample Freight Inc,Legal work,Scan and file documents received from client,1.0,140.00,140.00,Yes,L140
|
|
8
|
+
10/09/2026,Marcus Eriksen,Partner,2501,Sample Freight Inc,Legal work,Travel to Demo City for deposition,4.0,425.00,1700.00,Yes,L330
|
|
9
|
+
10/09/2026,Leo Brandt,Associate,2501,Sample Freight Inc,Legal work,Prepare deposition outline,2.0,260.00,520.00,Yes,
|
|
10
|
+
10/10/2026,Jules Ferrand,Summer Associate,2501,Sample Freight Inc,Legal work,Research venue rules,3.0,150.00,450.00,Yes,L120
|
|
11
|
+
10/12/2026,Priya Natarajan,Associate,2501,Sample Freight Inc,Legal work,Draft responses to requests for admission,1.5,280.00,420.00,Yes,L310
|
|
12
|
+
10/05/2026,Dana Whitlock,Partner,2502,Example Holdings LLC,Legal work,Negotiate supply agreement,2.0,475.00,950.00,Yes,
|
package/package.json
CHANGED
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fairbrief-billing-guidelines",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"mcpName": "io.github.fpavia111-creator/fairbrief-billing-guidelines",
|
|
5
|
+
"description": "Fairbrief Billing Guidelines: checks time entries against the outside counsel guidelines you write down for each client: rate caps, daily hours, increments, banned tasks, block billing, admin work, travel, task codes and staffing.",
|
|
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
|
+
"fairbrief-billing-guidelines": "bin/fairbrief-billing-guidelines.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/fairbrief-billing-guidelines.js demo",
|
|
33
|
+
"eval": "node bin/fairbrief-billing-guidelines.js eval"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"fairbrief-core": "^0.1.0"
|
|
37
|
+
},
|
|
38
|
+
"repository": {
|
|
39
|
+
"type": "git",
|
|
40
|
+
"url": "git+https://github.com/fpavia111-creator/fairbrief-agents.git",
|
|
41
|
+
"directory": "packages/fairbrief-billing-guidelines"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/fpavia111-creator/fairbrief-agents/tree/master/packages/fairbrief-billing-guidelines#readme",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/fpavia111-creator/fairbrief-agents/issues"
|
|
46
|
+
},
|
|
47
|
+
"keywords": [
|
|
48
|
+
"mcp",
|
|
49
|
+
"mcp-server",
|
|
50
|
+
"law-firm",
|
|
51
|
+
"legal",
|
|
52
|
+
"law-practice",
|
|
53
|
+
"fairbrief",
|
|
54
|
+
"outside-counsel-guidelines",
|
|
55
|
+
"ebilling",
|
|
56
|
+
"billing"
|
|
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/fairbrief-billing-guidelines",
|
|
4
|
+
"title": "Fairbrief Billing Guidelines",
|
|
5
|
+
"description": "Fairbrief Billing Guidelines: checks time entries against the outside counsel guidelines you write…",
|
|
6
|
+
"version": "0.1.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"url": "https://github.com/fpavia111-creator/fairbrief-agents",
|
|
9
|
+
"source": "github",
|
|
10
|
+
"subfolder": "packages/fairbrief-billing-guidelines"
|
|
11
|
+
},
|
|
12
|
+
"websiteUrl": "https://fair-agents.com/fairbrief.html",
|
|
13
|
+
"packages": [
|
|
14
|
+
{
|
|
15
|
+
"registryType": "npm",
|
|
16
|
+
"identifier": "fairbrief-billing-guidelines",
|
|
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,13 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
import { demoRuntime, printStep } from 'fairbrief-core';
|
|
3
|
+
|
|
4
|
+
export async function demo(manifest) {
|
|
5
|
+
const rt = demoRuntime(manifest, fileURLToPath(new URL('../fixtures', import.meta.url)));
|
|
6
|
+
process.stdout.write(`Fairbrief Billing Guidelines demo (fictional firm, client and guidelines) in ${rt.root}\n`);
|
|
7
|
+
const f = { time: 'mycase-time.csv', guidelines: 'guidelines.json' };
|
|
8
|
+
const c = await rt.call('guidelines_check', f);
|
|
9
|
+
printStep('Check October time against the client guidelines (a MyCase layout)', c);
|
|
10
|
+
for (const i of c.result.items) process.stdout.write(` ${i.id.padEnd(7)} ${(i.timekeeper || '').padEnd(16)} ${i.findings.map((x) => x.code).join(', ')}\n`);
|
|
11
|
+
printStep('Write the worklist', await rt.call('guidelines_write_report', f));
|
|
12
|
+
printStep('Agent tries to upload the bill itself', await rt.call('ebilling_submit', {}));
|
|
13
|
+
}
|
package/src/index.js
ADDED
package/src/logic.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Outside counsel guidelines. Clients that use e-billing reject lines that break their
|
|
2
|
+
// billing rules. Fairbrief Billing Guidelines checks every time entry for a client against the rules you
|
|
3
|
+
// wrote down for that client: rate caps by title, hours per timekeeper per day, the
|
|
4
|
+
// billing increment, the longest entry, banned tasks, block billing, administrative
|
|
5
|
+
// work, travel billed above the agreed share, task codes, titles the client will not
|
|
6
|
+
// pay for, and how many timekeepers may work on a matter. The rules are yours; the
|
|
7
|
+
// client's own guideline document decides.
|
|
8
|
+
import { str, num, round2, isoDate, nameKey, personKey, blockParts, adminWord, utbmsKind, isPhaseCode, confirmedNote } from 'fairbrief-core';
|
|
9
|
+
|
|
10
|
+
export const CHECKS = Object.freeze({
|
|
11
|
+
rate_over_cap: { severity: 'error', what: 'The rate is above the client\'s cap for that title.', fix: 'Bill at the cap or get approval from the client.' },
|
|
12
|
+
daily_hours_over: { severity: 'warning', what: 'The timekeeper bills more hours to this client on one day than the guideline allows.', fix: 'Check the entries for the day; split or explain them.' },
|
|
13
|
+
increment: { severity: 'error', what: 'The hours are not a multiple of the client\'s billing increment.', fix: 'Round the entry to the increment the client allows.' },
|
|
14
|
+
entry_too_long: { severity: 'warning', what: 'One entry is longer than the client allows for a single task.', fix: 'Split it into its tasks with their own time.' },
|
|
15
|
+
banned_task: { severity: 'error', what: 'The description names a task the client will not pay for.', fix: 'Remove the entry from the bill or write it off.' },
|
|
16
|
+
block_billed: { severity: 'error', what: 'Several tasks share one time figure and the client does not allow block billing.', fix: 'Split the entry so each task has its own time.' },
|
|
17
|
+
admin_work: { severity: 'error', what: 'The entry describes administrative work the client does not pay for.', fix: 'Mark it no-charge.' },
|
|
18
|
+
travel_full_rate: { severity: 'error', what: 'Travel time is billed above the share of the rate the client allows.', fix: 'Bill travel at the agreed share of the rate.' },
|
|
19
|
+
missing_task_code: { severity: 'error', what: 'The entry has no UTBMS task code, or only a phase code, and the client requires task codes.', fix: 'Add the task code (for example L120, not L100).' },
|
|
20
|
+
title_not_billable: { severity: 'error', what: 'The client does not pay for time by this title (for example summer associates).', fix: 'Mark the time no-charge.' },
|
|
21
|
+
too_many_timekeepers: { severity: 'warning', what: 'More timekeepers worked on the matter than the client allows.', fix: 'Agree staffing with the client or write off the extra timekeepers\' time.' },
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const rule = {
|
|
25
|
+
type: 'object', additionalProperties: false, required: ['client'],
|
|
26
|
+
properties: {
|
|
27
|
+
client: { type: 'string', minLength: 1 },
|
|
28
|
+
max_rates: { type: 'object', additionalProperties: { type: 'number', minimum: 0 }, description: 'Highest rate by title, e.g. {"Partner": 450}' },
|
|
29
|
+
max_daily_hours: { type: 'number', minimum: 0, maximum: 24 },
|
|
30
|
+
increment: { type: 'number', minimum: 0.01, maximum: 1 },
|
|
31
|
+
max_entry_hours: { type: 'number', minimum: 0, maximum: 24 },
|
|
32
|
+
banned_words: { type: 'array', maxItems: 200, items: { type: 'string', minLength: 2, maxLength: 80 } },
|
|
33
|
+
no_block_billing: { type: 'boolean' }, no_admin_work: { type: 'boolean' },
|
|
34
|
+
travel_pct: { type: 'number', minimum: 0, maximum: 100 },
|
|
35
|
+
require_task_codes: { type: 'boolean' },
|
|
36
|
+
not_billable_titles: { type: 'array', maxItems: 50, items: { type: 'string', minLength: 2, maxLength: 80 } },
|
|
37
|
+
max_timekeepers_per_matter: { type: 'integer', minimum: 1, maximum: 500 },
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
export const GUIDELINES_SCHEMA = { type: 'object', additionalProperties: false, required: ['clients'], properties: { clients: { type: 'array', minItems: 1, maxItems: 2000, items: rule }, confirmed_by: { type: 'string', maxLength: 120, description: 'Person at the firm who checked these rules against each client\'s guidelines' }, confirmed_on: { type: 'string', format: 'date', description: 'When they checked them' } } };
|
|
41
|
+
|
|
42
|
+
const multiple = (h, inc) => Math.abs(Math.round(h / inc) * inc - h) < 1e-6;
|
|
43
|
+
|
|
44
|
+
/** Returns { items (entries with findings, then matters), checked, not_covered, summary, by_check }. */
|
|
45
|
+
export function checkGuidelines(time, guidelines, asOf = null) {
|
|
46
|
+
const rules = new Map(guidelines.clients.map((c) => [nameKey(c.client), c]));
|
|
47
|
+
const rows = time.map((t, i) => ({ t, i, d: isoDate(t.date), g: rules.get(nameKey(t.client)) })).filter((x) => x.d && (!asOf || x.d <= asOf));
|
|
48
|
+
const covered = rows.filter((x) => x.g);
|
|
49
|
+
const day = new Map(); const team = new Map(); const items = [];
|
|
50
|
+
for (const x of covered) {
|
|
51
|
+
const k = `${nameKey(x.t.client)}|${personKey(x.t.timekeeper)}|${x.d}`; day.set(k, round2((day.get(k) || 0) + (num(x.t.hours) || 0)));
|
|
52
|
+
const m = str(x.t.matter); if (!team.has(m)) team.set(m, { g: x.g, client: str(x.t.client), people: new Set() }); team.get(m).people.add(personKey(x.t.timekeeper));
|
|
53
|
+
}
|
|
54
|
+
const seenDay = new Map();
|
|
55
|
+
for (const { t, i, d, g } of covered) {
|
|
56
|
+
const h = num(t.hours) || 0; const rate = num(t.rate); const desc = str(t.description); const title = str(t.timekeeper_class); const findings = [];
|
|
57
|
+
const cap = g.max_rates ? Object.entries(g.max_rates).find(([k]) => personKey(k) === personKey(title)) : null;
|
|
58
|
+
if (cap && rate !== null && rate > cap[1] + 0.005) findings.push({ code: 'rate_over_cap', amount: round2((rate - cap[1]) * h), detail: `${d} ${str(t.timekeeper)} (${title}) at ${rate}; the cap for ${cap[0]} is ${cap[1]}.` });
|
|
59
|
+
const k = `${nameKey(t.client)}|${personKey(t.timekeeper)}|${d}`; const run = round2((seenDay.get(k) || 0) + h); seenDay.set(k, run);
|
|
60
|
+
if (g.max_daily_hours !== undefined && run > g.max_daily_hours && run - h <= g.max_daily_hours) findings.push({ code: 'daily_hours_over', amount: null, detail: `${str(t.timekeeper)} billed ${day.get(k)} hours to this client on ${d}; the limit is ${g.max_daily_hours}.` });
|
|
61
|
+
if (g.increment && h > 0 && !multiple(h, g.increment)) findings.push({ code: 'increment', amount: null, detail: `${d} ${str(t.timekeeper)}: ${h} hours is not a multiple of ${g.increment}.` });
|
|
62
|
+
if (g.max_entry_hours !== undefined && h > g.max_entry_hours) findings.push({ code: 'entry_too_long', amount: null, detail: `${d} ${str(t.timekeeper)}: one entry of ${h} hours; the limit is ${g.max_entry_hours}.` });
|
|
63
|
+
const banned = (g.banned_words || []).find((w) => desc.toLowerCase().includes(w.toLowerCase()));
|
|
64
|
+
if (banned) findings.push({ code: 'banned_task', amount: rate !== null ? round2(h * rate) : null, detail: `${d} ${str(t.timekeeper)}: "${desc}" names "${banned}", which the client does not pay for.` });
|
|
65
|
+
const parts = g.no_block_billing ? blockParts(desc) : null;
|
|
66
|
+
if (parts) findings.push({ code: 'block_billed', amount: null, detail: `${d} ${str(t.timekeeper)}: ${parts.length} tasks under one figure of ${h} hours.` });
|
|
67
|
+
const admin = g.no_admin_work ? adminWord(desc) : null;
|
|
68
|
+
if (admin) findings.push({ code: 'admin_work', amount: rate !== null ? round2(h * rate) : null, detail: `${d} ${str(t.timekeeper)}: "${desc}" reads as administrative work ("${admin}").` });
|
|
69
|
+
if (g.travel_pct !== undefined && /\btravel/i.test(desc) && rate !== null) { const amt = num(t.amount) ?? round2(h * rate); const allowed = round2(h * rate * g.travel_pct / 100); if (amt > allowed + 0.005) findings.push({ code: 'travel_full_rate', amount: round2(amt - allowed), detail: `${d} ${str(t.timekeeper)}: travel billed at ${amt}; at ${g.travel_pct}% of the rate it is ${allowed}.` }); }
|
|
70
|
+
if (g.require_task_codes && (utbmsKind(t.task_code) !== 'task' || isPhaseCode(t.task_code))) findings.push({ code: 'missing_task_code', amount: null, detail: `${d} ${str(t.timekeeper)}: ${str(t.task_code) ? `${str(t.task_code)} is a phase code, not a task code` : 'no task code'}.` });
|
|
71
|
+
const nb = (g.not_billable_titles || []).find((x) => personKey(x) === personKey(title));
|
|
72
|
+
if (nb) findings.push({ code: 'title_not_billable', amount: rate !== null ? round2(h * rate) : null, detail: `${d} ${str(t.timekeeper)} is a ${title}; the client does not pay for that title.` });
|
|
73
|
+
if (!findings.length) continue;
|
|
74
|
+
const sev = findings.map((f) => CHECKS[f.code].severity);
|
|
75
|
+
items.push({ id: str(t.entry_id) || `T-${String(i + 1).padStart(4, '0')}`, date: d, timekeeper: str(t.timekeeper), title, matter: str(t.matter), client: str(t.client), hours: h, rate, description: desc, status: sev.includes('error') ? 'error' : 'warning', findings });
|
|
76
|
+
}
|
|
77
|
+
for (const [m, x] of team) if (x.g.max_timekeepers_per_matter && x.people.size > x.g.max_timekeepers_per_matter) items.push({ id: `M:${m}`, date: null, timekeeper: '', title: '', matter: m, client: x.client, hours: null, rate: null, description: '', status: 'warning', findings: [{ code: 'too_many_timekeepers', amount: null, detail: `${x.people.size} timekeepers billed to matter ${m}; the client allows ${x.g.max_timekeepers_per_matter}.` }] });
|
|
78
|
+
const by_check = {}; for (const x of items) for (const f of x.findings) by_check[f.code] = (by_check[f.code] || 0) + 1;
|
|
79
|
+
const note = confirmedNote(guidelines);
|
|
80
|
+
return { summary: `${covered.length} entr(ies) for ${new Set(covered.map((x) => nameKey(x.t.client))).size} client(s) with guidelines checked (${rows.length - covered.length} for clients without guidelines not checked): ${items.filter((x) => x.status === 'error').length} would likely be rejected, ${items.filter((x) => x.status === 'warning').length} to review.`, checked: covered.length, not_covered: rows.length - covered.length, flagged: items.length, by_check, ...(note ? { settings_note: note } : {}), items };
|
|
81
|
+
}
|
package/src/manifest.js
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { familyAgent, TIME_FIELDS, TIME_PROFILES, LIMITS, sectionTitle } from 'fairbrief-core';
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { checkGuidelines, CHECKS, GUIDELINES_SCHEMA } from './logic.js';
|
|
4
|
+
|
|
5
|
+
const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
|
|
6
|
+
const args = {
|
|
7
|
+
time: { type: 'string', description: 'Time entries export under --root with date, timekeeper, title, client, matter, hours, rate, amount, description and task code' },
|
|
8
|
+
guidelines: { type: 'string', description: 'Billing guideline rules as guidelines JSON: one block per client with rate caps by title, daily hours, increment, longest entry, banned words, block billing, admin work, travel share, task codes, titles not billable and staffing limit' },
|
|
9
|
+
};
|
|
10
|
+
const run = (a, ctx) => checkGuidelines(ctx.records(a.time), ctx.readJson(a.guidelines, 'guidelines'), a.as_of || null);
|
|
11
|
+
|
|
12
|
+
export const manifest = familyAgent({
|
|
13
|
+
name: 'fairbrief-billing-guidelines', prefix: 'guidelines', version: pkg.version,
|
|
14
|
+
description: 'Checks time entries against the outside counsel guidelines you write down for each client: rate caps by title, hours per day, billing increment, longest entry, banned tasks, block billing, administrative work, travel above the agreed share, task codes, titles the client will not pay for and staffing limits. Client names are masked before results reach the model.',
|
|
15
|
+
checkTitle: 'Check entries against client billing guidelines',
|
|
16
|
+
checkDescription: 'Each entry for a client with guidelines that breaks one of the client\'s rules, with the rule and the amount at stake; matters with more timekeepers than allowed (M:<matter>).',
|
|
17
|
+
sources: { time: { label: 'Time entries', args: ['time'], fields: TIME_FIELDS, profiles: TIME_PROFILES } },
|
|
18
|
+
configSchemas: { guidelines: GUIDELINES_SCHEMA },
|
|
19
|
+
args, required: ['time', 'guidelines'], run, checks: CHECKS,
|
|
20
|
+
item: { key: 'id', label: 'entry', arg: 'entry_id', kind: 'item' },
|
|
21
|
+
argDocs: { entry_id: 'Entry id from guidelines_check (T-0003 for the third row, or M:<matter> for a staffing finding)' },
|
|
22
|
+
report: {
|
|
23
|
+
base: 'billing-guidelines',
|
|
24
|
+
title: { en: 'Billing guideline exceptions', de: 'Abweichungen von Abrechnungsrichtlinien', fr: 'Écarts aux directives de facturation', es: 'Excepciones a las directrices de facturación', pt: 'Exceções às diretrizes de faturamento', it: 'Eccezioni alle linee guida di fatturazione', ja: '請求ガイドライン違反', zh: '账单指引例外', ko: '청구 지침 예외' },
|
|
25
|
+
rows: (r) => r.items.map((i) => ({ id: i.id, date: i.date || '', timekeeper: i.timekeeper, matter: i.matter, client: i.client, hours: i.hours ?? '', rate: i.rate ?? '', description: i.description, status: i.status, findings: i.findings.map((f) => f.code).join(' '), reasons: i.findings.map((f) => f.detail).join(' '), owner: '', decision: '', notes: '' })),
|
|
26
|
+
htmlColumns: ['id', 'date', 'timekeeper', 'matter', 'hours', 'rate', 'reasons'],
|
|
27
|
+
sections: (r) => [{ title: sectionTitle('by_rule'), rows: Object.entries(r.by_check).map(([rule, count]) => ({ rule, severity: CHECKS[rule].severity, count })), columns: ['rule', 'severity', 'count'] }],
|
|
28
|
+
limits: [LIMITS.files, 'The rules are the ones you wrote into the guidelines file; the client\'s own guideline document and e-billing system decide what is accepted.', 'Block billing and administrative work are found from the wording of the description; read the flagged entries yourself.', LIMITS.advice, LIMITS.phi],
|
|
29
|
+
},
|
|
30
|
+
refused: [
|
|
31
|
+
{ name: 'ebilling_submit', category: 'binding_send', description: 'Fairbrief Billing Guidelines never uploads invoices to a client\'s e-billing portal.' },
|
|
32
|
+
{ name: 'time_entry_edit', category: 'binding_send', description: 'Fairbrief Billing Guidelines never changes time entries; the timekeeper or billing team does.' },
|
|
33
|
+
],
|
|
34
|
+
prompt: {
|
|
35
|
+
name: 'guideline_review', title: 'Check a bill against client guidelines',
|
|
36
|
+
description: 'Walks the host model through a guideline review with Fairbrief Billing Guidelines.',
|
|
37
|
+
arguments: [{ name: 'time', description: 'Time entries under --root', required: true }, { name: 'guidelines', description: 'Guidelines JSON', required: true }],
|
|
38
|
+
text: `You are helping a law firm's billing team prepare a bill that follows the client's outside counsel guidelines, using fairbrief-billing-guidelines. Time: {{time}}. Guidelines: {{guidelines}}.
|
|
39
|
+
|
|
40
|
+
Rules: Fairbrief Billing Guidelines never uploads bills or edits entries (ebilling_submit and time_entry_edit are blocked). The rules come from the firm's guidelines file, not the client's own document. Client names are pseudonyms.
|
|
41
|
+
|
|
42
|
+
1. Call guidelines_check. Report how many entries would likely be rejected, by rule.
|
|
43
|
+
2. For each error, say what to change (split, round, no-charge, add code).
|
|
44
|
+
3. Call guidelines_write_report.`,
|
|
45
|
+
},
|
|
46
|
+
});
|