coldmemory 0.3.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- coldmemory-0.3.6/LICENSE +202 -0
- coldmemory-0.3.6/PKG-INFO +320 -0
- coldmemory-0.3.6/README.md +289 -0
- coldmemory-0.3.6/coldmemory/__init__.py +15 -0
- coldmemory-0.3.6/coldmemory/__main__.py +135 -0
- coldmemory-0.3.6/coldmemory/adversarial_ingest_bench.py +137 -0
- coldmemory-0.3.6/coldmemory/bench_v1.py +792 -0
- coldmemory-0.3.6/coldmemory/benchmark.py +292 -0
- coldmemory-0.3.6/coldmemory/cartridge_spec.py +559 -0
- coldmemory-0.3.6/coldmemory/citations.py +27 -0
- coldmemory-0.3.6/coldmemory/disk_index.py +3553 -0
- coldmemory-0.3.6/coldmemory/hermes_provider.py +135 -0
- coldmemory-0.3.6/coldmemory/hooks_snippet.py +161 -0
- coldmemory-0.3.6/coldmemory/hybrid.py +430 -0
- coldmemory-0.3.6/coldmemory/ingest.py +742 -0
- coldmemory-0.3.6/coldmemory/ingest_policy.py +46 -0
- coldmemory-0.3.6/coldmemory/init_cmd.py +2279 -0
- coldmemory-0.3.6/coldmemory/ledger.py +417 -0
- coldmemory-0.3.6/coldmemory/mcp_server.py +677 -0
- coldmemory-0.3.6/coldmemory/multihop_retriever.py +429 -0
- coldmemory-0.3.6/coldmemory/push.py +351 -0
- coldmemory-0.3.6/coldmemory/redact.py +133 -0
- coldmemory-0.3.6/coldmemory/scope_keys.py +95 -0
- coldmemory-0.3.6/coldmemory/sessions.py +236 -0
- coldmemory-0.3.6/coldmemory/verifier.py +1696 -0
- coldmemory-0.3.6/coldmemory.egg-info/PKG-INFO +320 -0
- coldmemory-0.3.6/coldmemory.egg-info/SOURCES.txt +49 -0
- coldmemory-0.3.6/coldmemory.egg-info/dependency_links.txt +1 -0
- coldmemory-0.3.6/coldmemory.egg-info/entry_points.txt +5 -0
- coldmemory-0.3.6/coldmemory.egg-info/requires.txt +5 -0
- coldmemory-0.3.6/coldmemory.egg-info/top_level.txt +1 -0
- coldmemory-0.3.6/integrations/hermes/coldmemory/__init__.py +10 -0
- coldmemory-0.3.6/integrations/hermes/coldmemory/plugin.yaml +3 -0
- coldmemory-0.3.6/pyproject.toml +55 -0
- coldmemory-0.3.6/setup.cfg +4 -0
- coldmemory-0.3.6/skills/coldmemory/SKILL.md +53 -0
- coldmemory-0.3.6/tests/test_adversarial_ingest.py +73 -0
- coldmemory-0.3.6/tests/test_bench_v1.py +217 -0
- coldmemory-0.3.6/tests/test_brief_allocation.py +249 -0
- coldmemory-0.3.6/tests/test_chat_prf.py +206 -0
- coldmemory-0.3.6/tests/test_coldmemory.py +1590 -0
- coldmemory-0.3.6/tests/test_disk_index.py +2453 -0
- coldmemory-0.3.6/tests/test_hermes_entry_point.py +173 -0
- coldmemory-0.3.6/tests/test_hybrid_retrieval.py +477 -0
- coldmemory-0.3.6/tests/test_init_onboarding.py +2304 -0
- coldmemory-0.3.6/tests/test_l0_brief.py +503 -0
- coldmemory-0.3.6/tests/test_ledger_push.py +706 -0
- coldmemory-0.3.6/tests/test_multihop_v02.py +337 -0
- coldmemory-0.3.6/tests/test_scope_keys.py +130 -0
- coldmemory-0.3.6/tests/test_scope_stacks.py +227 -0
- coldmemory-0.3.6/tests/test_sessions.py +271 -0
coldmemory-0.3.6/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.
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: coldmemory
|
|
3
|
+
Version: 0.3.6
|
|
4
|
+
Summary: Local-first AI agent memory with live file:line disk grounding, Keyed Decision Ledger, and local MCP — pure Python stdlib.
|
|
5
|
+
Author: ColdStack
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://coldstack.dev
|
|
8
|
+
Project-URL: Documentation, https://coldstack.dev/proof
|
|
9
|
+
Project-URL: Repository, https://github.com/coldstack-dev/coldstack
|
|
10
|
+
Project-URL: Issues, https://github.com/coldstack-dev/coldstack/issues
|
|
11
|
+
Keywords: mcp,memory,ai-agents,claude-code,codex,sqlite,local-first
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
22
|
+
Classifier: Topic :: Text Processing :: Indexing
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Provides-Extra: hybrid
|
|
27
|
+
Requires-Dist: numpy; extra == "hybrid"
|
|
28
|
+
Requires-Dist: onnxruntime; extra == "hybrid"
|
|
29
|
+
Requires-Dist: tokenizers; extra == "hybrid"
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
# ColdMemory v0.3
|
|
33
|
+
|
|
34
|
+
<!-- mcp-name: io.github.coldstack-dev/coldmemory -->
|
|
35
|
+
|
|
36
|
+
ColdMemory gives any MCP client short answers from your notes and repos. Each answer quotes live files, with the exact path and lines.
|
|
37
|
+
|
|
38
|
+
- **It works today without a GPU.** Disk search is the default.
|
|
39
|
+
- **This public build has no training code.** It searches and serves notes from disk; it can load a cartridge you already have.
|
|
40
|
+
- **It needs** Linux, Python 3.11 or newer (tested on 3.14.4), `git`, and `openssl` for signing. The package uses only the Python standard library (`dependencies = []`).
|
|
41
|
+
|
|
42
|
+
## Quickstart
|
|
43
|
+
|
|
44
|
+
Install the `coldmemory` CLI into a virtual environment (system Python on Linux is often PEP 668 externally managed; zero runtime dependencies), then initialize your notes in one command:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
python3 -m venv .venv
|
|
48
|
+
.venv/bin/python -m pip install --no-deps -e .
|
|
49
|
+
.venv/bin/coldmemory init /path/to/notes # creates 0700 store, verifies 1 live file:line quote, previews client wiring
|
|
50
|
+
.venv/bin/coldmemory init /path/to/notes --apply # backs up & wires Claude/Codex automatically + copies Hermes plugin (idempotent)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
For offline installs where `setuptools>=70.1` (which includes `bdist_wheel`) is already on the host, create the venv with `python3 -m venv --system-site-packages .venv` and pass `--no-build-isolation` to `pip install` (or install a prebuilt wheel with `--no-deps`).
|
|
54
|
+
|
|
55
|
+
`coldmemory init` auto-detects Claude Code, Codex, OpenBot, Hermes and Grok CLI (override with `--clients claude,codex,openbot,hermes,grok`, `--clients none`, or `--dry-run`). It never overwrites an existing bundle ID for different sources unless you pass `--force` (with `--apply`, `--force` also replaces existing signed or remote ColdMemory entries in selected clients), reuses unchanged revisions on re-run, creates timestamped backups before editing any client config (close running clients before `--apply` so they cannot race config saves), wires `--tools memory_ask` (234 schema tokens) plus `coldmemory.push` hooks for Claude Code and Codex (in Codex, run `/hooks` once to review and trust the generated hooks), copies the Hermes plugin files (printing its remaining env/config step), prints OpenBot Desktop's MCP form fields, and adds the same `memory_ask` server to `${GROK_HOME:-~/.grok}/config.toml` for Grok CLI (no hooks: Grok's session, prompt and compact hooks cannot inject model context, and Grok loads ColdMemory's MCP instructions natively).
|
|
56
|
+
|
|
57
|
+
## Try it on the synthetic company
|
|
58
|
+
|
|
59
|
+
Run these from this folder:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
STORE=$(mktemp -d)
|
|
63
|
+
python3 -m coldmemory compile --store "$STORE" --id demo --source obsidian:"$PWD/tests/fixtures/synthetic_company/engineering-vault"
|
|
64
|
+
python3 -m coldmemory ask --local-unsigned --store "$STORE" "Do we run RabbitMQ for the Harbor event queue?"
|
|
65
|
+
python3 -m coldmemory status --local-unsigned --store "$STORE"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The answer quotes the current NATS decision and says the RabbitMQ note is out of date.
|
|
69
|
+
|
|
70
|
+
## Serve a signed scope
|
|
71
|
+
|
|
72
|
+
Provision keys once on the signer. Keep the public-key copies used by the server outside the bundle store. The policy file contains a `mosaics` array. Each rule has an `entity` string and at least two distinct `facts` strings. Use the review and custody guidance in [THREAT_MODEL.md](https://github.com/coldstack-dev/coldstack/blob/main/memory/THREAT_MODEL.md).
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
mkdir -p -m 700 ~/.local/share/coldmemory-keys
|
|
76
|
+
chmod 700 ~/.local/share/coldmemory-keys
|
|
77
|
+
python3 -m coldmemory.scope_keys ~/.local/share/coldmemory-keys public private support
|
|
78
|
+
python3 -m coldmemory compile --store "$STORE" --scope public --id handbook \
|
|
79
|
+
--source "notion:$REVIEWED_EXPORT" --sign-key ~/.local/share/coldmemory-keys/public/sign.pem --policy "$RELEASE_POLICY"
|
|
80
|
+
python3 -m coldmemory.mcp_server --store "$STORE" --scope public --trust-key "public=$PUBLIC_TRUST_PEM"
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Recompile legacy bundles from reviewed sources to migrate. Restart each client with its scope and independently provisioned trust key. The signed server withholds new and changed files until the next signed revision.
|
|
84
|
+
|
|
85
|
+
### Scope stacks
|
|
86
|
+
|
|
87
|
+
One server can mount an ordered stack of scopes, each with its own trust key. A spec is `name[:rw|ro][,auto|fallback|explicit]`; a bare name means `rw,auto`, so `--scope private` works as before. Repeat `--scope` or separate specs with commas:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
python3 -m coldmemory.mcp_server --store "$STORE" --scope coldvoice:rw,auto --scope orch:ro,auto \
|
|
91
|
+
--scope personal:ro,explicit --trust-key "coldvoice=$CV_PEM" --trust-key "orch=$ORCH_PEM" --trust-key "personal=$P_PEM"
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
- `auto` scopes are searched by default, earlier scopes first on close matches, and feed the L0 brief (earlier scopes get the larger share).
|
|
95
|
+
- `fallback` scopes are searched only when every `auto` scope finds nothing, and never feed the brief.
|
|
96
|
+
- `explicit` scopes are searched only when the caller passes `scope="<name>"`, and never feed the brief. A scope that is not mounted is refused.
|
|
97
|
+
- `ro` scopes refuse `memory_record_note`. A locked decision in an `ro` (shared) scope beats a locked one in an `rw` scope.
|
|
98
|
+
- When two scopes hold the same decision key, the earlier scope's decision is in force, unless one is `decide --locked`: a locked decision always wins, is listed first, and is shown in the brief. Later versions of a key keep its lock; `forget` the key to drop it.
|
|
99
|
+
- With more than one scope, `memory_ask` and `memory_locate` take a `scope` argument, a `NO_MATCH` names the scopes it searched and those it did not, and `memory_status` prints the stack.
|
|
100
|
+
|
|
101
|
+
## Use your own notes
|
|
102
|
+
|
|
103
|
+
Keep the store outside every source folder and off shared drives. It must be a local folder you own with mode `0700`; on a shared mount owned by another user, `compile` refuses it. A `repo:` source must be a git checkout; plain paths default to `obsidian:` in `coldmemory init`.
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
coldmemory init /path/to/vault notion:/path/to/export repo:/path/to/repo --id work
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
To print one client's raw MCP config without editing settings, run `python3 -m coldmemory.hooks_snippet <client> --local-unsigned --tools memory_ask --store "${XDG_DATA_HOME:-$HOME/.local/share}/coldmemory"`.
|
|
110
|
+
|
|
111
|
+
### Claude Code and Codex sessions
|
|
112
|
+
|
|
113
|
+
Use a separate bundle `--id` (such as `sessions`) so compiling transcripts does not replace your `work` bundle, or pass both `--source` flags together:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
python3 -m coldmemory sessions
|
|
117
|
+
python3 -m coldmemory compile --store "${XDG_DATA_HOME:-$HOME/.local/share}/coldmemory" --id sessions \
|
|
118
|
+
--source "obsidian:${XDG_DATA_HOME:-$HOME/.local/share}/coldmemory-sessions"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
`sessions` copies the user and assistant text from `~/.claude/projects` and `~/.codex/sessions` into Markdown notes in `${XDG_DATA_HOME:-~/.local/share}/coldmemory-sessions` (change with `--out`, or pass other folders). Tool output, injected context and secrets are left out. It keeps how far it has read in each file, so later runs read only new lines, even when a sync tool replaces the file with a longer copy. A file is rebuilt when it shrinks or when the first or last 4 KiB it already read have changed; an edit only in the middle of an old transcript, or one that keeps both its size and modification time, is not noticed. It reads one line at a time, so memory stays flat however many gigabytes of transcripts you have. Only one run writes to an output folder at a time. Each note part stays under 512 KiB so `compile` can read it. New folders and notes are private to you (0700/0600); folders and notes that already exist keep their permissions.
|
|
122
|
+
|
|
123
|
+
| Client | Name to use | Where the output goes | Checked so far |
|
|
124
|
+
|---|---|---|---|
|
|
125
|
+
| Claude Code | `claude-code` | Run the printed command | Matches `claude mcp add-json --help`; same server settings tried live through `--mcp-config` |
|
|
126
|
+
| T3 Code | `t3-code` | Pass the JSON to `t3_mcp_server_update` | Matches the tool's schema |
|
|
127
|
+
| Codex | `codex` | `~/.codex/config.toml` | Valid TOML; same server settings tried live through `-c` overrides |
|
|
128
|
+
| Cursor | `cursor` | `~/.cursor/mcp.json` | Valid JSON; location unconfirmed |
|
|
129
|
+
| Antigravity | `antigravity` | Its MCP config, under `mcpServers` | Valid JSON; location unconfirmed |
|
|
130
|
+
| OpenBot | `openbot` | Desktop app: Settings → MCP servers → Connect to a custom MCP; copy each printed field into the matching box | Same server settings tried live in OpenBot 0.84.0 with a Claude agent |
|
|
131
|
+
| Grok CLI | `grok` | `~/.grok/config.toml` (or `./.grok/config.toml`) | Valid TOML; same server settings tried live in Grok CLI 1.0.100; `grok mcp list` (1.0.104) reads the `init` output |
|
|
132
|
+
|
|
133
|
+
Tests start the server with the settings from all seven snippets. T3 Code, Cursor and Antigravity have not been tried inside their clients.
|
|
134
|
+
|
|
135
|
+
### Share one vault between Claude Code and Codex
|
|
136
|
+
|
|
137
|
+
Point both clients at the same store. In a local unsigned store (`--local-unsigned`), a note one agent writes is returned by the other agent's next `memory_ask` call with its `file:line`. Once a note is edited, superseded or deleted, `memory_ask` stops returning the old text for both. A server started with `COLDMEMORY_WALK_SECONDS` rescans the sources at most that often, so it may find a new file only at its next scan. The demo starts a fresh server for every step. A signed store holds new and changed notes back until you compile the next signed revision.
|
|
138
|
+
|
|
139
|
+
To watch it happen without changing either client's settings, run:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
tools/cross_tool_demo.sh "$(mktemp -d)"
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
The script runs Claude Code (`claude -p`) and Codex (`codex exec`) headless and passes the server settings as one-off flags. It makes model calls on both accounts. It runs six steps:
|
|
146
|
+
|
|
147
|
+
1. Claude Code writes a note.
|
|
148
|
+
2. Codex quotes it.
|
|
149
|
+
3. Codex writes a note that supersedes it.
|
|
150
|
+
4. Claude Code quotes only the new note.
|
|
151
|
+
5. Claude Code deletes both notes.
|
|
152
|
+
6. Codex finds no match.
|
|
153
|
+
|
|
154
|
+
It checks that each `memory_ask` call asked the same Kestrel question, checks the notes on disk after the supersede and delete steps, checks that Claude Code ran only the one `rm` command, and prints `PASS`. Tried on 2026-12-04 with Claude Code 2.1.332 and Codex CLI 0.172.0.
|
|
155
|
+
|
|
156
|
+
### Session brief for Claude Code
|
|
157
|
+
|
|
158
|
+
`coldmemory brief` prints at most 250 tokens: a header, then the newest rule and decision lines, each as `file:line "quote"`. It reads the files from disk every time it runs, so a deleted, edited, superseded or revoked note drops out of the next brief. In a signed store, a new or edited note, including a new note that supersedes an older one, enters the brief only once a new signed revision is compiled. A `--local-unsigned` store is your own single scope and needs no setup. For a signed store it checks `--scope` against `COLD_ALLOWED_SCOPES` (default `public`) before it opens any store, and prints nothing when the scope is denied or the trust key fails.
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
python3 -m coldmemory.hooks_snippet claude-code --hooks --store "$STORE" --scope public --trust-key "public=$PUBLIC_TRUST_PEM"
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Merge the printed `hooks` into `.claude/settings.json`. `SessionStart` (startup, resume, clear and compact) gives the brief to the model, and `PostCompact` shows it to you after compaction. For a signed store the hook does not set `COLD_ALLOWED_SCOPES`: it inherits the allowlist from the environment that starts Claude Code, so a signed private hook prints nothing unless that environment allows `private`.
|
|
165
|
+
|
|
166
|
+
### Decision ledger and push (NOW)
|
|
167
|
+
|
|
168
|
+
Two layers, both on by default. The full archive (notes, repos, session transcripts and every owner message) answers any question with `file:line` quotes. The decision ledger answers "what is in force now". Each scope except `public` has its own, in `<store>/_ledger/<scope>/`, with one file per decision key (`<key>.md`) holding the owner's words with secrets redacted, whitespace collapsed to one line and anything past 1,500 characters cut. Writing the same key again moves the old file to `history/` with `superseded_by:` and links the new one with `supersedes:`, so a replaced rule is never served as current. `rm _ledger/<scope>/<key>.md` forgets it.
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
python3 -m coldmemory decide --store "$STORE" model-routing "New builders use Opus 5.5; Sol and Astra review."
|
|
172
|
+
python3 -m coldmemory decide --store "$STORE" memory-store "Keep memory in SQLite files on disk." \
|
|
173
|
+
--why-not "Redis (extra daemon)" --why-not "Mem0 (LLM ingest tax)"
|
|
174
|
+
python3 -m coldmemory decisions --store "$STORE"
|
|
175
|
+
python3 -m coldmemory.hooks_snippet claude-code --push --local-unsigned --store "$STORE"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
`decide`, `decisions` and `forget` take `--scope` (default `private`). Merge the printed hooks into `.claude/settings.json` (or the Codex hooks file) instead of `--hooks`, not alongside it. Like `brief`, a `--local-unsigned` store needs no setup, and for a signed store the hook does nothing unless its scope is listed in `COLD_ALLOWED_SCOPES` in the client's environment. The ledger is your own local data and is not signed; a trust key covers only the archive quotes. The hooks work as follows:
|
|
179
|
+
|
|
180
|
+
- **Session start and after every compaction.** `SessionStart` sends NOW: the decisions in force, newest first, capped at an estimated 550 tokens including a count of what did not fit. A compaction starts a new `compact_epoch`, resets the seen set, and sends NOW again: at once on `SessionStart` with source `compact`, or on the next prompt after `PostCompact`. Both events with no prompt between them count as one compaction. NOW comes with a `RETRACTED` line for every decision this session saw that has since been deleted. A retraction that does not fit is sent on a later turn.
|
|
181
|
+
- **Every prompt.** `UserPromptSubmit` sends an estimated 350 tokens at most: changed decisions, retractions, and up to five new `file:line` quotes for the prompt from the ledger and the archive. A quote longer than 400 characters is cut, and its `file:line` holds the rest. After it has recorded the prompt, the hook gives up after 100 ms and prints nothing rather than slow the turn. Token counts are estimates (the larger of words plus punctuation and characters / 3), not a client's tokenizer.
|
|
182
|
+
- **Capture.** The same hook first appends each owner prompt, secrets redacted, to `_ledger/<scope>/turns.jsonl`, so the query tool finds it at once. The same prompt from the same session within two minutes is stored and applied once, and a turn older than the decision in force never replaces it. Lines starting `remember:`, `rule:` or `decided: <key>: <words>` become decisions, and a `why not:` or `rejected:` line under one is kept as an option the owner ruled out (`decide --why-not`, repeatable). Ruled-out options (up to 8, 300 characters each) are written one per line in the decision file. `memory_ask` cites each by `file:line`, and NOW lists them after the decision with the `file:line` of the first. A new version of a decision carries only its own. A short "yes, do it" keeps the end of the proposal it answered. A message relayed from another agent is not captured.
|
|
183
|
+
- **Before a compaction (opt-in).** `--push --pre-compact` adds a `PreCompact` hook. It reads the last 256 KiB of the transcript, writes every recent owner turn holding a marked line to the ledger at that turn's own time (no model calls; a turn already kept is not applied again), and shows the user a one-line `systemMessage` counting the decisions and ruled-out options on disk. A turn this session already kept in `turns.jsonl` is never applied again, so a decision forgotten since stays forgotten. Without the flag the printed hooks are unchanged.
|
|
184
|
+
- **Clients without a hook.** For these, `python3 -m coldmemory.ledger tail --store "$STORE" --every 5` copies new owner lines from Claude Code and Codex transcripts, oldest first, keeping the assistant text before a confirmation.
|
|
185
|
+
- **Query tool.** `memory_ask` lists the decisions in force that match the question first, including those matched only by the words of a version they replaced. Then come matching owner messages, then the archive answer. An archive excerpt that shares words with a matched decision is labelled `archive` instead of `current`. A server for the `public` scope never reads a ledger. The query tool still needs a compiled archive bundle; a store with only a ledger answers through `decisions` and the hook, not `memory_ask`.
|
|
186
|
+
- **Hermes.** `pip install coldmemory` into Hermes's Python environment registers a native Hermes memory provider through the `hermes_agent.memory_providers` entry point; Run `coldmemory init` first; `hermes memory setup` then asks for that store folder and a scope. Archive quotes and the `coldmemory_ask` tool also need `COLDMEMORY_LOCAL_UNSIGNED=1` in Hermes's `.env` for a local unsigned store such as the one `coldmemory init` makes, or `COLDMEMORY_TRUST_KEY` (a public key file) for a signed store; without either, Hermes gets only the decisions. [integrations/hermes/coldmemory](https://github.com/coldstack-dev/coldstack/blob/main/memory/integrations/hermes/coldmemory/__init__.py) is the same provider for a plugin-folder install. It sends NOW in the system prompt, which Hermes rebuilds after compression, and the per-turn delta and quotes through `prefetch`. `on_pre_compress` asks the summarizer not to restate decisions. For a plugin-folder install, never put `$HERMES_HOME/plugins` on `PYTHONPATH` ahead of the `coldmemory` package (if `$HERMES_HOME/plugins` is on `PYTHONPATH`, keep the ColdMemory package root ahead of it so the plugin folder never shadows `coldmemory`).
|
|
187
|
+
|
|
188
|
+
### MCP tools
|
|
189
|
+
|
|
190
|
+
| Tool | What it does |
|
|
191
|
+
|---|---|
|
|
192
|
+
| `memory_ask(query, cartridge="auto", max_words=180)` | Returns a short brief with exact sources |
|
|
193
|
+
| `memory_locate(topic, top_k=5)` | Returns paths and line numbers only |
|
|
194
|
+
| `memory_list_cartridges()` | Lists the bundles this server can read |
|
|
195
|
+
| `memory_status()` | Shows files added, changed or deleted since compile |
|
|
196
|
+
| `memory_record_note(title, decision, source_paths)` | Saves a note to a private queue for your approval |
|
|
197
|
+
|
|
198
|
+
Pass `--tools memory_ask` (a comma-separated list) to serve only some tools. The `tools/list` schema for all five tools is 669 tokens and for `memory_ask` alone 234 (`o200k_base`); clients that load tools eagerly send it with their requests. [skills/coldmemory/SKILL.md](https://github.com/coldstack-dev/coldstack/blob/main/memory/skills/coldmemory/SKILL.md) lets a coding agent install ColdMemory for its user.
|
|
199
|
+
|
|
200
|
+
`coldmemory mcp` takes the same arguments as `python3 -m coldmemory.mcp_server`. The server uses stdio, so it opens no port. It connects to nothing unless you choose `--backend llama-server`, which accepts only `http://127.0.0.1:PORT`.
|
|
201
|
+
|
|
202
|
+
### Optional CPU hybrid retrieval
|
|
203
|
+
|
|
204
|
+
Search is pure Python by default and needs no extra packages. To add a local dense index, install the optional extra (`pip install ".[hybrid]"` for `numpy`, `onnxruntime` and `tokenizers`), download an ONNX embedding model with its `tokenizer.json`, and set these variables in the server environment:
|
|
205
|
+
|
|
206
|
+
| Variable | Effect |
|
|
207
|
+
|---|---|
|
|
208
|
+
| `COLDMEMORY_HYBRID_MODEL=/path/to/model` | Stage 1: fuse dense and BM25 ranks |
|
|
209
|
+
| `COLDMEMORY_RERANK_MODEL=/path/to/model` | Stage 2: rerank the stage 1 passages (needs stage 1) |
|
|
210
|
+
| `COLDMEMORY_VECTOR_CACHE=/path/to/dir` | Keep vectors (no note text) in owner-only files |
|
|
211
|
+
| `COLDMEMORY_HYBRID=off` | Turn the dense index off even when a model is set |
|
|
212
|
+
|
|
213
|
+
It runs on the CPU only. If the packages are missing, search falls back to pure Python. The dense index embeds every section, so check memory use on a large vault before you turn it on.
|
|
214
|
+
|
|
215
|
+
Limits to know about:
|
|
216
|
+
- Stage 2 reranks one passage per note, so it runs only when search returns one section per note.
|
|
217
|
+
- A dense match is cited by its section. In a long section, the quote comes from the lines that best match the question's words, which may not be the window that matched.
|
|
218
|
+
- On a linked-note answer, an explicit `top_k` can shorten the list of linked notes but never lengthen it.
|
|
219
|
+
|
|
220
|
+
## How an answer is checked
|
|
221
|
+
|
|
222
|
+
1. Every question searches the files as they are now. Cited files are read again before the answer is returned.
|
|
223
|
+
2. **Verified Sources** are exact quotes with a path and line numbers. Out-of-date notes are replaced by the notes that supersede them.
|
|
224
|
+
3. With a model backend, recall runs even when the question shares no words with your notes. The files it names are suggestions: only indexed files are used, each is read from disk, and it is labelled `proposed by recall`.
|
|
225
|
+
4. **Synthesized Context** is the model's wording, kept separate from the sources. It is withheld if any of these is true:
|
|
226
|
+
- The disk match is weak.
|
|
227
|
+
- It cites nothing, or a cited file is missing, changed since compile or out of date without its replacement.
|
|
228
|
+
- It contains a quotation or number that isn't in its cited files or related note titles.
|
|
229
|
+
5. Secrets are removed on the way in and again on the way out.
|
|
230
|
+
|
|
231
|
+
## Limitations
|
|
232
|
+
|
|
233
|
+
**Answers**
|
|
234
|
+
- These checks don't prove that the model's wording is right. A real number can still be attached to the wrong thing.
|
|
235
|
+
- "Weak match" means the quoted lines are real but may not answer the question. Expect it on some questions that do have an answer.
|
|
236
|
+
- Contradictions marked in a note (`superseded_by:`, `supersedes:`, "Replaced by", a stale `status:`) are always followed.
|
|
237
|
+
- Unmarked contradictions are caught only between strong matches whose titles share at least half their words, whose differing title words aren't in the question, and whose quoted lines name different numbers, number words or names. The note with the later date (`effective`, `decided`, `date`, `created`, `updated` or Notion's "Last edited time" property, else a year in the title) wins. Without two different dates, a note whose quote says the rule changed ("now", "changed", "no longer", "instead") wins. The older note's quote is left out and named as possibly out of date. If neither rule decides, both are quoted and flagged as a possible conflict. A later edit date is a heuristic, not proof of authority.
|
|
238
|
+
- `cartridge="auto"` picks the bundle with the best word match and tries the next only after "no match". Name the bundle if you know it. `memory_locate` doesn't use recall.
|
|
239
|
+
|
|
240
|
+
**Privacy**
|
|
241
|
+
- **If your agent runs in the cloud, its provider receives the returned brief,** including its quotes and paths.
|
|
242
|
+
- Redaction uses patterns. It can miss secrets written as ordinary words and unlabelled hex strings.
|
|
243
|
+
- `--scope` limits what one server process can read. It doesn't protect against other programs running as the same OS user. Use separate OS accounts for a real boundary.
|
|
244
|
+
- Deleting a note removes it from live answers, but not from trained weights or kept revisions. Compile a clean bundle, then remove the old revisions.
|
|
245
|
+
- Folders are `0700` and files are `0600` on Linux. Windows doesn't enforce those modes.
|
|
246
|
+
|
|
247
|
+
## Serve a cartridge you already have
|
|
248
|
+
1. Copy the revision's `obsidian.cold` folder to the server machine. Keep `<revision>/obsidian.cold/adapter.gguf` at the end of its path, because ColdMemory uses that to identify the revision.
|
|
249
|
+
2. Start llama-server with that adapter:
|
|
250
|
+
|
|
251
|
+
```text
|
|
252
|
+
llama-server -m <base.gguf> -ngl 99 --host 127.0.0.1 --port 8090 --cache-ram 0 --lora-init-without-apply --lora <path>/<revision>/obsidian.cold/adapter.gguf
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
3. If the server is on another machine, open a tunnel: `ssh -N -L 127.0.0.1:8090:127.0.0.1:8090 <YOUR_GPU_HOST>`.
|
|
256
|
+
4. On sealed questions, compare three setups with the same brief length: the cartridge, the same model with the adapter off, and tuned hybrid search. The adapter-off and hybrid setups aren't built yet. Use copies of the store to keep the test away from your live bundle.
|
|
257
|
+
5. If the cartridge wins, make it live, then add `--backend llama-server --url http://127.0.0.1:8090` to the client's server arguments:
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
python3 -m coldmemory activate --store ~/.local/share/coldmemory --id obsidian --revision <revision>
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Run `activate` without `--revision` to go back to the previous live revision.
|
|
264
|
+
|
|
265
|
+
## Nightly updates
|
|
266
|
+
|
|
267
|
+
Run `compile` each night from your own scheduler. **ColdMemory doesn't install a schedule.**
|
|
268
|
+
|
|
269
|
+
- Live answers use edited files straight away, before the next compile.
|
|
270
|
+
- If the live revision is disk only, a new compile replaces it in one step.
|
|
271
|
+
- If the live revision has weights, the new one waits for `activate`. The text and weights always switch together.
|
|
272
|
+
|
|
273
|
+
Notes saved by agents go into the bundle only after you approve them, and only while their sources stay unchanged. They are never Verified Sources, and disk search doesn't search them.
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
python3 -m coldmemory queue --store ~/.local/share/coldmemory --id work
|
|
277
|
+
python3 -m coldmemory approve --store ~/.local/share/coldmemory --id work <entry>
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## Files and compatibility
|
|
281
|
+
|
|
282
|
+
```text
|
|
283
|
+
<store>/<id>/current.json live and previous revisions
|
|
284
|
+
<store>/<id>/queue.jsonl notes waiting for approval
|
|
285
|
+
<store>/<id>/<revision>/memory.json base model, source hashes, build time, scope and file hashes
|
|
286
|
+
<store>/<id>/<revision>/graph.json links, backlinks and compile-time file hashes
|
|
287
|
+
<store>/<id>/<revision>/{train,val}.jsonl redacted question rows
|
|
288
|
+
<store>/<id>/<revision>/SHA256SUMS
|
|
289
|
+
<store>/<id>/<revision>/<id>.cold/ signed five-file v2 cartridge, only when one is attached
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Private cartridges say `"kind": "memory"` and `"license": {"adapter": "private-local", "commercial_safe": false}`, and `LICENSE.txt` says not to share them. The v2 format doesn't know either value yet, so a v2 host refuses a private cartridge. A cartridge built with an open `--license` uses `expert` and passes the v2 check.
|
|
293
|
+
|
|
294
|
+
## Test and benchmark
|
|
295
|
+
|
|
296
|
+
Run these from a source checkout (the test suite and `coldmemory.benchmark` read `tests/fixtures/`):
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
PYTHONDONTWRITEBYTECODE=1 python3 -m pytest -q -rs -p no:cacheprovider tests
|
|
300
|
+
PYTHONDONTWRITEBYTECODE=1 python3 -m coldmemory.benchmark
|
|
301
|
+
PYTHONDONTWRITEBYTECODE=1 python3 -m coldmemory.bench_v1 [--out <DIR>]
|
|
302
|
+
sha256sum -c SHA256SUMS
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
- The tests need `pytest`. To run the optional v2 spec compatibility check, set `COLDMEMORY_V2_SPEC=<V2_SPEC_PATH>` (requires `cryptography`). `-rs` shows a skipped check.
|
|
306
|
+
- The benchmark measures which evidence reaches the agent. It doesn't grade LLM answers. Mock recall replays training rows, so it says nothing about how well trained weights work.
|
|
307
|
+
- All notes, repos and planted secrets in the tests are synthetic.
|
|
308
|
+
- `coldmemory.bench_v1` generates a 291-file synthetic company (about 44,700 tokens across two Obsidian vaults, a Notion export and two git repos) from a fixed seed. It scores Full context, naive BM25 RAG, a tuned hybrid and ColdMemory on 100 questions in four families (paraphrase multi-hop, marked and unmarked supersession, disk grounding after edits, and 20 planted canary secrets with 20 permitted controls), plus token cost measured across all 100. `--out` also writes the corpus, questions, results and `SHA256SUMS`. Results: [docs/bench-v1.md](https://github.com/coldstack-dev/coldstack/blob/main/memory/docs/bench-v1.md). Answers quote absolute paths and the brief limit counts them, so the bench builds its corpus under `/tmp` when it is writable, ignoring `TMPDIR`. A fixed short prefix keeps the committed report reproducible on hosts with writable `/tmp`. Other temporary directory paths can change which evidence fits.
|
|
309
|
+
- When a long path would push evidence past the brief limit, citations become relative to a `Paths are relative to <dir>` line at the top of the answer.
|
|
310
|
+
- The disk backend scores 20/20 on paraphrase multi-hop. When a question names one note by its title, alias or metadata and that note only links to the facts, it follows wikilinks, backlinks and shared aliases, tags and entities for up to two hops, then quotes the best-matching live lines.
|
|
311
|
+
- When the matching line sits deep inside a long block, such as one key in a YAML map, the quote starts at that line instead of at the top of the block.
|
|
312
|
+
- Direct search checks strong matches for unmarked contradictions. For linked notes, the disk backend checks pairs whose shorter title contains only terms found in the longer title. On Bench v1, 1 of 4 ties and 1 of 4 wording-based changes go unflagged.
|
|
313
|
+
|
|
314
|
+
## Verify a checkout
|
|
315
|
+
|
|
316
|
+
```sh
|
|
317
|
+
python -m coldmemory --help
|
|
318
|
+
python -m pip install --no-compile -r requirements-test.txt
|
|
319
|
+
python -m pytest -q
|
|
320
|
+
```
|