@jokab1074/rememberme 0.0.0-stage → 0.22.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.
Files changed (44) hide show
  1. package/ARCHITECTURE.md +787 -0
  2. package/LICENSE +201 -0
  3. package/README.en.md +441 -0
  4. package/README.md +459 -2
  5. package/dist/mcp/index.js +37287 -0
  6. package/package.json +67 -4
  7. package/server.json +38 -0
  8. package/settings.json.example +7 -0
  9. package/src/bigfive.ts +163 -0
  10. package/src/bootstrap.ts +104 -0
  11. package/src/classify.ts +186 -0
  12. package/src/compact.ts +225 -0
  13. package/src/context-file.ts +305 -0
  14. package/src/embedded-proactive.ts +214 -0
  15. package/src/evolution/access-tracker.ts +118 -0
  16. package/src/evolution/curator.ts +220 -0
  17. package/src/evolution/lifecycle.ts +175 -0
  18. package/src/feedback-detector.ts +177 -0
  19. package/src/i18n.ts +89 -0
  20. package/src/index.ts +1479 -0
  21. package/src/loop.ts +396 -0
  22. package/src/mcp/build.ts +64 -0
  23. package/src/mcp/config.ts +108 -0
  24. package/src/mcp/index.ts +66 -0
  25. package/src/mcp/instructions.ts +43 -0
  26. package/src/mcp/logger.ts +32 -0
  27. package/src/mcp/provider.ts +142 -0
  28. package/src/mcp/server.ts +52 -0
  29. package/src/mcp/tools/memory.ts +126 -0
  30. package/src/mcp/tools/profile.ts +67 -0
  31. package/src/mcp/tools/record-turn.ts +239 -0
  32. package/src/memory-extract.ts +390 -0
  33. package/src/memory.ts +790 -0
  34. package/src/persona-init.ts +153 -0
  35. package/src/persona-learner.ts +349 -0
  36. package/src/proactive.ts +557 -0
  37. package/src/profile.ts +1008 -0
  38. package/src/prompt.ts +288 -0
  39. package/src/provider.ts +292 -0
  40. package/src/reflection.ts +552 -0
  41. package/src/sessions.ts +140 -0
  42. package/src/timeline.ts +208 -0
  43. package/src/utils.ts +91 -0
  44. package/src/web.ts +624 -0
