mindslice 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.
- mindslice-0.1.0/LICENSE +202 -0
- mindslice-0.1.0/NOTICE +22 -0
- mindslice-0.1.0/PKG-INFO +98 -0
- mindslice-0.1.0/README.md +77 -0
- mindslice-0.1.0/mindslice/__init__.py +58 -0
- mindslice-0.1.0/mindslice/__main__.py +5 -0
- mindslice-0.1.0/mindslice/baking/__init__.py +1 -0
- mindslice-0.1.0/mindslice/baking/archive.py +66 -0
- mindslice-0.1.0/mindslice/baking/bake.py +299 -0
- mindslice-0.1.0/mindslice/baking/bake_batch.py +537 -0
- mindslice-0.1.0/mindslice/baking/slice_transfer.py +265 -0
- mindslice-0.1.0/mindslice/errors.py +104 -0
- mindslice-0.1.0/mindslice/interfaces/__init__.py +1 -0
- mindslice-0.1.0/mindslice/interfaces/bake_review.py +230 -0
- mindslice-0.1.0/mindslice/interfaces/cli.py +392 -0
- mindslice-0.1.0/mindslice/interfaces/cli_addressing.py +52 -0
- mindslice-0.1.0/mindslice/interfaces/doctor.py +184 -0
- mindslice-0.1.0/mindslice/interfaces/mcp_server.py +536 -0
- mindslice-0.1.0/mindslice/interfaces/render.py +346 -0
- mindslice-0.1.0/mindslice/interfaces/staging_review.py +92 -0
- mindslice-0.1.0/mindslice/model/__init__.py +1 -0
- mindslice-0.1.0/mindslice/model/addressing.py +251 -0
- mindslice-0.1.0/mindslice/model/card.py +641 -0
- mindslice-0.1.0/mindslice/model/lineage.py +228 -0
- mindslice-0.1.0/mindslice/model/text.py +19 -0
- mindslice-0.1.0/mindslice/model/tomlfmt.py +129 -0
- mindslice-0.1.0/mindslice/operations/__init__.py +1 -0
- mindslice-0.1.0/mindslice/operations/audit.py +195 -0
- mindslice-0.1.0/mindslice/operations/boot.py +183 -0
- mindslice-0.1.0/mindslice/operations/impact.py +98 -0
- mindslice-0.1.0/mindslice/operations/recovery.py +113 -0
- mindslice-0.1.0/mindslice/operations/staging.py +641 -0
- mindslice-0.1.0/mindslice/operations/status.py +137 -0
- mindslice-0.1.0/mindslice/operations/validation.py +250 -0
- mindslice-0.1.0/mindslice/operations/writer.py +481 -0
- mindslice-0.1.0/mindslice/retrieval/__init__.py +1 -0
- mindslice-0.1.0/mindslice/retrieval/index.py +634 -0
- mindslice-0.1.0/mindslice/retrieval/lexical.py +215 -0
- mindslice-0.1.0/mindslice/retrieval/query.py +593 -0
- mindslice-0.1.0/mindslice/storage/__init__.py +1 -0
- mindslice-0.1.0/mindslice/storage/card_io.py +14 -0
- mindslice-0.1.0/mindslice/storage/config.py +192 -0
- mindslice-0.1.0/mindslice/storage/fsutil.py +141 -0
- mindslice-0.1.0/mindslice/storage/history.py +182 -0
- mindslice-0.1.0/mindslice/storage/locking.py +125 -0
- mindslice-0.1.0/mindslice/storage/snapshots.py +262 -0
- mindslice-0.1.0/mindslice/workspace.py +385 -0
- mindslice-0.1.0/mindslice.egg-info/PKG-INFO +98 -0
- mindslice-0.1.0/mindslice.egg-info/SOURCES.txt +77 -0
- mindslice-0.1.0/mindslice.egg-info/dependency_links.txt +1 -0
- mindslice-0.1.0/mindslice.egg-info/entry_points.txt +2 -0
- mindslice-0.1.0/mindslice.egg-info/top_level.txt +1 -0
- mindslice-0.1.0/pyproject.toml +34 -0
- mindslice-0.1.0/setup.cfg +4 -0
- mindslice-0.1.0/tests/test_agent_eval.py +613 -0
- mindslice-0.1.0/tests/test_always_loaded.py +268 -0
- mindslice-0.1.0/tests/test_audit.py +115 -0
- mindslice-0.1.0/tests/test_bake.py +365 -0
- mindslice-0.1.0/tests/test_bake_batch.py +555 -0
- mindslice-0.1.0/tests/test_cli_workflow.py +256 -0
- mindslice-0.1.0/tests/test_doctor.py +171 -0
- mindslice-0.1.0/tests/test_external_eval.py +404 -0
- mindslice-0.1.0/tests/test_formats.py +209 -0
- mindslice-0.1.0/tests/test_history.py +301 -0
- mindslice-0.1.0/tests/test_interfaces.py +411 -0
- mindslice-0.1.0/tests/test_lexical.py +149 -0
- mindslice-0.1.0/tests/test_lifecycle.py +253 -0
- mindslice-0.1.0/tests/test_mounted_edit.py +106 -0
- mindslice-0.1.0/tests/test_provenance.py +33 -0
- mindslice-0.1.0/tests/test_reader_eval.py +111 -0
- mindslice-0.1.0/tests/test_reader_qa.py +154 -0
- mindslice-0.1.0/tests/test_recovery.py +372 -0
- mindslice-0.1.0/tests/test_retrieval_eval.py +100 -0
- mindslice-0.1.0/tests/test_scenarios.py +545 -0
- mindslice-0.1.0/tests/test_search_chinese.py +183 -0
- mindslice-0.1.0/tests/test_search_english.py +127 -0
- mindslice-0.1.0/tests/test_search_feedback.py +75 -0
- mindslice-0.1.0/tests/test_selective_review.py +255 -0
- mindslice-0.1.0/tests/test_workspace.py +719 -0
mindslice-0.1.0/LICENSE
ADDED
|
@@ -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.
|
mindslice-0.1.0/NOTICE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MindSlice
|
|
2
|
+
Copyright 2026 pancerZH and the MindSlice contributors
|
|
3
|
+
|
|
4
|
+
Licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
5
|
+
|
|
6
|
+
Third-party material
|
|
7
|
+
--------------------
|
|
8
|
+
|
|
9
|
+
The evaluation records under evals/ quote short excerpts from published
|
|
10
|
+
benchmark datasets, and text that evaluated agents wrote from them: example
|
|
11
|
+
questions in evals/external/results/summary.md, and card lines and values in
|
|
12
|
+
the reports and audit worksheets under evals/agent/results/. That material is
|
|
13
|
+
not covered by the Apache License. It remains under the licence of the dataset
|
|
14
|
+
it comes from:
|
|
15
|
+
|
|
16
|
+
MEME CC BY 4.0 https://huggingface.co/datasets/meme-benchmark/MEME
|
|
17
|
+
LoCoMo CC BY-NC 4.0 https://github.com/snap-research/locomo
|
|
18
|
+
LongMemEval MIT https://huggingface.co/datasets/xiaowu0162/longmemeval-cleaned
|
|
19
|
+
MemoryAgentBench MIT https://huggingface.co/datasets/ai-hyz/MemoryAgentBench
|
|
20
|
+
|
|
21
|
+
The datasets themselves are not redistributed. evals/external/sources.py pins
|
|
22
|
+
the revision, digest and licence of each file the evaluations download.
|
mindslice-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mindslice
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Layered, pluggable, human-readable long-term memory engine for LLM agents (Python stdlib only).
|
|
5
|
+
Author: pancerZH
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/pancerZH/MindSlice
|
|
8
|
+
Project-URL: Documentation, https://github.com/pancerZH/MindSlice/blob/main/docs/getting-started.md
|
|
9
|
+
Project-URL: Issues, https://github.com/pancerZH/MindSlice/issues
|
|
10
|
+
Keywords: llm,agents,memory,markdown,mcp
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
16
|
+
Requires-Python: >=3.12
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
License-File: NOTICE
|
|
20
|
+
Dynamic: license-file
|
|
21
|
+
|
|
22
|
+
# MindSlice
|
|
23
|
+
|
|
24
|
+
**Portable memory for AI agents, with isolation and evolution built in.**
|
|
25
|
+
|
|
26
|
+
Keep project knowledge, personal preferences and shared handbooks in plain Markdown.
|
|
27
|
+
Mount what an agent needs, let it learn in its own workspace, and bake those learnings
|
|
28
|
+
into reusable versions. Connect through MCP, the CLI or Python.
|
|
29
|
+
|
|
30
|
+

