ihow-memory 0.1.0-alpha.0

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.
package/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.
package/NOTICE ADDED
@@ -0,0 +1,15 @@
1
+ iHow Memory Core
2
+ Copyright 2026 iHow Memory contributors
3
+
4
+ This product includes software developed as part of the iHow Memory project
5
+ (https://github.com/iHow1/ihow-memory-core).
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this software except in compliance with the License.
9
+ You may obtain a copy of the License in the accompanying LICENSE file or at:
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ iHow Memory is local-first: the open-source core runs entirely on the user's
14
+ machine with no telemetry and no required network calls. See README for the
15
+ privacy statement.
package/README.md ADDED
@@ -0,0 +1,250 @@
1
+ # iHow Memory
2
+
3
+ Local-first shared memory for AI agents. The alpha core stores Markdown locally, indexes it with Node's built-in SQLite FTS5, returns citations, and exposes the same governed memory flow through CLI and stdio MCP.
4
+
5
+ - No account
6
+ - No telemetry
7
+ - No required network calls
8
+ - No embedding model or API key required
9
+ - Cloud and sync are disabled by default
10
+
11
+ > Alpha software. Back up runtime configuration before editing it, and use a demo space until you have reviewed the local file layout.
12
+
13
+ ## 2-Minute Quickstart
14
+
15
+ Requirements:
16
+
17
+ - Node.js `>=22.12`
18
+ - macOS or Linux for the current alpha validation lane
19
+ - A writable local directory
20
+
21
+ ### 1. Inspect and initialize
22
+
23
+ During repository development:
24
+
25
+ ```bash
26
+ git clone https://github.com/iHow1/ihow-memory-core.git
27
+ cd ihow-memory-core
28
+ npm run cli -- doctor
29
+ npm run cli -- init --space demo --runtime codex
30
+ ```
31
+
32
+ After the npm package is published:
33
+
34
+ ```bash
35
+ npx ihow-memory init --space demo --runtime codex
36
+ ```
37
+
38
+ Use one of:
39
+
40
+ ```bash
41
+ ihow-memory init --space demo --runtime claude-code
42
+ ihow-memory init --space demo --runtime codex
43
+ ihow-memory init --space demo --runtime cursor
44
+ ```
45
+
46
+ `init` creates a local managed workspace and prints the matching MCP configuration snippet. It does not edit runtime configuration automatically.
47
+ It also copies the small zero-dependency JavaScript runtime into `<state-root>/<space>/.runtime/`, so the MCP configuration does not depend on an `npx` cache directory.
48
+
49
+ Before pasting the snippet:
50
+
51
+ 1. Back up the existing runtime configuration file.
52
+ 2. Paste the generated snippet.
53
+ 3. Restart or reload the runtime.
54
+ 4. Run `ihow-memory doctor --runtime <runtime>` again.
55
+
56
+ ### 2. Run the local proof
57
+
58
+ ```bash
59
+ ihow-memory proof --space demo-proof
60
+ ```
61
+
62
+ Expected flow:
63
+
64
+ ```text
65
+ agent A write candidate
66
+ -> governed promote
67
+ -> agent B search/read
68
+ -> citation
69
+ -> audit event
70
+ -> cloud disabled / local only
71
+ ```
72
+
73
+ ### 3. Connect an AI runtime
74
+
75
+ The generated snippet starts:
76
+
77
+ ```text
78
+ node mcp/server.js
79
+ ```
80
+
81
+ with `cwd` set to:
82
+
83
+ ```text
84
+ <state-root>/<space>/.runtime
85
+ ```
86
+
87
+ Available MCP tools:
88
+
89
+ - `memory.search`
90
+ - `memory.read`
91
+ - `memory.write_candidate`
92
+ - `memory.promote`
93
+ - `memory.durable_promote`
94
+ - `memory.status`
95
+
96
+ ### 4. Verify the result
97
+
98
+ Ask runtime A to write a non-sensitive candidate. Ask runtime B to search for the marker and read the cited file. Confirm:
99
+
100
+ - the search result contains a citation path and snippet;
101
+ - the read result contains the original marker;
102
+ - an audit event exists;
103
+ - status reports `cloud=false` and `sync.enabled=false`.
104
+
105
+ ## Doctor and Diagnostics
106
+
107
+ Run:
108
+
109
+ ```bash
110
+ ihow-memory doctor --runtime codex
111
+ ```
112
+
113
+ `doctor` checks:
114
+
115
+ - Node version;
116
+ - `node:sqlite` availability;
117
+ - memory root writability;
118
+ - selected runtime setup guidance;
119
+ - retrieval engine readiness;
120
+ - index manifest;
121
+ - local-only cloud/sync state.
122
+
123
+ For a redacted report:
124
+
125
+ ```bash
126
+ ihow-memory doctor --runtime codex --share-diagnostics
127
+ ```
128
+
129
+ The report omits memory content, replaces local paths with placeholders, and redacts secret-like values. It is printed locally and is not uploaded.
130
+
131
+ ## Feedback
132
+
133
+ ```bash
134
+ ihow-memory feedback --runtime codex
135
+ ```
136
+
137
+ This prints:
138
+
139
+ - a prefilled GitHub issue URL;
140
+ - a Markdown issue template;
141
+ - a redacted doctor summary.
142
+
143
+ No issue is submitted automatically.
144
+
145
+ ## Reset and Uninstall
146
+
147
+ Remove a managed demo space:
148
+
149
+ ```bash
150
+ ihow-memory reset --space demo
151
+ ```
152
+
153
+ Use the same `--root <dir>` value if the demo was initialized under a custom root:
154
+
155
+ ```bash
156
+ ihow-memory reset --root <state-root> --space demo
157
+ ```
158
+
159
+ Safety boundary:
160
+
161
+ - `reset` requires an explicit `--space`;
162
+ - `reset` only removes managed spaces;
163
+ - `reset` refuses `--memory-root`, so it cannot delete an existing shared memory root.
164
+
165
+ Uninstall steps:
166
+
167
+ 1. Remove the `ihow-memory` entry from the AI runtime's MCP configuration.
168
+ 2. Restore the configuration backup if needed.
169
+ 3. Delete demo spaces with `ihow-memory reset`.
170
+ 4. Remove a global npm install with `npm uninstall -g ihow-memory`.
171
+ 5. Delete any remaining custom state root only after reviewing its contents.
172
+
173
+ ## Workspace Modes
174
+
175
+ ### Managed Space
176
+
177
+ Default layout:
178
+
179
+ ```text
180
+ <state-root>/<space>/
181
+ memory/
182
+ candidate/inbox/
183
+ scopes/
184
+ _events/
185
+ history/
186
+ index.sqlite
187
+ index-manifest.json
188
+ ```
189
+
190
+ ### Existing Memory Root
191
+
192
+ Use an existing Markdown memory directory without moving it:
193
+
194
+ ```bash
195
+ ihow-memory doctor \
196
+ --memory-root <memory-root> \
197
+ --state-root <state-root>
198
+ ```
199
+
200
+ Write boundary:
201
+
202
+ - existing durable Markdown is read-only by default;
203
+ - candidates are written under `memory/_mcp/candidates/`;
204
+ - normal promote writes staging files under `memory/_mcp/promoted/`;
205
+ - audit events stay under `memory/_mcp/_events/`;
206
+ - SQLite state stays under `<state-root>`, outside the memory root.
207
+
208
+ ## Retrieval Engine
209
+
210
+ The default `fts` provider uses only Node built-in modules and `node:sqlite` FTS5:
211
+
212
+ - zero third-party runtime dependencies;
213
+ - zero embedding downloads;
214
+ - zero model/API requirements;
215
+ - citation-bearing lexical search.
216
+
217
+ The optional `vector-gguf` provider runs as a separate local process. If it is unconfigured, missing, slow, or unhealthy, retrieval falls back visibly to FTS. Governance, write guards, and audit behavior do not change with the retrieval provider.
218
+
219
+ ## Development Proofs
220
+
221
+ From a clone of the source repository (these scripts are not part of the npm package):
222
+
223
+ ```bash
224
+ npm run proof
225
+ npm run dogfood
226
+ ```
227
+
228
+ `dogfood` requires explicit local paths:
229
+
230
+ ```bash
231
+ MEMORY_ROOT=<memory-root> \
232
+ IHOW_MEMORY_STATE_ROOT=<state-root> \
233
+ npm run dogfood
234
+ ```
235
+
236
+ ## Hosted Runtime
237
+
238
+ A single-tenant HTTP runtime exists for development and controlled deployment. It is **not** part of the published npm package and is not the self-serve alpha path: no accounts, billing, hosted sync, or web console.
239
+
240
+ ## Package Status
241
+
242
+ Alpha prerelease (`0.1.0-alpha.0`). The npm tarball ships only the local CLI, the stdio MCP server, and the read-only local console (`ihow-memory console`). The single-tenant hosted runtime, TypeScript sources, and internal proof scripts are intentionally not part of the published package.
243
+
244
+ ## Privacy
245
+
246
+ The open-source core runs locally with no telemetry and no required network calls. Memory content is not included in diagnostics. `feedback` only prints a template; the user decides whether to submit it.
247
+
248
+ ## License
249
+
250
+ Apache License 2.0. See [`LICENSE`](./LICENSE) and [`NOTICE`](./NOTICE).
package/TRADEMARK.md ADDED
@@ -0,0 +1,24 @@
1
+ # Trademark Policy / 商标政策
2
+
3
+ **iHow**, **iHow Memory**, **Yihow**, and associated logos are trademarks of the iHow Memory project and its owner.
4
+
5
+ ## The code is open. The brand is protected. / 代码开放,品牌受保护
6
+
7
+ The source code is licensed under **Apache-2.0** — you are free to use, modify, fork, and redistribute it under those terms.
8
+
9
+ **However, the trademarks (the names "iHow" / "iHow Memory" / "Yihow", and the logos) are NOT licensed under Apache-2.0.**
10
+
11
+ 代码可自由 fork / 修改 / 再分发(遵循 Apache-2.0);但**名称与 logo 不在 Apache-2.0 授权范围内**。
12
+
13
+ ### You may NOT / 不可
14
+ - Use the names or logos in a way that suggests endorsement, affiliation, or official status without permission. / 以暗示官方背书、关联或官方身份的方式使用名称或 logo。
15
+ - Name a fork or derivative "iHow Memory" (or a confusingly similar name) so as to mislead users about its origin. / 给 fork / 衍生品起名 "iHow Memory" 或近似名,误导用户来源。
16
+ - Use the marks as your own product or company name. / 把商标用作你自己的产品 / 公司名。
17
+
18
+ ### You may / 可以
19
+ - State factually that your product "is built on" / "is compatible with" / "is a fork of" iHow Memory, as long as it is not misleading. / 如实说明"基于 / 兼容 / fork 自" iHow Memory(只要不误导)。
20
+ - Use the name in documentation, articles, and discussion that refer to this project. / 在引用本项目的文档、文章、讨论中使用名称。
21
+
22
+ **If you distribute a modified version, please use a different name** to avoid confusion. / **分发修改版请改用别的名字**以避免混淆。
23
+
24
+ Questions / 咨询: open an issue or contact the maintainers.
@@ -0,0 +1,53 @@
1
+ #!/usr/bin/env node
2
+ import path from 'node:path';
3
+ import { spawnSync } from 'node:child_process';
4
+ import { fileURLToPath } from 'node:url';
5
+
6
+ const REQUIRED_NODE = '22.12.0';
7
+
8
+ function versionParts(value) {
9
+ return value
10
+ .replace(/^v/, '')
11
+ .split('.')
12
+ .slice(0, 3)
13
+ .map((part) => Number.parseInt(part, 10) || 0);
14
+ }
15
+
16
+ function versionAtLeast(actual, expected) {
17
+ const left = versionParts(actual);
18
+ const right = versionParts(expected);
19
+ for (let index = 0; index < 3; index += 1) {
20
+ if (left[index] > right[index]) return true;
21
+ if (left[index] < right[index]) return false;
22
+ }
23
+ return true;
24
+ }
25
+
26
+ const actualNode = process.env.IHOW_MEMORY_TEST_NODE_VERSION || process.versions.node;
27
+ const command = process.argv[2] || 'help';
28
+
29
+ if (!versionAtLeast(actualNode, REQUIRED_NODE)) {
30
+ console.error('doctor: failed');
31
+ console.error(`- fail node: v${actualNode}`);
32
+ console.error(' hint: Install Node >= 22.12, then rerun: ihow-memory doctor.');
33
+ console.error(' example: nvm install 22 && nvm use 22');
34
+ console.error('- action sqlite: skipped until Node is upgraded');
35
+ console.error('cloud: disabled / local only');
36
+ if (command !== 'doctor') {
37
+ console.error(`command "${command}" was not started because this package requires Node >= 22.12.`);
38
+ }
39
+ process.exitCode = 1;
40
+ } else {
41
+ const packageDir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
42
+ const cliPath = path.join(packageDir, 'dist', 'cli.js');
43
+ const child = spawnSync(process.execPath, [cliPath, ...process.argv.slice(2)], {
44
+ stdio: 'inherit',
45
+ env: process.env,
46
+ });
47
+ if (child.error) {
48
+ console.error(`Unable to start iHow Memory: ${child.error.message}`);
49
+ process.exitCode = 1;
50
+ } else {
51
+ process.exitCode = child.status ?? 1;
52
+ }
53
+ }