cloakroom 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 (32) hide show
  1. cloakroom-0.1.0/LICENSE +202 -0
  2. cloakroom-0.1.0/NOTICE +15 -0
  3. cloakroom-0.1.0/PKG-INFO +175 -0
  4. cloakroom-0.1.0/README.md +139 -0
  5. cloakroom-0.1.0/pyproject.toml +45 -0
  6. cloakroom-0.1.0/setup.cfg +4 -0
  7. cloakroom-0.1.0/src/cloakroom/__init__.py +6 -0
  8. cloakroom-0.1.0/src/cloakroom/__main__.py +5 -0
  9. cloakroom-0.1.0/src/cloakroom/cli.py +145 -0
  10. cloakroom-0.1.0/src/cloakroom/client.py +60 -0
  11. cloakroom-0.1.0/src/cloakroom/config.py +46 -0
  12. cloakroom-0.1.0/src/cloakroom/crypto.py +74 -0
  13. cloakroom-0.1.0/src/cloakroom/daemon.py +78 -0
  14. cloakroom-0.1.0/src/cloakroom/decode.py +83 -0
  15. cloakroom-0.1.0/src/cloakroom/engine.py +197 -0
  16. cloakroom-0.1.0/src/cloakroom/hook.py +283 -0
  17. cloakroom-0.1.0/src/cloakroom/hookentry.py +63 -0
  18. cloakroom-0.1.0/src/cloakroom/onnx_backend.py +167 -0
  19. cloakroom-0.1.0/src/cloakroom/onnx_export.py +78 -0
  20. cloakroom-0.1.0/src/cloakroom/rules.py +151 -0
  21. cloakroom-0.1.0/src/cloakroom/safe.py +174 -0
  22. cloakroom-0.1.0/src/cloakroom/shell.py +119 -0
  23. cloakroom-0.1.0/src/cloakroom/vault.py +61 -0
  24. cloakroom-0.1.0/src/cloakroom.egg-info/PKG-INFO +175 -0
  25. cloakroom-0.1.0/src/cloakroom.egg-info/SOURCES.txt +30 -0
  26. cloakroom-0.1.0/src/cloakroom.egg-info/dependency_links.txt +1 -0
  27. cloakroom-0.1.0/src/cloakroom.egg-info/entry_points.txt +2 -0
  28. cloakroom-0.1.0/src/cloakroom.egg-info/requires.txt +14 -0
  29. cloakroom-0.1.0/src/cloakroom.egg-info/top_level.txt +1 -0
  30. cloakroom-0.1.0/tests/test_onnx_backend.py +140 -0
  31. cloakroom-0.1.0/tests/test_rules_mode.py +160 -0
  32. cloakroom-0.1.0/tests/test_shell_and_hooks.py +225 -0
