mixgram 1.0.2 → 1.0.6

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
@@ -9,7 +9,7 @@ MCP memory server compatible with [Engram](https://github.com/gentleman-programm
9
9
  ### Advantages over Engram
10
10
 
11
11
  - **Visible, editable docs** — As you advance with agentic development you see the actual documentation files on disk. You can open them, read them, and edit them manually; the agent’s memory is not hidden in a black box.
12
- - **Versioned** — Memory lives in Markdown under your repo (e.g. `projects/<name>/memory/` or `home/memory/`). Commit, branch, and diff as with any other docs.
12
+ - **Versioned** — Memory lives in Markdown under your repo (e.g. `mixgram/<type>/` for project scope) or in a shared home (e.g. `home/memory/` for cross-project). Commit, branch, and diff as with any other docs.
13
13
  - **No semantic deps required** — Core experience is text-only (FTS5). No need to install embeddings or vector libs unless you opt in.
14
14
 
15
15
  ---
@@ -56,8 +56,9 @@ Arguments are passed as `--key value`. Booleans use `--flag` or `--no-flag`. Arr
56
56
  | `--config <path>` | `MIXGRAM_CONFIG` | Config file (default: `./.mixgram/config.json` or `~/.mixgram/config.json`). |
57
57
  | `--embeddings` | `MIXGRAM_EMBEDDINGS_ENABLED` | Enable optional semantic (hybrid) search. |
58
58
  | `--watch` | `MIXGRAM_WATCH` | Watch files and reindex on change. |
59
- | `--home <path>` | `MIXGRAM_HOME` | Home memory root. |
60
- | `--projects <path>` | `MIXGRAM_PROJECTS` | Projects root. |
59
+ | `--home <path>` | `MIXGRAM_HOME` | Home memory root (cross-project). |
60
+ | `--project-memory <path>` | `MIXGRAM_PROJECT_MEMORY` | Project memory root (default: `./mixgram`, relative to repo). |
61
+ | `--projects <path>` | `MIXGRAM_PROJECTS` | Projects root (legacy). |
61
62
  | `--sqlite-path <path>` | `MIXGRAM_SQLITE_PATH` | SQLite index path. |
62
63
 
63
64
  **Example — Cursor**
@@ -80,11 +81,11 @@ With embeddings and custom paths via args:
80
81
  ```json
81
82
  "mixgram": {
82
83
  "command": "mixgram",
83
- "args": ["mcp", "--embeddings", "--home", "/data/memory", "--projects", "/data/projects"]
84
+ "args": ["mcp", "--embeddings", "--home", "/data/memory", "--project-memory", "./specs"]
84
85
  }
85
86
  ```
86
87
 
87
- Or use a config file (see below) and just `"args": ["mcp"]`. Restart Cursor after changing config.
88
+ Or use `./mixgram` (default), `./docs`, or any path. Or use a config file (see below) and just `"args": ["mcp"]`. Restart Cursor after changing config.
88
89
 
89
90
  ---
90
91
 
@@ -113,24 +114,23 @@ Example **`.mixgram/config.json`** (project or home):
113
114
 
114
115
  ```json
115
116
  {
116
- "homeMemoryRoot": "./home/memory",
117
- "projectsRoot": "./projects",
118
- "sqlitePath": "./.mixgram/index.db",
119
- "watch": false,
117
+ "homeMemoryRoot": "~/.mixgram/docs",
118
+ "projectMemoryRoot": "./mixgram",
119
+ "sqlitePath": "~/.mixgram/index.db",
120
120
  "embeddings": {
121
121
  "enabled": true
122
122
  }
123
123
  }
124
124
  ```
125
125
 
126
- Paths in the config file are relative to the config file’s directory (project) or to the current directory when using `~/.mixgram/config.json`. Defaults:
126
+ Paths in the config file are relative to the config file’s directory (project) or to the current directory when using `~/.mixgram/config.json`. **Project memory** is resolved relative to the current working directory (repo) when you use a global config, so docs stay in the repo. The project memory folder name is configurable: set `projectMemoryRoot` to e.g. `./specs` to get `specs/architecture/`, `specs/decisions/`, etc. Defaults:
127
127
 
128
128
  | Option | Default | Description |
129
129
  |--------|---------|-------------|
130
- | `homeMemoryRoot` | `./home/memory` | Cross-project memory (Markdown files). |
131
- | `projectsRoot` | `./projects` | Project roots; each project may have `memory/` under it. |
132
- | `sqlitePath` | `./.mixgram/index.db` | SQLite index (FTS5 + optional vectors). |
133
- | `watch` | `false` | Watch files and reindex on change. |
130
+ | `homeMemoryRoot` | `~/.mixgram/docs` | Cross-project memory (Markdown files). |
131
+ | `projectMemoryRoot` | `./mixgram` | Project memory in the current repo (e.g. `mixgram/architecture/`, `mixgram/decisions/`). You can use another folder name, e.g. `./specs` for `specs/architecture/`. |
132
+ | `sqlitePath` | `~/.mixgram/index.db` | SQLite index (FTS5 + optional vectors). |
133
+ | `watch` | `true` | Watch files and reindex on change. |
134
134
  | `indexing.reindexOnStartup` | `true` | Full reindex when server starts. |
135
135
  | `embeddings.enabled` | `false` | Enable async local embeddings and hybrid search. |
136
136
  | `search.defaultScopeMode` | `'merged'` | `'project-only'` \| `'home-only'` \| `'merged'`. |
@@ -143,7 +143,7 @@ import { run } from 'mixgram/src/mcp/server.js';
143
143
 
144
144
  await run({
145
145
  homeMemoryRoot: '/data/memory',
146
- projectsRoot: '/data/projects',
146
+ projectMemoryRoot: '/path/to/repo/mixgram',
147
147
  sqlitePath: '/data/.mixgram/index.db',
148
148
  watch: true
149
149
  });
@@ -169,8 +169,8 @@ Core flow: save Markdown-backed documents, search with FTS5, get context.
169
169
  }
