compartment 4.1__tar.gz → 4.2__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 (92) hide show
  1. compartment-4.2/LICENSE +201 -0
  2. {compartment-4.1 → compartment-4.2}/PKG-INFO +11 -2
  3. {compartment-4.1 → compartment-4.2}/README.md +5 -0
  4. {compartment-4.1 → compartment-4.2}/pyproject.toml +8 -2
  5. {compartment-4.1 → compartment-4.2}/src/compartment/__init__.py +1 -1
  6. {compartment-4.1 → compartment-4.2}/src/compartment/cli.py +117 -11
  7. compartment-4.2/src/compartment/clients.py +487 -0
  8. {compartment-4.1 → compartment-4.2}/src/compartment.egg-info/PKG-INFO +11 -2
  9. {compartment-4.1 → compartment-4.2}/src/compartment.egg-info/SOURCES.txt +3 -0
  10. {compartment-4.1 → compartment-4.2}/src/compartment.egg-info/requires.txt +1 -1
  11. compartment-4.2/tests/test_clients.py +247 -0
  12. {compartment-4.1 → compartment-4.2}/tests/test_connect_buttons.py +14 -6
  13. {compartment-4.1 → compartment-4.2}/tests/test_offline_selftest_bench.py +10 -1
  14. {compartment-4.1 → compartment-4.2}/setup.cfg +0 -0
  15. {compartment-4.1 → compartment-4.2}/src/compartment/acl.py +0 -0
  16. {compartment-4.1 → compartment-4.2}/src/compartment/agent_skill.py +0 -0
  17. {compartment-4.1 → compartment-4.2}/src/compartment/audit.py +0 -0
  18. {compartment-4.1 → compartment-4.2}/src/compartment/bench.py +0 -0
  19. {compartment-4.1 → compartment-4.2}/src/compartment/claude_desktop.py +0 -0
  20. {compartment-4.1 → compartment-4.2}/src/compartment/claude_hooks.py +0 -0
  21. {compartment-4.1 → compartment-4.2}/src/compartment/claude_memory.py +0 -0
  22. {compartment-4.1 → compartment-4.2}/src/compartment/crypto.py +0 -0
  23. {compartment-4.1 → compartment-4.2}/src/compartment/dash.py +0 -0
  24. {compartment-4.1 → compartment-4.2}/src/compartment/data/agent-skill/SKILL.md +0 -0
  25. {compartment-4.1 → compartment-4.2}/src/compartment/data/app.icns +0 -0
  26. {compartment-4.1 → compartment-4.2}/src/compartment/data/app.png +0 -0
  27. {compartment-4.1 → compartment-4.2}/src/compartment/data/hermes-plugin/__init__.py +0 -0
  28. {compartment-4.1 → compartment-4.2}/src/compartment/data/hermes-plugin/plugin.yaml +0 -0
  29. {compartment-4.1 → compartment-4.2}/src/compartment/data/menubar.png +0 -0
  30. {compartment-4.1 → compartment-4.2}/src/compartment/data/menubar@2x.png +0 -0
  31. {compartment-4.1 → compartment-4.2}/src/compartment/data/starter.mpack +0 -0
  32. {compartment-4.1 → compartment-4.2}/src/compartment/data/tray.ico +0 -0
  33. {compartment-4.1 → compartment-4.2}/src/compartment/embed.py +0 -0
  34. {compartment-4.1 → compartment-4.2}/src/compartment/home.py +0 -0
  35. {compartment-4.1 → compartment-4.2}/src/compartment/longmemeval.py +0 -0
  36. {compartment-4.1 → compartment-4.2}/src/compartment/menubar.py +0 -0
  37. {compartment-4.1 → compartment-4.2}/src/compartment/models/bge-small-en-v1.5-int8/model_quantized.onnx +0 -0
  38. {compartment-4.1 → compartment-4.2}/src/compartment/models/bge-small-en-v1.5-int8/tokenizer.json +0 -0
  39. {compartment-4.1 → compartment-4.2}/src/compartment/offline_guard.py +0 -0
  40. {compartment-4.1 → compartment-4.2}/src/compartment/packs.py +0 -0
  41. {compartment-4.1 → compartment-4.2}/src/compartment/platforms.py +0 -0
  42. {compartment-4.1 → compartment-4.2}/src/compartment/ranking.py +0 -0
  43. {compartment-4.1 → compartment-4.2}/src/compartment/salience.py +0 -0
  44. {compartment-4.1 → compartment-4.2}/src/compartment/selftest.py +0 -0
  45. {compartment-4.1 → compartment-4.2}/src/compartment/server.py +0 -0
  46. {compartment-4.1 → compartment-4.2}/src/compartment/session.py +0 -0
  47. {compartment-4.1 → compartment-4.2}/src/compartment/store.py +0 -0
  48. {compartment-4.1 → compartment-4.2}/src/compartment/systray.py +0 -0
  49. {compartment-4.1 → compartment-4.2}/src/compartment/vault.py +0 -0
  50. {compartment-4.1 → compartment-4.2}/src/compartment/vaultfile.py +0 -0
  51. {compartment-4.1 → compartment-4.2}/src/compartment/vindex.py +0 -0
  52. {compartment-4.1 → compartment-4.2}/src/compartment/wire.py +0 -0
  53. {compartment-4.1 → compartment-4.2}/src/compartment.egg-info/dependency_links.txt +0 -0
  54. {compartment-4.1 → compartment-4.2}/src/compartment.egg-info/entry_points.txt +0 -0
  55. {compartment-4.1 → compartment-4.2}/src/compartment.egg-info/top_level.txt +0 -0
  56. {compartment-4.1 → compartment-4.2}/tests/test_acl_audit_packs.py +0 -0
  57. {compartment-4.1 → compartment-4.2}/tests/test_acl_precedence.py +0 -0
  58. {compartment-4.1 → compartment-4.2}/tests/test_agent_skill.py +0 -0
  59. {compartment-4.1 → compartment-4.2}/tests/test_attempt_pacing.py +0 -0
  60. {compartment-4.1 → compartment-4.2}/tests/test_audit_chain.py +0 -0
  61. {compartment-4.1 → compartment-4.2}/tests/test_autoconnect.py +0 -0
  62. {compartment-4.1 → compartment-4.2}/tests/test_claude_desktop.py +0 -0
  63. {compartment-4.1 → compartment-4.2}/tests/test_claude_hooks_and_integrate.py +0 -0
  64. {compartment-4.1 → compartment-4.2}/tests/test_claude_memory_and_recent.py +0 -0
  65. {compartment-4.1 → compartment-4.2}/tests/test_connect_environment.py +0 -0
  66. {compartment-4.1 → compartment-4.2}/tests/test_crypto.py +0 -0
  67. {compartment-4.1 → compartment-4.2}/tests/test_dash.py +0 -0
  68. {compartment-4.1 → compartment-4.2}/tests/test_instructions.py +0 -0
  69. {compartment-4.1 → compartment-4.2}/tests/test_journal_framing.py +0 -0
  70. {compartment-4.1 → compartment-4.2}/tests/test_linux_panel.py +0 -0
  71. {compartment-4.1 → compartment-4.2}/tests/test_login_item_identity.py +0 -0
  72. {compartment-4.1 → compartment-4.2}/tests/test_long_memory_recall.py +0 -0
  73. {compartment-4.1 → compartment-4.2}/tests/test_macos_bundle.py +0 -0
  74. {compartment-4.1 → compartment-4.2}/tests/test_menubar.py +0 -0
  75. {compartment-4.1 → compartment-4.2}/tests/test_offline_guard_paths.py +0 -0
  76. {compartment-4.1 → compartment-4.2}/tests/test_ondisk_format.py +0 -0
  77. {compartment-4.1 → compartment-4.2}/tests/test_pack_trust.py +0 -0
  78. {compartment-4.1 → compartment-4.2}/tests/test_platforms.py +0 -0
  79. {compartment-4.1 → compartment-4.2}/tests/test_ranking.py +0 -0
  80. {compartment-4.1 → compartment-4.2}/tests/test_relations.py +0 -0
  81. {compartment-4.1 → compartment-4.2}/tests/test_salience.py +0 -0
  82. {compartment-4.1 → compartment-4.2}/tests/test_session_entropy.py +0 -0
  83. {compartment-4.1 → compartment-4.2}/tests/test_session_lock.py +0 -0
  84. {compartment-4.1 → compartment-4.2}/tests/test_single_instance.py +0 -0
  85. {compartment-4.1 → compartment-4.2}/tests/test_starter_data_quality.py +0 -0
  86. {compartment-4.1 → compartment-4.2}/tests/test_starter_packs.py +0 -0
  87. {compartment-4.1 → compartment-4.2}/tests/test_starter_visibility.py +0 -0
  88. {compartment-4.1 → compartment-4.2}/tests/test_status_bar_install.py +0 -0
  89. {compartment-4.1 → compartment-4.2}/tests/test_systray.py +0 -0
  90. {compartment-4.1 → compartment-4.2}/tests/test_tamper.py +0 -0
  91. {compartment-4.1 → compartment-4.2}/tests/test_twofa.py +0 -0
  92. {compartment-4.1 → compartment-4.2}/tests/test_vault_ops.py +0 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Max Freedom Pollard
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -1,7 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: compartment
3
- Version: 4.1
3
+ Version: 4.2
4
4
  Summary: Compartment - high-security, fully offline, encrypted vector memory for AI agents (MCP)
