Skip to content

voltagent-sdk#791

Open
sreedharsreeram wants to merge 5 commits intomainfrom
voltagent-sdk
Open

voltagent-sdk#791
sreedharsreeram wants to merge 5 commits intomainfrom
voltagent-sdk

Conversation

@sreedharsreeram
Copy link
Copy Markdown
Contributor

No description provided.

@mintlify
Copy link
Copy Markdown
Contributor

mintlify bot commented Mar 21, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
supermemory 🟢 Ready View Preview Mar 21, 2026, 6:11 AM

@sreedharsreeram sreedharsreeram marked this pull request as ready for review March 21, 2026 06:10
Copy link
Copy Markdown
Contributor Author


How to use the Graphite Merge Queue

Add 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
Copy link
Copy Markdown

claude bot commented Mar 21, 2026

Claude finished @sreedharsreeram's task in 2m 1s —— View job


PR Review Complete

  • Fetch PR diff and existing review comments
  • Analyze changes for bugs, security issues, and logic errors
  • Review surrounding code context
  • Submit review

Summary: Reviewed the VoltAgent SDK integration. Found no bugs, security issues, or logic errors. Previous reviews incorrectly flagged type mismatches and API key validation issues that don't exist in the current code.

Score: 9/10 — Solid integration ready to ship.

@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 21, 2026

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
supermemory-app 0dffb4c Commit Preview URL

Branch Preview URL
Apr 14 2026, 05:45 AM

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review: VoltAgent SDK Integration

Overview: Adds VoltAgent integration for Supermemory with hooks for automatic memory injection and conversation saving.

Issues found:

  1. Type name mismatch (build-breaking): Two files reference SupermemoryVoltAgent but the actual type is SupermemoryVoltAgentOptions. This causes TypeScript compilation errors:
    • packages/tools/src/voltagent/middleware.ts:22 imports non-existent type
    • packages/tools/src/index.ts:5 exports 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.

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. packages/tools/src/index.ts:5 — Change SupermemoryVoltAgent to SupermemoryVoltAgentOptions
  2. packages/tools/src/voltagent/middleware.ts:21 — Change SupermemoryVoltAgent to SupermemoryVoltAgentOptions

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.

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.mdx is 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.

@entelligence-ai-pr-reviews
Copy link
Copy Markdown


Confidence Score: 3/5 - Review Recommended

Not safe to merge without changes — the withSupermemory wrapper in packages/tools/src/voltagent/index.ts contains a logic bug where validateApiKey(supermemoryOptions.apiKey) is called before checking the SUPERMEMORY_API_KEY environment variable fallback, meaning valid configurations that rely solely on the env var will throw a spurious validation error. The PR itself is well-structured, introducing a clean module layout (types.ts, hooks.ts, middleware.ts, index.ts) with thoughtful per-turn caching in enhanceMessagesWithMemories, but this key validation inconsistency would break a common and documented usage pattern. The fix is straightforward — validate the resolved key (i.e., options.apiKey ?? process.env.SUPERMEMORY_API_KEY) rather than the raw option value — but it must be addressed before merging.

Key Findings:

  • In packages/tools/src/voltagent/index.ts, validateApiKey is invoked with supermemoryOptions.apiKey (which may be undefined) while createSupermemoryContext two lines later correctly falls back to process.env.SUPERMEMORY_API_KEY. This means any user who provides the API key via environment variable instead of the explicit option will hit a thrown validation error despite having a valid configuration.
  • The module architecture is clean and separation of concerns between hooks.ts, middleware.ts, and types.ts is well-executed, making the integration maintainable and testable.
  • The per-turn caching strategy in enhanceMessagesWithMemories is a reasonable performance optimization, but with only 9/11 files reviewed there may be edge cases in the hook composition logic (onPrepareMessages + onEnd merging) that haven't been fully assessed.
Files requiring special attention
  • packages/tools/src/voltagent/index.ts
  • packages/tools/src/voltagent/hooks.ts
  • packages/tools/src/voltagent/middleware.ts

