vektor-slipstream 1.4.3 → 1.4.4

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 CHANGED
@@ -3,6 +3,7 @@
3
3
  Hardware-accelerated persistent memory for AI agents. Local-first. No cloud. One-time payment.
4
4
 
5
5
  [![npm](https://img.shields.io/npm/v/vektor-slipstream)](https://www.npmjs.com/package/vektor-slipstream)
6
+ [![downloads](https://img.shields.io/npm/dw/vektor-slipstream)](https://www.npmjs.com/package/vektor-slipstream)
6
7
  [![license](https://img.shields.io/badge/license-Commercial-blue)](https://vektormemory.com/product#pricing)
7
8
 
8
9
  ## Install
@@ -39,7 +40,83 @@ const delta = await memory.delta('project decisions', 7);
39
40
  const brief = await memory.briefing();
40
41
  ```
41
42
 
42
- ## CLI
43
+ ---
44
+
45
+ ## CLI Chat — Persistent Memory Terminal
46
+
47
+ Chat with any LLM with full memory across every session. Zero configuration.
48
+
49
+ ```bash
50
+ npx vektor chat # start chat (auto-detects Ollama)
51
+ npx vektor chat --provider claude # use Anthropic Claude
52
+ npx vektor chat --provider groq --model llama-3.3-70b-versatile
53
+ npx vektor chat --provider gemini
54
+ npx vektor chat --provider openai
55
+ ```
56
+
57
+ ### Providers
58
+
59
+ | Provider | Details |
60
+ |---|---|
61
+ | `ollama` | Default — free, local, no API key. Auto-detects best installed model. |
62
+ | `claude` | Anthropic Claude — set `ANTHROPIC_API_KEY` |
63
+ | `openai` | OpenAI GPT — set `OPENAI_API_KEY` |
64
+ | `groq` | Groq LLaMA — set `GROQ_API_KEY` (free tier available) |
65
+ | `gemini` | Google Gemini — set `GEMINI_API_KEY` |
66
+
67
+ Set a permanent default:
68
+ ```bash
69
+ # Windows
70
+ $env:VEKTOR_PROVIDER = "claude"
71
+
72
+ # macOS/Linux
73
+ export VEKTOR_PROVIDER=claude
74
+ ```
75
+
76
+ ### In-chat commands
77
+
78
+ Type `/` to see available commands with autocomplete. Tab to select, arrow keys to navigate.
79
+
80
+ | Command | Action |
81
+ |---|---|
82
+ | `/recall <query>` | Search MAGMA memory mid-conversation |
83
+ | `/stats` | Show memory node count, edges, pinned |
84
+ | `/briefing` | Generate memory briefing inline |
85
+ | `/exit` | Exit chat (Ctrl+C also works) |
86
+
87
+ ### One-liner commands
88
+
89
+ ```bash
90
+ # Store a fact
91
+ npx vektor remember "I prefer TypeScript over JavaScript"
92
+ npx vektor remember "deadline is Friday" --importance 5
93
+
94
+ # Pipe support
95
+ cat meeting-notes.txt | npx vektor remember
96
+
97
+ # One-shot recall + LLM answer
98
+ npx vektor ask "what stack am I using?"
99
+ npx vektor ask "what did we decide about the database?"
100
+
101
+ # Autonomous goal executor
102
+ npx vektor agent "summarise everything I know about project Alpha"
103
+ npx vektor agent "research AI memory tools" --steps 15 --provider groq
104
+ ```
105
+
106
+ ### Ollama auto-detection
107
+
108
+ VEKTOR queries `http://localhost:11434/api/tags` and picks the best available model:
109
+ `qwen3` → `qwen2` → `llama` → `mistral` → first available.
110
+
111
+ Override:
112
+ ```bash
113
+ $env:OLLAMA_MODEL = "qwen3.5:4b"
114
+ export OLLAMA_MODEL=qwen3.5:4b
115
+ ```
116
+
117
+ ---
118
+
119
+ ## All CLI Commands
43
120
 
44
121
  ```bash
45
122
  npx vektor setup # First-run wizard — licence, hardware, integrations
@@ -48,49 +125,110 @@ npx vektor test # Test memory engine with progress bar
48
125
  npx vektor status # System health check
49
126
  npx vektor mcp # Start Claude Desktop MCP server
50
127
  npx vektor rem # Run REM dream cycle
51
- npx vektor chat # Persistent memory chat (all LLMs)
52
- npx vektor remember # Store a fact: npx vektor remember "I prefer TypeScript"
53
- npx vektor ask # Query memory: npx vektor ask "what stack am I using?"
54
- npx vektor agent # Autonomous goal executor
128
+ npx vektor chat # Persistent memory chat (all LLMs)
129
+ npx vektor remember # Store a fact
130
+ npx vektor ask # Query memory + LLM answer
131
+ npx vektor agent # Autonomous goal executor
55
132
  npx vektor help # All commands
56
133
  ```
57
134
 
58
- ## CLOAK — Developer Context Layer for Claude Code
135
+ ---
136
+
137
+ ## Claude Desktop Extension (DXT)
138
+
139
+ Install the `.dxt` extension for zero-config memory in every Claude Desktop session.
140
+
141
+ **Install:** drag `vektor-slipstream.dxt` onto the Claude Desktop Extensions page.
142
+
143
+ Once installed, Claude automatically:
144
+ - Recalls relevant context at session start
145
+ - Stores facts and decisions during conversation
146
+ - Summarises at session end
59
147
 
60
- CLOAK is a 4-tool MCP layer that gives Claude Code persistent memory of your project.
61
- Every session starts with full context. Every error is remembered. Every wasted token is tracked.
148
+ All 28 tools are available in Claude Desktop no configuration needed beyond your licence key.
62
149
 
63
- ### What it does
150
+ **User config fields:**
64
151
 
65
- | Tool | Does exactly one thing |
152
+ | Field | Purpose |
66
153
  |---|---|
67
- | `cloak_cortex` | Scans project files, builds a token-aware anatomy index in Vektor's entity graph |
68
- | `cloak_axon` | Session boundary handler loads last context on start, saves MemCell on stop |
69
- | `cloak_cerebellum` | Pre-write enforcer checks writes against known error patterns, auto-resolves fixes |
70
- | `cloak_token` | Token ledger — detects repeated reads and waste, one summary write per session |
154
+ | `licence_key` | Your Polar licence key (required) |
155
+ | `db_path` | Memory DB path (defaults to `~/vektor-slipstream-memory.db`) |
156
+ | `project_path` | Default path for `cloak_cortex` project scanning (optional) |
71
157
 
72
- ### Import
158
+ Download the latest `.dxt` from [vektormemory.com/docs/dxt](https://vektormemory.com/docs/dxt).
73
159
 
74
- ```js
75
- const { runCortex } = require('vektor-slipstream/cloak/cortex');
76
- const { onSessionStart,
77
- onSessionStop } = require('vektor-slipstream/cloak/axon');
78
- const { checkWrite,
79
- recordError } = require('vektor-slipstream/cloak/cerebellum');
80
- const { getSessionSummary} = require('vektor-slipstream/cloak/token');
81
-
82
- // Clean terminal output (replaces emoji with box-drawing chars)
83
- const { createMemory } = require('vektor-slipstream/boot');
84
- ```
160
+ ---
161
+
162
+ ## MCP Tools — All 28
163
+
164
+ ### Memory Tools
85
165
 
86
- ### Claude Code setup
166
+ | Tool | Function |
167
+ |---|---|
168
+ | `vektor_recall` | Semantic search across MAGMA graph |
169
+ | `vektor_store` | Store memory with importance score |
170
+ | `vektor_graph` | Traverse associative memory graph |
171
+ | `vektor_delta` | See what changed on a topic over time |
172
+ | `vektor_briefing` | Generate morning briefing from recent memories |
173
+
174
+ ### CLOAK Core
175
+
176
+ | Tool | Function |
177
+ |---|---|
178
+ | `cloak_fetch` | Stealth headless browser fetch via Playwright |
179
+ | `cloak_fetch_smart` | Checks `llms.txt` first, falls back to stealth browser |
180
+ | `cloak_render` | Full CSS/DOM layout sensor |
181
+ | `cloak_diff` | Semantic diff of URL since last fetch |
182
+ | `cloak_diff_text` | Structural diff between two text blobs |
183
+ | `cloak_passport` | AES-256-GCM credential vault (get/set/delete/list) |
184
+ | `tokens_saved` | Token efficiency ROI calculator |
185
+
186
+ ### Identity Tools
187
+
188
+ | Tool | Function |
189
+ |---|---|
190
+ | `cloak_identity_create` | Create persistent browser fingerprint identity |
191
+ | `cloak_identity_use` | Apply saved identity to a fetch call |
192
+ | `cloak_identity_list` | List all saved identities with trust summary |
193
+
194
+ ### Behaviour Tools
195
+
196
+ | Tool | Function |
197
+ |---|---|
198
+ | `cloak_inject_behaviour` | Human mouse/scroll injection for reCAPTCHA/Cloudflare bypass |
199
+ | `cloak_behaviour_stats` | List available patterns and categories |
200
+ | `cloak_load_pattern` | Load custom recorded behaviour pattern |
201
+ | `cloak_pattern_stats` | Self-improving pattern store tier breakdown |
202
+ | `cloak_pattern_list` | List patterns with scores and tier |
203
+ | `cloak_pattern_prune` | Remove stale/low-scoring patterns |
204
+ | `cloak_pattern_seed` | Seed store with built-in patterns |
205
+
206
+ ### CAPTCHA Tools
207
+
208
+ | Tool | Function |
209
+ |---|---|
210
+ | `cloak_detect_captcha` | Detect CAPTCHA type and sitekey |
211
+ | `cloak_solve_captcha` | Solve via vision AI (Claude/GPT-4o/2captcha) |
212
+
213
+ ### Compression & Cortex Tools
214
+
215
+ | Tool | Function |
216
+ |---|---|
217
+ | `turbo_quant_compress` | PolarQuant vector compression (~75% smaller) |
218
+ | `turbo_quant_stats` | Compression ratio and savings stats |
219
+ | `cloak_cortex` | Scan project directory into MAGMA entity graph |
220
+ | `cloak_cortex_anatomy` | Get cached file anatomy without rescanning |
221
+
222
+ ---
223
+
224
+ ## Claude Code Setup
87
225
 
88
226
  Add to `.claude/settings.json` in your project:
89
227
 
90
228
  ```json
91
229
  {
92
230
  "mcpServers": {
93
- "cloak": {
231
+ "vektor": {
94
232
  "command": "node",
95
233
  "args": ["/path/to/node_modules/vektor-slipstream/index.js"],
96
234
  "env": {
@@ -98,70 +236,11 @@ Add to `.claude/settings.json` in your project:
98
236
  "CLOAK_PROJECT_PATH": "/path/to/your/project"
99
237
  }
100
238
  }
101
- },
102
- "hooks": {
103
- "SessionStart": [{ "type": "command", "command": "node /path/to/node_modules/vektor-slipstream/index.js --hook SessionStart" }],
104
- "Stop": [{ "type": "command", "command": "node /path/to/node_modules/vektor-slipstream/index.js --hook Stop" }],
105
- "PreToolUse": [{ "type": "command", "command": "node /path/to/node_modules/vektor-slipstream/index.js --hook PreToolUse" }],
106
- "PostToolUse": [{ "type": "command", "command": "node /path/to/node_modules/vektor-slipstream/index.js --hook PostToolUse" }]
107
239
  }
108
240
  }
109
241
  ```
110
242
 
111
- ### Usage
112
-
113
- ```js
114
- // Scan project files into Vektor entity graph (call once on init)
115
- await cloak_cortex({})
116
-
117
- // Start session — loads last context automatically
118
- await cloak_axon({ action: 'start' })
119
-
120
- // Check before a risky write
121
- await cloak_cerebellum({
122
- action: 'check',
123
- content: '...code...',
124
- filePath: 'src/auth.ts'
125
- })
126
-
127
- // Record a bug you just hit
128
- await cloak_cerebellum({
129
- action: 'record_error',
130
- description: 'Null ref on user.id when DB returns empty',
131
- filePath: 'src/auth.ts',
132
- errorType: 'null_reference',
133
- fix: 'Add guard: if (user && user.id)'
134
- })
135
-
136
- // Save session with intent — the "why" not just the "what"
137
- await cloak_axon({
138
- action: 'stop',
139
- narrative: 'Fixed null reference in auth module'
140
- })
141
-
142
- // Check token waste
143
- await cloak_token({ action: 'summary' })
144
- ```
145
-
146
- ### Architecture
147
-
148
- ```
149
- Claude Code
150
- ↓ hooks + MCP tool calls
151
- CLOAK (4 tools, ~800 lines Node.js)
152
- ↓ memory.remember() / memory.recall()
153
- Vektor / MAGMA
154
- ↓ 4-layer graph (semantic, temporal, causal, entity)
155
- SQLite-vec (local, no cloud)
156
- ```
157
-
158
- ### DB growth
159
-
160
- CLOAK writes 3-5 nodes per session — not per operation.
161
- At 1 year of daily use: ~1,000 nodes. Sub-millisecond recall throughout.
162
-
163
- > ⚠️ **Concurrency warning**: Use stdio MCP (default). The HTTP mode
164
- > (`CLOAK_HTTP=1`) does not support concurrent multi-agent sessions.
243
+ All 28 tools are available in Claude Code via this config.
165
244
 
166
245
  ---
167
246
 
@@ -177,37 +256,19 @@ At 1 year of daily use: ~1,000 nodes. Sub-millisecond recall throughout.
177
256
 
178
257
  ### Integrations
179
258
 
180
- - **Claude MCP** — `vektor_recall`, `vektor_store`, `vektor_graph`, `vektor_delta`
181
- - **Claude Code** — CLOAK 4-tool developer context layer (see above)
259
+ - **Claude Desktop** — DXT extension, 28 tools, auto-memory system prompt
260
+ - **Claude Code** — MCP server, all 28 tools
261
+ - **CLI** — `chat`, `remember`, `ask`, `agent` commands
182
262
  - **LangChain** — v1 + v2 adapter included
183
263
  - **OpenAI Agents SDK** — drop-in integration
184
- - **Mistral** — `vektor_memoire` HTTP tool, localhost bridge
185
264
  - **Gemini · Groq · Ollama** — provider agnostic
186
265
 
187
- ### Cloak (Sovereign Identity)
188
-
189
- - `cloak_fetch` — stealth headless browser fetch
190
- - `cloak_render` — computed CSS · post-JS DOM sensor
191
- - `cloak_passport` — AES-256-GCM credential vault, machine-bound
192
- - `cloak_diff` — semantic diff since last fetch
193
- - `tokens_saved` — ROI audit per session
194
-
195
- ```js
196
- const { cloak_passport, cloak_fetch, tokens_saved } = require('vektor-slipstream/cloak');
197
-
198
- cloak_passport('GITHUB_TOKEN', 'ghp_xxxx');
199
- const token = cloak_passport('GITHUB_TOKEN');
200
-
201
- const { text, tokensSaved } = await cloak_fetch('https://example.com');
202
-
203
- const roi = tokens_saved({ raw_tokens: 10000, actual_tokens: 3000 });
204
- // → { reduction_pct: 70, cost_saved_usd: 0.0175, roi_multiple: 2.3 }
205
- ```
266
+ ---
206
267
 
207
268
  ## Performance
208
269
 
209
270
  | Metric | Value |
210
- |--------|-------|
271
+ |---|---|
211
272
  | Recall latency | ~8ms avg (local SQLite) |
212
273
  | Embedding cost | $0 — fully local ONNX |
213
274
  | Embedding latency | ~10ms GPU / ~25ms CPU |
@@ -222,15 +283,19 @@ Zero config. VEKTOR detects and uses the best available accelerator:
222
283
  - **Apple Silicon** — CoreML
223
284
  - **CPU** — optimised fallback, works everywhere
224
285
 
286
+ ---
287
+
225
288
  ## Licence
226
289
 
227
290
  Commercial licence. One-time payment of $159. Activates on up to 3 machines.
228
291
  Manage at [polar.sh](https://polar.sh).
229
292
 
230
- Purchase: [vektormemory.com/product#pricing](https://vektormemory.com/product#pricing)
231
- Docs: [vektormemory.com/docs](https://vektormemory.com/docs)
293
+ Purchase: [vektormemory.com/product#pricing](https://vektormemory.com/product#pricing)
294
+ Docs: [vektormemory.com/docs](https://vektormemory.com/docs)
232
295
  Support: hello@vektormemory.com
233
296
 
297
+ ---
298
+
234
299
  ## Research
235
300
 
236
301
  Built on peer-reviewed research:
@@ -238,4 +303,4 @@ Built on peer-reviewed research:
238
303
  - [MAGMA (arxiv:2601.03236)](https://arxiv.org/abs/2601.03236) — Multi-Graph Agentic Memory Architecture
239
304
  - [EverMemOS (arxiv:2601.02163)](https://arxiv.org/abs/2601.02163) — Self-Organizing Memory OS
240
305
  - [HippoRAG (arxiv:2405.14831)](https://arxiv.org/abs/2405.14831) — Neurobiologically Inspired Long-Term Memory (NeurIPS 2024)
241
- - [Mem0 (arxiv:2504.19413)](https://arxiv.org/abs/2504.19413) — Production-Ready Agent Memory
306
+ - [Mem0 (arxiv:2504.19413)](https://arxiv.org/abs/2504.19413) — Production-Ready Agent Memory
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vektor-slipstream",
3
- "version": "1.4.3",
3
+ "version": "1.4.4",
4
4
  "description": "Hardware-accelerated persistent memory for AI agents. Local-first, zero cloud dependency, $0 embedding cost.",
5
5
  "main": "slipstream-core-extended.js",
6
6
  "types": "./types/index.d.ts",
@@ -72,7 +72,7 @@
72
72
  "dependencies": {
73
73
  "better-sqlite3": "^12.8.0",
74
74
  "onnxruntime-node": "^1.17.3",
75
- "vektor-slipstream": "^1.4.2"
75
+ "vektor-slipstream": "^1.4.4"
76
76
  },
77
77
  "optionalDependencies": {
78
78
  "@anthropic-ai/sdk": "^0.82.0",
package/vektor-cli.js CHANGED
@@ -1,482 +1,259 @@
1
- #!/usr/bin/env node
1
+ /**
2
+ * vektor-cli.js (v1.5.x patch)
3
+ * VEKTOR Slipstream
4
+ * CLI router — drop-in replacement for the v1.4.x router.
5
+ *
6
+ * New commands added in v1.5.x:
7
+ * npx vektor agent --tools full tool suite
8
+ * npx vektor watch filesystem watcher
9
+ * npx vektor sync P2P memory sync
10
+ * npx vektor swarm multi-agent coordination
11
+ *
12
+ * All existing v1.4.x commands (chat, remember, ask, agent) are preserved.
13
+ */
14
+
2
15
  'use strict';
3
16
 
4
- const path = require('path');
5
- const os = require('os');
6
- const fs = require('fs');
7
- const PKG = require('./package.json');
8
- const loader = require('./vektor-banner-loader');
9
-
10
- const command = process.argv[2] || 'help';
11
-
12
- // ── Colours ───────────────────────────────────────────────────────────────────
13
-
14
- const C = {
15
- reset: '\x1b[0m',
16
- cyan: '\x1b[36m',
17
- green: '\x1b[32m',
18
- yellow: '\x1b[33m',
19
- red: '\x1b[31m',
20
- dim: '\x1b[2m',
21
- bold: '\x1b[1m',
22
- orange: '\x1b[38;5;214m',
17
+ const path = require('path');
18
+
19
+ // ─── Command registry ─────────────────────────────────────────────────────────
20
+
21
+ const COMMANDS = {
22
+ // ── v1.4.x (existing) ──────────────────────────────────────────────────
23
+ chat: () => require('./vektor-cli-chat.js').runChat,
24
+ remember: () => require('./vektor-cli-chat.js').runRemember,
25
+ ask: () => require('./vektor-cli-chat.js').runAsk,
26
+
27
+ // ── v1.5.x (new) ───────────────────────────────────────────────────────
28
+
29
+ /**
30
+ * npx vektor agent [goal] [--tools web,fs,code] [--continue]
31
+ * Autonomous agent with web search, file system, code execution.
32
+ */
33
+ agent: () => async (argv) => {
34
+ const { default: runAgent, main } = (() => {
35
+ try { return require('./vektor-agent.js'); } catch { return require('../vektor-agent.js'); }
36
+ })();
37
+ // Delegate to vektor-agent CLI main — it reads process.argv
38
+ await main?.() ?? runAgent({
39
+ goal: argv.filter(a => !a.startsWith('-')).join(' '),
40
+ tools: ['web', 'fs', 'code', 'memory'],
41
+ provider: process.env.VEKTOR_PROVIDER || 'ollama',
42
+ });
43
+ },
44
+
45
+ /**
46
+ * npx vektor watch [path] [--ext js,ts] [--no-llm]
47
+ * Filesystem watcher — auto-stores change summaries into MAGMA.
48
+ */
49
+ watch: () => async (_argv) => {
50
+ const { startWatch, parseArgs } = (() => {
51
+ try { return require('./vektor-watch.js'); } catch { return require('../vektor-watch.js'); }
52
+ })();
53
+ const opts = parseArgs(process.argv);
54
+ await startWatch(opts);
55
+ },
56
+
57
+ /**
58
+ * npx vektor sync --host [--pin X]
59
+ * npx vektor sync --connect <ip> [--pin X]
60
+ * Encrypted P2P memory sync between machines.
61
+ */
62
+ sync: () => async (_argv) => {
63
+ const { main } = (() => {
64
+ try { return require('./vektor-sync.js'); } catch { return require('../vektor-sync.js'); }
65
+ })();
66
+ await main?.();
67
+ },
68
+
69
+ /**
70
+ * npx vektor swarm "goal" [--agents 3] [--roles r1,r2,r3]
71
+ * Multi-agent swarm coordination.
72
+ */
73
+ swarm: () => async (_argv) => {
74
+ const { main } = (() => {
75
+ try { return require('./vektor-swarm.js'); } catch { return require('../vektor-swarm.js'); }
76
+ })();
77
+ await main?.();
78
+ },
79
+
80
+ // ── Utility ────────────────────────────────────────────────────────────
81
+
82
+ providers: () => async (_argv) => {
83
+ await checkProviders();
84
+ },
85
+
86
+ version: () => async (_argv) => {
87
+ const pkg = safeRequirePackageJson();
88
+ console.log(`VEKTOR Slipstream v${pkg.version || '1.5.0'}`);
89
+ },
90
+
91
+ help: () => async (_argv) => {
92
+ printHelp();
93
+ },
23
94
  };
24
- const cyan = s => C.cyan + s + C.reset;
25
- const green = s => C.green + s + C.reset;
26
- const yellow = s => C.yellow + s + C.reset;
27
- const red = s => C.red + s + C.reset;
28
- const dim = s => C.dim + s + C.reset;
29
- const bold = s => C.bold + s + C.reset;
30
- const orange = s => C.orange + s + C.reset;
31
-
32
- // Banner is printed automatically by vektor-banner-loader on require
33
-
34
- function printBox() {
35
- loader.complete('Ready');
36
- console.log(cyan(' +------------------------------------------------------+'));
37
- console.log(cyan(' |') + bold(' VEKTOR SLIPSTREAM CLI ') + cyan('|'));
38
- console.log(cyan(' +------------------------------------------------------+'));
39
- console.log(dim(' v' + PKG.version + ' . vektormemory.com'));
40
- console.log('');
41
- }
42
95
 
43
- // ── Help ──────────────────────────────────────────────────────────────────────
96
+ // ─── Provider checker ─────────────────────────────────────────────────────────
44
97
 
45
- async function cmdHelp() {
46
- printBox();
47
- console.log(bold(' MEMORY COMMANDS\n'));
98
+ async function checkProviders() {
99
+ const C = { green: '\x1b[32m', red: '\x1b[31m', dim: '\x1b[2m', reset: '\x1b[0m', bold: '\x1b[1m' };
100
+ console.log(`\n${C.bold}VEKTOR Provider Status${C.reset}\n`);
48
101
 
49
- const memoryCmds = [
50
- ['chat', 'Persistent memory chat all conversations stored in MAGMA graph'],
51
- ['remember', 'Store a fact instantly: npx vektor remember "I prefer TypeScript"'],
52
- ['ask', 'Ask a question using your memory: npx vektor ask "what stack am I using?"'],
53
- ['agent', 'Autonomous goal executor: npx vektor agent "research X and summarise"'],
54
- ['briefing', 'Generate a morning briefing from recent memories'],
55
- ['rem', 'Run the REM dream cycle — compress and consolidate memories'],
56
- ['tui', 'Launch the interactive memory browser (terminal UI)'],
102
+ const checks = [
103
+ { name: 'Claude (Anthropic)', key: 'ANTHROPIC_API_KEY', test: () => testClaude() },
104
+ { name: 'OpenAI', key: 'OPENAI_API_KEY', test: () => testOpenAI() },
105
+ { name: 'Groq', key: 'GROQ_API_KEY', test: () => testGroq() },
106
+ { name: 'Google Gemini', key: 'GEMINI_API_KEY', test: () => testGemini() },
107
+ { name: 'Ollama (local)', key: null, test: () => testOllama() },
57
108
  ];
58
109
 
59
- memoryCmds.forEach(([cmd, desc]) => {
60
- console.log(' ' + cyan(('npx vektor ' + cmd).padEnd(26)) + dim(desc));
61
- });
62
-
63
- console.log('');
64
- console.log(bold(' SYSTEM COMMANDS\n'));
65
-
66
- const sysCmds = [
67
- ['setup', 'First-run wizard — activate licence, test memory, configure integrations'],
68
- ['activate', 'Activate your licence key on this machine'],
69
- ['deactivate', "Free up this machine's activation slot"],
70
- ['status', 'Show licence status, memory stats, and system info'],
71
- ['test', 'Run a quick memory test (remember + recall + briefing)'],
72
- ['mcp', 'Start the Claude MCP server (for Claude Desktop)'],
73
- ['help', 'Show this help message'],
74
- ];
75
-
76
- sysCmds.forEach(([cmd, desc]) => {
77
- console.log(' ' + cyan(('npx vektor ' + cmd).padEnd(26)) + dim(desc));
78
- });
79
-
80
- console.log('');
81
- console.log(bold(' CHAT PROVIDERS\n'));
82
- console.log(' ' + cyan('--provider claude ') + ' ' + dim('Anthropic Claude (ANTHROPIC_API_KEY)'));
83
- console.log(' ' + cyan('--provider openai ') + ' ' + dim('OpenAI GPT (OPENAI_API_KEY)'));
84
- console.log(' ' + cyan('--provider groq ') + ' ' + dim('Groq LLaMA (GROQ_API_KEY)'));
85
- console.log(' ' + cyan('--provider gemini ') + ' ' + dim('Google Gemini (GEMINI_API_KEY)'));
86
- console.log(' ' + cyan('--provider ollama ') + ' ' + dim('Local Ollama (free, ollama serve)'));
87
-
88
- console.log('');
89
- console.log(bold(' ENVIRONMENT\n'));
90
- console.log(' ' + cyan('VEKTOR_LICENCE_KEY') + ' ' + dim('Your Polar licence key'));
91
- console.log(' ' + cyan('VEKTOR_DB_PATH ') + ' ' + dim('Path to memory database (default: ~/vektor-slipstream-memory.db)'));
92
- console.log(' ' + cyan('VEKTOR_PROVIDER ') + ' ' + dim('Default LLM provider (default: ollama)'));
93
- console.log(' ' + cyan('VEKTOR_AGENT_ID ') + ' ' + dim('Agent identifier (default: vektor-cli)'));
94
- console.log('');
95
- console.log(bold(' EXAMPLES\n'));
96
- console.log(dim(' # Start chatting with persistent memory (uses Ollama by default)'));
97
- console.log(' npx vektor chat\n');
98
- console.log(dim(' # Chat with Claude'));
99
- console.log(' npx vektor chat --provider claude\n');
100
- console.log(dim(' # Store a fact instantly'));
101
- console.log(' npx vektor remember "Client deadline is April 20th" --importance 5\n');
102
- console.log(dim(' # Ask your memory a question'));
103
- console.log(' npx vektor ask "what projects am I working on?"\n');
104
- console.log(dim(' # Run an autonomous research agent'));
105
- console.log(' npx vektor agent "research VEKTOR competitors and summarise findings"\n');
106
- console.log(dim(' # Pipe content into memory'));
107
- console.log(' cat README.md | npx vektor remember\n');
108
- console.log(dim(' # Connect to Claude Desktop'));
109
- console.log(' npx vektor mcp\n');
110
- console.log(' ' + dim('Purchase at: https://vektormemory.com/product#pricing'));
111
- console.log('');
112
- }
113
-
114
- // ── Status ────────────────────────────────────────────────────────────────────
115
-
116
- async function cmdStatus() {
117
- printBox();
118
- console.log(bold(' SYSTEM STATUS\n'));
119
-
120
- const nodeVer = parseInt(process.version.slice(1));
121
- const nodeOk = nodeVer >= 18;
122
- console.log(' Node.js ' + (nodeOk ? green('✓ ' + process.version) : red('✗ ' + process.version + ' (requires >=18)')));
123
-
124
- const cacheFile = path.join(os.homedir(), '.vektor', 'licence.json');
125
- const hasCache = fs.existsSync(cacheFile);
126
- console.log(' Licence cache ' + (hasCache ? green('✓ found') : yellow('– not found')) + dim(' (' + cacheFile + ')'));
127
-
128
- const envKey = process.env.VEKTOR_LICENCE_KEY;
129
- console.log(' Licence env ' + (envKey ? green('✓ VEKTOR_LICENCE_KEY set') : dim('– not set')));
130
-
131
- const dbPath = process.env.VEKTOR_DB_PATH ||
132
- path.join(os.homedir(), 'vektor-slipstream-memory.db');
133
- const hasDb = fs.existsSync(dbPath);
134
- console.log(' Memory DB ' + (hasDb ? green('✓ ' + dbPath) : dim('– not found (run: npx vektor test)')));
135
-
136
- const vaultFile = path.join(os.homedir(), '.vektor', 'vault.enc');
137
- console.log(' Cloak vault ' + (fs.existsSync(vaultFile) ? green('✓ found') : dim('– not initialised')));
138
-
139
- let hasPw = false;
140
- try { require('playwright'); hasPw = true; } catch (_) {}
141
- console.log(' Playwright ' + (hasPw ? green('✓ installed') : yellow('– optional (npx playwright install chromium)')));
142
-
143
- let hasOnnx = false;
144
- try { require('onnxruntime-node'); hasOnnx = true; } catch (_) {}
145
- console.log(' ONNX runtime ' + (hasOnnx ? green('✓ installed') : red('✗ missing (npm install onnxruntime-node)')));
146
-
147
- // Provider check
148
- const provider = process.env.VEKTOR_PROVIDER || 'ollama';
149
- console.log(' LLM provider ' + cyan(provider));
150
- if (provider === 'ollama') {
110
+ for (const check of checks) {
111
+ const hasKey = check.key ? !!process.env[check.key] : true;
112
+ if (!hasKey) {
113
+ console.log(` ${C.red}✗${C.reset} ${check.name} ${C.dim}(${check.key} not set)${C.reset}`);
114
+ continue;
115
+ }
116
+ process.stdout.write(` ⏳ ${check.name}…`);
151
117
  try {
152
- const res = await fetch('http://localhost:11434/api/tags', { signal: AbortSignal.timeout(2000) });
153
- const data = await res.json();
154
- const models = data.models?.map(m => m.name).join(', ') || 'none';
155
- console.log(' Ollama models ' + green('✓ running') + dim(' — ' + models));
156
- } catch {
157
- console.log(' Ollama ' + yellow('– not running (start with: ollama serve)'));
118
+ const model = await check.test();
119
+ process.stdout.write(`\r ${C.green}✓${C.reset} ${check.name} ${C.dim}${model}${C.reset}\n`);
120
+ } catch (err) {
121
+ process.stdout.write(`\r ${C.red}✗${C.reset} ${check.name} ${C.dim}${err.message}${C.reset}\n`);
158
122
  }
159
123
  }
160
-
161
- console.log('\n ' + cyan('vektor-slipstream') + ' ' + dim('v' + PKG.version));
162
124
  console.log('');
163
125
  }
164
126
 
165
- // ── Activate ──────────────────────────────────────────────────────────────────
166
-
167
- async function cmdActivate() {
168
- printBox();
169
- console.log(' Activating licence...\n');
170
- try {
171
- const { resolveAndValidateLicence } = require('./vektor-licence-prompt');
172
- const { validateLicence } = require('./vektor-licence');
173
- await resolveAndValidateLicence(validateLicence);
174
- console.log(green(' ✓ Licence activated successfully.'));
175
- console.log(dim(' Run: npx vektor status'));
176
- } catch (e) {
177
- console.error(red(' ✗ Activation failed: ') + e.message);
178
- process.exit(1);
179
- }
180
- console.log('');
127
+ async function testClaude() {
128
+ const res = await fetchTimeout('https://api.anthropic.com/v1/models', {
129
+ headers: { 'x-api-key': process.env.ANTHROPIC_API_KEY, 'anthropic-version': '2023-06-01' },
130
+ }, 5000);
131
+ const j = await res.json();
132
+ const m = j.data?.[0]?.id || 'connected';
133
+ return m;
181
134
  }
182
-
183
- // ── Deactivate ────────────────────────────────────────────────────────────────
184
-
185
- async function cmdDeactivate() {
186
- printBox();
187
- const key = process.env.VEKTOR_LICENCE_KEY;
188
- if (!key) {
189
- console.error(red(' ✗ VEKTOR_LICENCE_KEY not set.'));
190
- console.log(dim(' Set it: set VEKTOR_LICENCE_KEY=YOUR-KEY (Windows) or export VEKTOR_LICENCE_KEY=YOUR-KEY (Unix)'));
191
- process.exit(1);
192
- }
193
- try {
194
- const { deactivateMachine } = require('./vektor-licence');
195
- await deactivateMachine(key);
196
- console.log(green(' ✓ Machine deactivated. Activation slot freed.'));
197
- } catch (e) {
198
- console.error(red(' ✗ Deactivation error: ') + e.message);
199
- process.exit(1);
200
- }
201
- console.log('');
135
+ async function testOpenAI() {
136
+ const res = await fetchTimeout('https://api.openai.com/v1/models', {
137
+ headers: { Authorization: `Bearer ${process.env.OPENAI_API_KEY}` },
138
+ }, 5000);
139
+ const j = await res.json();
140
+ return j.data?.[0]?.id || 'connected';
202
141
  }
203
-
204
- // ── Test ──────────────────────────────────────────────────────────────────────
205
-
206
- async function cmdTest() {
207
- printBox();
208
- console.log(' Running memory test...\n');
209
-
210
- const steps = ['Boot engine', 'Store memory', 'Recall memory', 'Briefing', 'Cleanup'];
211
- let step = 0;
212
-
213
- const bar = (label) => {
214
- const pct = Math.round((step / steps.length) * 100);
215
- const filled = Math.round((step / steps.length) * 30);
216
- const b = '[' + '#'.repeat(filled) + '-'.repeat(30 - filled) + ']';
217
- process.stdout.write('\r ' + cyan(b) + ' ' + String(pct).padStart(3) + '% ' + dim(label || steps[step] || 'Done') + ' ');
218
- };
219
-
220
- bar();
221
-
222
- try {
223
- const { createMemory } = require('./slipstream-core');
224
- const testDb = path.join(os.tmpdir(), 'vektor-test-' + Date.now() + '.db');
225
-
226
- const memory = await createMemory({
227
- agentId: 'vektor-cli-test',
228
- dbPath: testDb,
229
- silent: true,
230
- licenceKey: process.env.VEKTOR_LICENCE_KEY,
231
- });
232
- step++; bar(); process.stdout.write('\n'); console.log(green(' ✓ Memory engine booted'));
233
-
234
- const { id } = await memory.remember('VEKTOR CLI test — memory is working correctly', { importance: 3 });
235
- step++; bar(); process.stdout.write('\n'); console.log(green(' ✓ Stored memory (id: ' + id + ')'));
236
-
237
- const results = await memory.recall('CLI test memory working', 3);
238
- step++; bar(); process.stdout.write('\n');
239
- if (results.length > 0) {
240
- console.log(green(' ✓ Recalled ' + results.length + ' result(s) — top score: ' + results[0].score.toFixed(4)));
241
- } else {
242
- console.log(yellow(' ⚠ Recall returned 0 results'));
243
- }
244
-
245
- try {
246
- await memory.briefing();
247
- step++; bar(); process.stdout.write('\n'); console.log(green(' ✓ Briefing generated'));
248
- } catch (_) {
249
- step++; bar(); process.stdout.write('\n'); console.log(dim(' – Briefing skipped (not enough memories)'));
250
- }
251
-
252
- try { if (memory.db) memory.db.close(); } catch (_) {}
253
- await new Promise(r => setTimeout(r, 200));
254
- try { fs.unlinkSync(testDb); } catch (_) {}
255
- step++; bar('Done'); process.stdout.write('\n'); console.log(green(' ✓ Test database cleaned up'));
256
-
257
- console.log('\n' + green(' ✓ All tests passed. VEKTOR is working correctly.\n'));
258
- } catch (e) {
259
- process.stdout.write('\n');
260
- console.error(red('\n ✗ Test failed: ') + e.message);
261
- if (e.message.includes('better-sqlite3')) {
262
- console.log(yellow(' Fix: npm rebuild better-sqlite3'));
263
- }
264
- if (e.message.includes('licence')) {
265
- console.log(yellow(' Fix: npx vektor activate'));
266
- }
267
- process.exit(1);
268
- }
142
+ async function testGroq() {
143
+ const res = await fetchTimeout('https://api.groq.com/openai/v1/models', {
144
+ headers: { Authorization: `Bearer ${process.env.GROQ_API_KEY}` },
145
+ }, 5000);
146
+ const j = await res.json();
147
+ return j.data?.[0]?.id || 'connected';
148
+ }
149
+ async function testGemini() {
150
+ const res = await fetchTimeout(`https://generativelanguage.googleapis.com/v1beta/models?key=${process.env.GEMINI_API_KEY}`, {}, 5000);
151
+ const j = await res.json();
152
+ return j.models?.[0]?.name || 'connected';
153
+ }
154
+ async function testOllama() {
155
+ const res = await fetchTimeout('http://localhost:11434/api/tags', {}, 3000);
156
+ const j = await res.json();
157
+ const models = j.models?.map(m => m.name) || [];
158
+ if (!models.length) throw new Error('No models installed. Run: ollama pull qwen3');
159
+ return models.join(', ');
269
160
  }
270
161
 
271
- // ── MCP ───────────────────────────────────────────────────────────────────────
162
+ function fetchTimeout(url, opts, ms) {
163
+ const ctrl = new AbortController();
164
+ const t = setTimeout(() => ctrl.abort(), ms);
165
+ return fetch(url, { ...opts, signal: ctrl.signal }).finally(() => clearTimeout(t));
166
+ }
272
167
 
273
- async function cmdMcp() {
274
- const mcpScript = path.join(__dirname, 'examples', 'example-claude-mcp.js');
275
- if (!fs.existsSync(mcpScript)) {
276
- console.error(red(' MCP server not found: ') + mcpScript);
277
- process.exit(1);
278
- }
279
- process.argv = ['node', mcpScript, '--mcp'];
280
- require(mcpScript);
168
+ // ─── Help ─────────────────────────────────────────────────────────────────────
169
+
170
+ function printHelp() {
171
+ const C = { bold: '\x1b[1m', dim: '\x1b[2m', cyan: '\x1b[36m', green: '\x1b[32m', reset: '\x1b[0m' };
172
+ console.log(`
173
+ ${C.bold}VEKTOR Slipstream CLI${C.reset}
174
+
175
+ ${C.bold}Memory:${C.reset}
176
+ ${C.cyan}npx vektor remember${C.reset} "text" Store a fact into MAGMA
177
+ ${C.cyan}npx vektor ask${C.reset} "question" Recall + LLM answer
178
+ ${C.cyan}npx vektor chat${C.reset} Interactive persistent-memory chat
179
+
180
+ ${C.bold}Agent (v1.5):${C.reset}
181
+ ${C.cyan}npx vektor agent${C.reset} "goal" Basic autonomous agent
182
+ ${C.cyan}npx vektor agent${C.reset} "goal" ${C.dim}--tools${C.reset} Full tool suite (web+fs+code)
183
+ ${C.cyan}npx vektor agent${C.reset} "goal" ${C.dim}--continue${C.reset} Resume last session
184
+ ${C.cyan}npx vektor agent${C.reset} "goal" ${C.dim}--tools web,fs,code${C.reset}
185
+
186
+ ${C.bold}Watch (v1.5):${C.reset}
187
+ ${C.cyan}npx vektor watch${C.reset} [path] Watch filesystem, auto-store changes
188
+ ${C.cyan}npx vektor watch${C.reset} src/ ${C.dim}--ext ts,tsx${C.reset}
189
+ ${C.cyan}npx vektor watch${C.reset} ${C.dim}--no-llm${C.reset} Heuristic summaries only
190
+
191
+ ${C.bold}Sync (v1.5):${C.reset}
192
+ ${C.cyan}npx vektor sync${C.reset} --host Listen for incoming sync
193
+ ${C.cyan}npx vektor sync${C.reset} --connect <ip> Sync with host machine
194
+ ${C.cyan}npx vektor sync${C.reset} --host ${C.dim}--pin 123456${C.reset}
195
+
196
+ ${C.bold}Swarm (v1.5):${C.reset}
197
+ ${C.cyan}npx vektor swarm${C.reset} "goal" Multi-agent coordination
198
+ ${C.cyan}npx vektor swarm${C.reset} "goal" ${C.dim}--agents 4${C.reset}
199
+ ${C.cyan}npx vektor swarm${C.reset} "goal" ${C.dim}--roles researcher,coder,reviewer${C.reset}
200
+
201
+ ${C.bold}Utilities:${C.reset}
202
+ ${C.cyan}npx vektor providers${C.reset} Test all API key connections
203
+ ${C.cyan}npx vektor version${C.reset} Show version
204
+ ${C.cyan}npx vektor help${C.reset} Show this help
205
+
206
+ ${C.bold}Providers:${C.reset} ${C.dim}--provider claude|openai|groq|gemini|ollama${C.reset}
207
+ `);
281
208
  }
282
209
 
283
- // ── TUI ───────────────────────────────────────────────────────────────────────
210
+ // ─── Helpers ──────────────────────────────────────────────────────────────────
284
211
 
285
- async function cmdTui() {
286
- const tuiScript = path.join(__dirname, 'vektor-tui.js');
287
- if (!fs.existsSync(tuiScript)) {
288
- console.error(red(' TUI not found: ') + tuiScript);
289
- process.exit(1);
212
+ function safeRequirePackageJson() {
213
+ const candidates = [
214
+ path.join(__dirname, 'package.json'),
215
+ path.join(__dirname, '..', 'package.json'),
216
+ ];
217
+ for (const c of candidates) {
218
+ try { return require(c); } catch { /* skip */ }
290
219
  }
291
- loader.complete('Launching TUI');
292
- require(tuiScript);
220
+ return {};
293
221
  }
294
222
 
295
- // ── REM ───────────────────────────────────────────────────────────────────────
296
-
297
- async function cmdRem() {
298
- printBox();
299
- console.log(' Running REM dream cycle...\n');
300
- try {
301
- const { createMemory } = require('./boot-patch');
302
- const dbPath = process.env.VEKTOR_DB_PATH ||
303
- path.join(os.homedir(), 'vektor-slipstream-memory.db');
304
-
305
- if (!fs.existsSync(dbPath)) {
306
- console.error(yellow(' ⚠ No memory database found at: ' + dbPath));
307
- console.log(dim(' Run: npx vektor test to create one'));
308
- process.exit(1);
309
- }
310
-
311
- const memory = await createMemory({
312
- agentId: process.env.VEKTOR_AGENT_ID || 'default',
313
- dbPath,
314
- silent: true,
315
- licenceKey: process.env.VEKTOR_LICENCE_KEY,
316
- });
317
-
318
- console.log(' ' + dim('┌─ Phase 1/4 Auditing memory graph...'));
319
- const stats = await memory.stats();
320
- const total = stats.total || 0;
321
- console.log(dim(' │ Total nodes: ' + total));
223
+ // ─── CLI dispatcher ───────────────────────────────────────────────────────────
322
224
 
323
- if (total === 0) {
324
- console.log(green(' └─ Memory graph is empty — nothing to consolidate\n'));
325
- return;
326
- }
327
-
328
- console.log(' ' + dim('├─ Phase 2/4 Scanning recent activity...'));
329
- const recent = await memory.recent(20);
330
- console.log(dim(' │ Recent nodes scanned: ' + (recent ? recent.length : 0)));
331
-
332
- console.log(' ' + dim('├─ Phase 3/4 Pruning noise nodes...'));
333
- let pruned = 0;
334
- const NOISE = [
335
- 'cloak warmup probe',
336
- 'VEKTOR CLI test — memory is working correctly',
337
- ];
338
- for (const pattern of NOISE) {
339
- try {
340
- const nodes = await memory.recall(pattern, 10);
341
- if (!nodes || !nodes.length) continue;
342
- for (const node of nodes) {
343
- if (node.content && NOISE.some(n => node.content.includes(n))) {
344
- if (node.id) { await memory.remove(node.id); pruned++; }
345
- }
346
- }
347
- } catch { /* non-fatal */ }
348
- }
349
- console.log(dim(' │ Noise nodes pruned: ' + pruned));
225
+ async function main() {
226
+ const argv = process.argv.slice(2);
227
+ const cmd = argv[0];
350
228
 
351
- console.log(' ' + dim('├─ Phase 4/4 Generating consolidation summary...'));
352
- let briefSnippet = '';
353
- try {
354
- const brief = await memory.briefing();
355
- if (brief) briefSnippet = brief.slice(0, 120) + (brief.length > 120 ? '...' : '');
356
- } catch { /* non-fatal */ }
357
-
358
- const statsAfter = await memory.stats();
359
- const totalAfter = statsAfter.total || 0;
360
- const delta = total - totalAfter;
361
-
362
- console.log(green(' └─ REM cycle complete\n'));
363
- console.log(' ' + dim('Before:') + ' ' + total + ' nodes');
364
- console.log(' ' + dim('After: ') + ' ' + totalAfter + ' nodes');
365
- console.log(' ' + dim('Pruned:') + ' ' + pruned + ' noise nodes');
366
- if (delta > pruned) {
367
- console.log(' ' + dim('AUDN: ') + ' ' + (delta - pruned) + ' duplicates resolved');
368
- }
369
- if (briefSnippet) {
370
- console.log('\n ' + dim('Briefing: ') + briefSnippet);
371
- }
229
+ if (!cmd || cmd === '--help' || cmd === '-h') {
230
+ printHelp();
231
+ return;
232
+ }
233
+ if (cmd === '--version' || cmd === '-v') {
234
+ const pkg = safeRequirePackageJson();
235
+ console.log(`v${pkg.version || '1.5.0'}`);
236
+ return;
237
+ }
372
238
 
373
- } catch (e) {
374
- console.error(red(' REM error: ') + e.message);
239
+ const factory = COMMANDS[cmd];
240
+ if (!factory) {
241
+ console.error(`Unknown command: ${cmd}\nRun 'npx vektor help' for usage.`);
375
242
  process.exit(1);
376
243
  }
377
- console.log('');
378
- }
379
-
380
- // ── Briefing ──────────────────────────────────────────────────────────────────
381
244
 
382
- async function cmdBriefing() {
383
- printBox();
384
- console.log(' Generating memory briefing...\n');
385
245
  try {
386
- const { createMemory } = require('./slipstream-core');
387
- const dbPath = process.env.VEKTOR_DB_PATH ||
388
- path.join(os.homedir(), 'vektor-slipstream-memory.db');
389
-
390
- if (!fs.existsSync(dbPath)) {
391
- console.error(yellow(' ⚠ No memory database found at: ' + dbPath));
392
- console.log(dim(' Run: npx vektor test to create one'));
393
- process.exit(1);
394
- }
395
-
396
- const memory = await createMemory({
397
- agentId: process.env.VEKTOR_AGENT_ID || 'default',
398
- dbPath,
399
- silent: true,
400
- licenceKey: process.env.VEKTOR_LICENCE_KEY,
401
- });
402
-
403
- const brief = await memory.briefing();
404
- if (brief) {
405
- console.log(bold(' ── MEMORY BRIEFING ──────────────────────────────────\n'));
406
- console.log(' ' + brief.split('\n').join('\n '));
407
- console.log('\n ' + dim('─────────────────────────────────────────────────────'));
408
- } else {
409
- console.log(dim(' No briefing available — add more memories first.'));
410
- console.log(dim(' Try: npx vektor chat or npx vektor remember "some fact"'));
411
- }
412
- } catch (e) {
413
- console.error(red(' ✗ Briefing error: ') + e.message);
246
+ const handler = factory();
247
+ await handler(argv.slice(1));
248
+ } catch (err) {
249
+ console.error(`Error in '${cmd}': ${err.message}`);
250
+ if (process.env.DEBUG) console.error(err);
414
251
  process.exit(1);
415
252
  }
416
- console.log('');
417
- }
418
-
419
- // ── Setup ─────────────────────────────────────────────────────────────────────
420
-
421
- async function cmdSetup() {
422
- require('./vektor-setup');
423
- }
424
-
425
- // ── Chat / Remember / Ask / Agent — from vektor-cli-chat.js ──────────────────
426
-
427
- async function cmdChat() { const { cmdChat } = require('./vektor-cli-chat'); await cmdChat(process.argv); }
428
- async function cmdRemember() { const { cmdRemember } = require('./vektor-cli-chat'); await cmdRemember(process.argv); }
429
- async function cmdAsk() { const { cmdAsk } = require('./vektor-cli-chat'); await cmdAsk(process.argv); }
430
- async function cmdAgent() { const { cmdAgent } = require('./vektor-cli-chat'); await cmdAgent(process.argv); }
431
-
432
- // ── Pipe support — cat file.txt | npx vektor remember ────────────────────────
433
- async function handlePipe() {
434
- if (process.stdin.isTTY) return false;
435
- const chunks = [];
436
- for await (const chunk of process.stdin) chunks.push(chunk);
437
- const piped = chunks.join('').trim();
438
- if (!piped) return false;
439
- // Inject piped content as the text argument
440
- process.argv.push(piped);
441
- return true;
442
253
  }
443
254
 
444
- // ── Router ────────────────────────────────────────────────────────────────────
445
-
446
- const commands = {
447
- help: cmdHelp,
448
- status: cmdStatus,
449
- activate: cmdActivate,
450
- deactivate: cmdDeactivate,
451
- test: cmdTest,
452
- mcp: cmdMcp,
453
- tui: cmdTui,
454
- rem: cmdRem,
455
- briefing: cmdBriefing,
456
- setup: cmdSetup,
457
- // New commands
458
- chat: cmdChat,
459
- remember: cmdRemember,
460
- ask: cmdAsk,
461
- agent: cmdAgent,
462
- };
463
-
464
- const fn = commands[command];
465
- if (!fn) {
466
- console.error(red('\n ✗ Unknown command: ') + bold(command));
467
- console.log(dim(' Run: npx vektor help\n'));
468
- process.exit(1);
255
+ if (require.main === module) {
256
+ main();
469
257
  }
470
258
 
471
- // Handle pipe for remember command
472
- if (command === 'remember') {
473
- handlePipe().then(() => fn()).catch(e => {
474
- console.error(red('\n ✗ Error: ') + e.message);
475
- process.exit(1);
476
- });
477
- } else {
478
- fn().catch(e => {
479
- console.error(red('\n ✗ Error: ') + e.message);
480
- process.exit(1);
481
- });
482
- }
259
+ module.exports = { COMMANDS, main };
package/vektor-setup.js CHANGED
@@ -250,6 +250,10 @@ async function main() {
250
250
  console.log(dim(' const ctx = await memory.recall(\'coding preferences\');'));
251
251
  console.log('');
252
252
  console.log(' Commands:');
253
+ console.log(` ${cyan('npx vektor chat')} — persistent memory chat (Claude, Ollama, GPT, Groq, Gemini)`);
254
+ console.log(` ${cyan('npx vektor remember')} — store a fact: npx vektor remember "I prefer TypeScript"`);
255
+ console.log(` ${cyan('npx vektor ask')} — query memory: npx vektor ask "what stack am I using?"`);
256
+ console.log(` ${cyan('npx vektor agent')} — autonomous goal executor`);
253
257
  console.log(` ${cyan('npx vektor status')} — check system health`);
254
258
  console.log(` ${cyan('npx vektor test')} — run memory test`);
255
259
  console.log(` ${cyan('npx vektor mcp')} — start Claude MCP server`);
@@ -263,4 +267,4 @@ async function main() {
263
267
  main().catch(e => {
264
268
  console.error(red('\n Setup error: ') + e.message);
265
269
  process.exit(1);
266
- });
270
+ });