@@ -0,0 +1,202 @@
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
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
cloakroom-0.1.0/NOTICE ADDED
@@ -0,0 +1,15 @@
1
+ Cloakroom
2
+ Copyright 2026 The Cloakroom authors
3
+
4
+ Licensed under the Apache License, Version 2.0 (see LICENSE).
5
+
6
+ The hook command that runs unchanged in both bash and PowerShell (plugin/hooks/hooks.json,
7
+ generated by scripts/gen_hooks.py) follows the approach of maisecrets
8
+ (https://github.com/Mcpgate-de/maisecrets), Copyright 2026 Andreas Kruse (Sprinterli),
9
+ Apache License 2.0.
10
+
11
+ Cloakroom downloads and runs the PII-Tracer model (https://huggingface.co/perplexity-ai/PII-Tracer)
12
+ at a pinned revision; the model is not redistributed here and keeps its own license (MIT).
13
+
14
+ The benchmark adapters in bench/adapters/ call other open-source tools that are fetched
15
+ separately by bench/setup_competitors.sh; their code is not included in this repository.
@@ -0,0 +1,175 @@
1
+ Metadata-Version: 2.4
2
+ Name: cloakroom
3
+ Version: 0.1.0
4
+ Summary: Local privacy gate for AI coding agents: secrets and PII are masked before the model sees them, restored only for local tools.
5
+ Author: The Cloakroom authors
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/shanjeevrajendran/cloakroom
8
+ Project-URL: Issues, https://github.com/shanjeevrajendran/cloakroom/issues
9
+ Project-URL: Benchmark, https://github.com/shanjeevrajendran/cloakroom/blob/main/bench/RESULTS.md
10
+ Keywords: privacy,pii,secrets,redaction,claude-code,ai-agents,dlp
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: MacOS
15
+ Classifier: Operating System :: Microsoft :: Windows
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3
18
+ Classifier: Topic :: Security
19
+ Requires-Python: >=3.10
20
+ Description-Content-Type: text/markdown
21
+ License-File: LICENSE
22
+ License-File: NOTICE
23
+ Requires-Dist: cryptography>=42
24
+ Requires-Dist: keyring>=24
25
+ Provides-Extra: model
26
+ Requires-Dist: onnxruntime>=1.20; extra == "model"
27
+ Requires-Dist: tokenizers>=0.20; extra == "model"
28
+ Requires-Dist: numpy; extra == "model"
29
+ Requires-Dist: huggingface_hub; extra == "model"
30
+ Provides-Extra: torch
31
+ Requires-Dist: torch>=2.5; extra == "torch"
32
+ Requires-Dist: transformers>=5.2; extra == "torch"
33
+ Requires-Dist: safetensors; extra == "torch"
34
+ Requires-Dist: huggingface_hub; extra == "torch"
35
+ Dynamic: license-file
36
+
37
+ <div align="center">
38
+
39
+ <img src="assets/hero.svg" alt="Cloakroom, a privacy layer for Claude Code. v0.1 benchmark on five fresh test sets: 0 of 1,005 personal data values leaked, 4 of 334 secrets and IDs leaked, 60 of 200 safe samples masked by mistake." width="880">
40
+
41
+ <p>
42
+ <a href="#get-started">Get started</a> ·
43
+ <a href="#results">Results</a> ·
44
+ <a href="#how-it-works">How it works</a> ·
45
+ <a href="#faq">FAQ</a> ·
46
+ <a href="docs-LIMITS.md">Known limits</a>
47
+ </p>
48
+
49
+ </div>
50
+
51
+ Names, emails, addresses and API keys in the files Claude reads are swapped
52
+ for placeholders before the model sees them. When Claude writes a file, the real values go back in, on your machine.
53
+ Runs on macOS, Windows and Linux.
54
+
55
+ **Status:** v0.1. Tested on macOS and a real Windows machine (Linux in CI). It works; expect rough edges.
56
+
57
+ <div align="center">
58
+ <img src="assets/demo.gif" alt="Claude Code reads a support ticket and .env through Cloakroom: the model sees PII_PERSON_1 and PII_SECRET_1, and reply.md on disk gets the real customer name back" width="820">
59
+ <br><sub>Claude sees <code>PII_PERSON_1</code>. The reply it writes lands on your disk as "Hi Nadia Petrov".</sub>
60
+ </div>
61
+
62
+ ## Why
63
+
64
+ Claude Code reads whatever your task touches: `.env` files, logs, customer exports, support tickets. All of it
65
+ goes to the model. Secret scanners catch keys with a known shape, but a customer's name in a ticket or an address
66
+ in a log looks like ordinary text to a regex.
67
+
68
+ ## What's different
69
+
70
+ - **Catches personal data, not just keys.** A local detection model plus rules. Across five fresh test sets it
71
+ leaked none of 1,005 planted names, emails, phone numbers, addresses and birth dates. The other tools we tested
72
+ let 119 to 992 of them through.
73
+ - **Claude keeps working.** Placeholders stay the same for the whole session, and the real values are put back
74
+ when Claude writes a file or runs a command locally.
75
+ - **Runs on your machine.** Detection, the encrypted vault and the restore are all local. The only network call is
76
+ the one-time model download.
77
+ - **Cross-platform.** One install on all three, with the vault key in each system's own secure store:
78
+ - **macOS:** Keychain. On Apple Silicon the model runs on the built-in GPU, about 20 ms per check.
79
+ - **Windows:** Credential Manager, hooks that run in PowerShell, tested on a real Windows machine.
80
+ - **Linux:** Secret Service, covered by CI on every change.
81
+ - **No GPU needed.** On an Apple M-series CPU a check takes about 60 ms.
82
+ - **Catches encoded dumps.** `base64`, `xxd` and `od` output is decoded and checked too.
83
+ - **Fails closed.** If Cloakroom can't run, prompts are blocked and tool calls denied instead of slipping through.
84
+
85
+ ## How it works
86
+
87
+ ```
88
+ Claude Code reads a file or runs a tool
89
+ │ "Nadia Petrov called about…" sk_live_51Hx9Q…
90
+ ▼
91
+ ┌────────────────────────────────────────────┐
92
+ │ Cloakroom (on your machine) │
93
+ │ rules + local model -> find the values │
94
+ │ encrypted vault -> remember them │
95
+ └────────────────────────────────────────────┘
96
+ │ "PII_PERSON_1 called about…" PII_SECRET_1
97
+ ▼
98
+ the model works with placeholders only
99
+ │ Write reply.md: "Hi PII_PERSON_1,"
100
+ ▼
101
+ Cloakroom puts the real value back, locally
102
+ │
103
+ ▼
104
+ reply.md on your disk: "Hi Nadia Petrov,"
105
+ ```
106
+
107
+ Details: [docs-HOW-IT-WORKS.md](docs-HOW-IT-WORKS.md).
108
+
109
+ ## Get started
110
+
111
+ ```bash
112
+ # 1. Install
113
+ uv tool install "cloakroom[model]" # or: pipx install "cloakroom[model]"
114
+
115
+ # 2. Check this machine: Python, the key store, the model and the service
116
+ cloakroom doctor
117
+ ```
118
+
119
+ ```
120
+ # 3. Add the plugin, inside Claude Code
121
+ /plugin marketplace add shanjeevrajendran/cloakroom
122
+ /plugin install cloakroom@cloakroom
123
+ ```
124
+
125
+ Python 3.10+. GPU and CPU backends, Windows notes and a rules-only mode: [docs-SETUP.md](docs-SETUP.md).
126
+
127
+ ## Results
128
+
129
+ Cloakroom and four other Claude Code redaction tools, default settings, the same synthetic agent traffic,
130
+ offline. Five fresh test sets, written by a different model and each run once before any tuning on it: 1,575
131
+ planted values to catch and 200 safe samples that should be left alone.
132
+
133
+ | Tool | Personal data (1,005) | Keys, passwords, cards, IDs (334) | False alarms (200 safe samples) |
134
+ |---|---|---|---|
135
+ | **Cloakroom** | **0** | **4** | 60 |
136
+ | sensitive-canary (blocks the call instead of masking) | 119 | 40 | 16 |
137
+ | maisecrets | 557 | 97 | 21 |
138
+ | claude-code-redact, PII on | 607 | 101 | 31 |
139
+ | redact-hook | 817-822 | 143-157 | 35-40 |
140
+ | claude-code-redact, secrets only | 992 | 179 | 2 |
141
+
142
+ Some of these tools only aim at secrets, so their personal-data column shows scope as much as quality.
143
+ False alarms are Cloakroom's weak spot: it masked 60 of 200 safe samples, such as historical names, landmark
144
+ addresses and documented test keys. A false alarm costs you a placeholder where Claude needed the real text; a
145
+ miss sends the value to the model. Method and every run:
146
+ [bench/RESULTS.md](bench/RESULTS.md). The maintainers of the compared tools were contacted before publishing.
147
+
148
+ ## FAQ
149
+
150
+ **Does it send my data anywhere?** No. It downloads the detection model once from Hugging Face (a pinned
151
+ version). Everything else runs on 127.0.0.1.
152
+
153
+ **How much slower is Claude?** Each tool call is checked by a small local service: about 20 ms on an Apple GPU,
154
+ 60 ms on an Apple M-series CPU, 400 ms on a 2-core cloud VM. `cloakroom doctor` prints yours.
155
+
156
+ **Will it mask things it shouldn't?** Sometimes, see above. Documented examples (Stripe test cards,
157
+ `example.com`, fictional 555 numbers) are left alone, and you can add your own exceptions to `allow` in
158
+ `~/.cloakroom/config.json`. `cloakroom check FILE` shows what would be masked.
159
+
160
+ **What doesn't it protect?** It stops accidental exposure; it isn't a sandbox. Out of scope: a prompt injection
161
+ set on smuggling data out piece by piece, text you paste into a prompt on purpose (that gets blocked, not
162
+ rewritten), and Claude Code's own local logs. Details: [docs-LIMITS.md](docs-LIMITS.md).
163
+
164
+ **How do I remove it?** See [Uninstall](docs-SETUP.md#uninstall).
165
+
166
+ ## More
167
+
168
+ - [How it works](docs-HOW-IT-WORKS.md): the detectors, the known-safe filter, the vault and the restore
169
+ - [Setup details](docs-SETUP.md) · [Known limits](docs-LIMITS.md) · [Benchmark](bench/RESULTS.md)
170
+
171
+ ## Credits
172
+
173
+ Detection model: [PII-Tracer](https://huggingface.co/perplexity-ai/PII-Tracer). The one-string hook command that
174
+ runs in both bash and PowerShell comes from [maisecrets](https://github.com/Mcpgate-de/maisecrets) (Apache-2.0).
175
+ Licensed Apache-2.0.
@@ -0,0 +1,139 @@
1
+ <div align="center">
2
+
3
+ <img src="assets/hero.svg" alt="Cloakroom, a privacy layer for Claude Code. v0.1 benchmark on five fresh test sets: 0 of 1,005 personal data values leaked, 4 of 334 secrets and IDs leaked, 60 of 200 safe samples masked by mistake." width="880">
4
+
5
+ <p>
6
+ <a href="#get-started">Get started</a> ·
7
+ <a href="#results">Results</a> ·
8
+ <a href="#how-it-works">How it works</a> ·
9
+ <a href="#faq">FAQ</a> ·
10
+ <a href="docs-LIMITS.md">Known limits</a>
11
+ </p>
12
+
13
+ </div>
14
+
15
+ Names, emails, addresses and API keys in the files Claude reads are swapped
16
+ for placeholders before the model sees them. When Claude writes a file, the real values go back in, on your machine.
17
+ Runs on macOS, Windows and Linux.
18
+
19
+ **Status:** v0.1. Tested on macOS and a real Windows machine (Linux in CI). It works; expect rough edges.
20
+
21
+ <div align="center">
22
+ <img src="assets/demo.gif" alt="Claude Code reads a support ticket and .env through Cloakroom: the model sees PII_PERSON_1 and PII_SECRET_1, and reply.md on disk gets the real customer name back" width="820">
23
+ <br><sub>Claude sees <code>PII_PERSON_1</code>. The reply it writes lands on your disk as "Hi Nadia Petrov".</sub>
24
+ </div>
25
+
26
+ ## Why
27
+
28
+ Claude Code reads whatever your task touches: `.env` files, logs, customer exports, support tickets. All of it
29
+ goes to the model. Secret scanners catch keys with a known shape, but a customer's name in a ticket or an address
30
+ in a log looks like ordinary text to a regex.
31
+
32
+ ## What's different
33
+
34
+ - **Catches personal data, not just keys.** A local detection model plus rules. Across five fresh test sets it
35
+ leaked none of 1,005 planted names, emails, phone numbers, addresses and birth dates. The other tools we tested
36
+ let 119 to 992 of them through.
37
+ - **Claude keeps working.** Placeholders stay the same for the whole session, and the real values are put back
38
+ when Claude writes a file or runs a command locally.
39
+ - **Runs on your machine.** Detection, the encrypted vault and the restore are all local. The only network call is
40
+ the one-time model download.
41
+ - **Cross-platform.** One install on all three, with the vault key in each system's own secure store:
42
+ - **macOS:** Keychain. On Apple Silicon the model runs on the built-in GPU, about 20 ms per check.
43
+ - **Windows:** Credential Manager, hooks that run in PowerShell, tested on a real Windows machine.
44
+ - **Linux:** Secret Service, covered by CI on every change.
45
+ - **No GPU needed.** On an Apple M-series CPU a check takes about 60 ms.
46
+ - **Catches encoded dumps.** `base64`, `xxd` and `od` output is decoded and checked too.
47
+ - **Fails closed.** If Cloakroom can't run, prompts are blocked and tool calls denied instead of slipping through.
48
+
49
+ ## How it works
50
+
51
+ ```
52
+ Claude Code reads a file or runs a tool
53
+ │ "Nadia Petrov called about…" sk_live_51Hx9Q…
54
+ ▼
55
+ ┌────────────────────────────────────────────┐
56
+ │ Cloakroom (on your machine) │
57
+ │ rules + local model -> find the values │
58
+ │ encrypted vault -> remember them │
59
+ └────────────────────────────────────────────┘
60
+ │ "PII_PERSON_1 called about…" PII_SECRET_1
61
+ ▼
62
+ the model works with placeholders only
63
+ │ Write reply.md: "Hi PII_PERSON_1,"
64
+ ▼
65
+ Cloakroom puts the real value back, locally
66
+ │
67
+ ▼
68
+ reply.md on your disk: "Hi Nadia Petrov,"
69
+ ```
70
+
71
+ Details: [docs-HOW-IT-WORKS.md](docs-HOW-IT-WORKS.md).
72
+
73
+ ## Get started
74
+
75
+ ```bash
76
+ # 1. Install
77
+ uv tool install "cloakroom[model]" # or: pipx install "cloakroom[model]"
78
+
79
+ # 2. Check this machine: Python, the key store, the model and the service
80
+ cloakroom doctor
81
+ ```
82
+
83
+ ```
84
+ # 3. Add the plugin, inside Claude Code
85
+ /plugin marketplace add shanjeevrajendran/cloakroom
86
+ /plugin install cloakroom@cloakroom
87
+ ```
88
+
89
+ Python 3.10+. GPU and CPU backends, Windows notes and a rules-only mode: [docs-SETUP.md](docs-SETUP.md).
90
+
91
+ ## Results
92
+
93
+ Cloakroom and four other Claude Code redaction tools, default settings, the same synthetic agent traffic,
94
+ offline. Five fresh test sets, written by a different model and each run once before any tuning on it: 1,575
95
+ planted values to catch and 200 safe samples that should be left alone.
96
+
97
+ | Tool | Personal data (1,005) | Keys, passwords, cards, IDs (334) | False alarms (200 safe samples) |
98
+ |---|---|---|---|
99
+ | **Cloakroom** | **0** | **4** | 60 |
100
+ | sensitive-canary (blocks the call instead of masking) | 119 | 40 | 16 |
101
+ | maisecrets | 557 | 97 | 21 |
102
+ | claude-code-redact, PII on | 607 | 101 | 31 |
103
+ | redact-hook | 817-822 | 143-157 | 35-40 |
104
+ | claude-code-redact, secrets only | 992 | 179 | 2 |
105
+
106
+ Some of these tools only aim at secrets, so their personal-data column shows scope as much as quality.
107
+ False alarms are Cloakroom's weak spot: it masked 60 of 200 safe samples, such as historical names, landmark
108
+ addresses and documented test keys. A false alarm costs you a placeholder where Claude needed the real text; a
109
+ miss sends the value to the model. Method and every run:
110
+ [bench/RESULTS.md](bench/RESULTS.md). The maintainers of the compared tools were contacted before publishing.
111
+
112
+ ## FAQ
113
+
114
+ **Does it send my data anywhere?** No. It downloads the detection model once from Hugging Face (a pinned
115
+ version). Everything else runs on 127.0.0.1.
116
+
117
+ **How much slower is Claude?** Each tool call is checked by a small local service: about 20 ms on an Apple GPU,
118
+ 60 ms on an Apple M-series CPU, 400 ms on a 2-core cloud VM. `cloakroom doctor` prints yours.
119
+
120
+ **Will it mask things it shouldn't?** Sometimes, see above. Documented examples (Stripe test cards,
121
+ `example.com`, fictional 555 numbers) are left alone, and you can add your own exceptions to `allow` in
122
+ `~/.cloakroom/config.json`. `cloakroom check FILE` shows what would be masked.
123
+
124
+ **What doesn't it protect?** It stops accidental exposure; it isn't a sandbox. Out of scope: a prompt injection
125
+ set on smuggling data out piece by piece, text you paste into a prompt on purpose (that gets blocked, not
126
+ rewritten), and Claude Code's own local logs. Details: [docs-LIMITS.md](docs-LIMITS.md).
127
+
128
+ **How do I remove it?** See [Uninstall](docs-SETUP.md#uninstall).
129
+
130
+ ## More
131
+
132
+ - [How it works](docs-HOW-IT-WORKS.md): the detectors, the known-safe filter, the vault and the restore
133
+ - [Setup details](docs-SETUP.md) · [Known limits](docs-LIMITS.md) · [Benchmark](bench/RESULTS.md)
134
+
135
+ ## Credits
136
+
137
+ Detection model: [PII-Tracer](https://huggingface.co/perplexity-ai/PII-Tracer). The one-string hook command that
138
+ runs in both bash and PowerShell comes from [maisecrets](https://github.com/Mcpgate-de/maisecrets) (Apache-2.0).
139
+ Licensed Apache-2.0.
@@ -0,0 +1,45 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"] # SPDX license expression + license-files (PEP 639)
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "cloakroom"
7
+ version = "0.1.0"
8
+ description = "Local privacy gate for AI coding agents: secrets and PII are masked before the model sees them, restored only for local tools."
9
+ readme = "README.md"
10
+ license = "Apache-2.0"
11
+ license-files = ["LICENSE", "NOTICE"]
12
+ requires-python = ">=3.10"
13
+ authors = [{name = "The Cloakroom authors"}]
14
+ keywords = ["privacy", "pii", "secrets", "redaction", "claude-code", "ai-agents", "dlp"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Environment :: Console",
18
+ "Intended Audience :: Developers",
19
+ "Operating System :: MacOS",
20
+ "Operating System :: Microsoft :: Windows",
21
+ "Operating System :: POSIX :: Linux",
22
+ "Programming Language :: Python :: 3",
23
+ "Topic :: Security",
24
+ ]
25
+ dependencies = ["cryptography>=42", "keyring>=24"]
26
+
27
+ [project.optional-dependencies]
28
+ # CPU: ONNX Runtime, no PyTorch at runtime (the ONNX file comes from scripts/export_onnx.py)
29
+ model = ["onnxruntime>=1.20", "tokenizers>=0.20", "numpy", "huggingface_hub"]
30
+ # MPS/CUDA, and the one-off ONNX export
31
+ torch = ["torch>=2.5", "transformers>=5.2", "safetensors", "huggingface_hub"]
32
+
33
+ [project.urls]
34
+ Homepage = "https://github.com/shanjeevrajendran/cloakroom"
35
+ Issues = "https://github.com/shanjeevrajendran/cloakroom/issues"
36
+ Benchmark = "https://github.com/shanjeevrajendran/cloakroom/blob/main/bench/RESULTS.md"
37
+
38
+ [project.scripts]
39
+ cloakroom = "cloakroom.cli:main"
40
+
41
+ [tool.setuptools.packages.find]
42
+ where = ["src"]
43
+
44
+ [dependency-groups]
45
+ dev = ["pytest"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,6 @@
1
+ """Cloakroom: agents check their secrets at the door."""
2
+ from .engine import ModelUnavailable, detect, mask
3
+ from .vault import Vault
4
+
5
+ __all__ = ["mask", "detect", "Vault", "ModelUnavailable"]
6
+ __version__ = "0.1.0"
@@ -0,0 +1,5 @@
1
+ import sys
2
+
3
+ from .cli import main
4
+
5
+ sys.exit(main())