|
|
31
|
+
|
|
32
|
+
## Why MindSlice?
|
|
33
|
+
|
|
34
|
+
**Isolation.** A *slice* is a folder of Markdown cards you can mount, unmount and share
|
|
35
|
+
independently. Mounted slices stay read-only through the engine; new learning goes into
|
|
36
|
+
a separate overlay. Multiple workspaces can reuse the same baseline while keeping their
|
|
37
|
+
own changes. Pending edits stay outside live memory until approved.
|
|
38
|
+
|
|
39
|
+
**Evolving memory.** Cards can explicitly extend or supersede earlier knowledge, so
|
|
40
|
+
retrieval follows recorded relationships under your trust rules. `bake` turns selected
|
|
41
|
+
changes into new slice versions, preserving the original folders and returning the new paths.
|
|
42
|
+
|
|
43
|
+
[Hot/cold memory](https://docs.letta.com/v1-sdk/memory/context-hierarchy) focuses on what stays
|
|
44
|
+
in context and what is retrieved later. [LLM Wiki](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f)
|
|
45
|
+
focuses on compiling sources into a maintained knowledge base. MindSlice makes **memory
|
|
46
|
+
boundaries and controlled evolution** first-class engine operations.
|
|
47
|
+
[How these approaches fit together →](docs/concepts.md)
|
|
48
|
+
|
|
49
|
+
Python 3.12+. No runtime dependencies, database server or LLM API calls inside the engine.
|
|
50
|
+
|
|
51
|
+
## Get started
|
|
52
|
+
|
|
53
|
+
Paste this into your coding agent:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
Clone https://github.com/pancerZH/MindSlice.git (or use the existing checkout).
|
|
57
|
+
Read skills/mindslice-setup/SKILL.md to finish setup.
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The agent helps you choose a workspace, connect your app, and choose how to start:
|
|
61
|
+
|
|
62
|
+
| Starting point | Tool |
|
|
63
|
+
| --- | --- |
|
|
64
|
+
| Empty memory or a short conversation | MindSlice `init` and ordinary memory writes |
|
|
65
|
+
| Existing MindSlice workspace | Connect it directly with `-w` |
|
|
66
|
+
| Shared `.slice` or Markdown notes folder | MindSlice `mount`, indexed as is |
|
|
67
|
+
| Documents to distill into structured cards | [MindSlice-forge](https://github.com/pancerZH/MindSlice-forge) |
|
|
68
|
+
|
|
69
|
+
Forge is an optional document-conversion tool. It creates a new workspace using an agent harness;
|
|
70
|
+
MindSlice handles storage, retrieval, mounting and memory evolution without needing Forge or an LLM.
|
|
71
|
+
The [builder skill](skills/slice-builder/SKILL.md) guides conversion and integration with an existing workspace.
|
|
72
|
+
|
|
73
|
+
Prefer manual setup? With Python 3.12+ and pipx installed:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
git clone https://github.com/pancerZH/MindSlice.git
|
|
77
|
+
cd MindSlice
|
|
78
|
+
pipx install -e .
|
|
79
|
+
mindslice init ~/mindslice
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Then [connect your agent](docs/getting-started.md#connect-your-agent) and tell it what to remember.
|
|
83
|
+
Run `mindslice -w ~/mindslice doctor`, then [verify a new session](docs/getting-started.md#verify-your-first-session).
|
|
84
|
+
[Full setup guide](docs/getting-started.md) · [Review changes and bake slices](docs/workflow.md)
|
|
85
|
+
|
|
86
|
+
## Documentation
|
|
87
|
+
|
|
88
|
+
- [Concepts](docs/concepts.md) — isolation, evolution, and how MindSlice fits other memory architectures.
|
|
89
|
+
- [Reference](docs/reference.md) — commands, Python API, MCP tools and card formats.
|
|
90
|
+
- [History and recovery](docs/history-and-recovery.md) — explain memory, roll back slices, back up and restore workspaces.
|
|
91
|
+
- [Build slices with Forge](skills/slice-builder/SKILL.md) — convert documents and connect the resulting workspace or slices.
|
|
92
|
+
- [Maintain memory](skills/slice-maintainer/SKILL.md) — consolidate knowledge and repair relationships.
|
|
93
|
+
- [Evaluations](docs/evaluations.md) · [Design](docs/design.md) · [Uninstall](skills/mindslice-setup/uninstall.md)
|
|
94
|
+
|
|
95
|
+
## License
|
|
96
|
+
|
|
97
|
+
[Apache License 2.0](LICENSE). Benchmark excerpts quoted in the evaluation records keep their
|
|
98
|
+
datasets' licences; see [NOTICE](NOTICE).
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# MindSlice
|
|
2
|
+
|
|
3
|
+
**Portable memory for AI agents, with isolation and evolution built in.**
|
|
4
|
+
|
|
5
|
+
Keep project knowledge, personal preferences and shared handbooks in plain Markdown.
|
|
6
|
+
Mount what an agent needs, let it learn in its own workspace, and bake those learnings
|
|
7
|
+
into reusable versions. Connect through MCP, the CLI or Python.
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
|
|
11
|
+
## Why MindSlice?
|
|
12
|
+
|
|
13
|
+
**Isolation.** A *slice* is a folder of Markdown cards you can mount, unmount and share
|
|
14
|
+
independently. Mounted slices stay read-only through the engine; new learning goes into
|
|
15
|
+
a separate overlay. Multiple workspaces can reuse the same baseline while keeping their
|
|
16
|
+
own changes. Pending edits stay outside live memory until approved.
|
|
17
|
+
|
|
18
|
+
**Evolving memory.** Cards can explicitly extend or supersede earlier knowledge, so
|
|
19
|
+
retrieval follows recorded relationships under your trust rules. `bake` turns selected
|
|
20
|
+
changes into new slice versions, preserving the original folders and returning the new paths.
|
|
21
|
+
|
|
22
|
+
[Hot/cold memory](https://docs.letta.com/v1-sdk/memory/context-hierarchy) focuses on what stays
|
|
23
|
+
in context and what is retrieved later. [LLM Wiki](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f)
|
|
24
|
+
focuses on compiling sources into a maintained knowledge base. MindSlice makes **memory
|
|
25
|
+
boundaries and controlled evolution** first-class engine operations.
|
|
26
|
+
[How these approaches fit together →](docs/concepts.md)
|
|
27
|
+
|
|
28
|
+
Python 3.12+. No runtime dependencies, database server or LLM API calls inside the engine.
|
|
29
|
+
|
|
30
|
+
## Get started
|
|
31
|
+
|
|
32
|
+
Paste this into your coding agent:
|
|
33
|
+
|
|
34
|
+
```text
|
|
35
|
+
Clone https://github.com/pancerZH/MindSlice.git (or use the existing checkout).
|
|
36
|
+
Read skills/mindslice-setup/SKILL.md to finish setup.
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The agent helps you choose a workspace, connect your app, and choose how to start:
|
|
40
|
+
|
|
41
|
+
| Starting point | Tool |
|
|
42
|
+
| --- | --- |
|
|
43
|
+
| Empty memory or a short conversation | MindSlice `init` and ordinary memory writes |
|
|
44
|
+
| Existing MindSlice workspace | Connect it directly with `-w` |
|
|
45
|
+
| Shared `.slice` or Markdown notes folder | MindSlice `mount`, indexed as is |
|
|
46
|
+
| Documents to distill into structured cards | [MindSlice-forge](https://github.com/pancerZH/MindSlice-forge) |
|
|
47
|
+
|
|
48
|
+
Forge is an optional document-conversion tool. It creates a new workspace using an agent harness;
|
|
49
|
+
MindSlice handles storage, retrieval, mounting and memory evolution without needing Forge or an LLM.
|
|
50
|
+
The [builder skill](skills/slice-builder/SKILL.md) guides conversion and integration with an existing workspace.
|
|
51
|
+
|
|
52
|
+
Prefer manual setup? With Python 3.12+ and pipx installed:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
git clone https://github.com/pancerZH/MindSlice.git
|
|
56
|
+
cd MindSlice
|
|
57
|
+
pipx install -e .
|
|
58
|
+
mindslice init ~/mindslice
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Then [connect your agent](docs/getting-started.md#connect-your-agent) and tell it what to remember.
|
|
62
|
+
Run `mindslice -w ~/mindslice doctor`, then [verify a new session](docs/getting-started.md#verify-your-first-session).
|
|
63
|
+
[Full setup guide](docs/getting-started.md) · [Review changes and bake slices](docs/workflow.md)
|
|
64
|
+
|
|
65
|
+
## Documentation
|
|
66
|
+
|
|
67
|
+
- [Concepts](docs/concepts.md) — isolation, evolution, and how MindSlice fits other memory architectures.
|
|
68
|
+
- [Reference](docs/reference.md) — commands, Python API, MCP tools and card formats.
|
|
69
|
+
- [History and recovery](docs/history-and-recovery.md) — explain memory, roll back slices, back up and restore workspaces.
|
|
70
|
+
- [Build slices with Forge](skills/slice-builder/SKILL.md) — convert documents and connect the resulting workspace or slices.
|
|
71
|
+
- [Maintain memory](skills/slice-maintainer/SKILL.md) — consolidate knowledge and repair relationships.
|
|
72
|
+
- [Evaluations](docs/evaluations.md) · [Design](docs/design.md) · [Uninstall](skills/mindslice-setup/uninstall.md)
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
[Apache License 2.0](LICENSE). Benchmark excerpts quoted in the evaluation records keep their
|
|
77
|
+
datasets' licences; see [NOTICE](NOTICE).
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"""MindSlice: a layered, pluggable, human-readable long-term memory engine for LLM agents.
|
|
2
|
+
|
|
3
|
+
Plain Markdown + TOML on disk is the single source of truth; ``.cache/index.sqlite``
|
|
4
|
+
is a disposable acceleration cache. Standard library only (Python 3.12+).
|
|
5
|
+
|
|
6
|
+
>>> from mindslice import Workspace
|
|
7
|
+
>>> ws = Workspace.init("workspace")
|
|
8
|
+
>>> ws.write("user-preferences/tooling", summary="The user prefers uv.", content="- Use `uv run` for scripts.")
|
|
9
|
+
>>> ws.search("uv scripts")["results"][0]["address"]
|
|
10
|
+
'@overlay/user-preferences/tooling'
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from .errors import (
|
|
14
|
+
AlreadyExistsError,
|
|
15
|
+
AmbiguousAddressError,
|
|
16
|
+
ApplyConflictError,
|
|
17
|
+
BakeConflictError,
|
|
18
|
+
FrontmatterError,
|
|
19
|
+
HistoryError,
|
|
20
|
+
InvalidAddressError,
|
|
21
|
+
InvalidArgumentsError,
|
|
22
|
+
LineageCycleError,
|
|
23
|
+
LockTimeoutError,
|
|
24
|
+
MindSliceError,
|
|
25
|
+
MountError,
|
|
26
|
+
NotFoundError,
|
|
27
|
+
PreconditionFailedError,
|
|
28
|
+
ReadOnlyMountError,
|
|
29
|
+
RecoveryError,
|
|
30
|
+
UnresolvedExportDependencyError,
|
|
31
|
+
WorkspaceNotFoundError,
|
|
32
|
+
)
|
|
33
|
+
from .workspace import Workspace
|
|
34
|
+
|
|
35
|
+
__version__ = "0.1.0"
|
|
36
|
+
|
|
37
|
+
__all__ = [
|
|
38
|
+
"Workspace",
|
|
39
|
+
"MindSliceError",
|
|
40
|
+
"AlreadyExistsError",
|
|
41
|
+
"AmbiguousAddressError",
|
|
42
|
+
"ApplyConflictError",
|
|
43
|
+
"BakeConflictError",
|
|
44
|
+
"FrontmatterError",
|
|
45
|
+
"HistoryError",
|
|
46
|
+
"InvalidAddressError",
|
|
47
|
+
"InvalidArgumentsError",
|
|
48
|
+
"LineageCycleError",
|
|
49
|
+
"LockTimeoutError",
|
|
50
|
+
"MountError",
|
|
51
|
+
"NotFoundError",
|
|
52
|
+
"PreconditionFailedError",
|
|
53
|
+
"ReadOnlyMountError",
|
|
54
|
+
"RecoveryError",
|
|
55
|
+
"UnresolvedExportDependencyError",
|
|
56
|
+
"WorkspaceNotFoundError",
|
|
57
|
+
"__version__",
|
|
58
|
+
]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Slice preparation, reference transfer, batch planning and export."""
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"""Deterministic archives of a baked slice directory."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import gzip
|
|
6
|
+
import io
|
|
7
|
+
import os
|
|
8
|
+
import tarfile
|
|
9
|
+
import tempfile
|
|
10
|
+
import zipfile
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
|
|
13
|
+
from ..storage.fsutil import fsync_dir
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def archive_format(output: Path) -> str:
|
|
17
|
+
name = output.name.lower()
|
|
18
|
+
if name.endswith(".zip"):
|
|
19
|
+
return "zip"
|
|
20
|
+
if name.endswith((".tar.gz", ".tgz")):
|
|
21
|
+
return "tar.gz"
|
|
22
|
+
return "directory"
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def write_archive(tree: Path, output: Path, fmt: str) -> None:
|
|
26
|
+
"""Write all files, with fixed archive metadata, then atomically publish the archive."""
|
|
27
|
+
name = output.name
|
|
28
|
+
for suffix in (".tar.gz", ".tgz", ".zip"):
|
|
29
|
+
if name.lower().endswith(suffix):
|
|
30
|
+
name = name[:-len(suffix)]
|
|
31
|
+
break
|
|
32
|
+
root = name if name.endswith(".slice") else name + ".slice"
|
|
33
|
+
entries = [(root, None)]
|
|
34
|
+
entries += [(root + "/" + p.relative_to(tree).as_posix(), None if p.is_dir() else p.read_bytes())
|
|
35
|
+
for p in sorted(tree.rglob("*"))]
|
|
36
|
+
output.parent.mkdir(parents=True, exist_ok=True)
|
|
37
|
+
fd, temporary = tempfile.mkstemp(prefix=f".{output.name}.", dir=output.parent)
|
|
38
|
+
os.close(fd)
|
|
39
|
+
try:
|
|
40
|
+
if fmt == "zip":
|
|
41
|
+
with zipfile.ZipFile(temporary, "w", compression=zipfile.ZIP_DEFLATED) as archive:
|
|
42
|
+
for path, data in entries:
|
|
43
|
+
info = zipfile.ZipInfo(path + "/" if data is None else path, date_time=(1980, 1, 1, 0, 0, 0))
|
|
44
|
+
info.external_attr = ((0o40755 << 16) | 0x10) if data is None else 0o100644 << 16
|
|
45
|
+
if data is not None:
|
|
46
|
+
info.compress_type = zipfile.ZIP_DEFLATED
|
|
47
|
+
archive.writestr(info, b"" if data is None else data)
|
|
48
|
+
else:
|
|
49
|
+
with open(temporary, "wb") as raw, gzip.GzipFile(filename="", mode="wb", fileobj=raw, mtime=0) as gz:
|
|
50
|
+
with tarfile.open(fileobj=gz, mode="w", format=tarfile.PAX_FORMAT) as archive:
|
|
51
|
+
for path, data in entries:
|
|
52
|
+
info = tarfile.TarInfo(path)
|
|
53
|
+
info.mtime = 0
|
|
54
|
+
info.uid = info.gid = 0
|
|
55
|
+
info.uname = info.gname = ""
|
|
56
|
+
info.mode = 0o755 if data is None else 0o644
|
|
57
|
+
if data is None:
|
|
58
|
+
info.type = tarfile.DIRTYPE
|
|
59
|
+
archive.addfile(info)
|
|
60
|
+
else:
|
|
61
|
+
info.size = len(data)
|
|
62
|
+
archive.addfile(info, io.BytesIO(data))
|
|
63
|
+
os.replace(temporary, output)
|
|
64
|
+
fsync_dir(output.parent)
|
|
65
|
+
finally:
|
|
66
|
+
Path(temporary).unlink(missing_ok=True)
|