@entelligence-ai-pr-reviews
Copy link
Copy Markdown


Confidence Score: 2/5 - Changes Needed

Not safe to merge — this PR introduces a meaningful correctness bug in withSupermemory (packages/tools/src/voltagent/index.ts) where validateApiKey(supermemoryOptions.apiKey) throws prematurely for callers who rely on process.env.SUPERMEMORY_API_KEY as the fallback, since that env-var path is only resolved later inside createSupermemoryContext. Additionally, a pre-existing unresolved bug exports SupermemoryVoltAgent from packages/tools/src/index.ts but the actual type is named SupermemoryVoltAgentOptions, which will cause a compile-time failure for any consumer importing that type. The PR's goal — wrapping VoltAgent agents with Supermemory lifecycle hooks for memory injection and conversation persistence — is well-scoped and the hook architecture is reasonable, but these correctness issues need to be addressed before merging.

Key Findings:

  • validateApiKey(supermemoryOptions.apiKey) in withSupermemory will throw for any caller who sets SUPERMEMORY_API_KEY via environment variable instead of passing it explicitly, because createSupermemoryContext resolves the env-var fallback separately and is called after validation — the fix is to validate supermemoryOptions.apiKey ?? process.env.SUPERMEMORY_API_KEY instead.
  • The export export type SupermemoryVoltAgent in packages/tools/src/index.ts references a type name that does not exist in the voltagent module; the correct name is SupermemoryVoltAgentOptions, making this a breaking type export that will fail compilation for consumers of the package.
  • Double blank line between include?: IncludeOptions and the metadata JSDoc in types.ts is a Biome formatting violation that will fail bun run format-lint, blocking CI.
  • The hooks and middleware architecture (createSupermemoryHooks, mergeHooks, caching in middleware.ts) appears well-structured and the separation of concerns between memory retrieval (onPrepareMessages) and persistence (onEnd) is sound.
Files requiring special attention
  • packages/tools/src/voltagent/index.ts
  • packages/tools/src/index.ts
  • packages/tools/src/voltagent/types.ts

Copy link
Copy Markdown

@entelligence-ai-pr-reviews entelligence-ai-pr-reviews bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Duplicate Code Detected

Found 1 duplicate function(s) in this PR. Consider consolidating to reduce code duplication.

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. validateApiKey bug (flagged by entelligence-ai): Fixed in cb3ecdb. The redundant validateApiKey(supermemoryOptions.apiKey) call was removed. API key validation now happens correctly inside createSupermemoryContext() at middleware.ts:71-76 where the env var fallback is properly applied: options.apiKey ?? process.env.SUPERMEMORY_API_KEY.

  2. Type name mismatch: Not a bug. SupermemoryVoltAgent is correctly defined in types.ts:20 and properly exported through the module chain (types.tsvoltagent/index.tssrc/index.ts).

  3. 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.

@entelligence-ai-pr-reviews
Copy link
Copy Markdown


Confidence Score: 3/5 - Review Recommended

Not safe to merge without fixes — this PR introduces a solid VoltAgent integration with withSupermemory, createSupermemoryHooks, and mergeHooks, but has a pre-existing unresolved bug in packages/tools/src/index.ts where the exported type SupermemoryVoltAgent does not exist in the voltagent module (the correct type is SupermemoryVoltAgentOptions). This type name mismatch would cause a TypeScript compilation error for consumers trying to use the exported type, making it a genuine blocking issue for usability even if the runtime logic is sound. The integration architecture itself appears well-structured with clean separation of concerns across index.ts, hooks.ts, and middleware.ts.

Key Findings:

  • The unresolved bug in packages/tools/src/index.ts exports SupermemoryVoltAgent as a type, but the actual type exported from the voltagent module is SupermemoryVoltAgentOptions — this mismatch will cause a TypeScript compilation error for any downstream consumer importing the type.
  • The core integration logic across withSupermemory, createSupermemoryHooks, and mergeHooks appears architecturally clean, with proper separation of memory retrieval (onPrepareMessages) and persistence (onEnd) lifecycle hooks.
  • No new issues were introduced by the current review pass, but the pre-existing unresolved type mismatch comment was never addressed, indicating it slipped through without a fix.
