twinwise 0.3.6__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.
twinwise-0.3.6/LICENSE ADDED
@@ -0,0 +1,177 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
twinwise-0.3.6/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ Twinwise
2
+ Copyright 2026 Suman Mondal
3
+
4
+ This product is licensed under the Apache License, Version 2.0 (see LICENSE).
@@ -0,0 +1,250 @@
1
+ Metadata-Version: 2.4
2
+ Name: twinwise
3
+ Version: 0.3.6
4
+ Summary: Make a safe twin of business spreadsheets before you use AI. Runs locally.
5
+ Author: Suman Mondal
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/Chalkduggo/Twinwise
8
+ Project-URL: Documentation, https://github.com/Chalkduggo/Twinwise/blob/main/docs/USER_MANUAL.md
9
+ Project-URL: Changelog, https://github.com/Chalkduggo/Twinwise/blob/main/CHANGELOG.md
10
+ Project-URL: Issues, https://github.com/Chalkduggo/Twinwise/issues
11
+ Project-URL: Security, https://github.com/Chalkduggo/Twinwise/blob/main/SECURITY.md
12
+ Keywords: privacy,data masking,anonymization,pseudonymization,excel,llm,ai safety
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Web Environment
15
+ Classifier: Intended Audience :: Financial and Insurance Industry
16
+ Classifier: Intended Audience :: End Users/Desktop
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Operating System :: OS Independent
23
+ Classifier: Topic :: Office/Business :: Financial :: Spreadsheet
24
+ Classifier: Topic :: Security
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ License-File: NOTICE
29
+ Requires-Dist: openpyxl>=3.1
30
+ Requires-Dist: fastapi>=0.110
31
+ Requires-Dist: uvicorn>=0.27
32
+ Requires-Dist: python-multipart>=0.0.9
33
+ Requires-Dist: cryptography>=42
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=8; extra == "dev"
36
+ Requires-Dist: httpx>=0.27; extra == "dev"
37
+ Dynamic: license-file
38
+
39
+ <p align="center"><img src="https://raw.githubusercontent.com/Chalkduggo/Twinwise/main/twinwise/ui/logo.svg" width="64" alt="Twinwise logo"></p>
40
+
41
+ <h1 align="center">Twinwise</h1>
42
+ <p align="center"><b>Make a safe twin of your business spreadsheets before you use AI.</b><br>
43
+ Same layout. Fake names, IDs and numbers. Totals still add up. Runs entirely on your computer.</p>
44
+ <p align="center">
45
+ <a href="https://pypi.org/project/twinwise/"><img src="https://img.shields.io/pypi/v/twinwise?label=PyPI" alt="PyPI version"></a>
46
+ <a href="https://github.com/Chalkduggo/Twinwise/actions/workflows/tests.yml"><img src="https://github.com/Chalkduggo/Twinwise/actions/workflows/tests.yml/badge.svg" alt="Tests"></a>
47
+ <a href="https://scorecard.dev/viewer/?uri=github.com/Chalkduggo/Twinwise"><img src="https://api.scorecard.dev/projects/github.com/Chalkduggo/Twinwise/badge" alt="OpenSSF Scorecard"></a>
48
+ <a href="https://github.com/Chalkduggo/Twinwise/blob/main/LICENSE"><img src="https://img.shields.io/badge/licence-Apache%202.0-blue" alt="Licence: Apache 2.0"></a>
49
+ </p>
50
+
51
+ ![Twinwise review screen](https://raw.githubusercontent.com/Chalkduggo/Twinwise/main/docs/screenshots/02-review.png)
52
+
53
+
54
+ https://github.com/user-attachments/assets/59911a9c-dcbe-4921-84c3-c62e856f076f
55
+
56
+
57
+ <p align="center">🎬 <a href="https://github.com/Chalkduggo/Twinwise/blob/main/docs/Twinwise_User_Guide.mp4"><b>Watch the 98-second user guide</b></a> · 📘 <a href="https://github.com/Chalkduggo/Twinwise/blob/main/docs/USER_GUIDE.md"><b>User guide</b></a> · 📕 <a href="https://github.com/Chalkduggo/Twinwise/blob/main/docs/USER_MANUAL.md"><b>User manual</b></a> · 🛡️ <a href="https://github.com/Chalkduggo/Twinwise/blob/main/docs/THREAT_MODEL.md"><b>Threat model</b></a> · ⬇️ <a href="https://github.com/Chalkduggo/Twinwise/releases/latest"><b>Download for Windows · macOS · Linux</b></a></p>
58
+
59
+ ## The problem
60
+
61
+ Teams want to ask ChatGPT, Claude or Copilot about their partner reports, revenue statements and subscriber files, but they can't upload the real thing. Partner names, deal terms and figures are confidential.
62
+
63
+ Twinwise creates a **data twin**: a copy of the file that looks and behaves like the original, with everything sensitive replaced.
64
+
65
+ | Original | Twin |
66
+ |---|---|
67
+ | `Northwind Cable PPV Activity Report` | `Company 1 PPV Activity Report` |
68
+ | `51001 - PPV for Aldermoor` | `79224 - PPV for Region 1` |
69
+ | `LANTERN FAMILY CHANNEL`, vendor `418207` | `VENDOR 1`, vendor `187512` |
70
+ | 5 buys × 4.99 = 24.95 | 7 buys × 3.99 = 27.93 *(still adds up)* |
71
+ | `royalties@harbormedia.example` | `user1@example.com` |
72
+
73
+ ## How it works
74
+
75
+ 1. **Drop in files.** Excel (`.xlsx`), CSV, or a ZIP of them.
76
+ 2. **Automatic first pass.** Twinwise finds the header row, works out what each column holds (names, IDs, counts, prices, percentages, dates), spots totals rows and formulas such as *Revenue = Buys × Price*, and plans every change.
77
+ 3. **You review.** Colours show the plan. Anything new it isn't sure about is marked in red. Click a cell or a column to change how it's handled.
78
+ 4. **Safety check.** The saved twin is searched for every value that was replaced: cells, sheet names, file name and document properties. Export is blocked if anything is found.
79
+ 5. **Export and use.** You get the twin (safe to share) and a private **key file** (never share it). Paste the AI's answer into *Restore AI answer* to see real names again.
80
+
81
+ Every export also includes **AI-ready context** for chat or RAG pipelines:
82
+
83
+ - `…_CONTEXT.md`: a data card covering what the file is, what each column means, the formulas in plain words (*Revenue = Number of Buys × Sale Price*), totals and summary figures. Paste it into a chat next to the twin, or index it.
84
+ - `…_chunks.jsonl`: ready-made chunks (overview, columns, totals, one per row) with metadata such as file, sheet, row and name labels. Load them straight into LangChain, LlamaIndex, Azure AI Search, pgvector, or anything that takes JSON lines.
85
+
86
+ Both are built from the twin only and pass the same leak test, so nothing real reaches your vector database.
87
+
88
+ Twinwise **learns**. Your decisions are saved as templates and a name library, so next month's file from the same partner is recognised and needs no review.
89
+
90
+ | Review | Safety check | Export |
91
+ |---|---|---|
92
+ | ![](https://raw.githubusercontent.com/Chalkduggo/Twinwise/main/docs/screenshots/04-cell.png) | ![](https://raw.githubusercontent.com/Chalkduggo/Twinwise/main/docs/screenshots/09-verify.png) | ![](https://raw.githubusercontent.com/Chalkduggo/Twinwise/main/docs/screenshots/10-export.png) |
93
+
94
+ ## Install
95
+
96
+ **Download the app** from [Releases](https://github.com/Chalkduggo/Twinwise/releases/latest). No Python needed:
97
+
98
+ | System | File | Start it |
99
+ |---|---|---|
100
+ | Windows 10/11 | `Twinwise-Windows.zip` | Unzip, double-click `Twinwise.exe`. If you see *"Windows protected your PC"*, click **More info → Run anyway**. |
101
+ | macOS (Apple Silicon) | `Twinwise-macOS-AppleSilicon.zip` | Unzip, double-click `Start Twinwise.command`. If macOS blocks it, go to **System Settings → Privacy & Security → Open Anyway**. |
102
+ | Linux (x86-64) | `Twinwise-Linux-x86_64.tar.gz` | `tar -xzf …` then `./Twinwise/start-twinwise.sh` |
103
+
104
+ The apps aren't code-signed yet, which is why the operating system asks once. Intel Macs: use the Python install below.
105
+
106
+ **With Python 3.10 or newer**, install from PyPI:
107
+
108
+ ```bash
109
+ pip install twinwise
110
+ twinwise ui # opens http://127.0.0.1:8765 in your browser
111
+ ```
112
+
113
+ Or from source:
114
+
115
+ ```bash
116
+ git clone https://github.com/Chalkduggo/Twinwise.git
117
+ cd Twinwise
118
+ pip install -e .
119
+ ```
120
+
121
+ **Check your download.** Every release includes `SHA256SUMS.txt`. On Windows run `certutil -hashfile Twinwise-Windows.zip SHA256`, on macOS/Linux `shasum -a 256 <file>`, and compare the result with the line in that file.
122
+
123
+ From source, double-click **`Start-Twinwise.bat`** (Windows) or run **`./start-twinwise.sh`** (macOS/Linux). Either one creates a private Python environment the first time, then opens the app.
124
+
125
+ To try it without your own files:
126
+
127
+ ```bash
128
+ twinwise demo # writes made-up partner reports to ~/Twinwise/demo
129
+ ```
130
+
131
+ ## Command line
132
+
133
+ ```bash
134
+ twinwise twin report.xlsx statements.zip -o out/ # create twins
135
+ twinwise twin data.csv --mode scale # one hidden factor for everything
136
+ twinwise twin report.xlsx --key-password "a long passphrase" # encrypt the key file
137
+ twinwise restore --key out/twin-key_2026-11-09.json answer.txt # AI answer -> real names
138
+ twinwise protect # password-protect your library
139
+ ```
140
+
141
+ Exit code `2` means the safety check found a leak, so you can use it in scripts.
142
+
143
+ ## How numbers change
144
+
145
+ | Mode | What happens | Use when |
146
+ |---|---|---|
147
+ | **consistent** (default) | Each column is multiplied by its own hidden factor, and each row by a small hidden variation (±5% by default). Formulas (×, −, +, average, max) and totals rows are recalculated so the twin adds up exactly. Counts stay whole numbers; prices can be rounded to real price points (3.64 → 3.99). | You want the AI to reason about the data |
148
+ | **scale** | Every amount is multiplied by one hidden factor. All ratios stay exact, but one known real figure reveals all the others. | You need exact ratios and the reader knows none of the real figures |
149
+ | **random** | Each number gets independent noise. | Maximum privacy; totals won't add up |
150
+
151
+ Hidden factors stay the same from month to month by default, so trends (+8% vs last month) are still meaningful. You can turn this off.
152
+
153
+ **Row variation** makes it harder to work back from one known figure to the rest of a column. The same row gets the same variation in every column and every month, so ratios inside a row and row-level trends stay true. Rows with nearly equal values may swap order. See the [threat model](https://github.com/Chalkduggo/Twinwise/blob/main/docs/THREAT_MODEL.md).
154
+
155
+ No masked number keeps its real value. Small values are nudged so a "1" never stays "1".
156
+
157
+ ## What it detects
158
+
159
+ - **Names in name columns** (Partner, Vendor, Channel, Title, Region, City, State, System, Person, Email…). The whole value is replaced, consistently across all files.
160
+ - **IDs and codes** (Vendor Number, System ID, Ref Code, Provider Code…). Replaced with a fake that keeps the same shape (`E000105-12` → `B227380-03`).
161
+ - **Names inside text** (titles, notes, addresses, signatures). Capitalised words that aren't ordinary business words are replaced, company suffixes join the name (*Northwind Communications*), and digit runs are replaced. New finds are flagged for review.
162
+ - **Emails and URLs.**
163
+ - **Multi-row headers, key-value blocks** above tables (`Vendor Name: …`), totals rows and calculated columns.
164
+ - **Hidden extras.** Pivot tables, charts, images and logos, hyperlinks, comments, drop-down lists, external links, headers/footers and author properties are removed from the twin, because Excel stores copies of real values in them. Sheet names and the file name are masked too.
165
+
166
+ ## Your library (all local)
167
+
168
+ Everything Twinwise learns lives in `~/.twinwise` (set `TWINWISE_HOME` to change it):
169
+
170
+ ```
171
+ safe_words.txt words you marked as safe
172
+ names.json real name -> fake label
173
+ ids.json real ID -> fake ID
174
+ factors.json hidden factors per column (for month-to-month comparisons)
175
+ templates/ one JSON file per report layout, with your column rules
176
+ history.jsonl a local log of every exported twin
177
+ library.enc replaces names, ids, factors and history when protection is on
178
+ ```
179
+
180
+ By default these are plain text files. **Turn on password protection** (Security page, or `twinwise protect`) and the names, IDs, factors and history are stored encrypted (AES-256-GCM, scrypt) in `library.enc`. Key files can be encrypted the same way at export. There is no password recovery.
181
+
182
+ ## Safety model, and its limits
183
+
184
+ Twinwise does **pseudonymisation**, not anonymisation. A twin is much safer to share than the original, but it is not public data. The full [threat model](https://github.com/Chalkduggo/Twinwise/blob/main/docs/THREAT_MODEL.md) explains what is and isn't protected.
185
+
186
+ Twinwise is built so that mistakes lean towards **over-masking**. Unknown text is masked and shown to you, not kept.
187
+
188
+ Please know what it does **not** guarantee:
189
+
190
+ - The leak test proves that everything Twinwise replaced is gone. It can't prove that text it judged safe isn't sensitive to you. The *Kept text you may want to glance at* list and the red review cells exist for that.
191
+ - Formulas are kept as formulas. Excel recalculates them from the masked inputs, and cached results are not stored.
192
+ - Very small groups (a count of 1 in a small town) can still hint at a real customer. Twinwise warns you about these.
193
+ - `.xls`, PDF and images aren't supported yet.
194
+ - Someone who knows a real figure can estimate others in the same column (to within about ±10% at the default setting). Someone who knows your business can guess who a label is from its size.
195
+ - Charts, pivot tables and images are removed from the twin, not rebuilt.
196
+ - The key file contains the real values. Keep it private and give it a password.
197
+
198
+ ## Privacy
199
+
200
+ - The server listens only on `127.0.0.1` and rejects requests from any other host.
201
+ - There's no telemetry, no analytics and no network calls. Your files never leave your computer.
202
+ - Test and demo data in this repo is fictional.
203
+
204
+ ## Roadmap
205
+
206
+ Free and open source (this repo): everything above.
207
+
208
+ Planned paid add-ons (separate, optional):
209
+
210
+ - Smart Assist (local AI through Ollama to classify unknown text)
211
+ - Ready-made template packs
212
+ - Batch and watched folders
213
+ - Realistic fake company names
214
+ - Advanced re-identification scoring
215
+ - PDF statements
216
+ - Team sharing with approvals and single sign-on
217
+
218
+ ## Building the apps
219
+
220
+ Push a tag like `v0.3.0`. `.github/workflows/release.yml` runs the tests on Windows, macOS and Linux, builds a single-file app on each with PyInstaller, starts it as a smoke test, and attaches all three downloads to the release.
221
+
222
+ ## Development
223
+
224
+ ```bash
225
+ pip install -e ".[dev]"
226
+ pytest
227
+ ```
228
+
229
+ The code is small and readable:
230
+
231
+ | File | What it does |
232
+ |---|---|
233
+ | `analyze.py` | Understands a sheet: header row, column roles, totals, formulas |
234
+ | `textmask.py` | Masks names and codes inside text |
235
+ | `twin.py` | Builds the twin and recalculates numbers |
236
+ | `verify.py` | Leak test and risk warnings |
237
+ | `keyfile.py` | Key file and restore |
238
+ | `rag.py` | AI context data card and RAG chunks |
239
+ | `engine.py` | Jobs, templates, export |
240
+ | `server.py`, `ui/` | Local review screen (no build step) |
241
+
242
+ ## Security
243
+
244
+ Found a security problem? Please report it privately, not in a public issue. See [SECURITY.md](https://github.com/Chalkduggo/Twinwise/blob/main/SECURITY.md).
245
+
246
+ ## License
247
+
248
+ Apache License 2.0. See [LICENSE](https://github.com/Chalkduggo/Twinwise/blob/main/LICENSE).
249
+
250
+ Twinwise is developed and maintained by **LoopWise**, created by **Suman Mondal**.
@@ -0,0 +1,212 @@
1
+ <p align="center"><img src="https://raw.githubusercontent.com/Chalkduggo/Twinwise/main/twinwise/ui/logo.svg" width="64" alt="Twinwise logo"></p>
2
+
3
+ <h1 align="center">Twinwise</h1>
4
+ <p align="center"><b>Make a safe twin of your business spreadsheets before you use AI.</b><br>
5
+ Same layout. Fake names, IDs and numbers. Totals still add up. Runs entirely on your computer.</p>
6
+ <p align="center">
7
+ <a href="https://pypi.org/project/twinwise/"><img src="https://img.shields.io/pypi/v/twinwise?label=PyPI" alt="PyPI version"></a>
8
+ <a href="https://github.com/Chalkduggo/Twinwise/actions/workflows/tests.yml"><img src="https://github.com/Chalkduggo/Twinwise/actions/workflows/tests.yml/badge.svg" alt="Tests"></a>
9
+ <a href="https://scorecard.dev/viewer/?uri=github.com/Chalkduggo/Twinwise"><img src="https://api.scorecard.dev/projects/github.com/Chalkduggo/Twinwise/badge" alt="OpenSSF Scorecard"></a>
10
+ <a href="https://github.com/Chalkduggo/Twinwise/blob/main/LICENSE"><img src="https://img.shields.io/badge/licence-Apache%202.0-blue" alt="Licence: Apache 2.0"></a>
11
+ </p>
12
+
13
+ ![Twinwise review screen](https://raw.githubusercontent.com/Chalkduggo/Twinwise/main/docs/screenshots/02-review.png)
14
+
15
+
16
+ https://github.com/user-attachments/assets/59911a9c-dcbe-4921-84c3-c62e856f076f
17
+
18
+
19
+ <p align="center">🎬 <a href="https://github.com/Chalkduggo/Twinwise/blob/main/docs/Twinwise_User_Guide.mp4"><b>Watch the 98-second user guide</b></a> · 📘 <a href="https://github.com/Chalkduggo/Twinwise/blob/main/docs/USER_GUIDE.md"><b>User guide</b></a> · 📕 <a href="https://github.com/Chalkduggo/Twinwise/blob/main/docs/USER_MANUAL.md"><b>User manual</b></a> · 🛡️ <a href="https://github.com/Chalkduggo/Twinwise/blob/main/docs/THREAT_MODEL.md"><b>Threat model</b></a> · ⬇️ <a href="https://github.com/Chalkduggo/Twinwise/releases/latest"><b>Download for Windows · macOS · Linux</b></a></p>
20
+
21
+ ## The problem
22
+
23
+ Teams want to ask ChatGPT, Claude or Copilot about their partner reports, revenue statements and subscriber files, but they can't upload the real thing. Partner names, deal terms and figures are confidential.
24
+
25
+ Twinwise creates a **data twin**: a copy of the file that looks and behaves like the original, with everything sensitive replaced.
26
+
27
+ | Original | Twin |
28
+ |---|---|
29
+ | `Northwind Cable PPV Activity Report` | `Company 1 PPV Activity Report` |
30
+ | `51001 - PPV for Aldermoor` | `79224 - PPV for Region 1` |
31
+ | `LANTERN FAMILY CHANNEL`, vendor `418207` | `VENDOR 1`, vendor `187512` |
32
+ | 5 buys × 4.99 = 24.95 | 7 buys × 3.99 = 27.93 *(still adds up)* |
33
+ | `royalties@harbormedia.example` | `user1@example.com` |
34
+
35
+ ## How it works
36
+
37
+ 1. **Drop in files.** Excel (`.xlsx`), CSV, or a ZIP of them.
38
+ 2. **Automatic first pass.** Twinwise finds the header row, works out what each column holds (names, IDs, counts, prices, percentages, dates), spots totals rows and formulas such as *Revenue = Buys × Price*, and plans every change.
39
+ 3. **You review.** Colours show the plan. Anything new it isn't sure about is marked in red. Click a cell or a column to change how it's handled.
40
+ 4. **Safety check.** The saved twin is searched for every value that was replaced: cells, sheet names, file name and document properties. Export is blocked if anything is found.
41
+ 5. **Export and use.** You get the twin (safe to share) and a private **key file** (never share it). Paste the AI's answer into *Restore AI answer* to see real names again.
42
+
43
+ Every export also includes **AI-ready context** for chat or RAG pipelines:
44
+
45
+ - `…_CONTEXT.md`: a data card covering what the file is, what each column means, the formulas in plain words (*Revenue = Number of Buys × Sale Price*), totals and summary figures. Paste it into a chat next to the twin, or index it.
46
+ - `…_chunks.jsonl`: ready-made chunks (overview, columns, totals, one per row) with metadata such as file, sheet, row and name labels. Load them straight into LangChain, LlamaIndex, Azure AI Search, pgvector, or anything that takes JSON lines.
47
+
48
+ Both are built from the twin only and pass the same leak test, so nothing real reaches your vector database.
49
+
50
+ Twinwise **learns**. Your decisions are saved as templates and a name library, so next month's file from the same partner is recognised and needs no review.
51
+
52
+ | Review | Safety check | Export |
53
+ |---|---|---|
54
+ | ![](https://raw.githubusercontent.com/Chalkduggo/Twinwise/main/docs/screenshots/04-cell.png) | ![](https://raw.githubusercontent.com/Chalkduggo/Twinwise/main/docs/screenshots/09-verify.png) | ![](https://raw.githubusercontent.com/Chalkduggo/Twinwise/main/docs/screenshots/10-export.png) |
55
+
56
+ ## Install
57
+
58
+ **Download the app** from [Releases](https://github.com/Chalkduggo/Twinwise/releases/latest). No Python needed:
59
+
60
+ | System | File | Start it |
61
+ |---|---|---|
62
+ | Windows 10/11 | `Twinwise-Windows.zip` | Unzip, double-click `Twinwise.exe`. If you see *"Windows protected your PC"*, click **More info → Run anyway**. |
63
+ | macOS (Apple Silicon) | `Twinwise-macOS-AppleSilicon.zip` | Unzip, double-click `Start Twinwise.command`. If macOS blocks it, go to **System Settings → Privacy & Security → Open Anyway**. |
64
+ | Linux (x86-64) | `Twinwise-Linux-x86_64.tar.gz` | `tar -xzf …` then `./Twinwise/start-twinwise.sh` |
65
+
66
+ The apps aren't code-signed yet, which is why the operating system asks once. Intel Macs: use the Python install below.
67
+
68
+ **With Python 3.10 or newer**, install from PyPI:
69
+
70
+ ```bash
71
+ pip install twinwise
72
+ twinwise ui # opens http://127.0.0.1:8765 in your browser
73
+ ```
74
+
75
+ Or from source:
76
+
77
+ ```bash
78
+ git clone https://github.com/Chalkduggo/Twinwise.git
79
+ cd Twinwise
80
+ pip install -e .
81
+ ```
82
+
83
+ **Check your download.** Every release includes `SHA256SUMS.txt`. On Windows run `certutil -hashfile Twinwise-Windows.zip SHA256`, on macOS/Linux `shasum -a 256 <file>`, and compare the result with the line in that file.
84
+
85
+ From source, double-click **`Start-Twinwise.bat`** (Windows) or run **`./start-twinwise.sh`** (macOS/Linux). Either one creates a private Python environment the first time, then opens the app.
86
+
87
+ To try it without your own files:
88
+
89
+ ```bash
90
+ twinwise demo # writes made-up partner reports to ~/Twinwise/demo
91
+ ```
92
+
93
+ ## Command line
94
+
95
+ ```bash
96
+ twinwise twin report.xlsx statements.zip -o out/ # create twins
97
+ twinwise twin data.csv --mode scale # one hidden factor for everything
98
+ twinwise twin report.xlsx --key-password "a long passphrase" # encrypt the key file
99
+ twinwise restore --key out/twin-key_2026-11-09.json answer.txt # AI answer -> real names
100
+ twinwise protect # password-protect your library
101
+ ```
102
+
103
+ Exit code `2` means the safety check found a leak, so you can use it in scripts.
104
+
105
+ ## How numbers change
106
+
107
+ | Mode | What happens | Use when |
108
+ |---|---|---|
109
+ | **consistent** (default) | Each column is multiplied by its own hidden factor, and each row by a small hidden variation (±5% by default). Formulas (×, −, +, average, max) and totals rows are recalculated so the twin adds up exactly. Counts stay whole numbers; prices can be rounded to real price points (3.64 → 3.99). | You want the AI to reason about the data |
110
+ | **scale** | Every amount is multiplied by one hidden factor. All ratios stay exact, but one known real figure reveals all the others. | You need exact ratios and the reader knows none of the real figures |
111
+ | **random** | Each number gets independent noise. | Maximum privacy; totals won't add up |
112
+
113
+ Hidden factors stay the same from month to month by default, so trends (+8% vs last month) are still meaningful. You can turn this off.
114
+
115
+ **Row variation** makes it harder to work back from one known figure to the rest of a column. The same row gets the same variation in every column and every month, so ratios inside a row and row-level trends stay true. Rows with nearly equal values may swap order. See the [threat model](https://github.com/Chalkduggo/Twinwise/blob/main/docs/THREAT_MODEL.md).
116
+
117
+ No masked number keeps its real value. Small values are nudged so a "1" never stays "1".
118
+
119
+ ## What it detects
120
+
121
+ - **Names in name columns** (Partner, Vendor, Channel, Title, Region, City, State, System, Person, Email…). The whole value is replaced, consistently across all files.
122
+ - **IDs and codes** (Vendor Number, System ID, Ref Code, Provider Code…). Replaced with a fake that keeps the same shape (`E000105-12` → `B227380-03`).
123
+ - **Names inside text** (titles, notes, addresses, signatures). Capitalised words that aren't ordinary business words are replaced, company suffixes join the name (*Northwind Communications*), and digit runs are replaced. New finds are flagged for review.
124
+ - **Emails and URLs.**
125
+ - **Multi-row headers, key-value blocks** above tables (`Vendor Name: …`), totals rows and calculated columns.
126
+ - **Hidden extras.** Pivot tables, charts, images and logos, hyperlinks, comments, drop-down lists, external links, headers/footers and author properties are removed from the twin, because Excel stores copies of real values in them. Sheet names and the file name are masked too.
127
+
128
+ ## Your library (all local)
129
+
130
+ Everything Twinwise learns lives in `~/.twinwise` (set `TWINWISE_HOME` to change it):
131
+
132
+ ```
133
+ safe_words.txt words you marked as safe
134
+ names.json real name -> fake label
135
+ ids.json real ID -> fake ID
136
+ factors.json hidden factors per column (for month-to-month comparisons)
137
+ templates/ one JSON file per report layout, with your column rules
138
+ history.jsonl a local log of every exported twin
139
+ library.enc replaces names, ids, factors and history when protection is on
140
+ ```
141
+
142
+ By default these are plain text files. **Turn on password protection** (Security page, or `twinwise protect`) and the names, IDs, factors and history are stored encrypted (AES-256-GCM, scrypt) in `library.enc`. Key files can be encrypted the same way at export. There is no password recovery.
143
+
144
+ ## Safety model, and its limits
145
+
146
+ Twinwise does **pseudonymisation**, not anonymisation. A twin is much safer to share than the original, but it is not public data. The full [threat model](https://github.com/Chalkduggo/Twinwise/blob/main/docs/THREAT_MODEL.md) explains what is and isn't protected.
147
+
148
+ Twinwise is built so that mistakes lean towards **over-masking**. Unknown text is masked and shown to you, not kept.
149
+
150
+ Please know what it does **not** guarantee:
151
+
152
+ - The leak test proves that everything Twinwise replaced is gone. It can't prove that text it judged safe isn't sensitive to you. The *Kept text you may want to glance at* list and the red review cells exist for that.
153
+ - Formulas are kept as formulas. Excel recalculates them from the masked inputs, and cached results are not stored.
154
+ - Very small groups (a count of 1 in a small town) can still hint at a real customer. Twinwise warns you about these.
155
+ - `.xls`, PDF and images aren't supported yet.
156
+ - Someone who knows a real figure can estimate others in the same column (to within about ±10% at the default setting). Someone who knows your business can guess who a label is from its size.
157
+ - Charts, pivot tables and images are removed from the twin, not rebuilt.
158
+ - The key file contains the real values. Keep it private and give it a password.
159
+
160
+ ## Privacy
161
+
162
+ - The server listens only on `127.0.0.1` and rejects requests from any other host.
163
+ - There's no telemetry, no analytics and no network calls. Your files never leave your computer.
164
+ - Test and demo data in this repo is fictional.
165
+
166
+ ## Roadmap
167
+
168
+ Free and open source (this repo): everything above.
169
+
170
+ Planned paid add-ons (separate, optional):
171
+
172
+ - Smart Assist (local AI through Ollama to classify unknown text)
173
+ - Ready-made template packs
174
+ - Batch and watched folders
175
+ - Realistic fake company names
176
+ - Advanced re-identification scoring
177
+ - PDF statements
178
+ - Team sharing with approvals and single sign-on
179
+
180
+ ## Building the apps
181
+
182
+ Push a tag like `v0.3.0`. `.github/workflows/release.yml` runs the tests on Windows, macOS and Linux, builds a single-file app on each with PyInstaller, starts it as a smoke test, and attaches all three downloads to the release.
183
+
184
+ ## Development
185
+
186
+ ```bash
187
+ pip install -e ".[dev]"
188
+ pytest
189
+ ```
190
+
191
+ The code is small and readable:
192
+
193
+ | File | What it does |
194
+ |---|---|
195
+ | `analyze.py` | Understands a sheet: header row, column roles, totals, formulas |
196
+ | `textmask.py` | Masks names and codes inside text |
197
+ | `twin.py` | Builds the twin and recalculates numbers |
198
+ | `verify.py` | Leak test and risk warnings |
199
+ | `keyfile.py` | Key file and restore |
200
+ | `rag.py` | AI context data card and RAG chunks |
201
+ | `engine.py` | Jobs, templates, export |
202
+ | `server.py`, `ui/` | Local review screen (no build step) |
203
+
204
+ ## Security
205
+
206
+ Found a security problem? Please report it privately, not in a public issue. See [SECURITY.md](https://github.com/Chalkduggo/Twinwise/blob/main/SECURITY.md).
207
+
208
+ ## License
209
+
210
+ Apache License 2.0. See [LICENSE](https://github.com/Chalkduggo/Twinwise/blob/main/LICENSE).
211
+
212
+ Twinwise is developed and maintained by **LoopWise**, created by **Suman Mondal**.