170
170
  ```
171
171
 
172
- - **scope** `project` → file under `projects/<project>/memory/...`
173
- - **scope** `home` → file under `home/memory/...`
172
+ - **scope** `project` → file under `<repo>/mixgram/<type>/...` (e.g. `mixgram/architecture/`, `mixgram/decisions/`).
173
+ - **scope** `home` → file under `home/memory/...` (cross-project).
174
174
  - Same `topic_key` + scope + project → **update** existing doc; otherwise create.
175
175
 
176
176
  ### Search
@@ -238,12 +238,12 @@ Useful after cloning a repo or editing Markdown by hand:
238
238
  { "full": true }
239
239
  ```
240
240
 
241
- - `full: true` — rebuild entire index from `home/**/*.md` and `projects/**/memory/**/*.md`.
241
+ - `full: true` — rebuild entire index from `home/**/*.md` and `mixgram/**/*.md` (project memory in repo).
242
242
  - `full: false` (default) — incremental (by mtime).
243
243
 
244
244
  Manual edit example:
245
245
 
246
- 1. Edit a `.md` file under `home/memory` or `projects/<project>/memory`.
246
+ 1. Edit a `.md` file under `home/memory` or `mixgram/<type>/` in your repo.
247
247
  2. Call `mem_reindex({ full: true })` (or run with `watch: true` so changes are picked up).
248
248
  3. `mem_search` and `mem_get_observation` reflect the new content.
249
249
 
package/bin/mixgram.js CHANGED
@@ -16,7 +16,7 @@ import os from 'os';
16
16
  const SUBCOMMAND = process.argv[2];
17
17
  const ARG = process.argv[3];
18
18
 
