zilmate 1.7.8 → 1.8.0
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/.agents/skills/agent-browser/SKILL.md +55 -0
- package/.agents/skills/agentmail/SKILL.md +282 -0
- package/.agents/skills/agentmail/references/webhooks.md +220 -0
- package/.agents/skills/agentmail/references/websockets.md +263 -0
- package/.agents/skills/ai-elements/SKILL.md +160 -0
- package/.agents/skills/ai-elements/references/agent.md +134 -0
- package/.agents/skills/ai-elements/references/artifact.md +84 -0
- package/.agents/skills/ai-elements/references/attachments.md +190 -0
- package/.agents/skills/ai-elements/references/audio-player.md +134 -0
- package/.agents/skills/ai-elements/references/canvas.md +34 -0
- package/.agents/skills/ai-elements/references/chain-of-thought.md +81 -0
- package/.agents/skills/ai-elements/references/checkpoint.md +183 -0
- package/.agents/skills/ai-elements/references/code-block.md +170 -0
- package/.agents/skills/ai-elements/references/commit.md +177 -0
- package/.agents/skills/ai-elements/references/confirmation.md +262 -0
- package/.agents/skills/ai-elements/references/connection.md +34 -0
- package/.agents/skills/ai-elements/references/context.md +126 -0
- package/.agents/skills/ai-elements/references/controls.md +32 -0
- package/.agents/skills/ai-elements/references/conversation.md +224 -0
- package/.agents/skills/ai-elements/references/edge.md +52 -0
- package/.agents/skills/ai-elements/references/environment-variables.md +102 -0
- package/.agents/skills/ai-elements/references/file-tree.md +72 -0
- package/.agents/skills/ai-elements/references/image.md +146 -0
- package/.agents/skills/ai-elements/references/inline-citation.md +299 -0
- package/.agents/skills/ai-elements/references/jsx-preview.md +104 -0
- package/.agents/skills/ai-elements/references/message.md +237 -0
- package/.agents/skills/ai-elements/references/mic-selector.md +189 -0
- package/.agents/skills/ai-elements/references/model-selector.md +112 -0
- package/.agents/skills/ai-elements/references/node.md +73 -0
- package/.agents/skills/ai-elements/references/open-in-chat.md +67 -0
- package/.agents/skills/ai-elements/references/package-info.md +95 -0
- package/.agents/skills/ai-elements/references/panel.md +33 -0
- package/.agents/skills/ai-elements/references/persona.md +166 -0
- package/.agents/skills/ai-elements/references/plan.md +79 -0
- package/.agents/skills/ai-elements/references/prompt-input.md +579 -0
- package/.agents/skills/ai-elements/references/queue.md +172 -0
- package/.agents/skills/ai-elements/references/reasoning.md +238 -0
- package/.agents/skills/ai-elements/references/sandbox.md +129 -0
- package/.agents/skills/ai-elements/references/schema-display.md +102 -0
- package/.agents/skills/ai-elements/references/shimmer.md +48 -0
- package/.agents/skills/ai-elements/references/snippet.md +64 -0
- package/.agents/skills/ai-elements/references/sources.md +209 -0
- package/.agents/skills/ai-elements/references/speech-input.md +163 -0
- package/.agents/skills/ai-elements/references/stack-trace.md +224 -0
- package/.agents/skills/ai-elements/references/suggestion.md +124 -0
- package/.agents/skills/ai-elements/references/task.md +222 -0
- package/.agents/skills/ai-elements/references/terminal.md +103 -0
- package/.agents/skills/ai-elements/references/test-results.md +157 -0
- package/.agents/skills/ai-elements/references/tool.md +285 -0
- package/.agents/skills/ai-elements/references/toolbar.md +32 -0
- package/.agents/skills/ai-elements/references/transcription.md +120 -0
- package/.agents/skills/ai-elements/references/voice-selector.md +241 -0
- package/.agents/skills/ai-elements/references/web-preview.md +200 -0
- package/.agents/skills/ai-elements/scripts/agent.tsx +61 -0
- package/.agents/skills/ai-elements/scripts/artifact.tsx +127 -0
- package/.agents/skills/ai-elements/scripts/attachments-inline.tsx +128 -0
- package/.agents/skills/ai-elements/scripts/attachments-list.tsx +95 -0
- package/.agents/skills/ai-elements/scripts/attachments.tsx +85 -0
- package/.agents/skills/ai-elements/scripts/audio-player-remote.tsx +35 -0
- package/.agents/skills/ai-elements/scripts/audio-player.tsx +68 -0
- package/.agents/skills/ai-elements/scripts/chain-of-thought.tsx +82 -0
- package/.agents/skills/ai-elements/scripts/checkpoint.tsx +110 -0
- package/.agents/skills/ai-elements/scripts/code-block-dark.tsx +46 -0
- package/.agents/skills/ai-elements/scripts/code-block.tsx +120 -0
- package/.agents/skills/ai-elements/scripts/commit.tsx +94 -0
- package/.agents/skills/ai-elements/scripts/confirmation-accepted.tsx +40 -0
- package/.agents/skills/ai-elements/scripts/confirmation-rejected.tsx +40 -0
- package/.agents/skills/ai-elements/scripts/confirmation-request.tsx +54 -0
- package/.agents/skills/ai-elements/scripts/confirmation.tsx +55 -0
- package/.agents/skills/ai-elements/scripts/context.tsx +45 -0
- package/.agents/skills/ai-elements/scripts/conversation.tsx +177 -0
- package/.agents/skills/ai-elements/scripts/environment-variables.tsx +62 -0
- package/.agents/skills/ai-elements/scripts/file-tree-basic.tsx +18 -0
- package/.agents/skills/ai-elements/scripts/file-tree-expanded.tsx +21 -0
- package/.agents/skills/ai-elements/scripts/file-tree-selection.tsx +24 -0
- package/.agents/skills/ai-elements/scripts/file-tree.tsx +42 -0
- package/.agents/skills/ai-elements/scripts/image.tsx +20 -0
- package/.agents/skills/ai-elements/scripts/inline-citation.tsx +97 -0
- package/.agents/skills/ai-elements/scripts/jsx-preview.tsx +104 -0
- package/.agents/skills/ai-elements/scripts/message.tsx +365 -0
- package/.agents/skills/ai-elements/scripts/mic-selector.tsx +49 -0
- package/.agents/skills/ai-elements/scripts/model-selector.tsx +365 -0
- package/.agents/skills/ai-elements/scripts/open-in-chat.tsx +33 -0
- package/.agents/skills/ai-elements/scripts/package-info.tsx +51 -0
- package/.agents/skills/ai-elements/scripts/persona-command.tsx +110 -0
- package/.agents/skills/ai-elements/scripts/persona-glint.tsx +110 -0
- package/.agents/skills/ai-elements/scripts/persona-halo.tsx +110 -0
- package/.agents/skills/ai-elements/scripts/persona-mana.tsx +110 -0
- package/.agents/skills/ai-elements/scripts/persona-obsidian.tsx +110 -0
- package/.agents/skills/ai-elements/scripts/persona-opal.tsx +110 -0
- package/.agents/skills/ai-elements/scripts/plan.tsx +65 -0
- package/.agents/skills/ai-elements/scripts/prompt-input-cursor.tsx +502 -0
- package/.agents/skills/ai-elements/scripts/prompt-input-tooltip.tsx +44 -0
- package/.agents/skills/ai-elements/scripts/prompt-input.tsx +267 -0
- package/.agents/skills/ai-elements/scripts/queue-prompt-input.tsx +394 -0
- package/.agents/skills/ai-elements/scripts/queue.tsx +295 -0
- package/.agents/skills/ai-elements/scripts/reasoning.tsx +71 -0
- package/.agents/skills/ai-elements/scripts/sandbox.tsx +178 -0
- package/.agents/skills/ai-elements/scripts/schema-display-basic.tsx +9 -0
- package/.agents/skills/ai-elements/scripts/schema-display-body.tsx +20 -0
- package/.agents/skills/ai-elements/scripts/schema-display-nested.tsx +23 -0
- package/.agents/skills/ai-elements/scripts/schema-display-params.tsx +16 -0
- package/.agents/skills/ai-elements/scripts/schema-display.tsx +110 -0
- package/.agents/skills/ai-elements/scripts/shimmer-duration.tsx +31 -0
- package/.agents/skills/ai-elements/scripts/shimmer-elements.tsx +43 -0
- package/.agents/skills/ai-elements/scripts/shimmer.tsx +17 -0
- package/.agents/skills/ai-elements/scripts/snippet-plain.tsx +19 -0
- package/.agents/skills/ai-elements/scripts/snippet.tsx +25 -0
- package/.agents/skills/ai-elements/scripts/sources-custom.tsx +39 -0
- package/.agents/skills/ai-elements/scripts/sources.tsx +32 -0
- package/.agents/skills/ai-elements/scripts/speech-input.tsx +84 -0
- package/.agents/skills/ai-elements/scripts/stack-trace-collapsed.tsx +39 -0
- package/.agents/skills/ai-elements/scripts/stack-trace-no-internal.tsx +41 -0
- package/.agents/skills/ai-elements/scripts/stack-trace.tsx +58 -0
- package/.agents/skills/ai-elements/scripts/suggestion-input.tsx +144 -0
- package/.agents/skills/ai-elements/scripts/suggestion.tsx +32 -0
- package/.agents/skills/ai-elements/scripts/task.tsx +59 -0
- package/.agents/skills/ai-elements/scripts/terminal-basic.tsx +7 -0
- package/.agents/skills/ai-elements/scripts/terminal-clear.tsx +19 -0
- package/.agents/skills/ai-elements/scripts/terminal-streaming.tsx +38 -0
- package/.agents/skills/ai-elements/scripts/terminal.tsx +82 -0
- package/.agents/skills/ai-elements/scripts/test-results-basic.tsx +27 -0
- package/.agents/skills/ai-elements/scripts/test-results-errors.tsx +51 -0
- package/.agents/skills/ai-elements/scripts/test-results-suites.tsx +40 -0
- package/.agents/skills/ai-elements/scripts/test-results.tsx +102 -0
- package/.agents/skills/ai-elements/scripts/tool-input-available.tsx +31 -0
- package/.agents/skills/ai-elements/scripts/tool-input-streaming.tsx +30 -0
- package/.agents/skills/ai-elements/scripts/tool-output-available.tsx +80 -0
- package/.agents/skills/ai-elements/scripts/tool-output-error.tsx +44 -0
- package/.agents/skills/ai-elements/scripts/tool.tsx +222 -0
- package/.agents/skills/ai-elements/scripts/transcription.tsx +290 -0
- package/.agents/skills/ai-elements/scripts/voice-selector.tsx +245 -0
- package/.agents/skills/ai-elements/scripts/web-preview.tsx +115 -0
- package/.agents/skills/ai-sdk/SKILL.md +78 -0
- package/.agents/skills/ai-sdk/references/ai-gateway.md +66 -0
- package/.agents/skills/ai-sdk/references/common-errors.md +443 -0
- package/.agents/skills/ai-sdk/references/devtools.md +52 -0
- package/.agents/skills/ai-sdk/references/type-safe-agents.md +204 -0
- package/.agents/skills/chat-sdk/SKILL.md +240 -0
- package/.agents/skills/composio/AGENTS.md +404 -0
- package/.agents/skills/composio/SKILL.md +55 -0
- package/.agents/skills/composio/rules/_template.md +38 -0
- package/.agents/skills/composio/rules/app-auth-configs.md +224 -0
- package/.agents/skills/composio/rules/app-auth-popup-ui.md +143 -0
- package/.agents/skills/composio/rules/app-connected-accounts.md +240 -0
- package/.agents/skills/composio/rules/app-custom-tools.md +220 -0
- package/.agents/skills/composio/rules/app-execute-tools.md +202 -0
- package/.agents/skills/composio/rules/app-fetch-tools.md +292 -0
- package/.agents/skills/composio/rules/app-modifiers.md +148 -0
- package/.agents/skills/composio/rules/app-tool-versions.md +343 -0
- package/.agents/skills/composio/rules/app-toolkits.md +184 -0
- package/.agents/skills/composio/rules/app-user-context.md +222 -0
- package/.agents/skills/composio/rules/building-with-composio.md +134 -0
- package/.agents/skills/composio/rules/composio-cli.md +223 -0
- package/.agents/skills/composio/rules/setup-api-keys.md +230 -0
- package/.agents/skills/composio/rules/tr-auth-auto.md +110 -0
- package/.agents/skills/composio/rules/tr-auth-connections.md +167 -0
- package/.agents/skills/composio/rules/tr-auth-manual.md +161 -0
- package/.agents/skills/composio/rules/tr-building-chat-ui.md +348 -0
- package/.agents/skills/composio/rules/tr-framework-ai-sdk.md +240 -0
- package/.agents/skills/composio/rules/tr-framework-integration.md +818 -0
- package/.agents/skills/composio/rules/tr-framework-mastra.md +185 -0
- package/.agents/skills/composio/rules/tr-mcp-vs-native.md +248 -0
- package/.agents/skills/composio/rules/tr-session-basic.md +82 -0
- package/.agents/skills/composio/rules/tr-session-config.md +172 -0
- package/.agents/skills/composio/rules/tr-session-lifecycle.md +385 -0
- package/.agents/skills/composio/rules/tr-toolkit-query.md +135 -0
- package/.agents/skills/composio/rules/tr-userid-best-practices.md +476 -0
- package/.agents/skills/composio/rules/triggers-create.md +246 -0
- package/.agents/skills/composio/rules/triggers-manage.md +275 -0
- package/.agents/skills/composio/rules/triggers-subscribe.md +173 -0
- package/.agents/skills/composio/rules/triggers-webhook.md +227 -0
- package/.agents/skills/create-auth-skill/SKILL.md +321 -0
- package/.agents/skills/design-md/README.md +34 -0
- package/.agents/skills/design-md/SKILL.md +172 -0
- package/.agents/skills/design-md/examples/DESIGN.md +154 -0
- package/.agents/skills/expo-tailwind-setup/SKILL.md +480 -0
- package/.agents/skills/expo-tailwind-setup/agents/openai.yaml +4 -0
- package/.agents/skills/find-skills/SKILL.md +142 -0
- package/.agents/skills/firecrawl/SKILL.md +321 -0
- package/.agents/skills/firecrawl/rules/install.md +85 -0
- package/.agents/skills/firecrawl/rules/security.md +26 -0
- package/.agents/skills/frontend-design/LICENSE.txt +177 -0
- package/.agents/skills/frontend-design/SKILL.md +55 -0
- package/.agents/skills/linkup-search/SKILL.md +298 -0
- package/.agents/skills/mcp-builder/LICENSE.txt +202 -0
- package/.agents/skills/mcp-builder/SKILL.md +236 -0
- package/.agents/skills/mcp-builder/reference/evaluation.md +602 -0
- package/.agents/skills/mcp-builder/reference/mcp_best_practices.md +249 -0
- package/.agents/skills/mcp-builder/reference/node_mcp_server.md +970 -0
- package/.agents/skills/mcp-builder/reference/python_mcp_server.md +719 -0
- package/.agents/skills/mcp-builder/scripts/connections.py +151 -0
- package/.agents/skills/mcp-builder/scripts/evaluation.py +373 -0
- package/.agents/skills/mcp-builder/scripts/example_evaluation.xml +22 -0
- package/.agents/skills/mcp-builder/scripts/requirements.txt +2 -0
- package/.agents/skills/mobile-android-design/SKILL.md +101 -0
- package/.agents/skills/mobile-android-design/references/android-navigation.md +698 -0
- package/.agents/skills/mobile-android-design/references/compose-components.md +796 -0
- package/.agents/skills/mobile-android-design/references/details.md +337 -0
- package/.agents/skills/mobile-android-design/references/material3-theming.md +604 -0
- package/.agents/skills/mobile-ios-design/SKILL.md +259 -0
- package/.agents/skills/mobile-ios-design/references/hig-patterns.md +529 -0
- package/.agents/skills/mobile-ios-design/references/ios-navigation.md +556 -0
- package/.agents/skills/mobile-ios-design/references/swiftui-components.md +575 -0
- package/.agents/skills/neon-drizzle/SKILL.md +81 -0
- package/.agents/skills/neon-drizzle/guides/existing-project.md +398 -0
- package/.agents/skills/neon-drizzle/guides/new-project.md +312 -0
- package/.agents/skills/neon-drizzle/guides/schema-only.md +415 -0
- package/.agents/skills/neon-drizzle/guides/troubleshooting.md +539 -0
- package/.agents/skills/neon-drizzle/references/adapters.md +478 -0
- package/.agents/skills/neon-drizzle/references/migrations.md +652 -0
- package/.agents/skills/neon-drizzle/references/query-patterns.md +761 -0
- package/.agents/skills/neon-drizzle/scripts/generate-schema.ts +77 -0
- package/.agents/skills/neon-drizzle/scripts/run-migration.ts +133 -0
- package/.agents/skills/neon-drizzle/templates/db-http.ts +6 -0
- package/.agents/skills/neon-drizzle/templates/db-websocket.ts +24 -0
- package/.agents/skills/neon-drizzle/templates/drizzle-config.ts +96 -0
- package/.agents/skills/neon-drizzle/templates/schema-example.ts +231 -0
- package/.agents/skills/neon-postgres/SKILL.md +376 -0
- package/.agents/skills/next-best-practices/SKILL.md +152 -0
- package/.agents/skills/next-best-practices/async-patterns.md +87 -0
- package/.agents/skills/next-best-practices/bundling.md +180 -0
- package/.agents/skills/next-best-practices/data-patterns.md +297 -0
- package/.agents/skills/next-best-practices/debug-tricks.md +105 -0
- package/.agents/skills/next-best-practices/directives.md +73 -0
- package/.agents/skills/next-best-practices/error-handling.md +227 -0
- package/.agents/skills/next-best-practices/file-conventions.md +140 -0
- package/.agents/skills/next-best-practices/font.md +245 -0
- package/.agents/skills/next-best-practices/functions.md +108 -0
- package/.agents/skills/next-best-practices/hydration-error.md +91 -0
- package/.agents/skills/next-best-practices/image.md +173 -0
- package/.agents/skills/next-best-practices/metadata.md +301 -0
- package/.agents/skills/next-best-practices/parallel-routes.md +287 -0
- package/.agents/skills/next-best-practices/route-handlers.md +146 -0
- package/.agents/skills/next-best-practices/rsc-boundaries.md +159 -0
- package/.agents/skills/next-best-practices/runtime-selection.md +39 -0
- package/.agents/skills/next-best-practices/scripts.md +141 -0
- package/.agents/skills/next-best-practices/self-hosting.md +371 -0
- package/.agents/skills/next-best-practices/suspense-boundaries.md +67 -0
- package/.agents/skills/playwright-best-practices/SKILL.md +303 -0
- package/.agents/skills/playwright-cli/SKILL.md +404 -0
- package/.agents/skills/playwright-cli/references/element-attributes.md +23 -0
- package/.agents/skills/playwright-cli/references/playwright-tests.md +39 -0
- package/.agents/skills/playwright-cli/references/request-mocking.md +87 -0
- package/.agents/skills/playwright-cli/references/running-code.md +241 -0
- package/.agents/skills/playwright-cli/references/session-management.md +225 -0
- package/.agents/skills/playwright-cli/references/spec-driven-testing.md +305 -0
- package/.agents/skills/playwright-cli/references/storage-state.md +275 -0
- package/.agents/skills/playwright-cli/references/test-generation.md +134 -0
- package/.agents/skills/playwright-cli/references/tracing.md +139 -0
- package/.agents/skills/playwright-cli/references/video-recording.md +143 -0
- package/.agents/skills/prisma-client-api/SKILL.md +216 -0
- package/.agents/skills/prisma-client-api/references/client-methods.md +223 -0
- package/.agents/skills/prisma-client-api/references/constructor.md +208 -0
- package/.agents/skills/prisma-client-api/references/filters.md +256 -0
- package/.agents/skills/prisma-client-api/references/model-queries.md +281 -0
- package/.agents/skills/prisma-client-api/references/query-options.md +276 -0
- package/.agents/skills/prisma-client-api/references/raw-queries.md +194 -0
- package/.agents/skills/prisma-client-api/references/relations.md +308 -0
- package/.agents/skills/prisma-client-api/references/transactions.md +184 -0
- package/.agents/skills/prisma-database-setup/SKILL.md +192 -0
- package/.agents/skills/prisma-database-setup/references/cockroachdb.md +89 -0
- package/.agents/skills/prisma-database-setup/references/mongodb.md +90 -0
- package/.agents/skills/prisma-database-setup/references/mysql.md +126 -0
- package/.agents/skills/prisma-database-setup/references/postgresql.md +92 -0
- package/.agents/skills/prisma-database-setup/references/prisma-client-setup.md +47 -0
- package/.agents/skills/prisma-database-setup/references/prisma-postgres.md +130 -0
- package/.agents/skills/prisma-database-setup/references/sqlite.md +106 -0
- package/.agents/skills/prisma-database-setup/references/sqlserver.md +94 -0
- package/.agents/skills/prisma-postgres/SKILL.md +127 -0
- package/.agents/skills/prisma-postgres/references/console-and-connections.md +67 -0
- package/.agents/skills/prisma-postgres/references/create-db-cli.md +136 -0
- package/.agents/skills/prisma-postgres/references/management-api-sdk.md +56 -0
- package/.agents/skills/prisma-postgres/references/management-api.md +61 -0
- package/.agents/skills/remotion-best-practices/SKILL.md +340 -0
- package/.agents/skills/remotion-best-practices/rules/3d.md +86 -0
- package/.agents/skills/remotion-best-practices/rules/assets/charts-bar-chart.tsx +173 -0
- package/.agents/skills/remotion-best-practices/rules/assets/text-animations-typewriter.tsx +100 -0
- package/.agents/skills/remotion-best-practices/rules/assets/text-animations-word-highlight.tsx +103 -0
- package/.agents/skills/remotion-best-practices/rules/audio-visualization.md +198 -0
- package/.agents/skills/remotion-best-practices/rules/audio.md +169 -0
- package/.agents/skills/remotion-best-practices/rules/calculate-metadata.md +134 -0
- package/.agents/skills/remotion-best-practices/rules/compositions.md +133 -0
- package/.agents/skills/remotion-best-practices/rules/display-captions.md +184 -0
- package/.agents/skills/remotion-best-practices/rules/ffmpeg.md +34 -0
- package/.agents/skills/remotion-best-practices/rules/get-audio-duration.md +58 -0
- package/.agents/skills/remotion-best-practices/rules/get-video-dimensions.md +68 -0
- package/.agents/skills/remotion-best-practices/rules/get-video-duration.md +60 -0
- package/.agents/skills/remotion-best-practices/rules/gifs.md +141 -0
- package/.agents/skills/remotion-best-practices/rules/google-fonts.md +72 -0
- package/.agents/skills/remotion-best-practices/rules/html-in-canvas.md +122 -0
- package/.agents/skills/remotion-best-practices/rules/images.md +71 -0
- package/.agents/skills/remotion-best-practices/rules/import-srt-captions.md +69 -0
- package/.agents/skills/remotion-best-practices/rules/light-leaks.md +73 -0
- package/.agents/skills/remotion-best-practices/rules/local-fonts.md +65 -0
- package/.agents/skills/remotion-best-practices/rules/lottie.md +70 -0
- package/.agents/skills/remotion-best-practices/rules/maplibre.md +458 -0
- package/.agents/skills/remotion-best-practices/rules/measuring-dom-nodes.md +34 -0
- package/.agents/skills/remotion-best-practices/rules/measuring-text.md +140 -0
- package/.agents/skills/remotion-best-practices/rules/parameters.md +109 -0
- package/.agents/skills/remotion-best-practices/rules/sequencing.md +144 -0
- package/.agents/skills/remotion-best-practices/rules/sfx.md +30 -0
- package/.agents/skills/remotion-best-practices/rules/silence-detection.md +71 -0
- package/.agents/skills/remotion-best-practices/rules/subtitles.md +36 -0
- package/.agents/skills/remotion-best-practices/rules/tailwind.md +11 -0
- package/.agents/skills/remotion-best-practices/rules/text-animations.md +20 -0
- package/.agents/skills/remotion-best-practices/rules/timing.md +136 -0
- package/.agents/skills/remotion-best-practices/rules/transcribe-captions.md +70 -0
- package/.agents/skills/remotion-best-practices/rules/transitions.md +197 -0
- package/.agents/skills/remotion-best-practices/rules/transparent-videos.md +106 -0
- package/.agents/skills/remotion-best-practices/rules/trimming.md +51 -0
- package/.agents/skills/remotion-best-practices/rules/videos.md +171 -0
- package/.agents/skills/remotion-best-practices/rules/voiceover.md +99 -0
- package/.agents/skills/remotion-render/SKILL.md +212 -0
- package/.agents/skills/skill-creator/LICENSE.txt +202 -0
- package/.agents/skills/skill-creator/SKILL.md +485 -0
- package/.agents/skills/skill-creator/agents/analyzer.md +274 -0
- package/.agents/skills/skill-creator/agents/comparator.md +202 -0
- package/.agents/skills/skill-creator/agents/grader.md +223 -0
- package/.agents/skills/skill-creator/assets/eval_review.html +146 -0
- package/.agents/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/.agents/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/.agents/skills/skill-creator/references/schemas.md +430 -0
- package/.agents/skills/skill-creator/scripts/__init__.py +0 -0
- package/.agents/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/.agents/skills/skill-creator/scripts/generate_report.py +326 -0
- package/.agents/skills/skill-creator/scripts/improve_description.py +247 -0
- package/.agents/skills/skill-creator/scripts/package_skill.py +136 -0
- package/.agents/skills/skill-creator/scripts/quick_validate.py +103 -0
- package/.agents/skills/skill-creator/scripts/run_eval.py +310 -0
- package/.agents/skills/skill-creator/scripts/run_loop.py +328 -0
- package/.agents/skills/skill-creator/scripts/utils.py +47 -0
- package/.agents/skills/stripe-best-practices/SKILL.md +54 -0
- package/.agents/skills/stripe-best-practices/references/billing.md +58 -0
- package/.agents/skills/stripe-best-practices/references/connect.md +173 -0
- package/.agents/skills/stripe-best-practices/references/payments.md +79 -0
- package/.agents/skills/stripe-best-practices/references/security.md +109 -0
- package/.agents/skills/stripe-best-practices/references/tax.md +37 -0
- package/.agents/skills/stripe-best-practices/references/treasury.md +16 -0
- package/.agents/skills/stripe-projects/SKILL.md +132 -0
- package/.agents/skills/supabase/CHANGELOG.md +35 -0
- package/.agents/skills/supabase/SKILL.md +135 -0
- package/.agents/skills/supabase/assets/feedback-issue-template.md +17 -0
- package/.agents/skills/supabase/references/skill-feedback.md +17 -0
- package/.agents/skills/supabase-postgres-best-practices/CHANGELOG.md +29 -0
- package/.agents/skills/supabase-postgres-best-practices/SKILL.md +64 -0
- package/.agents/skills/supabase-postgres-best-practices/references/_contributing.md +170 -0
- package/.agents/skills/supabase-postgres-best-practices/references/_sections.md +39 -0
- package/.agents/skills/supabase-postgres-best-practices/references/_template.md +34 -0
- package/.agents/skills/supabase-postgres-best-practices/references/advanced-full-text-search.md +55 -0
- package/.agents/skills/supabase-postgres-best-practices/references/advanced-jsonb-indexing.md +49 -0
- package/.agents/skills/supabase-postgres-best-practices/references/conn-idle-timeout.md +46 -0
- package/.agents/skills/supabase-postgres-best-practices/references/conn-limits.md +44 -0
- package/.agents/skills/supabase-postgres-best-practices/references/conn-pooling.md +41 -0
- package/.agents/skills/supabase-postgres-best-practices/references/conn-prepared-statements.md +46 -0
- package/.agents/skills/supabase-postgres-best-practices/references/data-batch-inserts.md +54 -0
- package/.agents/skills/supabase-postgres-best-practices/references/data-n-plus-one.md +53 -0
- package/.agents/skills/supabase-postgres-best-practices/references/data-pagination.md +50 -0
- package/.agents/skills/supabase-postgres-best-practices/references/data-upsert.md +50 -0
- package/.agents/skills/supabase-postgres-best-practices/references/lock-advisory.md +56 -0
- package/.agents/skills/supabase-postgres-best-practices/references/lock-deadlock-prevention.md +68 -0
- package/.agents/skills/supabase-postgres-best-practices/references/lock-short-transactions.md +50 -0
- package/.agents/skills/supabase-postgres-best-practices/references/lock-skip-locked.md +54 -0
- package/.agents/skills/supabase-postgres-best-practices/references/monitor-explain-analyze.md +45 -0
- package/.agents/skills/supabase-postgres-best-practices/references/monitor-pg-stat-statements.md +55 -0
- package/.agents/skills/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md +55 -0
- package/.agents/skills/supabase-postgres-best-practices/references/query-composite-indexes.md +44 -0
- package/.agents/skills/supabase-postgres-best-practices/references/query-covering-indexes.md +40 -0
- package/.agents/skills/supabase-postgres-best-practices/references/query-index-types.md +48 -0
- package/.agents/skills/supabase-postgres-best-practices/references/query-missing-indexes.md +43 -0
- package/.agents/skills/supabase-postgres-best-practices/references/query-partial-indexes.md +45 -0
- package/.agents/skills/supabase-postgres-best-practices/references/schema-constraints.md +80 -0
- package/.agents/skills/supabase-postgres-best-practices/references/schema-data-types.md +46 -0
- package/.agents/skills/supabase-postgres-best-practices/references/schema-foreign-key-indexes.md +59 -0
- package/.agents/skills/supabase-postgres-best-practices/references/schema-lowercase-identifiers.md +55 -0
- package/.agents/skills/supabase-postgres-best-practices/references/schema-partitioning.md +55 -0
- package/.agents/skills/supabase-postgres-best-practices/references/schema-primary-keys.md +61 -0
- package/.agents/skills/supabase-postgres-best-practices/references/security-privileges.md +54 -0
- package/.agents/skills/supabase-postgres-best-practices/references/security-rls-basics.md +50 -0
- package/.agents/skills/supabase-postgres-best-practices/references/security-rls-performance.md +63 -0
- package/.agents/skills/supermemory/LICENSE +201 -0
- package/.agents/skills/supermemory/README.md +221 -0
- package/.agents/skills/supermemory/SKILL.md +172 -0
- package/.agents/skills/supermemory/references/api-reference.md +591 -0
- package/.agents/skills/supermemory/references/architecture.md +557 -0
- package/.agents/skills/supermemory/references/quickstart.md +293 -0
- package/.agents/skills/supermemory/references/sdk-guide.md +655 -0
- package/.agents/skills/supermemory/references/use-cases.md +1033 -0
- package/.agents/skills/supermemory-cli/SKILL.md +490 -0
- package/.agents/skills/tdd/SKILL.md +108 -0
- package/.agents/skills/tdd/mocking.md +59 -0
- package/.agents/skills/tdd/refactoring.md +10 -0
- package/.agents/skills/tdd/tests.md +61 -0
- package/.agents/skills/ui-ux-pro-max/SKILL.md +661 -0
- package/.agents/skills/ui-ux-pro-max/data +1 -0
- package/.agents/skills/ui-ux-pro-max/scripts +1 -0
- package/.agents/skills/vercel-react-native-skills/AGENTS.md +2897 -0
- package/.agents/skills/vercel-react-native-skills/README.md +165 -0
- package/.agents/skills/vercel-react-native-skills/SKILL.md +121 -0
- package/.agents/skills/vercel-react-native-skills/metadata.json +16 -0
- package/.agents/skills/vercel-react-native-skills/rules/_sections.md +86 -0
- package/.agents/skills/vercel-react-native-skills/rules/_template.md +28 -0
- package/.agents/skills/vercel-react-native-skills/rules/animation-derived-value.md +53 -0
- package/.agents/skills/vercel-react-native-skills/rules/animation-gesture-detector-press.md +95 -0
- package/.agents/skills/vercel-react-native-skills/rules/animation-gpu-properties.md +65 -0
- package/.agents/skills/vercel-react-native-skills/rules/design-system-compound-components.md +66 -0
- package/.agents/skills/vercel-react-native-skills/rules/fonts-config-plugin.md +71 -0
- package/.agents/skills/vercel-react-native-skills/rules/imports-design-system-folder.md +68 -0
- package/.agents/skills/vercel-react-native-skills/rules/js-hoist-intl.md +61 -0
- package/.agents/skills/vercel-react-native-skills/rules/list-performance-callbacks.md +44 -0
- package/.agents/skills/vercel-react-native-skills/rules/list-performance-function-references.md +132 -0
- package/.agents/skills/vercel-react-native-skills/rules/list-performance-images.md +53 -0
- package/.agents/skills/vercel-react-native-skills/rules/list-performance-inline-objects.md +97 -0
- package/.agents/skills/vercel-react-native-skills/rules/list-performance-item-expensive.md +94 -0
- package/.agents/skills/vercel-react-native-skills/rules/list-performance-item-memo.md +82 -0
- package/.agents/skills/vercel-react-native-skills/rules/list-performance-item-types.md +104 -0
- package/.agents/skills/vercel-react-native-skills/rules/list-performance-virtualize.md +67 -0
- package/.agents/skills/vercel-react-native-skills/rules/monorepo-native-deps-in-app.md +46 -0
- package/.agents/skills/vercel-react-native-skills/rules/monorepo-single-dependency-versions.md +63 -0
- package/.agents/skills/vercel-react-native-skills/rules/navigation-native-navigators.md +188 -0
- package/.agents/skills/vercel-react-native-skills/rules/react-compiler-destructure-functions.md +50 -0
- package/.agents/skills/vercel-react-native-skills/rules/react-compiler-reanimated-shared-values.md +48 -0
- package/.agents/skills/vercel-react-native-skills/rules/react-state-dispatcher.md +91 -0
- package/.agents/skills/vercel-react-native-skills/rules/react-state-fallback.md +56 -0
- package/.agents/skills/vercel-react-native-skills/rules/react-state-minimize.md +65 -0
- package/.agents/skills/vercel-react-native-skills/rules/rendering-no-falsy-and.md +74 -0
- package/.agents/skills/vercel-react-native-skills/rules/rendering-text-in-text-component.md +36 -0
- package/.agents/skills/vercel-react-native-skills/rules/scroll-position-no-state.md +82 -0
- package/.agents/skills/vercel-react-native-skills/rules/state-ground-truth.md +80 -0
- package/.agents/skills/vercel-react-native-skills/rules/ui-expo-image.md +66 -0
- package/.agents/skills/vercel-react-native-skills/rules/ui-image-gallery.md +104 -0
- package/.agents/skills/vercel-react-native-skills/rules/ui-measure-views.md +78 -0
- package/.agents/skills/vercel-react-native-skills/rules/ui-menus.md +174 -0
- package/.agents/skills/vercel-react-native-skills/rules/ui-native-modals.md +77 -0
- package/.agents/skills/vercel-react-native-skills/rules/ui-pressable.md +61 -0
- package/.agents/skills/vercel-react-native-skills/rules/ui-safe-area-scroll.md +65 -0
- package/.agents/skills/vercel-react-native-skills/rules/ui-scrollview-content-inset.md +45 -0
- package/.agents/skills/vercel-react-native-skills/rules/ui-styling.md +87 -0
- package/.agents/skills/web-design-guidelines/SKILL.md +39 -0
- package/dist/index.js +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,1033 @@
|
|
|
1
|
+
# Supermemory Use Cases & Examples
|
|
2
|
+
|
|
3
|
+
Concrete examples showing how to use Supermemory for common AI application patterns.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
1. [Personalized Chatbot](#1-personalized-chatbot)
|
|
8
|
+
2. [Long-Term Task Assistant](#2-long-term-task-assistant)
|
|
9
|
+
3. [Document Knowledge Base](#3-document-knowledge-base)
|
|
10
|
+
4. [Customer Support AI](#4-customer-support-ai)
|
|
11
|
+
5. [Code Review Assistant](#5-code-review-assistant)
|
|
12
|
+
6. [Learning Companion](#6-learning-companion)
|
|
13
|
+
7. [Multi-Tenant SaaS Application](#7-multi-tenant-saas-application)
|
|
14
|
+
8. [Research Assistant](#8-research-assistant)
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 1. Personalized Chatbot
|
|
19
|
+
|
|
20
|
+
Build a chatbot that remembers user preferences and past conversations.
|
|
21
|
+
|
|
22
|
+
### Implementation (TypeScript + Vercel AI SDK)
|
|
23
|
+
|
|
24
|
+
```typescript
|
|
25
|
+
import { Supermemory } from 'supermemory';
|
|
26
|
+
import { openai } from '@ai-sdk/openai';
|
|
27
|
+
import { generateText } from 'ai';
|
|
28
|
+
|
|
29
|
+
const memory = new Supermemory();
|
|
30
|
+
|
|
31
|
+
async function chat(userId: string, message: string) {
|
|
32
|
+
// 1. Retrieve user context
|
|
33
|
+
const response = await memory.profile({
|
|
34
|
+
containerTag: userId,
|
|
35
|
+
q: message,
|
|
36
|
+
threshold: 0.6
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// 2. Build system prompt with personalization
|
|
40
|
+
const staticFacts = response.profile.static.map(f => `- ${f}`).join('\n');
|
|
41
|
+
const dynamicFacts = response.profile.dynamic.map(f => `- ${f}`).join('\n');
|
|
42
|
+
|
|
43
|
+
const systemPrompt = `
|
|
44
|
+
You are a helpful assistant with perfect memory.
|
|
45
|
+
|
|
46
|
+
User Profile:
|
|
47
|
+
${staticFacts}
|
|
48
|
+
|
|
49
|
+
Recent Context:
|
|
50
|
+
${dynamicFacts}
|
|
51
|
+
|
|
52
|
+
Use this context to provide personalized, contextually aware responses.
|
|
53
|
+
`.trim();
|
|
54
|
+
|
|
55
|
+
// 3. Generate response
|
|
56
|
+
const { text } = await generateText({
|
|
57
|
+
model: openai('gpt-4'),
|
|
58
|
+
system: systemPrompt,
|
|
59
|
+
prompt: message
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
// 4. Store the interaction
|
|
63
|
+
await memory.add({
|
|
64
|
+
content: `User: ${message}\nAssistant: ${text}`,
|
|
65
|
+
containerTag: userId,
|
|
66
|
+
metadata: {
|
|
67
|
+
timestamp: new Date().toISOString(),
|
|
68
|
+
messageId: crypto.randomUUID(),
|
|
69
|
+
type: 'conversation'
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
return text;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Usage
|
|
77
|
+
const response = await chat('user_123', 'What did I tell you about my preferences?');
|
|
78
|
+
console.log(response); // Uses stored context to answer accurately
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Python Version
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
from supermemory import Supermemory
|
|
85
|
+
from openai import OpenAI
|
|
86
|
+
import datetime
|
|
87
|
+
|
|
88
|
+
memory = Supermemory()
|
|
89
|
+
openai_client = OpenAI()
|
|
90
|
+
|
|
91
|
+
def chat(user_id: str, message: str) -> str:
|
|
92
|
+
# 1. Retrieve context
|
|
93
|
+
response = memory.profile(
|
|
94
|
+
container_tag=user_id,
|
|
95
|
+
q=message,
|
|
96
|
+
threshold=0.6
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
# 2. Build system prompt
|
|
100
|
+
static_facts = "\n".join(f"- {fact}" for fact in response['profile']['static'])
|
|
101
|
+
dynamic_facts = "\n".join(f"- {fact}" for fact in response['profile']['dynamic'])
|
|
102
|
+
|
|
103
|
+
system_prompt = f"""
|
|
104
|
+
You are a helpful assistant with perfect memory.
|
|
105
|
+
|
|
106
|
+
User Profile:
|
|
107
|
+
{static_facts}
|
|
108
|
+
|
|
109
|
+
Recent Context:
|
|
110
|
+
{dynamic_facts}
|
|
111
|
+
|
|
112
|
+
Use this context to provide personalized responses.
|
|
113
|
+
""".strip()
|
|
114
|
+
|
|
115
|
+
# 3. Generate response
|
|
116
|
+
response = openai_client.chat.completions.create(
|
|
117
|
+
model="gpt-4",
|
|
118
|
+
messages=[
|
|
119
|
+
{"role": "system", "content": system_prompt},
|
|
120
|
+
{"role": "user", "content": message}
|
|
121
|
+
]
|
|
122
|
+
)
|
|
123
|
+
text = response.choices[0].message.content
|
|
124
|
+
|
|
125
|
+
# 4. Store interaction
|
|
126
|
+
memory.add(
|
|
127
|
+
content=f"User: {message}\nAssistant: {text}",
|
|
128
|
+
container_tag=user_id,
|
|
129
|
+
metadata={
|
|
130
|
+
"timestamp": datetime.datetime.now().isoformat(),
|
|
131
|
+
"type": "conversation"
|
|
132
|
+
}
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
return text
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Key Benefits
|
|
139
|
+
- Personalized responses based on user history
|
|
140
|
+
- Remembers preferences across sessions
|
|
141
|
+
- Reduces repetitive questions
|
|
142
|
+
- Builds trust through consistency
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## 2. Long-Term Task Assistant
|
|
147
|
+
|
|
148
|
+
AI assistant that tracks ongoing projects and tasks over weeks/months.
|
|
149
|
+
|
|
150
|
+
### Implementation
|
|
151
|
+
|
|
152
|
+
```typescript
|
|
153
|
+
import { Supermemory } from 'supermemory';
|
|
154
|
+
import { anthropic } from '@ai-sdk/anthropic';
|
|
155
|
+
import { generateText } from 'ai';
|
|
156
|
+
|
|
157
|
+
const memory = new Supermemory();
|
|
158
|
+
|
|
159
|
+
interface Task {
|
|
160
|
+
id: string;
|
|
161
|
+
title: string;
|
|
162
|
+
status: 'todo' | 'in_progress' | 'done';
|
|
163
|
+
priority: 'low' | 'medium' | 'high';
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async function taskAssistant(userId: string, query: string) {
|
|
167
|
+
// Get task-related context
|
|
168
|
+
const response = await memory.profile({
|
|
169
|
+
containerTag: `${userId}_tasks`,
|
|
170
|
+
q: query,
|
|
171
|
+
threshold: 0.5
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// Build context from profile
|
|
175
|
+
const tasks = response.profile.dynamic.map(f => `- ${f}`).join('\n');
|
|
176
|
+
|
|
177
|
+
// Generate intelligent response
|
|
178
|
+
const { text } = await generateText({
|
|
179
|
+
model: anthropic('claude-3-5-sonnet-20241022'),
|
|
180
|
+
system: `
|
|
181
|
+
You are a task management assistant with perfect memory of the user's projects.
|
|
182
|
+
|
|
183
|
+
Active Tasks and Context:
|
|
184
|
+
${tasks}
|
|
185
|
+
|
|
186
|
+
Help the user track, prioritize, and complete their tasks.
|
|
187
|
+
`,
|
|
188
|
+
prompt: query
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
return text;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
async function addTask(userId: string, task: Task) {
|
|
195
|
+
await memory.add({
|
|
196
|
+
content: `Task: ${task.title} (Status: ${task.status}, Priority: ${task.priority})`,
|
|
197
|
+
containerTag: `${userId}_tasks`,
|
|
198
|
+
customId: task.id,
|
|
199
|
+
metadata: {
|
|
200
|
+
status: task.status,
|
|
201
|
+
priority: task.priority,
|
|
202
|
+
createdAt: new Date().toISOString()
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
async function updateTask(userId: string, taskId: string, status: Task['status']) {
|
|
208
|
+
// Add update (Supermemory will create relationship)
|
|
209
|
+
await memory.add({
|
|
210
|
+
content: `Task ${taskId} updated to status: ${status}`,
|
|
211
|
+
containerTag: `${userId}_tasks`,
|
|
212
|
+
metadata: {
|
|
213
|
+
taskId,
|
|
214
|
+
status,
|
|
215
|
+
updatedAt: new Date().toISOString(),
|
|
216
|
+
type: 'update'
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Usage
|
|
222
|
+
await addTask('user_123', {
|
|
223
|
+
id: 'task_1',
|
|
224
|
+
title: 'Implement authentication',
|
|
225
|
+
status: 'in_progress',
|
|
226
|
+
priority: 'high'
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
await taskAssistant('user_123', 'What are my high priority tasks?');
|
|
230
|
+
// Returns: "You have 1 high priority task: Implement authentication (in progress)"
|
|
231
|
+
|
|
232
|
+
await updateTask('user_123', 'task_1', 'done');
|
|
233
|
+
await taskAssistant('user_123', 'What did I complete today?');
|
|
234
|
+
// Returns: "You completed 'Implement authentication' today!"
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Key Benefits
|
|
238
|
+
- Long-term project tracking
|
|
239
|
+
- Automatic task status history
|
|
240
|
+
- Intelligent prioritization suggestions
|
|
241
|
+
- Context-aware task recommendations
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## 3. Document Knowledge Base
|
|
246
|
+
|
|
247
|
+
Semantic search across documentation, manuals, and knowledge articles.
|
|
248
|
+
|
|
249
|
+
### Implementation
|
|
250
|
+
|
|
251
|
+
```typescript
|
|
252
|
+
import { Supermemory } from 'supermemory';
|
|
253
|
+
|
|
254
|
+
const memory = new Supermemory();
|
|
255
|
+
|
|
256
|
+
// 1. Index documentation
|
|
257
|
+
async function indexDocumentation() {
|
|
258
|
+
const docs = [
|
|
259
|
+
{ url: 'https://docs.example.com/getting-started', category: 'onboarding' },
|
|
260
|
+
{ url: 'https://docs.example.com/api-reference', category: 'api' },
|
|
261
|
+
{ url: 'https://docs.example.com/security', category: 'security' },
|
|
262
|
+
];
|
|
263
|
+
|
|
264
|
+
for (const doc of docs) {
|
|
265
|
+
await memory.add({
|
|
266
|
+
content: doc.url,
|
|
267
|
+
containerTag: 'documentation',
|
|
268
|
+
metadata: {
|
|
269
|
+
category: doc.category,
|
|
270
|
+
type: 'documentation',
|
|
271
|
+
indexed_at: new Date().toISOString()
|
|
272
|
+
}
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
// 2. Search documentation
|
|
278
|
+
async function searchDocs(query: string, category?: string) {
|
|
279
|
+
const filters = category ? {
|
|
280
|
+
metadata: { category }
|
|
281
|
+
} : undefined;
|
|
282
|
+
|
|
283
|
+
const results = await memory.search.memories({
|
|
284
|
+
q: query,
|
|
285
|
+
containerTag: 'documentation',
|
|
286
|
+
searchMode: 'hybrid', // Use hybrid search for better RAG accuracy
|
|
287
|
+
threshold: 0.3,
|
|
288
|
+
limit: 10,
|
|
289
|
+
filters
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
return results.map(r => ({
|
|
293
|
+
content: r.content,
|
|
294
|
+
relevance: r.score,
|
|
295
|
+
metadata: r.metadata
|
|
296
|
+
}));
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// 3. Intelligent Q&A over documentation
|
|
300
|
+
async function askDocumentation(question: string) {
|
|
301
|
+
const results = await searchDocs(question);
|
|
302
|
+
|
|
303
|
+
const context = results
|
|
304
|
+
.slice(0, 5) // Top 5 results
|
|
305
|
+
.map(r => r.content)
|
|
306
|
+
.join('\n\n---\n\n');
|
|
307
|
+
|
|
308
|
+
const { text } = await generateText({
|
|
309
|
+
model: openai('gpt-4'),
|
|
310
|
+
system: `
|
|
311
|
+
You are a documentation assistant. Answer questions using ONLY the provided context.
|
|
312
|
+
|
|
313
|
+
Context:
|
|
314
|
+
${context}
|
|
315
|
+
|
|
316
|
+
If the answer isn't in the context, say so.
|
|
317
|
+
`,
|
|
318
|
+
prompt: question
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
return {
|
|
322
|
+
answer: text,
|
|
323
|
+
sources: results.slice(0, 5)
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// Usage
|
|
328
|
+
await indexDocumentation();
|
|
329
|
+
|
|
330
|
+
const result = await askDocumentation('How do I authenticate API requests?');
|
|
331
|
+
console.log(result.answer);
|
|
332
|
+
console.log('Sources:', result.sources);
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### Key Benefits
|
|
336
|
+
- Semantic search (not keyword matching)
|
|
337
|
+
- Multi-document understanding
|
|
338
|
+
- Automatic source citation
|
|
339
|
+
- Scales to thousands of documents
|
|
340
|
+
|
|
341
|
+
---
|
|
342
|
+
|
|
343
|
+
## 4. Customer Support AI
|
|
344
|
+
|
|
345
|
+
AI agent that remembers customer history and provides personalized support.
|
|
346
|
+
|
|
347
|
+
### Implementation
|
|
348
|
+
|
|
349
|
+
```typescript
|
|
350
|
+
import { Supermemory } from 'supermemory';
|
|
351
|
+
|
|
352
|
+
const memory = new Supermemory();
|
|
353
|
+
|
|
354
|
+
interface Customer {
|
|
355
|
+
id: string;
|
|
356
|
+
name: string;
|
|
357
|
+
email: string;
|
|
358
|
+
plan: 'free' | 'pro' | 'enterprise';
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
interface Ticket {
|
|
362
|
+
id: string;
|
|
363
|
+
customerId: string;
|
|
364
|
+
subject: string;
|
|
365
|
+
description: string;
|
|
366
|
+
status: 'open' | 'resolved';
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
// 1. Store customer profile
|
|
370
|
+
async function createCustomer(customer: Customer) {
|
|
371
|
+
await memory.add({
|
|
372
|
+
content: `Customer: ${customer.name} (${customer.email}), Plan: ${customer.plan}`,
|
|
373
|
+
containerTag: customer.id,
|
|
374
|
+
metadata: {
|
|
375
|
+
type: 'profile',
|
|
376
|
+
plan: customer.plan,
|
|
377
|
+
email: customer.email
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// 2. Log support ticket
|
|
383
|
+
async function createTicket(ticket: Ticket) {
|
|
384
|
+
await memory.add({
|
|
385
|
+
content: `Ticket ${ticket.id}: ${ticket.subject}\n${ticket.description}`,
|
|
386
|
+
containerTag: ticket.customerId,
|
|
387
|
+
customId: ticket.id,
|
|
388
|
+
metadata: {
|
|
389
|
+
type: 'ticket',
|
|
390
|
+
status: ticket.status,
|
|
391
|
+
subject: ticket.subject,
|
|
392
|
+
createdAt: new Date().toISOString()
|
|
393
|
+
}
|
|
394
|
+
});
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
// 3. Resolve ticket
|
|
398
|
+
async function resolveTicket(customerId: string, ticketId: string, resolution: string) {
|
|
399
|
+
await memory.add({
|
|
400
|
+
content: `Ticket ${ticketId} resolved: ${resolution}`,
|
|
401
|
+
containerTag: customerId,
|
|
402
|
+
metadata: {
|
|
403
|
+
type: 'resolution',
|
|
404
|
+
ticketId,
|
|
405
|
+
resolvedAt: new Date().toISOString()
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// 4. Support agent assistant
|
|
411
|
+
async function supportAssistant(customerId: string, query: string) {
|
|
412
|
+
const response = await memory.profile({
|
|
413
|
+
containerTag: customerId,
|
|
414
|
+
q: query,
|
|
415
|
+
threshold: 0.5
|
|
416
|
+
});
|
|
417
|
+
|
|
418
|
+
const staticInfo = response.profile.static.map(f => `- ${f}`).join('\n');
|
|
419
|
+
const recentTickets = response.profile.dynamic.map(f => `- ${f}`).join('\n');
|
|
420
|
+
|
|
421
|
+
const { text } = await generateText({
|
|
422
|
+
model: openai('gpt-4'),
|
|
423
|
+
system: `
|
|
424
|
+
You are a customer support AI with access to full customer history.
|
|
425
|
+
|
|
426
|
+
Customer Profile:
|
|
427
|
+
${staticInfo}
|
|
428
|
+
|
|
429
|
+
Previous Tickets and Interactions:
|
|
430
|
+
${recentTickets}
|
|
431
|
+
|
|
432
|
+
Provide helpful, personalized support based on this history.
|
|
433
|
+
`,
|
|
434
|
+
prompt: query
|
|
435
|
+
});
|
|
436
|
+
|
|
437
|
+
return text;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// Usage
|
|
441
|
+
await createCustomer({
|
|
442
|
+
id: 'cust_123',
|
|
443
|
+
name: 'Alice Johnson',
|
|
444
|
+
email: 'alice@example.com',
|
|
445
|
+
plan: 'pro'
|
|
446
|
+
});
|
|
447
|
+
|
|
448
|
+
await createTicket({
|
|
449
|
+
id: 'ticket_001',
|
|
450
|
+
customerId: 'cust_123',
|
|
451
|
+
subject: 'Cannot export data',
|
|
452
|
+
description: 'Getting error when trying to export CSV',
|
|
453
|
+
status: 'open'
|
|
454
|
+
});
|
|
455
|
+
|
|
456
|
+
const suggestion = await supportAssistant(
|
|
457
|
+
'cust_123',
|
|
458
|
+
'Customer is asking about data export again'
|
|
459
|
+
);
|
|
460
|
+
// Returns: "This is a recurring issue for Alice. She's on the Pro plan and has
|
|
461
|
+
// previously had trouble with CSV exports (ticket #001). Let's check if she's
|
|
462
|
+
// using the latest version..."
|
|
463
|
+
|
|
464
|
+
await resolveTicket('cust_123', 'ticket_001', 'Updated to latest version, issue resolved');
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
### Key Benefits
|
|
468
|
+
- Complete customer interaction history
|
|
469
|
+
- Personalized support responses
|
|
470
|
+
- Pattern detection (recurring issues)
|
|
471
|
+
- Reduced resolution time
|
|
472
|
+
|
|
473
|
+
---
|
|
474
|
+
|
|
475
|
+
## 5. Code Review Assistant
|
|
476
|
+
|
|
477
|
+
AI that learns your codebase and provides contextual code reviews.
|
|
478
|
+
|
|
479
|
+
### Implementation
|
|
480
|
+
|
|
481
|
+
```typescript
|
|
482
|
+
import { Supermemory } from 'supermemory';
|
|
483
|
+
import * as fs from 'fs';
|
|
484
|
+
import * as path from 'path';
|
|
485
|
+
|
|
486
|
+
const memory = new Supermemory();
|
|
487
|
+
|
|
488
|
+
// 1. Index codebase
|
|
489
|
+
async function indexCodebase(projectId: string, directory: string) {
|
|
490
|
+
const files = getAllFiles(directory, ['.ts', '.tsx', '.js', '.jsx']);
|
|
491
|
+
|
|
492
|
+
for (const file of files) {
|
|
493
|
+
const content = fs.readFileSync(file, 'utf-8');
|
|
494
|
+
const relativePath = path.relative(directory, file);
|
|
495
|
+
|
|
496
|
+
await memory.add({
|
|
497
|
+
content: `File: ${relativePath}\n\n${content}`,
|
|
498
|
+
containerTag: `${projectId}_codebase`,
|
|
499
|
+
customId: relativePath,
|
|
500
|
+
metadata: {
|
|
501
|
+
type: 'source_file',
|
|
502
|
+
language: path.extname(file).slice(1),
|
|
503
|
+
path: relativePath,
|
|
504
|
+
lines: content.split('\n').length
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
// 2. Index pull requests and reviews
|
|
511
|
+
async function indexPR(projectId: string, prNumber: number, diff: string, comments: string[]) {
|
|
512
|
+
await memory.add({
|
|
513
|
+
content: `PR #${prNumber}\n\nDiff:\n${diff}\n\nComments:\n${comments.join('\n')}`,
|
|
514
|
+
containerTag: `${projectId}_reviews`,
|
|
515
|
+
customId: `pr_${prNumber}`,
|
|
516
|
+
metadata: {
|
|
517
|
+
type: 'pull_request',
|
|
518
|
+
number: prNumber,
|
|
519
|
+
createdAt: new Date().toISOString()
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// 3. Review code with context
|
|
525
|
+
async function reviewCode(projectId: string, code: string, fileName: string) {
|
|
526
|
+
// Search for similar code patterns
|
|
527
|
+
const similarCode = await memory.search.memories({
|
|
528
|
+
q: code,
|
|
529
|
+
containerTag: `${projectId}_codebase`,
|
|
530
|
+
threshold: 0.3,
|
|
531
|
+
limit: 5
|
|
532
|
+
});
|
|
533
|
+
|
|
534
|
+
// Get past review comments
|
|
535
|
+
const pastReviews = await memory.search.memories({
|
|
536
|
+
q: `code review comments for ${fileName}`,
|
|
537
|
+
containerTag: `${projectId}_reviews`,
|
|
538
|
+
threshold: 0.3,
|
|
539
|
+
limit: 5
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
const { text } = await generateText({
|
|
543
|
+
model: anthropic('claude-3-5-sonnet-20241022'),
|
|
544
|
+
system: `
|
|
545
|
+
You are a code review assistant familiar with this codebase.
|
|
546
|
+
|
|
547
|
+
Similar Code Patterns:
|
|
548
|
+
${similarCode.map(c => c.content).slice(0, 3).join('\n\n---\n\n')}
|
|
549
|
+
|
|
550
|
+
Past Review Patterns:
|
|
551
|
+
${pastReviews.map(p => p.content).slice(0, 3).join('\n\n---\n\n')}
|
|
552
|
+
|
|
553
|
+
Provide a thoughtful code review, considering existing patterns and past feedback.
|
|
554
|
+
`,
|
|
555
|
+
prompt: `Review this code from ${fileName}:\n\n${code}`
|
|
556
|
+
});
|
|
557
|
+
|
|
558
|
+
return text;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
function getAllFiles(dir: string, extensions: string[]): string[] {
|
|
562
|
+
// Implementation omitted for brevity
|
|
563
|
+
return [];
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
// Usage
|
|
567
|
+
await indexCodebase('project_abc', './src');
|
|
568
|
+
await indexPR('project_abc', 123, '...diff...', ['Great work!', 'Consider adding tests']);
|
|
569
|
+
|
|
570
|
+
const review = await reviewCode('project_abc', `
|
|
571
|
+
async function fetchUser(id: string) {
|
|
572
|
+
const response = await fetch(\`/api/users/\${id}\`);
|
|
573
|
+
return response.json();
|
|
574
|
+
}
|
|
575
|
+
`, 'api/users.ts');
|
|
576
|
+
|
|
577
|
+
console.log(review);
|
|
578
|
+
// Returns: "This code lacks error handling. Based on past reviews in this project,
|
|
579
|
+
// we typically wrap fetch calls in try/catch and validate responses. See similar
|
|
580
|
+
// pattern in api/products.ts for reference..."
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
### Key Benefits
|
|
584
|
+
- Consistent code review standards
|
|
585
|
+
- Learns from past feedback
|
|
586
|
+
- Detects anti-patterns
|
|
587
|
+
- Suggests improvements based on codebase
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
## 6. Learning Companion
|
|
592
|
+
|
|
593
|
+
AI tutor that adapts to student progress and learning style.
|
|
594
|
+
|
|
595
|
+
### Implementation
|
|
596
|
+
|
|
597
|
+
```typescript
|
|
598
|
+
import { Supermemory } from 'supermemory';
|
|
599
|
+
|
|
600
|
+
const memory = new Supermemory();
|
|
601
|
+
|
|
602
|
+
interface LearningSession {
|
|
603
|
+
studentId: string;
|
|
604
|
+
topic: string;
|
|
605
|
+
content: string;
|
|
606
|
+
understanding: 'low' | 'medium' | 'high';
|
|
607
|
+
questions: string[];
|
|
608
|
+
}
|
|
609
|
+
|
|
610
|
+
async function recordLearningSession(session: LearningSession) {
|
|
611
|
+
await memory.add({
|
|
612
|
+
content: `
|
|
613
|
+
Topic: ${session.topic}
|
|
614
|
+
Understanding: ${session.understanding}
|
|
615
|
+
Content covered: ${session.content}
|
|
616
|
+
Questions asked: ${session.questions.join(', ')}
|
|
617
|
+
`,
|
|
618
|
+
containerTag: session.studentId,
|
|
619
|
+
metadata: {
|
|
620
|
+
type: 'learning_session',
|
|
621
|
+
topic: session.topic,
|
|
622
|
+
understanding: session.understanding,
|
|
623
|
+
timestamp: new Date().toISOString()
|
|
624
|
+
}
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
async function adaptiveTutor(studentId: string, question: string) {
|
|
629
|
+
const response = await memory.profile({
|
|
630
|
+
containerTag: studentId,
|
|
631
|
+
q: question,
|
|
632
|
+
threshold: 0.5
|
|
633
|
+
});
|
|
634
|
+
|
|
635
|
+
// Get learning history from search results (if available)
|
|
636
|
+
const searchResults = response.searchResults?.results || [];
|
|
637
|
+
|
|
638
|
+
// Analyze learning patterns from metadata
|
|
639
|
+
const weakTopics = searchResults
|
|
640
|
+
.filter(r => r.metadata?.understanding === 'low')
|
|
641
|
+
.map(r => r.metadata?.topic);
|
|
642
|
+
|
|
643
|
+
const strongTopics = searchResults
|
|
644
|
+
.filter(r => r.metadata?.understanding === 'high')
|
|
645
|
+
.map(r => r.metadata?.topic);
|
|
646
|
+
|
|
647
|
+
const staticInfo = response.profile.static.map(f => `- ${f}`).join('\n');
|
|
648
|
+
const recentLearning = response.profile.dynamic.slice(0, 5).map(f => f).join('\n\n');
|
|
649
|
+
|
|
650
|
+
const { text } = await generateText({
|
|
651
|
+
model: openai('gpt-4'),
|
|
652
|
+
system: `
|
|
653
|
+
You are an adaptive tutor who knows the student's learning history.
|
|
654
|
+
|
|
655
|
+
Student Profile:
|
|
656
|
+
${staticInfo}
|
|
657
|
+
|
|
658
|
+
Topics the student struggles with: ${weakTopics.join(', ') || 'None yet'}
|
|
659
|
+
Topics the student excels at: ${strongTopics.join(', ') || 'None yet'}
|
|
660
|
+
|
|
661
|
+
Recent Learning:
|
|
662
|
+
${recentLearning}
|
|
663
|
+
|
|
664
|
+
Adapt your teaching style and difficulty to match the student's level.
|
|
665
|
+
Use analogies to topics they understand well.
|
|
666
|
+
`,
|
|
667
|
+
prompt: question
|
|
668
|
+
});
|
|
669
|
+
|
|
670
|
+
return text;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
// Usage
|
|
674
|
+
await recordLearningSession({
|
|
675
|
+
studentId: 'student_456',
|
|
676
|
+
topic: 'React Hooks',
|
|
677
|
+
content: 'useState and useEffect basics',
|
|
678
|
+
understanding: 'medium',
|
|
679
|
+
questions: ['When should I use useEffect?', 'What is the dependency array?']
|
|
680
|
+
});
|
|
681
|
+
|
|
682
|
+
await recordLearningSession({
|
|
683
|
+
studentId: 'student_456',
|
|
684
|
+
topic: 'TypeScript',
|
|
685
|
+
content: 'Type annotations and interfaces',
|
|
686
|
+
understanding: 'high',
|
|
687
|
+
questions: []
|
|
688
|
+
});
|
|
689
|
+
|
|
690
|
+
const explanation = await adaptiveTutor('student_456', 'Explain useMemo to me');
|
|
691
|
+
// Returns: "Since you understand TypeScript well, think of useMemo as adding
|
|
692
|
+
// type safety to your computed values - it 'memoizes' them. Like how TypeScript
|
|
693
|
+
// prevents you from accidentally changing a type, useMemo prevents unnecessary
|
|
694
|
+
// recalculations..."
|
|
695
|
+
```
|
|
696
|
+
|
|
697
|
+
### Key Benefits
|
|
698
|
+
- Personalized learning pace
|
|
699
|
+
- Adapts to learning style
|
|
700
|
+
- Identifies knowledge gaps
|
|
701
|
+
- Builds on existing strengths
|
|
702
|
+
|
|
703
|
+
---
|
|
704
|
+
|
|
705
|
+
## 7. Multi-Tenant SaaS Application
|
|
706
|
+
|
|
707
|
+
Isolate data per organization while enabling shared knowledge bases.
|
|
708
|
+
|
|
709
|
+
### Implementation
|
|
710
|
+
|
|
711
|
+
```typescript
|
|
712
|
+
import { Supermemory } from 'supermemory';
|
|
713
|
+
|
|
714
|
+
const memory = new Supermemory();
|
|
715
|
+
|
|
716
|
+
interface Organization {
|
|
717
|
+
id: string;
|
|
718
|
+
name: string;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
interface User {
|
|
722
|
+
id: string;
|
|
723
|
+
orgId: string;
|
|
724
|
+
name: string;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
// Container tag strategy
|
|
728
|
+
function getContainerTags(orgId: string, userId: string) {
|
|
729
|
+
return {
|
|
730
|
+
org: `org_${orgId}`,
|
|
731
|
+
user: `org_${orgId}_user_${userId}`,
|
|
732
|
+
shared: `org_${orgId}_shared`
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
// 1. Store organization-wide knowledge
|
|
737
|
+
async function addOrgKnowledge(orgId: string, content: string) {
|
|
738
|
+
const tags = getContainerTags(orgId, '');
|
|
739
|
+
|
|
740
|
+
await memory.add({
|
|
741
|
+
content,
|
|
742
|
+
containerTag: tags.shared,
|
|
743
|
+
metadata: {
|
|
744
|
+
type: 'org_knowledge',
|
|
745
|
+
visibility: 'organization'
|
|
746
|
+
}
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
// 2. Store user-specific data
|
|
751
|
+
async function addUserData(orgId: string, userId: string, content: string) {
|
|
752
|
+
const tags = getContainerTags(orgId, userId);
|
|
753
|
+
|
|
754
|
+
await memory.add({
|
|
755
|
+
content,
|
|
756
|
+
containerTag: tags.user,
|
|
757
|
+
metadata: {
|
|
758
|
+
type: 'user_data',
|
|
759
|
+
visibility: 'private'
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
// 3. Search with proper isolation
|
|
765
|
+
async function search(orgId: string, userId: string, query: string, includeShared: boolean = true) {
|
|
766
|
+
const tags = getContainerTags(orgId, userId);
|
|
767
|
+
|
|
768
|
+
const containerTags = includeShared
|
|
769
|
+
? [tags.user, tags.shared] // User + org shared
|
|
770
|
+
: [tags.user]; // User only
|
|
771
|
+
|
|
772
|
+
const results = await memory.search.memories({
|
|
773
|
+
q: query,
|
|
774
|
+
containerTag: containerTags[0], // Use first tag
|
|
775
|
+
threshold: 0.3,
|
|
776
|
+
limit: 10
|
|
777
|
+
});
|
|
778
|
+
|
|
779
|
+
return results;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
// Usage
|
|
783
|
+
const org1 = 'acme_corp';
|
|
784
|
+
const org2 = 'other_corp';
|
|
785
|
+
const user1 = 'alice';
|
|
786
|
+
const user2 = 'bob';
|
|
787
|
+
|
|
788
|
+
// Organization-wide knowledge (visible to all users in org)
|
|
789
|
+
await addOrgKnowledge(org1, 'Company policy: Remote work allowed');
|
|
790
|
+
await addOrgKnowledge(org2, 'Company policy: Office-only');
|
|
791
|
+
|
|
792
|
+
// User-specific data (visible only to that user)
|
|
793
|
+
await addUserData(org1, user1, 'Alice prefers dark mode');
|
|
794
|
+
await addUserData(org1, user2, 'Bob prefers light mode');
|
|
795
|
+
|
|
796
|
+
// Alice searches (sees org1 shared + her own data)
|
|
797
|
+
const aliceResults = await search(org1, user1, 'work policy');
|
|
798
|
+
// Returns: "Company policy: Remote work allowed" ✅
|
|
799
|
+
// Does NOT return: Bob's preferences ✅
|
|
800
|
+
// Does NOT return: org2 data ✅
|
|
801
|
+
|
|
802
|
+
// Bob searches (sees org1 shared + his own data)
|
|
803
|
+
const bobResults = await search(org1, user2, 'preferences');
|
|
804
|
+
// Returns: "Bob prefers light mode" ✅
|
|
805
|
+
// Does NOT return: Alice's preferences ✅
|
|
806
|
+
```
|
|
807
|
+
|
|
808
|
+
### Key Benefits
|
|
809
|
+
- Perfect data isolation per tenant
|
|
810
|
+
- Shared knowledge bases
|
|
811
|
+
- Flexible visibility controls
|
|
812
|
+
- Scales to thousands of organizations
|
|
813
|
+
|
|
814
|
+
---
|
|
815
|
+
|
|
816
|
+
## 8. Research Assistant
|
|
817
|
+
|
|
818
|
+
Manage research papers, notes, and insights with automatic relationship discovery.
|
|
819
|
+
|
|
820
|
+
### Implementation
|
|
821
|
+
|
|
822
|
+
```typescript
|
|
823
|
+
import { Supermemory } from 'supermemory';
|
|
824
|
+
|
|
825
|
+
const memory = new Supermemory();
|
|
826
|
+
|
|
827
|
+
interface Paper {
|
|
828
|
+
title: string;
|
|
829
|
+
authors: string[];
|
|
830
|
+
abstract: string;
|
|
831
|
+
url: string;
|
|
832
|
+
year: number;
|
|
833
|
+
}
|
|
834
|
+
|
|
835
|
+
async function addPaper(userId: string, paper: Paper) {
|
|
836
|
+
await memory.add({
|
|
837
|
+
content: `
|
|
838
|
+
Title: ${paper.title}
|
|
839
|
+
Authors: ${paper.authors.join(', ')}
|
|
840
|
+
Year: ${paper.year}
|
|
841
|
+
Abstract: ${paper.abstract}
|
|
842
|
+
URL: ${paper.url}
|
|
843
|
+
`,
|
|
844
|
+
containerTag: `${userId}_research`,
|
|
845
|
+
customId: paper.url,
|
|
846
|
+
metadata: {
|
|
847
|
+
type: 'paper',
|
|
848
|
+
year: paper.year,
|
|
849
|
+
authors: paper.authors,
|
|
850
|
+
title: paper.title
|
|
851
|
+
}
|
|
852
|
+
});
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
async function addResearchNote(userId: string, note: string, relatedPapers: string[]) {
|
|
856
|
+
await memory.add({
|
|
857
|
+
content: note,
|
|
858
|
+
containerTag: `${userId}_research`,
|
|
859
|
+
metadata: {
|
|
860
|
+
type: 'note',
|
|
861
|
+
relatedPapers,
|
|
862
|
+
createdAt: new Date().toISOString()
|
|
863
|
+
}
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
async function findRelatedResearch(userId: string, topic: string) {
|
|
868
|
+
const results = await memory.search.memories({
|
|
869
|
+
q: topic,
|
|
870
|
+
containerTag: `${userId}_research`,
|
|
871
|
+
threshold: 0.3,
|
|
872
|
+
limit: 20
|
|
873
|
+
});
|
|
874
|
+
|
|
875
|
+
// Group by type
|
|
876
|
+
const papers = results.filter(r => r.metadata?.type === 'paper');
|
|
877
|
+
const notes = results.filter(r => r.metadata?.type === 'note');
|
|
878
|
+
|
|
879
|
+
return { papers, notes };
|
|
880
|
+
}
|
|
881
|
+
|
|
882
|
+
async function synthesizeInsights(userId: string, research_question: string) {
|
|
883
|
+
const related = await findRelatedResearch(userId, research_question);
|
|
884
|
+
|
|
885
|
+
const context = [
|
|
886
|
+
'=== Related Papers ===',
|
|
887
|
+
...related.papers.map(p => p.content),
|
|
888
|
+
'\n=== Your Notes ===',
|
|
889
|
+
...related.notes.map(n => n.content)
|
|
890
|
+
].join('\n\n');
|
|
891
|
+
|
|
892
|
+
const { text } = await generateText({
|
|
893
|
+
model: anthropic('claude-3-5-sonnet-20241022'),
|
|
894
|
+
system: `
|
|
895
|
+
You are a research assistant helping synthesize insights from papers and notes.
|
|
896
|
+
|
|
897
|
+
Relevant Research:
|
|
898
|
+
${context}
|
|
899
|
+
|
|
900
|
+
Provide a synthesis that connects ideas across papers and notes.
|
|
901
|
+
`,
|
|
902
|
+
prompt: research_question
|
|
903
|
+
});
|
|
904
|
+
|
|
905
|
+
return text;
|
|
906
|
+
}
|
|
907
|
+
|
|
908
|
+
// Usage
|
|
909
|
+
await addPaper('researcher_123', {
|
|
910
|
+
title: 'Attention Is All You Need',
|
|
911
|
+
authors: ['Vaswani et al.'],
|
|
912
|
+
year: 2017,
|
|
913
|
+
abstract: 'We propose a new simple network architecture, the Transformer...',
|
|
914
|
+
url: 'https://arxiv.org/abs/1706.03762'
|
|
915
|
+
});
|
|
916
|
+
|
|
917
|
+
await addPaper('researcher_123', {
|
|
918
|
+
title: 'BERT: Pre-training of Deep Bidirectional Transformers',
|
|
919
|
+
authors: ['Devlin et al.'],
|
|
920
|
+
year: 2018,
|
|
921
|
+
abstract: 'We introduce a new language representation model called BERT...',
|
|
922
|
+
url: 'https://arxiv.org/abs/1810.04805'
|
|
923
|
+
});
|
|
924
|
+
|
|
925
|
+
await addResearchNote(
|
|
926
|
+
'researcher_123',
|
|
927
|
+
'BERT builds on the Transformer architecture introduced in "Attention Is All You Need"',
|
|
928
|
+
['https://arxiv.org/abs/1706.03762', 'https://arxiv.org/abs/1810.04805']
|
|
929
|
+
);
|
|
930
|
+
|
|
931
|
+
const synthesis = await synthesizeInsights(
|
|
932
|
+
'researcher_123',
|
|
933
|
+
'How did transformers evolve from 2017 to 2018?'
|
|
934
|
+
);
|
|
935
|
+
// Returns: "The Transformer architecture (Vaswani et al., 2017) introduced
|
|
936
|
+
// self-attention mechanisms. BERT (Devlin et al., 2018) extended this by
|
|
937
|
+
// adding bidirectional pre-training, as noted in your research notes..."
|
|
938
|
+
```
|
|
939
|
+
|
|
940
|
+
### Key Benefits
|
|
941
|
+
- Automatic relationship discovery between papers
|
|
942
|
+
- Connect notes to relevant research
|
|
943
|
+
- Synthesize insights across sources
|
|
944
|
+
- Never lose track of references
|
|
945
|
+
|
|
946
|
+
---
|
|
947
|
+
|
|
948
|
+
## Common Patterns Across Use Cases
|
|
949
|
+
|
|
950
|
+
### Pattern 1: Context Retrieval Before Generation
|
|
951
|
+
|
|
952
|
+
```typescript
|
|
953
|
+
// Always retrieve context first
|
|
954
|
+
const response = await memory.profile({
|
|
955
|
+
containerTag: userId,
|
|
956
|
+
q: userMessage
|
|
957
|
+
});
|
|
958
|
+
|
|
959
|
+
// Then use in generation
|
|
960
|
+
const staticFacts = response.profile.static.join('\n');
|
|
961
|
+
const dynamicFacts = response.profile.dynamic.join('\n');
|
|
962
|
+
|
|
963
|
+
const llmResponse = await generateText({
|
|
964
|
+
system: `User Profile:\n${staticFacts}\n\nRecent Context:\n${dynamicFacts}`,
|
|
965
|
+
prompt: userMessage
|
|
966
|
+
});
|
|
967
|
+
```
|
|
968
|
+
|
|
969
|
+
### Pattern 2: Store After Interaction
|
|
970
|
+
|
|
971
|
+
```typescript
|
|
972
|
+
// Always store the result
|
|
973
|
+
await memory.add({
|
|
974
|
+
content: `Input: ${input}\nOutput: ${output}`,
|
|
975
|
+
containerTag: userId,
|
|
976
|
+
metadata: { timestamp: new Date().toISOString() }
|
|
977
|
+
});
|
|
978
|
+
```
|
|
979
|
+
|
|
980
|
+
### Pattern 3: Rich Metadata for Filtering
|
|
981
|
+
|
|
982
|
+
```typescript
|
|
983
|
+
await memory.add({
|
|
984
|
+
content: data,
|
|
985
|
+
containerTag: userId,
|
|
986
|
+
metadata: {
|
|
987
|
+
type: 'conversation',
|
|
988
|
+
category: 'support',
|
|
989
|
+
priority: 'high',
|
|
990
|
+
tags: ['billing', 'urgent'],
|
|
991
|
+
timestamp: new Date().toISOString()
|
|
992
|
+
}
|
|
993
|
+
});
|
|
994
|
+
|
|
995
|
+
// Later filter by metadata
|
|
996
|
+
const results = await memory.search.memories({
|
|
997
|
+
q: 'billing issues',
|
|
998
|
+
containerTag: 'user_123',
|
|
999
|
+
filters: {
|
|
1000
|
+
metadata: { priority: 'high', type: 'conversation' }
|
|
1001
|
+
}
|
|
1002
|
+
});
|
|
1003
|
+
```
|
|
1004
|
+
|
|
1005
|
+
### Pattern 4: Hierarchical Container Tags
|
|
1006
|
+
|
|
1007
|
+
```typescript
|
|
1008
|
+
// Organization → Team → User hierarchy
|
|
1009
|
+
const tags = {
|
|
1010
|
+
org: `org_${orgId}`,
|
|
1011
|
+
team: `org_${orgId}_team_${teamId}`,
|
|
1012
|
+
user: `org_${orgId}_team_${teamId}_user_${userId}`
|
|
1013
|
+
};
|
|
1014
|
+
|
|
1015
|
+
// Search at appropriate level
|
|
1016
|
+
const orgWide = await memory.search.memories({
|
|
1017
|
+
q: 'company policies',
|
|
1018
|
+
containerTag: tags.org,
|
|
1019
|
+
limit: 10
|
|
1020
|
+
});
|
|
1021
|
+
|
|
1022
|
+
const teamSpecific = await memory.search.memories({
|
|
1023
|
+
q: 'team resources',
|
|
1024
|
+
containerTag: tags.team,
|
|
1025
|
+
limit: 10
|
|
1026
|
+
});
|
|
1027
|
+
```
|
|
1028
|
+
|
|
1029
|
+
## Next Steps
|
|
1030
|
+
|
|
1031
|
+
Ready to build your own use case? Start with the [Quickstart Guide](quickstart.md) or explore the [SDK Documentation](sdk-guide.md).
|
|
1032
|
+
|
|
1033
|
+
For questions or custom use cases, visit [console.supermemory.ai](https://console.supermemory.ai).
|