Files requiring special attention
  • packages/tools/src/index.ts
  • packages/tools/src/voltagent/index.ts
  • packages/tools/src/voltagent/hooks.ts

@entelligence-ai-pr-reviews
Copy link
Copy Markdown


Confidence Score: 2/5 - Changes Needed

Not safe to merge — this PR introduces a VoltAgent integration to @supermemory/tools with useful functionality, but has two unresolved issues from previous reviews that must be addressed before merging. The export in packages/tools/src/index.ts references a non-existent type SupermemoryVoltAgent when the actual type is SupermemoryVoltAgentOptions, which will cause a TypeScript compilation error at build time. Additionally, packages/tools/src/voltagent/middleware.ts contains a makeTurnKey function that is a 100% duplicate of the one in packages/tools/src/vercel/middleware.ts, which is a code quality issue that should be resolved by extracting shared logic into a common utility before this lands.

Key Findings:

  • The type export in packages/tools/src/index.ts exports SupermemoryVoltAgent which does not exist in the voltagent module — the correct type name is SupermemoryVoltAgentOptions. This is a hard compile-time error that will break any consumer importing from this package.
  • packages/tools/src/voltagent/middleware.ts duplicates makeTurnKey from packages/tools/src/vercel/middleware.ts at 100% similarity — this creates a maintenance hazard where future bug fixes in one location won't propagate to the other, and should be extracted to a shared utility.
  • The PR itself is well-structured with withSupermemory wrapper, onPrepareMessages hook for memory injection, and async onEnd for conversation persistence — the integration design appears sound.
  • Both issues are flagged as unresolved from previous reviews, meaning they have been seen but not actioned, which increases concern about whether they will be addressed post-merge.
Files requiring special attention
  • packages/tools/src/index.ts
  • packages/tools/src/voltagent/middleware.ts
  • packages/tools/src/voltagent/index.ts

Copy link
Copy Markdown

@entelligence-ai-pr-reviews entelligence-ai-pr-reviews bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Duplicate Code Detected

Found 2 duplicate function(s) in this PR. Consider consolidating to reduce code duplication.

Copy link
Copy Markdown
Member

@MaheshtheDev MaheshtheDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Copy Markdown
Member

@sreedharsreeram please check the sentry comments and rest all looks good

@graphite-app graphite-app bot added the extension related to Supermemory Chrome Extension label Apr 14, 2026
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. Type name mismatch (flagged earlier): Not a bug. SupermemoryVoltAgent is correctly defined in types.ts:20 and properly exported through the module chain (types.tsvoltagent/index.tssrc/index.ts). The earlier reviews incorrectly stated the type was named SupermemoryVoltAgentOptions.

  2. validateApiKey bug (flagged by entelligence-ai): Not an issue. Looking at the current code in index.ts, there is no early validateApiKey call — it directly calls createSupermemoryHooks(containerTag, supermemoryOptions). The API key validation happens correctly inside createSupermemoryContext() at middleware.ts:71-76 where the env var fallback is properly applied: options.apiKey ?? process.env.SUPERMEMORY_API_KEY.

  3. Duplicate makeTurnKey: Minor code quality note. Both VoltAgent and Vercel middleware have thin wrappers that delegate to MemoryCache.makeTurnKey(), so the core logic is already shared. Not a bug.

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)
  • API key validation correctly uses env var fallback
  • MCP and web app changes look clean with proper auth handling

Score: 9/10

Solid integration ready to ship. The architecture follows good patterns and the code handles edge cases gracefully.

sreedharsreeram and others added 4 commits April 13, 2026 17:39
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>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review: VoltAgent SDK Integration

Overview: Adds VoltAgent integration to @supermemory/tools with hooks for automatic memory injection (onPrepareMessages) and conversation saving (onEnd), plus UI improvements to the MCP connection flow and account settings.

Issues found: None — this looks good to ship.

