claude-memory-agent 2.0.1 → 2.1.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.
- package/README.md +206 -206
- package/agent_card.py +186 -0
- package/bin/cli.js +317 -185
- package/bin/postinstall.js +270 -270
- package/dashboard.html +4232 -2689
- package/hooks/__pycache__/grounding-hook.cpython-312.pyc +0 -0
- package/hooks/__pycache__/session_end.cpython-312.pyc +0 -0
- package/hooks/grounding-hook.py +422 -348
- package/hooks/session_end.py +293 -192
- package/hooks/session_start.py +227 -227
- package/install.py +919 -902
- package/main.py +4496 -2859
- package/package.json +47 -47
- package/services/__init__.py +50 -50
- package/services/__pycache__/__init__.cpython-312.pyc +0 -0
- package/services/__pycache__/curator.cpython-312.pyc +0 -0
- package/services/__pycache__/database.cpython-312.pyc +0 -0
- package/services/curator.py +1606 -0
- package/services/database.py +3637 -2485
- package/skills/__init__.py +21 -1
- package/skills/__pycache__/__init__.cpython-312.pyc +0 -0
- package/skills/__pycache__/confidence_tracker.cpython-312.pyc +0 -0
- package/skills/__pycache__/context.cpython-312.pyc +0 -0
- package/skills/__pycache__/curator.cpython-312.pyc +0 -0
- package/skills/__pycache__/search.cpython-312.pyc +0 -0
- package/skills/__pycache__/session_review.cpython-312.pyc +0 -0
- package/skills/__pycache__/store.cpython-312.pyc +0 -0
- package/skills/confidence_tracker.py +441 -0
- package/skills/context.py +675 -0
- package/skills/curator.py +348 -0
- package/skills/search.py +369 -213
- package/skills/session_review.py +418 -0
- package/skills/store.py +377 -179
- package/update_system.py +829 -817
package/bin/postinstall.js
CHANGED
|
@@ -1,270 +1,270 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Post-installation script for Claude Memory Agent
|
|
5
|
-
*
|
|
6
|
-
* This runs automatically after npm install to:
|
|
7
|
-
* 1. Check Python availability
|
|
8
|
-
* 2. Install Python dependencies
|
|
9
|
-
* 3. Run the configuration wizard (if interactive)
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const { execSync, spawn } = require('child_process');
|
|
13
|
-
const path = require('path');
|
|
14
|
-
const fs = require('fs');
|
|
15
|
-
const readline = require('readline');
|
|
16
|
-
|
|
17
|
-
const AGENT_DIR = path.dirname(__dirname);
|
|
18
|
-
|
|
19
|
-
// Colors for terminal output
|
|
20
|
-
const colors = {
|
|
21
|
-
reset: '\x1b[0m',
|
|
22
|
-
green: '\x1b[32m',
|
|
23
|
-
yellow: '\x1b[33m',
|
|
24
|
-
red: '\x1b[31m',
|
|
25
|
-
cyan: '\x1b[36m',
|
|
26
|
-
bold: '\x1b[1m'
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
function log(msg) {
|
|
30
|
-
console.log(msg);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
function success(msg) {
|
|
34
|
-
console.log(`${colors.green}✓${colors.reset} ${msg}`);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function warn(msg) {
|
|
38
|
-
console.log(`${colors.yellow}!${colors.reset} ${msg}`);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function error(msg) {
|
|
42
|
-
console.log(`${colors.red}✗${colors.reset} ${msg}`);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function header(msg) {
|
|
46
|
-
console.log(`\n${colors.bold}${colors.cyan}${msg}${colors.reset}\n`);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Check Python availability
|
|
50
|
-
function getPython() {
|
|
51
|
-
const pythonCommands = ['python3', 'python', 'py'];
|
|
52
|
-
|
|
53
|
-
for (const cmd of pythonCommands) {
|
|
54
|
-
try {
|
|
55
|
-
const result = execSync(`${cmd} --version`, {
|
|
56
|
-
encoding: 'utf8',
|
|
57
|
-
stdio: ['pipe', 'pipe', 'pipe']
|
|
58
|
-
});
|
|
59
|
-
const match = result.match(/Python (\d+)\.(\d+)/);
|
|
60
|
-
if (match) {
|
|
61
|
-
const major = parseInt(match[1]);
|
|
62
|
-
const minor = parseInt(match[2]);
|
|
63
|
-
if (major >= 3 && minor >= 9) {
|
|
64
|
-
return { cmd, version: result.trim() };
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
} catch (e) {
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
// Check if Ollama is running
|
|
75
|
-
function checkOllama() {
|
|
76
|
-
try {
|
|
77
|
-
const http = require('http');
|
|
78
|
-
return new Promise((resolve) => {
|
|
79
|
-
const req = http.get('http://localhost:11434/api/tags', { timeout: 2000 }, (res) => {
|
|
80
|
-
resolve(res.statusCode === 200);
|
|
81
|
-
});
|
|
82
|
-
req.on('error', () => resolve(false));
|
|
83
|
-
req.on('timeout', () => {
|
|
84
|
-
req.destroy();
|
|
85
|
-
resolve(false);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
} catch (e) {
|
|
89
|
-
return Promise.resolve(false);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// Install Python dependencies
|
|
94
|
-
function installPythonDeps(python) {
|
|
95
|
-
const requirementsPath = path.join(AGENT_DIR, 'requirements.txt');
|
|
96
|
-
|
|
97
|
-
if (!fs.existsSync(requirementsPath)) {
|
|
98
|
-
warn('requirements.txt not found, skipping Python dependencies');
|
|
99
|
-
return true;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
log('Installing Python dependencies...');
|
|
103
|
-
try {
|
|
104
|
-
execSync(`${python} -m pip install -r requirements.txt -q --disable-pip-version-check`, {
|
|
105
|
-
cwd: AGENT_DIR,
|
|
106
|
-
stdio: ['pipe', 'pipe', 'pipe']
|
|
107
|
-
});
|
|
108
|
-
success('Python dependencies installed');
|
|
109
|
-
return true;
|
|
110
|
-
} catch (e) {
|
|
111
|
-
error('Failed to install Python dependencies');
|
|
112
|
-
console.log(' Run manually: pip install -r requirements.txt');
|
|
113
|
-
return false;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// Create .env file if it doesn't exist
|
|
118
|
-
function createEnvFile() {
|
|
119
|
-
const envPath = path.join(AGENT_DIR, '.env');
|
|
120
|
-
const examplePath = path.join(AGENT_DIR, '.env.example');
|
|
121
|
-
|
|
122
|
-
if (fs.existsSync(envPath)) {
|
|
123
|
-
success('.env file already exists');
|
|
124
|
-
return true;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
// Create basic .env
|
|
128
|
-
const envContent = `# Claude Memory Agent Configuration
|
|
129
|
-
# Generated during npm install
|
|
130
|
-
|
|
131
|
-
# Server
|
|
132
|
-
PORT=8102
|
|
133
|
-
HOST=0.0.0.0
|
|
134
|
-
MEMORY_AGENT_URL=http://localhost:8102
|
|
135
|
-
|
|
136
|
-
# Ollama
|
|
137
|
-
OLLAMA_HOST=http://localhost:11434
|
|
138
|
-
EMBEDDING_MODEL=nomic-embed-text
|
|
139
|
-
|
|
140
|
-
# Database (relative to agent directory)
|
|
141
|
-
DATABASE_PATH=${path.join(AGENT_DIR, 'memories.db').replace(/\\/g, '/')}
|
|
142
|
-
|
|
143
|
-
# Logging
|
|
144
|
-
LOG_LEVEL=INFO
|
|
145
|
-
`;
|
|
146
|
-
|
|
147
|
-
try {
|
|
148
|
-
fs.writeFileSync(envPath, envContent);
|
|
149
|
-
success('Created .env configuration file');
|
|
150
|
-
return true;
|
|
151
|
-
} catch (e) {
|
|
152
|
-
warn('Could not create .env file');
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// Main installation
|
|
158
|
-
async function main() {
|
|
159
|
-
header('Claude Memory Agent - Post-Installation Setup');
|
|
160
|
-
|
|
161
|
-
// Check Python
|
|
162
|
-
log('Checking Python...');
|
|
163
|
-
const python = getPython();
|
|
164
|
-
if (!python) {
|
|
165
|
-
error('Python 3.9+ is required but not found');
|
|
166
|
-
console.log('\n Please install Python from https://python.org/');
|
|
167
|
-
console.log(' Then run: claude-memory-agent install\n');
|
|
168
|
-
process.exit(1);
|
|
169
|
-
}
|
|
170
|
-
success(`Found ${python.version}`);
|
|
171
|
-
|
|
172
|
-
// Install Python dependencies
|
|
173
|
-
installPythonDeps(python.cmd);
|
|
174
|
-
|
|
175
|
-
// Create .env file
|
|
176
|
-
createEnvFile();
|
|
177
|
-
|
|
178
|
-
// Check Ollama
|
|
179
|
-
log('Checking Ollama...');
|
|
180
|
-
const ollamaRunning = await checkOllama();
|
|
181
|
-
|
|
182
|
-
if (ollamaRunning) {
|
|
183
|
-
success('Ollama is running');
|
|
184
|
-
// Check if model is installed
|
|
185
|
-
const modelInstalled = await checkOllamaModel();
|
|
186
|
-
if (modelInstalled) {
|
|
187
|
-
success('Embedding model is ready');
|
|
188
|
-
} else {
|
|
189
|
-
warn('Embedding model not found');
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// Print next steps based on what's missing
|
|
194
|
-
header('Installation Complete!');
|
|
195
|
-
|
|
196
|
-
if (!ollamaRunning) {
|
|
197
|
-
// Ollama not installed - show big warning
|
|
198
|
-
console.log(`${colors.red}${colors.bold}╔════════════════════════════════════════════════════════════╗${colors.reset}`);
|
|
199
|
-
console.log(`${colors.red}${colors.bold}║ REQUIRED: Install Ollama for semantic search to work ║${colors.reset}`);
|
|
200
|
-
console.log(`${colors.red}${colors.bold}╚════════════════════════════════════════════════════════════╝${colors.reset}`);
|
|
201
|
-
console.log('');
|
|
202
|
-
console.log(' Ollama is required for the memory agent to work properly.');
|
|
203
|
-
console.log(' Without it, semantic search will be disabled.');
|
|
204
|
-
console.log('');
|
|
205
|
-
console.log(` ${colors.cyan}Step 1:${colors.reset} Download and install Ollama:`);
|
|
206
|
-
console.log(` ${colors.bold}https://ollama.ai/download${colors.reset}`);
|
|
207
|
-
console.log('');
|
|
208
|
-
console.log(` ${colors.cyan}Step 2:${colors.reset} After installing, open a terminal and run:`);
|
|
209
|
-
console.log(` ${colors.bold}ollama pull nomic-embed-text${colors.reset}`);
|
|
210
|
-
console.log('');
|
|
211
|
-
console.log(` ${colors.cyan}Step 3:${colors.reset} Start Ollama (it runs in background):`);
|
|
212
|
-
console.log(` ${colors.bold}ollama serve${colors.reset}`);
|
|
213
|
-
console.log('');
|
|
214
|
-
console.log(` ${colors.cyan}Step 4:${colors.reset} Then run the setup:`);
|
|
215
|
-
console.log(` ${colors.bold}claude-memory-agent install${colors.reset}`);
|
|
216
|
-
console.log('');
|
|
217
|
-
} else {
|
|
218
|
-
// Ollama running - show normal next steps
|
|
219
|
-
console.log('Next steps:');
|
|
220
|
-
console.log('');
|
|
221
|
-
console.log(' 1. Run the setup wizard:');
|
|
222
|
-
console.log(` ${colors.bold}claude-memory-agent install${colors.reset}`);
|
|
223
|
-
console.log('');
|
|
224
|
-
console.log(' 2. Start the agent:');
|
|
225
|
-
console.log(` ${colors.bold}claude-memory-agent start${colors.reset}`);
|
|
226
|
-
console.log('');
|
|
227
|
-
console.log(' 3. Open the dashboard:');
|
|
228
|
-
console.log(` ${colors.bold}claude-memory-agent dashboard${colors.reset}`);
|
|
229
|
-
console.log('');
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// Check if embedding model is installed in Ollama
|
|
234
|
-
async function checkOllamaModel() {
|
|
235
|
-
try {
|
|
236
|
-
const http = require('http');
|
|
237
|
-
return new Promise((resolve) => {
|
|
238
|
-
const req = http.get('http://localhost:11434/api/tags', { timeout: 2000 }, (res) => {
|
|
239
|
-
let data = '';
|
|
240
|
-
res.on('data', chunk => data += chunk);
|
|
241
|
-
res.on('end', () => {
|
|
242
|
-
try {
|
|
243
|
-
const json = JSON.parse(data);
|
|
244
|
-
const models = json.models || [];
|
|
245
|
-
const hasModel = models.some(m =>
|
|
246
|
-
m.name && m.name.includes('nomic-embed-text')
|
|
247
|
-
);
|
|
248
|
-
resolve(hasModel);
|
|
249
|
-
} catch (e) {
|
|
250
|
-
resolve(false);
|
|
251
|
-
}
|
|
252
|
-
});
|
|
253
|
-
});
|
|
254
|
-
req.on('error', () => resolve(false));
|
|
255
|
-
req.on('timeout', () => {
|
|
256
|
-
req.destroy();
|
|
257
|
-
resolve(false);
|
|
258
|
-
});
|
|
259
|
-
});
|
|
260
|
-
} catch (e) {
|
|
261
|
-
return false;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
// Run if not in CI/CD environment
|
|
266
|
-
if (!process.env.CI && !process.env.npm_config_ignore_scripts) {
|
|
267
|
-
main().catch(console.error);
|
|
268
|
-
} else {
|
|
269
|
-
console.log('Skipping post-install in CI environment');
|
|
270
|
-
}
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Post-installation script for Claude Memory Agent
|
|
5
|
+
*
|
|
6
|
+
* This runs automatically after npm install to:
|
|
7
|
+
* 1. Check Python availability
|
|
8
|
+
* 2. Install Python dependencies
|
|
9
|
+
* 3. Run the configuration wizard (if interactive)
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const { execSync, spawn } = require('child_process');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const fs = require('fs');
|
|
15
|
+
const readline = require('readline');
|
|
16
|
+
|
|
17
|
+
const AGENT_DIR = path.dirname(__dirname);
|
|
18
|
+
|
|
19
|
+
// Colors for terminal output
|
|
20
|
+
const colors = {
|
|
21
|
+
reset: '\x1b[0m',
|
|
22
|
+
green: '\x1b[32m',
|
|
23
|
+
yellow: '\x1b[33m',
|
|
24
|
+
red: '\x1b[31m',
|
|
25
|
+
cyan: '\x1b[36m',
|
|
26
|
+
bold: '\x1b[1m'
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
function log(msg) {
|
|
30
|
+
console.log(msg);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function success(msg) {
|
|
34
|
+
console.log(`${colors.green}✓${colors.reset} ${msg}`);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function warn(msg) {
|
|
38
|
+
console.log(`${colors.yellow}!${colors.reset} ${msg}`);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function error(msg) {
|
|
42
|
+
console.log(`${colors.red}✗${colors.reset} ${msg}`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function header(msg) {
|
|
46
|
+
console.log(`\n${colors.bold}${colors.cyan}${msg}${colors.reset}\n`);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Check Python availability
|
|
50
|
+
function getPython() {
|
|
51
|
+
const pythonCommands = ['python3', 'python', 'py'];
|
|
52
|
+
|
|
53
|
+
for (const cmd of pythonCommands) {
|
|
54
|
+
try {
|
|
55
|
+
const result = execSync(`${cmd} --version`, {
|
|
56
|
+
encoding: 'utf8',
|
|
57
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
58
|
+
});
|
|
59
|
+
const match = result.match(/Python (\d+)\.(\d+)/);
|
|
60
|
+
if (match) {
|
|
61
|
+
const major = parseInt(match[1]);
|
|
62
|
+
const minor = parseInt(match[2]);
|
|
63
|
+
if (major >= 3 && minor >= 9) {
|
|
64
|
+
return { cmd, version: result.trim() };
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
} catch (e) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Check if Ollama is running
|
|
75
|
+
function checkOllama() {
|
|
76
|
+
try {
|
|
77
|
+
const http = require('http');
|
|
78
|
+
return new Promise((resolve) => {
|
|
79
|
+
const req = http.get('http://localhost:11434/api/tags', { timeout: 2000 }, (res) => {
|
|
80
|
+
resolve(res.statusCode === 200);
|
|
81
|
+
});
|
|
82
|
+
req.on('error', () => resolve(false));
|
|
83
|
+
req.on('timeout', () => {
|
|
84
|
+
req.destroy();
|
|
85
|
+
resolve(false);
|
|
86
|
+
});
|
|
87
|
+
});
|
|
88
|
+
} catch (e) {
|
|
89
|
+
return Promise.resolve(false);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Install Python dependencies
|
|
94
|
+
function installPythonDeps(python) {
|
|
95
|
+
const requirementsPath = path.join(AGENT_DIR, 'requirements.txt');
|
|
96
|
+
|
|
97
|
+
if (!fs.existsSync(requirementsPath)) {
|
|
98
|
+
warn('requirements.txt not found, skipping Python dependencies');
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
log('Installing Python dependencies...');
|
|
103
|
+
try {
|
|
104
|
+
execSync(`${python} -m pip install -r requirements.txt -q --disable-pip-version-check`, {
|
|
105
|
+
cwd: AGENT_DIR,
|
|
106
|
+
stdio: ['pipe', 'pipe', 'pipe']
|
|
107
|
+
});
|
|
108
|
+
success('Python dependencies installed');
|
|
109
|
+
return true;
|
|
110
|
+
} catch (e) {
|
|
111
|
+
error('Failed to install Python dependencies');
|
|
112
|
+
console.log(' Run manually: pip install -r requirements.txt');
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Create .env file if it doesn't exist
|
|
118
|
+
function createEnvFile() {
|
|
119
|
+
const envPath = path.join(AGENT_DIR, '.env');
|
|
120
|
+
const examplePath = path.join(AGENT_DIR, '.env.example');
|
|
121
|
+
|
|
122
|
+
if (fs.existsSync(envPath)) {
|
|
123
|
+
success('.env file already exists');
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Create basic .env
|
|
128
|
+
const envContent = `# Claude Memory Agent Configuration
|
|
129
|
+
# Generated during npm install
|
|
130
|
+
|
|
131
|
+
# Server
|
|
132
|
+
PORT=8102
|
|
133
|
+
HOST=0.0.0.0
|
|
134
|
+
MEMORY_AGENT_URL=http://localhost:8102
|
|
135
|
+
|
|
136
|
+
# Ollama
|
|
137
|
+
OLLAMA_HOST=http://localhost:11434
|
|
138
|
+
EMBEDDING_MODEL=nomic-embed-text
|
|
139
|
+
|
|
140
|
+
# Database (relative to agent directory)
|
|
141
|
+
DATABASE_PATH=${path.join(AGENT_DIR, 'memories.db').replace(/\\/g, '/')}
|
|
142
|
+
|
|
143
|
+
# Logging
|
|
144
|
+
LOG_LEVEL=INFO
|
|
145
|
+
`;
|
|
146
|
+
|
|
147
|
+
try {
|
|
148
|
+
fs.writeFileSync(envPath, envContent);
|
|
149
|
+
success('Created .env configuration file');
|
|
150
|
+
return true;
|
|
151
|
+
} catch (e) {
|
|
152
|
+
warn('Could not create .env file');
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Main installation
|
|
158
|
+
async function main() {
|
|
159
|
+
header('Claude Memory Agent - Post-Installation Setup');
|
|
160
|
+
|
|
161
|
+
// Check Python
|
|
162
|
+
log('Checking Python...');
|
|
163
|
+
const python = getPython();
|
|
164
|
+
if (!python) {
|
|
165
|
+
error('Python 3.9+ is required but not found');
|
|
166
|
+
console.log('\n Please install Python from https://python.org/');
|
|
167
|
+
console.log(' Then run: claude-memory-agent install\n');
|
|
168
|
+
process.exit(1);
|
|
169
|
+
}
|
|
170
|
+
success(`Found ${python.version}`);
|
|
171
|
+
|
|
172
|
+
// Install Python dependencies
|
|
173
|
+
installPythonDeps(python.cmd);
|
|
174
|
+
|
|
175
|
+
// Create .env file
|
|
176
|
+
createEnvFile();
|
|
177
|
+
|
|
178
|
+
// Check Ollama
|
|
179
|
+
log('Checking Ollama...');
|
|
180
|
+
const ollamaRunning = await checkOllama();
|
|
181
|
+
|
|
182
|
+
if (ollamaRunning) {
|
|
183
|
+
success('Ollama is running');
|
|
184
|
+
// Check if model is installed
|
|
185
|
+
const modelInstalled = await checkOllamaModel();
|
|
186
|
+
if (modelInstalled) {
|
|
187
|
+
success('Embedding model is ready');
|
|
188
|
+
} else {
|
|
189
|
+
warn('Embedding model not found');
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Print next steps based on what's missing
|
|
194
|
+
header('Installation Complete!');
|
|
195
|
+
|
|
196
|
+
if (!ollamaRunning) {
|
|
197
|
+
// Ollama not installed - show big warning
|
|
198
|
+
console.log(`${colors.red}${colors.bold}╔════════════════════════════════════════════════════════════╗${colors.reset}`);
|
|
199
|
+
console.log(`${colors.red}${colors.bold}║ REQUIRED: Install Ollama for semantic search to work ║${colors.reset}`);
|
|
200
|
+
console.log(`${colors.red}${colors.bold}╚════════════════════════════════════════════════════════════╝${colors.reset}`);
|
|
201
|
+
console.log('');
|
|
202
|
+
console.log(' Ollama is required for the memory agent to work properly.');
|
|
203
|
+
console.log(' Without it, semantic search will be disabled.');
|
|
204
|
+
console.log('');
|
|
205
|
+
console.log(` ${colors.cyan}Step 1:${colors.reset} Download and install Ollama:`);
|
|
206
|
+
console.log(` ${colors.bold}https://ollama.ai/download${colors.reset}`);
|
|
207
|
+
console.log('');
|
|
208
|
+
console.log(` ${colors.cyan}Step 2:${colors.reset} After installing, open a terminal and run:`);
|
|
209
|
+
console.log(` ${colors.bold}ollama pull nomic-embed-text${colors.reset}`);
|
|
210
|
+
console.log('');
|
|
211
|
+
console.log(` ${colors.cyan}Step 3:${colors.reset} Start Ollama (it runs in background):`);
|
|
212
|
+
console.log(` ${colors.bold}ollama serve${colors.reset}`);
|
|
213
|
+
console.log('');
|
|
214
|
+
console.log(` ${colors.cyan}Step 4:${colors.reset} Then run the setup:`);
|
|
215
|
+
console.log(` ${colors.bold}claude-memory-agent install${colors.reset}`);
|
|
216
|
+
console.log('');
|
|
217
|
+
} else {
|
|
218
|
+
// Ollama running - show normal next steps
|
|
219
|
+
console.log('Next steps:');
|
|
220
|
+
console.log('');
|
|
221
|
+
console.log(' 1. Run the setup wizard:');
|
|
222
|
+
console.log(` ${colors.bold}claude-memory-agent install${colors.reset}`);
|
|
223
|
+
console.log('');
|
|
224
|
+
console.log(' 2. Start the agent:');
|
|
225
|
+
console.log(` ${colors.bold}claude-memory-agent start${colors.reset}`);
|
|
226
|
+
console.log('');
|
|
227
|
+
console.log(' 3. Open the dashboard:');
|
|
228
|
+
console.log(` ${colors.bold}claude-memory-agent dashboard${colors.reset}`);
|
|
229
|
+
console.log('');
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Check if embedding model is installed in Ollama
|
|
234
|
+
async function checkOllamaModel() {
|
|
235
|
+
try {
|
|
236
|
+
const http = require('http');
|
|
237
|
+
return new Promise((resolve) => {
|
|
238
|
+
const req = http.get('http://localhost:11434/api/tags', { timeout: 2000 }, (res) => {
|
|
239
|
+
let data = '';
|
|
240
|
+
res.on('data', chunk => data += chunk);
|
|
241
|
+
res.on('end', () => {
|
|
242
|
+
try {
|
|
243
|
+
const json = JSON.parse(data);
|
|
244
|
+
const models = json.models || [];
|
|
245
|
+
const hasModel = models.some(m =>
|
|
246
|
+
m.name && m.name.includes('nomic-embed-text')
|
|
247
|
+
);
|
|
248
|
+
resolve(hasModel);
|
|
249
|
+
} catch (e) {
|
|
250
|
+
resolve(false);
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
req.on('error', () => resolve(false));
|
|
255
|
+
req.on('timeout', () => {
|
|
256
|
+
req.destroy();
|
|
257
|
+
resolve(false);
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
} catch (e) {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// Run if not in CI/CD environment
|
|
266
|
+
if (!process.env.CI && !process.env.npm_config_ignore_scripts) {
|
|
267
|
+
main().catch(console.error);
|
|
268
|
+
} else {
|
|
269
|
+
console.log('Skipping post-install in CI environment');
|
|
270
|
+
}
|