Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
How to use the Graphite Merge QueueAdd the label Main to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
|
Claude finished @sreedharsreeram's task in 1m 26s —— View job Review Complete: VoltAgent SDK Integration
Summary: No bugs or security issues found. The previously flagged issues have been fixed:
Score: 9/10 — Clean integration, ready to ship. |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
supermemory-app | 97bed1a | Commit Preview URL Branch Preview URL |
Apr 02 2026, 11:52 PM |
There was a problem hiding this comment.
PR Review: VoltAgent SDK Integration
Overview: Adds VoltAgent integration for Supermemory with hooks for automatic memory injection and conversation saving.
Issues found:
- Type name mismatch (build-breaking): Two files reference
SupermemoryVoltAgentbut the actual type isSupermemoryVoltAgentOptions. This causes TypeScript compilation errors:packages/tools/src/voltagent/middleware.ts:22imports non-existent typepackages/tools/src/index.ts:5exports non-existent type
What looks good:
- Clean hook architecture with proper async chaining in
mergeHooks() - Good defensive error handling - failures gracefully return original messages
- API key validation happens early at context creation
- Memory caching strategy with turn-based keys is sensible
- Fire-and-forget conversation saving with proper error logging
Score: 7/10
The code architecture is solid and follows existing patterns well. However, the type mismatch bug will prevent the package from building, so this needs to be fixed before merge.
e1b827a to
bffe1e1
Compare
There was a problem hiding this comment.
PR Review: VoltAgent SDK Integration (Re-review after sync)
Overview: Adds VoltAgent integration for Supermemory with hooks for automatic memory injection and conversation saving.
Issues found:
The type name mismatch bugs identified in the previous review are still present and cause TypeScript compilation to fail:
src/index.ts(5,15): error TS2305: Module '"./voltagent"' has no exported member 'SupermemoryVoltAgent'.
src/voltagent/middleware.ts(21,15): error TS2305: Module '"./types"' has no exported member 'SupermemoryVoltAgent'.
Fixes needed:
packages/tools/src/index.ts:5— ChangeSupermemoryVoltAgenttoSupermemoryVoltAgentOptionspackages/tools/src/voltagent/middleware.ts:21— ChangeSupermemoryVoltAgenttoSupermemoryVoltAgentOptions
The latest commit (bffe1e1) fixed Biome lint errors but did not address these type export issues.
What looks good:
- Clean hook architecture with proper async chaining in
mergeHooks() - Good defensive error handling - failures gracefully return original messages
- API key validation happens early at context creation
- Memory caching strategy with turn-based keys is sensible
- Fire-and-forget conversation saving with proper error logging
Score: 6/10
The code architecture is solid, but the package will not build due to the type mismatch errors. These must be fixed before merge.
bffe1e1 to
d641e73
Compare
There was a problem hiding this comment.
PR Review: VoltAgent SDK Integration (Re-review)
Overview: Adds VoltAgent integration for Supermemory with hooks for automatic memory injection and conversation saving.
Correction to previous reviews: The type mismatch bugs identified earlier do not exist. SupermemoryVoltAgent is correctly defined in types.ts:20 and properly exported through the module chain. The previous reviews incorrectly stated the type was named SupermemoryVoltAgentOptions.
Issues found: None that would cause production incidents.
What looks good:
- Clean hook architecture with proper async chaining in
mergeHooks() - Good defensive error handling - failures gracefully return original messages
- API key validation happens early at context creation
- Memory caching strategy with turn-based keys is sensible
- Fire-and-forget conversation saving with proper error logging
- Well-documented code with JSDoc comments and usage examples
- Documentation in
voltagent.mdxis accurate and comprehensive
Note: There are pre-existing TypeScript errors in the tools package (in ai-sdk.ts, openai/tools.ts, shared/cache.ts, and test files) that are unrelated to this PR. The VoltAgent-specific code compiles correctly.
Score: 9/10
This is a solid integration following good patterns. Ready to ship.
Replace explicit `any` types with proper type annotations and fix non-null assertion by using proper null checking. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
d641e73 to
9733adc
Compare
| validateApiKey(supermemoryOptions.apiKey) | ||
|
|
There was a problem hiding this comment.
Correctness: validateApiKey(supermemoryOptions.apiKey) is called with only the explicit option value, but createSupermemoryContext (called two lines later) uses options.apiKey ?? process.env.SUPERMEMORY_API_KEY. If options.apiKey is undefined and the key is set via the env var, validateApiKey will throw even though the downstream context creation would succeed — breaking the documented fallback behavior.
🤖 AI Agent Prompt for Cursor/Windsurf
📋 Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue
In `packages/tools/src/voltagent/index.ts` at line 143-144, `validateApiKey(supermemoryOptions.apiKey)` is called with only the explicit `apiKey` option. However, `createSupermemoryContext` (in `middleware.ts`) resolves the key as `options.apiKey ?? process.env.SUPERMEMORY_API_KEY`. This means that when a user relies on the `SUPERMEMORY_API_KEY` environment variable instead of passing `apiKey` explicitly, `validateApiKey(undefined)` will throw, even though the function would succeed if allowed to continue. Fix by changing line 144 to: `validateApiKey(supermemoryOptions.apiKey ?? process.env.SUPERMEMORY_API_KEY)` so the validation mirrors the actual resolution logic used downstream.
Confidence Score: 3/5 - Review RecommendedNot safe to merge without changes — the Key Findings:
Files requiring special attention
|
| validateApiKey(supermemoryOptions.apiKey) | ||
|
|
There was a problem hiding this comment.
Correctness: validateApiKey(supermemoryOptions.apiKey) is called with just the options value, but createSupermemoryContext (invoked a few lines later) also accepts process.env.SUPERMEMORY_API_KEY as a fallback — so this early validation will throw for any caller who relies on the env var without passing apiKey explicitly, even though the env var would have made it valid.
🤖 AI Agent Prompt for Cursor/Windsurf
📋 Copy this prompt to your AI coding assistant (Cursor, Windsurf, etc.) to get help fixing this issue
In `packages/tools/src/voltagent/index.ts`, around line 143-144, the call `validateApiKey(supermemoryOptions.apiKey)` will throw when `apiKey` is not explicitly provided in `options`, even when `SUPERMEMORY_API_KEY` is set in the environment. This is because `validateApiKey` only sees the raw (possibly undefined) options value, while `createSupermemoryContext` (called a few lines later) correctly handles the env var fallback via `options.apiKey ?? process.env.SUPERMEMORY_API_KEY`. Remove the early `validateApiKey(supermemoryOptions.apiKey)` call entirely — `createSupermemoryContext` already throws with a clear message when neither source provides a key.
Confidence Score: 2/5 - Changes NeededNot safe to merge — this PR introduces a meaningful correctness bug in Key Findings:
Files requiring special attention
|
| const makeTurnKey = ( | ||
| ctx: SupermemoryMiddlewareContext, | ||
| userMessage: string, | ||
| ): string => { | ||
| return MemoryCache.makeTurnKey( | ||
| ctx.containerTag, | ||
| ctx.conversationId, | ||
| ctx.mode, | ||
| userMessage, | ||
| ) | ||
| } |
There was a problem hiding this comment.
Duplicate Code:
This function makeTurnKey duplicates existing code.
📍 Original Location:
packages/tools/src/vercel/middleware.ts:252-262
Function: makeTurnKey
💡 Recommendation:
Extract this function to a shared utility module (e.g., /home/user/repo/packages/tools/src/shared/cache.ts or create a new shared/middleware-utils.ts). Both voltagent and vercel middleware files can import this shared function instead of duplicating it. The function is already using the shared MemoryCache class, so it's a natural fit to move it alongside that class or in a shared middleware utilities file. This would eliminate the duplication and ensure any future changes to turn key generation logic are consistent across all integrations.
Consider importing and reusing the existing function instead of duplicating the logic.
914aa56 to
cb3ecdb
Compare
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
PR Review: VoltAgent SDK Integration
Overview: Adds VoltAgent integration with Supermemory hooks for automatic memory injection (onPrepareMessages) and conversation saving (onEnd).
Issues found: None — this looks good to ship.
Addressing previous review feedback:
-
validateApiKey bug (flagged by entelligence-ai): Fixed in
cb3ecdb. The redundantvalidateApiKey(supermemoryOptions.apiKey)call was removed. API key validation now happens correctly insidecreateSupermemoryContext()atmiddleware.ts:71-76where the env var fallback is properly applied:options.apiKey ?? process.env.SUPERMEMORY_API_KEY. -
Type name mismatch: Not a bug.
SupermemoryVoltAgentis correctly defined intypes.ts:20and properly exported through the module chain (types.ts→voltagent/index.ts→src/index.ts). -
Double blank line formatting: Fixed — only single blank lines now.
What looks good:
- Clean separation of concerns:
types.ts,hooks.ts,middleware.ts,index.ts - Proper async chaining in
mergeHooks()for composing with existing hooks - Defensive error handling — failures return original messages instead of crashing
- Memory caching with turn-based keys avoids redundant API calls
- Fire-and-forget conversation saving with proper error logging
- Supports both UIMessage format (
parts) and standard format (content)
Score: 9/10
Solid integration ready to ship.
Confidence Score: 3/5 - Review RecommendedNot safe to merge without fixes — this PR introduces a solid VoltAgent integration with Key Findings:
Files requiring special attention
|
Confidence Score: 2/5 - Changes NeededNot safe to merge — this PR introduces a VoltAgent integration to Key Findings:
Files requiring special attention
|
| const makeTurnKey = ( | ||
| ctx: SupermemoryMiddlewareContext, | ||
| userMessage: string, | ||
| ): string => { | ||
| return MemoryCache.makeTurnKey( | ||
| ctx.containerTag, | ||
| ctx.conversationId, | ||
| ctx.mode, | ||
| userMessage, | ||
| ) | ||
| } |
There was a problem hiding this comment.
Duplicate Code:
This function makeTurnKey duplicates existing code.
📍 Original Location:
packages/tools/src/vercel/middleware.ts:252-262
Function: makeTurnKey
💡 Recommendation:
Remove both makeTurnKey wrapper functions entirely. Replace all calls with direct calls to MemoryCache.makeTurnKey(ctx.containerTag, ctx.conversationId, ctx.mode, userMessage). This eliminates unnecessary indirection and ~10 lines of duplicate code across both files.
Consider importing and reusing the existing function instead of duplicating the logic.
| const isNewUserTurn = (messages: VoltAgentMessage[]): boolean => { | ||
| const lastMessage = messages.at(-1) | ||
| return lastMessage?.role === "user" | ||
| } |
There was a problem hiding this comment.
Duplicate Code:
This function isNewUserTurn duplicates existing code.
📍 Original Location:
packages/tools/src/vercel/middleware.ts:267-270
Function: isNewUserTurn
💡 Recommendation:
Extract a shared utility function isLastMessageFromUser(messages: Array<{role: string}>): boolean in /home/user/repo/packages/tools/src/shared/memory-client.ts. Both implementations should be refactored to call this shared function, with VoltAgent passing messages directly and Vercel passing params.prompt. This consolidates ~8 lines of duplicate logic.
Consider importing and reusing the existing function instead of duplicating the logic.

No description provided.