n3memorycore-free 1.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- n3memorycore_free-1.3.1/LICENSE +190 -0
- n3memorycore_free-1.3.1/NOTICE +4 -0
- n3memorycore_free-1.3.1/PKG-INFO +296 -0
- n3memorycore_free-1.3.1/README.md +263 -0
- n3memorycore_free-1.3.1/n3memorycore/__init__.py +7 -0
- n3memorycore_free-1.3.1/n3memorycore/core/__init__.py +0 -0
- n3memorycore_free-1.3.1/n3memorycore/core/database.py +308 -0
- n3memorycore_free-1.3.1/n3memorycore/core/processor.py +361 -0
- n3memorycore_free-1.3.1/n3memorycore/n3mc_hook.py +57 -0
- n3memorycore_free-1.3.1/n3memorycore/n3mc_stop_hook.py +59 -0
- n3memorycore_free-1.3.1/n3memorycore/n3memory.py +998 -0
- n3memorycore_free-1.3.1/n3memorycore/paths.py +46 -0
- n3memorycore_free-1.3.1/n3memorycore_free.egg-info/PKG-INFO +296 -0
- n3memorycore_free-1.3.1/n3memorycore_free.egg-info/SOURCES.txt +23 -0
- n3memorycore_free-1.3.1/n3memorycore_free.egg-info/dependency_links.txt +1 -0
- n3memorycore_free-1.3.1/n3memorycore_free.egg-info/entry_points.txt +4 -0
- n3memorycore_free-1.3.1/n3memorycore_free.egg-info/requires.txt +10 -0
- n3memorycore_free-1.3.1/n3memorycore_free.egg-info/top_level.txt +1 -0
- n3memorycore_free-1.3.1/pyproject.toml +54 -0
- n3memorycore_free-1.3.1/setup.cfg +4 -0
- n3memorycore_free-1.3.1/tests/test_api.py +210 -0
- n3memorycore_free-1.3.1/tests/test_database.py +208 -0
- n3memorycore_free-1.3.1/tests/test_hooks.py +175 -0
- n3memorycore_free-1.3.1/tests/test_hooks_encoding.py +126 -0
- n3memorycore_free-1.3.1/tests/test_processor.py +144 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding any notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 NeuralNexusNote / ArnolfJp019
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: n3memorycore-free
|
|
3
|
+
Version: 1.3.1
|
|
4
|
+
Summary: Persistent hybrid-search memory store for Claude Code (Free Edition)
|
|
5
|
+
Author: N3MemoryCore contributors
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/NeuralNexusNote/n3mc-free
|
|
8
|
+
Project-URL: Issues, https://github.com/NeuralNexusNote/n3mc-free/issues
|
|
9
|
+
Keywords: claude,claude-code,memory,rag,embedding,sqlite-vec
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
License-File: NOTICE
|
|
23
|
+
Requires-Dist: fastapi>=0.110
|
|
24
|
+
Requires-Dist: uvicorn>=0.27
|
|
25
|
+
Requires-Dist: pydantic>=2.0
|
|
26
|
+
Requires-Dist: sentence-transformers>=2.5
|
|
27
|
+
Requires-Dist: sqlite-vec>=0.1.6
|
|
28
|
+
Requires-Dist: uuid7>=0.1.0
|
|
29
|
+
Provides-Extra: test
|
|
30
|
+
Requires-Dist: pytest>=7.0; extra == "test"
|
|
31
|
+
Requires-Dist: httpx>=0.27; extra == "test"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# N3MemoryCore (N3MC)
|
|
35
|
+
> A NeuralNexusNote™ product
|
|
36
|
+
|
|
37
|
+
🛡️ AI-Native Development Policy
|
|
38
|
+
This project prioritizes Instructions over Static Code. Please read our Development Philosophy to understand why you should let AI generate your execution environment.
|
|
39
|
+
|
|
40
|
+
> 🇯🇵 **[Click here for the Japanese Documentation (日本語版)](./README_JP.md)**
|
|
41
|
+
> 🛡️ **[Development Philosophy & AI-Native Policy](./PHILOSOPHY.md)**
|
|
42
|
+
|
|
43
|
+
> I know Java and C#, but Python is completely new to me.
|
|
44
|
+
> The code Claude Code generated — I built it without fully understanding it.
|
|
45
|
+
>
|
|
46
|
+
> But I tested it, refined the specification, rebuilt it,
|
|
47
|
+
> and shipped both Japanese and English versions — Free and Pro.
|
|
48
|
+
>
|
|
49
|
+
> Because if I could do it, so can you.
|
|
50
|
+
>
|
|
51
|
+
> The first draft of the specification was written by Copilot.
|
|
52
|
+
> Claude Code turned it into working code. Gemini reviewed it.
|
|
53
|
+
> Iterated across three AIs — that process is N3MemoryCore.
|
|
54
|
+
|
|
55
|
+
N3MemoryCore gives Claude Code long-term memory across sessions.
|
|
56
|
+
**Two install paths supported**: drop the spec into Claude Code and let it build the system, or `pip install` the reference build and run `n3mc --init`. Either way, no manual hook editing. (See [Setup](#setup) below.)
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Features
|
|
61
|
+
|
|
62
|
+
- 💾 **Fully local** — Your conversations stay on your machine. Nothing sent to the cloud.
|
|
63
|
+
- 🔍 **Semantic search** — Finds relevant past conversations even when the exact words differ. Multilingual by default (`intfloat/multilingual-e5-base`) — works for Japanese, English, Chinese, Korean, and ~100 other languages out of the box. Swap to a language-specialised model via `config.json` if you need higher single-language precision.
|
|
64
|
+
- 🔄 **Persistent across sessions** — Pick up tomorrow where you left off today.
|
|
65
|
+
- ⚡ **Works automatically** — Saving and searching happen automatically. No manual steps needed.
|
|
66
|
+
- 🤖 **Multi-agent ready** — Multiple AI agents share one memory DB. Each agent prioritizes its own memories while accessing the team's collective knowledge.
|
|
67
|
+
- 🏢 **Team & organization support** — Deploy the server on your network and share memories across your entire team.
|
|
68
|
+
- 🔗 **DB merge ready** — Databases built from the same specification are fully compatible. Transfer knowledge when handing off roles, or import memories accumulated in other environments — the DB structure is designed for integration from the ground up.
|
|
69
|
+
- 💰 **Reduces token waste** — No more re-explaining past context. Memory search uses local embeddings (zero Claude tokens), and accurate context injection means fewer corrections and back-and-forth.
|
|
70
|
+
|
|
71
|
+
## How It Works
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
User's message
|
|
75
|
+
│
|
|
76
|
+
▼
|
|
77
|
+
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
|
|
78
|
+
│ 1. Auto-save │────▶│ 2. Semantic │────▶│ 3. Context │
|
|
79
|
+
│ Save last │ │ search │ │ injection │
|
|
80
|
+
│ response │ │ Find related │ │ Feed to │
|
|
81
|
+
│ to DB │ │ memories │ │ Claude │
|
|
82
|
+
└──────────────┘ └──────────────┘ └──────────────┘
|
|
83
|
+
│
|
|
84
|
+
▼
|
|
85
|
+
Claude responds
|
|
86
|
+
with full context
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Powered by Claude Code's hook system. Everything happens automatically — no user action required.
|
|
90
|
+
|
|
91
|
+
### Relationship with Claude's built-in auto-memory
|
|
92
|
+
|
|
93
|
+
Claude Code has a built-in auto-memory system (`~/.claude/projects/.../memory/`). N3MemoryCore **complements it rather than competing with it**.
|
|
94
|
+
|
|
95
|
+
| | Claude auto-memory | N3MemoryCore RAG |
|
|
96
|
+
|---|---|---|
|
|
97
|
+
| **Strengths** | Reliable, loads every session, great for fixed facts | Conversation context, detailed history |
|
|
98
|
+
| **Weaknesses** | Cannot capture conversation flow or context | Depends on search quality; not guaranteed to surface |
|
|
99
|
+
| **Best for** | User profile, folder paths, stable settings | Conversation threads, past decisions, reasoning |
|
|
100
|
+
|
|
101
|
+
**Recommended usage:**
|
|
102
|
+
- **Fixed information needed every session** (folder paths, user preferences) → save to auto-memory
|
|
103
|
+
- **Conversation context and history** (discussion threads, past decisions) → N3MemoryCore accumulates automatically
|
|
104
|
+
|
|
105
|
+
## Free vs Pro
|
|
106
|
+
|
|
107
|
+
| | Free | Pro |
|
|
108
|
+
|---|---|---|
|
|
109
|
+
| Core features (save, search, auto) | ✅ | ✅ |
|
|
110
|
+
| Refresh (dedup & update) | - | ✅ Auto-replaces outdated memories |
|
|
111
|
+
| Session/environment bias | - | ✅ Prioritizes recent & local context |
|
|
112
|
+
| GC (garbage collection) | - | ✅ Auto-cleanup of old memories |
|
|
113
|
+
| Import/Export | - | ✅ Data migration & sharing |
|
|
114
|
+
| Delete | - | ✅ Individual record deletion |
|
|
115
|
+
|
|
116
|
+
**Start with Free.** You can upgrade to Pro later using the Upgrade specification.
|
|
117
|
+
|
|
118
|
+
## Specification Files
|
|
119
|
+
|
|
120
|
+
| File | Description |
|
|
121
|
+
|---|---|
|
|
122
|
+
| `N3MemoryCore_v1.2.0_Free_JP.md` | Free edition (Japanese) |
|
|
123
|
+
| `N3MemoryCore_v1.2.0_Free_EN.md` | Free edition (English) |
|
|
124
|
+
|
|
125
|
+
> 💡 **A note on annotations in the specification**
|
|
126
|
+
> Throughout the specification file (Markdown), you'll find annotations describing the design intent behind each instruction — written to give you precise control over AI behavior. Before having Claude generate the code, take a moment to read through them. They contain more than just code: the logic behind how to work with AI effectively.
|
|
127
|
+
|
|
128
|
+
## Setup
|
|
129
|
+
|
|
130
|
+
There are two supported setup paths. Pick whichever fits your style.
|
|
131
|
+
|
|
132
|
+
### Path A — AI-Native Setup (canonical)
|
|
133
|
+
|
|
134
|
+
1. Pick a specification file from the table above
|
|
135
|
+
2. Drop the file into the Claude Code prompt
|
|
136
|
+
3. Say: "Please implement this."
|
|
137
|
+
|
|
138
|
+
That's it. Claude Code writes the code, configures the hooks, and sets everything up.
|
|
139
|
+
Setup takes roughly 15–30 minutes (varies by environment and model).
|
|
140
|
+
Memory kicks in from the next session.
|
|
141
|
+
|
|
142
|
+
### Path B — Quick Start with `pip`
|
|
143
|
+
|
|
144
|
+
If you'd rather skip the AI implementation step and use the reference build directly:
|
|
145
|
+
|
|
146
|
+
#### 1. Install
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
git clone https://github.com/NeuralNexusNote/n3mc-free.git
|
|
150
|
+
cd n3mc-free
|
|
151
|
+
pip install -e . # or pip install .
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Requirements: Python 3.10+. The first server start will download the embedding model (`intfloat/multilingual-e5-base`, ~470 MB) — expect a 2–10 minute one-time delay.
|
|
155
|
+
|
|
156
|
+
#### 2. Connect to Claude Code
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
n3mc --init
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
This single command does **everything** needed to wire N3MC into Claude Code:
|
|
163
|
+
|
|
164
|
+
- Creates `~/.n3mc/` (data lives here — DB, config, audit log, PID file).
|
|
165
|
+
- Writes `~/.n3mc/config.json` with auto-generated `owner_id` / `local_id`.
|
|
166
|
+
- Registers the `UserPromptSubmit` and `Stop` hooks in **your user-global** `~/.claude/settings.json`, pointing to the installed `n3mc-hook` / `n3mc-stop-hook` entry-point scripts. The "user-global" location is essential — it means hooks fire from **any** project directory, not just this repo.
|
|
167
|
+
|
|
168
|
+
The command is idempotent: re-running it is safe and won't create duplicates.
|
|
169
|
+
|
|
170
|
+
#### 3. Verify the hook registration
|
|
171
|
+
|
|
172
|
+
Run this one-liner — it should print `OK`:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
python -c "import json,os; s=json.load(open(os.path.expanduser('~/.claude/settings.json'))); h=s.get('hooks',{}); assert any('n3mc' in c.get('command','').lower() for e in h.get('UserPromptSubmit',[]) for c in e.get('hooks',[])), 'UserPromptSubmit hook missing'; assert any('n3mc' in c.get('command','').lower() for e in h.get('Stop',[]) for c in e.get('hooks',[])), 'Stop hook missing'; print('OK')"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
If you see `OK`, the hooks are registered correctly. If you see an `AssertionError`, re-run `n3mc --init`.
|
|
179
|
+
|
|
180
|
+
#### 4. Restart Claude Code
|
|
181
|
+
|
|
182
|
+
Close **every** running Claude Code session (terminal CLI windows, IDE extensions like VS Code's "Claude Code" panel, etc.) and start a fresh one. Hooks are read at session startup; sessions started before `n3mc --init` will not pick up the new hooks.
|
|
183
|
+
|
|
184
|
+
#### 5. Confirm it's working
|
|
185
|
+
|
|
186
|
+
In a fresh Claude Code session, send any message. After Claude responds, run:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
n3mc --list
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
You should see at least two records — one with a `[user]` prefix (your message) and one with a `[claude]` prefix (Claude's response). If the list is empty, jump to **Troubleshooting** below.
|
|
193
|
+
|
|
194
|
+
#### Optional: change where data lives
|
|
195
|
+
|
|
196
|
+
Override the data location by setting `N3MC_HOME=/path/to/dir` before running `n3mc --init` (the chosen path is then permanent for that install).
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
### Troubleshooting (Path B)
|
|
201
|
+
|
|
202
|
+
**`n3mc: command not found` after `pip install`**
|
|
203
|
+
Your Python `Scripts/` (Windows) or `bin/` (macOS/Linux) directory is not on `PATH`. Either add it to `PATH`, or invoke as `python -m n3memorycore.n3memory --init` instead.
|
|
204
|
+
|
|
205
|
+
**`--list` shows zero records after a real conversation**
|
|
206
|
+
You opened the Claude Code session **before** running `n3mc --init`. Close it completely and open a new session — hooks are loaded at session start.
|
|
207
|
+
|
|
208
|
+
**Hooks register, but nothing saves**
|
|
209
|
+
Check the audit log:
|
|
210
|
+
```bash
|
|
211
|
+
cat ~/.n3mc/.memory/audit.log | tail -3
|
|
212
|
+
```
|
|
213
|
+
Each user prompt should produce one JSON line. If the file is empty, the hooks aren't firing — confirm Step 3's verification command prints `OK`, and confirm `~/.claude/settings.json` (user-global, not project-local) was the file modified.
|
|
214
|
+
|
|
215
|
+
**`n3mc --search` returns nothing the first time, but works after**
|
|
216
|
+
The `intfloat/multilingual-e5-base` model is downloading (~470 MB) on the first call. Wait 2–10 minutes for the download to finish, then retry.
|
|
217
|
+
|
|
218
|
+
### What to expect after setup
|
|
219
|
+
|
|
220
|
+
Once setup is complete, everything works automatically from the next session:
|
|
221
|
+
- Past conversations relevant to your current message are retrieved and injected automatically
|
|
222
|
+
- Claude responds with full context ("Regarding what we discussed last time...")
|
|
223
|
+
- Saving and searching happen in the background — no action needed on your part
|
|
224
|
+
|
|
225
|
+
### Backup and restore
|
|
226
|
+
|
|
227
|
+
To migrate memories to another environment or keep a safe backup, save these 2 files
|
|
228
|
+
from `~/.n3mc/`:
|
|
229
|
+
- `.memory/n3memory.db` — the memory database
|
|
230
|
+
- `config.json` — contains `owner_id` and `local_id` UUIDv4 keys
|
|
231
|
+
|
|
232
|
+
These 2 files must be kept together. If the keys don't match, owner verification will fail.
|
|
233
|
+
|
|
234
|
+
### Uninstall
|
|
235
|
+
|
|
236
|
+
```bash
|
|
237
|
+
pip uninstall n3memorycore-free
|
|
238
|
+
rm -rf ~/.n3mc/ # delete data (irreversible)
|
|
239
|
+
# Then manually remove the hook entries from ~/.claude/settings.json.
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
Or, if you set up via Path A, ask Claude Code: "Please uninstall N3MemoryCore."
|
|
243
|
+
|
|
244
|
+
## ID Hierarchy
|
|
245
|
+
|
|
246
|
+
N3MemoryCore uses 5 ID fields to identify the origin and context of each record:
|
|
247
|
+
|
|
248
|
+
| ID | Stored in | Generated | Granularity | Purpose |
|
|
249
|
+
|---|---|---|---|---|
|
|
250
|
+
| `id` (PK) | DB record | Per record (UUIDv7, time-ordered) | **One record** | Unique identifier for each memory — used for deletion and dedup |
|
|
251
|
+
| `owner_id` | `config.json` | First startup (UUIDv4) | **Owner / N3MC server** | Identifies whose data this is — for shared/multi-user scenarios and import provenance |
|
|
252
|
+
| `session_id` | In-memory or supplied by host | Per task / project / conversation (UUIDv4) | **Task / project / conversation** | Groups memories that belong to one task / project / conversation. In Free, drives the `b_session` ranking bias (match=1.0, mismatch=0.6) so the ongoing exchange ranks above unrelated past sessions |
|
|
253
|
+
| `local_id` (agent_id) | `config.json` / API | First startup (UUIDv4), or per request | **Agent / install** | UUIDv4 identifier for the speaking agent. Each agent gets its own UUID in multi-agent setups (in Free, stored but not used in ranking; `b_local` is a Pro feature) |
|
|
254
|
+
| `agent_name` | DB record | Per buffer call (free-form string) | **Agent display name** | Human-readable label for the agent (e.g. `"claude-code"`) |
|
|
255
|
+
|
|
256
|
+
```
|
|
257
|
+
owner_id (one N3MC server / data owner)
|
|
258
|
+
└── session_id (one task / project / conversation)
|
|
259
|
+
└── local_id (the speaking agent within that session)
|
|
260
|
+
├── agent_name (its display name: "claude-code", etc.)
|
|
261
|
+
└── id (one memory record)
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
## Requirements
|
|
265
|
+
|
|
266
|
+
- **Claude Code** (required)
|
|
267
|
+
- **Python 3.10+**
|
|
268
|
+
- **OS**: Windows 11 (tested) / macOS and Linux (designed for, but not yet verified)
|
|
269
|
+
|
|
270
|
+
> To check if Python is installed, run `python --version` in your terminal.
|
|
271
|
+
> If missing, Claude Code will guide you during setup.
|
|
272
|
+
|
|
273
|
+
## Extensibility
|
|
274
|
+
|
|
275
|
+
N3MemoryCore is built from a specification, so extending it is as simple as asking Claude Code.
|
|
276
|
+
|
|
277
|
+
- **MCP server** — Expose N3MC as an MCP server so other AI tools can access the memory
|
|
278
|
+
- **PostgreSQL migration** — Move from SQLite to PostgreSQL + pgvector for team-scale deployments
|
|
279
|
+
- **Custom search logic** — Tune bias coefficients and ranking formulas
|
|
280
|
+
- **Alternative embedding models** — Swap in a different model to suit your use case
|
|
281
|
+
- **Custom ID fields** — Add fields like `project_id` or `tag` to organize memories your way
|
|
282
|
+
- **PDF import** — Extract text from PDF files and store them as searchable memories
|
|
283
|
+
- **Hashtag support** — Claude auto-tags memories with `#hashtags` for filtered search (e.g. `--search "#AWS"`) — works with existing FTS, no DB changes needed
|
|
284
|
+
|
|
285
|
+
Just load the specification into Claude Code and say what you want to add.
|
|
286
|
+
|
|
287
|
+
## ⚠️ Disclaimer
|
|
288
|
+
|
|
289
|
+
- **No support, no claims**: This project is provided as-is with no support. Questions, bug reports, and feature requests are not guaranteed a response. Use entirely at your own discretion.
|
|
290
|
+
- **Use at your own risk**: This system runs on AI-generated code. The author is not responsible for any data changes or issues caused by its use.
|
|
291
|
+
- **Backup first**: Always back up your current environment before running this on important projects.
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
Apache License 2.0 — Copyright (C) 2026 NeuralNexusNote™ / ArnolfJp019
|
|
296
|
+
See [LICENSE](./LICENSE) for details.
|