19
- /** Parse options after "mcp": --config, --embeddings, --watch, --home, --projects, --sqlite-path */
19
+ /** Parse options after "mcp": --config, --embeddings, --watch, --home, --sqlite-path */
20
20
  function parseMcpArgs() {
21
21
  const args = process.argv.slice(3);
22
22
  const out = {};
@@ -31,8 +31,8 @@ function parseMcpArgs() {
31
31
  out._configPath = args[++i];
32
32
  } else if (a === '--home' && args[i + 1]) {
33
33
  out.homeMemoryRoot = args[++i];
34
- } else if (a === '--projects' && args[i + 1]) {
35
- out.projectsRoot = args[++i];
34
+ } else if (a === '--project-memory' && args[i + 1]) {
35
+ out.projectMemoryRoot = args[++i];
36
36
  } else if (a === '--sqlite-path' && args[i + 1]) {
37
37
  out.sqlitePath = args[++i];
38
38
  }
@@ -81,7 +81,7 @@ function loadCliConfig() {
81
81
  envOverrides.embeddings = { ...(fileConfig.embeddings || {}), enabled: true };
82
82
  }
83
83
  if (process.env.MIXGRAM_HOME) envOverrides.homeMemoryRoot = process.env.MIXGRAM_HOME;
84
- if (process.env.MIXGRAM_PROJECTS) envOverrides.projectsRoot = process.env.MIXGRAM_PROJECTS;
84
+ if (process.env.MIXGRAM_PROJECT_MEMORY) envOverrides.projectMemoryRoot = process.env.MIXGRAM_PROJECT_MEMORY;
85
85
  if (process.env.MIXGRAM_SQLITE_PATH) envOverrides.sqlitePath = process.env.MIXGRAM_SQLITE_PATH;
86
86
  if (process.env.MIXGRAM_WATCH === '1' || process.env.MIXGRAM_WATCH === 'true') envOverrides.watch = true;
87
87
 
@@ -91,7 +91,8 @@ function loadCliConfig() {
91
91
  if (argvRest.embeddings && typeof merged.embeddings === 'object') {
92
92
  merged.embeddings = { ...merged.embeddings, ...argvRest.embeddings };
93
93
  }
94
- return { overrides: merged, baseDir };
94
+ const projectBaseDir = process.cwd();
95
+ return { overrides: merged, baseDir, projectBaseDir };
95
96
  }
96
97
 
97
98
  const MIXGRAM_ENTRY = {
@@ -216,11 +217,12 @@ mcp options (and env / config file):
216
217
  --embeddings Enable semantic search (or embeddings.enabled in config)
217
218
  --watch Watch files and reindex on change
218
219
  --home <path> Home memory root (default: ./home/memory)
220
+ --project-memory <path> Project memory root (default: ./mixgram, relative to repo)
219
221
  --projects <path> Projects root (default: ./projects)
220
222
  --sqlite-path <path> SQLite index path (default: ./.mixgram/index.db)
221
223
 
222
- Env: MIXGRAM_CONFIG, MIXGRAM_EMBEDDINGS_ENABLED, MIXGRAM_HOME, MIXGRAM_PROJECTS,
223
- MIXGRAM_SQLITE_PATH, MIXGRAM_WATCH
224
+ Env: MIXGRAM_CONFIG, MIXGRAM_EMBEDDINGS_ENABLED, MIXGRAM_HOME, MIXGRAM_PROJECT_MEMORY,
225
+ MIXGRAM_PROJECTS, MIXGRAM_SQLITE_PATH, MIXGRAM_WATCH
224
226
 
225
227
  Setup targets:
226
228
  cursor Cursor IDE
@@ -237,8 +239,8 @@ Config file: .mixgram/config.json or ~/.mixgram/config.json
237
239
 
238
240
  async function main() {
239
241
  if (SUBCOMMAND === 'mcp') {
240
- const { overrides, baseDir } = loadCliConfig();
241
- await run(overrides, baseDir)
242
+ const { overrides, baseDir, projectBaseDir } = loadCliConfig();
243
+ await run(overrides, baseDir, projectBaseDir)
242
244
  .then(() => {})
243
245
  .catch((err) => {
244
246
  console.error(err);
@@ -287,8 +289,8 @@ async function main() {
287
289
  }
288
290
  const toolDef = getToolByName(SUBCOMMAND);
289
291
  const args = parseToolArgs(toolDef, toolArgv);
290
- const { overrides, baseDir } = loadCliConfig();
291
- const config = loadConfig(overrides, baseDir);
292
+ const { overrides, baseDir, projectBaseDir } = loadCliConfig();
293
+ const config = loadConfig(overrides, baseDir, projectBaseDir);
292
294
  const handlers = createToolHandlers(config);
293
295
  try {
294
296
  const result = await handlers[SUBCOMMAND](args);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mixgram",
3
- "version": "1.0.2",
3
+ "version": "1.0.6",
4
4
  "description": "MCP memory server with Markdown source of truth and SQLite FTS5.",
5
5
  "keywords": [
6
6
  "mcp",
package/spec/run-tests.js CHANGED
@@ -17,10 +17,9 @@ import * as reporter from './reporter.js';
17
17
  const tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'mixgram-test-'));
18
18
  const config = loadConfig({
19
19
  homeMemoryRoot: path.join(tmpDir, 'home', 'memory'),
20
- projectsRoot: path.join(tmpDir, 'projects'),
20
+ projectMemoryRoot: path.join(tmpDir, 'mixgram'),
21
21
  sqlitePath: path.join(tmpDir, '.mixgram', 'index.db')
22
22
  });
23
- fs.mkdirSync(path.join(tmpDir, 'projects', 'castlebravo', 'memory'), { recursive: true });
24
23
  fs.mkdirSync(path.dirname(config.sqlitePath), { recursive: true });
25
24
 
26
25
  const h = createToolHandlers(config);
@@ -53,7 +52,7 @@ async function runScenarios() {
53
52
  if (scenario.name === 'Semantic / embeddings (save and search)' && !ctx.hSemantic) {
54
53
  const configSemantic = loadConfig({
55
54
  homeMemoryRoot: config.homeMemoryRoot,
56
- projectsRoot: config.projectsRoot,
55
+ projectMemoryRoot: config.projectMemoryRoot,
57
56
  sqlitePath: config.sqlitePath,
58
57
  embeddings: { enabled: true }
59
58
  });
@@ -78,7 +77,7 @@ async function runLegacySemanticKnn() {
78
77
  const configSemantic = ctx.hSemantic
79
78
  ? loadConfig({
80
79
  homeMemoryRoot: config.homeMemoryRoot,
81
- projectsRoot: config.projectsRoot,
80
+ projectMemoryRoot: config.projectMemoryRoot,
82
81
  sqlitePath: config.sqlitePath,
83
82
  embeddings: { enabled: true }
84
83
  })
@@ -43,6 +43,7 @@ export const scenarios = [
43
43
  reporter.step('mem_save', { title: decisionSqliteIndex.title, topic_key: decisionSqliteIndex.topic_key }, { id: s1.id, path: s1.path, created: s1.created });
44
44
  ok(s1.success && s1.id && s1.created === true, 'save success');
45
45
  ok(fs.existsSync(s1.path), 'file created');
46
+ ok(s1.path.includes('mixgram') || s1.path.replace(/\\/g, '/').includes('mixgram'), 'project doc under mixgram');
46
47
 
47
48
  const search1 = await h.mem_search({ query: 'derived SQLite index', project: PROJECT_NAME });
48
49
  const search1Parsed = parseRes(search1);
package/spec/sdd.md CHANGED
@@ -928,9 +928,8 @@ src/
928
928
 
929
929
  ```json
930
930
  {
931
- "homeMemoryRoot": "./home/memory",
932
- "projectsRoot": "./projects",
933
- "sqlitePath": "./.Mixgram/index.db",
931
+ "homeMemoryRoot": "~/.mixgram/docs",
932
+ "sqlitePath": "~/.mixgram/index.db",
934
933
  "watch": true,
935
934
  "indexing": {
936
935
  "chunkSize": 1200,
package/src/config.js CHANGED
@@ -1,10 +1,19 @@
1
1
  import path from 'path';
2
+ import os from 'os';
3
+
4
+ function expandHome(p) {
5
+ if (typeof p !== 'string') return p;
6
+ if (p === '~' || p.startsWith('~/') || p.startsWith('~\\')) {
7
+ return path.join(os.homedir(), p.slice(2) || '');
8
+ }
9
+ return p;
10
+ }
2
11
 
3
12
  const DEFAULT_CONFIG = {
4
- homeMemoryRoot: './home/memory',
5
- projectsRoot: './projects',
6
- sqlitePath: './.mixgram/index.db',
7
- watch: false,
13
+ homeMemoryRoot: '~/.mixgram/shared',
14
+ projectMemoryRoot: './mixgram',
15
+ sqlitePath: '~/.mixgram/index.db',
16
+ watch: true,
8
17
  indexing: {
9
18
  chunkSize: 1200,
10
19
  chunkOverlap: 120,
@@ -38,19 +47,22 @@ const DEFAULT_CONFIG = {
38
47
  }
39
48
  };
40
49
 
41
- function resolvePaths(config, baseDir) {
50
+ function resolvePaths(config, baseDir, projectBaseDir = null) {
42
51
  const base = baseDir || process.cwd();
52
+ const projectBase = projectBaseDir ?? base;
53
+ const homeRoot = expandHome(config.homeMemoryRoot);
54
+ const sqlite = expandHome(config.sqlitePath);
43
55
  return {
44
56
  ...config,
45
- homeMemoryRoot: path.resolve(base, config.homeMemoryRoot),
46
- projectsRoot: path.resolve(base, config.projectsRoot),
47
- sqlitePath: path.resolve(base, config.sqlitePath)
57
+ homeMemoryRoot: path.isAbsolute(homeRoot) ? homeRoot : path.resolve(base, homeRoot),
58
+ projectMemoryRoot: path.resolve(projectBase, config.projectMemoryRoot ?? './mixgram'),
59
+ sqlitePath: path.isAbsolute(sqlite) ? sqlite : path.resolve(base, sqlite)
48
60
  };
49
61
  }
50
62
 
51
- function loadConfig(overrides = {}, baseDir) {
63
+ function loadConfig(overrides = {}, baseDir, projectBaseDir = null) {
52
64
  const config = { ...DEFAULT_CONFIG, ...overrides };
53
- return resolvePaths(config, baseDir);
65
+ return resolvePaths(config, baseDir, projectBaseDir);
54
66
  }
55
67
 
56
68
  export { DEFAULT_CONFIG, loadConfig, resolvePaths };
@@ -95,12 +95,20 @@ function indexDocument(config, docPath, rawContent, fileMtimeMs = null) {
95
95
 
96
96
  if (config?.embeddings?.enabled) {
97
97
  const newChunkIds = Array.from({ length: chunks.length }, (_, idx) => chunkId(id, idx));
98
- import('../embeddings/queue.js').then(({ enqueueChunks, markStale }) => {
99
- if (oldChunkIds.length) markStale(config, oldChunkIds);
100
- enqueueChunks(config, newChunkIds);
101
- });
98
+ import('../embeddings/queue.js')
99
+ .then(({ enqueueChunks, markStale }) => {
100
+ if (oldChunkIds.length) markStale(config, oldChunkIds);
101
+ enqueueChunks(config, newChunkIds);
102
+ })
103
+ .catch((err) => {
104
+ if (typeof process !== 'undefined' && process.stderr) {
105
+ process.stderr.write(`[mixgram] embeddings queue error: ${err?.message ?? err}\n`);
106
+ }
107
+ });
102
108
  if (oldChunkIds.length) {
103
- import('../embeddings/vectorStore.js').then(({ removeChunks }) => removeChunks(config, oldChunkIds).catch(() => {}));
109
+ import('../embeddings/vectorStore.js')
110
+ .then(({ removeChunks }) => removeChunks(config, oldChunkIds))
111
+ .catch(() => {});
104
112
  }
105
113
  }
106
114
 
@@ -111,8 +119,16 @@ function removeDocumentFromIndex(config, documentId) {
111
119
  const db = getDb(config);
112
120
  const chunkIds = db.prepare('SELECT id FROM document_chunks WHERE document_id = ?').all(documentId).map((r) => r.id);
113
121
  if (config?.embeddings?.enabled && chunkIds.length) {
114
- import('../embeddings/queue.js').then(({ markStale }) => markStale(config, chunkIds));
115
- import('../embeddings/vectorStore.js').then(({ removeChunks }) => removeChunks(config, chunkIds).catch(() => {}));
122
+ import('../embeddings/queue.js')
123
+ .then(({ markStale }) => markStale(config, chunkIds))
124
+ .catch((err) => {
125
+ if (typeof process !== 'undefined' && process.stderr) {
126
+ process.stderr.write(`[mixgram] embeddings markStale error: ${err?.message ?? err}\n`);
127
+ }
128
+ });
129
+ import('../embeddings/vectorStore.js')
130
+ .then(({ removeChunks }) => removeChunks(config, chunkIds))
131
+ .catch(() => {});
116
132
  }
117
133
  for (const cid of chunkIds) {
118
134
  db.prepare('DELETE FROM embedding_jobs WHERE chunk_id = ?').run(cid);
@@ -5,19 +5,19 @@ import { getDb } from '../../db/sqlite.js';
5
5
  import { indexDocument, removeDocumentFromIndex } from './indexer.js';
6
6
 
7
7
  /**
8
- * List all Markdown file paths under home and projects memory roots (absolute).
8
+ * List all Markdown file paths under home (cross-project) and project memory root (repo-local).
9
9
  */
10
10
  function listMarkdownPaths(config) {
11
11
  const homeRoot = config.homeMemoryRoot;
12
- const projectsRoot = config.projectsRoot;
12
+ const projectRoot = config.projectMemoryRoot;
13
13
  const out = [];
14
14
  if (fs.existsSync(homeRoot)) {
15
15
  const homeFiles = globSync('**/*.md', { cwd: homeRoot });
16
16
  out.push(...homeFiles.map((p) => path.join(homeRoot, p)));
17
17
  }
18
- if (fs.existsSync(projectsRoot)) {
19
- const projectFiles = globSync('**/memory/**/*.md', { cwd: projectsRoot });
20
- out.push(...projectFiles.map((p) => path.join(projectsRoot, p)));
18
+ if (projectRoot && fs.existsSync(projectRoot)) {
19
+ const projectFiles = globSync('**/*.md', { cwd: projectRoot });
20
+ out.push(...projectFiles.map((p) => path.join(projectRoot, p)));
21
21
  }
22
22
  return out;
23
23
  }
package/src/fs/paths.js CHANGED
@@ -42,13 +42,13 @@ function documentPath(config, { scope, project, type, topic_key, id }) {
42
42
  return path.join(root, typeDir, baseName);
43
43
  }
44
44
 
45
- if (scope === 'project' && project) {
46
- const root = path.join(config.projectsRoot, project, 'memory');
45
+ if (scope === 'project') {
46
+ const root = config.projectMemoryRoot;
47
47
  return path.join(root, typeDir, baseName);
48
48
  }
49
49
 
50
- const root = config.projectsRoot;
51
- return path.join(root, '_default', 'memory', typeDir, baseName);
50
+ const root = config.projectMemoryRoot;
51
+ return path.join(root, typeDir, baseName);
52
52
  }
53
53
 
54
54
  function ensureDir(filePath) {
package/src/fs/watcher.js CHANGED
@@ -5,17 +5,17 @@ import { indexDocument, removeDocumentFromIndex } from '../core/indexing/indexer
5
5
  import { getDocumentIdByPath } from '../core/indexing/reindex.js';
6
6
 
7
7
  /**
8
- * Start watching home and projects memory roots for .md changes.
8
+ * Start watching home (cross-project) and project memory root (repo-local) for .md changes.
9
9
  * On add/change: index the file. On unlink: remove from index by path.
10
10
  * @param {object} config - resolved config
11
11
  * @returns {import('chokidar').FSWatcher} watcher instance (call .close() to stop)
12
12
  */
13
13
  function startWatcher(config) {
14
14
  const homeRoot = config.homeMemoryRoot;
15
- const projectsRoot = config.projectsRoot;
15
+ const projectRoot = config.projectMemoryRoot;
16
16
  const patterns = [];
17
17
  if (homeRoot) patterns.push(path.join(homeRoot, '**/*.md'));
18
- if (projectsRoot) patterns.push(path.join(projectsRoot, '**/memory/**/*.md'));
18
+ if (projectRoot) patterns.push(path.join(projectRoot, '**/*.md'));
19
19
  if (patterns.length === 0) return null;
20
20
 
21
21
  const watcher = chokidar.watch(patterns, {
@@ -39,8 +39,10 @@ function startWatcher(config) {
39
39
  } catch (_) {}
40
40
  })
41
41
  .on('unlink', (filePath) => {
42
- const id = getDocumentIdByPath(config, filePath);
43
- if (id) removeDocumentFromIndex(config, id);
42
+ try {
43
+ const id = getDocumentIdByPath(config, filePath);
44
+ if (id) removeDocumentFromIndex(config, id);
45
+ } catch (_) {}
44
46
  });
45
47
 
46
48
  return watcher;
package/src/mcp/server.js CHANGED
@@ -4,8 +4,8 @@ import { loadConfig } from '../config.js';
4
4
  import { createToolHandlers } from './tools.js';
5
5
  import { getToolDefinitions } from './tool-registry.js';
6
6
 
7
- function createServer(configOverrides = {}, baseDir = null) {
8
- const config = loadConfig(configOverrides, baseDir);
7
+ function createServer(configOverrides = {}, baseDir = null, projectBaseDir = null) {
8
+ const config = loadConfig(configOverrides, baseDir, projectBaseDir);
9
9
  const mcpServer = new McpServer(
10
10
  { name: 'mixgram', version: '1.0.0' },
11
11
  { capabilities: { tools: { listChanged: true } } }
@@ -26,19 +26,46 @@ function createServer(configOverrides = {}, baseDir = null) {
26
26
  return { mcpServer, config };
27
27
  }
28
28
 
29
- async function run(configOverrides = {}, baseDir = null) {
30
- const { mcpServer, config } = createServer(configOverrides, baseDir);
29
+ async function run(configOverrides = {}, baseDir = null, projectBaseDir = null) {
30
+ if (typeof process !== 'undefined') {
31
+ process.on('unhandledRejection', (reason, promise) => {
32
+ if (process.stderr) {
33
+ process.stderr.write(`[mixgram] unhandledRejection: ${reason}\n`);
34
+ }
35
+ });
36
+ }
37
+
38
+ const { mcpServer, config } = createServer(configOverrides, baseDir, projectBaseDir);
39
+
31
40
  if (config.indexing?.reindexOnStartup) {
32
- const { fullReindex } = await import('../core/indexing/reindex.js');
33
- fullReindex(config);
41
+ try {
42
+ const { fullReindex } = await import('../core/indexing/reindex.js');
43
+ fullReindex(config);
44
+ } catch (err) {
45
+ if (typeof process !== 'undefined' && process.stderr) {
46
+ process.stderr.write(`[mixgram] reindex on startup failed: ${err?.message ?? err}\n`);
47
+ }
48
+ }
34
49
  }
35
50
  if (config.watch) {
36
- const { startWatcher } = await import('../fs/watcher.js');
37
- startWatcher(config);
51
+ try {
52
+ const { startWatcher } = await import('../fs/watcher.js');
53
+ startWatcher(config);
54
+ } catch (err) {
55
+ if (typeof process !== 'undefined' && process.stderr) {
56
+ process.stderr.write(`[mixgram] watcher start failed: ${err?.message ?? err}\n`);
57
+ }
58
+ }
38
59
  }
39
60
  if (config.embeddings?.enabled) {
40
- const { startWorker } = await import('../core/embeddings/worker.js');
41
- startWorker(config);
61
+ try {
62
+ const { startWorker } = await import('../core/embeddings/worker.js');
63
+ startWorker(config);
64
+ } catch (err) {
65
+ if (typeof process !== 'undefined' && process.stderr) {
66
+ process.stderr.write(`[mixgram] embeddings worker start failed: ${err?.message ?? err}\n`);
67
+ }
68
+ }
42
69
  }
43
70
  const transport = new StdioServerTransport();
44
71
  await mcpServer.connect(transport);
package/.mixgram/index.db DELETED
Binary file
Binary file
Binary file
Binary file
@@ -1,17 +0,0 @@
1
- ---
2
- id: obs_6ebf7e3f75daa71933d79c52
3
- title: Use SQLite as derived index
4
- type: decision
5
- scope: project
6
- project: castlebravo
7
- topic_key: architecture/sqlite-derived-index
8
- tool_name: mem_save
9
- created_at: '2026-03-09T02:51:10.990Z'
10
- updated_at: '2026-03-09T02:51:10.990Z'
11
- revision_count: 1
12
- duplicate_count: 0
13
- deleted: false
14
- tags: []
15
- embedding_status: disabled
16
- ---
17
- SQLite will be used as a derived index over Markdown documents.
@@ -1,17 +0,0 @@
1
- ---
2
- id: obs_8a9cd5a608500ed1a05a6326
3
- title: Use SQLite as derived index
4
- type: decision
5
- scope: project
6
- project: test
7
- topic_key: architecture/sqlite-derived-index
8
- tool_name: mem_save
9
- created_at: '2026-03-09T02:40:42.952Z'
10
- updated_at: '2026-03-09T02:40:59.029Z'
11
- revision_count: 2
12
- duplicate_count: 0
13
- deleted: false
14
- tags: []
15
- embedding_status: pending
16
- ---
17
- We use a derived SQLite index over Markdown.