package/LICENSE ADDED
@@ -0,0 +1,201 @@
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 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 tracking or otherwise improving the Work,
59
+ but excludes 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 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 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 those 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 alternative 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 describing the origin of the Work and
141
+ 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 Support. While redistributing the Work or
166
+ Derivative Works thereof, You may choose to offer, and charge a
167
+ fee for, acceptance of support, warranty, indemnity, or other
168
+ liability obligations and/or rights consistent with this License.
169
+ However, in accepting such obligations, You may act only on Your
170
+ own behalf and on Your sole responsibility, not on behalf of any
171
+ other Contributor, and only if You agree to indemnify, defend,
172
+ and hold each Contributor harmless for any liability incurred by,
173
+ or claims asserted against, such Contributor by reason of your
174
+ accepting any such warranty or support.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 EmoTalk Contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.en.md ADDED
@@ -0,0 +1,441 @@
1
+ # RememberMe
2
+
3
+ [English](README.en.md) | [中文](README.md)
4
+
5
+ > **RememberMe MCP is live** — see the [MCP server (as a memory backend)](#mcp-server-as-a-memory-backend) section.
6
+
7
+ > An AI companion that **actually remembers you**. Switch models, switch platforms, close and reopen — it still knows who you are, what you like, and what you've been through.
8
+
9
+ ---
10
+
11
+ ## What is this
12
+
13
+ **It remembers you**.
14
+
15
+ Not the polite "we have your account on file" kind. It actually persists — as local data — **who you are, what you like, and what you've been through**. Come back six months later, ask "do you remember me?", and it picks up from the topic you left mid-sentence.
16
+
17
+ This isn't the "start over every time" experience of generic chatbots. RememberMe's core promise: **all the context it builds about you persists across sessions, across interfaces, across models**.
18
+
19
+ - **Remembers who you are** — your name, occupation, life stage, location, the topics on your mind
20
+ - **Remembers what you like** — preferences grow from your real feedback, not developer-imposed defaults like "users prefer concise replies"
21
+ - **Remembers what you've been through** — recurring emotional patterns are named and kept (`work-burnout`, `life-aversion` — not just a daily mood log)
22
+ - **Remembers what you talked about** — six months later, the conversation context is still there
23
+
24
+ Provides a **web interface** (default), a **CLI interface**, and an **MCP server** — so Claude Code, Claude Desktop, Cursor and other AIs can use your long-term memory directly.
25
+
26
+ ---
27
+
28
+ ## 🧠 How it remembers you
29
+
30
+ > Strictly speaking, RememberMe is a **context orchestrator** — it composes your profile, memories, emotional patterns, and conversation history into a system prompt that's better tuned to *this* moment, so that the same LLM performs noticeably better with you than it does in a generic chat window. It doesn't plan or act on its own; when you want *other* AIs to share this memory, the same store is also exposed as an MCP server (see below).
31
+
32
+ ### Your profile lives in local markdown files
33
+
34
+ - **Who you are** (basic info) — name, occupation, location, stored as fields in `data/profile/PROFILE.md`
35
+ - **What you like** (preferences + communication style) — grown from your real feedback, not predefined "length / tone / depth / format" dimensions
36
+ - **What you've been through** (events + emotional patterns) — recurring emotional reactions stored as `emotion`-type memories, only kept when ≥2 pieces of evidence exist
37
+
38
+ Every entry is a **plain text file** — you can open it in any editor, read it, modify it.
39
+
40
+ ### Come back six months later, it still remembers
41
+
42
+ - The topic you left mid-sentence
43
+ - Your emotional patterns ("you always get anxious when talking about work", not "you're feeling off today")
44
+ - Your preferences (you said "don't reply too long" — now it replies briefly)
45
+ - Across sessions, across interfaces (CLI ↔ Web), across models (Claude / DeepSeek / GPT-4) — same memory
46
+
47
+ ### On privacy: two boundaries to be clear about
48
+
49
+ - ✅ **Local data**: your profile, memories, reflections, and feedback-learned observations only live in `data/`, covered by `.gitignore`. RememberMe does not upload them to any RememberMe-controlled server.
50
+ - ⚠️ **LLM calls**: to work, RememberMe has to send conversation content to the LLM provider you configured (Anthropic / DeepSeek / OpenAI / etc.). RememberMe itself does not store conversations outside your local disk, but **you have to trust your LLM provider** — this is a constraint shared by every LLM-based application.
51
+
52
+ ---
53
+
54
+ ## Core Features
55
+
56
+ ### 🧠 Multi-layer memory
57
+ Not just "what you said" — it distinguishes "which are recurring emotional patterns" from "which are life events that actually affect you" from "which are external resources."
58
+ - `emotion` — recurring patterns (requires ≥2 evidence)
59
+ - `event` — life events with emotional impact
60
+ - `reference` — external resources (doctor/therapist/contact)
61
+
62
+ ### 👤 User profile
63
+ Automatically accumulates 6 dimensions of long-term info: basic info, communication style, topics of interest, preferences & taboos, emotional baseline, recent changes.
64
+
65
+ ### 🪞 Daily reflection
66
+ The background process reads your emotional timeline, recent memories, and profile, then distills them into "today's insights" — over time, the AI knows you better and better.
67
+
68
+ ### 🌊 Big-Five persona (OCEAN)
69
+ No more hardcoded personas. On a new session, you describe the persona you want in one sentence ("Socrates", "gentle older sister", "brutally honest buddy"), and the LLM translates it into 5 numeric dimensions (Openness / Conscientiousness / Extraversion / Agreeableness / Neuroticism) + a free-text preferences string. **Per-session**, persisted to `data/personality/{sessionId}.json`.
70
+
71
+ ### 🪄 Auto-learn your preferences
72
+ Feedback you give in conversation ("don't reply too long," "don't use emoji," "call me Lao Wang") is auto-classified as positive/negative/neutral, extracted into natural-language observations, and accumulated in `data/learned-prefs/default.json`. Each next reply's system prompt carries these observations as soft hints (not hard rules).
73
+
74
+ ### 💬 Per-session conversations
75
+ Each session is persisted to `data/sessions/` with persona + history + title. Click any session in the left sidebar to switch.
76
+
77
+ ### 📝 Pure Markdown config
78
+ Profile, memories, and reflections are all `.md` files. **No YAML, no JSON config** (except runtime data).
79
+
80
+ ### 🌐 Web interface (default)
81
+ Default launches a Bun.serve() HTTP server. Open `http://localhost:3000` to use. SSE streaming + live status bar.
82
+
83
+ ### 🔌 MCP server (as a memory backend)
84
+ The same memory store is also packaged as an MCP server, so any MCP client — Claude Code, Claude Desktop, Cursor, VS Code — can read and write your long-term memory. Four tools: three reads (`list_memories` / `read_memory` / `read_profile`) and one write (`record_turn`). Details in the [MCP server](#mcp-server-as-a-memory-backend) section below.
85
+
86
+ ---
87
+
88
+ ## Quick Start
89
+
90
+ ```bash
91
+ # 1. Install deps (need bun ≥ 1.1)
92
+ bun install
93
+
94
+ # 2. Set API key (any one, Anthropic recommended)
95
+ export ANTHROPIC_API_KEY=sk-ant-xxx
96
+ # or (OpenAI-compatible: DeepSeek/Moonshot/self-hosted)
97
+ export OPENAI_API_KEY=sk-xxx
98
+
99
+ # 3. Launch (web by default)
100
+ bun run start # → http://localhost:3000
101
+ bun run repl # → CLI mode (src/index.ts)
102
+ ```
103
+
104
+ Or put your API key in `settings.json` (Anthropic SDK format, gitignored):
105
+
106
+ ```json
107
+ {
108
+ "env": {
109
+ "ANTHROPIC_API_KEY": "sk-ant-your-key-here",
110
+ "ANTHROPIC_BASE_URL": "https://api.deepseek.com/anthropic",
111
+ "ANTHROPIC_MODEL": "deepseek-v4-flash"
112
+ }
113
+ }
114
+ ```
115
+
116
+ First launch auto-creates `data/profile/PROFILE.md` and `data/sessions/`. Start chatting.
117
+
118
+ ---
119
+
120
+ ## How to use
121
+
122
+ ### Web version (default)
123
+
124
+ Visit `http://localhost:3000`:
125
+ - Left sidebar: session list (+ new conversation), persona init entry, model input, clear/export buttons
126
+ - Right area: chat message stream + input
127
+ - Enter to send, Shift+Enter for newline
128
+ - Status bar shows: `Thinking... (N chars, Ns)` → `Ready (N s)`
129
+ - **New session + persona init**: click "+ New conversation" → modal pops up → describe the persona you want ("Socrates") → LLM converts to OCEAN values + free-text preferences → saved to `data/personality/{sessionId}.json`
130
+ - **Switch session**: click any item in the left list → load that conversation instantly (persona switches with the session)
131
+ - **Switch model**: type new model name in input field → click "Apply"
132
+
133
+ > New sessions start with one-sentence persona generation → OCEAN; if you skip, you get the default neutral persona (all OCEAN 0.5).
134
+
135
+ ### CLI mode
136
+
137
+ ```bash
138
+ bun run repl
139
+ ```
140
+
141
+ #### REPL commands
142
+
143
+ | Command | What it does |
144
+ |---|---|
145
+ | Just type | Start chatting |
146
+ | `/persona show` | Show current OCEAN persona + preferences |
147
+ | `/persona init <one-sentence description>` | Use LLM to generate OCEAN for current session (prompted on first launch) |
148
+ | `/persona describe <text>` | Edit `preferences` without calling LLM |
149
+ | `/persona reset` | Reset persona to neutral default (all 0.5) |
150
+ | `/session list` | List all sessions (most-recent-active first) |
151
+ | `/session current` | Show current session details (id + title + history length + persona) |
152
+ | `/session new [description]` | Create new session (optionally init persona immediately; CLI and web share session data) |
153
+ | `/session switch <id>` | Switch to a specific session (save current → load target → reload persona) |
154
+ | `/session save` | Manually save current session (also auto-saved on exit) |
155
+ | `/session delete <id>` | Delete a session + its persona file (cannot delete the current one) |
156
+ | `/memory list` / `read <name>` / `types` / `save <type> <name> <desc>` | Memory management (2 main + 1 minor types) |
157
+ | `/memory auto <on\|off\|status>` | Auto-extract toggle (default on) |
158
+ | `/memory suggest` | Manually trigger an extraction |
159
+ | `/timeline` / `/timeline stats` | Emotional trajectory / stats |
160
+ | `/profile` / `/profile path` / `/profile scan` / `/profile reset` | User profile management |
161
+ | `/learner` / `/learner reset` | Persona learner status |
162
+ | `/reflect [days]` | Manually trigger reflection (default: 7-day lookback) |
163
+ | `/reflections list` / `read <date>` | Browse reflection history |
164
+ | `/stats` | Session stats (with compact recommendation) |
165
+ | `/compact` | Manually compact history |
166
+ | `/quiet` | Toggle `[emotion: ...]` debug labels |
167
+ | `/clear` | Clear current session history |
168
+ | `/help` | Full help |
169
+ | `/quit` | Exit (auto-saves current session) |
170
+
171
+ ### CLI & Web share sessions
172
+
173
+ `data/sessions/` is shared between CLI and web:
174
+ - Chat on web → start CLI → CLI auto-loads the most recent session with real conversation
175
+ - Chat on CLI → quit web → restart web → web loads the same session
176
+ - Switch sessions with `/session switch <id>` (CLI) or the left sidebar (web)
177
+
178
+ ### MCP server (as a memory backend)
179
+
180
+ Mount RememberMe on any MCP client (Claude Code / Claude Desktop / Cursor / VS Code …) and **other AIs** get your long-term memory too.
181
+
182
+ Four tools:
183
+
184
+ | Tool | Type | What it does |
185
+ |---|---|---|
186
+ | `list_memories` | read | List all memories (name + description + date) |
187
+ | `read_memory` | read | Fetch one memory in full |
188
+ | `read_profile` | read | Read the 6 sections of the user profile |
189
+ | `record_turn` | **write** | The host says "this turn is worth keeping"; the memory system decides what to write |
190
+
191
+ **Design**: the host model only decides *whether* a turn is worth recording. Extraction and pattern induction run server-side using RememberMe's original rubric, so the **type judgment and pattern quality are identical** to the web/CLI paths (same `extractMemoryCandidates()`).
192
+
193
+ <details>
194
+ <summary><b>Use it from your local Claude Code (development build)</b></summary>
195
+
196
+ ```bash
197
+ # 1. Build (re-run after changing src/mcp/)
198
+ bun install
199
+ bun run build:mcp
200
+
201
+ # 2. Register with Claude Code (-s local = this project only, stored in ~/.claude.json)
202
+ # Replace <REPO> with your absolute repo path
203
+ claude mcp add rememberme -s local \
204
+ -e REMEMBERME_DATA_DIR=<REPO>/data \
205
+ -- node <REPO>/dist/mcp/index.js
206
+
207
+ # 3. Verify
208
+ claude mcp list # should show rememberme ... ✔ Connected
209
+ ```
210
+
211
+ Then **restart Claude Code** (MCP tools are loaded at session start). The tools appear as `mcp__rememberme__list_memories` and friends.
212
+
213
+ Swap `-s local` for `-s user` to make it available in every project.
214
+
215
+ > ⚠️ **Scope decides where it works**: `claude mcp list` only shows the local entry of the project you're currently in, plus global user entries. With `-s local` you must `cd` into the repo root to see it; from anywhere else it prints "No MCP servers configured". A local entry with the same name **shadows** the user entry — check which scope you're looking at when debugging.
216
+ >
217
+ > **`REMEMBERME_DATA_DIR` must be an absolute path.** Without it the server falls back to `~/.rememberme/data` and won't see this repo's `data/`. Resolution order: `REMEMBERME_DATA_DIR` → `dataDir` in `settings.json` → `~/.rememberme/data`.
218
+ >
219
+ > You can also run straight from source (changes take effect immediately, no rebuild):
220
+ > ```bash
221
+ > claude mcp add rememberme-dev -s local \
222
+ > -e REMEMBERME_DATA_DIR=<REPO>/data \
223
+ > -- bun run <REPO>/src/mcp/index.ts
224
+ > ```
225
+
226
+ </details>
227
+
228
+ <details>
229
+ <summary><b>Install with npx (after publish)</b></summary>
230
+
231
+ The npm package name is **`@jokab1074/rememberme`**:
232
+
233
+ ```bash
234
+ claude mcp add rememberme -s user -- npx -y @jokab1074/rememberme
235
+ ```
236
+
237
+ The published package carries an `mcpName` field (`io.github.SoHardToMakeAName/RememberMe`) used for [MCP Registry](https://registry.modelcontextprotocol.io) ownership verification; the manifest is the `server.json` at the repo root.
238
+
239
+ **First run needs an API key.** The MCP server looks for configuration in this order:
240
+
241
+ ```
242
+ 1. REMEMBERME_SETTINGS environment variable
243
+ 2. ~/.rememberme/settings.json
244
+ 3. <package dir>/../settings.json
245
+ ```
246
+
247
+ An npm install lives in `node_modules/`, so step 3 won't find your repo's `settings.json` — only `~/.rememberme/settings.json` is left. Create it (see `settings.json.example` for the format):
248
+
249
+ ```json
250
+ {
251
+ "env": {
252
+ "ANTHROPIC_API_KEY": "sk-ant-your-key",
253
+ "ANTHROPIC_BASE_URL": "https://api.anthropic.com",
254
+ "ANTHROPIC_MODEL": "claude-sonnet-4-5-20250929"
255
+ }
256
+ }
257
+ ```
258
+
259
+ Or point it at a config you already have:
260
+
261
+ ```bash
262
+ claude mcp add rememberme -s user \
263
+ -e REMEMBERME_SETTINGS=/path/to/settings.json \
264
+ -- npx -y @jokab1074/rememberme
265
+ ```
266
+
267
+ Without a key the three read tools still work, and `record_turn` tells you exactly where to configure it:
268
+
269
+ > Unable to extract memory: no usable LLM config.
270
+ > No API key configured. Set ANTHROPIC_API_KEY in ~/.rememberme/settings.json or the project settings.json…
271
+
272
+ **Data directory**: the npm build defaults to `~/.rememberme/data` (memories in `~/.rememberme/data/memory/`, profile at `~/.rememberme/data/profile/PROFILE.md`) — the coherent location for a globally-installed npm package. Point `REMEMBERME_DATA_DIR` at an absolute path to change it.
273
+
274
+ </details>
275
+
276
+ **Read-only mode** (don't want the server calling an LLM / spending quota):
277
+
278
+ ```bash
279
+ REMEMBERME_MCP_DISABLE_LLM=1 # leaves the 3 read tools; record_turn returns a clear error
280
+ ```
281
+
282
+ > The MCP server implementation lives in [`src/mcp/`](src/mcp/);
283
+ > see [`ARCHITECTURE.md`](ARCHITECTURE.md) for the overall design.
284
+
285
+ ---
286
+
287
+ ## How the persona works (OCEAN)
288
+
289
+ ### Big Five (OCEAN)
290
+
291
+ The academically validated 5-dimension model (each 0-1):
292
+
293
+ | Dimension | Meaning | High score |
294
+ |---|---|---|
295
+ | **Openness** | Imagination, curiosity, abstract thinking | Loves new ideas, cross-domain connections |
296
+ | **Conscientiousness** | Organization, self-discipline, reliability | Organizes before speaking |
297
+ | **Extraversion** | Warmth, talkativeness, energy | Actively extends topics |
298
+ | **Agreeableness** | Trust, cooperation, altruism | Gentle, non-confrontational |
299
+ | **Neuroticism** | Emotional sensitivity, anxiety | High = anxious / Low = stable |
300
+
301
+ ### How it works
302
+
303
+ 1. **On new session**: modal asks "describe the persona you want" (1 sentence)
304
+ 2. **LLM translates**: maps description to 5 OCEAN values + free-text preferences
305
+ 3. **Persisted**: written to `data/personality/{sessionId}.json`
306
+ 4. **Stable after that**: this file is the session's persona source of truth
307
+ 5. **Injected per turn**: numbers + behavior hints + free-text preferences go into the system prompt
308
+
309
+ ### Skip path
310
+
311
+ Don't fill the modal → default OCEAN (all 0.5) + generic preferences. You can `/learner reset` later.
312
+
313
+ ### Feedback overlay
314
+
315
+ After each user message, a background feedback classifier runs (fire-and-forget):
316
+ - Positive feedback ("right, that's it") → `positivePatterns` accumulate
317
+ - Negative feedback ("too long") → `negativePatterns` accumulate
318
+ - Neutral (new topic) → not written
319
+
320
+ These observations **don't write back to the persona JSON** — they accumulate in `data/learned-prefs/{userId}.json`. The next system prompt merges persona + feedback observations:
321
+
322
+ ```
323
+ 【大五人格】
324
+ - Openness: 0.85(高开放性:喜欢新想法、跨领域联想)
325
+ - ...
326
+
327
+ 【用户过去喜欢的】(反馈学习)
328
+ - 用户喜欢举具体例子
329
+ - 用户喜欢引用典故
330
+
331
+ 【核心原则】人设 + 反馈都是参考,不是束缚。灵活调整。
332
+ ```
333
+
334
+ **Feedback wins over persona**: when the user explicitly says "don't do X", feedback takes priority.
335
+
336
+ ---
337
+
338
+ ## Directory structure
339
+
340
+ ```
341
+ rememberme/
342
+ ├── README.md / README.en.md ← user docs
343
+ ├── ARCHITECTURE.md ← developer docs (architecture, data flow, modules)
344
+ ├── USER_MANUAL.md ← CLI user manual
345
+ ├── package.json ← scripts: start, dev, repl, web, mcp, build:mcp
346
+ ├── server.json ← MCP Registry manifest
347
+ ├── settings.json.example ← API key template (the real settings.json is never committed)
348
+ ├── data/ ← runtime data (gitignored)
349
+ │ ├── sessions/ ← session history
350
+ │ ├── learned-prefs/ ← feedback learning data
351
+ │ ├── memory/ ← memory files
352
+ │ ├── timeline/ ← emotional timeline
353
+ │ ├── profile/ ← user profile
354
+ │ └── personality/ ← OCEAN personas (per-session)
355
+ ├── locales/ ← i18n strings (zh-CN / en)
356
+ ├── web/ ← web frontend
357
+ │ ├── index.html
358
+ │ ├── style.css
359
+ │ └── app.js ← SSE stream consumer
360
+ ├── src/ ← core code
361
+ │ ├── index.ts ← REPL entry
362
+ │ ├── web.ts ← web backend (Bun.serve + SSE)
363
+ │ ├── provider.ts ← LLM provider abstraction (Anthropic + OpenAI-compatible)
364
+ │ ├── profile.ts ← user profile
365
+ │ ├── memory.ts ← 5 memory types
366
+ │ ├── timeline.ts ← emotional timeline
367
+ │ ├── reflection.ts ← daily reflection
368
+ │ ├── prompt.ts ← 5-layer system prompt assembler
369
+ │ ├── compact.ts ← auto-compact
370
+ │ ├── sessions.ts ← session management
371
+ │ ├── feedback-detector.ts ← feedback classifier
372
+ │ ├── persona-learner.ts ← dynamic persona learner
373
+ │ ├── bigfive.ts ← OCEAN data model
374
+ │ ├── persona-init.ts ← persona init (description → OCEAN)
375
+ │ ├── classify.ts ← emotion detection + memory recall (side-query)
376
+ │ ├── evolution/ ← self-evolution layer (curator / lifecycle)
377
+ │ ├── mcp/ ← MCP server (npm package: rememberme)
378
+ │ │ ├── index.ts ← entry (stdio transport + stdout guard)
379
+ │ │ ├── server.ts ← wires up the 4 tools
380
+ │ │ ├── config.ts ← data dir / settings path resolution
381
+ │ │ ├── provider.ts ← the server's own LLM provider
382
+ │ │ ├── instructions.ts ← instructions (when to call record_turn)
383
+ │ │ ├── build.ts ← distribution build (used by prepack)
384
+ │ │ └── tools/ ← list_memories / read_memory / read_profile / record_turn
385
+ │ └── loop.ts ← runTurn core
386
+ └── personality/ ← persona markdown docs
387
+ ```
388
+
389
+ > **Not in the repo**: `tests/` (regression tests), `scripts/` (one-off and experiment scripts),
390
+ > `experiments/` (throwaway experiment scaffolding), `dist/` (build output).
391
+ > The repo keeps only what's needed to run and to publish.
392
+
393
+
394
+ ---
395
+
396
+ ## 🔒 Privacy
397
+
398
+ RememberMe itself uploads nothing. All runtime artifacts live in `data/`, which is in `.gitignore` — **never committed**:
399
+
400
+ ```
401
+ .gitignored runtime data:
402
+ ├── data/profile/PROFILE.md ← your profile (only .example template is committed)
403
+ ├── data/personality/*.json ← your OCEAN persona
404
+ ├── data/sessions/*.json ← conversation history
405
+ ├── data/memory/MEMORY.md + emotion/*.md + event/*.md + reference/*.md ← memories
406
+ ├── data/timeline/*.jsonl ← emotional timeline
407
+ ├── data/reflections/*.md ← daily reflections
408
+ ├── data/learned-prefs/*.json ← feedback-learned observations
409
+ └── settings.json ← API key (use .example placeholder in repo)
410
+ ```
411
+
412
+ **Local data: safe to**
413
+ - Paste PROFILE.md content in issues / PRs / screenshots (won't be collected)
414
+ - Push this repo to public GitHub (no conversation data leaks)
415
+ - List this project on your résumé (reviewers see only code + docs)
416
+
417
+ **But one boundary to be clear about: LLM calls**
418
+ - For RememberMe to work, it has to send conversation content to the LLM provider you configured (Anthropic / DeepSeek / OpenAI / etc.)
419
+ - RememberMe itself doesn't store copies of those conversations outside your local disk, but **you have to trust your LLM provider** — this is a constraint shared by every LLM-based application
420
+ - Picking a self-hosted / local model (e.g. Ollama) eliminates this external dependency entirely
421
+
422
+ ---
423
+
424
+ ## 🛠 Tech stack
425
+
426
+ | Layer | Choice | Why |
427
+ |---|---|---|
428
+ | Runtime | **Bun 1.1+** | Built-in TypeScript / tests / HTTP server, zero build step |
429
+ | LLM | **Anthropic SDK** (OpenAI/DeepSeek/Moonshot compatible) | Custom baseURL keeps Anthropic protocol while allowing alternative endpoints |
430
+ | HTTP | **Bun.serve** | Built-in SSE streaming, zero extra deps |
431
+ | Frontend | Plain HTML / CSS / Vanilla JS | No React/Vue, 3 files, easy to read/modify |
432
+ | Storage | **Pure Markdown + JSON** | User data readable, hand-editable, git-diffable |
433
+ | Tests | **bun:test** | 346 cases, runs at runtime, ~80s (test code is not in the public repo) |
434
+ | Big Five persona | 5 dimensions 0-1 + free-text preferences | Academic standard + LLM translation + per-session storage |
435
+ | Feedback learning | LLM free-text observations + positive/negative examples | No predefined enums, open dimensions |
436
+
437
+ ---
438
+
439
+ ## License
440
+
441
+ Apache License 2.0. See [LICENSE](./LICENSE).