amagi-binder 0.1.0__tar.gz

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.
Files changed (37) hide show
  1. amagi_binder-0.1.0/LICENSE +21 -0
  2. amagi_binder-0.1.0/MANIFEST.in +4 -0
  3. amagi_binder-0.1.0/PKG-INFO +231 -0
  4. amagi_binder-0.1.0/README.md +204 -0
  5. amagi_binder-0.1.0/SKILL.md +93 -0
  6. amagi_binder-0.1.0/examples/binder.pdf +0 -0
  7. amagi_binder-0.1.0/examples/binder_bates_log.csv +7 -0
  8. amagi_binder-0.1.0/examples/make_examples.py +302 -0
  9. amagi_binder-0.1.0/examples/riverside/01_supply_agreement.pdf +118 -0
  10. amagi_binder-0.1.0/examples/riverside/02_purchase_order.pdf +74 -0
  11. amagi_binder-0.1.0/examples/riverside/03_email_thread.pdf +74 -0
  12. amagi_binder-0.1.0/examples/riverside/04_service_log.pdf +44 -0
  13. amagi_binder-0.1.0/examples/riverside/05_oven_display_photo.jpg +0 -0
  14. amagi_binder-0.1.0/examples/riverside/06_refund_demand.pdf +80 -0
  15. amagi_binder-0.1.0/examples/riverside/index.csv +7 -0
  16. amagi_binder-0.1.0/examples/riverside/index.yaml +28 -0
  17. amagi_binder-0.1.0/pyproject.toml +45 -0
  18. amagi_binder-0.1.0/setup.cfg +4 -0
  19. amagi_binder-0.1.0/src/amagi_binder/__init__.py +1 -0
  20. amagi_binder-0.1.0/src/amagi_binder/__main__.py +3 -0
  21. amagi_binder-0.1.0/src/amagi_binder/build.py +340 -0
  22. amagi_binder-0.1.0/src/amagi_binder/cli.py +269 -0
  23. amagi_binder-0.1.0/src/amagi_binder/index.py +340 -0
  24. amagi_binder-0.1.0/src/amagi_binder/sheets.py +261 -0
  25. amagi_binder-0.1.0/src/amagi_binder/sources.py +154 -0
  26. amagi_binder-0.1.0/src/amagi_binder/stamp.py +169 -0
  27. amagi_binder-0.1.0/src/amagi_binder.egg-info/PKG-INFO +231 -0
  28. amagi_binder-0.1.0/src/amagi_binder.egg-info/SOURCES.txt +35 -0
  29. amagi_binder-0.1.0/src/amagi_binder.egg-info/dependency_links.txt +1 -0
  30. amagi_binder-0.1.0/src/amagi_binder.egg-info/entry_points.txt +2 -0
  31. amagi_binder-0.1.0/src/amagi_binder.egg-info/requires.txt +13 -0
  32. amagi_binder-0.1.0/src/amagi_binder.egg-info/top_level.txt +1 -0
  33. amagi_binder-0.1.0/tests/conftest.py +69 -0
  34. amagi_binder-0.1.0/tests/test_build.py +217 -0
  35. amagi_binder-0.1.0/tests/test_cli.py +111 -0
  36. amagi_binder-0.1.0/tests/test_index.py +127 -0
  37. amagi_binder-0.1.0/tests/test_sources_stamp.py +150 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Amagisolutionsgroup, Inc. (AmagiLabs)
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.
@@ -0,0 +1,4 @@
1
+ include LICENSE README.md SKILL.md
2
+ graft examples
3
+ graft tests
4
+ global-exclude __pycache__ *.py[cod]
@@ -0,0 +1,231 @@
1
+ Metadata-Version: 2.4
2
+ Name: amagi-binder
3
+ Version: 0.1.0
4
+ Summary: Turn a folder of exhibits and a short YAML or CSV index into one court-ready PDF: Bates stamps, exhibit slip sheets, a linked table of contents, bookmarks, and a CSV Bates log.
5
+ Author-email: "AmagiLabs (Amagisolutionsgroup, Inc.)" <dev@amagisolutionsgroup.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/amagilabs/amagi-binder
8
+ Project-URL: Issues, https://github.com/amagilabs/amagi-binder/issues
9
+ Keywords: bates,bates-numbering,exhibits,legal,litigation,pdf,discovery,cli,claude-code
10
+ Classifier: Environment :: Console
11
+ Classifier: Intended Audience :: Legal Industry
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Topic :: Office/Business
15
+ Requires-Python: >=3.9
16
+ Description-Content-Type: text/markdown
17
+ License-File: LICENSE
18
+ Requires-Dist: pikepdf>=8.0
19
+ Requires-Dist: reportlab<5,>=4.0; python_version < "3.10"
20
+ Requires-Dist: reportlab>=4.0; python_version >= "3.10"
21
+ Requires-Dist: pillow>=9.0
22
+ Requires-Dist: pyyaml>=6.0
23
+ Provides-Extra: dev
24
+ Requires-Dist: pytest>=7.0; extra == "dev"
25
+ Requires-Dist: pypdf>=4.0; extra == "dev"
26
+ Dynamic: license-file
27
+
28
+ # amagi-binder
29
+
30
+ Turn a folder of exhibits into one court-ready PDF. You list the exhibits in a short YAML or CSV
31
+ file. amagi-binder Bates-stamps every page and adds a slip sheet before each exhibit. It builds a
32
+ table of contents with clickable links, bookmarks every exhibit, and writes a CSV log of which
33
+ Bates numbers went where. Built for solo attorneys, small firms and people representing
34
+ themselves.
35
+
36
+ ![demo](assets/demo.gif)
37
+
38
+ ![Contents page, exhibit slip sheet, and a stamped landscape page](assets/binder_pages.png)
39
+
40
+ You don't need Acrobat Pro or a litigation suite for this. Everything runs on your machine. Files
41
+ are never uploaded, and you don't need an account or an API key.
42
+
43
+ ## Install
44
+
45
+ ```
46
+ pipx install amagi-binder
47
+ ```
48
+
49
+ Needs Python 3.9 or newer. It takes PDF, JPG, PNG and TIFF files.
50
+
51
+ ## Usage
52
+
53
+ The [examples](examples) folder holds a made-up breach-of-warranty case with six exhibits:
54
+ a contract, a purchase order, an email thread, a scanned landscape service log, a photo and a
55
+ demand letter. The `check` and `build` commands below run from that folder.
56
+
57
+ ### 1. Start an index from a folder
58
+
59
+ Here the same six files sit in a folder called `my_exhibits` (this run was on Windows, so the
60
+ paths print with backslashes):
61
+
62
+ ```
63
+ $ amagi-binder init my_exhibits/ --title "Plaintiff's Trial Exhibits"
64
+ wrote my_exhibits\index.yaml with 6 exhibits (sorted by file name). Edit it, then run:
65
+ amagi-binder build my_exhibits\index.yaml -o binder.pdf
66
+ ```
67
+
68
+ Files are sorted the way a person would sort them (`2_` before `10_`), and each title is a guess
69
+ from the file name:
70
+
71
+ ```yaml
72
+ # amagi-binder index. Edit titles, dates and order, then run:
73
+ # amagi-binder build <this file> -o binder.pdf
74
+ title: "Plaintiff's Trial Exhibits"
75
+ caption: "" # e.g. "Doe v. Roe, Case No. 1:26-cv-00001"
76
+ bates:
77
+ prefix: "" # e.g. "DOE" or "DOE_"
78
+ start: 1
79
+ digits: 6
80
+ labels: numbers # or: letters
81
+ exhibits:
82
+ - file: "01_supply_agreement.pdf"
83
+ title: "Supply agreement"
84
+ date: ""
85
+ - file: "02_purchase_order.pdf"
86
+ title: "Purchase order"
87
+ date: ""
88
+ ...
89
+ ```
90
+
91
+ Fix the titles, add dates, and put the exhibits in the order you want. The index order is the
92
+ binder order. An exhibit can also take a fixed `label` (`7A`), a `description` for its slip
93
+ sheet, a `pages` range (`"1-3,5"`), or several `files` that belong together, like an email and
94
+ its attachment. See [examples/riverside/index.yaml](examples/riverside/index.yaml) for a filled-in
95
+ index.
96
+
97
+ Prefer a spreadsheet? Use a CSV with the columns `file,label,title,date,description,pages`
98
+ instead ([example](examples/riverside/index.csv)).
99
+
100
+ ### 2. Check the plan
101
+
102
+ `check` reads every file and shows what each exhibit will get. It writes nothing.
103
+
104
+ ```
105
+ $ amagi-binder check riverside/index.yaml
106
+ Exhibit Pages Bates range Binder pages Title
107
+ 1 3 RBK000001 - RBK000003 2-5 Equipment Supply and Service Agreement
108
+ 2 1 RBK000004 6-7 Purchase Order RB-2025-014
109
+ 3 1 RBK000005 8-9 Emails between D. Whitfield and P. Osterm...
110
+ 4 1 RBK000006 10-11 Northgate service log for the DX-40
111
+ 5 1 RBK000007 12-13 Photo of the oven display reading 547 F a...
112
+ 6 1 RBK000008 14-15 Letter demanding return and refund under...
113
+
114
+ 6 exhibits, 15 binder pages, 1 contents page. Next Bates number: RBK000009
115
+ OK
116
+ ```
117
+
118
+ It stops with exit code 1 on a missing file, a password-protected or broken PDF, a bad page
119
+ range, or two exhibits with the same label. It warns about files in the folder that the index
120
+ leaves out. `--json` prints the same plan for scripts.
121
+
122
+ ### 3. Build the binder
123
+
124
+ ```
125
+ $ amagi-binder build riverside/index.yaml -o binder.pdf
126
+ Exhibit Pages Bates range Binder pages Title
127
+ ...
128
+ wrote binder.pdf (6 exhibits, 15 binder pages, 1 contents page. Next Bates number: RBK000009)
129
+ wrote binder_bates_log.csv
130
+ ```
131
+
132
+ The sample output is in the repo: [examples/binder.pdf](examples/binder.pdf) and
133
+ [examples/binder_bates_log.csv](examples/binder_bates_log.csv).
134
+
135
+ What's in the PDF:
136
+
137
+ - **A table of contents** listing each exhibit's label, title, date, page count, Bates range and
138
+ binder page. Click a row to jump to that exhibit. Long lists run onto more pages.
139
+ - **A slip sheet** before each exhibit, with the label in large type, the title, date,
140
+ description, Bates range and case caption.
141
+ - **A Bates number on every exhibit page.** By default it sits bottom-right, 0.3 inch from the
142
+ edge, as the page appears on screen. Rotated scans and cropped pages are stamped in the right
143
+ spot.
144
+ - **Bookmarks** for every exhibit, with a sub-bookmark for each file when an exhibit has several.
145
+ - **Page labels**, so the viewer's page box shows `RBK000004` and you can type a Bates number to
146
+ jump to it.
147
+
148
+ The log has one row per exhibit, with a SHA-256 hash of each source file so you can show later
149
+ which version of a document you produced:
150
+
151
+ ```
152
+ exhibit,title,date,files,pages,bates_begin,bates_end,binder_page_begin,binder_page_end,sha256
153
+ 1,Equipment Supply and Service Agreement,"January 15, 2025",01_supply_agreement.pdf,3,RBK000001,RBK000003,2,5,11202a2a1919931129ebf405d27c836632364512c43c153dcb00ed10ceb555d0
154
+ 2,Purchase Order RB-2025-014,"January 20, 2025",02_purchase_order.pdf,1,RBK000004,RBK000004,6,7,6f1df52cfad2f2fd28bb037cd13e5dfc283510f6144624fc678f9283d6e83d0c
155
+ ```
156
+
157
+ ### Options
158
+
159
+ Flags override the index file:
160
+
161
+ ```
162
+ $ amagi-binder build riverside/index.yaml -o binder.pdf --prefix DEF_ --start 1201 --legend CONFIDENTIAL --stamp-slips -q
163
+ wrote binder.pdf (6 exhibits, 15 binder pages, 1 contents page. Next Bates number: DEF_001215)
164
+ wrote binder_bates_log.csv
165
+ ```
166
+
167
+ | Flag | What it does |
168
+ |---|---|
169
+ | `--prefix`, `--start`, `--digits` | Bates format: `DEF_001201` |
170
+ | `--legend TEXT` | A second stamp at bottom-left, such as `CONFIDENTIAL` |
171
+ | `--exhibit-stamp` | Adds `Exhibit 3, page 2 of 5` at bottom-center |
172
+ | `--position`, `--font-size`, `--box` | Stamp placement, size, and a white box behind it |
173
+ | `--stamp-slips` | Slip sheets get a Bates number too |
174
+ | `--no-bates`, `--no-slips`, `--no-toc` | Leave parts out |
175
+ | `--labels letters`, `--label-start N` | Exhibits A, B, C (after Z comes AA), or start at 12 |
176
+ | `--exhibit-word Tab` | Slip sheets say TAB instead of EXHIBIT |
177
+ | `--paper letter\|legal\|a4` | Size of slip sheets, contents pages and photo pages |
178
+ | `--exhibits DIR` | Folder the file names are relative to, if the index lives elsewhere |
179
+
180
+ Run the same index twice and you get a byte-identical PDF.
181
+
182
+ Exit codes: `0` ok, `1` the index has problems, `2` usage error.
183
+
184
+ ## Use it from Claude
185
+
186
+ The repo ships a [SKILL.md](SKILL.md). Copy it to `~/.claude/skills/amagi-binder/SKILL.md`,
187
+ point Claude at a folder, and say "make an exhibit binder, Bates prefix DOE." Claude writes the
188
+ index, runs `check`, asks you about anything it flagged, then builds the binder. The skill tells
189
+ Claude never to invent titles or dates.
190
+
191
+ ## Limits
192
+
193
+ - It numbers and assembles. It does not redact, OCR, or decide what to produce or withhold.
194
+ - Check your court's local rules on exhibit format. The defaults (stamp bottom-right, letter
195
+ paper, slip sheets) are common, but they aren't universal.
196
+ - Stamps are drawn on top of the page. If a document's content runs to the edge, look at that
197
+ page and use `--box` or `--position` if a stamp covers text.
198
+ - Password-protected PDFs must be unlocked first (for example
199
+ `qpdf --decrypt --password=PASSWORD in.pdf out.pdf`).
200
+ - Stamps use the built-in Helvetica font, which covers Western European characters. Other
201
+ characters in titles or legends print as `?`.
202
+
203
+ ## If this saved you time
204
+
205
+ A star helps other people find it. If a PDF stamps in the wrong place, open an issue and attach
206
+ the page if you can share it.
207
+
208
+ ## More AmagiLabs tools
209
+
210
+ - [amagi-litigation-deadlines](https://github.com/amagilabs/amagi-litigation-deadlines): computes
211
+ litigation response deadlines from a trigger event and date, with a citation for every rule.
212
+ - [amagi-contract-deadlines](https://github.com/amagilabs/amagi-contract-deadlines): pulls every
213
+ renewal, notice and expiry date out of a folder of contracts into a calendar and a CSV.
214
+ - [amagi-legal-review-skills](https://github.com/amagilabs/amagi-legal-review-skills): Claude Code
215
+ skills for contract and lease review.
216
+ - More at [github.com/amagilabs](https://github.com/amagilabs).
217
+
218
+ ## Development
219
+
220
+ ```
221
+ pip install -e ".[dev]"
222
+ pytest
223
+ python examples/make_examples.py # rebuild the example exhibits
224
+ ```
225
+
226
+ ## License
227
+
228
+ MIT. See [LICENSE](LICENSE). amagi-binder uses [pikepdf](https://pikepdf.readthedocs.io)
229
+ (MPL-2.0), [ReportLab](https://www.reportlab.com/opensource/) (BSD),
230
+ [Pillow](https://python-pillow.org) (MIT-CMU) and [PyYAML](https://pyyaml.org) (MIT). The example
231
+ case, its parties and its documents are made up.
@@ -0,0 +1,204 @@
1
+ # amagi-binder
2
+
3
+ Turn a folder of exhibits into one court-ready PDF. You list the exhibits in a short YAML or CSV
4
+ file. amagi-binder Bates-stamps every page and adds a slip sheet before each exhibit. It builds a
5
+ table of contents with clickable links, bookmarks every exhibit, and writes a CSV log of which
6
+ Bates numbers went where. Built for solo attorneys, small firms and people representing
7
+ themselves.
8
+
9
+ ![demo](assets/demo.gif)
10
+
11
+ ![Contents page, exhibit slip sheet, and a stamped landscape page](assets/binder_pages.png)
12
+
13
+ You don't need Acrobat Pro or a litigation suite for this. Everything runs on your machine. Files
14
+ are never uploaded, and you don't need an account or an API key.
15
+
16
+ ## Install
17
+
18
+ ```
19
+ pipx install amagi-binder
20
+ ```
21
+
22
+ Needs Python 3.9 or newer. It takes PDF, JPG, PNG and TIFF files.
23
+
24
+ ## Usage
25
+
26
+ The [examples](examples) folder holds a made-up breach-of-warranty case with six exhibits:
27
+ a contract, a purchase order, an email thread, a scanned landscape service log, a photo and a
28
+ demand letter. The `check` and `build` commands below run from that folder.
29
+
30
+ ### 1. Start an index from a folder
31
+
32
+ Here the same six files sit in a folder called `my_exhibits` (this run was on Windows, so the
33
+ paths print with backslashes):
34
+
35
+ ```
36
+ $ amagi-binder init my_exhibits/ --title "Plaintiff's Trial Exhibits"
37
+ wrote my_exhibits\index.yaml with 6 exhibits (sorted by file name). Edit it, then run:
38
+ amagi-binder build my_exhibits\index.yaml -o binder.pdf
39
+ ```
40
+
41
+ Files are sorted the way a person would sort them (`2_` before `10_`), and each title is a guess
42
+ from the file name:
43
+
44
+ ```yaml
45
+ # amagi-binder index. Edit titles, dates and order, then run:
46
+ # amagi-binder build <this file> -o binder.pdf
47
+ title: "Plaintiff's Trial Exhibits"
48
+ caption: "" # e.g. "Doe v. Roe, Case No. 1:26-cv-00001"
49
+ bates:
50
+ prefix: "" # e.g. "DOE" or "DOE_"
51
+ start: 1
52
+ digits: 6
53
+ labels: numbers # or: letters
54
+ exhibits:
55
+ - file: "01_supply_agreement.pdf"
56
+ title: "Supply agreement"
57
+ date: ""
58
+ - file: "02_purchase_order.pdf"
59
+ title: "Purchase order"
60
+ date: ""
61
+ ...
62
+ ```
63
+
64
+ Fix the titles, add dates, and put the exhibits in the order you want. The index order is the
65
+ binder order. An exhibit can also take a fixed `label` (`7A`), a `description` for its slip
66
+ sheet, a `pages` range (`"1-3,5"`), or several `files` that belong together, like an email and
67
+ its attachment. See [examples/riverside/index.yaml](examples/riverside/index.yaml) for a filled-in
68
+ index.
69
+
70
+ Prefer a spreadsheet? Use a CSV with the columns `file,label,title,date,description,pages`
71
+ instead ([example](examples/riverside/index.csv)).
72
+
73
+ ### 2. Check the plan
74
+
75
+ `check` reads every file and shows what each exhibit will get. It writes nothing.
76
+
77
+ ```
78
+ $ amagi-binder check riverside/index.yaml
79
+ Exhibit Pages Bates range Binder pages Title
80
+ 1 3 RBK000001 - RBK000003 2-5 Equipment Supply and Service Agreement
81
+ 2 1 RBK000004 6-7 Purchase Order RB-2025-014
82
+ 3 1 RBK000005 8-9 Emails between D. Whitfield and P. Osterm...
83
+ 4 1 RBK000006 10-11 Northgate service log for the DX-40
84
+ 5 1 RBK000007 12-13 Photo of the oven display reading 547 F a...
85
+ 6 1 RBK000008 14-15 Letter demanding return and refund under...
86
+
87
+ 6 exhibits, 15 binder pages, 1 contents page. Next Bates number: RBK000009
88
+ OK
89
+ ```
90
+
91
+ It stops with exit code 1 on a missing file, a password-protected or broken PDF, a bad page
92
+ range, or two exhibits with the same label. It warns about files in the folder that the index
93
+ leaves out. `--json` prints the same plan for scripts.
94
+
95
+ ### 3. Build the binder
96
+
97
+ ```
98
+ $ amagi-binder build riverside/index.yaml -o binder.pdf
99
+ Exhibit Pages Bates range Binder pages Title
100
+ ...
101
+ wrote binder.pdf (6 exhibits, 15 binder pages, 1 contents page. Next Bates number: RBK000009)
102
+ wrote binder_bates_log.csv
103
+ ```
104
+
105
+ The sample output is in the repo: [examples/binder.pdf](examples/binder.pdf) and
106
+ [examples/binder_bates_log.csv](examples/binder_bates_log.csv).
107
+
108
+ What's in the PDF:
109
+
110
+ - **A table of contents** listing each exhibit's label, title, date, page count, Bates range and
111
+ binder page. Click a row to jump to that exhibit. Long lists run onto more pages.
112
+ - **A slip sheet** before each exhibit, with the label in large type, the title, date,
113
+ description, Bates range and case caption.
114
+ - **A Bates number on every exhibit page.** By default it sits bottom-right, 0.3 inch from the
115
+ edge, as the page appears on screen. Rotated scans and cropped pages are stamped in the right
116
+ spot.
117
+ - **Bookmarks** for every exhibit, with a sub-bookmark for each file when an exhibit has several.
118
+ - **Page labels**, so the viewer's page box shows `RBK000004` and you can type a Bates number to
119
+ jump to it.
120
+
121
+ The log has one row per exhibit, with a SHA-256 hash of each source file so you can show later
122
+ which version of a document you produced:
123
+
124
+ ```
125
+ exhibit,title,date,files,pages,bates_begin,bates_end,binder_page_begin,binder_page_end,sha256
126
+ 1,Equipment Supply and Service Agreement,"January 15, 2025",01_supply_agreement.pdf,3,RBK000001,RBK000003,2,5,11202a2a1919931129ebf405d27c836632364512c43c153dcb00ed10ceb555d0
127
+ 2,Purchase Order RB-2025-014,"January 20, 2025",02_purchase_order.pdf,1,RBK000004,RBK000004,6,7,6f1df52cfad2f2fd28bb037cd13e5dfc283510f6144624fc678f9283d6e83d0c
128
+ ```
129
+
130
+ ### Options
131
+
132
+ Flags override the index file:
133
+
134
+ ```
135
+ $ amagi-binder build riverside/index.yaml -o binder.pdf --prefix DEF_ --start 1201 --legend CONFIDENTIAL --stamp-slips -q
136
+ wrote binder.pdf (6 exhibits, 15 binder pages, 1 contents page. Next Bates number: DEF_001215)
137
+ wrote binder_bates_log.csv
138
+ ```
139
+
140
+ | Flag | What it does |
141
+ |---|---|
142
+ | `--prefix`, `--start`, `--digits` | Bates format: `DEF_001201` |
143
+ | `--legend TEXT` | A second stamp at bottom-left, such as `CONFIDENTIAL` |
144
+ | `--exhibit-stamp` | Adds `Exhibit 3, page 2 of 5` at bottom-center |
145
+ | `--position`, `--font-size`, `--box` | Stamp placement, size, and a white box behind it |
146
+ | `--stamp-slips` | Slip sheets get a Bates number too |
147
+ | `--no-bates`, `--no-slips`, `--no-toc` | Leave parts out |
148
+ | `--labels letters`, `--label-start N` | Exhibits A, B, C (after Z comes AA), or start at 12 |
149
+ | `--exhibit-word Tab` | Slip sheets say TAB instead of EXHIBIT |
150
+ | `--paper letter\|legal\|a4` | Size of slip sheets, contents pages and photo pages |
151
+ | `--exhibits DIR` | Folder the file names are relative to, if the index lives elsewhere |
152
+
153
+ Run the same index twice and you get a byte-identical PDF.
154
+
155
+ Exit codes: `0` ok, `1` the index has problems, `2` usage error.
156
+
157
+ ## Use it from Claude
158
+
159
+ The repo ships a [SKILL.md](SKILL.md). Copy it to `~/.claude/skills/amagi-binder/SKILL.md`,
160
+ point Claude at a folder, and say "make an exhibit binder, Bates prefix DOE." Claude writes the
161
+ index, runs `check`, asks you about anything it flagged, then builds the binder. The skill tells
162
+ Claude never to invent titles or dates.
163
+
164
+ ## Limits
165
+
166
+ - It numbers and assembles. It does not redact, OCR, or decide what to produce or withhold.
167
+ - Check your court's local rules on exhibit format. The defaults (stamp bottom-right, letter
168
+ paper, slip sheets) are common, but they aren't universal.
169
+ - Stamps are drawn on top of the page. If a document's content runs to the edge, look at that
170
+ page and use `--box` or `--position` if a stamp covers text.
171
+ - Password-protected PDFs must be unlocked first (for example
172
+ `qpdf --decrypt --password=PASSWORD in.pdf out.pdf`).
173
+ - Stamps use the built-in Helvetica font, which covers Western European characters. Other
174
+ characters in titles or legends print as `?`.
175
+
176
+ ## If this saved you time
177
+
178
+ A star helps other people find it. If a PDF stamps in the wrong place, open an issue and attach
179
+ the page if you can share it.
180
+
181
+ ## More AmagiLabs tools
182
+
183
+ - [amagi-litigation-deadlines](https://github.com/amagilabs/amagi-litigation-deadlines): computes
184
+ litigation response deadlines from a trigger event and date, with a citation for every rule.
185
+ - [amagi-contract-deadlines](https://github.com/amagilabs/amagi-contract-deadlines): pulls every
186
+ renewal, notice and expiry date out of a folder of contracts into a calendar and a CSV.
187
+ - [amagi-legal-review-skills](https://github.com/amagilabs/amagi-legal-review-skills): Claude Code
188
+ skills for contract and lease review.
189
+ - More at [github.com/amagilabs](https://github.com/amagilabs).
190
+
191
+ ## Development
192
+
193
+ ```
194
+ pip install -e ".[dev]"
195
+ pytest
196
+ python examples/make_examples.py # rebuild the example exhibits
197
+ ```
198
+
199
+ ## License
200
+
201
+ MIT. See [LICENSE](LICENSE). amagi-binder uses [pikepdf](https://pikepdf.readthedocs.io)
202
+ (MPL-2.0), [ReportLab](https://www.reportlab.com/opensource/) (BSD),
203
+ [Pillow](https://python-pillow.org) (MIT-CMU) and [PyYAML](https://pyyaml.org) (MIT). The example
204
+ case, its parties and its documents are made up.
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: amagi-binder
3
+ description: Use when someone has a folder of exhibits (PDFs, scans, photos) and needs one court-ready exhibit binder - Bates-stamped pages, exhibit slip sheets, a linked table of contents, PDF bookmarks and a CSV Bates log. Works from a short YAML or CSV index; runs locally.
4
+ ---
5
+
6
+ # amagi-binder
7
+
8
+ ## When to use
9
+
10
+ Use this skill when the user wants to put exhibits together for a filing, a hearing, a
11
+ deposition or a production: "Bates stamp these and make an exhibit binder", "number these
12
+ DEF000001 onward", "build the trial exhibit book from this folder". Inputs can be PDF, JPG,
13
+ PNG or TIFF files. The output is one PDF plus a CSV log of what got which Bates numbers.
14
+
15
+ It runs on the user's machine. It makes no network calls and needs no API keys.
16
+
17
+ ## Workflow
18
+
19
+ 1. **Write a starter index** from the folder. Files are listed in natural name order
20
+ (`2_` before `10_`), with a title guessed from each file name.
21
+
22
+ ```
23
+ amagi-binder init exhibits/ --title "Plaintiff's Trial Exhibits"
24
+ ```
25
+
26
+ 2. **Edit `exhibits/index.yaml`** with what the user tells you:
27
+
28
+ ```yaml
29
+ title: "Plaintiff's Trial Exhibits"
30
+ caption: "Doe v. Roe, Case No. 1:26-cv-00001"
31
+ bates:
32
+ prefix: "DOE" # DOE000001, DOE000002, ...
33
+ start: 1
34
+ digits: 6
35
+ labels: numbers # or letters (A, B, ... Z, AA)
36
+ exhibits:
37
+ - file: 01_contract.pdf
38
+ title: "Supply agreement"
39
+ date: 2025-01-15
40
+ - file: 07_emails.pdf
41
+ label: "7A" # a fixed label wins over auto labels
42
+ pages: "1-3,5" # only some pages, in this order
43
+ - files: [08_email.pdf, 08_attachment.pdf] # one exhibit from several files
44
+ title: "Email with attachment"
45
+ ```
46
+
47
+ Order in the index is order in the binder. **Never invent titles, dates or
48
+ descriptions.** Use what the user said or what the document plainly shows. If a date is
49
+ unknown, leave it out. Ask before renumbering anything that has already been produced.
50
+
51
+ A CSV index works too, with columns `file,label,title,date,description,pages`. Put
52
+ several files for one exhibit in one cell, separated by `;`.
53
+
54
+ 3. **Check before building.** This writes nothing.
55
+
56
+ ```
57
+ amagi-binder check exhibits/index.yaml
58
+ amagi-binder check exhibits/index.yaml --json
59
+ ```
60
+
61
+ It prints each exhibit's page count, Bates range and binder pages, then the next unused
62
+ Bates number. It fails (exit 1) on a missing file, an unreadable or password-protected
63
+ PDF, a bad page range or a duplicate label. It warns about files in the folder that the
64
+ index skips. Tell the user about every warning.
65
+
66
+ 4. **Build.**
67
+
68
+ ```
69
+ amagi-binder build exhibits/index.yaml -o binder.pdf
70
+ ```
71
+
72
+ This writes `binder.pdf` and `binder_bates_log.csv` (exhibit, title, date, files, pages,
73
+ Bates begin and end, binder pages, SHA-256 of each source file).
74
+
75
+ ## Useful flags
76
+
77
+ - `--prefix DEF_ --start 1201 --digits 7` sets Bates numbering. These flags override the index.
78
+ - `--legend CONFIDENTIAL` adds a second stamp at bottom-left.
79
+ - `--exhibit-stamp` adds "Exhibit 3, page 2 of 5" at bottom-center.
80
+ - `--position top-right`, `--font-size 9`, `--box` (white box behind the stamp).
81
+ - `--stamp-slips` gives slip sheets a Bates number too.
82
+ - `--no-bates`, `--no-slips`, `--no-toc` turn parts off.
83
+ - `--labels letters`, `--label-start 12`, `--exhibit-word Tab`.
84
+ - `--paper letter|legal|a4` sets the size of slip sheets, contents pages and image pages.
85
+
86
+ ## What to tell the user
87
+
88
+ - Report the Bates range and page count from the command output. Don't estimate them.
89
+ - Stamps go on top of the page, about 0.3 inch from the edge. Check one page where the
90
+ content runs to the edge, and use `--box` or `--position` if a stamp covers text.
91
+ - Unlock password-protected PDFs first (for example with `qpdf --decrypt`).
92
+ - This tool numbers and assembles documents. It does not decide what to produce or
93
+ withhold, and it does not redact. Those calls belong to the attorney.
Binary file
@@ -0,0 +1,7 @@
1
+ exhibit,title,date,files,pages,bates_begin,bates_end,binder_page_begin,binder_page_end,sha256
2
+ 1,Equipment Supply and Service Agreement,"January 15, 2025",01_supply_agreement.pdf,3,RBK000001,RBK000003,2,5,11202a2a1919931129ebf405d27c836632364512c43c153dcb00ed10ceb555d0
3
+ 2,Purchase Order RB-2025-014,"January 20, 2025",02_purchase_order.pdf,1,RBK000004,RBK000004,6,7,6f1df52cfad2f2fd28bb037cd13e5dfc283510f6144624fc678f9283d6e83d0c
4
+ 3,Emails between D. Whitfield and P. Osterman about the oven running hot,"June 9 - July 1, 2025",03_email_thread.pdf,1,RBK000005,RBK000005,8,9,c3c243bd76d6f447b843fa7456487410373acb8840d6493125b7f7256baf2e8d
5
+ 4,Northgate service log for the DX-40,"March 3 - July 2, 2025",04_service_log.pdf,1,RBK000006,RBK000006,10,11,4f1b6ee5ba42a3ec73edecc572228d90c0746b5b5055bacec9f7efcf1a01cecf
6
+ 5,Photo of the oven display reading 547 F at a 500 F set point,"July 1, 2025",05_oven_display_photo.jpg,1,RBK000007,RBK000007,12,13,dfe88a4c932fe36bc290d75b106182be4d8cef5a8efdb5809cdad5b9b2440bb3
7
+ 6,Letter demanding return and refund under Section 5,"July 8, 2025",06_refund_demand.pdf,1,RBK000008,RBK000008,14,15,7e6bcad5c219091f0919dd8a41a7e70d7aae6a618471348fdac8a11ff3e656e6