Version: 1.0 (January 2026) Owner: MBA Student / Senior UI Expert Primary Objective: High-speed, high-reasoning business analysis with a professional corporate aesthetic.
To maintain a tidy and professional workspace, all UI changes must follow these rules:
- Font: Clean Sans-Serif stack (Primary: Calibri, Secondary: Inter/Arial).
- Text Alignment: Analysis results and exam questions MUST be justified (
text-justify) withleading-relaxedline height. - Layout: "Viewport Lock" (100vh). No page-level scrolling.
- Main Canvas (Center): Primary reading and exam area.
- Control Panel (Right): Fixed 400px width for inputs and actions.
- Sidebar: Removed for maximum reading focus.
The application uses a 3-Tier fallback system to ensure 100% uptime:
- TIER 1 (Primary):
gemini-2.5-flash- Fast, everyday tasks. - TIER 2 (Strategic):
gemini-3-flash-preview- Deep MBA case analysis. - TIER 3 (Safety Net):
gemini-2.5-flash-lite- Emergency fallback for 503/429 errors.
- Mandatory: All responses must use
generateContentStream(no blocking calls) - Latency: Stream must start within 2 seconds of request
- Frontend: Handles partial chunks gracefully (Markdown/JSON buffering)
- Error Handling: Robust try-catch blocks prevent UI crashes from incomplete chunks
Follow these steps for academic rigor:
- Analyze: Upload document (PDF, DOCX, CSV, or Image) -> Generate Initial Analysis.
- Audit: Click "Audit Analysis" to run
@academic-peer-review.mdusing the "Pro" model. - Test: Navigate to "Mock Exam" tab to generate situational questions via
@exam-generator.md. - Learn: Use the footer "Learning Opportunities" via
@learning-opportunity.mdto bridge knowledge gaps.
- Supported Types: PDF, DOCX, CSV, Images (PNG, JPEG, GIF, WebP)
- Not supported: PPTX
- File API Path: Documents (PDF, DOCX, CSV) use
GoogleAIFileManagerwithfileData: { fileUri, mimeType }wrapper - Inline Data Path: Images use Base64
inlineDatafor smaller payloads - Temp File Cleanup: All temporary files uploaded via File API are automatically deleted after use
- Brain Mode Selector: Choose Tier 1 (Primary), Tier 2 (Strategic), or Tier 3 (Safety Net) in right panel
- Model Context Selector: Auto-detect, General, Finance, Marketing, or Strategy perspective
- Model Selection: Mock Exam always uses Tier 1 (gemini-2.5-flash) for better JSON compliance
- Response Schema: Strict JSON schema enforced to prevent parsing errors
- Format:
{ questions: [{ question, options, correctIndex, rationale }] }
When modifying the application, the Agent MUST follow this sequence:
- Check Commands: Always reference the relevant
.mdfile in the/commandsfolder. - Exploration Phase: Use
@exploration-phase.mdfor major feature planning. - Code Audit: Use
@code-peer-review.md(Cross-Model Verification) before final implementation to check Gemini's logic against Claude's standards. - Architectural Guardrails: No Prisma, no Docker, no external servers. Keep it lightweight.
- MIME Error: If a file fails, ensure it is a PDF, DOCX, CSV, or Image. DOCX/CSV require the 'File API' path. PPTX is not supported.
- Stream Error: If the stream fails to parse, check the
extractJsonbuffer logic inapp/page.tsx. - JSON Parse Error: Verify Response Schema is configured correctly for Mock Exam. Check browser console for raw output.
- Quota Error (429): The system should auto-shift to Tier 3. Automatic retry with 5-second delay (max 2 retries) before fallback.
- 503 Overload: Automatic retry with 5-second delay (max 2 retries), then fallback to Tier 3.
- File Upload Failure: Verify File API initialization (
GoogleAIFileManager) and check temp file cleanup inapp/actions/gemini.ts. - Model Not Found (404): Verify model name matches registry. Check
@gemini-api-config.mdfor correct model strings.