@jokab1074/rememberme 0.0.0-stage → 0.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ARCHITECTURE.md +787 -0
- package/LICENSE +202 -0
- package/README.en.md +459 -0
- package/README.md +477 -2
- package/dist/mcp/index.js +37334 -0
- package/package.json +67 -4
- package/server.json +38 -0
- package/settings.json.example +7 -0
- package/src/bigfive.ts +163 -0
- package/src/bootstrap.ts +104 -0
- package/src/classify.ts +186 -0
- package/src/compact.ts +225 -0
- package/src/context-file.ts +305 -0
- package/src/embedded-proactive.ts +214 -0
- package/src/evolution/access-tracker.ts +118 -0
- package/src/evolution/curator.ts +220 -0
- package/src/evolution/lifecycle.ts +175 -0
- package/src/feedback-detector.ts +177 -0
- package/src/i18n.ts +89 -0
- package/src/index.ts +1479 -0
- package/src/loop.ts +396 -0
- package/src/mcp/build.ts +64 -0
- package/src/mcp/config.ts +108 -0
- package/src/mcp/index.ts +66 -0
- package/src/mcp/instructions.ts +44 -0
- package/src/mcp/logger.ts +32 -0
- package/src/mcp/provider.ts +142 -0
- package/src/mcp/server.ts +52 -0
- package/src/mcp/tools/memory.ts +126 -0
- package/src/mcp/tools/profile.ts +67 -0
- package/src/mcp/tools/record-turn.ts +284 -0
- package/src/memory-extract.ts +390 -0
- package/src/memory.ts +790 -0
- package/src/persona-init.ts +153 -0
- package/src/persona-learner.ts +349 -0
- package/src/proactive.ts +557 -0
- package/src/profile.ts +1095 -0
- package/src/prompt.ts +288 -0
- package/src/provider.ts +292 -0
- package/src/reflection.ts +552 -0
- package/src/sessions.ts +140 -0
- package/src/timeline.ts +208 -0
- package/src/utils.ts +91 -0
- package/src/web-security.ts +43 -0
- package/src/web.ts +724 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright 2026 RememberMe Contributors
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.en.md
ADDED
|
@@ -0,0 +1,459 @@
|
|
|
1
|
+
# RememberMe
|
|
2
|
+
|
|
3
|
+
[English](README.en.md) | [中文](README.md)
|
|
4
|
+
|
|
5
|
+
[](https://github.com/SoHardToMakeAName/RememberMe/actions/workflows/ci.yml)
|
|
6
|
+
[](https://www.npmjs.com/package/@jokab1074/rememberme)
|
|
7
|
+
|
|
8
|
+
> **RememberMe MCP is live** — see the [MCP server (as a memory backend)](#mcp-server-as-a-memory-backend) section.
|
|
9
|
+
|
|
10
|
+
> 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.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## What is this
|
|
15
|
+
|
|
16
|
+
**It remembers you**.
|
|
17
|
+
|
|
18
|
+
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.
|
|
19
|
+
|
|
20
|
+
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**.
|
|
21
|
+
|
|
22
|
+
- **Remembers who you are** — your name, occupation, life stage, location, the topics on your mind
|
|
23
|
+
- **Remembers what you like** — preferences grow from your real feedback, not developer-imposed defaults like "users prefer concise replies"
|
|
24
|
+
- **Remembers what you've been through** — recurring emotional patterns are named and kept (`work-burnout`, `life-aversion` — not just a daily mood log)
|
|
25
|
+
- **Remembers what you talked about** — six months later, the conversation context is still there
|
|
26
|
+
|
|
27
|
+
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.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## 🧠 How it remembers you
|
|
32
|
+
|
|
33
|
+
> 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).
|
|
34
|
+
|
|
35
|
+
### Your profile lives in local markdown files
|
|
36
|
+
|
|
37
|
+
- **Who you are** (basic info) — name, occupation, location, stored as fields in `data/profile/PROFILE.md`
|
|
38
|
+
- **What you like** (preferences + communication style) — grown from your real feedback, not predefined "length / tone / depth / format" dimensions
|
|
39
|
+
- **What you've been through** (events + emotional patterns) — recurring emotional reactions stored as `emotion`-type memories, only kept when ≥2 pieces of evidence exist
|
|
40
|
+
|
|
41
|
+
Every entry is a **plain text file** — you can open it in any editor, read it, modify it.
|
|
42
|
+
|
|
43
|
+
### Come back six months later, it still remembers
|
|
44
|
+
|
|
45
|
+
- The topic you left mid-sentence
|
|
46
|
+
- Your emotional patterns ("you always get anxious when talking about work", not "you're feeling off today")
|
|
47
|
+
- Your preferences (you said "don't reply too long" — now it replies briefly)
|
|
48
|
+
- Across sessions, across interfaces (CLI ↔ Web), across models (Claude / DeepSeek / GPT-4) — same memory
|
|
49
|
+
|
|
50
|
+
### On privacy: two boundaries to be clear about
|
|
51
|
+
|
|
52
|
+
- ✅ **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.
|
|
53
|
+
- ⚠️ **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.
|
|
54
|
+
|
|
55
|
+
### 🌐 The web UI binds to localhost only
|
|
56
|
+
|
|
57
|
+
The web server binds **127.0.0.1** by default, so other devices on the same WiFi / LAN **cannot reach it**.
|
|
58
|
+
(Earlier versions omitted `hostname`, and Bun defaults to `0.0.0.0` — reachable from the LAN, where `/api/send` spends your API key on whoever asks. Tightened in v0.22.0.)
|
|
59
|
+
|
|
60
|
+
| What you want | How |
|
|
61
|
+
|---|---|
|
|
62
|
+
| Local use only (default) | nothing to set |
|
|
63
|
+
| Use it from another device on your LAN | `HOST=0.0.0.0 EC_WEB_TOKEN=your-token bun run start` |
|
|
64
|
+
| Genuinely open with no auth (not recommended) | `HOST=0.0.0.0 EC_WEB_ALLOW_UNAUTHENTICATED=1 bun run start` |
|
|
65
|
+
|
|
66
|
+
- With `EC_WEB_TOKEN` set, every `/api/*` route requires `Authorization: Bearer <token>`; the browser asks for the token once and keeps it in `localStorage`
|
|
67
|
+
- **Listening on a non-loopback address without a token → the server refuses to start** (better to fail than to silently hand your key away)
|
|
68
|
+
- Every `/api/*` route also checks the `Origin` header, blocking browser-originated cross-site requests (CSRF)
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Core Features
|
|
73
|
+
|
|
74
|
+
### 🧠 Multi-layer memory
|
|
75
|
+
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."
|
|
76
|
+
- `emotion` — recurring patterns (requires ≥2 evidence)
|
|
77
|
+
- `event` — life events with emotional impact
|
|
78
|
+
- `reference` — external resources (doctor/therapist/contact)
|
|
79
|
+
|
|
80
|
+
### 👤 User profile
|
|
81
|
+
Automatically accumulates 6 dimensions of long-term info: basic info, communication style, topics of interest, preferences & taboos, emotional baseline, recent changes.
|
|
82
|
+
|
|
83
|
+
### 🪞 Daily reflection
|
|
84
|
+
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.
|
|
85
|
+
|
|
86
|
+
### 🌊 Big-Five persona (OCEAN)
|
|
87
|
+
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`.
|
|
88
|
+
|
|
89
|
+
### 🪄 Auto-learn your preferences
|
|
90
|
+
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).
|
|
91
|
+
|
|
92
|
+
### 💬 Per-session conversations
|
|
93
|
+
Each session is persisted to `data/sessions/` with persona + history + title. Click any session in the left sidebar to switch.
|
|
94
|
+
|
|
95
|
+
### 📝 Pure Markdown config
|
|
96
|
+
Profile, memories, and reflections are all `.md` files. **No YAML, no JSON config** (except runtime data).
|
|
97
|
+
|
|
98
|
+
### 🌐 Web interface (default)
|
|
99
|
+
Default launches a Bun.serve() HTTP server. Open `http://localhost:3000` to use. SSE streaming + live status bar.
|
|
100
|
+
|
|
101
|
+
### 🔌 MCP server (as a memory backend)
|
|
102
|
+
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.
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Quick Start
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# 1. Install deps (need bun ≥ 1.1)
|
|
110
|
+
bun install
|
|
111
|
+
|
|
112
|
+
# 2. Set API key (any one, Anthropic recommended)
|
|
113
|
+
export ANTHROPIC_API_KEY=sk-ant-xxx
|
|
114
|
+
# or (OpenAI-compatible: DeepSeek/Moonshot/self-hosted)
|
|
115
|
+
export OPENAI_API_KEY=sk-xxx
|
|
116
|
+
|
|
117
|
+
# 3. Launch (web by default)
|
|
118
|
+
bun run start # → http://localhost:3000
|
|
119
|
+
bun run repl # → CLI mode (src/index.ts)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Or put your API key in `settings.json` (Anthropic SDK format, gitignored):
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"env": {
|
|
127
|
+
"ANTHROPIC_API_KEY": "sk-ant-your-key-here",
|
|
128
|
+
"ANTHROPIC_BASE_URL": "https://api.deepseek.com/anthropic",
|
|
129
|
+
"ANTHROPIC_MODEL": "deepseek-v4-flash"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
First launch auto-creates `data/profile/PROFILE.md` and `data/sessions/`. Start chatting.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## How to use
|
|
139
|
+
|
|
140
|
+
### Web version (default)
|
|
141
|
+
|
|
142
|
+
Visit `http://localhost:3000`:
|
|
143
|
+
- Left sidebar: session list (+ new conversation), persona init entry, model input, clear/export buttons
|
|
144
|
+
- Right area: chat message stream + input
|
|
145
|
+
- Enter to send, Shift+Enter for newline
|
|
146
|
+
- Status bar shows: `Thinking... (N chars, Ns)` → `Ready (N s)`
|
|
147
|
+
- **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`
|
|
148
|
+
- **Switch session**: click any item in the left list → load that conversation instantly (persona switches with the session)
|
|
149
|
+
- **Switch model**: type new model name in input field → click "Apply"
|
|
150
|
+
|
|
151
|
+
> New sessions start with one-sentence persona generation → OCEAN; if you skip, you get the default neutral persona (all OCEAN 0.5).
|
|
152
|
+
|
|
153
|
+
### CLI mode
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
bun run repl
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
#### REPL commands
|
|
160
|
+
|
|
161
|
+
| Command | What it does |
|
|
162
|
+
|---|---|
|
|
163
|
+
| Just type | Start chatting |
|
|
164
|
+
| `/persona show` | Show current OCEAN persona + preferences |
|
|
165
|
+
| `/persona init <one-sentence description>` | Use LLM to generate OCEAN for current session (prompted on first launch) |
|
|
166
|
+
| `/persona describe <text>` | Edit `preferences` without calling LLM |
|
|
167
|
+
| `/persona reset` | Reset persona to neutral default (all 0.5) |
|
|
168
|
+
| `/session list` | List all sessions (most-recent-active first) |
|
|
169
|
+
| `/session current` | Show current session details (id + title + history length + persona) |
|
|
170
|
+
| `/session new [description]` | Create new session (optionally init persona immediately; CLI and web share session data) |
|
|
171
|
+
| `/session switch <id>` | Switch to a specific session (save current → load target → reload persona) |
|
|
172
|
+
| `/session save` | Manually save current session (also auto-saved on exit) |
|
|
173
|
+
| `/session delete <id>` | Delete a session + its persona file (cannot delete the current one) |
|
|
174
|
+
| `/memory list` / `read <name>` / `types` / `save <type> <name> <desc>` | Memory management (2 main + 1 minor types) |
|
|
175
|
+
| `/memory auto <on\|off\|status>` | Auto-extract toggle (default on) |
|
|
176
|
+
| `/memory suggest` | Manually trigger an extraction |
|
|
177
|
+
| `/timeline` / `/timeline stats` | Emotional trajectory / stats |
|
|
178
|
+
| `/profile` / `/profile path` / `/profile scan` / `/profile reset` | User profile management |
|
|
179
|
+
| `/learner` / `/learner reset` | Persona learner status |
|
|
180
|
+
| `/reflect [days]` | Manually trigger reflection (default: 7-day lookback) |
|
|
181
|
+
| `/reflections list` / `read <date>` | Browse reflection history |
|
|
182
|
+
| `/stats` | Session stats (with compact recommendation) |
|
|
183
|
+
| `/compact` | Manually compact history |
|
|
184
|
+
| `/quiet` | Toggle `[emotion: ...]` debug labels |
|
|
185
|
+
| `/clear` | Clear current session history |
|
|
186
|
+
| `/help` | Full help |
|
|
187
|
+
| `/quit` | Exit (auto-saves current session) |
|
|
188
|
+
|
|
189
|
+
### CLI & Web share sessions
|
|
190
|
+
|
|
191
|
+
`data/sessions/` is shared between CLI and web:
|
|
192
|
+
- Chat on web → start CLI → CLI auto-loads the most recent session with real conversation
|
|
193
|
+
- Chat on CLI → quit web → restart web → web loads the same session
|
|
194
|
+
- Switch sessions with `/session switch <id>` (CLI) or the left sidebar (web)
|
|
195
|
+
|
|
196
|
+
### MCP server (as a memory backend)
|
|
197
|
+
|
|
198
|
+
Mount RememberMe on any MCP client (Claude Code / Claude Desktop / Cursor / VS Code …) and **other AIs** get your long-term memory too.
|
|
199
|
+
|
|
200
|
+
Four tools:
|
|
201
|
+
|
|
202
|
+
| Tool | Type | What it does |
|
|
203
|
+
|---|---|---|
|
|
204
|
+
| `list_memories` | read | List all memories (name + description + date) |
|
|
205
|
+
| `read_memory` | read | Fetch one memory in full |
|
|
206
|
+
| `read_profile` | read | Read the 6 sections of the user profile |
|
|
207
|
+
| `record_turn` | **write** | The host says "this turn is worth keeping"; the memory system decides what to write |
|
|
208
|
+
|
|
209
|
+
**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()`).
|
|
210
|
+
|
|
211
|
+
<details>
|
|
212
|
+
<summary><b>Use it from your local Claude Code (development build)</b></summary>
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# 1. Build (re-run after changing src/mcp/)
|
|
216
|
+
bun install
|
|
217
|
+
bun run build:mcp
|
|
218
|
+
|
|
219
|
+
# 2. Register with Claude Code (-s local = this project only, stored in ~/.claude.json)
|
|
220
|
+
# Replace <REPO> with your absolute repo path
|
|
221
|
+
claude mcp add rememberme -s local \
|
|
222
|
+
-e REMEMBERME_DATA_DIR=<REPO>/data \
|
|
223
|
+
-- node <REPO>/dist/mcp/index.js
|
|
224
|
+
|
|
225
|
+
# 3. Verify
|
|
226
|
+
claude mcp list # should show rememberme ... ✔ Connected
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Then **restart Claude Code** (MCP tools are loaded at session start). The tools appear as `mcp__rememberme__list_memories` and friends.
|
|
230
|
+
|
|
231
|
+
Swap `-s local` for `-s user` to make it available in every project.
|
|
232
|
+
|
|
233
|
+
> ⚠️ **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.
|
|
234
|
+
>
|
|
235
|
+
> **`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`.
|
|
236
|
+
>
|
|
237
|
+
> You can also run straight from source (changes take effect immediately, no rebuild):
|
|
238
|
+
> ```bash
|
|
239
|
+
> claude mcp add rememberme-dev -s local \
|
|
240
|
+
> -e REMEMBERME_DATA_DIR=<REPO>/data \
|
|
241
|
+
> -- bun run <REPO>/src/mcp/index.ts
|
|
242
|
+
> ```
|
|
243
|
+
|
|
244
|
+
</details>
|
|
245
|
+
|
|
246
|
+
<details>
|
|
247
|
+
<summary><b>Install with npx (after publish)</b></summary>
|
|
248
|
+
|
|
249
|
+
The npm package name is **`@jokab1074/rememberme`**:
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
claude mcp add rememberme -s user -- npx -y @jokab1074/rememberme
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
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.
|
|
256
|
+
|
|
257
|
+
**First run needs an API key.** The MCP server looks for configuration in this order:
|
|
258
|
+
|
|
259
|
+
```
|
|
260
|
+
1. REMEMBERME_SETTINGS environment variable
|
|
261
|
+
2. ~/.rememberme/settings.json
|
|
262
|
+
3. <package dir>/../settings.json
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
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):
|
|
266
|
+
|
|
267
|
+
```json
|
|
268
|
+
{
|
|
269
|
+
"env": {
|
|
270
|
+
"ANTHROPIC_API_KEY": "sk-ant-your-key",
|
|
271
|
+
"ANTHROPIC_BASE_URL": "https://api.anthropic.com",
|
|
272
|
+
"ANTHROPIC_MODEL": "claude-sonnet-4-5-20250929"
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
Or point it at a config you already have:
|
|
278
|
+
|
|
279
|
+
```bash
|
|
280
|
+
claude mcp add rememberme -s user \
|
|
281
|
+
-e REMEMBERME_SETTINGS=/path/to/settings.json \
|
|
282
|
+
-- npx -y @jokab1074/rememberme
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
Without a key the three read tools still work, and `record_turn` tells you exactly where to configure it:
|
|
286
|
+
|
|
287
|
+
> Unable to extract memory: no usable LLM config.
|
|
288
|
+
> No API key configured. Set ANTHROPIC_API_KEY in ~/.rememberme/settings.json or the project settings.json…
|
|
289
|
+
|
|
290
|
+
**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.
|
|
291
|
+
|
|
292
|
+
</details>
|
|
293
|
+
|
|
294
|
+
**Read-only mode** (don't want the server calling an LLM / spending quota):
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
REMEMBERME_MCP_DISABLE_LLM=1 # leaves the 3 read tools; record_turn returns a clear error
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
> The MCP server implementation lives in [`src/mcp/`](src/mcp/);
|
|
301
|
+
> see [`ARCHITECTURE.md`](ARCHITECTURE.md) for the overall design.
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## How the persona works (OCEAN)
|
|
306
|
+
|
|
307
|
+
### Big Five (OCEAN)
|
|
308
|
+
|
|
309
|
+
The academically validated 5-dimension model (each 0-1):
|
|
310
|
+
|
|
311
|
+
| Dimension | Meaning | High score |
|
|
312
|
+
|---|---|---|
|
|
313
|
+
| **Openness** | Imagination, curiosity, abstract thinking | Loves new ideas, cross-domain connections |
|
|
314
|
+
| **Conscientiousness** | Organization, self-discipline, reliability | Organizes before speaking |
|
|
315
|
+
| **Extraversion** | Warmth, talkativeness, energy | Actively extends topics |
|
|
316
|
+
| **Agreeableness** | Trust, cooperation, altruism | Gentle, non-confrontational |
|
|
317
|
+
| **Neuroticism** | Emotional sensitivity, anxiety | High = anxious / Low = stable |
|
|
318
|
+
|
|
319
|
+
### How it works
|
|
320
|
+
|
|
321
|
+
1. **On new session**: modal asks "describe the persona you want" (1 sentence)
|
|
322
|
+
2. **LLM translates**: maps description to 5 OCEAN values + free-text preferences
|
|
323
|
+
3. **Persisted**: written to `data/personality/{sessionId}.json`
|
|
324
|
+
4. **Stable after that**: this file is the session's persona source of truth
|
|
325
|
+
5. **Injected per turn**: numbers + behavior hints + free-text preferences go into the system prompt
|
|
326
|
+
|
|
327
|
+
### Skip path
|
|
328
|
+
|
|
329
|
+
Don't fill the modal → default OCEAN (all 0.5) + generic preferences. You can `/learner reset` later.
|
|
330
|
+
|
|
331
|
+
### Feedback overlay
|
|
332
|
+
|
|
333
|
+
After each user message, a background feedback classifier runs (fire-and-forget):
|
|
334
|
+
- Positive feedback ("right, that's it") → `positivePatterns` accumulate
|
|
335
|
+
- Negative feedback ("too long") → `negativePatterns` accumulate
|
|
336
|
+
- Neutral (new topic) → not written
|
|
337
|
+
|
|
338
|
+
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:
|
|
339
|
+
|
|
340
|
+
```
|
|
341
|
+
【大五人格】
|
|
342
|
+
- Openness: 0.85(高开放性:喜欢新想法、跨领域联想)
|
|
343
|
+
- ...
|
|
344
|
+
|
|
345
|
+
【用户过去喜欢的】(反馈学习)
|
|
346
|
+
- 用户喜欢举具体例子
|
|
347
|
+
- 用户喜欢引用典故
|
|
348
|
+
|
|
349
|
+
【核心原则】人设 + 反馈都是参考,不是束缚。灵活调整。
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
**Feedback wins over persona**: when the user explicitly says "don't do X", feedback takes priority.
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
## Directory structure
|
|
357
|
+
|
|
358
|
+
```
|
|
359
|
+
rememberme/
|
|
360
|
+
├── README.md / README.en.md ← user docs
|
|
361
|
+
├── ARCHITECTURE.md ← developer docs (architecture, data flow, modules)
|
|
362
|
+
├── USER_MANUAL.md ← CLI user manual
|
|
363
|
+
├── package.json ← scripts: start, dev, repl, web, mcp, build:mcp
|
|
364
|
+
├── server.json ← MCP Registry manifest
|
|
365
|
+
├── settings.json.example ← API key template (the real settings.json is never committed)
|
|
366
|
+
├── data/ ← runtime data (gitignored)
|
|
367
|
+
│ ├── sessions/ ← session history
|
|
368
|
+
│ ├── learned-prefs/ ← feedback learning data
|
|
369
|
+
│ ├── memory/ ← memory files
|
|
370
|
+
│ ├── timeline/ ← emotional timeline
|
|
371
|
+
│ ├── profile/ ← user profile
|
|
372
|
+
│ └── personality/ ← OCEAN personas (per-session)
|
|
373
|
+
├── locales/ ← i18n strings (zh-CN / en)
|
|
374
|
+
├── web/ ← web frontend
|
|
375
|
+
│ ├── index.html
|
|
376
|
+
│ ├── style.css
|
|
377
|
+
│ └── app.js ← SSE stream consumer
|
|
378
|
+
├── src/ ← core code
|
|
379
|
+
│ ├── index.ts ← REPL entry
|
|
380
|
+
│ ├── web.ts ← web backend (Bun.serve + SSE)
|
|
381
|
+
│ ├── provider.ts ← LLM provider abstraction (Anthropic + OpenAI-compatible)
|
|
382
|
+
│ ├── profile.ts ← user profile
|
|
383
|
+
│ ├── memory.ts ← 5 memory types
|
|
384
|
+
│ ├── timeline.ts ← emotional timeline
|
|
385
|
+
│ ├── reflection.ts ← daily reflection
|
|
386
|
+
│ ├── prompt.ts ← 5-layer system prompt assembler
|
|
387
|
+
│ ├── compact.ts ← auto-compact
|
|
388
|
+
│ ├── sessions.ts ← session management
|
|
389
|
+
│ ├── feedback-detector.ts ← feedback classifier
|
|
390
|
+
│ ├── persona-learner.ts ← dynamic persona learner
|
|
391
|
+
│ ├── bigfive.ts ← OCEAN data model
|
|
392
|
+
│ ├── persona-init.ts ← persona init (description → OCEAN)
|
|
393
|
+
│ ├── classify.ts ← emotion detection + memory recall (side-query)
|
|
394
|
+
│ ├── evolution/ ← self-evolution layer (curator / lifecycle)
|
|
395
|
+
│ ├── mcp/ ← MCP server (npm package: rememberme)
|
|
396
|
+
│ │ ├── index.ts ← entry (stdio transport + stdout guard)
|
|
397
|
+
│ │ ├── server.ts ← wires up the 4 tools
|
|
398
|
+
│ │ ├── config.ts ← data dir / settings path resolution
|
|
399
|
+
│ │ ├── provider.ts ← the server's own LLM provider
|
|
400
|
+
│ │ ├── instructions.ts ← instructions (when to call record_turn)
|
|
401
|
+
│ │ ├── build.ts ← distribution build (used by prepack)
|
|
402
|
+
│ │ └── tools/ ← list_memories / read_memory / read_profile / record_turn
|
|
403
|
+
│ └── loop.ts ← runTurn core
|
|
404
|
+
└── personality/ ← persona markdown docs
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
> **Not in the repo**: `tests/` (regression tests), `scripts/` (one-off and experiment scripts),
|
|
408
|
+
> `experiments/` (throwaway experiment scaffolding), `dist/` (build output).
|
|
409
|
+
> The repo keeps only what's needed to run and to publish.
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
## 🔒 Privacy
|
|
415
|
+
|
|
416
|
+
RememberMe itself uploads nothing. All runtime artifacts live in `data/`, which is in `.gitignore` — **never committed**:
|
|
417
|
+
|
|
418
|
+
```
|
|
419
|
+
.gitignored runtime data:
|
|
420
|
+
├── data/profile/PROFILE.md ← your profile (only .example template is committed)
|
|
421
|
+
├── data/personality/*.json ← your OCEAN persona
|
|
422
|
+
├── data/sessions/*.json ← conversation history
|
|
423
|
+
├── data/memory/MEMORY.md + emotion/*.md + event/*.md + reference/*.md ← memories
|
|
424
|
+
├── data/timeline/*.jsonl ← emotional timeline
|
|
425
|
+
├── data/reflections/*.md ← daily reflections
|
|
426
|
+
├── data/learned-prefs/*.json ← feedback-learned observations
|
|
427
|
+
└── settings.json ← API key (use .example placeholder in repo)
|
|
428
|
+
```
|
|
429
|
+
|
|
430
|
+
**Local data: safe to**
|
|
431
|
+
- Paste PROFILE.md content in issues / PRs / screenshots (won't be collected)
|
|
432
|
+
- Push this repo to public GitHub (no conversation data leaks)
|
|
433
|
+
- List this project on your résumé (reviewers see only code + docs)
|
|
434
|
+
|
|
435
|
+
**But one boundary to be clear about: LLM calls**
|
|
436
|
+
- For RememberMe to work, it has to send conversation content to the LLM provider you configured (Anthropic / DeepSeek / OpenAI / etc.)
|
|
437
|
+
- 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
|
|
438
|
+
- Picking a self-hosted / local model (e.g. Ollama) eliminates this external dependency entirely
|
|
439
|
+
|
|
440
|
+
---
|
|
441
|
+
|
|
442
|
+
## 🛠 Tech stack
|
|
443
|
+
|
|
444
|
+
| Layer | Choice | Why |
|
|
445
|
+
|---|---|---|
|
|
446
|
+
| Runtime | **Bun 1.1+** | Built-in TypeScript / tests / HTTP server, zero build step |
|
|
447
|
+
| LLM | **Anthropic SDK** (OpenAI/DeepSeek/Moonshot compatible) | Custom baseURL keeps Anthropic protocol while allowing alternative endpoints |
|
|
448
|
+
| HTTP | **Bun.serve** | Built-in SSE streaming, zero extra deps |
|
|
449
|
+
| Frontend | Plain HTML / CSS / Vanilla JS | No React/Vue, 3 files, easy to read/modify |
|
|
450
|
+
| Storage | **Pure Markdown + JSON** | User data readable, hand-editable, git-diffable |
|
|
451
|
+
| Tests | **bun:test** | 346 cases, runs at runtime, ~80s (test code is not in the public repo) |
|
|
452
|
+
| Big Five persona | 5 dimensions 0-1 + free-text preferences | Academic standard + LLM translation + per-session storage |
|
|
453
|
+
| Feedback learning | LLM free-text observations + positive/negative examples | No predefined enums, open dimensions |
|
|
454
|
+
|
|
455
|
+
---
|
|
456
|
+
|
|
457
|
+
## License
|
|
458
|
+
|
|
459
|
+
Apache License 2.0. See [LICENSE](./LICENSE).
|