mixgram 1.2.4 → 1.2.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 +2 -2
- package/bin/mixgram.js +2 -2
- package/package.json +1 -1
- package/spec/bench-indexing.js +2 -2
- package/spec/scenarios/scenarios.js +4 -4
- package/spec/sdd.md +2 -2
- package/spec/test-large-document.js +1 -1
- package/src/core/search/search.js +7 -4
- package/src/utils/ids.js +12 -7
package/README.md
CHANGED
|
@@ -220,9 +220,9 @@ Omit `query` or use `*` to get **recent** context only.
|
|
|
220
220
|
### Example: one round-trip
|
|
221
221
|
|
|
222
222
|
```text
|
|
223
|
-
1. mem_save → { success: true, id: "
|
|
223
|
+
1. mem_save → { success: true, id: "<10-char id>", path: "...", created: true }
|
|
224
224
|
2. mem_search({ query: "SQLite", project: "my-app" }) → { results: [ { title, snippet, ... } ] }
|
|
225
|
-
3. mem_get_observation({ id: "
|
|
225
|
+
3. mem_get_observation({ id: "<10-char id>" }) → { title, content, type, scope, project, ... }
|
|
226
226
|
```
|
|
227
227
|
|
|
228
228
|
---
|
package/bin/mixgram.js
CHANGED
|
@@ -240,8 +240,8 @@ Setup targets:
|
|
|
240
240
|
gemini-cli Gemini CLI
|
|
241
241
|
codex Codex
|
|
242
242
|
|
|
243
|
-
Example (Cursor): "mixgram": { "command": "mixgram", "args": ["mcp", "--project-memory", "
|
|
244
|
-
With embeddings: "args": ["mcp", "--project-memory", "
|
|
243
|
+
Example (Cursor): "mixgram": { "command": "mixgram", "args": ["mcp", "--project-memory", "\${workspaceFolder}/docs"] }
|
|
244
|
+
With embeddings: "args": ["mcp", "--project-memory", "\${workspaceFolder}/docs", "--embeddings"]
|
|
245
245
|
Config file: .mixgram/config.json or ~/.mixgram/config.json
|
|
246
246
|
|
|
247
247
|
npm install -g mixgram
|
package/package.json
CHANGED
package/spec/bench-indexing.js
CHANGED
|
@@ -74,9 +74,9 @@ console.log('Mode: %s\n', RUN_EMBED_PROCESSING ? 'indexing + embedding queue pro
|
|
|
74
74
|
|
|
75
75
|
// --- Create corpus ---
|
|
76
76
|
for (let i = 0; i < NUM_SMALL; i++) {
|
|
77
|
-
writeDoc(baseConfig.projectMemoryRoot, `
|
|
77
|
+
writeDoc(baseConfig.projectMemoryRoot, `bench${String(i).padStart(5, '0')}`, `Small ${i}`, `Content for small doc ${i}.\n`);
|
|
78
78
|
}
|
|
79
|
-
const largePath = writeDoc(baseConfig.projectMemoryRoot, '
|
|
79
|
+
const largePath = writeDoc(baseConfig.projectMemoryRoot, 'bench99999', 'Large doc', buildLargeBody(LARGE_SIZE));
|
|
80
80
|
|
|
81
81
|
/**
|
|
82
82
|
* Full reindex with breakdown: clearIndex, listMarkdownPaths, index loop.
|
|
@@ -532,14 +532,14 @@ export const scenarios = [
|
|
|
532
532
|
|
|
533
533
|
reporter.startScenario(this.name, this.goal);
|
|
534
534
|
|
|
535
|
-
const updBad = await h.mem_update({ id: '
|
|
535
|
+
const updBad = await h.mem_update({ id: 'nonexist01', title: 'No', content: 'No' });
|
|
536
536
|
const updBadParsed = parseRes(updBad);
|
|
537
|
-
reporter.step('mem_update (bad id)', { id: '
|
|
537
|
+
reporter.step('mem_update (bad id)', { id: 'nonexist01' }, updBadParsed);
|
|
538
538
|
ok(updBadParsed.success === false && updBadParsed.error, 'update fails cleanly');
|
|
539
539
|
|
|
540
|
-
const getBad = await h.mem_get_observation({ id: '
|
|
540
|
+
const getBad = await h.mem_get_observation({ id: 'nonexist02' });
|
|
541
541
|
const getBadParsed = parseRes(getBad);
|
|
542
|
-
reporter.step('mem_get_observation (bad id)', { id: '
|
|
542
|
+
reporter.step('mem_get_observation (bad id)', { id: 'nonexist02' }, getBadParsed);
|
|
543
543
|
ok(getBadParsed.error === 'Observation not found' || !!getBadParsed.error, 'get_observation error');
|
|
544
544
|
|
|
545
545
|
reporter.endScenario(p, f);
|
package/spec/sdd.md
CHANGED
|
@@ -338,13 +338,13 @@ Each memory document should include structured frontmatter.
|
|
|
338
338
|
|
|
339
339
|
```md
|
|
340
340
|
---
|
|
341
|
-
id:
|
|
341
|
+
id: a1b2c3d4e5
|
|
342
342
|
title: Use SQLite as derived index
|
|
343
343
|
type: decision
|
|
344
344
|
scope: project
|
|
345
345
|
project: castlebravo
|
|
346
346
|
topic_key: architecture/sqlite-derived-index
|
|
347
|
-
session_id:
|
|
347
|
+
session_id: f6g7h8i9j0
|
|
348
348
|
tool_name: mem_save
|
|
349
349
|
created_at: 2026-03-08T18:00:00Z
|
|
350
350
|
updated_at: 2026-03-08T18:00:00Z
|
|
@@ -39,7 +39,7 @@ export function runLargeDocumentTest(config) {
|
|
|
39
39
|
fs.mkdirSync(docsDir, { recursive: true });
|
|
40
40
|
|
|
41
41
|
const body = buildLargeBody(TARGET_SIZE);
|
|
42
|
-
const id = '
|
|
42
|
+
const id = 'large100k00';
|
|
43
43
|
const now = new Date().toISOString();
|
|
44
44
|
const frontmatter = {
|
|
45
45
|
id,
|
|
@@ -40,7 +40,7 @@ function normalizeQuery(q) {
|
|
|
40
40
|
* @param {string} [options.scopeMode] - 'project-only' | 'home-only' | 'merged'
|
|
41
41
|
* @param {string} [options.project] - project name (required for project-only and merged)
|
|
42
42
|
* @param {number} [options.limit] - max results
|
|
43
|
-
* @returns {Array<{ documentId: string, title: string, topicKey: string, type: string, scope: string, project: string | null, snippet: string, score: number }>}
|
|
43
|
+
* @returns {Array<{ documentId: string, title: string, topicKey: string, type: string, scope: string, project: string | null, created: string | null, snippet: string, score: number }>}
|
|
44
44
|
*/
|
|
45
45
|
function search(config, options = {}) {
|
|
46
46
|
const {
|
|
@@ -85,9 +85,10 @@ function search(config, options = {}) {
|
|
|
85
85
|
d.type AS type,
|
|
86
86
|
d.scope AS scope,
|
|
87
87
|
d.project AS project,
|
|
88
|
+
d.created_at AS created,
|
|
88
89
|
d.body AS body,
|
|
89
|
-
snippet(document_fts, 1, '
|
|
90
|
-
snippet(document_fts, 8, '
|
|
90
|
+
snippet(document_fts, 1, '**', '**', '...', 24) AS snippetTitle,
|
|
91
|
+
snippet(document_fts, 8, '**', '**', '...', 64) AS snippetBody,
|
|
91
92
|
bm25(document_fts, ${bm25Args}) AS rank
|
|
92
93
|
FROM document_fts f
|
|
93
94
|
JOIN documents d ON d.id = f.document_id
|
|
@@ -110,6 +111,7 @@ function search(config, options = {}) {
|
|
|
110
111
|
type: r.type,
|
|
111
112
|
scope: r.scope,
|
|
112
113
|
project: r.project,
|
|
114
|
+
created: r.created || null,
|
|
113
115
|
snippet: String(snippet).trim(),
|
|
114
116
|
score: -Number(r.rank)
|
|
115
117
|
};
|
|
@@ -123,7 +125,7 @@ function getRecentContext(config, options = {}) {
|
|
|
123
125
|
const { project = null, limit = config.search?.defaultLimit ?? 10 } = options;
|
|
124
126
|
const db = getDb(config);
|
|
125
127
|
let sql = `
|
|
126
|
-
SELECT d.id AS documentId, d.title, d.topic_key AS topicKey, d.type, d.scope, d.project, d.body
|
|
128
|
+
SELECT d.id AS documentId, d.title, d.topic_key AS topicKey, d.type, d.scope, d.project, d.created_at AS created, d.body
|
|
127
129
|
FROM documents d
|
|
128
130
|
WHERE d.deleted_at IS NULL
|
|
129
131
|
`;
|
|
@@ -145,6 +147,7 @@ function getRecentContext(config, options = {}) {
|
|
|
145
147
|
type: r.type,
|
|
146
148
|
scope: r.scope,
|
|
147
149
|
project: r.project,
|
|
150
|
+
created: r.created || null,
|
|
148
151
|
snippet: (r.body || '').slice(0, 300).trim()
|
|
149
152
|
}));
|
|
150
153
|
}
|
package/src/utils/ids.js
CHANGED
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
import crypto from 'crypto';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const ALPHANUM = '0123456789abcdefghijklmnopqrstuvwxyz';
|
|
4
|
+
|
|
5
|
+
export function generateId() {
|
|
6
|
+
const bytes = crypto.randomBytes(10);
|
|
7
|
+
let s = '';
|
|
8
|
+
for (let i = 0; i < 10; i++) s += ALPHANUM[bytes[i] % 36];
|
|
9
|
+
return s;
|
|
6
10
|
}
|
|
7
11
|
|
|
8
12
|
export function observationId() {
|
|
9
|
-
return generateId(
|
|
13
|
+
return generateId();
|
|
10
14
|
}
|
|
11
15
|
|
|
12
16
|
export function sessionId() {
|
|
13
|
-
return generateId(
|
|
17
|
+
return generateId();
|
|
14
18
|
}
|
|
15
19
|
|
|
16
20
|
export function chunkId(documentId, index) {
|
|
17
|
-
return `${documentId}
|
|
21
|
+
return `${documentId}_${index}`;
|
|
18
22
|
}
|
|
19
23
|
|
|
20
24
|
export function promptId() {
|
|
21
|
-
return generateId(
|
|
25
|
+
return generateId();
|
|
22
26
|
}
|
|
27
|
+
|