n3memorycore-free-antigravity 1.9.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. n3memorycore_free_antigravity-1.9.2/LICENSE +190 -0
  2. n3memorycore_free_antigravity-1.9.2/NOTICE +4 -0
  3. n3memorycore_free_antigravity-1.9.2/PKG-INFO +462 -0
  4. n3memorycore_free_antigravity-1.9.2/README.md +427 -0
  5. n3memorycore_free_antigravity-1.9.2/n3memorycore_free_antigravity/__init__.py +3 -0
  6. n3memorycore_free_antigravity-1.9.2/n3memorycore_free_antigravity/core/__init__.py +0 -0
  7. n3memorycore_free_antigravity-1.9.2/n3memorycore_free_antigravity/core/database.py +422 -0
  8. n3memorycore_free_antigravity-1.9.2/n3memorycore_free_antigravity/core/processor.py +597 -0
  9. n3memorycore_free_antigravity-1.9.2/n3memorycore_free_antigravity/n3mc_hook.py +75 -0
  10. n3memorycore_free_antigravity-1.9.2/n3memorycore_free_antigravity/n3mc_stop_hook.py +81 -0
  11. n3memorycore_free_antigravity-1.9.2/n3memorycore_free_antigravity/n3memory.py +2708 -0
  12. n3memorycore_free_antigravity-1.9.2/n3memorycore_free_antigravity/paths.py +51 -0
  13. n3memorycore_free_antigravity-1.9.2/n3memorycore_free_antigravity.egg-info/PKG-INFO +462 -0
  14. n3memorycore_free_antigravity-1.9.2/n3memorycore_free_antigravity.egg-info/SOURCES.txt +32 -0
  15. n3memorycore_free_antigravity-1.9.2/n3memorycore_free_antigravity.egg-info/dependency_links.txt +1 -0
  16. n3memorycore_free_antigravity-1.9.2/n3memorycore_free_antigravity.egg-info/entry_points.txt +4 -0
  17. n3memorycore_free_antigravity-1.9.2/n3memorycore_free_antigravity.egg-info/requires.txt +11 -0
  18. n3memorycore_free_antigravity-1.9.2/n3memorycore_free_antigravity.egg-info/top_level.txt +1 -0
  19. n3memorycore_free_antigravity-1.9.2/pyproject.toml +56 -0
  20. n3memorycore_free_antigravity-1.9.2/setup.cfg +4 -0
  21. n3memorycore_free_antigravity-1.9.2/tests/test_antigravity_integration.py +727 -0
  22. n3memorycore_free_antigravity-1.9.2/tests/test_api.py +143 -0
  23. n3memorycore_free_antigravity-1.9.2/tests/test_database.py +163 -0
  24. n3memorycore_free_antigravity-1.9.2/tests/test_dataflow.py +44 -0
  25. n3memorycore_free_antigravity-1.9.2/tests/test_dedup_concurrent.py +37 -0
  26. n3memorycore_free_antigravity-1.9.2/tests/test_hooks.py +184 -0
  27. n3memorycore_free_antigravity-1.9.2/tests/test_hooks_encoding.py +52 -0
  28. n3memorycore_free_antigravity-1.9.2/tests/test_index_meta.py +204 -0
  29. n3memorycore_free_antigravity-1.9.2/tests/test_processor.py +113 -0
  30. n3memorycore_free_antigravity-1.9.2/tests/test_regressions.py +912 -0
  31. n3memorycore_free_antigravity-1.9.2/tests/test_review_2026_11_17.py +52 -0
  32. n3memorycore_free_antigravity-1.9.2/tests/test_review_part2.py +253 -0
  33. n3memorycore_free_antigravity-1.9.2/tests/test_safe_path.py +88 -0
  34. n3memorycore_free_antigravity-1.9.2/tests/test_search_port_2026_11_17.py +106 -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,4 @@
