Conversation
- Refactored stock analysis agent's reasoning protocol for clarity and conciseness, consolidating multiple analysis frameworks into a streamlined process. - Updated data gathering and analysis phases in the stock analysis agent to improve efficiency and clarity. - Added tool efficiency guidelines to the weather agent to prevent repetitive tool usage. - Changed index configuration in pg-storage from 'flat' to 'hnsw' for improved performance with high-dimensional embeddings. - Cleaned up memory template in pg-storage for better readability and organization. - Updated web scraper tool to introduce new schemas for crawling, extraction, request, and storage options, enhancing configurability. - Improved output structure in web scraper tool to better organize extracted content and analysis results. - Introduced a new chat sidebar component for displaying agent details, features, checkpoints, and memory settings in a user-friendly manner.
Learn moreAll Green is an AI agent that automatically: ✅ Addresses code review comments ✅ Fixes failing CI checks ✅ Resolves merge conflicts |
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Reviewer's GuideRefactors multiple agents’ system prompts for a more concise reasoning protocol while adding a cross-cutting 'tool efficiency' rule, restructures the web scraper tool’s input/output schemas, switches Postgres pg-vector indexes to HNSW with a simplified memory template, and significantly enhances the chat UI with model/agent selection, context display, checkpoints, speech input, and a new sidebar layout plus Gemini 3 model support. Sequence diagram for enhanced chat interaction with model/agent selection and sidebarsequenceDiagram
actor User
participant ChatPage
participant ChatInput
participant ChatSidebar
participant ChatContext
participant AgentBackend
User->>ChatPage: Open /chat
ChatPage->>ChatContext: Initialize with defaultAgent
ChatPage->>ChatHeader: Render with context
ChatPage->>ChatSidebar: Render with agentConfig, checkpoints, memory
ChatPage->>ChatInput: Render with selectedAgent, selectedModel
User->>ChatInput: Select model via ModelSelector
ChatInput->>ChatContext: selectModel(modelId)
ChatContext-->>ChatInput: updated selectedModel
ChatContext-->>ChatSidebar: updated selectedModel (indirect via provider)
User->>ChatInput: Select agent via AgentSelector
ChatInput->>ChatContext: selectAgent(agentId)
ChatContext-->>ChatSidebar: updated agentConfig
User->>ChatInput: Dictate message via SpeechButton
ChatInput->>SpeechButton: start transcription
SpeechButton-->>ChatInput: onTranscriptionChange(text)
User->>ChatInput: Press Send
ChatInput->>ChatContext: sendMessage(text, files)
ChatContext->>AgentBackend: invoke agent with selectedModel and agentConfig
AgentBackend-->>ChatContext: streamed response
ChatContext-->>ChatMessages: append messages
User->>ChatInput: Create checkpoint
ChatInput->>ChatContext: createCheckpoint(lastMessageIndex)
ChatContext-->>ChatSidebar: checkpoints updated
User->>ChatSidebar: Update threadId/resourceId
ChatSidebar->>ChatContext: setThreadId, setResourceId
ChatContext-->>AgentBackend: use updated memory config on next call
Class diagram for updated webScraperTool schemasclassDiagram
class WebScraperInput {
+string url
+string? selector
+string[]? attributes
+CrawlingOptions? crawling
+ExtractionOptions? extraction
+RequestOptions? request
+StorageOptions? storage
}
class CrawlingOptions {
+int? depth
+int? maxPages
+bool? followLinks
+bool? respectRobotsTxt
+int? delayBetweenRequests
}
class ExtractionOptions {
+bool? includeImages
+bool? extractMetadata
+ContentType? contentType
+bool? extractStructuredData
+bool? languageDetection
+ContentFilteringOptions? contentFiltering
}
class ContentFilteringOptions {
+int? minLength
+int? maxLength
+string[]? keywords
+string[]? excludePatterns
}
class RequestOptions {
+int? timeout
+string? userAgent
+Map~string,string~? headers
+int? retryAttempts
+bool? compression
+Map~string,string~? cookies
}
class StorageOptions {
+bool? saveMarkdown
+string? markdownFileName
+OutputFormat? outputFormat
}
class WebScraperOutput {
+string url
+string status
+string? errorMessage
+ScrapedContent content
+StorageInfo? storage
+AnalysisResult? analysis
}
class ScrapedContent {
+Map~string,string~[] extractedData
+string? rawContent
+string? markdownContent
}
class StorageInfo {
+string? savedFilePath
}
class AnalysisResult {
+Map~string,string~? metadata
+ImageInfo[]? images
+any[]? structuredData
+string? detectedLanguage
}
class ImageInfo {
+string src
+string? alt
+string? title
}
class ContentType {
}
class OutputFormat {
}
WebScraperInput --> CrawlingOptions : uses
WebScraperInput --> ExtractionOptions : uses
WebScraperInput --> RequestOptions : uses
WebScraperInput --> StorageOptions : uses
ExtractionOptions --> ContentFilteringOptions : uses
WebScraperOutput --> ScrapedContent : contains
WebScraperOutput --> StorageInfo : contains
WebScraperOutput --> AnalysisResult : contains
AnalysisResult --> ImageInfo : contains
ExtractionOptions --> ContentType : enum
StorageOptions --> OutputFormat : enum
Class diagram for enhanced Chat UI layout and componentsclassDiagram
class ChatPage {
+render()
}
class ChatProvider {
+string defaultAgent
+provideChatContext()
}
class ChatHeader {
+render()
}
class ChatMessages {
+render()
}
class ChatInput {
-string input
-TextareaRef textareaRef
+handleSubmit(message)
+setInput(value)
}
class ChatSidebar {
+render()
}
class ChatContext {
+bool isLoading
+string status
+AgentConfig agentConfig
+string selectedAgent
+ModelConfig selectedModel
+Message[] messages
+Usage usage
+Checkpoint[] checkpoints
+string threadId
+string resourceId
+sendMessage(text,files)
+stopGeneration()
+selectModel(modelId)
+selectAgent(agentId)
+createCheckpoint(index)
+restoreCheckpoint(id)
+setThreadId(id)
+setResourceId(id)
}
class AgentConfig {
+string name
+string category
+string description
+AgentFeatures features
}
class AgentFeatures {
+bool reasoning
+bool tools
+bool sources
+bool canvas
+bool artifacts
+bool plan
+bool task
+bool webPreview
}
class ModelConfig {
+string id
+string name
+string provider
+int contextWindow
+bool? isDefault
}
class Checkpoint {
+string id
+string? label
+int messageCount
+Date timestamp
}
class ChatInputToolbar {
+ModelSelector
+AgentSelector
+ContextDisplay
+SpeechButton
+AttachmentMenu
+CheckpointButton
}
class ModelSelector {
+open()
+selectModel(modelId)
}
class ContextDisplay {
+int usedTokens
+int maxTokens
}
class SpeechButton {
+onTranscriptionChange(text)
}
ChatPage --> ChatProvider : wraps
ChatPage --> ChatHeader : contains
ChatPage --> ChatMessages : contains
ChatPage --> ChatInput : contains
ChatPage --> ChatSidebar : contains
ChatProvider --> ChatContext : provides
ChatHeader --> ChatContext : uses
ChatMessages --> ChatContext : uses
ChatInput --> ChatContext : uses
ChatSidebar --> ChatContext : uses
ChatInput --> ChatInputToolbar : contains
ChatInputToolbar --> ModelSelector : uses
ChatInputToolbar --> ContextDisplay : uses
ChatInputToolbar --> SpeechButton : uses
ChatContext --> AgentConfig : returns
ChatContext --> ModelConfig : returns
ChatContext --> Checkpoint : manages
AgentConfig --> AgentFeatures : has
ModelSelector --> ModelConfig : lists
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Summary by CodeRabbitRelease Notes
✏️ Tip: You can customize this high-level summary in your review settings. WalkthroughThis PR introduces extensive chat UI enhancements with model/agent selection, a new ChatSidebar for agent configuration, Gemini 3 model support, refactors 20+ agent prompts to simplified formats, restructures the web-scraper tool's input/output schemas, updates storage indexing to HNSW, and enables new mastra runtime features. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant ChatInput
participant ChatContext
participant AgentProvider
User->>ChatInput: Select Agent (dropdown)
ChatInput->>ChatContext: selectAgent(agentId)
ChatContext->>ChatContext: Update agent state
User->>ChatInput: Select Model (dropdown)
ChatInput->>ChatContext: selectModel(modelId)
ChatContext->>ChatContext: Update model state
User->>ChatInput: Type message & attach files
ChatInput->>ChatInput: Manage input state + attachments
User->>ChatInput: Click Send or Create Checkpoint
alt Create Checkpoint
ChatInput->>ChatContext: createCheckpoint(messageIndex)
ChatContext->>ChatContext: Store checkpoint state
ChatContext-->>ChatInput: Checkpoint created
else Send Message
ChatInput->>ChatContext: Submit with selected agent/model
ChatContext->>AgentProvider: Route to agent with model
AgentProvider-->>ChatContext: Response
ChatContext-->>ChatInput: Update messages
ChatInput->>ChatInput: Clear input, refresh sidebar
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
🤖 Hi @ssdeanx, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
Summary of ChangesHello @ssdeanx, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a suite of enhancements across the application, primarily focusing on improving the user experience in the chat interface, expanding AI model capabilities, and optimizing backend agent logic and data storage. Key changes include a redesigned chat UI with a new sidebar and advanced input features, integration of the latest Google Gemini 3 models, and a widespread refactoring of agent prompts to improve their reasoning and tool-use efficiency. Additionally, data storage mechanisms have been optimized, and the web scraping tool has gained more sophisticated configuration options. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
🤖 I'm sorry @ssdeanx, but I was unable to process your request. Please see the logs for more details. |
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The
webScraperToolinput/output schemas now use nestedcrawling/extraction/request/storageobjects and wrap content/metadata intocontent,storage, andanalysis; if any existing tools or agents are still calling the old flat schema or reading top-levelextractedData/metadata/images, they will break—consider either adding compatibility shims or updating all known call sites in this PR. - In
pg-storage.ts, the comment on theindexConfigstill describes a flat index and IVF lists, but the config was switched totype: 'hnsw'with HNSW params—update the comment to match the actual index type and parameters so future tuning isn't misled by stale documentation in code. - Several Tailwind class changes (e.g.,
min-w-35,w-85,max-h-100,min-w-30) inchat-header.tsxandnetwork-header.tsxdon't correspond to standard Tailwind utility names; if these aren't custom tokens in your config they will be ignored—consider switching to valid classes (e.g.,min-w-[140px],w-[340px],max-h-[400px]) or defining matching custom sizes.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `webScraperTool` input/output schemas now use nested `crawling/extraction/request/storage` objects and wrap content/metadata into `content`, `storage`, and `analysis`; if any existing tools or agents are still calling the old flat schema or reading top-level `extractedData/metadata/images`, they will break—consider either adding compatibility shims or updating all known call sites in this PR.
- In `pg-storage.ts`, the comment on the `indexConfig` still describes a flat index and IVF lists, but the config was switched to `type: 'hnsw'` with HNSW params—update the comment to match the actual index type and parameters so future tuning isn't misled by stale documentation in code.
- Several Tailwind class changes (e.g., `min-w-35`, `w-85`, `max-h-100`, `min-w-30`) in `chat-header.tsx` and `network-header.tsx` don't correspond to standard Tailwind utility names; if these aren't custom tokens in your config they will be ignored—consider switching to valid classes (e.g., `min-w-[140px]`, `w-[340px]`, `max-h-[400px]`) or defining matching custom sizes.
## Individual Comments
### Comment 1
<location> `src/mastra/config/pg-storage.ts:99-101` </location>
<code_context>
scope: 'resource', // 'resource' | 'thread'
// HNSW index configuration to support high-dimensional embeddings (>2000 dimensions)
indexConfig: {
- type: 'flat', // flat index type (supports dimensions > 4000, unlike HNSW limit of 2000)
+ type: 'hnsw', // flat index type (supports dimensions > 4000, unlike HNSW limit of 2000)
metric: 'cosine', // Distance metric for normalized embeddings
- ivf: {lists: parseInt(process.env.LISTS ?? '3072')}, // IVF configuration for flat index
+ hnsw: { m: 16, efConstruction: 64 } // hnsw configuration
},
threshold: 0.75, // Similarity threshold for semantic recall
</code_context>
<issue_to_address>
**nitpick:** Index type was switched to `hnsw` but the inline comments still reference `flat`/IVF and high-dimension constraints.
Comments still describe a flat/IVF index and dimension limits that no longer apply. Please update them to reflect the HNSW config and its actual trade-offs (e.g., memory vs recall, M/efConstruction) so future tuning isn’t based on outdated assumptions.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| type: 'flat', // flat index type (supports dimensions > 4000, unlike HNSW limit of 2000) | ||
| type: 'hnsw', // flat index type (supports dimensions > 4000, unlike HNSW limit of 2000) | ||
| metric: 'cosine', // Distance metric for normalized embeddings | ||
| ivf: {lists: parseInt(process.env.LISTS ?? '3072')}, // IVF configuration for flat index |
There was a problem hiding this comment.
nitpick: Index type was switched to hnsw but the inline comments still reference flat/IVF and high-dimension constraints.
Comments still describe a flat/IVF index and dimension limits that no longer apply. Please update them to reflect the HNSW config and its actual trade-offs (e.g., memory vs recall, M/efConstruction) so future tuning isn’t based on outdated assumptions.
There was a problem hiding this comment.
Code Review
This pull request introduces a wide range of enhancements, including a major UI overhaul for the chat interface with a new sidebar and improved input controls, support for new Gemini models, and significant refactoring of agent prompts for conciseness and clarity. The changes are generally well-implemented. My review includes a few suggestions to improve code clarity, fix a potential runtime error related to date parsing, and address some minor inconsistencies and cleanup opportunities. Specifically, I've pointed out some redundant boolean checks, an incorrect comment in the pg-storage configuration, and some cleanup opportunities in the newly added components and middleware.
| className, | ||
| }: AgentCheckpointProps) { | ||
| const date = timestamp ? (typeof timestamp === 'string' ? new Date(timestamp) : timestamp) : undefined | ||
| const date = timestamp !== undefined ? (typeof timestamp === 'string' ? new Date(timestamp) : timestamp) : undefined |
There was a problem hiding this comment.
This change might introduce a runtime error. The original check timestamp ? ... correctly handled falsy values like an empty string (''), treating it as undefined. The new check timestamp !== undefined will be true for an empty string. This leads to new Date(''), which creates an Invalid Date object. If formatTime doesn't handle invalid dates, this will likely throw a RangeError. It's safer to stick with the original truthiness check or add a specific check for empty strings.
| const date = timestamp !== undefined ? (typeof timestamp === 'string' ? new Date(timestamp) : timestamp) : undefined | |
| const date = timestamp ? (typeof timestamp === 'string' ? new Date(timestamp) : timestamp) : undefined |
| const completedCount = useMemo(() => steps.filter((s) => s.status === "complete").length, [steps]) | ||
| const activeStep = useMemo(() => steps.find((s) => s.status === "active"), [steps]) | ||
|
|
||
| if (steps.length === 0) {return null} |
There was a problem hiding this comment.
For better performance, it's a good practice to have early returns at the beginning of the function body, before any hooks like useMemo are called. This avoids unnecessary computations when the component is going to return null anyway. Consider moving the if (steps.length === 0) check to be the first line in the component.
| status={step.status} | ||
| > | ||
| {step.duration && step.status === "complete" && ( | ||
| {(Boolean(step.duration)) && step.status === "complete" && ( |
There was a problem hiding this comment.
The explicit (Boolean(step.duration)) check is redundant. The original step.duration check is idiomatic in JavaScript/TypeScript for checking for truthy values (non-zero numbers, non-empty strings, etc.) and is more concise. I'd recommend simplifying this for better readability.
| {(Boolean(step.duration)) && step.status === "complete" && ( | |
| {step.duration && step.status === "complete" && ( |
| </QueueItemActions> | ||
| </div> | ||
| {task.description && ( | ||
| {(Boolean(task.description)) && ( |
| <QueueItemDescription>{task.description}</QueueItemDescription> | ||
| )} | ||
| {task.error && ( | ||
| {(Boolean(task.error)) && ( |
| <ModelSelectorItem | ||
| key={agent.id} | ||
| onSelect={() => selectAgent(agent.id)} | ||
| className={cn(selectedAgent === agent.id && "bg-accent")} | ||
| > | ||
| {agent.name} | ||
| </ModelSelectorItem> |
There was a problem hiding this comment.
For consistency with chat-header.tsx and to ensure search functionality within the ModelSelector works as expected, it's a good practice to add the value prop to ModelSelectorItem. In chat-header.tsx, this was explicitly set to agent.name.
<ModelSelectorItem
key={agent.id}
value={agent.name}
onSelect={() => selectAgent(agent.id)}
className={cn(selectedAgent === agent.id && "bg-accent")}
>
{agent.name}
</ModelSelectorItem>
| import { | ||
| BotIcon, | ||
| CpuIcon, | ||
| HistoryIcon, | ||
| BookmarkIcon, | ||
| SettingsIcon, | ||
| DatabaseIcon, | ||
| HashIcon, | ||
| UserIcon, | ||
| CheckCircle2Icon, | ||
| CircleIcon, | ||
| InfoIcon, | ||
| } from "lucide-react" |
There was a problem hiding this comment.
| // HNSW index configuration to support high-dimensional embeddings (>2000 dimensions) | ||
| indexConfig: { | ||
| type: 'flat', // flat index type (supports dimensions > 4000, unlike HNSW limit of 2000) | ||
| type: 'hnsw', // flat index type (supports dimensions > 4000, unlike HNSW limit of 2000) |
There was a problem hiding this comment.
The index type has been changed to hnsw, but the comment still describes the flat index type and its dimension limits. This comment is now misleading and should be updated to reflect the use of HNSW.
| type: 'hnsw', // flat index type (supports dimensions > 4000, unlike HNSW limit of 2000) | |
| type: 'hnsw', // HNSW index type for improved performance with high-dimensional embeddings |
| // if (requestContext?.set) { | ||
| const requestContext = c.get('requestContext') as RequestContext | undefined | ||
| if (requestContext?.set) { | ||
| // // Temperature unit (from Cloudflare geo header) |
There was a problem hiding this comment.
| // runtime API key (for tools that may accept runtimeContext.apiKey) | ||
| // if (apiKeyHeader !== null && apiKeyHeader !== '') { requestContext.set('apiKey', apiKeyHeader) } | ||
| // } | ||
| // if (apiKeyHeader !== null && apiKeyHeader !== '') { requestContext.set('apiKey', apiKeyHeader) } |
There was a problem hiding this comment.
Actionable comments posted: 20
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (8)
app/chat/components/agent-queue.tsx (1)
120-127: Remove unnecessary parentheses around Boolean() calls.The extra parentheses wrapping
Boolean(task.description)andBoolean(task.error)add visual clutter without providing value. Standard syntax{Boolean(value) && ...}is clearer.Additionally, note the inconsistency with line 128, which uses a direct truthy check
task.createdAt &&withoutBoolean(). For string properties (whichdescriptionanderrorlikely are), both approaches behave identically. Consider applying the same pattern consistently throughout.🔎 Proposed refactor to simplify
- {(Boolean(task.description)) && ( + {Boolean(task.description) && ( <QueueItemDescription>{task.description}</QueueItemDescription> )} - {(Boolean(task.error)) && ( + {Boolean(task.error) && ( <QueueItemDescription className="text-destructive"> {task.error} </QueueItemDescription> )}Or, for consistency with line 128, you could use direct truthy checks if
descriptionanderrorare typed asstring | undefined:- {(Boolean(task.description)) && ( + {task.description && ( <QueueItemDescription>{task.description}</QueueItemDescription> )} - {(Boolean(task.error)) && ( + {task.error && ( <QueueItemDescription className="text-destructive"> {task.error} </QueueItemDescription> )}src/mastra/agents/scriptWriterAgent.ts (3)
5-5: Remove unused importBaseSpan.
BaseSpanis imported but never used in this file. Per coding guidelines, eliminate dead code.🔎 Proposed fix
-import { BaseSpan } from '@mastra/observability';
59-61: Update misleading comment.The comment states "Chat bison for pro as well" but the code returns
googleAI, which is a configured model instance from../config/google. The comment should accurately reflect what model is being used.🔎 Proposed fix
} else if (userTier === 'pro') { - // Chat bison for pro as well + // Use configured Google AI model for pro tier return googleAI }
67-69: Consider removing empty configuration objects.The
options: {}andscorers: {}are empty and could be omitted if they're not required by theAgentinterface, reducing visual noise.🔎 Proposed fix (if not required by interface)
memory: pgMemory, - options: {}, - scorers: { - }, tools: {src/mastra/agents/acpAgent.ts (2)
20-23: Add TSDoc documentation for the public interface.The
ACPContextinterface lacks documentation. According to coding guidelines, public APIs should be documented with TSDoc comments.🔎 Suggested TSDoc documentation
+/** + * Context information for ACP Agent requests. + * + * @property userId - Optional user identifier for the request + * @property userRole - Optional role constraint for the user (e.g., 'user', 'admin') + */ export interface ACPContext { userId?: string userRole?: string }
95-97: Remove the commented-out supermemory tools integration.The commented-out code at lines 95-97 should be removed entirely. Maintaining commented code blocks violates the coding guideline: "Avoid commenting out dead code. Use version control instead." There are no associated TODOs, FIXMEs, or tracking issues indicating planned development on this feature. If supermemory integration is planned, either add a TODO comment with the tracking issue reference or implement the feature with a proper configuration/feature flag approach instead of keeping commented code.
src/mastra/agents/package-publisher.ts (1)
171-172: Remove commented-out code or convert to proper TODO.The commented-out
tracingPolicyconfiguration violates the coding guideline: "No commented-out code or unresolved TODO comments without associated tickets should remain in commits."If the tracing policy is not needed, remove the commented code entirely. If this is a feature that needs to be implemented later, convert it to a proper TODO comment with an associated ticket reference.
As per coding guidelines, rely on git history rather than maintaining commented code blocks.
app/chat/components/chat-header.tsx (1)
283-298: Inconsistentvalueprop: usesagent.nameinstead ofagent.id.The
ModelSelectorItemfor agents usesvalue={agent.name}(line 285), while the model selector usesvalue={model.id}(line 235). Using display names as values can cause issues if two agents share the same name, and creates inconsistency between selectors.🔎 Proposed fix
<ModelSelectorItem key={agent.id} - value={agent.name} + value={agent.id} onSelect={() => handleSelectAgent(agent)} className="flex items-center justify-between" >
📜 Review details
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (37)
Copilot-Processing.mdapp/chat/components/agent-chain-of-thought.tsxapp/chat/components/agent-checkpoint.tsxapp/chat/components/agent-inline-citation.tsxapp/chat/components/agent-queue.tsxapp/chat/components/chat-header.tsxapp/chat/components/chat-input.tsxapp/chat/components/chat-sidebar.tsxapp/chat/config/google-models.tsapp/chat/config/models.tsapp/chat/page.tsxapp/networks/components/network-header.tsxapp/workflows/page.tsxsrc/mastra/agents/acpAgent.tssrc/mastra/agents/businessLegalAgents.tssrc/mastra/agents/codingAgents.tssrc/mastra/agents/contentStrategistAgent.tssrc/mastra/agents/copywriterAgent.tssrc/mastra/agents/dane.tssrc/mastra/agents/dataExportAgent.tssrc/mastra/agents/dataIngestionAgent.tssrc/mastra/agents/documentProcessingAgent.tssrc/mastra/agents/editorAgent.tssrc/mastra/agents/evaluationAgent.tssrc/mastra/agents/knowledgeIndexingAgent.tssrc/mastra/agents/learningExtractionAgent.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/recharts.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/researchPaperAgent.tssrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/config/pg-storage.tssrc/mastra/index.tssrc/mastra/tools/web-scraper-tool.ts
🧰 Additional context used
📓 Path-based instructions (35)
**/app/**
📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)
Use the
app/directory structure for route handlers, server components, and client components (Next.js 13+). Prefer this over thepages/directory for new projects.
Files:
app/workflows/page.tsxapp/chat/config/models.tsapp/chat/components/chat-header.tsxapp/chat/components/chat-sidebar.tsxapp/chat/page.tsxapp/chat/components/agent-queue.tsxapp/chat/components/agent-chain-of-thought.tsxapp/networks/components/network-header.tsxapp/chat/config/google-models.tsapp/chat/components/chat-input.tsxapp/chat/components/agent-checkpoint.tsxapp/chat/components/agent-inline-citation.tsx
**/app/**/page.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)
Represent route UIs using
page.tsxorpage.jsxfiles within theapp/directory structure.
Files:
app/workflows/page.tsxapp/chat/page.tsx
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)
**/*.{js,jsx,ts,tsx}: Usenext/dynamicfor dynamic imports to load components only when needed, improving initial load time.
Usenext/imagecomponent for automatic image optimization, including lazy loading and responsive images.
Use React.memo to prevent unnecessary re-renders of components.
Use the<Link prefetch>tag to prefetch pages that are likely to be visited.
Use getServerSideProps, getStaticProps, or server components for fetching data on the server-side.
Use SWR or React Query for client-side data fetching and caching.
Use CSS Modules, Styled Components, or Tailwind CSS for component-level styling. Prefer Tailwind CSS for rapid development.
Use React Context, Zustand, Jotai, or Recoil for managing global state. Avoid Redux unless necessary.
Usereact-hook-formfor managing forms and validation.
Only fetch the data that is needed by the component to avoid over-fetching.
Avoid long-running synchronous operations in the main thread to prevent blocking.
Always usesetStateor hooks to update state instead of mutating state directly.
Include a complete dependency array inuseEffecthooks to prevent unexpected behavior.
Avoid writing server-side code in client components to prevent exposing secrets or causing unexpected behavior.
Usetry...catchblocks for handling errors in asynchronous operations.
Implement error boundary components usinggetDerivedStateFromErrororcomponentDidCatchlifecycle methods.
Sanitize user input to prevent Cross-Site Scripting (XSS) attacks. Be especially careful when rendering HTML directly from user input.
Store authentication tokens in HTTP-only cookies or local storage securely.
Implement role-based access control to restrict access to sensitive resources.
Clean up event listeners and timers inuseEffecthooks to avoid memory leaks.
Only update state when necessary to reduce the number of re-renders and improve performance.
Use immutable data structures and avoid mutating data directly to prevent unexpected...
Files:
app/workflows/page.tsxsrc/mastra/agents/editorAgent.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/evaluationAgent.tsapp/chat/config/models.tsapp/chat/components/chat-header.tsxsrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/codingAgents.tsapp/chat/components/chat-sidebar.tsxsrc/mastra/agents/contentStrategistAgent.tsapp/chat/page.tsxsrc/mastra/agents/knowledgeIndexingAgent.tssrc/mastra/agents/recharts.tssrc/mastra/agents/dataExportAgent.tssrc/mastra/agents/businessLegalAgents.tsapp/chat/components/agent-queue.tsxapp/chat/components/agent-chain-of-thought.tsxsrc/mastra/agents/learningExtractionAgent.tsapp/networks/components/network-header.tsxapp/chat/config/google-models.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/researchPaperAgent.tssrc/mastra/agents/acpAgent.tssrc/mastra/index.tssrc/mastra/agents/copywriterAgent.tsapp/chat/components/chat-input.tsxsrc/mastra/agents/dane.tsapp/chat/components/agent-checkpoint.tsxsrc/mastra/config/pg-storage.tssrc/mastra/tools/web-scraper-tool.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/documentProcessingAgent.tsapp/chat/components/agent-inline-citation.tsxsrc/mastra/agents/dataIngestionAgent.ts
app/**/*.{tsx,ts}
📄 CodeRabbit inference engine (app/AGENTS.md)
app/**/*.{tsx,ts}: Use Tailwind CSS 4 with oklch color variables for styling in Next.js App Router pages and layouts
Use React 19 latest features in component implementations within the app directory
Files:
app/workflows/page.tsxapp/chat/config/models.tsapp/chat/components/chat-header.tsxapp/chat/components/chat-sidebar.tsxapp/chat/page.tsxapp/chat/components/agent-queue.tsxapp/chat/components/agent-chain-of-thought.tsxapp/networks/components/network-header.tsxapp/chat/config/google-models.tsapp/chat/components/chat-input.tsxapp/chat/components/agent-checkpoint.tsxapp/chat/components/agent-inline-citation.tsx
**/*.{ts,tsx,js,jsx,py,java,cs,rb,go,rs,cpp,c,h,hpp,swift,kotlin,php,scala,clj,groovy,lua,sh,bash}
📄 CodeRabbit inference engine (.github/instructions/self-explanatory-code-commenting.instructions.md)
**/*.{ts,tsx,js,jsx,py,java,cs,rb,go,rs,cpp,c,h,hpp,swift,kotlin,php,scala,clj,groovy,lua,sh,bash}: Write code that speaks for itself. Comment only when necessary to explain WHY, not WHAT. Avoid obvious comments that state what the code literally does.
Avoid redundant comments that simply repeat what the code is doing
Keep comments accurate and up-to-date with code changes. Remove or update outdated comments that no longer match the implementation.
Write comments for complex business logic that explain the WHY behind specific calculations or business rules
Document non-obvious algorithms with comments explaining the algorithm choice and its reasoning
Add comments explaining what regex patterns match, especially for complex patterns
Document API constraints, rate limits, gotchas, and external dependencies with explanatory comments
Avoid commenting out dead code. Use version control instead of maintaining commented code blocks.
Do not maintain code change history or modification logs as comments. Rely on git history and commit messages instead.
Avoid decorative divider comments (e.g., lines of equals signs or asterisks) for section separation
Ensure comments are placed appropriately above or adjacent to the code they describe
Write comments using proper grammar, spelling, and professional language
Prefer self-documenting code with clear variable/function names over adding comments to explain unclear code
Files:
app/workflows/page.tsxsrc/mastra/agents/editorAgent.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/evaluationAgent.tsapp/chat/config/models.tsapp/chat/components/chat-header.tsxsrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/codingAgents.tsapp/chat/components/chat-sidebar.tsxsrc/mastra/agents/contentStrategistAgent.tsapp/chat/page.tsxsrc/mastra/agents/knowledgeIndexingAgent.tssrc/mastra/agents/recharts.tssrc/mastra/agents/dataExportAgent.tssrc/mastra/agents/businessLegalAgents.tsapp/chat/components/agent-queue.tsxapp/chat/components/agent-chain-of-thought.tsxsrc/mastra/agents/learningExtractionAgent.tsapp/networks/components/network-header.tsxapp/chat/config/google-models.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/researchPaperAgent.tssrc/mastra/agents/acpAgent.tssrc/mastra/index.tssrc/mastra/agents/copywriterAgent.tsapp/chat/components/chat-input.tsxsrc/mastra/agents/dane.tsapp/chat/components/agent-checkpoint.tsxsrc/mastra/config/pg-storage.tssrc/mastra/tools/web-scraper-tool.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/documentProcessingAgent.tsapp/chat/components/agent-inline-citation.tsxsrc/mastra/agents/dataIngestionAgent.ts
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.github/instructions/self-explanatory-code-commenting.instructions.md)
**/*.{ts,tsx,js,jsx}: Document public APIs with TSDoc/JSDoc comments including parameter descriptions, return types, examples, and thrown exceptions
Add TSDoc comments to configuration constants and environment variables explaining their source, reasoning, or constraints
Use TSDoc annotation tags (TODO, FIXME, HACK, NOTE, WARNING, PERF, SECURITY, BUG, REFACTOR, DEPRECATED) to mark special comments
Include file headers with @fileoverview, @author, @copyright, and @license tags to document file purpose and ownership
Document function parameters with @param tags, return values with @returns tags, and exceptions with @throws tags in TSDoc comments
Use @see tags in TSDoc comments to reference related functions, methods, or documentation
Include @example tags in public API documentation with code examples showing typical usageUse ESLint configuration from eslint.config.cjs with TypeScript rules and Prettier integration
Files:
app/workflows/page.tsxsrc/mastra/agents/editorAgent.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/evaluationAgent.tsapp/chat/config/models.tsapp/chat/components/chat-header.tsxsrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/codingAgents.tsapp/chat/components/chat-sidebar.tsxsrc/mastra/agents/contentStrategistAgent.tsapp/chat/page.tsxsrc/mastra/agents/knowledgeIndexingAgent.tssrc/mastra/agents/recharts.tssrc/mastra/agents/dataExportAgent.tssrc/mastra/agents/businessLegalAgents.tsapp/chat/components/agent-queue.tsxapp/chat/components/agent-chain-of-thought.tsxsrc/mastra/agents/learningExtractionAgent.tsapp/networks/components/network-header.tsxapp/chat/config/google-models.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/researchPaperAgent.tssrc/mastra/agents/acpAgent.tssrc/mastra/index.tssrc/mastra/agents/copywriterAgent.tsapp/chat/components/chat-input.tsxsrc/mastra/agents/dane.tsapp/chat/components/agent-checkpoint.tsxsrc/mastra/config/pg-storage.tssrc/mastra/tools/web-scraper-tool.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/documentProcessingAgent.tsapp/chat/components/agent-inline-citation.tsxsrc/mastra/agents/dataIngestionAgent.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/self-explanatory-code-commenting.instructions.md)
**/*.{ts,tsx}: Document interface and type definitions with TSDoc comments explaining their purpose and usage context
Document interface properties with /** */ comments explaining each field's purpose and constraints
Document generic type parameters with @template tags explaining what each type parameter represents
Use type guards with comments explaining the runtime validation logic being performed
Document advanced/complex TypeScript types with explanatory comments about their purpose and use cases
Files:
app/workflows/page.tsxsrc/mastra/agents/editorAgent.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/evaluationAgent.tsapp/chat/config/models.tsapp/chat/components/chat-header.tsxsrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/codingAgents.tsapp/chat/components/chat-sidebar.tsxsrc/mastra/agents/contentStrategistAgent.tsapp/chat/page.tsxsrc/mastra/agents/knowledgeIndexingAgent.tssrc/mastra/agents/recharts.tssrc/mastra/agents/dataExportAgent.tssrc/mastra/agents/businessLegalAgents.tsapp/chat/components/agent-queue.tsxapp/chat/components/agent-chain-of-thought.tsxsrc/mastra/agents/learningExtractionAgent.tsapp/networks/components/network-header.tsxapp/chat/config/google-models.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/researchPaperAgent.tssrc/mastra/agents/acpAgent.tssrc/mastra/index.tssrc/mastra/agents/copywriterAgent.tsapp/chat/components/chat-input.tsxsrc/mastra/agents/dane.tsapp/chat/components/agent-checkpoint.tsxsrc/mastra/config/pg-storage.tssrc/mastra/tools/web-scraper-tool.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/documentProcessingAgent.tsapp/chat/components/agent-inline-citation.tsxsrc/mastra/agents/dataIngestionAgent.ts
app/workflows/page.tsx
📄 CodeRabbit inference engine (app/workflows/AGENTS.md)
Main page component in app/workflows/page.tsx should be clean and minimal, delegating UI logic to subcomponents
Files:
app/workflows/page.tsx
**/*.{js,ts,jsx,tsx,java,py,cs,go,rb,php,swift,kt,scala,rs,cpp,c,h}
📄 CodeRabbit inference engine (.github/instructions/code-review-generic.instructions.md)
**/*.{js,ts,jsx,tsx,java,py,cs,go,rb,php,swift,kt,scala,rs,cpp,c,h}: Use descriptive and meaningful names for variables, functions, and classes
Apply Single Responsibility Principle: each function/class does one thing well
Follow DRY (Don't Repeat Yourself): eliminate code duplication
Keep functions small and focused (ideally < 20-30 lines)
Avoid deeply nested code (max 3-4 levels)
Avoid magic numbers and strings; use named constants instead
Code should be self-documenting; use comments only when necessary
Implement proper error handling at appropriate levels with meaningful error messages
Avoid silent failures or ignored exceptions; fail fast and validate inputs early
Use appropriate error types/exceptions with meaningful context
Validate and sanitize all user inputs
Use parameterized queries for database access; never use string concatenation for SQL queries
Implement proper authentication checks before accessing resources
Verify user has permission to perform actions; implement proper authorization
Use established cryptographic libraries; never roll your own crypto implementation
Avoid N+1 query problems; use proper indexing and eager loading for database queries
Use appropriate algorithms with suitable time/space complexity for the use case
Utilize caching for expensive or repeated operations
Ensure proper cleanup of connections, files, and streams to prevent resource leaks
Implement pagination for large result sets
Load data only when needed (lazy loading pattern)
Document all public APIs with purpose, parameters, and return values
Add explanatory comments for non-obvious logic
No commented-out code or unresolved TODO comments without associated tickets should remain in commits
Ensure code follows consistent style and conventions with the rest of the codebase
Files:
app/workflows/page.tsxsrc/mastra/agents/editorAgent.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/evaluationAgent.tsapp/chat/config/models.tsapp/chat/components/chat-header.tsxsrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/codingAgents.tsapp/chat/components/chat-sidebar.tsxsrc/mastra/agents/contentStrategistAgent.tsapp/chat/page.tsxsrc/mastra/agents/knowledgeIndexingAgent.tssrc/mastra/agents/recharts.tssrc/mastra/agents/dataExportAgent.tssrc/mastra/agents/businessLegalAgents.tsapp/chat/components/agent-queue.tsxapp/chat/components/agent-chain-of-thought.tsxsrc/mastra/agents/learningExtractionAgent.tsapp/networks/components/network-header.tsxapp/chat/config/google-models.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/researchPaperAgent.tssrc/mastra/agents/acpAgent.tssrc/mastra/index.tssrc/mastra/agents/copywriterAgent.tsapp/chat/components/chat-input.tsxsrc/mastra/agents/dane.tsapp/chat/components/agent-checkpoint.tsxsrc/mastra/config/pg-storage.tssrc/mastra/tools/web-scraper-tool.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/documentProcessingAgent.tsapp/chat/components/agent-inline-citation.tsxsrc/mastra/agents/dataIngestionAgent.ts
**/*.{js,ts,jsx,tsx,java,py,cs,go,rb,php,swift,kt,scala,rs,cpp,c,h,json,yaml,yml,env,config}
📄 CodeRabbit inference engine (.github/instructions/code-review-generic.instructions.md)
Never include passwords, API keys, tokens, or PII in code or logs
Files:
app/workflows/page.tsxsrc/mastra/agents/editorAgent.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/evaluationAgent.tsapp/chat/config/models.tsapp/chat/components/chat-header.tsxsrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/codingAgents.tsapp/chat/components/chat-sidebar.tsxsrc/mastra/agents/contentStrategistAgent.tsapp/chat/page.tsxsrc/mastra/agents/knowledgeIndexingAgent.tssrc/mastra/agents/recharts.tssrc/mastra/agents/dataExportAgent.tssrc/mastra/agents/businessLegalAgents.tsapp/chat/components/agent-queue.tsxapp/chat/components/agent-chain-of-thought.tsxsrc/mastra/agents/learningExtractionAgent.tsapp/networks/components/network-header.tsxapp/chat/config/google-models.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/researchPaperAgent.tssrc/mastra/agents/acpAgent.tssrc/mastra/index.tssrc/mastra/agents/copywriterAgent.tsapp/chat/components/chat-input.tsxsrc/mastra/agents/dane.tsapp/chat/components/agent-checkpoint.tsxsrc/mastra/config/pg-storage.tssrc/mastra/tools/web-scraper-tool.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/documentProcessingAgent.tsapp/chat/components/agent-inline-citation.tsxsrc/mastra/agents/dataIngestionAgent.ts
**/*.{ts,tsx,java,cs,go,php,swift,kt,scala}
📄 CodeRabbit inference engine (.github/instructions/code-review-generic.instructions.md)
Prefer small, focused interfaces (Interface Segregation Principle)
Files:
app/workflows/page.tsxsrc/mastra/agents/editorAgent.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/evaluationAgent.tsapp/chat/config/models.tsapp/chat/components/chat-header.tsxsrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/codingAgents.tsapp/chat/components/chat-sidebar.tsxsrc/mastra/agents/contentStrategistAgent.tsapp/chat/page.tsxsrc/mastra/agents/knowledgeIndexingAgent.tssrc/mastra/agents/recharts.tssrc/mastra/agents/dataExportAgent.tssrc/mastra/agents/businessLegalAgents.tsapp/chat/components/agent-queue.tsxapp/chat/components/agent-chain-of-thought.tsxsrc/mastra/agents/learningExtractionAgent.tsapp/networks/components/network-header.tsxapp/chat/config/google-models.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/researchPaperAgent.tssrc/mastra/agents/acpAgent.tssrc/mastra/index.tssrc/mastra/agents/copywriterAgent.tsapp/chat/components/chat-input.tsxsrc/mastra/agents/dane.tsapp/chat/components/agent-checkpoint.tsxsrc/mastra/config/pg-storage.tssrc/mastra/tools/web-scraper-tool.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/documentProcessingAgent.tsapp/chat/components/agent-inline-citation.tsxsrc/mastra/agents/dataIngestionAgent.ts
**/*.{js,mjs,cjs,ts,tsx,jsx,py,java,cs,go,rb,php,rs,cpp,c,h,hpp}
📄 CodeRabbit inference engine (.github/instructions/update-docs-on-code-change.instructions.md)
Use automated documentation generators for code documentation - JSDoc/TSDoc for JavaScript/TypeScript, Sphinx/pdoc for Python, Javadoc for Java, xmldoc for C#, godoc for Go, rustdoc for Rust
Files:
app/workflows/page.tsxsrc/mastra/agents/editorAgent.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/evaluationAgent.tsapp/chat/config/models.tsapp/chat/components/chat-header.tsxsrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/codingAgents.tsapp/chat/components/chat-sidebar.tsxsrc/mastra/agents/contentStrategistAgent.tsapp/chat/page.tsxsrc/mastra/agents/knowledgeIndexingAgent.tssrc/mastra/agents/recharts.tssrc/mastra/agents/dataExportAgent.tssrc/mastra/agents/businessLegalAgents.tsapp/chat/components/agent-queue.tsxapp/chat/components/agent-chain-of-thought.tsxsrc/mastra/agents/learningExtractionAgent.tsapp/networks/components/network-header.tsxapp/chat/config/google-models.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/researchPaperAgent.tssrc/mastra/agents/acpAgent.tssrc/mastra/index.tssrc/mastra/agents/copywriterAgent.tsapp/chat/components/chat-input.tsxsrc/mastra/agents/dane.tsapp/chat/components/agent-checkpoint.tsxsrc/mastra/config/pg-storage.tssrc/mastra/tools/web-scraper-tool.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/documentProcessingAgent.tsapp/chat/components/agent-inline-citation.tsxsrc/mastra/agents/dataIngestionAgent.ts
app/**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
app/**/*.{ts,tsx}: Use Next.js 16 App Router with React 19 for frontend development
Use MastraClient for fetching agent, workflow, tool, and thread data in frontend applications
Files:
app/workflows/page.tsxapp/chat/config/models.tsapp/chat/components/chat-header.tsxapp/chat/components/chat-sidebar.tsxapp/chat/page.tsxapp/chat/components/agent-queue.tsxapp/chat/components/agent-chain-of-thought.tsxapp/networks/components/network-header.tsxapp/chat/config/google-models.tsapp/chat/components/chat-input.tsxapp/chat/components/agent-checkpoint.tsxapp/chat/components/agent-inline-citation.tsx
**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Style UI components with Tailwind CSS 4 using oklch color variables
Files:
app/workflows/page.tsxapp/chat/components/chat-header.tsxapp/chat/components/chat-sidebar.tsxapp/chat/page.tsxapp/chat/components/agent-queue.tsxapp/chat/components/agent-chain-of-thought.tsxapp/networks/components/network-header.tsxapp/chat/components/chat-input.tsxapp/chat/components/agent-checkpoint.tsxapp/chat/components/agent-inline-citation.tsx
**/*.{ts,tsx,js,jsx,json,md}
📄 CodeRabbit inference engine (AGENTS.md)
Use Prettier for code formatting with ES5 trailing commas, 4-space tabs, and single quotes
Files:
app/workflows/page.tsxsrc/mastra/agents/editorAgent.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/evaluationAgent.tsapp/chat/config/models.tsapp/chat/components/chat-header.tsxsrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/codingAgents.tsapp/chat/components/chat-sidebar.tsxsrc/mastra/agents/contentStrategistAgent.tsapp/chat/page.tsxCopilot-Processing.mdsrc/mastra/agents/knowledgeIndexingAgent.tssrc/mastra/agents/recharts.tssrc/mastra/agents/dataExportAgent.tssrc/mastra/agents/businessLegalAgents.tsapp/chat/components/agent-queue.tsxapp/chat/components/agent-chain-of-thought.tsxsrc/mastra/agents/learningExtractionAgent.tsapp/networks/components/network-header.tsxapp/chat/config/google-models.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/researchPaperAgent.tssrc/mastra/agents/acpAgent.tssrc/mastra/index.tssrc/mastra/agents/copywriterAgent.tsapp/chat/components/chat-input.tsxsrc/mastra/agents/dane.tsapp/chat/components/agent-checkpoint.tsxsrc/mastra/config/pg-storage.tssrc/mastra/tools/web-scraper-tool.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/documentProcessingAgent.tsapp/chat/components/agent-inline-citation.tsxsrc/mastra/agents/dataIngestionAgent.ts
app/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Use TanStack Query hooks from
lib/hooks/use-dashboard-queries.tsfor agents, workflows, tools, traces, threads, and messages
Files:
app/workflows/page.tsxapp/chat/components/chat-header.tsxapp/chat/components/chat-sidebar.tsxapp/chat/page.tsxapp/chat/components/agent-queue.tsxapp/chat/components/agent-chain-of-thought.tsxapp/networks/components/network-header.tsxapp/chat/components/chat-input.tsxapp/chat/components/agent-checkpoint.tsxapp/chat/components/agent-inline-citation.tsx
**/*.{js,ts}
📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)
Use parameterized queries or an ORM to prevent SQL injection attacks.
Files:
src/mastra/agents/editorAgent.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/evaluationAgent.tsapp/chat/config/models.tssrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/codingAgents.tssrc/mastra/agents/contentStrategistAgent.tssrc/mastra/agents/knowledgeIndexingAgent.tssrc/mastra/agents/recharts.tssrc/mastra/agents/dataExportAgent.tssrc/mastra/agents/businessLegalAgents.tssrc/mastra/agents/learningExtractionAgent.tsapp/chat/config/google-models.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/researchPaperAgent.tssrc/mastra/agents/acpAgent.tssrc/mastra/index.tssrc/mastra/agents/copywriterAgent.tssrc/mastra/agents/dane.tssrc/mastra/config/pg-storage.tssrc/mastra/tools/web-scraper-tool.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/documentProcessingAgent.tssrc/mastra/agents/dataIngestionAgent.ts
src/mastra/agents/*.ts
📄 CodeRabbit inference engine (src/mastra/agents/AGENTS.md)
src/mastra/agents/*.ts: Agent file naming convention: Create agent files using kebab-case with.tsextension in/src/mastra/agents/directory (e.g.,your-agent-name.ts)
Each agent must follow the pattern: export agent asconst yourAgent = new Agent({ id: 'your-agent-id', name: 'Your Agent Name', description: '...' })
Files:
src/mastra/agents/editorAgent.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/evaluationAgent.tssrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/codingAgents.tssrc/mastra/agents/contentStrategistAgent.tssrc/mastra/agents/knowledgeIndexingAgent.tssrc/mastra/agents/recharts.tssrc/mastra/agents/dataExportAgent.tssrc/mastra/agents/businessLegalAgents.tssrc/mastra/agents/learningExtractionAgent.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/researchPaperAgent.tssrc/mastra/agents/acpAgent.tssrc/mastra/agents/copywriterAgent.tssrc/mastra/agents/dane.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/documentProcessingAgent.tssrc/mastra/agents/dataIngestionAgent.ts
src/mastra/**/*
📄 CodeRabbit inference engine (src/AGENTS.md)
mastramodules can import fromutils, but must not import fromapporcli(excepttypes)
Files:
src/mastra/agents/editorAgent.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/evaluationAgent.tssrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/codingAgents.tssrc/mastra/agents/contentStrategistAgent.tssrc/mastra/agents/knowledgeIndexingAgent.tssrc/mastra/agents/recharts.tssrc/mastra/agents/dataExportAgent.tssrc/mastra/agents/businessLegalAgents.tssrc/mastra/agents/learningExtractionAgent.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/researchPaperAgent.tssrc/mastra/agents/acpAgent.tssrc/mastra/index.tssrc/mastra/agents/copywriterAgent.tssrc/mastra/agents/dane.tssrc/mastra/config/pg-storage.tssrc/mastra/tools/web-scraper-tool.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/documentProcessingAgent.tssrc/mastra/agents/dataIngestionAgent.ts
src/mastra/agents/**/*.ts
📄 CodeRabbit inference engine (src/mastra/AGENTS.md)
Add agents under
src/mastra/agentsthat wire tools together into higher-level behaviorsImplement agents by composing tools into specialized behaviors using the Mastra agents DSL
Files:
src/mastra/agents/editorAgent.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/evaluationAgent.tssrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/codingAgents.tssrc/mastra/agents/contentStrategistAgent.tssrc/mastra/agents/knowledgeIndexingAgent.tssrc/mastra/agents/recharts.tssrc/mastra/agents/dataExportAgent.tssrc/mastra/agents/businessLegalAgents.tssrc/mastra/agents/learningExtractionAgent.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/researchPaperAgent.tssrc/mastra/agents/acpAgent.tssrc/mastra/agents/copywriterAgent.tssrc/mastra/agents/dane.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/documentProcessingAgent.tssrc/mastra/agents/dataIngestionAgent.ts
src/mastra/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Use
maskSensitiveMessageData()helper fromsrc/mastra/config/pg-storage.tsto mask secrets in logs
Files:
src/mastra/agents/editorAgent.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/evaluationAgent.tssrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/codingAgents.tssrc/mastra/agents/contentStrategistAgent.tssrc/mastra/agents/knowledgeIndexingAgent.tssrc/mastra/agents/recharts.tssrc/mastra/agents/dataExportAgent.tssrc/mastra/agents/businessLegalAgents.tssrc/mastra/agents/learningExtractionAgent.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/researchPaperAgent.tssrc/mastra/agents/acpAgent.tssrc/mastra/index.tssrc/mastra/agents/copywriterAgent.tssrc/mastra/agents/dane.tssrc/mastra/config/pg-storage.tssrc/mastra/tools/web-scraper-tool.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/documentProcessingAgent.tssrc/mastra/agents/dataIngestionAgent.ts
**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
Use TypeScript with ES2022 target and Next.js path aliases configured in tsconfig.json
Files:
src/mastra/agents/editorAgent.tssrc/mastra/agents/researchAgent.tssrc/mastra/agents/evaluationAgent.tsapp/chat/config/models.tssrc/mastra/agents/scriptWriterAgent.tssrc/mastra/agents/weather-agent.tssrc/mastra/agents/codingAgents.tssrc/mastra/agents/contentStrategistAgent.tssrc/mastra/agents/knowledgeIndexingAgent.tssrc/mastra/agents/recharts.tssrc/mastra/agents/dataExportAgent.tssrc/mastra/agents/businessLegalAgents.tssrc/mastra/agents/learningExtractionAgent.tsapp/chat/config/google-models.tssrc/mastra/agents/package-publisher.tssrc/mastra/agents/stockAnalysisAgent.tssrc/mastra/agents/researchPaperAgent.tssrc/mastra/agents/acpAgent.tssrc/mastra/index.tssrc/mastra/agents/copywriterAgent.tssrc/mastra/agents/dane.tssrc/mastra/config/pg-storage.tssrc/mastra/tools/web-scraper-tool.tssrc/mastra/agents/reportAgent.tssrc/mastra/agents/documentProcessingAgent.tssrc/mastra/agents/dataIngestionAgent.ts
**/components/**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/next-js.instructions.md)
Use PascalCase for component file names (e.g.,
ComponentName.jsxorComponentName.tsx).
Files:
app/chat/components/chat-header.tsxapp/chat/components/chat-sidebar.tsxapp/chat/components/agent-queue.tsxapp/chat/components/agent-chain-of-thought.tsxapp/networks/components/network-header.tsxapp/chat/components/chat-input.tsxapp/chat/components/agent-checkpoint.tsxapp/chat/components/agent-inline-citation.tsx
app/chat/components/**/*.{ts,tsx}
📄 CodeRabbit inference engine (app/chat/AGENTS.md)
app/chat/components/**/*.{ts,tsx}: Use AI SDK v5 types and patterns in chat components: import types like UIMessage, DynamicToolUIPart, TextUIPart, ReasoningUIPart from 'ai' and use type guard functions like isTextUIPart, isReasoningUIPart, isToolOrDynamicToolUIPart to filter message parts
Access message content through message.parts array using type guards rather than message.content, extracting specific parts like text using const textPart = message.parts?.find(isTextUIPart)
Handle Mastra stream chunk types correctly: use 'text-delta' for streaming text, 'reasoning-delta' for streaming reasoning (NOT 'reasoning'), 'tool-call' for tool invocation, 'tool-result' for tool completion, 'source' for research sources, and 'finish' for completion with usage data
Use AI Elements components (Conversation, Message, PromptInput, ModelSelector, Reasoning, Tool, Sources, Artifact) from the AI Elements library in their respective chat component files as specified in the architecture
Files:
app/chat/components/chat-header.tsxapp/chat/components/chat-sidebar.tsxapp/chat/components/agent-queue.tsxapp/chat/components/agent-chain-of-thought.tsxapp/chat/components/chat-input.tsxapp/chat/components/agent-checkpoint.tsxapp/chat/components/agent-inline-citation.tsx
app/chat/components/chat-header.tsx
📄 CodeRabbit inference engine (app/chat/AGENTS.md)
Implement ChatHeader component with ModelSelector to allow users to select from 26+ configured agents and switch between them
Files:
app/chat/components/chat-header.tsx
app/chat/**/*.tsx
📄 CodeRabbit inference engine (AGENTS.md)
Use @ai-sdk/react for streaming and AI-powered React hooks in chat interfaces
Files:
app/chat/components/chat-header.tsxapp/chat/components/chat-sidebar.tsxapp/chat/page.tsxapp/chat/components/agent-queue.tsxapp/chat/components/agent-chain-of-thought.tsxapp/chat/components/chat-input.tsxapp/chat/components/agent-checkpoint.tsxapp/chat/components/agent-inline-citation.tsx
**/*.md
📄 CodeRabbit inference engine (.github/instructions/markdown.instructions.md)
**/*.md: Use appropriate heading levels (H2, H3, etc.) to structure markdown content. Do not use H1 headings, as these will be generated from the title. Use##for H2 and###for H3 in a hierarchical manner. Recommend restructuring if content includes H4 or higher levels.
Use bullet points (with-) or numbered lists (with1.) for lists in markdown. Indent nested lists with two spaces and ensure proper indentation and spacing.
Use fenced code blocks (triple backticks) for code snippets in markdown. Specify the language after the opening backticks for syntax highlighting (e.g.,csharp).
Use proper markdown syntax for links:[link text](URL). Ensure that link text is descriptive and URLs are valid and accessible.
Use proper markdown syntax for images:. Include a brief description of the image in the alt text for accessibility.
Use markdown tables (with|delimiters) for tabular data. Ensure proper formatting, alignment, and inclusion of headers.
Limit line length to 80 characters in markdown for readability. Use soft line breaks for long paragraphs.
Use appropriate whitespace in markdown to separate sections and improve readability. Use blank lines between sections and avoid excessive whitespace.
Include YAML front matter at the beginning of markdown files with required metadata fields:post_title,author1,post_slug,microsoft_alias,featured_image,categories(from /categories.txt),tags,ai_note,summary, andpost_date.
Files:
Copilot-Processing.md
app/networks/**/*.tsx
📄 CodeRabbit inference engine (app/networks/AGENTS.md)
app/networks/**/*.tsx: UseuseChatfrom@ai-sdk/reactwithDefaultChatTransportfor streaming responses from the/networkroute in the networks feature
Support real-time streaming with stop/cancel functionality, reasoning visualization for chain-of-thought models, and tool invocation display showing agent tool calls
Provide a responsive layout with collapsible sidebar on mobile for the networks feature
Files:
app/networks/components/network-header.tsx
src/mastra/index.ts
📄 CodeRabbit inference engine (src/AGENTS.md)
Enforce registration pattern in
mastra/index.tsfor AI orchestration modules composition
Files:
src/mastra/index.ts
app/chat/components/chat-input.tsx
📄 CodeRabbit inference engine (app/chat/AGENTS.md)
Implement ChatInput component with PromptInput AI Elements for message submission, including support for file attachments when fileUpload is enabled for the selected agent
Files:
app/chat/components/chat-input.tsx
src/mastra/config/pg-storage.ts
📄 CodeRabbit inference engine (src/mastra/config/AGENTS.md)
src/mastra/config/pg-storage.ts: PostgreSQL storage configuration must include PgVector support for embeddings, memory, and thread persistence
Database connection must use the SUPABASE environment variable with optional performance tuning via DB_MAX_CONNECTIONS, DB_IDLE_TIMEOUT, and DB_CONNECTION_TIMEOUT
Memory configuration must support MEMORY_LAST_MESSAGES, SEMANTIC_TOP_K, SEMANTIC_RANGE_BEFORE, SEMANTIC_RANGE_AFTER, and LISTS environment variables
RAG configuration must support GRAPH_THRESHOLD, GRAPH_RANDOM_WALK_STEPS, GRAPH_RESTART_PROB, PG_MIN_SCORE, and PG_EF environment variables
Files:
src/mastra/config/pg-storage.ts
src/mastra/config/**/*.ts
📄 CodeRabbit inference engine (AGENTS.md)
src/mastra/config/**/*.ts: Use PostgreSQL with PgVector for vector storage and persistence in pg-storage
Store centralized provider clients (Google, OpenAI, Anthropic, OpenRouter, Vertex) insrc/mastra/config
Files:
src/mastra/config/pg-storage.ts
src/mastra/tools/**/*.ts
📄 CodeRabbit inference engine (src/mastra/AGENTS.md)
src/mastra/tools/**/*.ts: Add new tools undersrc/mastra/toolsfollowing thecreateToolpattern with Zod schemas
Use explicit Zod schemas for every tool input/output
Keep tools small and side-effect-free when possible; agents orchestrate tools and handle context
src/mastra/tools/**/*.ts: Use Zod schemas for strict validation of tool inputs and outputs in Mastra tools
Implement tools withcreateTool()pattern:createTool({ id, inputSchema, outputSchema, execute })
Files:
src/mastra/tools/web-scraper-tool.ts
src/mastra/{tools,workflows}/**/*.ts
📄 CodeRabbit inference engine (src/mastra/AGENTS.md)
Use
RequestContext(per-request) or agent-specific runtime context types (e.g.EditorRuntimeContext) to enforce access control in tools and workflows
Files:
src/mastra/tools/web-scraper-tool.ts
src/mastra/tools/**/{web-scraper-tool.ts,browser-tool.ts}
📄 CodeRabbit inference engine (src/mastra/tools/AGENTS.md)
Web scraping tools (Web Scraper, Browser Tool) must use Playwright and Cheerio for HTML parsing
Files:
src/mastra/tools/web-scraper-tool.ts
🧬 Code graph analysis (6)
app/chat/components/chat-header.tsx (1)
src/components/ai-elements/model-selector.tsx (4)
ModelSelectorTrigger(29-31)ModelSelectorContent(37-49)ModelSelectorInput(59-64)ModelSelectorList(68-70)
app/chat/components/chat-sidebar.tsx (4)
app/chat/providers/chat-context.tsx (1)
useChatContext(137-143)ui/badge.tsx (1)
Badge(46-46)ui/input.tsx (1)
Input(21-21)ui/button.tsx (1)
Button(60-60)
app/chat/page.tsx (3)
app/chat/providers/chat-context.tsx (1)
ChatProvider(154-578)app/chat/components/chat-messages.tsx (1)
ChatMessages(763-907)app/chat/components/chat-sidebar.tsx (1)
ChatSidebar(24-198)
app/chat/components/agent-queue.tsx (1)
src/components/ai-elements/queue.tsx (1)
QueueItemDescription(92-107)
app/networks/components/network-header.tsx (2)
ui/button.tsx (1)
Button(60-60)src/components/ai-elements/model-selector.tsx (4)
ModelSelectorTrigger(29-31)ModelSelectorContent(37-49)ModelSelectorInput(59-64)ModelSelectorList(68-70)
src/mastra/index.ts (1)
src/mastra/config/logger.ts (1)
log(14-18)
🪛 Biome (2.1.2)
app/chat/components/chat-sidebar.tsx
[error] 162-165: A form label must be associated with an input.
Consider adding a for or htmlFor attribute to the label element or moving the input element to inside the label element.
(lint/a11y/noLabelWithoutControl)
[error] 174-177: A form label must be associated with an input.
Consider adding a for or htmlFor attribute to the label element or moving the input element to inside the label element.
(lint/a11y/noLabelWithoutControl)
[error] 133-137: Provide an explicit type prop for the button element.
The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset
(lint/a11y/useButtonType)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: CodeQL analysis (javascript-typescript)
- GitHub Check: Agent
- GitHub Check: Sourcery review
- GitHub Check: Codacy Security Scan
- GitHub Check: Analyze (javascript-typescript)
| status={step.status} | ||
| > | ||
| {step.duration && step.status === "complete" && ( | ||
| {(Boolean(step.duration)) && step.status === "complete" && ( |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Consider removing redundant Boolean() wrapper.
The explicit Boolean() wrapper is unnecessary since JavaScript already performs implicit truthiness evaluation in conditional contexts. The code would be cleaner as:
-{(Boolean(step.duration)) && step.status === "complete" && (
+{step.duration && step.status === "complete" && (🤖 Prompt for AI Agents
In app/chat/components/agent-chain-of-thought.tsx around line 62, the
conditional uses an unnecessary Boolean() wrapper: "(Boolean(step.duration)) &&
step.status === 'complete' && (". Remove the Boolean(...) wrapper so the
expression relies on JS truthiness (e.g., "step.duration && step.status ===
'complete' && (") to simplify the code while preserving behavior.
| export function AgentInlineCitation({ citations, text }: AgentInlineCitationProps) { | ||
| const citation = citations[0] | ||
| if (!citation) {return <span>{text}</span>} | ||
| if (citations.length === 0) {return <span>{text}</span>} |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Suggest formatting the conditional return for readability.
The logic is correct, but placing the return statement on the same line reduces readability.
🔎 Proposed formatting improvement
- if (citations.length === 0) {return <span>{text}</span>}
+ if (citations.length === 0) {
+ return <span>{text}</span>
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (citations.length === 0) {return <span>{text}</span>} | |
| if (citations.length === 0) { | |
| return <span>{text}</span> | |
| } |
🤖 Prompt for AI Agents
In app/chat/components/agent-inline-citation.tsx around line 27, the conditional
return is written inline ("if (citations.length === 0) {return
<span>{text}</span>}"), which harms readability; refactor it to a multi-line
conditional (use braces and place the return on its own line) so the
empty-citations early-return is clear and consistent with surrounding code
formatting.
| const agentsByCategory = useMemo(() => getAgentsByCategory(), []) | ||
|
|
||
| /* Agent Selector - compact dropdown in input toolbar */ | ||
|
|
||
| // Model Selector | ||
|
|
||
|
|
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Remove empty comment blocks.
Lines 87-90 contain placeholder comments without implementation. Either implement the intended functionality or remove these artifacts.
🔎 Proposed fix
const agentsByCategory = useMemo(() => getAgentsByCategory(), [])
-
- /* Agent Selector - compact dropdown in input toolbar */
-
- // Model Selector
-
const handleSubmit = async (message: { text: string; files: unknown[] }) => {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const agentsByCategory = useMemo(() => getAgentsByCategory(), []) | |
| /* Agent Selector - compact dropdown in input toolbar */ | |
| // Model Selector | |
| const agentsByCategory = useMemo(() => getAgentsByCategory(), []) | |
| const handleSubmit = async (message: { text: string; files: unknown[] }) => { |
🤖 Prompt for AI Agents
In app/chat/components/chat-input.tsx around lines 85 to 91 there are empty
placeholder comment blocks (lines 87–90) that should be removed or implemented;
delete the unused comment markers and any leftover scaffolding if no feature is
intended, or replace them with the actual Agent Selector / Model Selector
implementation (hook/state/UI) if you planned to add functionality—ensure there
are no naked comment blocks left behind and that the code compiles after removal
or replacement.
| <PromptInputButton title="Select model"> | ||
| <SparklesIcon className="size-4" /> | ||
| <span className="hidden sm:inline ml-1 text-xs"> | ||
| {selectedModel.name.split(" ")[0]} | ||
| </span> | ||
| </PromptInputButton> |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Brittle string manipulation for model name display.
selectedModel.name.split(" ")[0] assumes the first word is meaningful. This could produce unexpected results for models with names like "Gemini 3 Flash Preview" (shows only "Gemini"). Consider using a truncation approach or a dedicated short name field.
🔎 Alternative approach
<PromptInputButton title="Select model">
<SparklesIcon className="size-4" />
<span className="hidden sm:inline ml-1 text-xs truncate max-w-20">
- {selectedModel.name.split(" ")[0]}
+ {selectedModel.name}
</span>
</PromptInputButton>Or add a shortName field to ModelConfig for explicit control over the abbreviated display.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <PromptInputButton title="Select model"> | |
| <SparklesIcon className="size-4" /> | |
| <span className="hidden sm:inline ml-1 text-xs"> | |
| {selectedModel.name.split(" ")[0]} | |
| </span> | |
| </PromptInputButton> | |
| <PromptInputButton title="Select model"> | |
| <SparklesIcon className="size-4" /> | |
| <span className="hidden sm:inline ml-1 text-xs truncate max-w-20"> | |
| {selectedModel.name} | |
| </span> | |
| </PromptInputButton> |
🤖 Prompt for AI Agents
In app/chat/components/chat-input.tsx around lines 229 to 234, the UI currently
uses selectedModel.name.split(" ")[0] which is brittle; replace this with a
stable short-display value: prefer a new selectedModel.shortName (add shortName
to ModelConfig/type and populate where models are defined), and fall back to a
safe truncation of selectedModel.name (e.g., take the first N characters and add
“…” if longer) instead of splitting by spaces; update usages and tests
accordingly so the button shows either shortName or a truncated name.
| selectedModel, | ||
| } = useChatContext() |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Unused variable: selectedModel is destructured but never used.
Remove unused destructured value to keep the code clean.
🔎 Proposed fix
const {
agentConfig,
checkpoints,
restoreCheckpoint,
threadId,
resourceId,
setThreadId,
setResourceId,
- selectedModel,
} = useChatContext()📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| selectedModel, | |
| } = useChatContext() | |
| const { | |
| agentConfig, | |
| checkpoints, | |
| restoreCheckpoint, | |
| threadId, | |
| resourceId, | |
| setThreadId, | |
| setResourceId, | |
| } = useChatContext() |
🤖 Prompt for AI Agents
In app/chat/components/chat-sidebar.tsx around lines 33 to 34, the hook
destructures selectedModel from useChatContext but the variable is never used;
remove selectedModel from the destructuring to eliminate the unused variable and
keep imports/usage unchanged (only delete selectedModel from the object pattern)
so lint/errors go away.
| # Package Location Rules | ||
| - **Core**: packages/{core,deployer,cli,engine,evals,rag,memory,mcp,loggers} | ||
| - **Deployers**: deployers/{cloudflare,vercel,netlify} (STRICT: No other dirs) | ||
| - **Stores**: stores/{name} (e.g., @mastra/pg -> stores/pg) | ||
| - **Speech**: speech/{name} (e.g., @mastra/speech-google -> speech/google) | ||
| - **Validation**: No examples/ or integrations/ in paths. Exact matches only. | ||
| `; |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's check the file size and read the entire file to verify line numbers
wc -l src/mastra/agents/package-publisher.ts
cat -n src/mastra/agents/package-publisher.ts | head -180Repository: ssdeanx/AgentStack
Length of output: 8332
Clarify the inconsistency between package location rules and build execution plan.
The package location schema on line 23 states "No examples/ or integrations/ in paths. Exact matches only," but the BUILD_PACKAGES_PROMPT (lines 65-68) explicitly includes a parallel phase to "Build integrations/ directory packages" using pnpmBuild for each @mastra/integration-* package.
This contradiction requires clarification: Are integrations/ packages excluded from the standardized package locations (per the validation rule) but still built when they exist, or should the validation rule be updated to include integrations/ as a supported location category?
🤖 Prompt for AI Agents
In src/mastra/agents/package-publisher.ts around lines 18 to 24, the package
location rules forbid examples/ or integrations/ while the BUILD_PACKAGES_PROMPT
(lines ~65-68) includes a build phase for @mastra/integration-* packages;
reconcile this by either (A) updating the validation rules to explicitly allow
integrations/ (add integrations/{name} or @mastra/integration-* to the allowed
locations and examples) or (B) removing the integrations build phase from
BUILD_PACKAGES_PROMPT so it matches the validation policy—pick one approach and
update the text and prompt consistently so rules and build plan align.
| - Generate TypeScript React components using Recharts v3.5.0+. | ||
| - Create responsive, accessible, and performant chart components. | ||
| - Implement proper data typing and prop interfaces. | ||
| - Follow React best practices and Recharts patterns. | ||
| </expertise> |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# First, let's check the actual file content at lines 180-184
cat -n src/mastra/agents/recharts.ts | sed -n '170,195p'Repository: ssdeanx/AgentStack
Length of output: 1092
🏁 Script executed:
# Check the package.json for Recharts dependency
find . -name "package.json" -type f -exec grep -l "recharts" {} \;Repository: ssdeanx/AgentStack
Length of output: 76
🏁 Script executed:
# Get more details about the recharts dependency version in package.json
jq '.dependencies, .devDependencies, .optionalDependencies' package.json 2>/dev/null | grep -A 2 -B 2 "recharts"Repository: ssdeanx/AgentStack
Length of output: 208
🌐 Web query:
Recharts latest stable version npm package
💡 Result:
The latest stable Recharts npm version is 3.6.0 (as of January 3, 2026). [1][2]
Sources:
[1] Snyk package page (recharts) — lists latest version 3.6.0.
[2] jsDocs.io (recharts) — version 3.6.0 published.
Update Recharts version reference to match installed dependency.
The prompt instructs AI to generate components for Recharts v3.5.0+, but the project's package.json specifies "recharts": "^2.15.4". This is a breaking incompatibility—v2.x and v3.x have different APIs. Update the prompt to target Recharts v2.15.4 or upgrade the project dependency to v3.6.0 (latest stable) and test accordingly.
🤖 Prompt for AI Agents
In src/mastra/agents/recharts.ts around lines 180 to 184, the prompt text
references Recharts v3.5.0+ while package.json has "recharts": "^2.15.4",
causing an API mismatch; either change the prompt to target Recharts v2.15.4
(update wording to "Recharts v2.15.4" and adjust any API expectations to v2.x)
or upgrade the project dependency to a compatible v3.x (e.g., update
package.json to "recharts": "^3.6.0", run npm/yarn install, update any code
using v2 APIs to v3 where needed, and run tests) — pick one approach, make the
corresponding change, and ensure generated component code and tests match the
chosen Recharts version.
| indexConfig: { | ||
| type: 'flat', // flat index type (supports dimensions > 4000, unlike HNSW limit of 2000) | ||
| type: 'hnsw', // flat index type (supports dimensions > 4000, unlike HNSW limit of 2000) | ||
| metric: 'cosine', // Distance metric for normalized embeddings | ||
| ivf: {lists: parseInt(process.env.LISTS ?? '3072')}, // IVF configuration for flat index | ||
| hnsw: { m: 16, efConstruction: 64 } // hnsw configuration | ||
| }, |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
# Find and check pgvector version in dependencies
fd -E node_modules -type f \( -name "package.json" -o -name "package-lock.json" -o -name "yarn.lock" -o -name "pnpm-lock.yaml" \) | head -5 | xargs -I {} sh -c 'echo "File: {}"; head -100 {}'Repository: ssdeanx/AgentStack
Length of output: 232
🏁 Script executed:
# Check the current pg-storage.ts file for context
cat -n src/mastra/config/pg-storage.ts | head -120Repository: ssdeanx/AgentStack
Length of output: 5981
🏁 Script executed:
# Search for any pgvector or dimension-related configuration
rg -n "pgvector|version.*pg|dimension" src/mastra/config/ --type tsRepository: ssdeanx/AgentStack
Length of output: 5400
🏁 Script executed:
# Look for any README or docs mentioning pgvector requirements
fd -e md "README|INSTALL|SETUP|requirements" | xargs rg -l "pgvector" 2>/dev/nullRepository: ssdeanx/AgentStack
Length of output: 99
🏁 Script executed:
# Search for pgvector version in package.json
jq '.dependencies, .devDependencies' package.json 2>/dev/null | grep -A2 -B2 "pg\|pgvector\|mastra"Repository: ssdeanx/AgentStack
Length of output: 1230
🏁 Script executed:
# Check for any version specifications in lock files
fd -type f \( -name "package-lock.json" -o -name "pnpm-lock.yaml" -o -name "yarn.lock" \) -exec grep -l "pgvector\|@mastra/pg" {} \;Repository: ssdeanx/AgentStack
Length of output: 232
🏁 Script executed:
# Search for any documentation or comments about pgvector requirements
rg -n "pgvector.*version|HNSW.*dimension|dimension.*HNSW" --type mdRepository: ssdeanx/AgentStack
Length of output: 277
🏁 Script executed:
# Check @mastra/pg or similar imports to understand the package version
rg -n "@mastra/pg|from.*mastra/pg" src/mastra/config/pg-storage.ts -A 2 -B 2Repository: ssdeanx/AgentStack
Length of output: 273
🏁 Script executed:
# Check the ADR document for more details about pgvector and dimension decisions
cat -n docs/adr/0001-why-pgvector-and-gemini-embeddings.mdRepository: ssdeanx/AgentStack
Length of output: 1877
🏁 Script executed:
# Search for any pgvector version constraints or documentation about HNSW/flat index support
rg -n "flat|hnsw|pgvector" docs/ -A 2 -B 2Repository: ssdeanx/AgentStack
Length of output: 2520
🏁 Script executed:
# Check if there are any other references to indexConfig type in the codebase
rg -n "indexConfig.*type|type.*hnsw|type.*flat" src/Repository: ssdeanx/AgentStack
Length of output: 833
🏁 Script executed:
# Verify the exact line 142 usage in pg-storage.ts
sed -n '138,145p' src/mastra/config/pg-storage.tsRepository: ssdeanx/AgentStack
Length of output: 360
🏁 Script executed:
# Check mongodb.ts to see both incorrect and correct patterns
sed -n '82,120p' src/mastra/config/mongodb.tsRepository: ssdeanx/AgentStack
Length of output: 1870
Fix indexConfig to match architectural decision and correct misleading comment.
Line 99's comment contradicts the code and misleads maintainers. More critically, the indexConfig uses type: 'hnsw' which violates ADR 0001 (dated 2025-11-15). The architectural decision explicitly recommends type: 'flat' for 3072-dimensional embeddings due to HNSW dimension limits. Using HNSW with 3072 dimensions may cause runtime failures.
Update to use type: 'flat' as documented in the ADR, following the pattern already implemented in mongodb.ts line 116:
Recommended fix
indexConfig: {
- type: 'hnsw', // flat index type (supports dimensions > 4000, unlike HNSW limit of 2000)
+ type: 'flat', // flat index for high-dimensional vectors (3072 dimensions)
metric: 'cosine', // Distance metric for normalized embeddings
- hnsw: { m: 16, efConstruction: 64 } // hnsw configuration
+ ivf: { lists: 4000 } // IVF configuration for flat index
},🤖 Prompt for AI Agents
In src/mastra/config/pg-storage.ts around lines 98 to 102, the indexConfig
incorrectly sets type: 'hnsw' and contains a misleading comment about flat vs
HNSW; update indexConfig to use type: 'flat' to comply with ADR 0001 for
3072-dimensional embeddings, remove the hnsw-specific settings (or omit them
entirely), keep metric: 'cosine', and replace the comment with a short accurate
note stating that flat is used for high-dimensional embeddings as in mongodb.ts
line 116.
| process.env.SUPABASE! ?? | ||
| 'postgresql://user:password@localhost:5432/mydb', |
There was a problem hiding this comment.
Non-null assertion ! is misleading with nullish coalescing ??.
The ! asserts SUPABASE is non-null, but then ?? provides a fallback for null/undefined anyway. If SUPABASE is truly expected to be set, remove the ?? fallback; otherwise, remove the ! to avoid confusion.
🔎 Suggested fix
connectionString:
- process.env.SUPABASE! ??
+ process.env.SUPABASE ??
'postgresql://user:password@localhost:5432/mydb',📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| process.env.SUPABASE! ?? | |
| 'postgresql://user:password@localhost:5432/mydb', | |
| process.env.SUPABASE ?? | |
| 'postgresql://user:password@localhost:5432/mydb', |
🤖 Prompt for AI Agents
In src/mastra/index.ts around lines 184-185, the code uses a non-null assertion
on process.env.SUPABASE together with a nullish-coalescing fallback which is
contradictory; either make SUPABASE required by removing the "??
'postgresql://...'" fallback so the non-null assertion is meaningful, or make it
optional by removing the "!" and keeping the fallback (or handling undefined
explicitly). Update the line to choose one of those two options and ensure
surrounding code/types reflect whether SUPABASE can be undefined.
| async (c, next) => { | ||
| const start = Date.now() | ||
| await next() | ||
| const duration = Date.now() - start | ||
| log.info(`${c.req.method} ${c.req.url} - ${duration}ms`) | ||
| }, |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Request URL logging may expose sensitive query parameters.
The timing logger logs the full c.req.url which could include sensitive query parameters (tokens, PII, etc.). Consider logging only the pathname or sanitizing the URL.
🔎 Suggested fix
async (c, next) => {
const start = Date.now()
await next()
const duration = Date.now() - start
- log.info(`${c.req.method} ${c.req.url} - ${duration}ms`)
+ const url = new URL(c.req.url)
+ log.info(`${c.req.method} ${url.pathname} - ${duration}ms`)
},🤖 Prompt for AI Agents
In src/mastra/index.ts around lines 341 to 346, the timing middleware currently
logs c.req.url which may include sensitive query parameters; change the log to
exclude or sanitize query data by logging only the request pathname (or parse
the URL and remove/whitelist query params) and optionally mask known sensitive
keys (e.g., token, password, ssn) before logging, preserving method and duration
output.
There was a problem hiding this comment.
Pull request overview
This PR refactors agent prompts for conciseness, restructures the web scraper tool with improved schema organization, updates vector storage configuration, and introduces new chat UI components.
Key Changes:
- Agent prompts streamlined from verbose frameworks to condensed protocols across 15+ agents
- Web scraper tool reorganized into separate schemas (crawling, extraction, request, storage) with nested output structure
- Vector index changed from 'flat' to 'hnsw' with condensed memory template
Reviewed changes
Copilot reviewed 37 out of 37 changed files in this pull request and generated 31 comments.
Show a summary per file
| File | Description |
|---|---|
| src/mastra/tools/web-scraper-tool.ts | Restructured input schemas into logical groups and nested output structure (content/storage/analysis) |
| src/mastra/index.ts | Uncommented middleware, routes, and MCP servers; added non-null assertion to SUPABASE env var |
| src/mastra/config/pg-storage.ts | Changed index type from 'flat' to 'hnsw'; condensed memory template |
| src/mastra/agents/*.ts | Consolidated verbose reasoning frameworks into concise protocols; added tool efficiency rules |
| app/chat/components/chat-sidebar.tsx | New component displaying agent details, capabilities, checkpoints, and memory config |
| app/chat/components/chat-input.tsx | Enhanced with model/agent selectors, speech button, checkpoint creation, and context display |
| app/chat/components/chat-header.tsx | Added mt-16 margin and updated Tailwind classes |
| app/chat/config/google-models.ts | Added Gemini 3 Flash Preview and reordered Gemini 3 Pro Preview |
| app/chat/page.tsx | Updated layout to include sidebar with adjusted height calculation |
| app/workflows/page.tsx | Added pt-16 padding for navbar clearance |
| // }, | ||
| await next() | ||
| }, | ||
| //Request timing logger |
There was a problem hiding this comment.
Comment text has irregular spacing: "//Request timing logger" should be "// Request timing logger" (with a space after the slashes). This is inconsistent with standard JavaScript comment formatting conventions.
| # Senior Research Analyst | ||
| Tier: ${userTier} | Lang: ${language} | Phase: ${researchPhase} |
There was a problem hiding this comment.
The 'userId' variable has been removed from the agent's system prompt in the refactored version (line 46 of the diff context shows it was previously used). If this was intentional cleanup of unused context, that's fine, but if userId was meant to be included in the new condensed format, it should be added back to line 52.
| setResourceId(tempResourceId) | ||
| }, [tempThreadId, tempResourceId, setThreadId, setResourceId]) | ||
|
|
||
| if (!agentConfig) {return null} |
There was a problem hiding this comment.
Early return with missing closing brace. The condition checks if (!agentConfig) {return null} but the opening brace placement on line 44 suggests it should be if (!agentConfig) { return null } with the return statement on the same line or properly formatted. The current formatting is non-standard.
| if (!agentConfig) {return null} | |
| if (!agentConfig) { | |
| return null | |
| } |
| <ModelSelectorEmpty>No agents found.</ModelSelectorEmpty> | ||
| {CATEGORY_ORDER.map((category) => { | ||
| const agents = agentsByCategory[category] | ||
| if (agents.length === 0) {return null} |
There was a problem hiding this comment.
Similar early return formatting issue. The condition if (agents.length === 0) {return null} should be formatted as if (agents.length === 0) return null or with proper spacing around braces for consistency with JavaScript/TypeScript style conventions.
| if (agents.length === 0) {return null} | |
| if (agents.length === 0) return null |
| export function AgentInlineCitation({ citations, text }: AgentInlineCitationProps) { | ||
| const citation = citations[0] | ||
| if (!citation) {return <span>{text}</span>} | ||
| if (citations.length === 0) {return <span>{text}</span>} |
There was a problem hiding this comment.
The original code assigned citations[0] to a variable and checked if it exists. The refactored version checks citations.length === 0 directly which is correct and more efficient. However, the original code would have handled the case where citations array exists but is empty, while this new check might behave differently if citations is undefined (though TypeScript should prevent that). The change is likely fine but verify that citations is always defined as an array.
| @@ -32,98 +32,23 @@ export const documentProcessingAgent = new Agent({ | |||
| const chunkSize = requestContext.get('chunkSize') ?? 512 | |||
There was a problem hiding this comment.
'chunkSize' is assigned a value but never used.
| @@ -32,98 +32,23 @@ export const documentProcessingAgent = new Agent({ | |||
| const chunkSize = requestContext.get('chunkSize') ?? 512 | |||
| const chunkOverlap = requestContext.get('chunkOverlap') ?? 50 | |||
There was a problem hiding this comment.
'chunkOverlap' is assigned a value but never used.
| @@ -32,100 +32,23 @@ export const knowledgeIndexingAgent = new Agent({ | |||
| const chunkOverlap = requestContext.get('chunkOverlap') ?? 50 | |||
There was a problem hiding this comment.
'chunkOverlap' is assigned a value but never used.
| const chunkOverlap = requestContext.get('chunkOverlap') ?? 50 |
| import { | ||
| BotIcon, | ||
| CpuIcon, | ||
| HistoryIcon, | ||
| BookmarkIcon, | ||
| SettingsIcon, | ||
| DatabaseIcon, | ||
| HashIcon, | ||
| UserIcon, | ||
| CheckCircle2Icon, | ||
| CircleIcon, | ||
| InfoIcon, | ||
| } from "lucide-react" |
There was a problem hiding this comment.
Unused import CpuIcon.
| resourceId, | ||
| setThreadId, | ||
| setResourceId, | ||
| selectedModel, |
There was a problem hiding this comment.
Unused variable selectedModel.
| selectedModel, |

Summary by Sourcery
Streamline multiple agents’ system prompts and reasoning protocols while enhancing chat UI, web scraping tool schemas, and pg-vector storage configuration.
New Features:
Bug Fixes:
Enhancements:
Documentation:
Chores: