memorix 0.9.1 → 0.9.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/CHANGELOG.md +22 -0
- package/README.md +81 -11
- package/README.zh-CN.md +81 -11
- package/dist/cli/index.js +90 -66
- package/dist/cli/index.js.map +1 -1
- package/dist/index.js +61 -62
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [0.9.3] — 2026-02-25
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
- **`memorix_timeline` "not found" bug** — Timeline was using unreliable Orama empty-term search. Now uses in-memory observations (same fix pattern as `memorix_detail`).
|
|
9
|
+
- **`memorix_retention` "no observations found" bug** — Same root cause as timeline. Now uses in-memory observations for reliable document retrieval.
|
|
10
|
+
- **`memorix_search` cross-IDE projectId mismatch** — Removed redundant projectId filter from search. Data isolation is already handled at the directory level. Different IDEs resolving different projectIds for the same directory no longer causes empty search results.
|
|
11
|
+
- **Claude Code hooks format** — Updated `generateClaudeConfig` to use the new `{matcher: {}, hooks: [...]}` structure required by Claude Code 2025+. Fixes "Expected array, but received undefined" error on `memorix hooks install --agent claude --global`.
|
|
12
|
+
- **EPERM `process.cwd()` crash** — All CLI commands (`serve`, `hooks install/uninstall/status`) now safely handle `process.cwd()` failures (e.g., deleted CWD on macOS) with fallback to home directory.
|
|
13
|
+
|
|
14
|
+
## [0.9.2] — 2026-02-25
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- **Empty directory support** — Memorix now starts successfully in any directory, even without `.git` or `package.json`. No more `__invalid__` project errors for brand new folders. Only truly dangerous directories (home dir, drive root, system dirs) are rejected.
|
|
18
|
+
- **`findPackageRoot` safety** — Walking up from temp/nested directories no longer accidentally selects the home directory as project root.
|
|
19
|
+
|
|
20
|
+
### Changed
|
|
21
|
+
- **README rewrite** — Complete rewrite of Quick Start section for both EN and 中文 READMEs:
|
|
22
|
+
- Two-step install (global install + MCP config) instead of error-prone `npx`
|
|
23
|
+
- Per-agent config examples (Claude Code, Cursor, Windsurf, etc.)
|
|
24
|
+
- Troubleshooting table for common errors
|
|
25
|
+
- AI-friendly: agents reading the README will now configure correctly on first try
|
|
26
|
+
|
|
5
27
|
## [0.9.1] — 2026-02-25
|
|
6
28
|
|
|
7
29
|
### Fixed
|
package/README.md
CHANGED
|
@@ -49,35 +49,90 @@ Your AI assistant forgets everything when you start a new chat. You spend 10 min
|
|
|
49
49
|
|
|
50
50
|
## ⚡ Get Started in 30 Seconds
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
### Step 1: Install globally (one-time)
|
|
53
53
|
|
|
54
|
+
```bash
|
|
55
|
+
npm install -g memorix
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
> ⚠️ **Do NOT use `npx`** — npx downloads the package every time, which causes MCP server initialization timeout (60s limit). Global install starts instantly.
|
|
59
|
+
|
|
60
|
+
### Step 2: Add to your agent's MCP config
|
|
61
|
+
|
|
62
|
+
<details open>
|
|
63
|
+
<summary><strong>Claude Code</strong></summary>
|
|
64
|
+
|
|
65
|
+
Run in terminal:
|
|
66
|
+
```bash
|
|
67
|
+
claude mcp add memorix -- memorix serve
|
|
68
|
+
```
|
|
69
|
+
Or manually add to `~/.claude.json`:
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"memorix": {
|
|
74
|
+
"command": "memorix",
|
|
75
|
+
"args": ["serve"]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
</details>
|
|
81
|
+
|
|
82
|
+
<details>
|
|
83
|
+
<summary><strong>Cursor</strong></summary>
|
|
84
|
+
|
|
85
|
+
Add to `.cursor/mcp.json` in your project:
|
|
54
86
|
```json
|
|
55
87
|
{
|
|
56
88
|
"mcpServers": {
|
|
57
89
|
"memorix": {
|
|
58
|
-
"command": "
|
|
59
|
-
"args": ["
|
|
90
|
+
"command": "memorix",
|
|
91
|
+
"args": ["serve"]
|
|
60
92
|
}
|
|
61
93
|
}
|
|
62
94
|
}
|
|
63
95
|
```
|
|
96
|
+
</details>
|
|
64
97
|
|
|
65
|
-
>
|
|
66
|
-
>
|
|
98
|
+
<details>
|
|
99
|
+
<summary><strong>Windsurf</strong></summary>
|
|
67
100
|
|
|
68
|
-
|
|
101
|
+
Add to Windsurf MCP settings (`~/.codeium/windsurf/mcp_config.json`):
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"mcpServers": {
|
|
105
|
+
"memorix": {
|
|
106
|
+
"command": "memorix",
|
|
107
|
+
"args": ["serve"]
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
</details>
|
|
69
113
|
|
|
70
114
|
<details>
|
|
71
|
-
<summary
|
|
115
|
+
<summary><strong>VS Code Copilot / Codex / Kiro / Antigravity</strong></summary>
|
|
72
116
|
|
|
73
|
-
|
|
117
|
+
Same format — add to the agent's MCP config file:
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"mcpServers": {
|
|
121
|
+
"memorix": {
|
|
122
|
+
"command": "memorix",
|
|
123
|
+
"args": ["serve"]
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
74
128
|
|
|
129
|
+
**Antigravity only:** Antigravity uses its own install path as CWD. You **must** add:
|
|
75
130
|
```json
|
|
76
131
|
{
|
|
77
132
|
"mcpServers": {
|
|
78
133
|
"memorix": {
|
|
79
|
-
"command": "
|
|
80
|
-
"args": ["
|
|
134
|
+
"command": "memorix",
|
|
135
|
+
"args": ["serve"],
|
|
81
136
|
"env": {
|
|
82
137
|
"MEMORIX_PROJECT_ROOT": "E:/your/project/path"
|
|
83
138
|
}
|
|
@@ -85,8 +140,23 @@ Antigravity sets its working directory to its own install path (e.g., `G:\Antigr
|
|
|
85
140
|
}
|
|
86
141
|
}
|
|
87
142
|
```
|
|
143
|
+
</details>
|
|
144
|
+
|
|
145
|
+
### Step 3: Restart your agent — done!
|
|
146
|
+
|
|
147
|
+
No API keys. No cloud accounts. No dependencies. Works with any directory (git repo or not).
|
|
88
148
|
|
|
89
|
-
|
|
149
|
+
> 📖 **Full setup guide for all 7 agents** → [docs/SETUP.md](docs/SETUP.md)
|
|
150
|
+
|
|
151
|
+
<details>
|
|
152
|
+
<summary><strong>🔧 Troubleshooting</strong></summary>
|
|
153
|
+
|
|
154
|
+
| Problem | Solution |
|
|
155
|
+
|---------|----------|
|
|
156
|
+
| `MCP server initialization timed out after 60 seconds` | You're using `npx`. Run `npm install -g memorix` and change config to `"command": "memorix"` |
|
|
157
|
+
| `Cannot start Memorix: no valid project detected` | Your CWD is a system directory (home, Desktop, etc). Open a real project folder or set `MEMORIX_PROJECT_ROOT` |
|
|
158
|
+
| `memorix: command not found` | Run `npm install -g memorix` first. Verify with `memorix --version` |
|
|
159
|
+
| Parameter type errors (GLM/non-Anthropic models) | Update to v0.9.1+: `npm install -g memorix@latest` |
|
|
90
160
|
|
|
91
161
|
</details>
|
|
92
162
|
|
package/README.zh-CN.md
CHANGED
|
@@ -49,35 +49,90 @@
|
|
|
49
49
|
|
|
50
50
|
## ⚡ 30 秒快速开始
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
### 第一步:全局安装(只需一次)
|
|
53
53
|
|
|
54
|
+
```bash
|
|
55
|
+
npm install -g memorix
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
> ⚠️ **不要用 `npx`** — npx 每次都会重新下载包,会导致 MCP 服务器初始化超时(60 秒限制)。全局安装后秒启动。
|
|
59
|
+
|
|
60
|
+
### 第二步:添加到你的 Agent 的 MCP 配置
|
|
61
|
+
|
|
62
|
+
<details open>
|
|
63
|
+
<summary><strong>Claude Code</strong></summary>
|
|
64
|
+
|
|
65
|
+
在终端执行:
|
|
66
|
+
```bash
|
|
67
|
+
claude mcp add memorix -- memorix serve
|
|
68
|
+
```
|
|
69
|
+
或手动添加到 `~/.claude.json`:
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"memorix": {
|
|
74
|
+
"command": "memorix",
|
|
75
|
+
"args": ["serve"]
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
</details>
|
|
81
|
+
|
|
82
|
+
<details>
|
|
83
|
+
<summary><strong>Cursor</strong></summary>
|
|
84
|
+
|
|
85
|
+
添加到项目目录的 `.cursor/mcp.json`:
|
|
54
86
|
```json
|
|
55
87
|
{
|
|
56
88
|
"mcpServers": {
|
|
57
89
|
"memorix": {
|
|
58
|
-
"command": "
|
|
59
|
-
"args": ["
|
|
90
|
+
"command": "memorix",
|
|
91
|
+
"args": ["serve"]
|
|
60
92
|
}
|
|
61
93
|
}
|
|
62
94
|
}
|
|
63
95
|
```
|
|
96
|
+
</details>
|
|
64
97
|
|
|
65
|
-
>
|
|
66
|
-
>
|
|
98
|
+
<details>
|
|
99
|
+
<summary><strong>Windsurf</strong></summary>
|
|
67
100
|
|
|
68
|
-
|
|
101
|
+
添加到 Windsurf MCP 配置(`~/.codeium/windsurf/mcp_config.json`):
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"mcpServers": {
|
|
105
|
+
"memorix": {
|
|
106
|
+
"command": "memorix",
|
|
107
|
+
"args": ["serve"]
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
</details>
|
|
69
113
|
|
|
70
114
|
<details>
|
|
71
|
-
<summary
|
|
115
|
+
<summary><strong>VS Code Copilot / Codex / Kiro / Antigravity</strong></summary>
|
|
72
116
|
|
|
73
|
-
|
|
117
|
+
同样的格式 — 添加到对应 Agent 的 MCP 配置文件:
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"mcpServers": {
|
|
121
|
+
"memorix": {
|
|
122
|
+
"command": "memorix",
|
|
123
|
+
"args": ["serve"]
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
```
|
|
74
128
|
|
|
129
|
+
**仅 Antigravity:** Antigravity 使用自身安装路径作为工作目录,**必须**添加:
|
|
75
130
|
```json
|
|
76
131
|
{
|
|
77
132
|
"mcpServers": {
|
|
78
133
|
"memorix": {
|
|
79
|
-
"command": "
|
|
80
|
-
"args": ["
|
|
134
|
+
"command": "memorix",
|
|
135
|
+
"args": ["serve"],
|
|
81
136
|
"env": {
|
|
82
137
|
"MEMORIX_PROJECT_ROOT": "E:/your/project/path"
|
|
83
138
|
}
|
|
@@ -85,8 +140,23 @@ Antigravity 会将工作目录设为自身安装路径(如 `G:\Antigravity`)
|
|
|
85
140
|
}
|
|
86
141
|
}
|
|
87
142
|
```
|
|
143
|
+
</details>
|
|
144
|
+
|
|
145
|
+
### 第三步:重启你的 Agent — 完成!
|
|
146
|
+
|
|
147
|
+
不需要 API Key,不需要云账号,不需要额外依赖。**任何目录都能用**(有没有 git 都行)。
|
|
88
148
|
|
|
89
|
-
|
|
149
|
+
> 📖 **7 个 Agent 的完整配置指南** → [docs/SETUP.md](docs/SETUP.md)
|
|
150
|
+
|
|
151
|
+
<details>
|
|
152
|
+
<summary><strong>🔧 常见问题</strong></summary>
|
|
153
|
+
|
|
154
|
+
| 问题 | 解决方案 |
|
|
155
|
+
|------|----------|
|
|
156
|
+
| `MCP server initialization timed out after 60 seconds` | 你在用 `npx`。执行 `npm install -g memorix`,然后把配置改成 `"command": "memorix"` |
|
|
157
|
+
| `Cannot start Memorix: no valid project detected` | 你的工作目录是系统目录(主目录、桌面等)。打开一个真正的项目文件夹,或设置 `MEMORIX_PROJECT_ROOT` |
|
|
158
|
+
| `memorix: command not found` | 先执行 `npm install -g memorix`,用 `memorix --version` 验证 |
|
|
159
|
+
| 参数类型错误(GLM/非 Anthropic 模型) | 更新到 v0.9.1+:`npm install -g memorix@latest` |
|
|
90
160
|
|
|
91
161
|
</details>
|
|
92
162
|
|
package/dist/cli/index.js
CHANGED
|
@@ -959,37 +959,30 @@ async function getObservationsByIds(ids, projectId) {
|
|
|
959
959
|
}
|
|
960
960
|
return results;
|
|
961
961
|
}
|
|
962
|
-
async function getTimeline(anchorId,
|
|
963
|
-
const
|
|
964
|
-
const
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
};
|
|
968
|
-
if (projectId) {
|
|
969
|
-
searchParams.where = { projectId };
|
|
970
|
-
}
|
|
971
|
-
const allResults = await search(database, searchParams);
|
|
972
|
-
const docs = allResults.hits.map((h) => h.document).sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
973
|
-
const anchorIndex = docs.findIndex((d) => d.observationId === anchorId);
|
|
962
|
+
async function getTimeline(anchorId, _projectId, depthBefore = 3, depthAfter = 3) {
|
|
963
|
+
const { getAllObservations: getAllObservations2 } = await Promise.resolve().then(() => (init_observations(), observations_exports));
|
|
964
|
+
const allObs = getAllObservations2();
|
|
965
|
+
const sorted = allObs.sort((a, b) => a.createdAt.localeCompare(b.createdAt));
|
|
966
|
+
const anchorIndex = sorted.findIndex((o) => o.id === anchorId);
|
|
974
967
|
if (anchorIndex === -1) {
|
|
975
968
|
return { before: [], anchor: null, after: [] };
|
|
976
969
|
}
|
|
977
|
-
const toIndexEntry = (
|
|
978
|
-
const obsType =
|
|
970
|
+
const toIndexEntry = (obs) => {
|
|
971
|
+
const obsType = obs.type;
|
|
979
972
|
return {
|
|
980
|
-
id:
|
|
981
|
-
time: formatTime(
|
|
973
|
+
id: obs.id,
|
|
974
|
+
time: formatTime(obs.createdAt),
|
|
982
975
|
type: obsType,
|
|
983
976
|
icon: OBSERVATION_ICONS[obsType] ?? "\u2753",
|
|
984
|
-
title:
|
|
985
|
-
tokens:
|
|
977
|
+
title: obs.title,
|
|
978
|
+
tokens: obs.tokens
|
|
986
979
|
};
|
|
987
980
|
};
|
|
988
|
-
const before =
|
|
989
|
-
const after =
|
|
981
|
+
const before = sorted.slice(Math.max(0, anchorIndex - depthBefore), anchorIndex).map(toIndexEntry);
|
|
982
|
+
const after = sorted.slice(anchorIndex + 1, anchorIndex + 1 + depthAfter).map(toIndexEntry);
|
|
990
983
|
return {
|
|
991
984
|
before,
|
|
992
|
-
anchor: toIndexEntry(
|
|
985
|
+
anchor: toIndexEntry(sorted[anchorIndex]),
|
|
993
986
|
after
|
|
994
987
|
};
|
|
995
988
|
}
|
|
@@ -1169,6 +1162,7 @@ var init_entity_extractor = __esm({
|
|
|
1169
1162
|
// src/memory/observations.ts
|
|
1170
1163
|
var observations_exports = {};
|
|
1171
1164
|
__export(observations_exports, {
|
|
1165
|
+
getAllObservations: () => getAllObservations,
|
|
1172
1166
|
getObservation: () => getObservation,
|
|
1173
1167
|
getObservationCount: () => getObservationCount2,
|
|
1174
1168
|
getProjectObservations: () => getProjectObservations,
|
|
@@ -1336,6 +1330,9 @@ function getObservation(id) {
|
|
|
1336
1330
|
function getProjectObservations(projectId) {
|
|
1337
1331
|
return observations.filter((o) => o.projectId === projectId);
|
|
1338
1332
|
}
|
|
1333
|
+
function getAllObservations() {
|
|
1334
|
+
return [...observations];
|
|
1335
|
+
}
|
|
1339
1336
|
function getObservationCount2() {
|
|
1340
1337
|
return observations.length;
|
|
1341
1338
|
}
|
|
@@ -1678,20 +1675,19 @@ function detectProject(cwd) {
|
|
|
1678
1675
|
const name2 = id2.split("/").pop() ?? path4.basename(rootPath);
|
|
1679
1676
|
return { id: id2, name: name2, gitRemote, rootPath };
|
|
1680
1677
|
}
|
|
1681
|
-
if (
|
|
1678
|
+
if (isDangerousRoot(rootPath)) {
|
|
1682
1679
|
console.error(`[memorix] Skipped invalid project root: ${rootPath}`);
|
|
1683
1680
|
return { id: "__invalid__", name: "unknown", rootPath };
|
|
1684
1681
|
}
|
|
1685
1682
|
const name = path4.basename(rootPath);
|
|
1686
1683
|
const id = `local/${name}`;
|
|
1687
|
-
console.error(`[memorix] Warning: no git remote found at ${rootPath}, using fallback projectId: ${id}`);
|
|
1688
1684
|
return { id, name, rootPath };
|
|
1689
1685
|
}
|
|
1690
|
-
function
|
|
1686
|
+
function isDangerousRoot(dirPath) {
|
|
1691
1687
|
const resolved = path4.resolve(dirPath);
|
|
1692
1688
|
const home = path4.resolve(os2.homedir());
|
|
1693
|
-
if (resolved === home) return
|
|
1694
|
-
if (resolved === path4.parse(resolved).root) return
|
|
1689
|
+
if (resolved === home) return true;
|
|
1690
|
+
if (resolved === path4.parse(resolved).root) return true;
|
|
1695
1691
|
const basename2 = path4.basename(resolved).toLowerCase();
|
|
1696
1692
|
const knownNonProjectDirs = /* @__PURE__ */ new Set([
|
|
1697
1693
|
// IDE / editor config dirs
|
|
@@ -1728,31 +1724,16 @@ function isValidProjectRoot(dirPath) {
|
|
|
1728
1724
|
if (knownNonProjectDirs.has(basename2)) {
|
|
1729
1725
|
const parent = path4.resolve(path4.dirname(resolved));
|
|
1730
1726
|
if (parent === home || parent === path4.parse(parent).root) {
|
|
1731
|
-
return
|
|
1727
|
+
return true;
|
|
1732
1728
|
}
|
|
1733
1729
|
}
|
|
1734
|
-
|
|
1735
|
-
"package.json",
|
|
1736
|
-
"Cargo.toml",
|
|
1737
|
-
"go.mod",
|
|
1738
|
-
"pyproject.toml",
|
|
1739
|
-
"setup.py",
|
|
1740
|
-
"pom.xml",
|
|
1741
|
-
"build.gradle",
|
|
1742
|
-
"Makefile",
|
|
1743
|
-
"CMakeLists.txt",
|
|
1744
|
-
"composer.json",
|
|
1745
|
-
"Gemfile",
|
|
1746
|
-
".git",
|
|
1747
|
-
"README.md",
|
|
1748
|
-
"README"
|
|
1749
|
-
];
|
|
1750
|
-
return projectIndicators.some((f) => existsSync(path4.join(resolved, f)));
|
|
1730
|
+
return false;
|
|
1751
1731
|
}
|
|
1752
1732
|
function findPackageRoot(cwd) {
|
|
1753
1733
|
let dir = path4.resolve(cwd);
|
|
1754
1734
|
const root = path4.parse(dir).root;
|
|
1755
1735
|
while (dir !== root) {
|
|
1736
|
+
if (isDangerousRoot(dir)) return null;
|
|
1756
1737
|
if (existsSync(path4.join(dir, "package.json"))) {
|
|
1757
1738
|
return dir;
|
|
1758
1739
|
}
|
|
@@ -3719,18 +3700,23 @@ function resolveHookCommand() {
|
|
|
3719
3700
|
}
|
|
3720
3701
|
function generateClaudeConfig() {
|
|
3721
3702
|
const cmd = `${resolveHookCommand()} hook`;
|
|
3722
|
-
const
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3703
|
+
const hookGroup = {
|
|
3704
|
+
matcher: {},
|
|
3705
|
+
hooks: [
|
|
3706
|
+
{
|
|
3707
|
+
type: "command",
|
|
3708
|
+
command: cmd,
|
|
3709
|
+
timeout: 10
|
|
3710
|
+
}
|
|
3711
|
+
]
|
|
3726
3712
|
};
|
|
3727
3713
|
return {
|
|
3728
3714
|
hooks: {
|
|
3729
|
-
SessionStart: [
|
|
3730
|
-
PostToolUse: [
|
|
3731
|
-
UserPromptSubmit: [
|
|
3732
|
-
PreCompact: [
|
|
3733
|
-
Stop: [
|
|
3715
|
+
SessionStart: [hookGroup],
|
|
3716
|
+
PostToolUse: [hookGroup],
|
|
3717
|
+
UserPromptSubmit: [hookGroup],
|
|
3718
|
+
PreCompact: [hookGroup],
|
|
3719
|
+
Stop: [hookGroup]
|
|
3734
3720
|
}
|
|
3735
3721
|
};
|
|
3736
3722
|
}
|
|
@@ -5629,8 +5615,10 @@ Use this as the \`topicKey\` parameter in \`memorix_store\` to enable upsert beh
|
|
|
5629
5615
|
maxTokens: safeMaxTokens,
|
|
5630
5616
|
since,
|
|
5631
5617
|
until,
|
|
5632
|
-
//
|
|
5633
|
-
projectId
|
|
5618
|
+
// Data isolation is handled at the directory level (each project has its own data dir).
|
|
5619
|
+
// No projectId filter needed — avoids cross-IDE search failures when different IDEs
|
|
5620
|
+
// resolve different projectIds for the same directory.
|
|
5621
|
+
projectId: void 0
|
|
5634
5622
|
});
|
|
5635
5623
|
let text = result.formatted;
|
|
5636
5624
|
if (!syncAdvisoryShown && syncAdvisory) {
|
|
@@ -5727,13 +5715,24 @@ ${result.remaining} active observations remaining.
|
|
|
5727
5715
|
Archived memories can be restored manually if needed.` }]
|
|
5728
5716
|
};
|
|
5729
5717
|
}
|
|
5730
|
-
const
|
|
5731
|
-
const
|
|
5732
|
-
|
|
5733
|
-
|
|
5734
|
-
|
|
5735
|
-
|
|
5736
|
-
|
|
5718
|
+
const { getAllObservations: getAllObservations2 } = await Promise.resolve().then(() => (init_observations(), observations_exports));
|
|
5719
|
+
const allObs = getAllObservations2();
|
|
5720
|
+
const docs = allObs.map((obs) => ({
|
|
5721
|
+
id: `obs-${obs.id}`,
|
|
5722
|
+
observationId: obs.id,
|
|
5723
|
+
entityName: obs.entityName,
|
|
5724
|
+
type: obs.type,
|
|
5725
|
+
title: obs.title,
|
|
5726
|
+
narrative: obs.narrative,
|
|
5727
|
+
facts: obs.facts.join("\n"),
|
|
5728
|
+
filesModified: obs.filesModified.join("\n"),
|
|
5729
|
+
concepts: obs.concepts.join(", "),
|
|
5730
|
+
tokens: obs.tokens,
|
|
5731
|
+
createdAt: obs.createdAt,
|
|
5732
|
+
projectId: obs.projectId,
|
|
5733
|
+
accessCount: 0,
|
|
5734
|
+
lastAccessedAt: ""
|
|
5735
|
+
}));
|
|
5737
5736
|
if (docs.length === 0) {
|
|
5738
5737
|
return {
|
|
5739
5738
|
content: [{ type: "text", text: "No observations found for this project." }]
|
|
@@ -6603,7 +6602,13 @@ var init_serve = __esm({
|
|
|
6603
6602
|
const { McpServer: McpServer2 } = await import("@modelcontextprotocol/sdk/server/mcp.js");
|
|
6604
6603
|
const { createMemorixServer: createMemorixServer2 } = await Promise.resolve().then(() => (init_server2(), server_exports2));
|
|
6605
6604
|
const { detectProject: detectProject2 } = await Promise.resolve().then(() => (init_detector(), detector_exports));
|
|
6606
|
-
let
|
|
6605
|
+
let safeCwd;
|
|
6606
|
+
try {
|
|
6607
|
+
safeCwd = process.cwd();
|
|
6608
|
+
} catch {
|
|
6609
|
+
safeCwd = (await import("os")).homedir();
|
|
6610
|
+
}
|
|
6611
|
+
let projectRoot = args.cwd || process.env.MEMORIX_PROJECT_ROOT || process.env.INIT_CWD || safeCwd;
|
|
6607
6612
|
console.error(`[memorix] Starting with cwd: ${projectRoot}`);
|
|
6608
6613
|
const earlyDetect = detectProject2(projectRoot);
|
|
6609
6614
|
const needsRoots = earlyDetect.id === "__invalid__" || earlyDetect.id.startsWith("local/");
|
|
@@ -7502,7 +7507,14 @@ var init_hooks_install = __esm({
|
|
|
7502
7507
|
},
|
|
7503
7508
|
run: async ({ args }) => {
|
|
7504
7509
|
const { detectInstalledAgents: detectInstalledAgents2, installHooks: installHooks2 } = await Promise.resolve().then(() => (init_installers(), installers_exports));
|
|
7505
|
-
const
|
|
7510
|
+
const os4 = await import("os");
|
|
7511
|
+
let cwd;
|
|
7512
|
+
try {
|
|
7513
|
+
cwd = process.cwd();
|
|
7514
|
+
} catch {
|
|
7515
|
+
cwd = os4.homedir();
|
|
7516
|
+
console.log(`\u26A0\uFE0F Could not access current directory, using home: ${cwd}`);
|
|
7517
|
+
}
|
|
7506
7518
|
let agents;
|
|
7507
7519
|
if (args.agent) {
|
|
7508
7520
|
agents = [args.agent];
|
|
@@ -7563,7 +7575,13 @@ var init_hooks_uninstall = __esm({
|
|
|
7563
7575
|
},
|
|
7564
7576
|
run: async ({ args }) => {
|
|
7565
7577
|
const { detectInstalledAgents: detectInstalledAgents2, uninstallHooks: uninstallHooks2 } = await Promise.resolve().then(() => (init_installers(), installers_exports));
|
|
7566
|
-
const
|
|
7578
|
+
const os4 = await import("os");
|
|
7579
|
+
let cwd;
|
|
7580
|
+
try {
|
|
7581
|
+
cwd = process.cwd();
|
|
7582
|
+
} catch {
|
|
7583
|
+
cwd = os4.homedir();
|
|
7584
|
+
}
|
|
7567
7585
|
let agents;
|
|
7568
7586
|
if (args.agent) {
|
|
7569
7587
|
agents = [args.agent];
|
|
@@ -7605,7 +7623,13 @@ var init_hooks_status = __esm({
|
|
|
7605
7623
|
},
|
|
7606
7624
|
run: async () => {
|
|
7607
7625
|
const { getHookStatus: getHookStatus2 } = await Promise.resolve().then(() => (init_installers(), installers_exports));
|
|
7608
|
-
const
|
|
7626
|
+
const os4 = await import("os");
|
|
7627
|
+
let cwd;
|
|
7628
|
+
try {
|
|
7629
|
+
cwd = process.cwd();
|
|
7630
|
+
} catch {
|
|
7631
|
+
cwd = os4.homedir();
|
|
7632
|
+
}
|
|
7609
7633
|
const statuses = await getHookStatus2(cwd);
|
|
7610
7634
|
console.log("\nMemorix Hooks Status");
|
|
7611
7635
|
console.log("\u2550".repeat(50));
|