1
+ N3MemoryCore (N3MC)
2
+ Copyright 2026 NeuralNexusNote / ArnolfJp019
3
+
4
+ This product is part of the NeuralNexusNote project.
@@ -0,0 +1,462 @@
1
+ Metadata-Version: 2.4
2
+ Name: n3memorycore-free-antigravity
3
+ Version: 1.9.2
4
+ Summary: Persistent hybrid-search memory store for Antigravity (Free Edition)
5
+ Author: N3MemoryCore contributors
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/NeuralNexusNote/n3mc-free-Antigravity
8
+ Project-URL: Issues, https://github.com/NeuralNexusNote/n3mc-free-Antigravity/issues
9
+ Keywords: antigravity,gemini,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 :: Microsoft :: Windows
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ License-File: NOTICE
24
+ Requires-Dist: fastapi>=0.110
25
+ Requires-Dist: uvicorn>=0.27
26
+ Requires-Dist: pydantic>=2.0
27
+ Requires-Dist: sentence-transformers>=2.5
28
+ Requires-Dist: sqlite-vec>=0.1.6
29
+ Requires-Dist: uuid7>=0.1.0
30
+ Requires-Dist: psutil>=5.9
31
+ Provides-Extra: test
32
+ Requires-Dist: pytest>=7.0; extra == "test"
33
+ Requires-Dist: httpx>=0.27; extra == "test"
34
+ Dynamic: license-file
35
+
36
+ # N3MemoryCore Free for Antigravity (n3mc-free-Antigravity) v1.9.1
37
+
38
+ **Give Antigravity a memory that does not fade — free, on your own PC.**
39
+
40
+ Antigravity forgets what you were working on when you close the conversation.
41
+ N3MemoryCore saves every message and reply in a file on your own PC, and brings
42
+ the related ones back the next time you talk about the same thing. You do not
43
+ have to say "remember this", and Antigravity does not have to call a search
44
+ tool: the hooks do both on every turn.
45
+ Of the AI's memory, N3MC covers the **conversation history** layer (what was said, when, and in which conversation). It does not cover the rules that are always loaded, such as rule files, or connections to external tools.
46
+
47
+ 1. In File Explorer, create an empty folder
48
+ 2. Put the specification `N3MemoryCore_v1.9.1_Free_EN.md` into it (put nothing else in it)
49
+ 3. Open Antigravity in that folder
50
+ 4. Send: "Please implement N3MemoryCore according to the specification `N3MemoryCore_v1.9.1_Free_EN.md`."
51
+ 5. When it is done, restart Antigravity (see [Restart Antigravity](#4-restart-antigravity))
52
+
53
+ Memory works from the next session. The first run
54
+ downloads the search model (about 1.1 GB) once. Details: [Setup](#setup).
55
+ To install from PyPI instead (bonus), see [Method B: Install the package (bonus)](#method-b-install-the-package-bonus).
56
+
57
+ > **⚠️ Disclaimer**
58
+ >
59
+ > - **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.
60
+ > - **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.
61
+ > - **Backup first**: Always back up your current environment before running this on important projects.
62
+
63
+ > **⚠️ How long memories are kept, and data size**
64
+ >
65
+ > - **Memories are not deleted.** This edition has no feature that deletes old records.
66
+ > - **More data makes it slower.** The more records there are, the longer a search takes.
67
+
68
+ > A NeuralNexusNote™ product
69
+ >
70
+ > 🇯🇵 **[Click here for the Japanese Documentation (日本語版)](./README_JP.md)**
71
+ > 🛡️ **[Development Philosophy & AI-Native Policy](./PHILOSOPHY.md)**
72
+
73
+ ## How It Works
74
+
75
+ ```
76
+ User's message
77
+ │
78
+ ▼
79
+ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐
80
+ │ 1. Auto-save │────▶│ 2. Semantic │────▶│ 3. Context │
81
+ │ Save message │ │ search │ │ injection │
82
+ │ and reply │ │ Find related │ │ Feed to │
83
+ │ to DB │ │ memories │ │ Antigravity │
84
+ └──────────────┘ └──────────────┘ └──────────────┘
85
+ │
86
+ ▼
87
+ Antigravity responds
88
+ with full context
89
+ ```
90
+
91
+ Powered by Antigravity's hook system (`PreInvocation` and `Stop`). Everything happens automatically — no user action required.
92
+
93
+ - **What is saved** — every message you send and every reply of Antigravity, as written. A fenced code block is saved as `[code omitted]`: N3MC remembers what was said and decided, and the code is in your project's files.
94
+ - **What is recalled** — with every message, the hook searches the memory and adds the related records to Antigravity's context, before Antigravity reads your message.
95
+
96
+ ### Three scenes
97
+
98
+ > **Monday** — You and Antigravity decide to use PostgreSQL for the website, and say why.
99
+ >
100
+ > **Wednesday** — In a new conversation you ask which database you chose. Monday's decision and its reason arrive in Antigravity's context together with your question. You do not explain it again.
101
+ >
102
+ > **Friday** — You are working in another folder. When the subject comes up, Monday's decision is recalled there too: this edition keeps one memory for all your project folders.
103
+
104
+ ### What Antigravity receives
105
+
106
+ This is the block the hook added for the Wednesday question. It was captured from a real run of the hooks (a temporary data folder; the second conversation was started in a different folder from the first).
107
+
108
+ ```text
109
+ # Recalled Memory Context
110
+ Search query: Which database did we decide to use for the website, and why?
111
+
112
+ ## Top matches (use these to answer the question)
113
+
114
+ _If several versions of the same content appear, the one with the newest `saved` time is the current one._
115
+
116
+ ## [1] score=0.5283 saved=2026-11-23 16:32 (UTC+0900) antigravity
117
+ [user] Let's use PostgreSQL for the website's database. Several people will edit at the same time, and SQLite locks the whole file on every write.
118
+
119
+ ## Possibly related (weak matches — may be unrelated)
120
+
121
+ ## [2] score=0.3340 saved=2026-11-23 16:32 (UTC+0900) antigravity
122
+ [assistant] Agreed, PostgreSQL it is. The reason, for the record: several editors at the same time, and SQLite allows one writer at a time. Next step: write the schema for the articles table.
123
+
124
+ ## Previous matching Q-A exchanges (supplementary context)
125
+
126
+ ### turn_id: b2a9a033-af73-4cc3-b910-ae8c1a025df5 saved=2026-11-23 16:32 (UTC+0900)
127
+ [user] Let's use PostgreSQL for the website's database. Several people will edit at the same time, and SQLite locks the whole file on every write.
128
+ [assistant] Agreed, PostgreSQL it is. The reason, for the record: several editors at the same time, and SQLite allows one writer at a time. Next step: write the schema for the articles table.
129
+ ```
130
+
131
+ `Top matches` are the records that passed the relevance floors. `Possibly related` are the closest of the records that did not (see [Weak matches](#weak-matches-min_results)). The last part shows the whole exchange a top match belongs to.
132
+
133
+ ## About this project
134
+
135
+ 🛡️ AI-Native Development Policy
136
+ This project prioritizes Instructions over Static Code. Please read our [Development Philosophy](./PHILOSOPHY.md) to understand why you should let AI generate your execution environment.
137
+
138
+ This edition was made by rewriting the specification of [N3MC Free](https://github.com/NeuralNexusNote/n3mc-free) v1.9.1 (for Claude Code) for Antigravity, and generating the code from that specification. Saving and searching work as in the main Free; what differs is how the hooks are wired and the names.
139
+
140
+ **Two ways to set it up**: drop the specification into Antigravity and let it build the system (primary), or install the package with `pip install n3memorycore-free-antigravity` and run `n3mc-free-antigravity --init` (bonus). Either way, no manual hook editing. (See [Setup](#setup) below.)
141
+
142
+ ## How this edition relates to the main Free
143
+
144
+ N3MC Free has one edition per application. **For Antigravity, use this one.**
145
+
146
+ | | **This edition** | **[N3MC Free](https://github.com/NeuralNexusNote/n3mc-free)** (main) |
147
+ |---|---|---|
148
+ | Works with | Antigravity | Claude Code |
149
+ | Package | `n3memorycore-free-antigravity` | `n3memorycore-free` |
150
+ | Command | `n3mc-free-antigravity` | `n3mc` |
151
+ | Data folder | `~/.n3mc-free-antigravity` | `~/.n3mc` |
152
+ | Server port (default) | `18527` | `18520` |
153
+ | Where the hooks are registered | `~/.gemini/config/hooks.json` | `~/.claude/settings.json` |
154
+ | Rules file | `.agents/rules/n3mc-behavior.md` | `.claude/rules/n3mc-behavior.md` |
155
+ | Variable that moves the data | `N3MC_FREE_ANTIGRAVITY_HOME` | `N3MC_HOME` |
156
+
157
+ - **Both can be installed on one PC.** The names, the data folders and the ports all differ, so they do not collide.
158
+ - **As installed, the memories are separate.** This edition saves to its own database (`~/.n3mc-free-antigravity/.memory/n3memory.db`) and does not see the main Free's records.
159
+
160
+ ### Sharing one memory with Claude Code (connection mode)
161
+
162
+ Connect this edition to the main Free's resident server, and Antigravity and Claude Code use one database. Add these two settings to `~/.n3mc-free-antigravity/config.json`:
163
+
164
+ ```json
165
+ "connect_server_port": 18520,
166
+ "connect_server_root": "C:/Users/<your user name>/.n3mc"
167
+ ```
168
+
169
+ `connect_server_root` is the absolute path of the other side's data folder. This edition connects only when it matches the data folder the other server reports.
170
+
171
+ - **While connected** — saves and searches go to the other server. This edition's own database is not used. Antigravity's records carry `antigravity` as the agent that wrote them.
172
+ - **When the other server is not running** — this edition does not start it. A search shows "memory search unavailable", and your messages do not reach the database: they are kept only in `audit.log`. A `⚠️ N3MC notice` line in the recalled block tells you so.
173
+ - **Earlier records** — records saved in this edition's own database before you connected are not moved to the other database. This edition has no command that moves records.
174
+ - **Commands** — `--list`, `--show-turn` and `--recall-thread` read the other database read-only. Run `--repair` on the other side.
175
+
176
+ Remove the two settings to go back to standalone.
177
+
178
+ ### If you used an earlier Antigravity edition
179
+
180
+ The earlier Antigravity edition used the same names as the main Free (Python package `n3memorycore`, command `n3mc`, data folder `~/.n3mc`). This edition has its own names, so it has to be installed again.
181
+
182
+ - Run `pip install n3memorycore-free-antigravity` (or `pip install -e .` in this repository), then `n3mc-free-antigravity --init`.
183
+ - `--init` replaces the old entry (`n3memorycore`) in `~/.gemini/config/hooks.json` with the new one. If the old entry holds other commands, it is kept, and `--init` prints a line about it.
184
+ - Earlier records in `~/.n3mc` stay where they are. This edition sees them only in [connection mode](#sharing-one-memory-with-claude-code-connection-mode).
185
+
186
+ **This edition is not the right tool if:**
187
+
188
+ - you use an application other than Antigravity — for Claude Code, use the main [N3MC Free](https://github.com/NeuralNexusNote/n3mc-free);
189
+ - you want old records removed for you, or want to delete single records — this edition has no delete command;
190
+ - you want the same memory on two PCs — this edition keeps one file on one PC and does not synchronize it.
191
+
192
+ ---
193
+
194
+ ## Features
195
+
196
+ | You want to… | N3MemoryCore… | How |
197
+ |---|---|---|
198
+ | Stop explaining the same thing again | saves every message and reply, and recalls the related ones on every turn | Antigravity hooks (`PreInvocation`, `Stop`). No tool call, no manual step |
199
+ | Find things in your own words | finds a past conversation even when the exact words differ | Vector search with `intfloat/multilingual-e5-base` (Japanese, English, Chinese, Korean and ~100 other languages) plus keyword search |
200
+ | Pick up tomorrow where you left off | keeps the memory across conversations and across project folders | One database for every folder; the conversation you are in is ranked first |
201
+ | Keep your data at home | stores the memory in a file on your own PC, not in any cloud service | SQLite. Only the memories recalled for a turn are sent to the model, together with your message ([details](#your-memory-stays-on-your-pc)) |
202
+ | Keep the injected context short | does the search with local embeddings and injects only the related records | The recalled block is capped (`top_matches_max`, `min_results`) |
203
+ | Share one memory with Claude Code | connects to the main Free's resident server and keeps who wrote each record | [Connection mode](#sharing-one-memory-with-claude-code-connection-mode). `agent_name` is `antigravity` |
204
+
205
+ To use another embedding model, set it in `config.json` and run `n3mc-free-antigravity --reembed`; the model must produce 768-dimension vectors.
206
+
207
+ ## Your Memory Stays on Your PC
208
+
209
+ An AI that remembers you is convenient, but it is natural to ask where those memories are kept. N3MemoryCore keeps them in one place you control: a folder on your own PC.
210
+
211
+ - **One local file** — Every memory is stored in a single SQLite file, `~/.n3mc-free-antigravity/.memory/n3memory.db`. There is no N3MC account and no N3MC cloud service. To move it, set `N3MC_FREE_ANTIGRAVITY_HOME` (see [Optional: change where data lives](#optional-change-where-data-lives)).
212
+ - **The raw input is kept next to it** — `~/.n3mc-free-antigravity/.memory/audit.log` holds the input of every hook call. It is rotated at 50 MB, and `n3mc-free-antigravity --list` does not show it. Treat it as private data, like the database.
213
+ - **Search runs on your PC** — The embedding model and the search run locally. N3MC's server listens only on `127.0.0.1` and rejects requests for any other host name, so other machines on your network cannot reach it.
214
+ - **No telemetry** — N3MC sends no usage data anywhere. The code is open, so you can check this yourself.
215
+ - **You can see and remove everything** — `n3mc-free-antigravity --list` shows what is stored. Deleting `~/.n3mc-free-antigravity/` removes all of it (see [Uninstall](#uninstall)). Backing up is copying two files (see [Backup and restore](#backup-and-restore)).
216
+
217
+ What does go over the network:
218
+
219
+ - **The embedding model download** — On the first search, `intfloat/multilingual-e5-base` (about 1.1 GB) is downloaded from Hugging Face. After that, the Hugging Face library may still check for model updates when the model loads; set `HF_HUB_OFFLINE=1` to stop this once the model is downloaded.
220
+ - **What the model reads** — The memories recalled for a turn are added to that turn's context, so they are sent to the provider of the model Antigravity uses, together with your message, as everything you type into Antigravity is. N3MC does not upload your memory database anywhere, but the parts the model uses in a turn are part of that conversation.
221
+
222
+ ## Specification Files
223
+
224
+ | File | Description |
225
+ |---|---|
226
+ | `N3MemoryCore_v1.9.1_Free_JP.md` | Free edition, rewritten for Antigravity (Japanese) |
227
+ | `N3MemoryCore_v1.9.1_Free_EN.md` | Free edition, rewritten for Antigravity (English) |
228
+
229
+ The file names are the same as the main Free's specification files; the content is for Antigravity.
230
+
231
+ ## Setup
232
+
233
+ There are two ways to set it up. Method A, generating the code from the specification, is the primary one; Method B, installing the package, is a bonus. (The specification calls Method A "Path B — AI-Native Setup" and Method B "Path A — Quick Start with `pip`".)
234
+
235
+ ### Method A: Generate from the spec (primary, recommended)
236
+
237
+ Let Antigravity generate the code from the specification:
238
+
239
+ 1. **Make a folder**: in File Explorer, create one empty folder (for example `C:\Users\<you>\n3mc-free-antigravity`). The code is generated in this folder and stays in use after setup; do not delete or move it later.
240
+ 2. **Put the specification in it**: copy the specification `N3MemoryCore_v1.9.1_Free_EN.md` from the table above into that folder (put nothing else in it).
241
+ 3. **Open Antigravity in that folder**
242
+ 4. **Ask**: send "Please implement N3MemoryCore according to the specification `N3MemoryCore_v1.9.1_Free_EN.md`."
243
+
244
+ Antigravity shows the folder and asks you once to confirm it; then it writes the code, configures the hooks, and sets everything up. It stops instead if the folder holds other files, so that a project of yours is not overwritten.
245
+ Memory kicks in from the next session. The generated code stays in that folder: deleting or moving it later stops the memory.
246
+
247
+ ---
248
+
249
+ ### Method B: Install the package (bonus)
250
+
251
+ Use the reference build directly:
252
+
253
+ #### 1. Install
254
+
255
+ The simplest install — straight from PyPI (no clone needed):
256
+
257
+ ```bash
258
+ pip install n3memorycore-free-antigravity
259
+ ```
260
+
261
+ Or, if you want a local checkout to read / modify / contribute:
262
+
263
+ ```bash
264
+ git clone https://github.com/NeuralNexusNote/n3mc-free-Antigravity.git
265
+ cd n3mc-free-Antigravity
266
+ pip install -e . # editable install
267
+ ```
268
+
269
+ With the editable install, the hooks run the code from that folder: deleting or moving it later stops the memory.
270
+
271
+ Requirements: Python 3.10+. The first server start will download the embedding model (`intfloat/multilingual-e5-base`, about 1.1 GB) — expect a one-time delay of several minutes, depending on your connection.
272
+
273
+ #### 2. Connect to Antigravity
274
+
275
+ ```bash
276
+ n3mc-free-antigravity --init
277
+ ```
278
+
279
+ This command does what is needed to wire N3MC into Antigravity:
280
+
281
+ - Creates `~/.n3mc-free-antigravity/` (data lives here — DB, config, audit log, PID file).
282
+ - Writes `~/.n3mc-free-antigravity/config.json` with auto-generated `owner_id` / `local_id`.
283
+ - Registers the `PreInvocation` and `Stop` hooks in `~/.gemini/config/hooks.json` under the name `n3memorycore-free-antigravity`, pointing to the installed `n3mc-free-antigravity-hook` / `n3mc-free-antigravity-stop-hook`, each with a 120-second time limit. This file is a per-user setting, so the hooks fire in Antigravity opened on any folder.
284
+ - Leaves hooks of other programs alone.
285
+ - Backs up `hooks.json` (`hooks.json.bak-n3mc-<date-time>`) before changing it. If the file is not valid JSON, it changes nothing and tells you.
286
+ - Writes the rules file `.agents/rules/n3mc-behavior.md` into the folder where you ran the command (not when that folder is your home folder).
287
+
288
+ The command is idempotent: re-running it is safe and won't create duplicates.
289
+
290
+ #### 3. Verify the hook registration
291
+
292
+ Run this one-liner — it should print `OK`:
293
+
294
+ ```bash
295
+ python -c "import json,os; d=json.load(open(os.path.expanduser('~/.gemini/config/hooks.json'), encoding='utf-8')); e=d.get('n3memorycore-free-antigravity',{}); assert any('n3mc-free-antigravity-hook' in c.get('command','').lower() or 'n3memorycore_free_antigravity.n3mc_hook' in c.get('command','').lower() for c in e.get('PreInvocation',[])), 'PreInvocation hook missing'; assert any('n3mc-free-antigravity-stop-hook' in c.get('command','').lower() or 'n3memorycore_free_antigravity.n3mc_stop_hook' in c.get('command','').lower() for c in e.get('Stop',[])), 'Stop hook missing'; print('OK')"
296
+ ```
297
+
298
+ If you see an `AssertionError`, re-run `n3mc-free-antigravity --init`.
299
+
300
+ #### 4. Restart Antigravity
301
+
302
+ Quit Antigravity completely and start it again. An Antigravity that was open before `n3mc-free-antigravity --init` does not pick up the new hooks.
303
+
304
+ #### 5. Confirm it's working
305
+
306
+ In a new conversation, send any message. After Antigravity responds, run:
307
+
308
+ ```bash
309
+ n3mc-free-antigravity --list
310
+ ```
311
+
312
+ You should see at least two records — one that starts with `[user]` (your message) and one that starts with `[assistant]` (Antigravity's response). If the list is empty, jump to **Troubleshooting** below.
313
+
314
+ #### Optional: change where data lives
315
+
316
+ Set `N3MC_FREE_ANTIGRAVITY_HOME=/path/to/dir` to keep the data somewhere else. N3MC reads the variable every time it runs and does not store it, so set it **permanently**, where both Antigravity (which starts the hooks) and your terminal see it — for example as a user environment variable — before running `n3mc-free-antigravity --init`. If it is set only in the terminal where you ran `--init`, the hooks use `~/.n3mc-free-antigravity`.
317
+
318
+ ---
319
+
320
+ ### Troubleshooting (Method B)
321
+
322
+ **`n3mc-free-antigravity: command not found` after `pip install`**
323
+ Your Python `Scripts/` (Windows) or `bin/` (Linux) directory is not on `PATH`. Either add it to `PATH`, or invoke as `python -m n3memorycore_free_antigravity.n3memory --init` instead.
324
+
325
+ **`--list` shows zero records after a real conversation**
326
+ Antigravity was open **before** you ran `n3mc-free-antigravity --init`. Quit it completely and start it again.
327
+
328
+ **Hooks register, but nothing saves**
329
+ Check the audit log:
330
+ ```bash
331
+ cat ~/.n3mc-free-antigravity/.memory/audit.log | tail -3
332
+ ```
333
+ Each message should add JSON lines. If the file is empty, the hooks aren't firing — confirm Step 3's verification command prints `OK`.
334
+
335
+ **`n3mc-free-antigravity --search` returns nothing the first time, but works after**
336
+ The `intfloat/multilingual-e5-base` model is downloading (about 1.1 GB) on the first call. Wait for the download to finish, then retry.
337
+
338
+ **The recalled block says "memory search unavailable"**
339
+ You are in [connection mode](#sharing-one-memory-with-claude-code-connection-mode) and the other server is not running. Start Claude Code and send a message: that starts the main Free's server.
340
+
341
+ ### What to expect after setup
342
+
343
+ Once setup is complete, everything works automatically from the next session:
344
+ - Past conversations relevant to your current message are retrieved and injected automatically
345
+ - Antigravity responds with full context ("Regarding what we discussed last time...")
346
+ - Saving and searching happen in the background — no action needed on your part
347
+ - The Stop hook writes a small rules file, `.agents/rules/n3mc-behavior.md`, into each project folder you work in. It tells Antigravity how to read the recalled block; a file you edited by hand is not replaced
348
+
349
+ ### Tuning recall (vector_min_cos)
350
+
351
+ N3MC finds records whose meaning is close to your question with vector search.
352
+ `vector_min_cos` is the threshold for "how close is close enough to be a
353
+ candidate" (default 0.82; the specification's value is 0.85).
354
+
355
+ | If you | What happens |
356
+ |---|---|
357
+ | lower it (e.g. 0.80–0.83) | Records are found even when the wording differs, and short questions recall more. Less related records also come in, and the injected context gets longer |
358
+ | raise it (e.g. 0.88) | Fewer loosely related records and shorter injected context. Related records are also dropped more easily |
359
+
360
+ A sensible range is 0.80–0.88. Set it in `~/.n3mc-free-antigravity/config.json`,
361
+ e.g. `"vector_min_cos": 0.83`. It takes effect from the next question (the
362
+ server restarts automatically). If the file has a typo and cannot be read, it is
363
+ left untouched and N3MC runs with defaults until you fix it; a notice about this
364
+ appears at the top of the recalled context. Write numbers without quotes.
365
+
366
+ ### Search settings on by default
367
+
368
+ Four more settings keep unrelated records out of the recalled context. They are
369
+ the same as in the main Free and are on by default. They run on the CPU and
370
+ need no other model.
371
+
372
+ | Setting | Default | What it does | To turn it off |
373
+ |---|---|---|---|
374
+ | `fts_stopwords` | `true` | English function words (`the`, `is`, `of`, `who`, ...) are not used as keywords, so a question made of common words no longer matches almost every record | `false` |
375
+ | `kw_only_min_terms` | `3` | A record found by its keywords only (not close enough in meaning) goes under Top matches only when it contains 3 different words of the question. Otherwise it can still appear as a weak match | `0` |
376
+ | `top_matches_max` | `5` | At most 5 records under Top matches, so the recalled context stays short | `0` (then up to `search_result_limit`) |
377
+ | `cross_lang_min_cos` | `0.80` | A Japanese question can find an English record and the other way round: the closest record written in the other script counts as a match from this similarity on | `0` |
378
+
379
+ These settings are not in the specification (`N3MemoryCore_v1.9.1_Free_*.md`),
380
+ so code generated again from it does not have them. For the specification's
381
+ search exactly, write `"vector_min_cos": 0.85, "fts_stopwords": false,
382
+ "kw_only_min_terms": 0, "top_matches_max": 0, "cross_lang_min_cos": 0` in
383
+ `~/.n3mc-free-antigravity/config.json`.
384
+
385
+ ### Weak matches (min_results)
386
+
387
+ When fewer than 3 records pass the relevance floors, N3MC adds the closest
388
+ of the records it dropped, up to 3 in total, under a separate heading
389
+ `## Possibly related (weak matches — may be unrelated)`. Antigravity is told to
390
+ use them only when they are actually relevant. This keeps a question from
391
+ getting no memory at all, at the cost of up to 3 extra, mostly unrelated chunks
392
+ per turn. Set `"min_results": 0` in `~/.n3mc-free-antigravity/config.json` to
393
+ turn it off, or another number to change the count.
394
+
395
+ Old records are never hidden by their age: age only lowers their rank below
396
+ newer records of the same relevance.
397
+
398
+ ### Backup and restore
399
+
400
+ To migrate memories to another environment or keep a safe backup, save these 2 files
401
+ from `~/.n3mc-free-antigravity/`:
402
+ - `.memory/n3memory.db` — the memory database
403
+ - `config.json` — contains `owner_id` and `local_id` UUIDv4 keys
404
+
405
+ Keep these 2 files together: `config.json` holds the IDs that are stamped on the records in the database.
406
+
407
+ ### Uninstall
408
+
409
+ If you set up via Method A, ask Antigravity: "Please delete N3MemoryCore." — it also removes the hook configuration.
410
+
411
+ To do it yourself:
412
+
413
+ 1. Remove the `n3memorycore-free-antigravity` entry from `~/.gemini/config/hooks.json`, and restart Antigravity.
414
+ 2. Stop the memory server, which keeps running in the background: end the process whose command line contains `n3memorycore_free_antigravity.n3memory --run-server` (its PID is in `~/.n3mc-free-antigravity/.memory/n3mc.pid`), or restart the PC.
415
+ 3. Remove the package and the data:
416
+
417
+ ```bash
418
+ pip uninstall n3memorycore-free-antigravity
419
+ rm -rf ~/.n3mc-free-antigravity/ # delete data (irreversible)
420
+ ```
421
+
422
+ 4. `.agents/rules/n3mc-behavior.md` in your project folders, and the `hooks.json.bak-n3mc-*` backups next to `hooks.json`, can be deleted by hand.
423
+
424
+ ## ID Hierarchy
425
+
426
+ N3MemoryCore uses 6 ID fields to identify the origin and context of each record:
427
+
428
+ | ID | Stored in | Generated | Granularity | Purpose |
429
+ |---|---|---|---|---|
430
+ | `id` (PK) | DB record | Per record (UUIDv7, time-ordered) | **One record** | Unique identifier for each memory |
431
+ | `owner_id` | `config.json` | First startup (UUIDv4) | **Owner / data folder** | Identifies whose data this is |
432
+ | `local_id` | `config.json` / API | First startup (UUIDv4), or per request | **Install** | One install has one `local_id`; it is the same in every session. Stored on every record (in Free it is not used in ranking) |
433
+ | `session_id` | Supplied by Antigravity (`conversationId` in the hook input) | Per conversation | **One conversation** | Groups the memories of one conversation. Drives the `b_session` ranking bias (match=1.0, mismatch=0.6) so the ongoing exchange ranks above unrelated past conversations |
434
+ | `turn_id` | DB record | When your message is saved (UUIDv4) | **One exchange** | Ties one user message to the reply that answers it; `--show-turn` and `--recall-thread` take it |
435
+ | `agent_name` | DB record | Per save (free-form string) | **Display label** | Human-readable label of the writer (`"antigravity"` for the hooks). `--buffer --agent-id <name>` sets this field |
436
+
437
+ ```
438
+ owner_id (the data folder ~/.n3mc-free-antigravity and its owner)
439
+ └── local_id (the install; the same in every session)
440
+ └── session_id (one Antigravity conversation)
441
+ └── turn_id (one exchange: one user message and the reply to it)
442
+ └── id (one record = one chunk)
443
+
444
+ agent_name (a display label, outside the hierarchy: "antigravity" for the hooks)
445
+ ```
446
+
447
+ ## Requirements
448
+
449
+ - **Antigravity** (required; its hook system is used)
450
+ - **Python 3.10+**
451
+ - **OS**: Windows 11 and Ubuntu (tested). macOS is not supported.
452
+
453
+ > To check if Python is installed, run `python --version` in your terminal.
454
+
455
+ ## Extensibility
456
+
457
+ N3MemoryCore is built from a specification, so extending it is as simple as asking Antigravity: load the specification into Antigravity and say what you want to add. When you customize it, tell Antigravity where the specification is and ask it to update the specification too.
458
+
459
+ ---
460
+
461
+ Apache License 2.0 — Copyright (C) 2026 NeuralNexusNote™ / ArnolfJp019
462
+ See [LICENSE](./LICENSE) for details.