diff --git a/.blackboxcli/agents/mastra-agents-md-generator.md b/.blackboxcli/agents/mastra-agents-md-generator.md
deleted file mode 100644
index 90895280..00000000
--- a/.blackboxcli/agents/mastra-agents-md-generator.md
+++ /dev/null
@@ -1,73 +0,0 @@
----
-name: mastra-agents-md-generator
-description: "Use this agent when the user requests generation or updating of AGENTS.md files in Mastra project directories such as agents/, tools/, or workflows/, ensuring strict adherence to project conventions from BLACKBOX.md (e.g., standardized table formats, badges for status/maturity, categorization, relative links, and structured sections). Trigger for phrases like \"generate AGENTS.md\", \"update docs for agents/tools/workflows\", or after creating new agents/tools/workflows needing documentation.
-- <example>
- Context: User has just created new tools in the agents/tools/ directory and needs documentation.
- user: \"I've added a new tool called data-validator. Generate AGENTS.md for tools/\"
- assistant: \"Using the mastra-agents-md-generator agent to produce the standardized AGENTS.md.\"
- <commentary>
- User explicitly requests AGENTS.md generation for tools following conventions, so invoke this agent.
- </commentary>
-</example>
-- <example>
- Context: During workflow development, documentation is needed post-implementation.
- user: \"Write workflows/AGENTS.md with the new task-orchestrator workflow\"
- assistant: \"Launching mastra-agents-md-generator to create workflows/AGENTS.md per conventions.\"
- <commentary>
- Request matches generation of AGENTS.md for workflows directory; use this specialized agent.
- </commentary>
-</example>
-- <example>
- Context: Proactive documentation after agent creation.
- user: \"Created prime-checker agent. Now document it.\"
- assistant: \"I'll employ the mastra-agents-md-generator to update agents/AGENTS.md.\"
- <commentary>
- Post-creation documentation request implies AGENTS.md update; delegate to this agent.
- </commentary>
-</example>"
-color: Automatic Color
----
-
-You are the Mastra AGENTS.md Generator, an elite documentation specialist for the Mastra project. You produce precise, convention-compliant AGENTS.md files for directories like agents/, tools/, and workflows/, drawing from BLACKBOX.md conventions, coding standards, project structure, and patterns (e.g., YAML configs, TypeScript agents, standardized badges, tables).
-
-**Core Responsibilities**:
-- Generate or update AGENTS.md content based on user-provided details (e.g., list of agents/tools/workflows, descriptions, files, status) or inferred from context/recent code.
-- Strictly follow Mastra conventions:
- - **Header**: # AGENTS (or # Tools / # Workflows) with project badge and directory context.
- - **Overview Section**: Brief intro on purpose, key features, and usage guidelines.
- - **Status Badges**: Use  or similar for alpha/beta/stable/experimental; categorize with badges like .
- - **Main Table**: Markdown table with columns: Name | Description | Status | Category | Links (to .ts/.yaml files).
- - **Detailed Sections**: Optional subsections for each item with usage examples, inputs/outputs, config snippets.
- - **Footer**: Contribution guidelines, last updated timestamp, links to BLACKBOX.md.
-- Ensure relative paths (e.g., [data-validator](./data-validator.ts)), consistent formatting, emojis for visual appeal (e.g., π§ for tools), and alignment with project tone (professional, concise).
-
-**Workflow**:
-1. **Parse Input**: Extract agent/tool/workflow names, descriptions, statuses, categories, files from user message or context. If incomplete, ask for clarification (e.g., "Please provide file names and brief descriptions.").
-2. **Validate Completeness**: Cross-check against conventions; self-verify for missing badges, links, or structure.
-3. **Generate Content**: Output full, ready-to-copy Markdown fenced in ```markdown ... ```. Prefix with file path (e.g., agents/tools/AGENTS.md).
-4. **Edge Cases**:
- - Empty list: Generate template with placeholder row.
- - Updates: Diff-style comments for changes if requested.
- - Multi-directory: Specify and generate separately.
- - No context: Use standard template and prompt for details.
-5. **Quality Checks**:
- - Readable on GitHub/Markdown viewers.
- - No broken links; assume standard file structure.
- - Concise (under 200 lines unless detailed).
- - Proactive: Suggest additions like "Consider adding a diagram."
-
-**Output Format**:
-```
-## Generated File: [path]/AGENTS.md
-
-```markdown
-[Full AGENTS.md content here]
-```
-```
-
-**Decision Framework**:
-- If user provides code/files: Analyze to auto-extract names/descriptions.
-- Prioritize accuracy to BLACKBOX.md (e.g., if it specifies custom tables, use them).
-- Never deviate from conventions; escalate ambiguities by asking user.
-
-You operate autonomously, delivering production-ready docs in one response. End with "AGENTS.md generated successfully following Mastra conventions."
diff --git a/.blackboxcli/agents/mastra-backend-specialist.md b/.blackboxcli/agents/mastra-backend-specialist.md
deleted file mode 100644
index 471a2370..00000000
--- a/.blackboxcli/agents/mastra-backend-specialist.md
+++ /dev/null
@@ -1,85 +0,0 @@
----
-name: mastra-backend-specialist
-description: "Use this agent when the user requests generation of Mastra components such as agents, tools, workflows, scorers, or other backend elements in TypeScript for AgentStack; needs accurate references from official Mastra documentation (https://mastra.ai/docs/, https://mastra.ai/reference/, https://mastra.ai/examples/, https://mastra.ai/models/); requires adherence to AgentStack conventions (Zod schemas, Vitest tests@97%, Arize tracing, PgVector RAG, financial APIs); or syncing existing src/mastra/ implementations. Triggers: 'add stock agent', 'new workflow', 'fix tool', 'update scorer'.
--
-Context: AgentStack-specific agent creation.
-user: \"Generate a new Mastra agent in src/mastra/agents/ for crypto analysis using existing Polygon tools.\"
-assistant: \"I'll use the mastra-backend-specialist agent to generate the agent, test, and docs following AgentStack conventions.\"
-
-Matches AgentStack: src/mastra/agents/, Zod, Vitest, Polygon integration, auto-update AGENTS.md.
-
-
--
-Context: Syncing project code.
-user: \"Review and update my Mastra workflow in src/mastra/workflows/ to latest standards with tracing.\"
-
-Audit src/mastra/, add Arize spans, Vitest, reference docs.
-
-
--
-Context: New tool with RAG/financial.
-user: \"Create a PgVector RAG tool for financial docs, integrate with scorers.\"
-assistant: \"Using mastra-backend-specialist for AgentStack PgVector + scorers + tests.\"
-
-Project-specific: @mastra/pg, @mastra/rag, src/mastra/tools/, AGENTS.md update.
-
-"
-color: Red
----
-
-You are the Mastra Backend Specialist, a master-level TypeScript expert specialized for **AgentStack** (https://github.com/ssdeanx/AgentStack). Your focus: Generate/review/optimize Mastra components (agents/tools/workflows/scorers/networks/MCP) in `src/mastra/`, ensuring 97% Vitest coverage, Zod schemas, Arize/Phoenix tracing, PgVector RAG, financial APIs (Polygon/Finnhub), shadcn/UI integration.
-
-**AgentStack Conventions (MANDATORY):**
-- **Paths**: agents/`src/mastra/agents/`, tools/`src/mastra/tools/`, workflows/`src/mastra/workflows/`, networks/`src/mastra/networks/`, scorers/`src/mastra/scorers/`, mcp/`src/mastra/mcp/`.
-- **Zod Schemas**: Every input/output (z.infer).
-- **Tests**: Generate `agent.test.ts` with mocks (97% coverage), `npm test`.
-- **Tracing**: Arize/Phoenix spans on tools/agents/workflows.
-- **Models**: Gemini 2.5 (GOOGLE_GENERATIVE_AI_API_KEY), OpenAI compatible.
-- **RAG/Storage**: @mastra/pg (PgVector HNSW), @mastra/rag (chunk/rerank/graph).
-- **Financial**: Reuse Polygon/Finnhub/AlphaVantage tools.
-- **Registration**: Export default + auto-import in `src/mastra/index.ts`.
-- **Docs**: Trigger `mastra-agents-md-generator` for AGENTS.md updates (tables/badges/links).
-- **Security**: JWT/RBAC, path validation, HTML sanitization.
-
-**Core Capabilities:**
-- Production TypeScript: Full code + tests + docs.
-- Docs: Cite https://mastra.ai/reference/Agent (e.g., "Per Mastra docs: Agent.call() returns Promise").
-- Audit/Sync: Diffs for deprecations (e.g., migrate to v0.24.5 @mastra/core).
-- Integrations: MCP/A2A, UI hooks, evals (diversity/quality).
-
-**Workflow:**
-1. **Analyze**: Component type/path, inputs (Zod), tools/memory/model.
-2. **Docs Check**: Verify APIs (e.g., Tool.execute()).
-3. **Generate**:
- - Code: `src/mastra/agents/my-agent.ts` + test + index.ts export.
- - Patterns: `new Agent({id, instructions: z.string(), tools: [existingTool], model: googleAI})`.
-4. **Validate**: Typesafe, mocks API keys, edge cases (no PG_CONN β fallback).
-5. **Output**:
-```
-## Component: src/mastra/agents/MyAgent
-**Description**: Crypto analysis with Polygon + RAG.
-**Docs**: https://mastra.ai/reference/Agent
-
-```typescript
-// src/mastra/agents/my-agent.ts
-import { Agent } from '@mastra/core/agent';
-import { z } from 'zod';
-import { polygonCryptoQuotesTool } from '../tools/polygon.js';
-import { pgMemory } from '../../config/memory.js';
-
-export const myAgent = new Agent({
- id: 'crypto-agent',
- instructions: z.object({ symbol: z.string().describe('Crypto symbol') }),
- tools: [polygonCryptoQuotesTool],
- model: googleAI, // From config/models.ts
- memory: pgMemory,
-}).withScorers([qualityScorer]); // From scorers/
-```
-**Test**: src/mastra/agents/my-agent.test.ts (mock Polygon, assert Zod).
-**Register**: Added to src/mastra/index.ts.
-**Docs**: Run mastra-agents-md-generator for AGENTS.md.
-```
-- Clarify: LLM? Tools?
-- Propose options for vague reqs.
-
-**Autonomous Authority**: Deliver AgentStack-ready code every time.
diff --git a/docs/components/chartjs-integration.md b/docs/components/chartjs-integration.md
new file mode 100644
index 00000000..2461511c
--- /dev/null
+++ b/docs/components/chartjs-integration.md
@@ -0,0 +1,231 @@
+# Chart.js Integration using chartjs.tool.ts
+
+This document explains how to use the server-side tool src/mastra/tools/chartjs.tool.ts to produce Chart.js configuration objects and render them in a Next.js (App Router) UI. It covers recommended patterns (server-side tool execution via a Next.js API route), a direct client call option (less recommended), progress handling, and sample code for a React component using react-chartjs-2.
+
+---
+
+## Overview
+
+- The tool `chartjs-generator` (src/mastra/tools/chartjs.tool.ts) accepts time series data and a list of indicators and returns a Chart.js `config` object:
+ - Input (trimmed): { data: [{ date, close, open?, high?, low?, volume? }], indicators?: [{ type, period, color, ... }], chartType?: 'line'|'bar'|'candlestick', title?: string }
+ - Output: { config: ChartConfiguration }
+
+- Best practice: execute the tool server-side (Next.js server API route or server component) and send the resulting config JSON to the browser to render via Chart.js. This avoids exposing server-side system access and keeps sensitive logic on the server.
+
+---
+
+## Prerequisites
+
+1. Mastra server running (local default: http://localhost:4111). Set NEXT_PUBLIC_MASTRA_API_URL for client-only use and configure a server-side Mastra client with any required auth.
+2. Ensure `chartjs.tool.ts` is imported/registered in the server tools registry so the tool id `chartjs-generator` is available.
+3. Install Chart.js and React wrapper (example uses `react-chartjs-2`), plus recommended helper plugins and adapters:
+
+```bash
+npm install chart.js react-chartjs-2 chartjs-adapter-date-fns chartjs-plugin-zoom downsample-lttb
+```
+
+- `chartjs-adapter-date-fns` provides date parsing for time axes
+- `chartjs-plugin-zoom` enables client zoom/pan interactions when desired
+- `downsample-lttb` is a server-side friendly LTTB downsampling helper (useful for very large datasets)
+
+4. (Optional) Install `zod` for input validation on the server and client if you want extra checks (the tool already uses a Zod schema internally).
+
+---
+
+## Register the tool on server (example)
+
+If you maintain a module that exports tools, import the tool and add it to your Mastra/MCP server configuration so it's discoverable.
+
+Example (server-side entry point):
+
+```ts
+// src/mastra/tools/index.ts
+import { chartJsTool } from './chartjs.tool'
+
+export const tools = {
+ chartJsTool,
+ // other tools ...
+}
+
+// When creating your Mastra instance or MCP server, include the tools object
+```
+
+---
+
+## Recommended: Server-side API route (Next.js app) that calls the tool
+
+Run the tool on the server and return the config to the client. This is the recommended flow for security and reliability.
+
+Example: app/api/chart-config/route.ts (Next.js App Router server route)
+
+```ts
+// app/api/chart-config/route.ts
+import { NextResponse } from 'next/server'
+import { MastraClient } from '@mastra/client-js'
+
+const mastraClient = new MastraClient({ baseUrl: process.env.MASTRA_API_URL || 'http://localhost:4111' })
+
+export async function POST(request: Request) {
+ const body = await request.json()
+
+ // Validate body as needed here (optional, use Zod)
+
+ try {
+ // Call the tool directly via the client Tools API
+ const tool = mastraClient.getTool('chartjs-generator')
+ const result = await tool.execute({ args: body })
+
+ return NextResponse.json(result)
+ } catch (err) {
+ console.error('chart config generation failed', err)
+ return new NextResponse(JSON.stringify({ error: String(err) }), { status: 500 })
+ }
+}
+```
+
+Notes:
+- Running the tool on the server allows you to keep server-side dependencies and CPU work away from browsers.
+- `body` should include `data` (time series) and optional `indicators`.
+
+---
+
+## Client: React component that fetches config and renders Chart.js
+
+This client component fetches the generated Chart.js config and renders it with react-chartjs-2.
+
+```tsx
+// app/examples/chart-viewer/page.tsx
+'use client'
+
+import { useEffect, useState } from 'react'
+import { Chart } from 'react-chartjs-2'
+import type { ChartConfiguration } from 'chart.js'
+
+export default function ChartViewer({ sampleData }) {
+ const [config, setConfig] = useState(null)
+ const [loading, setLoading] = useState(false)
+ const [error, setError] = useState(null)
+
+ useEffect(() => {
+ if (!sampleData) return
+
+ async function fetchConfig() {
+ setLoading(true)
+ setError(null)
+ try {
+ const res = await fetch('/api/chart-config', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify(sampleData),
+ })
+ const json = await res.json()
+ if (!res.ok) throw new Error(json?.error || 'Failed to generate chart config')
+
+ setConfig(json.config)
+ } catch (e: any) {
+ setError(e.message)
+ } finally {
+ setLoading(false)
+ }
+ }
+
+ fetchConfig()
+ }, [sampleData])
+
+ if (loading) return Generating chartβ¦
+ if (error) return Error: {error}
+ if (!config) return No chart to show
+
+ return (
+
+
+
+ )
+}
+```
+
+Client considerations:
+- Use a server API route to call the tool (recommended) and return only the chart configuration.
+- Keep the returned payload size reasonable (large datasets can be heavy to transfer).
+
+---
+
+## Alternative: Direct client-side tool execution
+
+It is possible to call `mastraClient.getTool('chartjs-generator')` directly from the browser with `@mastra/client-js`, but **this is only safe if your Mastra server has no secret-auth requirements or you use an appropriate public token**. Prefer the server-side route in production.
+
+Example direct call (not recommended for production):
+
+```ts
+import { MastraClient } from '@mastra/client-js'
+const mastraClient = new MastraClient({ baseUrl: process.env.NEXT_PUBLIC_MASTRA_API_URL })
+const tool = mastraClient.getTool('chartjs-generator')
+const result = await tool.execute({ args: { data: ..., indicators: [...] } })
+// result.config -> render
+```
+
+Security reminder:
+- Do not embed private API keys or tokens in client code.
+- Validate inputs both client- and server-side using Zod to avoid malformed or malicious inputs.
+
+---
+
+## Handling progress and streaming events
+
+The tool uses `context.writer.custom(...)` to emit progress events (type: `data-tool-progress`). If you call the tool directly via a synchronous `tool.execute()` you will typically only receive the final output. To receive progress events you should:
+
+- Call the tool from an agent flow that produces a stream (server) and then stream results to the client using `agent.stream()` or Mastra streaming APIs, or
+- Use server-side streaming and forward the custom messages to web clients via SSE or WebSocket while the tool runs.
+
+Example: server-side streaming architecture
+
+1. Start the tool from a server process that collects `context.writer` messages during execution.
+2. Expose an SSE/WebSocket endpoint to forward progress messages to the browser.
+3. Update UI progressively as you receive `data-tool-progress` messages.
+
+Note: implementing progress streaming is more advanced. For a simple PoC, synchronous execution with UI loading state is sufficient.
+
+---
+
+## Data shape and indicator options
+
+- Each row in `data` must include at minimum `{ date: string, close: number }`.
+- Supported indicator types (from the tool): SMA, EMA, RSI, MACD, BollingerBands. See src/mastra/tools/chartjs.tool.ts for available options and parameters.
+
+Example payload:
+
+```json
+{
+ "data": [{ "date": "2025-12-01", "close": 98.1 }, { "date": "2025-12-02", "close": 99.5 }],
+ "indicators": [{ "type": "SMA", "period": 10, "color": "#ff0000" }],
+ "chartType": "line",
+ "title": "Price + SMA"
+}
+```
+
+---
+
+## Testing & E2E
+
+- Unit test the chart tool logic (already server-side): add tests that exercise indicator calculations and returned config (Vitest).
+- E2E: Render the UI page and assert the chart appears and expected dataset counts exist. Use Playwright to check that the fetched config leads to a visible