diff options
| author | Shoubhit Dash <[email protected]> | 2026-01-30 21:08:11 +0530 |
|---|---|---|
| committer | Dhravya Shah <[email protected]> | 2026-01-30 21:09:12 -0700 |
| commit | 05ecc18e4f0eef6d3b88b0e459b43ad9f13ce8cf (patch) | |
| tree | 84d930a7fccccff3a6d54295ee8ecec8d0acedb0 /packages/tools/src/claude-memory.ts | |
| parent | done (diff) | |
| download | archived-supermemory-01-30-mastra_integration.tar.xz archived-supermemory-01-30-mastra_integration.zip | |
format and lint01-30-mastra_integration
Diffstat (limited to 'packages/tools/src/claude-memory.ts')
| -rw-r--r-- | packages/tools/src/claude-memory.ts | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/packages/tools/src/claude-memory.ts b/packages/tools/src/claude-memory.ts index 08d49e63..b65c8ff9 100644 --- a/packages/tools/src/claude-memory.ts +++ b/packages/tools/src/claude-memory.ts @@ -57,15 +57,6 @@ export class ClaudeMemoryTool { .replace(/\./g, "_") // Replace . with _ } - /** - * Convert customId back to file path - * Note: This is lossy since we can't distinguish _ from . or / - * We rely on metadata.file_path for accurate path reconstruction - */ - private customIdToPath(customId: string): string { - return "/" + customId.replace(/_/g, "/") - } - constructor(apiKey: string, config?: ClaudeMemoryConfig) { this.client = new Supermemory({ apiKey, @@ -182,7 +173,7 @@ export class ClaudeMemoryTool { // If path ends with / or is exactly /memories, it's a directory listing request if (path.endsWith("/") || path === "/memories") { // Normalize path to end with / - const dirPath = path.endsWith("/") ? path : path + "/" + const dirPath = path.endsWith("/") ? path : `${path}/` return await this.listDirectory(dirPath) } @@ -227,7 +218,7 @@ export class ClaudeMemoryTool { const slashIndex = relativePath.indexOf("/") if (slashIndex > 0) { // It's a subdirectory - dirs.add(relativePath.substring(0, slashIndex) + "/") + dirs.add(`${relativePath.substring(0, slashIndex)}/`) } else if (relativePath !== "") { // It's a file in this directory files.push(relativePath) @@ -335,7 +326,7 @@ export class ClaudeMemoryTool { try { const normalizedId = this.normalizePathToCustomId(filePath) - const response = await this.client.add({ + const _response = await this.client.add({ content: fileText, customId: normalizedId, containerTags: this.containerTags, @@ -394,7 +385,7 @@ export class ClaudeMemoryTool { // Update the document const normalizedId = this.normalizePathToCustomId(filePath) - const updateResponse = await this.client.add({ + const _updateResponse = await this.client.add({ content: newContent, customId: normalizedId, containerTags: this.containerTags, |