5
+ License: Apache-2.0
5
6
  Project-URL: Homepage, https://github.com/MaxFreedomPollard/Compartment
6
7
  Project-URL: Source, https://github.com/MaxFreedomPollard/Compartment
7
8
  Project-URL: Issues, https://github.com/MaxFreedomPollard/Compartment/issues
@@ -11,6 +12,7 @@ Project-URL: Security, https://github.com/MaxFreedomPollard/Compartment/blob/mai
11
12
  Keywords: mcp,model-context-protocol,memory,agent-memory,vector-database,semantic-search,encryption,offline,local-first,claude,claude-code,privacy,rag
12
13
  Classifier: Development Status :: 4 - Beta
13
14
  Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: Apache Software License
14
16
  Classifier: Environment :: Console
15
17
  Classifier: Environment :: MacOS X
16
18
  Classifier: Operating System :: OS Independent
@@ -27,12 +29,13 @@ Classifier: Topic :: Database :: Database Engines/Servers
27
29
  Classifier: Typing :: Typed
28
30
  Requires-Python: >=3.11
29
31
  Description-Content-Type: text/markdown
32
+ License-File: LICENSE
30
33
  Requires-Dist: pynacl>=1.5
31
34
  Requires-Dist: argon2-cffi>=23.1
32
35
  Requires-Dist: onnxruntime>=1.17
