opencode-codex-memory 0.3.0 → 0.3.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/README.md +4 -0
- package/dist/src/paths.js +19 -1
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -104,6 +104,10 @@ echo 'I prefer TypeScript strict mode and 2-space indentation.' \
|
|
|
104
104
|
└── extensions/ad_hoc/notes/ # things you explicitly asked it to remember
|
|
105
105
|
```
|
|
106
106
|
|
|
107
|
+
The location follows opencode's own data directory — `$XDG_DATA_HOME/opencode`
|
|
108
|
+
when that's set, otherwise `~/.local/share/opencode` (same resolution on macOS,
|
|
109
|
+
Linux, and Windows).
|
|
110
|
+
|
|
107
111
|
It's all plain files and a local SQLite database. Read them, edit them, delete
|
|
108
112
|
them — it's yours. (The `memories/` folder also holds a few working files and
|
|
109
113
|
an internal `.git/` the plugin uses for change tracking; `memory_reset` wipes
|
package/dist/src/paths.js
CHANGED
|
@@ -1,13 +1,31 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
import os from "os";
|
|
3
|
+
import { xdgData } from "xdg-basedir";
|
|
3
4
|
const MEMORY_DIR_NAME = "memories";
|
|
4
5
|
const MEMORY_DB_NAME = "memory.db";
|
|
5
6
|
const OVERRIDE_ENV = "OPENCODE_CODEX_MEMORY_TEST_ROOT";
|
|
7
|
+
const OPENCODE_APP_DIR = "opencode";
|
|
8
|
+
/**
|
|
9
|
+
* Memory lives under opencode's data dir, mirroring codex's
|
|
10
|
+
* `<codex_home>/memories` (codex-rs `find_codex_home` + `from_codex_home`) but
|
|
11
|
+
* with the opencode-specific home. opencode resolves its data dir as
|
|
12
|
+
* `path.join(xdgData, "opencode")` via the `xdg-basedir` lib
|
|
13
|
+
* (packages/core/src/global.ts), so we reuse the SAME lib to stay byte-identical
|
|
14
|
+
* across platforms and `XDG_DATA_HOME` overrides. opencode does not surface this
|
|
15
|
+
* directory through the plugin API (`/path` gives home/config/state/worktree/
|
|
16
|
+
* directory, not data), so it must be recomputed here.
|
|
17
|
+
*
|
|
18
|
+
* `OPENCODE_CODEX_MEMORY_TEST_ROOT` is our `CODEX_HOME` analog: an explicit
|
|
19
|
+
* override that wins outright (tests + the write-pipeline sandbox).
|
|
20
|
+
*/
|
|
6
21
|
function dataRoot() {
|
|
7
22
|
const override = process.env[OVERRIDE_ENV];
|
|
8
23
|
if (override)
|
|
9
24
|
return override;
|
|
10
|
-
|
|
25
|
+
// xdgData = XDG_DATA_HOME || ~/.local/share (identical on every platform).
|
|
26
|
+
// The `??` mirrors xdg-basedir's own guard for a missing home directory.
|
|
27
|
+
const base = xdgData ?? path.join(os.homedir(), ".local", "share");
|
|
28
|
+
return path.join(base, OPENCODE_APP_DIR);
|
|
11
29
|
}
|
|
12
30
|
export function memoryRoot() {
|
|
13
31
|
return path.join(dataRoot(), MEMORY_DIR_NAME);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-codex-memory",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Persistent memory plugin for opencode — ports codex's two-phase memory system (extraction → consolidation → injection → citation feedback)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/src/index.js",
|
|
@@ -47,7 +47,8 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@opencode-ai/plugin": "^1.18.0",
|
|
49
49
|
"diff": "^9.0.0",
|
|
50
|
-
"isomorphic-git": "^1.38.6"
|
|
50
|
+
"isomorphic-git": "^1.38.6",
|
|
51
|
+
"xdg-basedir": "^5.1.0"
|
|
51
52
|
},
|
|
52
53
|
"devDependencies": {
|
|
53
54
|
"typescript": "^5.5.0",
|