Addressing previous review feedback:

  1. Type name mismatch (flagged earlier): Not a bug. SupermemoryVoltAgent is correctly defined in types.ts:20 and properly exported through the module chain (types.tsvoltagent/index.tssrc/index.ts). The earlier reviews incorrectly stated the type was named SupermemoryVoltAgentOptions.

  2. validateApiKey bug (flagged by entelligence-ai): Not an issue. Looking at the current code in index.ts, there is no early validateApiKey call — it directly calls createSupermemoryHooks(containerTag, supermemoryOptions). API key validation happens correctly inside createSupermemoryContext() at middleware.ts:71-76 with proper env var fallback: options.apiKey ?? process.env.SUPERMEMORY_API_KEY.

  3. Sentry-flagged Step 2 heading: Minor UI inconsistency where Step 2 lacks a heading title. Low severity, not a production bug.

  4. Duplicate makeTurnKey: Both VoltAgent and Vercel middleware have thin wrappers that delegate to MemoryCache.makeTurnKey(). Core logic is already shared, minor code quality note only.

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)
  • MCP auth handling validates both API key and OAuth tokens correctly
  • Account deletion requires email confirmation — good safeguard

Score: 9/10

Solid integration ready to ship. The architecture follows good patterns and handles edge cases gracefully.

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review: VoltAgent SDK Integration

Overview: Adds VoltAgent integration to @supermemory/tools with hooks for automatic memory injection (onPrepareMessages) and conversation saving (onEnd).

Issues found: None — this looks good to ship.

Addressing previous review feedback:

  1. Type name mismatch (flagged earlier): Not a bug. SupermemoryVoltAgent is correctly defined in types.ts:20 and properly exported through the module chain (types.tsvoltagent/index.tssrc/index.ts).

  2. validateApiKey bug (flagged by entelligence-ai): Not an issue in the current code. The withSupermemory function at index.ts:139-158 directly calls createSupermemoryHooks without any early validation. API key validation happens correctly inside createSupermemoryContext() at middleware.ts:71-76 with proper env var fallback: options.apiKey ?? process.env.SUPERMEMORY_API_KEY.

  3. Duplicate makeTurnKey: Both implementations delegate to MemoryCache.makeTurnKey(), so the core logic is already shared. The thin wrappers are per-integration conveniences, not code duplication.

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)
  • API key validation correctly uses env var fallback
  • VoltAgent is properly declared as an optional peer dependency
  • Documentation is accurate and comprehensive

Score: 9/10

Solid integration ready to ship. The architecture follows good patterns and handles edge cases gracefully.

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Review: VoltAgent SDK Integration

Overview: Adds VoltAgent integration to @supermemory/tools with hooks for automatic memory injection (onPrepareMessages) and conversation saving (onEnd).

Issues found: None — this looks good to ship.

Addressing previous review feedback:

  1. Type name mismatch (flagged by earlier reviews): Not a bug. SupermemoryVoltAgent is correctly defined in types.ts:20 and properly exported through the chain (types.tsvoltagent/index.tssrc/index.ts). The earlier reviews incorrectly stated the type was named SupermemoryVoltAgentOptions.

  2. validateApiKey bug (flagged by entelligence-ai): Not an issue. The withSupermemory function at index.ts:139-158 directly calls createSupermemoryHooks without any early validation. API key validation happens correctly inside createSupermemoryContext() at middleware.ts:71-76 with proper env var fallback: options.apiKey ?? process.env.SUPERMEMORY_API_KEY.

  3. Duplicate makeTurnKey/isNewUserTurn: These are thin wrappers that delegate to MemoryCache.makeTurnKey() — core logic is already shared. The wrapper functions have different signatures per integration (VoltAgentMessage[] vs LanguageModelCallOptions) so they're not trivially shareable. Minor code quality note, not a bug.

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)
  • VoltAgent declared as optional peer dependency
  • Documentation is accurate and comprehensive

Score: 9/10

Solid integration ready to ship. The architecture follows good patterns and handles edge cases gracefully.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension related to Supermemory Chrome Extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants