matryca-plumber 1.5.1__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 (150) hide show
  1. matryca_plumber-1.5.1/LICENSE +201 -0
  2. matryca_plumber-1.5.1/NOTICE +5 -0
  3. matryca_plumber-1.5.1/PKG-INFO +450 -0
  4. matryca_plumber-1.5.1/README.md +419 -0
  5. matryca_plumber-1.5.1/frontend/node_modules/flatted/python/flatted.py +144 -0
  6. matryca_plumber-1.5.1/matryca_plumber.egg-info/PKG-INFO +450 -0
  7. matryca_plumber-1.5.1/matryca_plumber.egg-info/SOURCES.txt +148 -0
  8. matryca_plumber-1.5.1/matryca_plumber.egg-info/dependency_links.txt +1 -0
  9. matryca_plumber-1.5.1/matryca_plumber.egg-info/entry_points.txt +4 -0
  10. matryca_plumber-1.5.1/matryca_plumber.egg-info/requires.txt +18 -0
  11. matryca_plumber-1.5.1/matryca_plumber.egg-info/top_level.txt +8 -0
  12. matryca_plumber-1.5.1/pyproject.toml +118 -0
  13. matryca_plumber-1.5.1/setup.cfg +4 -0
  14. matryca_plumber-1.5.1/src/__init__.py +1 -0
  15. matryca_plumber-1.5.1/src/agent/__init__.py +1 -0
  16. matryca_plumber-1.5.1/src/agent/alias_state.py +94 -0
  17. matryca_plumber-1.5.1/src/agent/context_compressor.py +269 -0
  18. matryca_plumber-1.5.1/src/agent/git_snapshot.py +118 -0
  19. matryca_plumber-1.5.1/src/agent/graph_dispatch.py +833 -0
  20. matryca_plumber-1.5.1/src/agent/graph_tool_helpers.py +289 -0
  21. matryca_plumber-1.5.1/src/agent/l1_memory.py +163 -0
  22. matryca_plumber-1.5.1/src/agent/llm_context_payload.py +104 -0
  23. matryca_plumber-1.5.1/src/agent/maintenance_daemon.py +3034 -0
  24. matryca_plumber-1.5.1/src/agent/mcp_server.py +322 -0
  25. matryca_plumber-1.5.1/src/agent/mcp_telemetry.py +102 -0
  26. matryca_plumber-1.5.1/src/agent/mcp_tool_guard.py +57 -0
  27. matryca_plumber-1.5.1/src/agent/plumber_config.py +418 -0
  28. matryca_plumber-1.5.1/src/agent/plumber_llm.py +144 -0
  29. matryca_plumber-1.5.1/src/agent/plumber_modules/__init__.py +156 -0
  30. matryca_plumber-1.5.1/src/agent/plumber_modules/_shared.py +136 -0
  31. matryca_plumber-1.5.1/src/agent/plumber_modules/auto_split.py +163 -0
  32. matryca_plumber-1.5.1/src/agent/plumber_modules/backlink_backpropagator.py +260 -0
  33. matryca_plumber-1.5.1/src/agent/plumber_modules/dangling_healer.py +78 -0
  34. matryca_plumber-1.5.1/src/agent/plumber_modules/entity_consolidation.py +99 -0
  35. matryca_plumber-1.5.1/src/agent/plumber_modules/marpa_framework.py +276 -0
  36. matryca_plumber-1.5.1/src/agent/plumber_modules/property_hygiene.py +137 -0
  37. matryca_plumber-1.5.1/src/agent/plumber_modules/semantic_cache_router.py +207 -0
  38. matryca_plumber-1.5.1/src/agent/prompt_constraints.py +35 -0
  39. matryca_plumber-1.5.1/src/agent/prompt_layout.py +23 -0
  40. matryca_plumber-1.5.1/src/agent/quality_gate.py +139 -0
  41. matryca_plumber-1.5.1/src/agent/routing_hint.py +54 -0
  42. matryca_plumber-1.5.1/src/cli/__init__.py +304 -0
  43. matryca_plumber-1.5.1/src/cli/__main__.py +6 -0
  44. matryca_plumber-1.5.1/src/cli/tui_dashboard.py +253 -0
  45. matryca_plumber-1.5.1/src/cli/ui_auth.py +34 -0
  46. matryca_plumber-1.5.1/src/cli/ui_server.py +840 -0
  47. matryca_plumber-1.5.1/src/config.py +99 -0
  48. matryca_plumber-1.5.1/src/graph/__init__.py +7 -0
  49. matryca_plumber-1.5.1/src/graph/advanced_query_block.py +94 -0
  50. matryca_plumber-1.5.1/src/graph/alias_index.py +385 -0
  51. matryca_plumber-1.5.1/src/graph/block_ref_lint.py +132 -0
  52. matryca_plumber-1.5.1/src/graph/bootstrap_harvest.py +359 -0
  53. matryca_plumber-1.5.1/src/graph/dashboard.py +107 -0
  54. matryca_plumber-1.5.1/src/graph/flashcards.py +171 -0
  55. matryca_plumber-1.5.1/src/graph/generational_cache.py +334 -0
  56. matryca_plumber-1.5.1/src/graph/global_fence_scanner.py +129 -0
  57. matryca_plumber-1.5.1/src/graph/graph_analytics.py +317 -0
  58. matryca_plumber-1.5.1/src/graph/graph_path_validate.py +25 -0
  59. matryca_plumber-1.5.1/src/graph/hierarchical_summarization.py +166 -0
  60. matryca_plumber-1.5.1/src/graph/hubs.py +47 -0
  61. matryca_plumber-1.5.1/src/graph/insights_engine.py +420 -0
  62. matryca_plumber-1.5.1/src/graph/io_retry.py +56 -0
  63. matryca_plumber-1.5.1/src/graph/journal_task_scan.py +282 -0
  64. matryca_plumber-1.5.1/src/graph/json_flock.py +44 -0
  65. matryca_plumber-1.5.1/src/graph/link_tag_hop.py +318 -0
  66. matryca_plumber-1.5.1/src/graph/logseq_uuid.py +92 -0
  67. matryca_plumber-1.5.1/src/graph/markdown_blocks.py +408 -0
  68. matryca_plumber-1.5.1/src/graph/master_catalog.py +427 -0
  69. matryca_plumber-1.5.1/src/graph/mldoc_guards.py +62 -0
  70. matryca_plumber-1.5.1/src/graph/mldoc_properties.py +178 -0
  71. matryca_plumber-1.5.1/src/graph/moc_page.py +109 -0
  72. matryca_plumber-1.5.1/src/graph/page_path.py +81 -0
  73. matryca_plumber-1.5.1/src/graph/page_properties.py +218 -0
  74. matryca_plumber-1.5.1/src/graph/page_write_lock.py +182 -0
  75. matryca_plumber-1.5.1/src/graph/path_sandbox.py +134 -0
  76. matryca_plumber-1.5.1/src/graph/property_line_edit.py +677 -0
  77. matryca_plumber-1.5.1/src/graph/reparent_blocks.py +254 -0
  78. matryca_plumber-1.5.1/src/graph/semantic_clustering.py +701 -0
  79. matryca_plumber-1.5.1/src/graph/service_manager.py +261 -0
  80. matryca_plumber-1.5.1/src/graph/split_large_blocks.py +268 -0
  81. matryca_plumber-1.5.1/src/graph/tag_unify.py +321 -0
  82. matryca_plumber-1.5.1/src/graph/templates.py +101 -0
  83. matryca_plumber-1.5.1/src/graph/unlinked_mentions.py +161 -0
  84. matryca_plumber-1.5.1/src/graph/wiki_lint.py +172 -0
  85. matryca_plumber-1.5.1/src/main.py +72 -0
  86. matryca_plumber-1.5.1/src/rag/__init__.py +1 -0
  87. matryca_plumber-1.5.1/src/rag/local_query.py +118 -0
  88. matryca_plumber-1.5.1/src/rag/matryca_hooks.py +355 -0
  89. matryca_plumber-1.5.1/src/utils/__init__.py +1 -0
  90. matryca_plumber-1.5.1/src/utils/console_sanitize.py +21 -0
  91. matryca_plumber-1.5.1/src/utils/json_repair.py +168 -0
  92. matryca_plumber-1.5.1/src/utils/logging_config.py +62 -0
  93. matryca_plumber-1.5.1/src/utils/rotating_file.py +43 -0
  94. matryca_plumber-1.5.1/src/utils/token_logger.py +414 -0
  95. matryca_plumber-1.5.1/src/utils/updater.py +126 -0
  96. matryca_plumber-1.5.1/tests/__init__.py +1 -0
  97. matryca_plumber-1.5.1/tests/conftest.py +15 -0
  98. matryca_plumber-1.5.1/tests/test_advanced_query_block.py +40 -0
  99. matryca_plumber-1.5.1/tests/test_adversarial_security.py +84 -0
  100. matryca_plumber-1.5.1/tests/test_alias_index.py +100 -0
  101. matryca_plumber-1.5.1/tests/test_alias_state.py +71 -0
  102. matryca_plumber-1.5.1/tests/test_backlink_backpropagator.py +100 -0
  103. matryca_plumber-1.5.1/tests/test_block_ref_lint.py +76 -0
  104. matryca_plumber-1.5.1/tests/test_cli.py +266 -0
  105. matryca_plumber-1.5.1/tests/test_config.py +50 -0
  106. matryca_plumber-1.5.1/tests/test_context_compressor.py +292 -0
  107. matryca_plumber-1.5.1/tests/test_dashboard.py +29 -0
  108. matryca_plumber-1.5.1/tests/test_git_snapshot.py +53 -0
  109. matryca_plumber-1.5.1/tests/test_graph_analytics.py +102 -0
  110. matryca_plumber-1.5.1/tests/test_graph_dispatch_search.py +24 -0
  111. matryca_plumber-1.5.1/tests/test_graph_path_hygiene.py +46 -0
  112. matryca_plumber-1.5.1/tests/test_graph_path_validate.py +22 -0
  113. matryca_plumber-1.5.1/tests/test_hardening_final.py +190 -0
  114. matryca_plumber-1.5.1/tests/test_hierarchical_summarization.py +204 -0
  115. matryca_plumber-1.5.1/tests/test_hubs.py +19 -0
  116. matryca_plumber-1.5.1/tests/test_ironclad_phase8.py +224 -0
  117. matryca_plumber-1.5.1/tests/test_journal_task_scan.py +83 -0
  118. matryca_plumber-1.5.1/tests/test_json_repair.py +78 -0
  119. matryca_plumber-1.5.1/tests/test_l1_memory.py +81 -0
  120. matryca_plumber-1.5.1/tests/test_link_tag_hop.py +75 -0
  121. matryca_plumber-1.5.1/tests/test_llm_context_payload.py +101 -0
  122. matryca_plumber-1.5.1/tests/test_local_query.py +46 -0
  123. matryca_plumber-1.5.1/tests/test_logging_config.py +23 -0
  124. matryca_plumber-1.5.1/tests/test_logseq_uuid.py +116 -0
  125. matryca_plumber-1.5.1/tests/test_maintenance_daemon.py +1566 -0
  126. matryca_plumber-1.5.1/tests/test_markdown_blocks_hygiene.py +56 -0
  127. matryca_plumber-1.5.1/tests/test_master_catalog.py +349 -0
  128. matryca_plumber-1.5.1/tests/test_matryca_hooks.py +77 -0
  129. matryca_plumber-1.5.1/tests/test_mcp_server.py +177 -0
  130. matryca_plumber-1.5.1/tests/test_mcp_telemetry.py +83 -0
  131. matryca_plumber-1.5.1/tests/test_mldoc_phase7.py +110 -0
  132. matryca_plumber-1.5.1/tests/test_page_path.py +62 -0
  133. matryca_plumber-1.5.1/tests/test_page_properties.py +135 -0
  134. matryca_plumber-1.5.1/tests/test_phase1_hardening.py +123 -0
  135. matryca_plumber-1.5.1/tests/test_phase3_hardening.py +210 -0
  136. matryca_plumber-1.5.1/tests/test_phase4_remediation.py +173 -0
  137. matryca_plumber-1.5.1/tests/test_phase_5_6_graph_tools.py +135 -0
  138. matryca_plumber-1.5.1/tests/test_plumber_cognitive_modules.py +372 -0
  139. matryca_plumber-1.5.1/tests/test_plumber_config_env_serialization.py +29 -0
  140. matryca_plumber-1.5.1/tests/test_property_line_edit.py +206 -0
  141. matryca_plumber-1.5.1/tests/test_quality_gate.py +59 -0
  142. matryca_plumber-1.5.1/tests/test_routing_hint.py +17 -0
  143. matryca_plumber-1.5.1/tests/test_semantic_clustering.py +199 -0
  144. matryca_plumber-1.5.1/tests/test_service_manager.py +91 -0
  145. matryca_plumber-1.5.1/tests/test_templates.py +26 -0
  146. matryca_plumber-1.5.1/tests/test_token_logger.py +108 -0
  147. matryca_plumber-1.5.1/tests/test_tui_dashboard.py +175 -0
  148. matryca_plumber-1.5.1/tests/test_ui_server.py +666 -0
  149. matryca_plumber-1.5.1/tests/test_updater.py +99 -0
  150. matryca_plumber-1.5.1/tests/test_wiki_lint.py +26 -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
53
+ of 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 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 provide 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 Marco Porcellato & Matryca.ai
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.
@@ -0,0 +1,5 @@
1
+ matryca-logseq-llm-wiki
2
+ Copyright 2026 Marco Porcellato and Matryca.ai
3
+
4
+ This product includes software developed by Marco Porcellato and Matryca.ai.
5
+ The "Matryca logseq llm wiki" and "Logseq Matryca Parser" logic and the atomic-block outliner paradigm are intellectual property linked to the Matryca ecosystem.
@@ -0,0 +1,450 @@
1
+ Metadata-Version: 2.4
2
+ Name: matryca-plumber
3
+ Version: 1.5.1
4
+ Summary: Enterprise-grade, local-first autonomous background AI daemon and headless mutation plane for Logseq OG.
5
+ License: Apache-2.0
6
+ Project-URL: Homepage, https://github.com/MarcoPorcellato/matryca-plumber
7
+ Project-URL: Repository, https://github.com/MarcoPorcellato/matryca-plumber
8
+ Project-URL: Issues, https://github.com/MarcoPorcellato/matryca-plumber/issues
9
+ Requires-Python: >=3.12
10
+ Description-Content-Type: text/markdown
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Requires-Dist: logseq-matryca-parser>=0.3.3
14
+ Requires-Dist: pydantic<3.0.0,>=2.0.0
15
+ Requires-Dist: python-dotenv<2.0.0,>=1.0.0
16
+ Requires-Dist: loguru<1.0.0,>=0.7.0
17
+ Requires-Dist: mcp<2.0.0,>=1.0.0
18
+ Requires-Dist: pyyaml<7.0.0,>=6.0.0
19
+ Requires-Dist: openai<2.0.0,>=1.50.0
20
+ Requires-Dist: instructor<2.0.0,>=1.7.0
21
+ Requires-Dist: rich<14.0.0,>=13.9.0
22
+ Requires-Dist: fastapi<1.0.0,>=0.115.0
23
+ Requires-Dist: uvicorn<1.0.0,>=0.32.0
24
+ Requires-Dist: httpx<1.0.0,>=0.28.0
25
+ Provides-Extra: dev
26
+ Requires-Dist: pytest<10.0.0,>=9.0.3; extra == "dev"
27
+ Requires-Dist: pytest-asyncio<2.0.0,>=1.3.0; extra == "dev"
28
+ Requires-Dist: ruff<1.0.0,>=0.8.0; extra == "dev"
29
+ Requires-Dist: mypy<2.0.0,>=1.13.0; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # Matryca Plumber
33
+
34
+ > **v1.5 โ€” Ironclad Release.** Agentic Knowledge Management for Logseq OG. An **enterprise-grade, local-first background AI daemon** with a real-time **Sovereign UI** control room, a **typed CLI**, and **direct Logseq Markdown AST** mutation (no Logseq HTTP API, no auxiliary database). The default experience is **autonomous**: the daemon and Python workers poll your graph, run structured local-LLM passes, and commit indexes and lint artifacts while you work or sleep. An **optional FastMCP stdio sidecar** exposes the same headless mutation plane to external clients (for example Claude Desktop) โ€” same `graph_dispatch` contract, not a separate data path. Heavily inspired by [Andrej Karpathy's LLM-Wiki vision](https://karpathy.ai/blog). **100% native Logseq AST parity**, optimistic concurrency safety, versioned AI authorship stamping.
35
+
36
+ [![CI](https://github.com/MarcoPorcellato/matryca-plumber/actions/workflows/ci.yml/badge.svg)](https://github.com/MarcoPorcellato/matryca-plumber/actions/workflows/ci.yml)
37
+ [![Tests](https://img.shields.io/badge/tests-417%20passing-brightgreen)](https://github.com/MarcoPorcellato/matryca-plumber/actions/workflows/ci.yml)
38
+ [![Python 3.12+](https://img.shields.io/badge/python-3.12+-3776AB?logo=python&logoColor=white)](https://www.python.org/downloads/)
39
+ [![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)](LICENSE)
40
+
41
+ ![Matryca Plumber โ€” Agentic Knowledge Management for Logseq OG](images/20260519%20Logseq%20Matryca%20LLM%20Wiki%20copertina%20github.jpg)
42
+
43
+ Matryca is a **100% headless, sandboxed** **standalone daemon + CLI** that turns your local Logseq graph into a high token-density agentic workspace โ€” **no network APIs and no Logseq desktop JSON-RPC**. It treats your vault as a **tree of blocks**, not a flat document store. Logseq OG remains optional: humans and the daemon co-edit the **same** `.md` trees on disk.
44
+
45
+ **Matryca Plumber** is not a one-shot script โ€” it is an **enterprise-grade, local-first background AI daemon for Logseq**. It polls your graph on a duty cycle, calls a local LLM (LM Studio), appends semantic indexes, runs optional cognitive lint modules, and logs every token transaction โ€” **while you edit the same `.md` files in Logseq or leave the vault idle**. Optional **MCP-attached** sessions reuse the identical mutation plane for interactive queries; they are **not** required for background operation. Every write path mirrors Logseq's on-disk AST contract: page frontmatter at line 0, block properties contiguous to their parent bullet, namespace filenames encoded exactly like Logseq's Clojure Datalog layer, and **optimistic concurrency control** that aborts stale writes when you type during inference.
46
+
47
+ The **v1.4.0 Headless Revolution** removed HTTP JSON-RPC; **v1.5 Ironclad** adds the production-hardened Plumber plane โ€” the **Sovereign UI** React cockpit (`:8000`) with **Zero-Trust Bearer authentication**, **dynamic Human-vs-AI graph telemetry**, Ermes context compression, `JSON_SCHEMA` grammar sampling, structural quarantine, GraphRAG Louvain clustering, outliner-native MapReduce chunking, the **Context Acceleration Shield** for deterministic KV-cache reuse on giant pages, strict AST serialization parity (`logseq-matryca-parser`), versioned `made-by::` authorship stamping, **first-class Windows daemon support** (no legacy `os.fork()`), and a **417-test** CI bar with zero Ruff/Mypy strict warnings.
48
+
49
+ Built for power-users who run local LLMs on real vaults โ€” including the r/LocalLLaMA crowd โ€” Matryca is **indestructible and secure by default**: loopback-only UI auth, SSRF-hardened LM proxy discovery, path-sandboxed graph I/O, and atomic ledger commits that survive sudden power loss.
50
+
51
+ > **Brand note:** **Matryca Brain** is reserved exclusively for the Nuitka-compiled Pro enterprise ingestion suite. The open-source maintenance daemon, linter, and indexing subsystem is **Matryca Plumber**.
52
+
53
+ ---
54
+
55
+ ## โœจ Core Features
56
+
57
+ * ๐ŸŽ›๏ธ **Sovereign UI Cockpit:** local React dashboard at **`http://127.0.0.1:8000`** with Light/Dark mode, live graph telemetry, token economics, and Trust & Safety toggles โ€” polls daemon state at **1 Hz** without memory leaks. Every REST call requires a **Bearer token** via the `X-Matryca-Token` header (Zero-Trust API โ€” no anonymous cockpit access).
58
+ * ๐Ÿ”‘ **Zero-Trust UI API:** the React SPA and FastAPI backend communicate over a strictly authenticated local API. Tokens come from `MATRYCA_UI_TOKEN` or are auto-generated at runtime via `GET /api/auth/session`; unauthenticated requests receive **401**.
59
+ * ๐ŸชŸ **Windows First-Class Support:** the Plumber daemon runs safely in the background on **Windows, macOS, and Linux** via a cross-platform `subprocess` launcher โ€” no UNIX-only `os.fork()`. Exclusive **`.matryca_plumber_daemon.lock`** prevents dual-daemon race conditions on every platform.
60
+ * ๐Ÿ“ˆ **Dynamic Impact Telemetry:** the dashboard mathematically separates **Organic Human Mind** (your notes) from **Plumber Agent Cognition** (AI enhancements) in real time via live graph scans plus the per-graph incremental ledger.
61
+ * ๐ŸŒŒ **AST Spatial Intelligence:** `logseq-matryca-parser` owns block hierarchy, frontmatter planes, and multiline outliner serialization โ€” strict Logseq Datalog parity.
62
+ * ๐Ÿค– **100% Headless & Local-First:** atomic file I/O on `.md` sources โ€” Logseq desktop optional.
63
+ * ๐Ÿ”ง **Matryca Plumber Daemon:** progressive semantic indexing + safe micro-lint via local LLM (LM Studio).
64
+ * ๐Ÿฉป **X-Ray Token Economy:** UUID aliases (`[0]`, `[1]`) โ€” up to ~35ร— less context noise.
65
+ * ๐Ÿ”’ **Sandboxed Privacy:** path traversal and symlink escape blocked at `path_sandbox.py`; L1 memory reads confined to `$HOME` or system temp; SSRF guards block cloud metadata IPs on LM proxy discovery.
66
+ * ๐Ÿงฑ **Ironclad Stability (v1.5):** **417** passing tests, `fcntl.flock` RMW locks (with graceful cloud-sync degradation opt-in), atomic swaps with parent-directory `fsync`, malformed-`((uuid))` quarantine, and **Windows CRLF (`\r`) immunity** on all fence and property scanners.
67
+ * ๐Ÿ” **Optimistic Concurrency Control:** `st_mtime` snapshot before LLM inference; write aborted if you edited the page in Logseq during those seconds โ€” **no silent data loss**.
68
+ * ๐Ÿ“ **Exact Logseq AST Compliance:** true line-0 page frontmatter, block properties at **+2 indent** before children, namespace encoding, foldable `- ###` headings โ€” the graph re-indexes cleanly; third-party tools break it, Matryca does not.
69
+ * ๐Ÿ—‚๏ธ **Zero-Config Multi-Graph:** point `LOGSEQ_GRAPH_PATH` at any Logseq graph; each graph carries its own hidden **`.matryca_daemon_state.json`** ledger โ€” historical AI telemetry travels with the vault, no central database.
70
+ * ๐Ÿ“Š **Zero-DB Lexical Engine:** in-memory Okapi BM25 + generational cache patching.
71
+ * โšก **Context Acceleration Shield:** deterministic prompt prefix alignment + Phase 1 summary substitution + semantic skeleton compression โ€” obliterates LM Studio prefill latency on 5,000+ block pages while preserving entity topology.
72
+ * ๐Ÿ”Œ **Integrations โ€” optional FastMCP sidecar:** stdio **MCP** server for operators who want to **query or mutate the graph from Claude Desktop** (or any MCP host) against the **same** headless CRUD plane. **Not** required for `matryca plumber start`, the Sovereign UI, or autonomous indexing.
73
+
74
+ ---
75
+
76
+ ## ๐Ÿ›ก๏ธ Trust & Safety UI Drawer
77
+
78
+ The React control room (`matryca plumber status` โ†’ **Settings**) exposes a **Trust & Safety** drawer that maps every cognitive lint toggle to a visible risk tier. Operators opt in deliberately โ€” nothing mutates your prose unless you enable it.
79
+
80
+ | Mode | Risk | What it allows |
81
+ |------|------|----------------|
82
+ | ๐ŸŸข **Safe Mode** | Read-only & metadata | Semantic routing cache, Ermes context compression (memory-only), entity consolidation (`alias::`), property hygiene (`key::` inference), MARPA domain taxonomy โ€” **never edits your bullet text** |
83
+ | ๐ŸŸ  **Augmented Mode** | Side-blocks & new pages | **Heal Dangling Links** (isolated seed pages for broken `[[WikiLinks]]`), **Backpropagate Links** (appends foldable `- ### Matryca Backlink Context` sections on target pages) โ€” your original bullets stay intact |
84
+ | ๐Ÿ”ด **Surgeon Mode** | Inline & structural edits | **Inline Semantic Corrections** (wraps concepts in `[[WikiLinks]]` inside your bullets; stamps `matryca-plumber:: true` for audit โ€” **strictly opt-in**), **Auto-Split Dense Blocks** (extracts oversized subtrees to child pages, replaces them with `- {{embed [[Page]]}}` stubs) |
85
+
86
+ Each toggle writes to `.env` and hot-reloads on the next daemon cycle via `reload_plumber_dotenv()` โ€” no restart required.
87
+
88
+ ### Key differentiators
89
+
90
+ Why Matryca Plumber over generic Markdown LLM tools:
91
+
92
+ - **Optimistic Concurrency Control** โ€” records `st_mtime` before inference, aborts the write if you edited the page in Logseq during those seconds. Combined with `fcntl.flock` RMW locks: **no torn writes, no silent data loss**.
93
+ - **Exact Logseq AST compliance** โ€” page frontmatter at line 0, block properties at +2 indent before children, namespace filenames encoded like Logseq's Datalog layer (`/` โ†’ `___` + percent-encoding). The graph **re-indexes cleanly**; other tools break block identity and spawn ghost pages.
94
+
95
+ ---
96
+
97
+ ## ๐Ÿช  Matryca Plumber: Local Semantic Infrastructure
98
+
99
+ Matryca Plumber is a high-performance, deterministic, asynchronous maintenance engine designed to index, connect, and optimize large local Logseq knowledge graphs (3,000+ pages). Powered by strict phase separation and a zero-token-cost native GraphRAG engine, the system eliminates UI rendering lag and prevents LLM KV-cache saturation on consumer hardware.
100
+
101
+ ### ๐ŸŒŸ Enterprise-Grade Key Capabilities
102
+
103
+ - **High-Velocity Stateless Ingestion (Phase 1):** Parallel initial scan of Markdown files. Computes protected code-block fences to avoid false positives, extracts synthetic summaries via local LLM (Gemma 4), and resets rolling memory between pages โ€” cutting Prompt Prefill latency from ~25 s to under 2 s per file.
104
+ - **Native GraphRAG Engine (Phase 2 Clustering):** Deterministic partitioning of pages into isolated semantic neighborhoods (5โ€“35 pages) via the Louvain modularity algorithm, computed in RAM in under one second using hybrid TF-IDF matrices (with stopword filters) and Jaccard tag similarity.
105
+ - **Context Isolation (Ermes Thermal Shield):** During Phase 2 cognitive analysis, message history is rigorously confined to the single geographic cluster, injecting a central anchor node (*Cluster Hub Anchor*), maximizing coherence and zeroing generative hallucinations.
106
+ - **Context Acceleration Shield (Phase 2 KV-cache hardening):** For pages exceeding `mapreduce_trigger_chars`, Phase 2 cognitive lint substitutes pre-computed Phase 1 hierarchical summaries (or a regex semantic skeleton) instead of raw megabyte-class outliner text. All LLM prompts follow a cache-aligned layout โ€” stable page content first, dynamic task instructions last โ€” so consecutive operations on the same file hit LM Studio / llama.cpp prompt caching and drop sequential prefill to near zero.
107
+ - **Fault Tolerance and Self-Healing:** Universal Unicode resilience (`errors="replace"`), graceful degradation when cloud sync drivers (iCloud, Dropbox) block `flock`, automatic recovery from corrupted state files, and Error Backoff to prevent infinite CPU loops on unchanged corrupted files.
108
+
109
+ **Prerequisites:** LM Studio (or any OpenAI-compatible local server) at `MATRYCA_LM_BASE_URL`, model loaded matching `MATRYCA_LM_MODEL`.
110
+
111
+ ### ๐Ÿš€ Sovereign UI โ€” the local control room
112
+
113
+ Matryca Plumber no longer ships a legacy Rich text-canvas dashboard. **`matryca plumber status`** (alias **`matryca plumber ui`**) is the unified operational entry point: it spins up a lightweight async **FastAPI + Uvicorn** server on **`http://127.0.0.1:8000`** โ€” the **Sovereign UI** โ€” that transparently serves:
114
+
115
+ 1. **Structured REST API** โ€” `/api/state` (daemon checkpoint + live graph analytics), `/api/logs`, `/api/config` (OpenAPI at `/docs`). All endpoints except `/api/auth/session` require the **`X-Matryca-Token`** Bearer header.
116
+ 2. **Compiled React SPA** โ€” Light/Dark themed control room from `frontend/dist/` (`GraphInsightsCard` Human-vs-AI telemetry, cognitive progress, token counters, Trust & Safety drawer, live JSONL console). On first load, the SPA bootstraps its token from **`GET /api/auth/session`** and attaches it to every poll and control action.
117
+
118
+ **Zero-Trust local API:** even though the server binds to loopback (`127.0.0.1`), Matryca treats the cockpit as an untrusted client surface โ€” any other process on your machine cannot drive daemon start/stop or read telemetry without the shared secret. Set **`MATRYCA_UI_TOKEN`** for a fixed operator secret, or let the server generate one per process (returned once via `/api/auth/session`).
119
+
120
+ The daemon continues indexing in the background; the cockpit polls checkpoint state at **1 Hz** via `usePlumberPolling` without blocking inference or leaking memory on long sessions. Build the frontend once, then operate from a single interface:
121
+
122
+ ```bash
123
+ cd frontend && npm install && npm run build # one-time (or after UI changes)
124
+ matryca plumber start # background daemon
125
+ matryca plumber status # opens the control room in your browser
126
+ ```
127
+
128
+ ### ๐Ÿ› ๏ธ Command-Line Interface (CLI)
129
+
130
+ ```bash
131
+ # Start the Plumber daemon in background (overnight production runs)
132
+ matryca plumber start
133
+
134
+ # Start ingestion in foreground (ideal for initial monitoring)
135
+ matryca plumber start --foreground
136
+
137
+ # Open the web control room (FastAPI + React SPA on :8000)
138
+ matryca plumber status
139
+
140
+ # Force synchronized, controlled daemon shutdown (Graceful Evacuation)
141
+ matryca plumber stop
142
+
143
+ # Run an analytical graph X-ray and emit metrics as JSON
144
+ matryca plumber audit
145
+
146
+ # Compute and inspect semantic graph neighborhoods manually
147
+ matryca plumber cluster
148
+ ```
149
+
150
+ Ops log default: `logs/matryca_plumber_ops.log` (override with `MATRYCA_PLUMBER_LOG_PATH`). **Incremental AI ledger + daemon checkpoint:** `.matryca_daemon_state.json` at graph root (tracks `ai_pages_created`, `ai_links_injected`, `ai_blocks_healed`, per-file processing state) with a hot **`.bak`** recovery sibling. Process exclusivity: **`.matryca_plumber_daemon.lock`** (cross-platform) plus `.matryca_plumber_daemon.pid`.
151
+
152
+ ### On-disk index formats
153
+
154
+ **Semantic index** (successful inference):
155
+
156
+ ```markdown
157
+ ### Matryca Semantic Index
158
+ - indexed-at:: 2026-05-21 14:30 UTC
159
+ - summary:: Concise page summary in the document's native language
160
+ - suggested-tags:: #project #idea
161
+ - moc-pointers::
162
+ - [[Maps of Content]]
163
+ - cross-references::
164
+ - related concept (see_also) โ†’ [[Other Page]]
165
+ - semantic-lint-applied::
166
+ - auto_wikilink:aaaaaaaa-โ€ฆ:Linked canonical term
167
+ - semantic-lint-warnings::
168
+ - Possible duplicate (block aaaaaaaaโ€ฆ)
169
+ ```
170
+
171
+ **Structural lint** (malformed `((uuid))` quarantine โ€” daemon skips LLM processing):
172
+
173
+ ```markdown
174
+ ### Matryca Structural Lint
175
+ - malformed-block-refs::
176
+ - ((aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeee))
177
+ - todo:: #todo [[Matryca Broken Reference]] โ€” fix ((uuid)) typos in Logseq
178
+ ```
179
+
180
+ **MARPA validation** (when `MATRYCA_LINT_MARPA_FRAMEWORK=true`):
181
+
182
+ ```markdown
183
+ ### Matryca MARPA Validation
184
+ - assigned-domain:: progetto
185
+ - detected-tags:: #project
186
+ - ssot-warnings::
187
+ - ssot_duplicate:pages/Duplicate.md (prefer ((block-uuid)) transclusion)
188
+ ```
189
+
190
+ ---
191
+
192
+ ## โš™๏ธ Configuration
193
+
194
+ Copy **`.env.example`** โ†’ **`.env`**. The only **required** variable for the daemon, Sovereign UI, CLI, and optional MCP sidecar is:
195
+
196
+ | Variable | Default | Role |
197
+ |----------|---------|------|
198
+ | `LOGSEQ_GRAPH_PATH` | โ€” | **Required.** Absolute graph root (`pages/`, `journals/`) |
199
+
200
+ ### Core graph & mutation plane
201
+
202
+ | Variable | Default | Role |
203
+ |----------|---------|------|
204
+ | `MATRYCA_GIT_SNAPSHOT_ON_WRITE` | `false` | Opt-in `git commit` before selected writes |
205
+ | `MATRYCA_DEBUG` | `false` | Disable MCP-telemetry log privacy masking (stdio sidecar) |
206
+ | `MATRYCA_L1_PATH` | โ€” | Optional L1 session rules (file or directory) |
207
+ | `MATRYCA_WIKI_CONFIG` | `$GRAPH/matryca-wiki.yml` | Wiki orchestration YAML |
208
+
209
+ ### Local LLM (Plumber + Instructor)
210
+
211
+ | Variable | Default | Role |
212
+ |----------|---------|------|
213
+ | `MATRYCA_LM_BASE_URL` | `http://localhost:1234/v1` | LM Studio OpenAI-compatible endpoint |
214
+ | `MATRYCA_LM_MODEL` | `qwen2.5-coder-7b` | Exact loaded model id (must match LM Studio) |
215
+ | `MATRYCA_LM_INSTRUCTOR_MODE` | `JSON_SCHEMA` | Primary grammar-based structured output mode |
216
+ | `MATRYCA_LM_INSTRUCTOR_FALLBACK` | `MD_JSON` | Fallback when schema binding fails |
217
+
218
+ ### Daemon timing & logging
219
+
220
+ | Variable | Default | Role |
221
+ |----------|---------|------|
222
+ | `MATRYCA_PLUMBER_POLL_SECONDS` | `30` | Seconds between graph scan cycles |
223
+ | `MATRYCA_PLUMBER_LOG_PATH` | `logs/matryca_plumber_ops.log` | JSONL ops log path |
224
+
225
+ ### Security & cross-platform hardening (v1.5 Ironclad)
226
+
227
+ | Variable | Default | Role |
228
+ |----------|---------|------|
229
+ | `MATRYCA_UI_TOKEN` | *(auto-generated)* | Shared secret for Sovereign UI โ†” FastAPI auth. Set a custom value for a stable token across restarts; otherwise the server generates one at runtime and exposes it once via **`GET /api/auth/session`**. The React SPA sends it on every request as **`X-Matryca-Token`**. |
230
+ | `MATRYCA_ALLOW_FLOCK_DEGRADATION` | `false` | **At-your-own-risk** flag for vaults on strict cloud-sync drives (iCloud, Dropbox, OneDrive) that block OS-level `flock`. When `true`, Matryca falls back to in-process thread locking only โ€” **weaker cross-process safety**. Leave `false` on local disks; enable only if page locks fail persistently on a synced graph. |
231
+
232
+ ### Thermal pacing (hardware protection)
233
+
234
+ Duty-cycle modulation after each local LLM inference event. Set to **`0`** to disable. Loaded by `load_plumber_lint_config()` in `src/agent/plumber_config.py`:
235
+
236
+ | Variable | Default | Role |
237
+ |----------|---------|------|
238
+ | `MATRYCA_THERMAL_DELAY_BOOTSTRAP` | `2.0` | Cooling pause (seconds) after each Phase 1 bootstrap page summary |
239
+ | `MATRYCA_THERMAL_DELAY_COGNITIVE` | `2.0` | Cooling pause (seconds) after each Phase 2 file iteration (indexing + cognitive lint) |
240
+
241
+ ### Low-Impact Antivirus Mode (Sympathetic Background Scheduling)
242
+
243
+ When enabled (default **`true`**), the detached Plumber daemon sets POSIX **niceness** to **19** at bootstrap โ€” the lowest scheduling tier the kernel allows. The OS CPU scheduler then yields cycles to interactive apps (Logseq, IDE, browser) whenever the user is active, and allocates spare capacity to background indexing during idle gaps. No mouse/window tracking or polling overhead: the kernelโ€™s own scheduler handles the handoff. Set **`MATRYCA_PLUMBER_LOW_PRIORITY_MODE=false`** to run the daemon at normal process priority (useful for dedicated inference workstations).
244
+
245
+ | Variable | Default | Role |
246
+ |----------|---------|------|
247
+ | `MATRYCA_PLUMBER_LOW_PRIORITY_MODE` | `true` | Max niceness (19) for detached daemon โ€” invisible background indexing |
248
+
249
+ ### Context compression (Ermes mode)
250
+
251
+ Loaded by `load_plumber_lint_config()` in `src/agent/plumber_config.py`:
252
+
253
+ | Variable | Default | Role |
254
+ |----------|---------|------|
255
+ | `MATRYCA_PLUMBER_CONTEXT_COMPRESSION` | `false` | Enable rolling history condensation |
256
+ | `MATRYCA_PLUMBER_COMPRESSION_TRIGGER_TOKENS` | `100000` | Token threshold to trigger compression |
257
+ | `MATRYCA_PLUMBER_COMPRESSION_TARGET_TOKENS` | `30000` | Target size after condensation |
258
+
259
+ ### Cognitive lint modules (open-source tier)
260
+
261
+ All default **`false`** unless noted. See `src/agent/plumber_config.py`.
262
+
263
+ | Variable | Default | Role |
264
+ |----------|---------|------|
265
+ | `MATRYCA_LINT_MARPA_FRAMEWORK` | `false` | MARPA domain taxonomy (Mappa/Area/Risorsa/Progetto/Archivio) |
266
+ | `MATRYCA_LINT_HEAL_DANGLING` | `false` | Seed pages for unresolved wikilinks |
267
+ | `MATRYCA_LINT_DANGLING_MAX_WORDS` | `50` | Max words in generated seed definitions |
268
+ | `MATRYCA_LINT_ENTITY_CONSOLIDATION` | `false` | Semantic overlap โ†’ alias properties |
269
+ | `MATRYCA_LINT_SIMILARITY_THRESHOLD` | `0.85` | Overlap score threshold for merge suggestions |
270
+ | `MATRYCA_LINT_AUTO_SPLIT` | `false` | Extract dense subtrees to child pages |
271
+ | `MATRYCA_LINT_SPLIT_BLOCK_THRESHOLD` | `15` | Child count triggering auto-split |
272
+ | `MATRYCA_LINT_PROPERTY_HYGIENE` | `false` | Infer missing tag properties |
273
+ | `MATRYCA_LINT_INFER_MISSING_PROPERTIES` | `true` | Allow LLM property inference when hygiene enabled |
274
+ | `MATRYCA_LINT_PROPERTY_RULES` | `$GRAPH/matryca-plumber-rules.yml` | Optional YAML rules path |
275
+ | `MATRYCA_LINT_BACKPROPAGATE_LINKS` | `false` | Propagate wikilink corrections to backlink pages |
276
+ | `MATRYCA_LINT_SEMANTIC_ROUTING` | `false` | Filesystem-backed LLM inference cache |
277
+
278
+ > **Commercial tier (Matryca Brain โ€” not wired in OSS):** Twin Ingestion and Epistemic Guardian are reserved for the Nuitka-compiled **Matryca Brain** edition. Pavlyshyn bipartite validation is proprietary โ€” not present in open source.
279
+
280
+ ### Claude Desktop (optional MCP host)
281
+
282
+ ```json
283
+ {
284
+ "mcpServers": {
285
+ "matryca-plumber": {
286
+ "command": "uvx",
287
+ "args": ["--from", "matryca-plumber", "matryca-plumber"],
288
+ "env": {
289
+ "LOGSEQ_GRAPH_PATH": "/absolute/path/to/your/Logseq/graph"
290
+ }
291
+ }
292
+ }
293
+ }
294
+ ```
295
+
296
+ Requires [uv](https://docs.astral.sh/uv/) on `PATH`. Restart the MCP host after edits.
297
+
298
+ ---
299
+
300
+ ## ๐Ÿงช Stability Markers
301
+
302
+ * **417 passing tests** (2 skipped), **0 Mypy strict issues**, **0 Ruff warnings**.
303
+ * **Ruff** format + lint clean on `src/` and `tests/`.
304
+ * Enforced on `main` in [`.github/workflows/ci.yml`](.github/workflows/ci.yml) โ€” run locally:
305
+
306
+ ```bash
307
+ make check
308
+ ```
309
+
310
+ ---
311
+
312
+ ## Architecture stack
313
+
314
+ ```mermaid
315
+ flowchart TB
316
+ subgraph host["Host machine"]
317
+ IDE["Sovereign UI browser ยท Logseq OG ยท optional MCP client"]
318
+ end
319
+ subgraph proc["matryca process"]
320
+ PLUMBER["MaintenanceDaemon\nautonomous duty cycle"]
321
+ UI["FastAPI + Uvicorn :8000\nReact SPA + Zero-Trust REST"]
322
+ MCP["FastMCP stdio\noptional sidecar"]
323
+ GD["graph_dispatch.py"]
324
+ PLUMBER --> GD
325
+ MCP --> GD
326
+ UI --> STATE
327
+ end
328
+ subgraph data["Data plane"]
329
+ FS[("LOGSEQ_GRAPH_PATH")]
330
+ LOCK["page_rmw_lock\nfcntl.flock"]
331
+ ATW["atomic_write_bytes"]
332
+ GC["generational_cache\nincremental patch"]
333
+ STATE[".matryca_daemon_state.json\nAI ledger + checkpoint"]
334
+ end
335
+ IDE -->|plumber status + X-Matryca-Token| UI
336
+ IDE <-->|optional| MCP
337
+ PLUMBER --> LOCK
338
+ GD --> LOCK
339
+ LOCK --> ATW
340
+ ATW --> FS
341
+ PLUMBER --> GC
342
+ PLUMBER --> STATE
343
+ ```
344
+
345
+ Deep dive: [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) โ€” RMW locking rationale, Ermes compression, quarantine flow, IP separation.
346
+
347
+ Lifecycle log: [`docs/PROJECT_DIARY.md`](docs/PROJECT_DIARY.md) โ€” Phases 1โ€“8, crushed bottlenecks.
348
+
349
+ ---
350
+
351
+ ## Feature matrix: architectural phases
352
+
353
+ | Phase | Core capabilities |
354
+ |:-----:|-------------------|
355
+ | **1โ€“8** | Headless graph engine (+ optional MCP bridge) โ†’ Ironclad data plane (fences, atomic writes, generational cache) |
356
+ | **9โ€“13** | Trust plane, delivery CI, Fortress sandbox, Headless Revolution, service installer |
357
+ | **14 โ€” Plumber OS** | Local LLM daemon, cognitive lint modules, Ermes compression, Louvain GraphRAG clustering, outliner MapReduce chunking, **Context Acceleration Shield** (prefix-aligned caching + semantic compression), **Sovereign UI** (FastAPI + React cockpit), **dynamic Human-vs-AI graph telemetry**, intra-turn telemetry sync, POSIX atomic checkpoints, **`json_repair.py`**, **`reload_plumber_dotenv()`** hot-reload, **`patch_generational_caches_for_paths`** on Plumber writes |
358
+ | **15 โ€” Ironclad Logseq-Native Shield** | Logseq Datalog parity (namespace encoding, true frontmatter vs block properties, multiline block padding), optimistic concurrency (`st_mtime` guard), versioned **`made-by:: matryca plumber vX.X.X`** authorship stamping, alias-aware case-insensitive resolution, ghost-clone prevention (`logseq/bak/`, `.recycle/` exclusion), code-block immunity, UTF-8 / CRLF I/O hardening, **Trust & Safety** UI drawer |
359
+ | **16 โ€” Enterprise Security & Concurrency** | **Zero-Trust UI API** (`X-Matryca-Token`, `MATRYCA_UI_TOKEN`), cross-platform **`subprocess`** daemon launch (Windows-first), **`.matryca_plumber_daemon.lock`** exclusivity, paranoia-level ledger pipeline (`mkstemp` โ†’ `fsync` โ†’ `os.replace` โ†’ `.bak`), SSRF guards on LM proxy discovery, strict path sandbox + L1 `$HOME` isolation, **`PageLockUnavailableError`** lock-skip protocol, **`MATRYCA_ALLOW_FLOCK_DEGRADATION`**, **417** tests |
360
+
361
+ Full tool matrix (daemon, CLI, and optional MCP): [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) ยง Complete phase evolution history.
362
+
363
+ ---
364
+
365
+ ## Zero-install execution (`uvx`)
366
+
367
+ ```bash
368
+ uvx --from matryca-plumber matryca-plumber
369
+ ```
370
+
371
+ Bleeding edge from `main`:
372
+
373
+ ```bash
374
+ uvx --from git+https://github.com/MarcoPorcellato/matryca-plumber.git matryca-plumber
375
+ ```
376
+
377
+ ### Background OS service (`matryca service`)
378
+
379
+ Install a stable binary first โ€” **not** via ephemeral `uvx` โ€” so LaunchAgent/systemd can wake the **CLI/daemon** on login (same graph plane; MCP remains optional):
380
+
381
+ ```bash
382
+ uv tool install matryca-plumber
383
+ matryca service install
384
+ ```
385
+
386
+ ---
387
+
388
+ ## Safe testing on a copy of your graph
389
+
390
+ Point `LOGSEQ_GRAPH_PATH` at a **dedicated test graph** before enabling Plumber or agent mutators. Optional: `MATRYCA_GIT_SNAPSHOT_ON_WRITE=true` for revertible experiments.
391
+
392
+ <details>
393
+ <summary><b>๐Ÿ› ๏ธ Logseq Sync โ€” clean transplant for test graphs</b></summary>
394
+
395
+ <ol>
396
+ <li>Create an empty folder and add it as a new graph in Logseq.</li>
397
+ <li>Close Logseq; copy only <code>pages/</code>, <code>journals/</code>, <code>assets/</code> from production.</li>
398
+ <li>Reopen and <b>Re-index</b>.</li>
399
+ </ol>
400
+ </details>
401
+
402
+ ---
403
+
404
+ ## Quickstart (clone and develop)
405
+
406
+ **Primary path:** `matryca plumber start` (background daemon) โ†’ `matryca plumber status` (Sovereign UI on `:8000`). The optional **Claude Desktop / MCP** JSON block is for interactive sidecar use only โ€” it does **not** start autonomous indexing.
407
+
408
+ ### Prerequisites
409
+
410
+ - Python **3.12+**
411
+ - **[uv](https://docs.astral.sh/uv/)**
412
+ - **Node.js 20+** (to build the Plumber React cockpit once)
413
+ - Logseq OG graph on disk
414
+ - LM Studio (for Plumber daemon)
415
+
416
+ ### Install
417
+
418
+ ```bash
419
+ git clone https://github.com/MarcoPorcellato/matryca-plumber.git
420
+ cd matryca-plumber
421
+ make install
422
+ cp .env.example .env # edit LOGSEQ_GRAPH_PATH + LM settings
423
+ cd frontend && npm install && npm run build && cd ..
424
+ ```
425
+
426
+ ### Verify
427
+
428
+ ```bash
429
+ make check # Ruff + Mypy strict + 417 tests
430
+ matryca plumber start --foreground # optional smoke test
431
+ matryca plumber status # optional โ€” opens :8000 control room
432
+ ```
433
+
434
+ ---
435
+
436
+ ## Documentation map
437
+
438
+ | Document | Audience |
439
+ |----------|----------|
440
+ | [`SYSTEM_PROMPT.md`](SYSTEM_PROMPT.md) | Agent operators โ€” outline discipline, `made-by::` authorship, OCC, persist-first UUIDs |
441
+ | [`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) | Engineers โ€” data planes, Plumber lifecycle, hardening |
442
+ | [`docs/PROJECT_DIARY.md`](docs/PROJECT_DIARY.md) | Maintainers โ€” phase history, ADRs, bug archaeology |
443
+ | [`CONTRIBUTING.md`](CONTRIBUTING.md) | Contributors โ€” `uv`, `make check` |
444
+ | [`SECURITY.md`](SECURITY.md) | Vulnerability reporting |
445
+
446
+ ---
447
+
448
+ ## License
449
+
450
+ Apache-2.0 โ€” see [LICENSE](LICENSE).