Skip to content

Latest commit

 

History

History
155 lines (124 loc) · 7.45 KB

File metadata and controls

155 lines (124 loc) · 7.45 KB

ByeBrief Architecture

System Diagram

┌─────────────────────────────────────────────────────────────────┐
│                        ByeBrief Client                          │
├─────────────────────────────────────────────────────────────────┤
│                                                                 │
│  ┌──────────────┐    ┌──────────────┐    ┌──────────────┐      │
│  │   React UI   │───▶│  Zustand     │───▶│  React Flow  │      │
│  │  Components  │    │   Store      │    │    Canvas    │      │
│  └──────────────┘    └──────────────┘    └──────────────┘      │
│         │                   │                                    │
│         ▼                   ▼                                    │
│  ┌──────────────┐    ┌──────────────┐                           │
│  │ Export Logic │    │  Audit Log   │                           │
│  │ (MD/DOCX/    │    │  (Session    │                           │
│  │  PDF/TXT)    │    │   Recording) │                           │
│  └──────────────┘    └──────────────┘                           │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘
            │                                    ▲
            ▼                                    │
┌─────────────────────────────────────────────────┼───────────────┐
│                    Local Runtime                │               │
├─────────────────────────────────────────────────┼───────────────┤
│                                                 │               │
│  ┌─────────────────────────────────────────────▼─────────────┐  │
│  │              Ollama (localhost:11434)                   │  │
│  │  ┌─────────────┐  ┌─────────────┐  ┌─────────────┐       │  │
│  │  │  Generate   │  │  Analyze    │  │   Draft     │       │  │
│  │  │  Draft      │  │  Claims     │  │   Reports   │       │  │
│  │  └─────────────┘  └─────────────┘  └─────────────┘       │  │
│  └───────────────────────────────────────────────────────────┘  │
│                                                                 │
│  ┌─────────────────────────────────────────────┐               │
│  │     Optional: Web Search API ( Brave )      │               │
│  └─────────────────────────────────────────────┘               │
│                                                                 │
└─────────────────────────────────────────────────────────────────┘

Data Flow

1. Canvas Interactions

User Action → React Flow → Zustand Store → localStorage (persistence)
  1. User drags node on canvas
  2. React Flow emits onNodesChange event
  3. Zustand store updates node position
  4. Change persisted to localStorage

2. AI Requests

User clicks AI action → Zustand settings → Ollama API → Parse response → Update UI
  1. User clicks "Generate Draft" or other AI action
  2. Component retrieves current nodes, notes, settings from Zustand
  3. Prompt sent to Ollama at configured base URL
  4. Response parsed and displayed in AI Results Panel

3. Export Flow

User clicks Export → Gather canvas data → Format (MD/DOCX/PDF/TXT) → Download
  1. User selects export format
  2. Export module gathers nodes, notes, connections
  3. Applies legal-grade template (IRAC structure)
  4. Generates file and triggers browser download

4. Session Recording

Action performed → Audit log entry → Stored in Zustand → Exportable

Every significant action creates an audit log entry with timestamp.

Model Integration Points

Ollama Connection (src/ollama.ts)

// Configuration
interface OllamaSettings {
  baseUrl: string;      // e.g., "http://localhost:11434"
  model: string;        // e.g., "llama3.2"
  temperature: number;  // 0.0 - 1.0
  topP: number;         // 0.0 - 1.0
  maxTokens: number;    // max response length
  streaming: boolean;  // stream responses
  retries: number;     // retry attempts
}

Prompt Engineering

  • AI Optimize: Structure analysis, gap detection
  • Cross-Examine: Claim-evidence mapping, contradiction detection
  • Generate Draft: IRAC legal method, executive summary

Search Integration (src/search.ts)

Optional Brave Search or Tavily API integration for research assistance.


Security Boundary

What Stays Local

Data Storage Access
Investigation nodes localStorage Browser only
Notes localStorage Browser only
Session recordings localStorage Browser only
Settings localStorage Browser only
Audit logs localStorage Browser only

What Can Call External Services

Service Trigger Data Sent
Ollama User action Nodes, notes, prompts
Brave Search Opt-in, user action Search queries only
Tavily Search Opt-in, user action Search queries only

Privacy Guarantees

  1. No telemetry: No usage data collected
  2. No cloud sync: All data local by default
  3. Explicit consent: Search requires API key configuration
  4. Local AI: Ollama runs on localhost only

Configuration

  • All settings stored in localStorage
  • Settings include: model URL, API keys, UI preferences
  • Clear data option in Settings → UI tab

Key Modules

Module Responsibility
src/store.ts Zustand state, audit logging
src/ollama.ts Ollama API client, prompt templates
src/viral.ts Viral feature implementations
src/export.ts File generation (MD/DOCX/PDF/TXT)
src/components/*.tsx React UI components