@danielmarbach/mnemonic-mcp 0.11.1 → 0.11.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/build/git.d.ts +8 -1
- package/build/git.d.ts.map +1 -1
- package/build/git.js +43 -8
- package/build/git.js.map +1 -1
- package/build/index.js +16 -16
- package/build/index.js.map +1 -1
- package/build/structured-content.d.ts +98 -0
- package/build/structured-content.d.ts.map +1 -1
- package/build/structured-content.js +17 -0
- package/build/structured-content.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,19 @@ All notable changes to `mnemonic` will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format is loosely based on Keep a Changelog and uses semver-style version headings.
|
|
6
6
|
|
|
7
|
+
## [0.11.3] - 2026-03-15
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- `git.add()` index.lock errors now retry with exponential backoff before failing, matching the retry behavior for `git.commit()` failures.
|
|
12
|
+
- Retry contract now includes `operation` field indicating whether add or commit failed, so clients can retry appropriately.
|
|
13
|
+
|
|
14
|
+
## [0.11.2] - 2026-03-15
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- `consolidate` with `strategy: "find-clusters"` now includes computed theme groups and relationship clusters in structured output.
|
|
19
|
+
|
|
7
20
|
## [0.11.1] - 2026-03-15
|
|
8
21
|
|
|
9
22
|
### Fixed
|
package/build/git.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export declare class GitOperationError extends Error {
|
|
2
|
-
constructor(operation: "commit" | "push", cause: unknown);
|
|
2
|
+
constructor(operation: "add" | "commit" | "push", cause: unknown);
|
|
3
3
|
}
|
|
4
4
|
export interface SyncResult {
|
|
5
5
|
hasRemote: boolean;
|
|
@@ -13,6 +13,8 @@ export interface SyncResult {
|
|
|
13
13
|
export interface CommitResult {
|
|
14
14
|
status: "committed" | "skipped" | "failed";
|
|
15
15
|
reason?: "git-disabled" | "no-changes" | "error";
|
|
16
|
+
/** Which operation failed, when status is "failed" */
|
|
17
|
+
operation?: "add" | "commit";
|
|
16
18
|
error?: string;
|
|
17
19
|
}
|
|
18
20
|
export interface PushResult {
|
|
@@ -52,6 +54,11 @@ export declare class GitOps {
|
|
|
52
54
|
*/
|
|
53
55
|
commit(message: string, files: string[], body?: string): Promise<boolean>;
|
|
54
56
|
commitWithStatus(message: string, files: string[], body?: string): Promise<CommitResult>;
|
|
57
|
+
/**
|
|
58
|
+
* Retry git.add() with exponential backoff for transient index.lock errors.
|
|
59
|
+
* Returns a CommitResult-like object for add failures.
|
|
60
|
+
*/
|
|
61
|
+
private addWithRetry;
|
|
55
62
|
/**
|
|
56
63
|
* Bidirectional sync: fetch → count unpushed local commits → pull (rebase)
|
|
57
64
|
* → push. Returns details about what changed so callers can trigger
|
package/build/git.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAEA,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,SAAS,EAAE,QAAQ,GAAG,MAAM,EAAE,KAAK,EAAE,OAAO;
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAEA,qBAAa,iBAAkB,SAAQ,KAAK;gBAC9B,SAAS,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,EAAE,KAAK,EAAE,OAAO;CAKjE;AAED,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,uEAAuE;IACvE,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,2CAA2C;IAC3C,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,+CAA+C;IAC/C,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,WAAW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|
@@ -61,12 +61,19 @@ export class GitOps {
|
|
|
61
61
|
async commitWithStatus(message, files, body) {
|
|
62
62
|
if (!this.enabled)
|
|
63
63
|
return { status: "skipped", reason: "git-disabled" };
|
|
64
|
+
// Scope every add+commit to only the paths mnemonic manages.
|
|
65
|
+
// Never commit files outside the vault — e.g. src/ or test/ changes
|
|
66
|
+
// that happen to be staged in the same repo.
|
|
67
|
+
const scopedFiles = files.length > 0 ? files : [`${this.notesRelDir}/`];
|
|
68
|
+
// Retry git.add() with exponential backoff for transient index.lock errors.
|
|
69
|
+
// git.add() can fail with "Unable to create '.git/index.lock': File exists"
|
|
70
|
+
// when concurrent git operations race for the index. This is recoverable
|
|
71
|
+
// by retrying after a short delay.
|
|
72
|
+
const addResult = await this.addWithRetry(scopedFiles);
|
|
73
|
+
if (addResult.status === "failed") {
|
|
74
|
+
return addResult;
|
|
75
|
+
}
|
|
64
76
|
try {
|
|
65
|
-
// Scope every add+commit to only the paths mnemonic manages.
|
|
66
|
-
// Never commit files outside the vault — e.g. src/ or test/ changes
|
|
67
|
-
// that happen to be staged in the same repo.
|
|
68
|
-
const scopedFiles = files.length > 0 ? files : [`${this.notesRelDir}/`];
|
|
69
|
-
await this.git.add(scopedFiles);
|
|
70
77
|
const status = await this.git.status();
|
|
71
78
|
if (status.staged.length === 0)
|
|
72
79
|
return { status: "skipped", reason: "no-changes" };
|
|
@@ -78,10 +85,38 @@ export class GitOps {
|
|
|
78
85
|
return { status: "committed" };
|
|
79
86
|
}
|
|
80
87
|
catch (err) {
|
|
81
|
-
const
|
|
82
|
-
console.error(`[git] Commit failed: ${
|
|
83
|
-
return { status: "failed", reason: "error", error:
|
|
88
|
+
const errMessage = err instanceof Error ? err.message : String(err);
|
|
89
|
+
console.error(`[git] Commit failed: ${errMessage}`);
|
|
90
|
+
return { status: "failed", reason: "error", operation: "commit", error: errMessage };
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Retry git.add() with exponential backoff for transient index.lock errors.
|
|
95
|
+
* Returns a CommitResult-like object for add failures.
|
|
96
|
+
*/
|
|
97
|
+
async addWithRetry(files) {
|
|
98
|
+
const maxRetries = 3;
|
|
99
|
+
const baseDelayMs = 50;
|
|
100
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
101
|
+
try {
|
|
102
|
+
await this.git.add(files);
|
|
103
|
+
return { status: "committed" };
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
const errMessage = err instanceof Error ? err.message : String(err);
|
|
107
|
+
const isLockError = errMessage.includes("index.lock") || errMessage.includes("File exists");
|
|
108
|
+
if (isLockError && attempt < maxRetries - 1) {
|
|
109
|
+
const delayMs = baseDelayMs * Math.pow(2, attempt);
|
|
110
|
+
console.error(`[git] add() lock contention, retrying in ${delayMs}ms (attempt ${attempt + 1}/${maxRetries})`);
|
|
111
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
console.error(`[git] add() failed: ${errMessage}`);
|
|
115
|
+
return { status: "failed", reason: "error", operation: "add", error: errMessage };
|
|
116
|
+
}
|
|
84
117
|
}
|
|
118
|
+
// Should be unreachable, but TypeScript needs a return
|
|
119
|
+
return { status: "failed", reason: "error", operation: "add", error: "max retries exceeded" };
|
|
85
120
|
}
|
|
86
121
|
/**
|
|
87
122
|
* Bidirectional sync: fetch → count unpushed local commits → pull (rebase)
|
package/build/git.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,MAAM,YAAY,CAAC;AAElD,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAC1C,YAAY,
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../src/git.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAa,MAAM,YAAY,CAAC;AAElD,MAAM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E,aAAa,EAAE,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,CAAC;QACnD,CAAC;IACH,CAAC;CACF"}
|
package/build/index.js
CHANGED
|
@@ -122,12 +122,11 @@ Examples:
|
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
-
runMigrationCli().catch(err => {
|
|
125
|
+
await runMigrationCli().catch(err => {
|
|
126
126
|
console.error("Migration failed:", err);
|
|
127
127
|
process.exit(1);
|
|
128
128
|
});
|
|
129
|
-
|
|
130
|
-
await new Promise(() => { });
|
|
129
|
+
process.exit(0);
|
|
131
130
|
}
|
|
132
131
|
// ── CLI: import-claude-memory ─────────────────────────────────────────────────
|
|
133
132
|
if (process.argv[2] === "import-claude-memory") {
|
|
@@ -265,12 +264,11 @@ Examples:
|
|
|
265
264
|
console.log(`\n✓ Imported ${notesToWrite.length} note${notesToWrite.length === 1 ? "" : "s"} into main vault`);
|
|
266
265
|
process.exit(0);
|
|
267
266
|
}
|
|
268
|
-
runImportCli().catch(err => {
|
|
267
|
+
await runImportCli().catch(err => {
|
|
269
268
|
console.error("Import failed:", err);
|
|
270
269
|
process.exit(1);
|
|
271
270
|
});
|
|
272
|
-
|
|
273
|
-
await new Promise(() => { });
|
|
271
|
+
process.exit(0);
|
|
274
272
|
}
|
|
275
273
|
// ── Config ────────────────────────────────────────────────────────────────────
|
|
276
274
|
const VAULT_PATH = process.env["VAULT_PATH"]
|
|
@@ -617,6 +615,7 @@ function buildPersistenceStatus(args) {
|
|
|
617
615
|
git: {
|
|
618
616
|
commit: args.commit.status,
|
|
619
617
|
push: args.push.status,
|
|
618
|
+
commitOperation: args.commit.operation,
|
|
620
619
|
commitMessage: args.commitMessage,
|
|
621
620
|
commitBody: args.commitBody,
|
|
622
621
|
commitReason: args.commit.reason,
|
|
@@ -640,6 +639,7 @@ function buildMutationRetryContract(args) {
|
|
|
640
639
|
cwd: args.cwd,
|
|
641
640
|
vault: storageLabel(args.vault),
|
|
642
641
|
error: args.commit.error ?? "Unknown git commit failure",
|
|
642
|
+
operation: args.commit.operation,
|
|
643
643
|
},
|
|
644
644
|
mutationApplied: args.mutationApplied,
|
|
645
645
|
retrySafe: args.mutationApplied,
|
|
@@ -653,9 +653,11 @@ function formatRetrySummary(retry) {
|
|
|
653
653
|
return undefined;
|
|
654
654
|
}
|
|
655
655
|
const safety = retry.retrySafe ? "safe" : "requires review";
|
|
656
|
+
const opLabel = retry.attemptedCommit.operation === "add" ? "add" : "commit";
|
|
657
|
+
const error = retry.attemptedCommit.error;
|
|
656
658
|
return [
|
|
657
659
|
`Retry: ${safety} | vault=${retry.attemptedCommit.vault} | files=${retry.attemptedCommit.files.length}`,
|
|
658
|
-
`Git
|
|
660
|
+
`Git ${opLabel} error: ${error}`,
|
|
659
661
|
].join("\n");
|
|
660
662
|
}
|
|
661
663
|
function formatPersistenceSummary(persistence) {
|
|
@@ -668,7 +670,8 @@ function formatPersistenceSummary(persistence) {
|
|
|
668
670
|
lines[0] += ` | embedding reason=${persistence.embedding.reason}`;
|
|
669
671
|
}
|
|
670
672
|
if (persistence.git.commit === "failed" && persistence.git.commitError) {
|
|
671
|
-
|
|
673
|
+
const opLabel = persistence.git.commitOperation === "add" ? "add" : "commit";
|
|
674
|
+
lines.push(`Git ${opLabel} error: ${persistence.git.commitError}`);
|
|
672
675
|
}
|
|
673
676
|
if (persistence.git.push === "failed" && persistence.git.pushError) {
|
|
674
677
|
lines.push(`Git push error: ${persistence.git.pushError}`);
|
|
@@ -1660,21 +1663,15 @@ server.registerTool("recall", {
|
|
|
1660
1663
|
const structuredContent = { action: "recalled", query, scope: scope || "all", results: [] };
|
|
1661
1664
|
return { content: [{ type: "text", text: "No memories found matching that query." }], structuredContent };
|
|
1662
1665
|
}
|
|
1663
|
-
const sections = [];
|
|
1664
|
-
for (const { id, score, vault } of top) {
|
|
1665
|
-
const note = await readCachedNote(vault, id);
|
|
1666
|
-
if (note)
|
|
1667
|
-
sections.push(formatNote(note, score));
|
|
1668
|
-
}
|
|
1669
1666
|
const header = project
|
|
1670
1667
|
? `Recall results for project **${project.name}** (scope: ${scope}):`
|
|
1671
1668
|
: `Recall results (global):`;
|
|
1672
|
-
const
|
|
1673
|
-
// Build structured results array
|
|
1669
|
+
const sections = [];
|
|
1674
1670
|
const structuredResults = [];
|
|
1675
1671
|
for (const { id, score, vault, boosted } of top) {
|
|
1676
1672
|
const note = await readCachedNote(vault, id);
|
|
1677
1673
|
if (note) {
|
|
1674
|
+
sections.push(formatNote(note, score));
|
|
1678
1675
|
structuredResults.push({
|
|
1679
1676
|
id,
|
|
1680
1677
|
title: note.title,
|
|
@@ -1689,6 +1686,7 @@ server.registerTool("recall", {
|
|
|
1689
1686
|
});
|
|
1690
1687
|
}
|
|
1691
1688
|
}
|
|
1689
|
+
const textContent = `${header}\n\n${sections.join("\n\n---\n\n")}`;
|
|
1692
1690
|
const structuredContent = {
|
|
1693
1691
|
action: "recalled",
|
|
1694
1692
|
query,
|
|
@@ -3127,6 +3125,8 @@ function findClusters(entries, project) {
|
|
|
3127
3125
|
projectName: project?.name,
|
|
3128
3126
|
notesProcessed: entries.length,
|
|
3129
3127
|
notesModified: 0,
|
|
3128
|
+
themeGroups,
|
|
3129
|
+
relationshipClusters,
|
|
3130
3130
|
};
|
|
3131
3131
|
return { content: [{ type: "text", text: lines.join("\n") }], structuredContent };
|
|
3132
3132
|
}
|