fairbrief-block-billing 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 ADDED
@@ -0,0 +1,5 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (unreleased)
4
+
5
+ - First version (Fairbrief ver 1).
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,177 @@
1
- # Temporary Holding Version
1
+ # Fairbrief Block Billing (`fairbrief-block-billing`)
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Finds block-billed, vague, empty, clerical and thin time-entry narratives before the bill goes out, with a plain reason for each and the time at stake by timekeeper. Client names are masked before results reach the model.
4
+
5
+ **Fairbrief Block Billing never rewrites or changes time entries; the timekeeper 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-block-billing demo
11
+ npx -y fairbrief-block-billing mcp --root ./firm-exports
12
+ ```
13
+
14
+ ## What it checks
15
+
16
+ | Check | Severity | What it means | What a person does |
17
+ |---|---|---|---|
18
+ | `block_billed` | error | Several tasks share one time figure (block billing). | Split the entry so each task has its own time. |
19
+ | `empty_description` | error | The entry has no description. | Ask the timekeeper what the work was. |
20
+ | `vague` | warning | The description does not say what was done or why (for example "Research" or "Conference"). | Add the subject and the purpose: research on what, a call with whom about what. |
21
+ | `admin_work` | warning | The description reads as clerical or administrative work, which many clients do not pay for. | Mark it no-charge or describe the legal work it was part of. |
22
+ | `thin_narrative` | warning | A few words describe a long entry. | Describe the work in enough detail to support the hours. |
23
+
24
+ <!-- generated:start -->
25
+
26
+ ## A demo run
27
+
28
+ `npx -y fairbrief-block-billing demo` runs the agent on the fictional files in [`fixtures/`](fixtures) in a temporary folder. Captured output:
29
+
30
+ ```text
31
+ Fairbrief Block Billing demo (fictional firm and time) in <demo folder>
32
+
33
+ ▶ Read October narratives before billing (a Smokeball layout)
34
+ status: executed decision: allow
35
+ 8 entr(ies) read: 7 need a better narrative (5790 of time at stake): 1 block-billed, 3 vague, 1 empty, 1 clerical, 1 thin.
36
+ T-0001 Dana Whitlock 4.5 h block_billed
37
+ T-0002 Priya Natarajan 3 h vague
38
+ T-0003 Tomas Lindgren 1 h empty_description
39
+ T-0004 Grace Obi 1 h admin_work
40
+ T-0005 Marcus Eriksen 5 h thin_narrative
41
+ T-0007 Priya Natarajan 0.3 h vague
42
+ T-0008 Dana Whitlock 0.5 h vague
43
+
44
+ ▶ Write the worklist
45
+ status: executed decision: allow
46
+ Worklist written: 8 entr(ies) read: 7 need a better narrative (5790 of time at stake): 1 block-billed, 3 vague, 1 empty, 1 clerical, 1 thin. Files: fairbrief-out/block_billing/block-billing.csv, fairbrief-out/block_billing/block-billing.html.
47
+ ```
48
+
49
+ ## Tools
50
+
51
+ | Tool | What it does | Policy |
52
+ |---|---|---|
53
+ | `block_billing_check` | Each unbilled entry whose narrative is block-billed, vague, empty, clerical or thin, with the reason; totals by timekeeper. | runs |
54
+ | `block_billing_explain` | Show one entry from block_billing_check with every finding and the figures it was checked against. | runs |
55
+ | `block_billing_checks` | List every check block_billing runs, what it looks for and what a person does about it. | runs |
56
+ | `block_billing_write_report` | Write block-billing.csv (one row per item, with blank owner, decision and notes columns) and block-billing.html into out_dir (default fairbrief-out/block_billing). | runs |
57
+ | `time_entry_edit` | Fairbrief Block Billing never rewrites or changes time entries; the timekeeper does. | refused |
58
+
59
+ 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.
60
+
61
+ ## Columns it reads
62
+
63
+ 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).
64
+
65
+ ### Time entries (`time`)
66
+
67
+ | Column | Type | Also read as | For example, in other languages |
68
+ |---|---|---|---|
69
+ | `entry_id` | text | Entry ID, Activity ID, Time Entry ID, Entry #, Slip ID, Slip Number | - |
70
+ | `date` | date | Date, Entry Date, Work Date, Activity Date, Date Worked, Service Date | Datum, Date, 日付, 日期 |
71
+ | `timekeeper` | text | Timekeeper, User, Attorney, Lawyer, Staff, Billing User | Zeiterfasser, Intervenant, 担当弁護士, 计时人员 |
72
+ | `timekeeper_id` | text | Timekeeper ID, TK ID, Timekeeper Number, Tkpr, TK, Initials | - |
73
+ | `timekeeper_class` | text | Title, Role, Classification, Timekeeper Classification, Rank, Level | Rolle, Rôle, ロール, 角色 |
74
+ | `matter` | text | Matter, Matter Number, Matter ID, Matter No, Matter #, Display Number | Mandat, Dossier, 案件番号, 案件编号 |
75
+ | `matter_name` | text (masked) | Matter Name, Matter Description, Case Name, File Name | Mandatsbezeichnung, Intitulé du dossier, 案件名, 案件名称 |
76
+ | `client` | text (masked) | Client, Client Name, Client Full Name, Billing Client, Contact, Client/Company | Mandant, Nom du client, 依頼者, 客户名称 |
77
+ | `hours` | number | Hours, Quantity, Qty, Time, Duration, Hours Worked | Stunden, Heures, 時間, 小时 |
78
+ | `rate` | amount | Rate, Hourly Rate, Billing Rate, Price, Unit Price, Std Rate | Stundensatz, Taux horaire, 単価, 费率 |
79
+ | `amount` | amount | Amount, Total, Value, Billable Amount, Fee Amount, Line Total | Betrag, Montant, 金額, 金额 |
80
+ | `billable` | yes/no | Billable, Is Billable, Billable? | - |
81
+ | `description` | text | Description, Narrative, Note, Notes, Activity Description, Detail | Beschreibung, Description, 摘要, 摘要 |
82
+ | `task_code` | text | Task Code, UTBMS Task, UTBMS Task Code, Task, Phase/Task, Phase Task | - |
83
+ | `activity_code` | text | Activity Code, UTBMS Activity, UTBMS Activity Code, Line Item Activity Code | - |
84
+ | `billed_status` | text | Status, Bill Status, Billing Status, Billed, State, Entry Status | Status, Statut, ステータス, 状态 |
85
+ | `invoice_number` | text | Invoice, Invoice Number, Invoice #, Bill Number, Bill #, Bill No | Rechnungsnummer, N° de facture, 請求書番号, 发票号 |
86
+ | `billed_amount` | amount | Billed Amount, Amount Billed, Billed Value, Bill Amount | - |
87
+ | `written_off` | amount | Write Off, Write-Off, Written Off, Write Down, Write-Down, Discount | - |
88
+ | `collected` | amount | Collected, Amount Collected, Payments Applied, Received, Paid Amount | - |
89
+ | `billed_date` | date | Billed Date, Bill Date, Invoice Date, Date Billed | - |
90
+
91
+ Named exports recognised by their column names:
92
+
93
+ | System | Export | Recognised by | Layout checked against vendor docs |
94
+ |---|---|---|---|
95
+ | Clio Manage | Activities export, time entries (CSV) | Quantity, User, Matter, Rate, Billed | no |
96
+ | PracticePanther | Time entries export (CSV) | Billed By, Matter, Hours, Billable | no |
97
+ | MyCase | Time entries report (CSV) | Case, User, Hours, Billable | no |
98
+ | Smokeball | Fee entries export (CSV) | Staff, Matter, Hours, Amount | no |
99
+ | CosmoLex | Time entries report (CSV) | Timekeeper, Matter, Hours, Status | no |
100
+ | PCLaw | Time listing (CSV) | Lawyer, Matter, Explanation, Hours | no |
101
+ | Tabs3 Billing | Fee journal (CSV) | Tkpr, Client, Hours, Rate | no |
102
+ | Aderant Expert | Time detail report (CSV) | Work Date, Timekeeper, Narrative, Hours | no |
103
+ | Elite 3E | Timecard detail (CSV) | Work Date, Work Hrs, Work Rate, Work Amt | no |
104
+
105
+ 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.
106
+
107
+ ### Files from other countries
108
+
109
+ 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-block-billing inspect <file>` (names and shapes only, never values) and name them in `fairbrief-sources.json`:
110
+
111
+ ```json
112
+ { "files": { "exports/time.csv": { "columns": { "matter": "Aktenzeichen" }, "date_order": "dmy" } } }
113
+ ```
114
+
115
+ ## Install
116
+
117
+ Node 20 or newer. No other dependencies.
118
+
119
+ ```bash
120
+ npx -y fairbrief-block-billing demo
121
+ npx -y fairbrief-block-billing mcp --root /path/to/your/files
122
+ ```
123
+
124
+ Claude Desktop, Cursor and other MCP hosts:
125
+
126
+ ```json
127
+ {
128
+ "mcpServers": {
129
+ "fairbrief-block-billing": {
130
+ "command": "npx",
131
+ "args": [
132
+ "-y",
133
+ "fairbrief-block-billing",
134
+ "mcp",
135
+ "--root",
136
+ "/path/to/your/files"
137
+ ]
138
+ }
139
+ }
140
+ }
141
+ ```
142
+
143
+ Claude Code: `claude mcp add fairbrief-block-billing -- npx -y fairbrief-block-billing mcp --root .`, or install the `fairbrief-block-billing` plugin from this repository's marketplace (`fairbrief-law-firm`).
144
+
145
+ ## Modes and approvals
146
+
147
+ - **Review** (`--mode review`): reads and reports only.
148
+ - **Assist** (default): the policy above. A tool that asks returns an `approval_id`; a person approves it once with `fairbrief-block-billing approve <id> --as "Your Name"` (or on the local approvals page, `fairbrief-block-billing approvals`), and the same call is repeated.
149
+ - **Auto** (`--mode auto --auto <tool,...>`): opt-in per tool, with step caps and a kill switch (`fairbrief-block-billing 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.
150
+
151
+ ## CLI
152
+
153
+ ```bash
154
+ fairbrief-block-billing tools # every tool, its policy and arguments
155
+ fairbrief-block-billing sources # the columns each input is read from
156
+ fairbrief-block-billing inspect <file> # how a file would be read (names and shapes, never values)
157
+ fairbrief-block-billing call block_billing_check '{"time":"<time>"}'
158
+ fairbrief-block-billing eval # the private eval cases on the fictional fixtures
159
+ fairbrief-block-billing demo
160
+ ```
161
+
162
+ ## Client data
163
+
164
+ 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.
165
+
166
+ ## Audit log and data
167
+
168
+ 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.
169
+
170
+ <!-- generated:end -->
171
+
172
+ ## Limits
173
+
174
+ - 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.
175
+ - 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.
176
+ - 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.
177
+ - 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-block-billing', demo, evalFile: fileURLToPath(new URL('../evals/cases.json', import.meta.url)) });
@@ -0,0 +1,319 @@
1
+ {
2
+ "suite": "fairbrief-block-billing",
3
+ "root": "..",
4
+ "data_note": "Fictional fixtures in ../fixtures. Deterministic checks; no model is called.",
5
+ "cases": [
6
+ {
7
+ "id": "october-narratives",
8
+ "tool": "block_billing_check",
9
+ "args": {
10
+ "time": "fixtures/smokeball-time.csv",
11
+ "settings": "fixtures/narrative-settings.json"
12
+ },
13
+ "expect": {
14
+ "status": "executed",
15
+ "equals": {
16
+ "result.read": 8,
17
+ "result.flagged": 7,
18
+ "result.value_at_stake": 5790,
19
+ "result.by_check.block_billed": 1,
20
+ "result.by_check.vague": 3,
21
+ "result.by_check.empty_description": 1,
22
+ "result.by_check.admin_work": 1,
23
+ "result.by_check.thin_narrative": 1
24
+ }
25
+ }
26
+ },
27
+ {
28
+ "id": "plain-reasons",
29
+ "tool": "block_billing_check",
30
+ "args": {
31
+ "time": "fixtures/smokeball-time.csv",
32
+ "settings": "fixtures/narrative-settings.json"
33
+ },
34
+ "expect": {
35
+ "contains": [
36
+ "4 tasks under one figure of 4.5 hours",
37
+ "\\\"research\\\" alone does not say what was done",
38
+ "1 hours with no description",
39
+ "reads as clerical work",
40
+ "4 words for 5 hours"
41
+ ]
42
+ }
43
+ },
44
+ {
45
+ "id": "lenient-thin-limit",
46
+ "tool": "block_billing_check",
47
+ "args": {
48
+ "time": "fixtures/smokeball-time.csv",
49
+ "settings": "fixtures/narrative-settings-lenient.json"
50
+ },
51
+ "expect": {
52
+ "status": "executed",
53
+ "equals": {
54
+ "result.flagged": 6
55
+ },
56
+ "not_contains": [
57
+ "thin_narrative",
58
+ "settings_note"
59
+ ]
60
+ }
61
+ },
62
+ {
63
+ "id": "clean-entry-not-listed",
64
+ "tool": "block_billing_explain",
65
+ "args": {
66
+ "time": "fixtures/smokeball-time.csv",
67
+ "entry_id": "T-0006"
68
+ },
69
+ "expect": {
70
+ "status": "error",
71
+ "contains": [
72
+ "not found"
73
+ ]
74
+ }
75
+ },
76
+ {
77
+ "id": "timekeeper-totals",
78
+ "tool": "block_billing_check",
79
+ "args": {
80
+ "time": "fixtures/smokeball-time.csv"
81
+ },
82
+ "expect": {
83
+ "contains": [
84
+ "{\"timekeeper\":\"Dana Whitlock\",\"entries\":2,\"hours\":5,\"amount\":2250}"
85
+ ]
86
+ }
87
+ },
88
+ {
89
+ "id": "smokeball-layout",
90
+ "tool": "block_billing_check",
91
+ "args": {
92
+ "time": "fixtures/smokeball-time.csv"
93
+ },
94
+ "expect": {
95
+ "contains": [
96
+ "smokeball_time"
97
+ ]
98
+ }
99
+ },
100
+ {
101
+ "id": "std-check-in-review-mode",
102
+ "tool": "block_billing_check",
103
+ "mode": "review",
104
+ "args": {
105
+ "time": "fixtures/smokeball-time.csv",
106
+ "settings": "fixtures/narrative-settings.json"
107
+ },
108
+ "expect": {
109
+ "status": "executed"
110
+ }
111
+ },
112
+ {
113
+ "id": "std-limit-one",
114
+ "tool": "block_billing_check",
115
+ "args": {
116
+ "time": "fixtures/smokeball-time.csv",
117
+ "settings": "fixtures/narrative-settings.json",
118
+ "limit": 1
119
+ },
120
+ "expect": {
121
+ "status": "executed",
122
+ "max": {
123
+ "result.items.length": 1
124
+ }
125
+ }
126
+ },
127
+ {
128
+ "id": "std-masked",
129
+ "tool": "block_billing_check",
130
+ "args": {
131
+ "time": "fixtures/smokeball-time.csv",
132
+ "settings": "fixtures/narrative-settings.json"
133
+ },
134
+ "expect": {
135
+ "status": "executed",
136
+ "not_contains": [
137
+ "Odessa Varga",
138
+ "Bram Holloway",
139
+ "Varga, Odessa",
140
+ "Holloway, Bram"
141
+ ]
142
+ }
143
+ },
144
+ {
145
+ "id": "std-report",
146
+ "tool": "block_billing_write_report",
147
+ "args": {
148
+ "time": "fixtures/smokeball-time.csv",
149
+ "settings": "fixtures/narrative-settings.json"
150
+ },
151
+ "expect": {
152
+ "status": "executed",
153
+ "contains": [
154
+ ".csv",
155
+ ".html"
156
+ ],
157
+ "not_contains": [
158
+ "Odessa Varga",
159
+ "Bram Holloway"
160
+ ]
161
+ }
162
+ },
163
+ {
164
+ "id": "std-report-german",
165
+ "tool": "block_billing_write_report",
166
+ "args": {
167
+ "time": "fixtures/smokeball-time.csv",
168
+ "settings": "fixtures/narrative-settings.json",
169
+ "language": "de"
170
+ },
171
+ "expect": {
172
+ "status": "executed",
173
+ "equals": {
174
+ "result.lang": "de"
175
+ }
176
+ }
177
+ },
178
+ {
179
+ "id": "std-checks-list",
180
+ "tool": "block_billing_checks",
181
+ "args": {},
182
+ "expect": {
183
+ "status": "executed"
184
+ }
185
+ },
186
+ {
187
+ "id": "std-explain",
188
+ "tool": "block_billing_explain",
189
+ "args": {
190
+ "time": "fixtures/smokeball-time.csv",
191
+ "settings": "fixtures/narrative-settings.json",
192
+ "entry_id": "T-0001"
193
+ },
194
+ "expect": {
195
+ "status": "executed",
196
+ "contains": [
197
+ "T-0001"
198
+ ]
199
+ }
200
+ },
201
+ {
202
+ "id": "std-explain-unknown",
203
+ "tool": "block_billing_explain",
204
+ "args": {
205
+ "time": "fixtures/smokeball-time.csv",
206
+ "settings": "fixtures/narrative-settings.json",
207
+ "entry_id": "NO-SUCH-ITEM"
208
+ },
209
+ "expect": {
210
+ "status": "error",
211
+ "contains": [
212
+ "not found"
213
+ ]
214
+ }
215
+ },
216
+ {
217
+ "id": "std-missing-file",
218
+ "tool": "block_billing_check",
219
+ "args": {
220
+ "time": "fixtures/no-such-file.csv",
221
+ "settings": "fixtures/narrative-settings.json"
222
+ },
223
+ "expect": {
224
+ "status": "error",
225
+ "contains": [
226
+ "file not found"
227
+ ]
228
+ }
229
+ },
230
+ {
231
+ "id": "std-outside-root",
232
+ "tool": "block_billing_check",
233
+ "args": {
234
+ "time": "../../../../etc/passwd",
235
+ "settings": "fixtures/narrative-settings.json"
236
+ },
237
+ "expect": {
238
+ "status": "error",
239
+ "matches": [
240
+ "outside|leaves the allowed root"
241
+ ]
242
+ }
243
+ },
244
+ {
245
+ "id": "std-settings-typo",
246
+ "tool": "block_billing_check",
247
+ "args": {
248
+ "time": "fixtures/smokeball-time.csv",
249
+ "settings": "fixtures/narrative-settings-typo.json"
250
+ },
251
+ "expect": {
252
+ "status": "error",
253
+ "contains": [
254
+ "is not a valid"
255
+ ]
256
+ }
257
+ },
258
+ {
259
+ "id": "std-unknown-tool",
260
+ "tool": "shell_exec",
261
+ "args": {
262
+ "cmd": "whoami"
263
+ },
264
+ "expect": {
265
+ "status": "blocked"
266
+ }
267
+ },
268
+ {
269
+ "id": "std-refused-time_entry_edit",
270
+ "tool": "time_entry_edit",
271
+ "args": {},
272
+ "expect": {
273
+ "status": "blocked"
274
+ }
275
+ },
276
+ {
277
+ "id": "intl-de-october-narratives",
278
+ "tool": "block_billing_check",
279
+ "args": {
280
+ "time": "fixtures/intl/de/smokeball-time.csv",
281
+ "settings": "fixtures/narrative-settings.json"
282
+ },
283
+ "expect": {
284
+ "status": "executed",
285
+ "equals": {
286
+ "result.read": 8,
287
+ "result.flagged": 7,
288
+ "result.value_at_stake": 5790,
289
+ "result.by_check.block_billed": 1,
290
+ "result.by_check.vague": 3,
291
+ "result.by_check.empty_description": 1,
292
+ "result.by_check.admin_work": 1,
293
+ "result.by_check.thin_narrative": 1
294
+ }
295
+ }
296
+ },
297
+ {
298
+ "id": "intl-ja-october-narratives",
299
+ "tool": "block_billing_check",
300
+ "args": {
301
+ "time": "fixtures/intl/ja/smokeball-time.csv",
302
+ "settings": "fixtures/narrative-settings.json"
303
+ },
304
+ "expect": {
305
+ "status": "executed",
306
+ "equals": {
307
+ "result.read": 8,
308
+ "result.flagged": 7,
309
+ "result.value_at_stake": 5790,
310
+ "result.by_check.block_billed": 1,
311
+ "result.by_check.vague": 3,
312
+ "result.by_check.empty_description": 1,
313
+ "result.by_check.admin_work": 1,
314
+ "result.by_check.thin_narrative": 1
315
+ }
316
+ }
317
+ }
318
+ ]
319
+ }
package/evals/own.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "root": "..",
3
+ "base": { "time": "fixtures/smokeball-time.csv", "settings": "fixtures/narrative-settings.json" },
4
+ "item": "T-0001",
5
+ "settings_typo": "fixtures/narrative-settings-typo.json",
6
+ "cases": [
7
+ { "id": "october-narratives", "tool": "block_billing_check", "args": { "time": "fixtures/smokeball-time.csv", "settings": "fixtures/narrative-settings.json" },
8
+ "expect": { "status": "executed", "equals": { "result.read": 8, "result.flagged": 7, "result.value_at_stake": 5790, "result.by_check.block_billed": 1, "result.by_check.vague": 3, "result.by_check.empty_description": 1, "result.by_check.admin_work": 1, "result.by_check.thin_narrative": 1 } } },
9
+ { "id": "plain-reasons", "tool": "block_billing_check", "args": { "time": "fixtures/smokeball-time.csv", "settings": "fixtures/narrative-settings.json" },
10
+ "expect": { "contains": ["4 tasks under one figure of 4.5 hours", "\\\"research\\\" alone does not say what was done", "1 hours with no description", "reads as clerical work", "4 words for 5 hours"] } },
11
+ { "id": "lenient-thin-limit", "tool": "block_billing_check", "args": { "time": "fixtures/smokeball-time.csv", "settings": "fixtures/narrative-settings-lenient.json" },
12
+ "expect": { "status": "executed", "equals": { "result.flagged": 6 }, "not_contains": ["thin_narrative", "settings_note"] } },
13
+ { "id": "clean-entry-not-listed", "tool": "block_billing_explain", "args": { "time": "fixtures/smokeball-time.csv", "entry_id": "T-0006" },
14
+ "expect": { "status": "error", "contains": ["not found"] } },
15
+ { "id": "timekeeper-totals", "tool": "block_billing_check", "args": { "time": "fixtures/smokeball-time.csv" },
16
+ "expect": { "contains": ["{\"timekeeper\":\"Dana Whitlock\",\"entries\":2,\"hours\":5,\"amount\":2250}"] } },
17
+ { "id": "smokeball-layout", "tool": "block_billing_check", "args": { "time": "fixtures/smokeball-time.csv" },
18
+ "expect": { "contains": ["smokeball_time"] } }
19
+ ]
20
+ }
@@ -0,0 +1,8 @@
1
+ # Fairbrief Block Billing fixtures
2
+
3
+ Everything here is fictional: the firm (Example Ridge Law LLP), timekeepers, clients, matters and time.
4
+
5
+ - `smokeball-time.csv`: eight unbilled October entries in a Smokeball fee export layout (Staff, Hours, Amount; US dates) with a Client column.
6
+ - `narrative-settings.json`: example limits (2 hours, 5 words) and one extra vague phrase. `narrative-settings-lenient.json` raises the thin limit to 6 hours, with a named confirmer. `narrative-settings-typo.json` has a misspelt key.
7
+
8
+ Planted: a four-task block-billed entry; "Research", "Telephone call" and "Conference" alone; an entry with no description; calendaring and organizing a file; "Work on brief issues" for five hours. One entry is clean. 5,790 of time at stake.
@@ -0,0 +1,68 @@
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-narratives",
4
+ "planted": [
5
+ [
6
+ "T-0001",
7
+ "block_billed"
8
+ ],
9
+ [
10
+ "T-0002",
11
+ "vague"
12
+ ],
13
+ [
14
+ "T-0003",
15
+ "empty_description"
16
+ ],
17
+ [
18
+ "T-0004",
19
+ "admin_work"
20
+ ],
21
+ [
22
+ "T-0005",
23
+ "thin_narrative"
24
+ ],
25
+ [
26
+ "T-0007",
27
+ "vague"
28
+ ],
29
+ [
30
+ "T-0008",
31
+ "vague"
32
+ ]
33
+ ],
34
+ "clean": {
35
+ "edits": [
36
+ {
37
+ "arg": "time",
38
+ "dropRows": [
39
+ 1,
40
+ 2,
41
+ 3,
42
+ 4,
43
+ 5,
44
+ 7,
45
+ 8
46
+ ]
47
+ }
48
+ ]
49
+ },
50
+ "mutations": [
51
+ {
52
+ "name": "narrative cut to one vague word",
53
+ "edits": [
54
+ {
55
+ "arg": "time",
56
+ "set": [
57
+ {
58
+ "row": 1,
59
+ "column": "Description",
60
+ "value": "Research"
61
+ }
62
+ ]
63
+ }
64
+ ],
65
+ "expect": "vague"
66
+ }
67
+ ]
68
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "note": "Fictional client names used in these fixtures. The shared tests check that no eval result returns any of them to the model.",
3
+ "values": ["Odessa Varga", "Bram Holloway", "Varga, Odessa", "Holloway, Bram"]
4
+ }
@@ -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,9 @@
1
+ Datum;Zeiterfasser;Mandat;Mandant;Beschreibung;Stunden;Stundensatz;Betrag
2
+ 01.10.2026;Dana Whitlock;2701;Odessa Varga;"Review file; call client; draft letter to opposing counsel; research damages";4,5;450,00;2.025,00
3
+ 02.10.2026;Priya Natarajan;2701;Odessa Varga;Research;3,0;300,00;900,00
4
+ 02.10.2026;Tomas Lindgren;2702;Bram Holloway;;1,0;275,00;275,00
5
+ 03.10.2026;Grace Obi;2702;Bram Holloway;Calendar deadlines and organize file;1,0;150,00;150,00
6
+ 05.10.2026;Marcus Eriksen;2703;Demo Bakery Co;Work on brief issues;5,0;425,00;2.125,00
7
+ 06.10.2026;Leo Brandt;2703;Demo Bakery Co;Draft reply brief addressing waiver argument and standard of review;2,5;260,00;650,00
8
+ 07.10.2026;Priya Natarajan;2701;Odessa Varga;Telephone call;0,3;300,00;90,00
9
+ 08.10.2026;Dana Whitlock;2702;Bram Holloway;Conference;0,5;450,00;225,00
@@ -0,0 +1,9 @@
1
+ ���t,�S���ٌ�m,�Č��ԍ�,�˗���,�E�v,����,�P��,���z
2
+ 2026/10/01,Dana Whitlock,2701,Odessa Varga,Review file; call client; draft letter to opposing counsel; research damages,4.5,450.00,"2,025.00"
3
+ 2026/10/02,Priya Natarajan,2701,Odessa Varga,Research,3.0,300.00,900.00
4
+ 2026/10/02,Tomas Lindgren,2702,Bram Holloway,,1.0,275.00,275.00
5
+ 2026/10/03,Grace Obi,2702,Bram Holloway,Calendar deadlines and organize file,1.0,150.00,150.00
6
+ 2026/10/05,Marcus Eriksen,2703,Demo Bakery Co,Work on brief issues,5.0,425.00,"2,125.00"
7
+ 2026/10/06,Leo Brandt,2703,Demo Bakery Co,Draft reply brief addressing waiver argument and standard of review,2.5,260.00,650.00
8
+ 2026/10/07,Priya Natarajan,2701,Odessa Varga,Telephone call,0.3,300.00,90.00
9
+ 2026/10/08,Dana Whitlock,2702,Bram Holloway,Conference,0.5,450.00,225.00
@@ -0,0 +1,5 @@
1
+ {
2
+ "thin_hours": 6,
3
+ "confirmed_by": "Marcus Eriksen (fictional billing partner)",
4
+ "confirmed_on": "2026-11-02"
5
+ }
@@ -0,0 +1 @@
1
+ { "thin_hourz": 2 }
@@ -0,0 +1,5 @@
1
+ {
2
+ "extra_vague_words": ["prep"],
3
+ "thin_hours": 2,
4
+ "thin_words": 5
5
+ }
@@ -0,0 +1,9 @@
1
+ Date,Staff,Matter,Client,Description,Hours,Rate,Amount
2
+ 10/01/2026,Dana Whitlock,2701,Odessa Varga,Review file; call client; draft letter to opposing counsel; research damages,4.5,450.00,2025.00
3
+ 10/02/2026,Priya Natarajan,2701,Odessa Varga,Research,3.0,300.00,900.00
4
+ 10/02/2026,Tomas Lindgren,2702,Bram Holloway,,1.0,275.00,275.00
5
+ 10/03/2026,Grace Obi,2702,Bram Holloway,Calendar deadlines and organize file,1.0,150.00,150.00
6
+ 10/05/2026,Marcus Eriksen,2703,Demo Bakery Co,Work on brief issues,5.0,425.00,2125.00
7
+ 10/06/2026,Leo Brandt,2703,Demo Bakery Co,Draft reply brief addressing waiver argument and standard of review,2.5,260.00,650.00
8
+ 10/07/2026,Priya Natarajan,2701,Odessa Varga,Telephone call,0.3,300.00,90.00
9
+ 10/08/2026,Dana Whitlock,2702,Bram Holloway,Conference,0.5,450.00,225.00
package/package.json CHANGED
@@ -1,6 +1,58 @@
1
1
  {
2
2
  "name": "fairbrief-block-billing",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "mcpName": "io.github.fpavia111-creator/fairbrief-block-billing",
5
+ "description": "Fairbrief Block Billing: finds block-billed, vague, empty and administrative time entry narratives before the bill goes out, with a plain reason for each.",
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-block-billing": "bin/fairbrief-block-billing.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-block-billing.js demo",
33
+ "eval": "node bin/fairbrief-block-billing.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-block-billing"
42
+ },
43
+ "homepage": "https://github.com/fpavia111-creator/fairbrief-agents/tree/master/packages/fairbrief-block-billing#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
+ "block-billing",
55
+ "time-entries",
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-block-billing",
4
+ "title": "Fairbrief Block Billing",
5
+ "description": "Fairbrief Block Billing: finds block-billed, vague, empty and administrative time entry narratives…",
6
+ "version": "0.1.0",
7
+ "repository": {
8
+ "url": "https://github.com/fpavia111-creator/fairbrief-agents",
9
+ "source": "github",
10
+ "subfolder": "packages/fairbrief-block-billing"
11
+ },
12
+ "websiteUrl": "https://fair-agents.com/fairbrief.html",
13
+ "packages": [
14
+ {
15
+ "registryType": "npm",
16
+ "identifier": "fairbrief-block-billing",
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,12 @@
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 Block Billing demo (fictional firm and time) in ${rt.root}\n`);
7
+ const f = { time: 'smokeball-time.csv' };
8
+ const c = await rt.call('block_billing_check', f);
9
+ printStep('Read October narratives before billing (a Smokeball layout)', c);
10
+ for (const i of c.result.items) process.stdout.write(` ${i.id} ${i.timekeeper.padEnd(16)} ${String(i.hours).padStart(4)} h ${i.findings.map((x) => x.code).join(', ')}\n`);
11
+ printStep('Write the worklist', await rt.call('block_billing_write_report', f));
12
+ }
package/src/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { manifest } from './manifest.js';
2
+ export * from './logic.js';
package/src/logic.js ADDED
@@ -0,0 +1,54 @@
1
+ // Time-entry narratives. Clients cut or query entries that lump several tasks under one
2
+ // figure, say nothing about what was done, describe clerical work, or give one short
3
+ // phrase for hours of work. Fairbrief Block Billing reads each narrative before the bill goes out and
4
+ // says plainly what is wrong with it. It reads words; a person decides.
5
+ import { str, num, round2, isoDate, blockParts, vagueReason, adminWord, isUnbilled, timeValue, confirmedNote } from 'fairbrief-core';
6
+
7
+ export const CHECKS = Object.freeze({
8
+ block_billed: { severity: 'error', what: 'Several tasks share one time figure (block billing).', fix: 'Split the entry so each task has its own time.' },
9
+ empty_description: { severity: 'error', what: 'The entry has no description.', fix: 'Ask the timekeeper what the work was.' },
10
+ vague: { severity: 'warning', what: 'The description does not say what was done or why (for example "Research" or "Conference").', fix: 'Add the subject and the purpose: research on what, a call with whom about what.' },
11
+ admin_work: { severity: 'warning', what: 'The description reads as clerical or administrative work, which many clients do not pay for.', fix: 'Mark it no-charge or describe the legal work it was part of.' },
12
+ thin_narrative: { severity: 'warning', what: 'A few words describe a long entry.', fix: 'Describe the work in enough detail to support the hours.' },
13
+ });
14
+
15
+ export const SETTINGS_SCHEMA = {
16
+ type: 'object', additionalProperties: false,
17
+ properties: {
18
+ extra_vague_words: { type: 'array', maxItems: 200, items: { type: 'string', minLength: 2, maxLength: 80 }, description: 'Phrases your clients reject on their own, added to the built-in list' },
19
+ extra_admin_words: { type: 'array', maxItems: 200, items: { type: 'string', minLength: 2, maxLength: 80 }, description: 'Clerical phrases to add to the built-in list' },
20
+ thin_hours: { type: 'number', minimum: 0.1, maximum: 24, description: 'Entries this long or longer need more than a few words (example default 2)' },
21
+ thin_words: { type: 'integer', minimum: 1, maximum: 50, description: 'Fewer words than this on a long entry is thin (example default 5)' },
22
+ include_billed: { type: 'boolean', description: 'Also read entries already billed (default false: pre-bill only)' },
23
+ confirmed_by: { type: 'string', maxLength: 120, description: 'Person at the firm who checked these settings' },
24
+ confirmed_on: { type: 'string', format: 'date', description: 'When they checked them' },
25
+ },
26
+ };
27
+
28
+ /** Returns { items (flagged entries), by_timekeeper, summary, by_check }. */
29
+ export function readNarratives(time, settings = {}, asOf = null) {
30
+ const thinH = settings.thin_hours ?? 2; const thinW = settings.thin_words ?? 5;
31
+ const rows = time.map((t, i) => ({ t, i, d: isoDate(t.date) })).filter((x) => x.d && (!asOf || x.d <= asOf) && (settings.include_billed || isUnbilled(x.t)));
32
+ const items = []; const TK = new Map(); let value = 0;
33
+ for (const { t, i, d } of rows) {
34
+ const desc = str(t.description); const h = num(t.hours) || 0; const findings = [];
35
+ if (!desc) findings.push({ code: 'empty_description', detail: `${d} ${str(t.timekeeper)}: ${h} hours with no description.` });
36
+ else {
37
+ const parts = blockParts(desc);
38
+ if (parts) findings.push({ code: 'block_billed', detail: `${d} ${str(t.timekeeper)}: ${parts.length} tasks under one figure of ${h} hours ("${parts.join('" / "')}").` });
39
+ const v = vagueReason(desc, settings.extra_vague_words || []);
40
+ if (v && !parts) findings.push({ code: 'vague', detail: `${d} ${str(t.timekeeper)}: ${v}.` });
41
+ const a = adminWord(desc, settings.extra_admin_words || []);
42
+ if (a) findings.push({ code: 'admin_work', detail: `${d} ${str(t.timekeeper)}: "${desc}" reads as clerical work ("${a}").` });
43
+ const words = desc.split(/\s+/).filter(Boolean).length;
44
+ if (!v && !parts && h >= thinH && words < thinW) findings.push({ code: 'thin_narrative', detail: `${d} ${str(t.timekeeper)}: ${words} words for ${h} hours.` });
45
+ }
46
+ if (!findings.length) continue;
47
+ const amount = timeValue(t); value = round2(value + amount);
48
+ items.push({ id: str(t.entry_id) || `T-${String(i + 1).padStart(4, '0')}`, date: d, timekeeper: str(t.timekeeper), matter: str(t.matter), client: str(t.client), hours: h, amount, description: desc, status: findings.some((f) => CHECKS[f.code].severity === 'error') ? 'error' : 'warning', findings });
49
+ const k = str(t.timekeeper) || 'unknown'; const x = TK.get(k) || { timekeeper: k, entries: 0, hours: 0, amount: 0 }; x.entries++; x.hours = round2(x.hours + h); x.amount = round2(x.amount + amount); TK.set(k, x);
50
+ }
51
+ const by_check = {}; for (const x of items) for (const f of x.findings) by_check[f.code] = (by_check[f.code] || 0) + 1;
52
+ const note = confirmedNote(settings);
53
+ return { summary: `${rows.length} entr(ies) read: ${items.length} need a better narrative (${value} of time at stake): ${by_check.block_billed || 0} block-billed, ${by_check.vague || 0} vague, ${by_check.empty_description || 0} empty, ${by_check.admin_work || 0} clerical, ${by_check.thin_narrative || 0} thin.`, read: rows.length, flagged: items.length, value_at_stake: value, by_timekeeper: [...TK.values()].sort((a, b) => b.entries - a.entries || b.amount - a.amount), by_check, ...(note ? { settings_note: note } : {}), items };
54
+ }
@@ -0,0 +1,43 @@
1
+ import { familyAgent, TIME_FIELDS, TIME_PROFILES, LIMITS, sectionTitle } from 'fairbrief-core';
2
+ import { readFileSync } from 'node:fs';
3
+ import { readNarratives, CHECKS, SETTINGS_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, matter, hours, rate and description' },
8
+ settings: { type: 'string', description: 'Optional narrative_settings JSON: extra vague and clerical phrases, thin-narrative limits, whether billed entries are read, who confirmed them' },
9
+ };
10
+ const run = (a, ctx) => readNarratives(ctx.records(a.time), a.settings ? ctx.readJson(a.settings, 'narrative_settings') : {}, a.as_of || null);
11
+
12
+ export const manifest = familyAgent({
13
+ name: 'fairbrief-block-billing', prefix: 'block_billing', version: pkg.version,
14
+ description: 'Finds block-billed, vague, empty, clerical and thin time-entry narratives before the bill goes out, with a plain reason for each and the time at stake by timekeeper. Client names are masked before results reach the model.',
15
+ checkTitle: 'Read time narratives before billing',
16
+ checkDescription: 'Each unbilled entry whose narrative is block-billed, vague, empty, clerical or thin, with the reason; totals by timekeeper.',
17
+ sources: { time: { label: 'Time entries', args: ['time'], fields: TIME_FIELDS, profiles: TIME_PROFILES } },
18
+ configSchemas: { narrative_settings: SETTINGS_SCHEMA },
19
+ args, required: ['time'], run, checks: CHECKS,
20
+ item: { key: 'id', label: 'entry', arg: 'entry_id', kind: 'item' },
21
+ argDocs: { entry_id: 'Entry id from block_billing_check (T-0003 for the third row of the file)' },
22
+ report: {
23
+ base: 'block-billing',
24
+ title: { en: 'Time narratives to fix', de: 'Zu überarbeitende Tätigkeitsbeschreibungen', fr: 'Descriptions de temps à corriger', es: 'Descripciones de tiempo por corregir', pt: 'Descrições de horas a corrigir', it: 'Descrizioni delle attività da correggere', 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, amount: i.amount, description: i.description, 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', 'description', 'reasons'],
27
+ sections: (r) => [{ title: sectionTitle('by_timekeeper'), rows: r.by_timekeeper, columns: ['timekeeper', 'entries', 'hours', 'amount'] }, { 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, 'Narratives are judged from their words: semicolons and lists suggest block billing, a short list of phrases suggests vague or clerical work. A good narrative can trip a check and a poor one can pass; read the list.', LIMITS.advice, LIMITS.phi],
29
+ },
30
+ refused: [{ name: 'time_entry_edit', category: 'binding_send', description: 'Fairbrief Block Billing never rewrites or changes time entries; the timekeeper does.' }],
31
+ prompt: {
32
+ name: 'narrative_review', title: 'Review time narratives before billing',
33
+ description: 'Walks the host model through a narrative review with Fairbrief Block Billing.',
34
+ arguments: [{ name: 'time', description: 'Time entries under --root', required: true }],
35
+ text: `You are helping a law firm's billing team clean up time narratives with fairbrief-block-billing. Time: {{time}}.
36
+
37
+ Rules: Fairbrief Block Billing never changes entries (time_entry_edit is blocked). Do not invent what the work was; ask the timekeeper. Client names are pseudonyms.
38
+
39
+ 1. Call block_billing_check. Report the counts by problem and the time at stake by timekeeper.
40
+ 2. For block-billed entries, show the tasks found so the timekeeper can split the time.
41
+ 3. Call block_billing_write_report to send each timekeeper their list.`,
42
+ },
43
+ });