dore-memory 0.1.2 â 0.1.3
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/README.md +30 -10
- package/bin/dore-memory.js +89 -14
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
</p>
|
|
7
7
|
|
|
8
8
|
<p align="center">
|
|
9
|
-
<img src="https://img.shields.io/badge/Claude_Code-plugin_0.
|
|
9
|
+
<img src="https://img.shields.io/badge/Claude_Code-plugin_0.6.0-d97757?style=flat-square" alt="Claude Code plugin 0.6.0" />
|
|
10
|
+
<a href="https://github.com/SopheaII/dore-memory/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/SopheaII/dore-memory/ci.yml?branch=master&style=flat-square&label=CI" alt="CI" /></a>
|
|
10
11
|
<a href="https://www.npmjs.com/package/dore-memory"><img src="https://img.shields.io/npm/v/dore-memory?style=flat-square&logo=npm" alt="npm" /></a>
|
|
11
12
|
<img src="https://img.shields.io/badge/python-3.11+-3776ab?style=flat-square&logo=python&logoColor=white" alt="Python 3.11+" />
|
|
12
13
|
<img src="https://img.shields.io/badge/data-stays_local-2ea44f?style=flat-square" alt="Data stays local" />
|
|
@@ -19,19 +20,37 @@ npx dore-memory install # sets up dore and its Claude Code plugin, then open
|
|
|
19
20
|
|
|
20
21
|
## Why dore
|
|
21
22
|
|
|
22
|
-
**Problem:**
|
|
23
|
+
**Problem:** Claude Code forgets everything when you start a new session, so you explain the same things again and again.
|
|
23
24
|
|
|
24
|
-
**Solution:** dore
|
|
25
|
+
**Solution:** dore gives Claude a memory that works like yours:
|
|
25
26
|
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
27
|
+
- ð **It listens.** When you tell Claude a fact ("our staging server uses port 8443"), dore saves it.
|
|
28
|
+
You don't need to say "remember this".
|
|
29
|
+
- ðĄ **It reminds.** When you ask about it later, even in a new session, dore hands Claude that note before it answers.
|
|
30
|
+
- ð **It updates.** When a fact changes ("the staging port is now 9443"), the new fact replaces the old one.
|
|
31
|
+
- ðïļ **It keeps things in place.** Facts about you (your name, how you like to work) are used in every project.
|
|
32
|
+
Facts about one project (its port, its database) stay in that project.
|
|
33
|
+
|
|
34
|
+
## How is it different from other memory tools?
|
|
35
|
+
|
|
36
|
+
Most memory tools let the AI manage the memory: the AI decides what to save, and then either loads the whole
|
|
37
|
+
memory into every message or has to search it. That costs tokens, and if the AI forgets to save, the fact is lost.
|
|
38
|
+
|
|
39
|
+
dore manages the memory itself, outside the AI:
|
|
40
|
+
|
|
41
|
+
| | Usual memory tools | dore |
|
|
42
|
+
|---|---|---|
|
|
43
|
+
| Who decides what to save | The AI (costs tokens, and it can forget) | dore, from what you type (free, every time) |
|
|
44
|
+
| What Claude receives | The whole memory, or what the AI searched for | Only the notes that match your message (usually none) |
|
|
45
|
+
| When a fact changes | Old and new notes may both stay | The old note is replaced |
|
|
46
|
+
| When notes disagree | No rule | What you said wins over what the AI guessed |
|
|
47
|
+
| Where it runs | Sometimes a cloud service | Only on your computer |
|
|
48
|
+
|
|
49
|
+
Learning costs 0 Claude tokens and adds about 13 ms to each message.
|
|
30
50
|
|
|
31
51
|
## See it work in Claude Code
|
|
32
52
|
|
|
33
|
-
|
|
34
|
-
Claude Code's own memory is turned off on both sides, so only dore can remember.
|
|
53
|
+
Left: **without** dore. Right: **with** dore.
|
|
35
54
|
|
|
36
55
|
**Session 1:** tell Claude a fact.
|
|
37
56
|
|
|
@@ -108,7 +127,8 @@ claude plugin marketplace add ~/Documents/dore
|
|
|
108
127
|
claude plugin install dore-memory@dore-memory
|
|
109
128
|
```
|
|
110
129
|
|
|
111
|
-
Works on macOS and
|
|
130
|
+
Works on macOS, Linux and Windows (Claude Code on Windows uses Git Bash, which dore's hooks need), no GPU.
|
|
131
|
+
It also works with opencode and other MCP agents.
|
|
112
132
|
|
|
113
133
|
## How it works
|
|
114
134
|
|
package/bin/dore-memory.js
CHANGED
|
@@ -11,23 +11,38 @@ const path = require("node:path");
|
|
|
11
11
|
|
|
12
12
|
const REPO = "SopheaII/dore-memory";
|
|
13
13
|
const PLUGIN = "dore-memory@dore-memory";
|
|
14
|
+
const IS_WIN = process.platform === "win32";
|
|
15
|
+
const EXE = IS_WIN ? ".exe" : "";
|
|
14
16
|
const HOME = process.env.DORE_HOME || path.join(os.homedir(), ".dore-memory");
|
|
15
17
|
const VENV = path.join(HOME, ".venv");
|
|
16
|
-
const
|
|
18
|
+
const VENV_BIN = path.join(VENV, IS_WIN ? "Scripts" : "bin"); // Windows venvs keep programs in Scripts\
|
|
19
|
+
const VENV_PY = path.join(VENV_BIN, "python" + EXE);
|
|
20
|
+
const HOOK = path.join(VENV_BIN, "dore-hook" + EXE);
|
|
17
21
|
const DATA = process.env.DORE_DATA || path.join(HOME, "data");
|
|
18
22
|
// Until dore-memory is on PyPI, install from GitHub. Override with DORE_PIP_SPEC (e.g. "dore-memory").
|
|
19
23
|
const SPEC = process.env.DORE_PIP_SPEC || `git+https://github.com/${REPO}.git`;
|
|
24
|
+
// Where the Claude Code plugin comes from; a local folder (a dore checkout) works too, for testing.
|
|
25
|
+
const MARKET = process.env.DORE_MARKETPLACE || REPO;
|
|
20
26
|
|
|
21
27
|
const say = (msg) => console.log(`dore-memory: ${msg}`);
|
|
22
28
|
const fail = (msg) => { console.error(`dore-memory: ${msg}`); process.exit(1); };
|
|
23
29
|
|
|
24
30
|
function has(cmd) {
|
|
31
|
+
if (IS_WIN) return spawnSync("where", [cmd], { stdio: "ignore" }).status === 0;
|
|
25
32
|
return spawnSync("sh", ["-c", `command -v ${cmd}`], { stdio: "ignore" }).status === 0;
|
|
26
33
|
}
|
|
27
34
|
|
|
28
|
-
|
|
35
|
+
// Windows: `claude` and `npm` are often .cmd files, which only start through the shell;
|
|
36
|
+
// quote arguments there so paths with spaces (C:\Users\First Last) stay whole.
|
|
37
|
+
function spawn(cmd, args, opts) {
|
|
38
|
+
if (!IS_WIN) return spawnSync(cmd, args, opts);
|
|
39
|
+
const q = (a) => (/[\s"]/.test(a) ? `"${a.replace(/"/g, '\\"')}"` : a);
|
|
40
|
+
return spawnSync([cmd, ...args].map(q).join(" "), { ...opts, shell: true });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function run(cmd, args, { allowFail = false, env } = {}) {
|
|
29
44
|
console.log(` $ ${[cmd, ...args].join(" ")}`);
|
|
30
|
-
const r =
|
|
45
|
+
const r = spawn(cmd, args, { stdio: "inherit", ...(env ? { env } : {}) });
|
|
31
46
|
if (r.status !== 0 && !allowFail) fail(`command failed: ${cmd} ${args.join(" ")}`);
|
|
32
47
|
return r.status === 0;
|
|
33
48
|
}
|
|
@@ -37,20 +52,73 @@ function pythonOk(py) {
|
|
|
37
52
|
return r.status === 0;
|
|
38
53
|
}
|
|
39
54
|
|
|
55
|
+
function ask(question) {
|
|
56
|
+
// No terminal (CI, piped, run by an agent): go ahead, like other installers do.
|
|
57
|
+
if (!process.stdin.isTTY) return true;
|
|
58
|
+
process.stdout.write(`${question} [Y/n] `);
|
|
59
|
+
const buf = Buffer.alloc(256);
|
|
60
|
+
let answer = "";
|
|
61
|
+
try { answer = buf.toString("utf8", 0, fs.readSync(0, buf, 0, 256, null)).trim().toLowerCase(); } catch {}
|
|
62
|
+
return answer === "" || answer.startsWith("y");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// uv's own installer puts it in ~/.local/bin (or $XDG_BIN_HOME, $CARGO_HOME/bin); same on Windows.
|
|
66
|
+
function findUv() {
|
|
67
|
+
if (has("uv")) return "uv";
|
|
68
|
+
const dirs = [process.env.XDG_BIN_HOME, path.join(os.homedir(), ".local", "bin"),
|
|
69
|
+
path.join(process.env.CARGO_HOME || path.join(os.homedir(), ".cargo"), "bin")];
|
|
70
|
+
return dirs.filter(Boolean).map((d) => path.join(d, "uv" + EXE)).find((p) => fs.existsSync(p)) || null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function installUv() {
|
|
74
|
+
say("dore needs Python 3.11+. uv (https://docs.astral.sh/uv/) can set it up for dore only.");
|
|
75
|
+
if (!ask("Install uv now?")) fail("stopped. Install Python 3.11+ or uv, then run: npx dore-memory install");
|
|
76
|
+
if (IS_WIN) {
|
|
77
|
+
// Started from PowerShell 7, Windows PowerShell 5 inherits 7's PSModulePath and fails to load its
|
|
78
|
+
// own modules ("module could not be loaded"); give it a clean one. Fall back to pwsh if needed.
|
|
79
|
+
const env = Object.fromEntries(Object.entries(process.env).filter(([k]) => k.toLowerCase() !== "psmodulepath"));
|
|
80
|
+
const ps = ["-NoProfile", "-ExecutionPolicy", "ByPass", "-Command", "irm https://astral.sh/uv/install.ps1 | iex"];
|
|
81
|
+
const ok = run("powershell", ps, { env, allowFail: true }) || (has("pwsh") && run("pwsh", ps, { allowFail: true }));
|
|
82
|
+
if (!ok) fail("could not install uv. Install it yourself (https://docs.astral.sh/uv/), then run: npx dore-memory install");
|
|
83
|
+
} else {
|
|
84
|
+
if (!has("curl")) fail("needs curl to install uv. Install uv yourself: https://docs.astral.sh/uv/");
|
|
85
|
+
run("sh", ["-c", "curl -LsSf https://astral.sh/uv/install.sh | sh"]);
|
|
86
|
+
}
|
|
87
|
+
return findUv() || fail("uv was installed but not found. Open a new terminal and run: npx dore-memory install");
|
|
88
|
+
}
|
|
89
|
+
|
|
40
90
|
function installPython(upgrade) {
|
|
41
91
|
fs.mkdirSync(HOME, { recursive: true });
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
92
|
+
// Windows: always uv ("python" there is often the Microsoft Store placeholder).
|
|
93
|
+
const py = IS_WIN ? null : ["python3.12", "python3.11", "python3.13", "python3"].find((p) => has(p) && pythonOk(p));
|
|
94
|
+
// Prefer uv (it downloads Python 3.12 by itself); else a Python 3.11+ already here; else install uv.
|
|
95
|
+
const uv = findUv() || (py ? null : installUv());
|
|
96
|
+
if (uv) {
|
|
97
|
+
// Windows on ARM: spaCy has no win_arm64 package, so use x64 Python (Windows runs it emulated).
|
|
98
|
+
const pyWant = IS_WIN && os.arch() === "arm64" ? "cpython-3.12-windows-x86_64-none" : "3.12";
|
|
99
|
+
if (!fs.existsSync(VENV)) run(uv, ["venv", VENV, "--python", pyWant]);
|
|
100
|
+
run(uv, ["pip", "install", "--python", VENV_PY, ...(upgrade ? ["--upgrade"] : []), SPEC]);
|
|
45
101
|
} else {
|
|
46
|
-
const py = ["python3.12", "python3.11", "python3.13", "python3"].find((p) => has(p) && pythonOk(p));
|
|
47
|
-
if (!py) fail("needs Python 3.11+ or uv. Install uv: curl -LsSf https://astral.sh/uv/install.sh | sh");
|
|
48
102
|
if (!fs.existsSync(VENV)) run(py, ["-m", "venv", VENV]);
|
|
49
|
-
const pip = path.join(
|
|
103
|
+
const pip = path.join(VENV_BIN, "pip");
|
|
50
104
|
run(pip, ["install", "--quiet", "--upgrade", "pip"]);
|
|
51
105
|
run(pip, ["install", ...(upgrade ? ["--upgrade"] : []), SPEC]);
|
|
52
106
|
}
|
|
53
107
|
if (!fs.existsSync(HOOK)) fail(`install finished but ${HOOK} is missing`);
|
|
108
|
+
warmUp();
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// The first hook run downloads the search model (~130 MB). That takes longer than Claude Code
|
|
112
|
+
// waits for a hook (20 s), so the user's first message would be lost. Do it here instead.
|
|
113
|
+
function warmUp() {
|
|
114
|
+
say("downloading the search model and opening the memory (one time, about 30 s)...");
|
|
115
|
+
const code = "from dore.config import Config\nfrom dore.integrations.hooks import open_store\n"
|
|
116
|
+
+ "from dore.learn.grammar import nlp\nopen_store(Config()).close()\nnlp()\n";
|
|
117
|
+
const r = spawnSync(VENV_PY, ["-c", code], {
|
|
118
|
+
stdio: ["ignore", "ignore", "inherit"],
|
|
119
|
+
env: { ...process.env, DORE_HOME: HOME, HF_HUB_DISABLE_PROGRESS_BARS: "1" },
|
|
120
|
+
});
|
|
121
|
+
if (r.status !== 0) fail("could not download the search model. Check your internet connection and run install again.");
|
|
54
122
|
}
|
|
55
123
|
|
|
56
124
|
function installPlugin() {
|
|
@@ -59,13 +127,12 @@ function installPlugin() {
|
|
|
59
127
|
return false;
|
|
60
128
|
}
|
|
61
129
|
// "add" fails when the marketplace is already known; that is fine.
|
|
62
|
-
run("claude", ["plugin", "marketplace", "add",
|
|
130
|
+
run("claude", ["plugin", "marketplace", "add", MARKET], { allowFail: true });
|
|
63
131
|
run("claude", ["plugin", "marketplace", "update", "dore-memory"], { allowFail: true });
|
|
64
132
|
return run("claude", ["plugin", "install", PLUGIN], { allowFail: true });
|
|
65
133
|
}
|
|
66
134
|
|
|
67
135
|
function install(upgrade) {
|
|
68
|
-
if (process.platform === "win32") fail("Windows is not supported yet (macOS and Linux only).");
|
|
69
136
|
say(`setting up in ${HOME} (first run downloads ~200 MB of packages and models)`);
|
|
70
137
|
installPython(upgrade);
|
|
71
138
|
const plugin = installPlugin();
|
|
@@ -77,7 +144,14 @@ function install(upgrade) {
|
|
|
77
144
|
|
|
78
145
|
function uninstall() {
|
|
79
146
|
if (has("claude")) run("claude", ["plugin", "uninstall", PLUGIN], { allowFail: true });
|
|
80
|
-
|
|
147
|
+
// Stop dore's background helper first: Windows can't delete files a running program uses.
|
|
148
|
+
if (fs.existsSync(HOOK)) spawnSync(HOOK, ["quit"], { stdio: "ignore", timeout: 10000 });
|
|
149
|
+
try {
|
|
150
|
+
if (fs.existsSync(VENV)) fs.rmSync(VENV, { recursive: true, force: true, maxRetries: 5, retryDelay: 500 });
|
|
151
|
+
} catch {
|
|
152
|
+
// Windows keeps files of a running program locked; dore's helper quits by itself after 30 idle minutes.
|
|
153
|
+
fail(`could not remove ${VENV} (dore's helper may still be running). Close Claude Code, wait a minute, and run uninstall again.`);
|
|
154
|
+
}
|
|
81
155
|
say("removed the plugin and the Python environment.");
|
|
82
156
|
// dore never deletes memories: the notes stay unless the user removes them.
|
|
83
157
|
console.log(` Your memory was kept in ${DATA}. Delete that folder yourself if you want it gone.`);
|
|
@@ -88,7 +162,7 @@ function status() {
|
|
|
88
162
|
console.log(`hook: ${fs.existsSync(HOOK) ? HOOK : "missing (run: npx dore-memory install)"}`);
|
|
89
163
|
console.log(`memory: ${fs.existsSync(path.join(DATA, "memory.db")) ? path.join(DATA, "memory.db") : "empty"}`);
|
|
90
164
|
if (has("claude")) {
|
|
91
|
-
const r =
|
|
165
|
+
const r = spawn("claude", ["plugin", "list"], { encoding: "utf8" });
|
|
92
166
|
const on = (r.stdout || "").includes(PLUGIN);
|
|
93
167
|
console.log(`plugin: ${on ? PLUGIN : "not installed"}`);
|
|
94
168
|
} else {
|
|
@@ -103,7 +177,8 @@ const HELP = `Usage: npx dore-memory <command>
|
|
|
103
177
|
status show where dore is and whether the plugin is on
|
|
104
178
|
uninstall remove the plugin and Python environment (keeps your memory)
|
|
105
179
|
|
|
106
|
-
Environment: DORE_HOME (default ~/.dore-memory), DORE_PIP_SPEC (what to pip install)
|
|
180
|
+
Environment: DORE_HOME (default ~/.dore-memory), DORE_PIP_SPEC (what to pip install),
|
|
181
|
+
DORE_MARKETPLACE (where the plugin comes from; default the GitHub repo).`;
|
|
107
182
|
|
|
108
183
|
const cmd = process.argv[2];
|
|
109
184
|
if (cmd === "install") install(false);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dore-memory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Local long-term memory for Claude Code. Say it once, it remembers in every new session. Installs the dore Python package and its Claude Code plugin.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
|
@@ -33,7 +33,8 @@
|
|
|
33
33
|
},
|
|
34
34
|
"os": [
|
|
35
35
|
"darwin",
|
|
36
|
-
"linux"
|
|
36
|
+
"linux",
|
|
37
|
+
"win32"
|
|
37
38
|
],
|
|
38
39
|
"scripts": {
|
|
39
40
|
"prepack": "node scripts/sync-readme.js"
|