33
36
  Requires-Dist: tokenizers>=0.15
34
37
  Requires-Dist: numpy>=1.26
35
- Requires-Dist: mcp>=1.0
38
+ Requires-Dist: mcp<2,>=1.0
36
39
  Requires-Dist: pyobjc-framework-Cocoa>=10.0; sys_platform == "darwin"
37
40
  Requires-Dist: pystray>=0.19; sys_platform == "win32"
38
41
  Requires-Dist: pillow>=10; sys_platform == "win32"
@@ -43,6 +46,7 @@ Provides-Extra: tray
43
46
  Provides-Extra: dev
44
47
  Requires-Dist: pytest>=8; extra == "dev"
45
48
  Requires-Dist: usearch>=2.9; extra == "dev"
49
+ Dynamic: license-file
46
50
 
47
51
  # Compartment
48
52
 
@@ -512,6 +516,11 @@ backup), then: `openclaw gateway restart` and confirm with
512
516
  pip install compartment && compartment init
513
517
  ```
514
518
 
519
+ `compartment integrate --list` names the thirty MCP clients it knows - Cursor,
520
+ VS Code, Cline, Roo Code, Zed, OpenCode, Codex CLI, Gemini CLI, LM Studio,
521
+ AnythingLLM, BoltAI and the rest - and `compartment integrate --all` writes the
522
+ block below into every one of them that is installed here.
523
+
515
524
  Then add the server to your client's MCP config (stdio transport, no API
516
525
  key, no environment variables):
517
526
 
@@ -466,6 +466,11 @@ backup), then: `openclaw gateway restart` and confirm with
466
466
  pip install compartment && compartment init
467
467
  ```
468
468
 
469
+ `compartment integrate --list` names the thirty MCP clients it knows - Cursor,
470
+ VS Code, Cline, Roo Code, Zed, OpenCode, Codex CLI, Gemini CLI, LM Studio,
471
+ AnythingLLM, BoltAI and the rest - and `compartment integrate --all` writes the
472
+ block below into every one of them that is installed here.
473
+
469
474
  Then add the server to your client's MCP config (stdio transport, no API
470
475
  key, no environment variables):
471
476
 
@@ -4,9 +4,10 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "compartment"
7
- version = "4.1"
7
+ version = "4.2"
8
8
  description = "Compartment - high-security, fully offline, encrypted vector memory for AI agents (MCP)"
9
9
  readme = "README.md"
10
+ license = { text = "Apache-2.0" }
10
11
  requires-python = ">=3.11"
11
12
  keywords = ["mcp", "model-context-protocol", "memory", "agent-memory",
12
13
  "vector-database", "semantic-search", "encryption", "offline",
@@ -14,6 +15,7 @@ keywords = ["mcp", "model-context-protocol", "memory", "agent-memory",
14
15
  classifiers = [
15
16
  "Development Status :: 4 - Beta",
16
17
  "Intended Audience :: Developers",
18
+ "License :: OSI Approved :: Apache Software License",
17
19
  "Environment :: Console",
18
20
  "Environment :: MacOS X",
19
21
  "Operating System :: OS Independent",
@@ -35,7 +37,11 @@ dependencies = [
35
37
  "onnxruntime>=1.17",
36
38
  "tokenizers>=0.15",
37
39
  "numpy>=1.26",
38
- "mcp>=1.0",
40
+ # Ceiling, not caution. mcp 2.0 (2026-07-28) removed mcp.server.fastmcp,
41
+ # which server.py imports, so an unbounded `mcp>=1.0` resolves to a
42
+ # release where `compartment serve` raises at import and the MCP server
43
+ # never starts. Lifting this means porting to mcp.server.mcpserver first.
44
+ "mcp>=1.0,<2",
39
45
  # The app ships with every install. It is not an add-on: unlocking,
40
46
  # locking and changing the passphrase are things people do through a
41
47
  # panel, not through a terminal, so an install that only lays down a CLI
@@ -1,6 +1,6 @@
1
1
  """Compartment - high-security, fully offline, encrypted vector memory for AI agents."""
2
2
 
3
- __version__ = "4.1"
3
+ __version__ = "4.2"
4
4
 
5
5
  from . import offline_guard as _og
6
6
 
@@ -19,7 +19,8 @@ import zipfile
19
19
  from pathlib import Path
20
20
 
21
21
  from . import (__version__, agent_skill, audit, claude_desktop, claude_hooks,
22
- claude_memory, offline_guard, packs, selftest, session)
22
+ claude_memory, clients, offline_guard, packs, selftest,
23
+ session)
23
24
  from .acl import VaultConfig
24
25
  from .crypto import CryptoError
25
26
  from .embed import DEFAULT_MODEL, OPTIONAL_MODELS, Embedder, user_model_dir
@@ -1189,15 +1190,107 @@ def _install_agent_skill(target: str) -> None:
1189
1190
  "conversation into the vault.")
1190
1191
 
1191
1192
 
1193
+ #: The three that get the full treatment - an MCP registration, the
1194
+ #: /compartmentalize skill in their own skills directory, and for Claude the
1195
+ #: capture hook and the file-memory import. Everything in `clients.CLIENTS`
1196
+ #: gets the MCP registration, which is the part that makes memory work.
1197
+ DEEP_TARGETS = ("claude", "hermes", "openclaw")
1198
+
1199
+
1192
1200
  def cmd_integrate(args) -> None:
1193
- """One-command wiring into an agent ecosystem (claude/hermes/openclaw)."""
1194
- try:
1195
- _integrate_target(args)
1196
- finally:
1197
- # Written whichever way the wiring above went, including the paths
1198
- # that return early. The skill is a file in the agent's own skills
1199
- # directory; it does not depend on the MCP registration landing.
1200
- _install_agent_skill(args.target)
1201
+ """One-command wiring into an agent ecosystem."""
1202
+ if getattr(args, "list", False):
1203
+ _integrate_list(args)
1204
+ return
1205
+ if getattr(args, "all", False):
1206
+ _integrate_all(args)
1207
+ return
1208
+ if not args.target:
1209
+ print("name an agent, or use --list to see every one this knows and "
1210
+ "--all to wire every one that is installed.")
1211
+ return
1212
+
1213
+ if args.target in DEEP_TARGETS:
1214
+ try:
1215
+ _integrate_target(args)
1216
+ finally:
1217
+ # Written whichever way the wiring above went, including the paths
1218
+ # that return early. The skill is a file in the agent's own skills
1219
+ # directory; it does not depend on the MCP registration landing.
1220
+ _install_agent_skill(args.target)
1221
+ return
1222
+
1223
+ client = clients.resolve(args.target)
1224
+ if client is None:
1225
+ known = ", ".join(sorted(set(DEEP_TARGETS) | set(clients.CLIENTS)))
1226
+ print(f"unknown agent {args.target!r}. Known: {known}")
1227
+ return
1228
+ _integrate_client(client, args)
1229
+
1230
+
1231
+ def _integrate_list(args) -> None:
1232
+ """Every client this knows, and where each one stands on this machine."""
1233
+ rows = clients.status()
1234
+ here = [r for r in rows if r["present"]]
1235
+ width = max(len(r["display"]) for r in rows)
1236
+ print(f"{len(rows)} clients known, {len(here)} installed here\n")
1237
+ for r in rows:
1238
+ if r["registered"]:
1239
+ mark, state = "✓", "connected"
1240
+ elif r["present"]:
1241
+ mark, state = "•", "installed, not connected"
1242
+ else:
1243
+ mark, state = " ", "not found"
1244
+ manual = "" if r["writes"] else " (paste, not written)"
1245
+ print(f" {mark} {r['display']:<{width}} {state}{manual}")
1246
+ if r["present"]:
1247
+ print(f" {' ' * width} {r['config']}")
1248
+ print(f"\nwire one: compartment integrate <name>"
1249
+ f"\nwire all: compartment integrate --all")
1250
+
1251
+
1252
+ def _integrate_all(args) -> None:
1253
+ """Wire every client that is actually on this machine.
1254
+
1255
+ Deliberately only the ones found: writing configuration for programs
1256
+ nobody has installed leaves litter and connects nothing.
1257
+ """
1258
+ found = clients.detected()
1259
+ if not found:
1260
+ print("no MCP clients found on this machine.")
1261
+ return
1262
+ print(f"{len(found)} client(s) found\n")
1263
+ for c in found:
1264
+ _integrate_client(c, args, brief=True)
1265
+ print("\nrestart any client that was running to pick it up.")
1266
+
1267
+
1268
+ def _integrate_client(client, args, brief: bool = False) -> None:
1269
+ """Register compartment with one MCP client, or say why not."""
1270
+ if getattr(args, "remove", False):
1271
+ gone = clients.unregister(client)
1272
+ print(f"{'removed from' if gone else 'was not in'} "
1273
+ f"{client.display} ({client.config_path()})")
1274
+ return
1275
+
1276
+ res = clients.register(client, args.vault)
1277
+ if res["written"]:
1278
+ print(f"✓ {client.display} → {res['config']}"
1279
+ + (f" (backup: {Path(res['backup']).name})"
1280
+ if res["backup"] else ""))
1281
+ if res["note"]:
1282
+ print(f" {res['note']}")
1283
+ else:
1284
+ print(f"• {client.display}: {res['reason']}")
1285
+ if res["note"]:
1286
+ print(f" {res['note']}")
1287
+ print(f" {res['config']}")
1288
+ for line in (res["snippet"] or "").splitlines():
1289
+ print(f" {line}")
1290
+
1291
+ if not brief and not os.path.exists(args.vault):
1292
+ print(f"\n! no vault at {args.vault} - run `compartment init` to "
1293
+ "create one")
1201
1294
 
1202
1295
 
1203
1296
  def _integrate_target(args) -> None:
@@ -1739,8 +1832,21 @@ def main(argv: list[str] | None = None) -> None:
1739
1832
  p.set_defaults(fn=cmd_uninstall)
1740
1833
 
1741
1834
  p = sub.add_parser("integrate",
1742
- help="one-command wiring into claude, hermes, or openclaw")
1743
- p.add_argument("target", choices=["claude", "hermes", "openclaw"])
1835
+ help="one-command wiring into any MCP client "
1836
+ "(--list to see them all)")
1837
+ # choices still does the rejecting, so a typo is an error rather than a
1838
+ # config written for a client that does not exist. metavar keeps the
1839
+ # usage line to one word now that the list is thirty long; argparse still
1840
+ # names every accepted spelling when it turns one down.
1841
+ p.add_argument("target", nargs="?", default=None, metavar="AGENT",
1842
+ choices=sorted(set(DEEP_TARGETS) | set(clients.ALIASES)),
1843
+ help="claude, hermes, openclaw, or any client from --list")
1844
+ p.add_argument("--list", action="store_true",
1845
+ help="every client this knows, and whether it is here")
1846
+ p.add_argument("--all", action="store_true",
1847
+ help="wire every client found on this machine")
1848
+ p.add_argument("--remove", action="store_true",
1849
+ help="take compartment back out of that client")
1744
1850
  p.add_argument("--no-import", action="store_true",
1745
1851
  help="do not import existing Claude Code file memories")
1746
1852
  p.add_argument("--no-hooks", action="store_true",