Skip to content

Latest commit

ย 

History

82 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿง  FRM Desktop โ€“ Formal Reasoning Mode

FRM Desktop Version License Platform

A sophisticated desktop application for authoring, validating, and visualizing Formal Reasoning Mode (FRM) problem descriptions with equation-first mathematical modeling and AI-powered novelty assurance.

Features โ€ข Quick Start โ€ข Architecture โ€ข Screenshots โ€ข Contributing


๐Ÿš€ Overview

FRM Desktop is a cutting-edge Electron + React application designed for mechanism-level, equation-first reasoning in the AI era. It provides a comprehensive workspace for building sophisticated mathematical models across multiple domains including medicine, biology, engineering, AI, and more.

The application features AI-powered novelty assurance, Model Context Protocol (MCP) integration, and real-time communication logging to ensure every model you build remains schema-compliant, novel, and ready for AI consumption. The system is driven entirely by the enhanced frm_schema.json specification with comprehensive novelty assessment capabilities.

โœจ Features

๐ŸŽฏ Core Capabilities

  • ๐Ÿ“ Schema-Driven Editor - Intuitive form editor with real-time validation feedback
  • ๐Ÿ” Live AJV Validation - Instant validation against enhanced FRM JSON Schema with novelty assurance
  • ๐Ÿงฎ Equation-First Modeling - Built for ODE, PDE, DAE, SDE, and hybrid systems with novelty tagging
  • ๐Ÿค– AI Schema Generator - Generate domain-specific schemas using configurable OpenAI API integration
  • ๐Ÿ“Š Interactive Visualization - Real-time model visualization and analysis
  • ๐ŸŒ™ Modern UI - Beautiful dark/light theme with smooth animations and lazy loading

๐Ÿ—๏ธ Advanced Features

  • ๐Ÿ”ง Multi-Domain Support - 30+ domains including AI, astrophysics, climate science, quantum computing
  • ๐Ÿ“ Mathematical Rendering - KaTeX integration for beautiful equation display
  • ๐Ÿ’พ Import/Export - JSON-based problem sharing and collaboration
  • โšก Performance Optimized - Lazy-loaded components, validation caching, and efficient state management
  • ๐Ÿ›ก๏ธ Type Safety - Full TypeScript support with generated schema types and runtime type guards
  • ๐Ÿ”— MCP Integration - Model Context Protocol server for AI tool integration
  • ๐Ÿ“ก Real-time Communication - Live communication logging and monitoring panel
  • ๐ŸŽฏ Novelty Assurance - AI-powered novelty assessment with similarity metrics and redundancy checking
  • โฑ๏ธ Generation Timer - Real-time timer display during schema generation with precise duration tracking
  • ๐Ÿ“‹ Generation Logging - Comprehensive logging of each generation including model, domain, sub-domain, and duration

๐Ÿ”ง Developer Features

  • ๐Ÿ“ Monaco Editor - Professional code editor with syntax highlighting and IntelliSense
  • ๐Ÿ”„ Schema Migration - Built-in tools for schema version migration and updates
  • ๐Ÿ› Schema Debugging - Comprehensive debugging utilities for schema validation
  • ๐Ÿ“‹ Clipboard Integration - Advanced copy/paste functionality for schema elements
  • โšก Build Optimization - Advanced code splitting and chunk optimization
  • ๐Ÿ›ก๏ธ Error Boundaries - Robust error handling with graceful degradation
  • ๐Ÿ“Š Virtualized Lists - High-performance rendering for large datasets

๐Ÿš€ What's New in v1.0.0

๐ŸŽฏ Novelty Assurance System

  • AI-Powered Novelty Detection - Integrated similarity assessment using cosine embeddings, ROUGE-L, and NovAScore
  • Comprehensive Citation Management - Full citation tracking with coverage analysis and conflict detection
  • Evidence Mapping - Systematic evidence tracking linking claims to supporting citations
  • Redundancy Prevention - Automated detection of duplicate work with configurable thresholds

๐Ÿ”— Model Context Protocol (MCP) Integration

  • MCP Server Implementation - Built-in MCP server for AI tool integration
  • Real-time Communication Logging - Live monitoring of AI interactions and tool calls
  • Tool Validation - Comprehensive validation of FRM documents through MCP tools
  • Performance Monitoring - Real-time statistics and connection status tracking

โšก Performance Optimizations

  • Validation Caching - LRU-style caching with 90% performance improvement for repeated operations
  • Lazy Loading - Component-level lazy loading for faster initial load times
  • Memory Management - Optimized memory usage with WeakMap caching and cleanup
  • Type Guard Optimization - Runtime type validation with performance monitoring

๐ŸŽจ Enhanced User Experience

  • Domain Selector - Comprehensive domain selection with 30+ scientific domains
  • Communication Panel - Real-time monitoring of AI interactions and system events
  • Enhanced Validation - Detailed error reporting with context-aware suggestions
  • Modern UI Components - Radix UI components with smooth animations and accessibility

๐Ÿš€ Quick Start

Prerequisites

  • Node.js 18+
  • npm 9+

Installation & Development

# Clone the repository
git clone https://github.com/DesmondForward/formal-reasoning-mode.git
cd formal-reasoning-mode

# Install dependencies
npm install

# Start development server
npm run dev

The development script starts both the Vite dev server and Electron, providing hot-reload for rapid development.

Building & Distribution

# Build for production
npm run build

# Create desktop packages
npm run dist          # All platforms
npm run dist:win      # Windows only
npm run dist:mac      # macOS only
npm run dist:linux    # Linux only

๐Ÿ—๏ธ Architecture

Technology Stack

Layer Technology Purpose
๐Ÿ–ฅ๏ธ Desktop Electron 38 Cross-platform desktop runtime
โš›๏ธ Frontend React 18 + TypeScript 5.3.3 Modern UI with type safety
๐ŸŽจ Styling Tailwind CSS 3.4.0 + Framer Motion Responsive design with animations
๐Ÿ” Validation AJV 8.12.0 + json-schema-to-ts Schema validation and type generation
๐Ÿงฎ Math KaTeX 0.16.9 + react-katex Mathematical equation rendering
๐Ÿ”ง Build Vite 7.1.7 Fast development and optimized builds
๐Ÿค– AI Integration Configurable OpenAI API AI-powered schema generation
๐Ÿ”— MCP Model Context Protocol AI tool integration and communication
๐Ÿ“Š State Management React Hooks + Context Efficient state management with caching

Key Technologies

  • Monaco Editor - Professional code editing with syntax highlighting
  • Radix UI - Accessible, unstyled UI components
  • Axios - HTTP client for API communication
  • Zod - Runtime type validation and schema parsing
  • PostCSS - CSS processing and optimization
  • Cross-env - Cross-platform environment variable handling

Project Structure

๐Ÿ“ FRM Desktop/
โ”œโ”€โ”€ ๐Ÿ“ main/                    # Electron main process
โ”‚   โ”œโ”€โ”€ main.ts                 # Main process entry point
โ”‚   โ”œโ”€โ”€ preload.ts              # Secure preload script
โ”‚   โ””โ”€โ”€ ๐Ÿ“ mcp/                 # Model Context Protocol server
โ”‚       โ””โ”€โ”€ frmMcpServer.ts     # MCP server implementation
โ”œโ”€โ”€ ๐Ÿ“ src/                     # React renderer application
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ components/          # React components
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ editors/         # Specialized form editors
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ NoveltyAssuranceEditor.tsx # Novelty assessment editor
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ InputEditor.tsx # Input specification editor
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ModelingEditor.tsx # Mathematical modeling editor
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ MethodSelectionEditor.tsx # Method selection editor
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ SolutionAnalysisEditor.tsx # Solution analysis editor
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ValidationEditor.tsx # Validation editor
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ OutputContractEditor.tsx # Output contract editor
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ ui/              # Reusable UI components
โ”‚   โ”‚   โ”œโ”€โ”€ SchemaEditor.tsx    # Main schema editor
โ”‚   โ”‚   โ”œโ”€โ”€ ValidationPanel.tsx # Real-time validation
โ”‚   โ”‚   โ”œโ”€โ”€ VisualizationPanel.tsx # Model visualization
โ”‚   โ”‚   โ”œโ”€โ”€ CommunicationLogPanel.tsx # Real-time communication monitoring
โ”‚   โ”‚   โ”œโ”€โ”€ VirtualizedEventList.tsx # High-performance event rendering
โ”‚   โ”‚   โ”œโ”€โ”€ ErrorBoundary.tsx   # Error handling component
โ”‚   โ”‚   โ””โ”€โ”€ DomainSelector.tsx  # Domain selection component
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ hooks/               # Custom React hooks
โ”‚   โ”‚   โ”œโ”€โ”€ useCommunication.ts # Communication monitoring
โ”‚   โ”‚   โ”œโ”€โ”€ useValidation.ts    # Validation with caching
โ”‚   โ”‚   โ”œโ”€โ”€ useFRMData.ts       # Data management
โ”‚   โ”‚   โ””โ”€โ”€ useTheme.ts         # Theme management
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ data/                # Schema definitions and types
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ utils/               # Utility functions
โ”‚   โ”‚   โ”œโ”€โ”€ typeGuards.ts       # Runtime type validation
โ”‚   โ”‚   โ”œโ”€โ”€ validation.ts       # Validation utilities
โ”‚   โ”‚   โ”œโ”€โ”€ schemaMigration.ts  # Schema migration tools
โ”‚   โ”‚   โ”œโ”€โ”€ schemaDebug.ts      # Schema debugging utilities
โ”‚   โ”‚   โ”œโ”€โ”€ schemaGenerator.ts  # AI schema generation
โ”‚   โ”‚   โ””โ”€โ”€ clipboard.ts        # Clipboard utilities
โ”‚   โ””โ”€โ”€ App.tsx                 # Application root
โ”œโ”€โ”€ ๐Ÿ“„ frm_schema.json          # Enhanced FRM JSON Schema with novelty assurance
โ””โ”€โ”€ ๐Ÿ“„ package.json             # Dependencies and scripts

๐ŸŽจ Screenshots

Main Editor Interface

Schema Editor

Real-time Validation

Validation Panel

Model Visualization

Visualization Panel

๐Ÿ”ง Configuration

Environment Variables

Create a .env.local file for development. Copy from .env.example and configure your preferred AI provider:

# AI Provider Configuration
# Set AI_PROVIDER to one of: openai, google, anthropic
AI_PROVIDER=openai

# OpenAI Configuration (for AI example generation)
OPENAI_API_KEY=your_openai_api_key_here
OPENAI_MODEL=gpt-5.5
OPENAI_API_URL=https://api.openai.com/v1/responses
OPENAI_REASONING_EFFORT=medium
OPENAI_TEXT_VERBOSITY=low

# Google Gemini Configuration
GOOGLE_API_KEY=your_google_api_key_here
GOOGLE_MODEL=gemini-2.5-pro
GOOGLE_API_URL=https://generativelanguage.googleapis.com/v1beta

# Anthropic Claude Configuration
ANTHROPIC_API_KEY=your_anthropic_api_key_here
ANTHROPIC_MODEL=claude-3-5-sonnet-20241022
ANTHROPIC_API_URL=https://api.anthropic.com/v1/messages

# Development
VITE_DEV_SERVER_URL=http://localhost:3000

Supported AI Providers:

  • OpenAI: GPT-5.5, GPT-5.4, GPT-5.2, GPT-5, GPT-4o, GPT-4o-mini, GPT-4-turbo
  • Google: Gemini 2.5 Pro, Gemini 2.5 Flash, Gemini 2.5 Flash-Lite, Gemini 1.5 Pro, Gemini 1.5 Flash
  • Anthropic: Claude 3.5 Sonnet, Claude 3.5 Haiku, Claude 3 Opus, Claude 3 Sonnet, Claude 3 Haiku

Schema Customization

The application is fully driven by frm_schema.json. To extend or modify the schema:

  1. Update frm_schema.json with your changes
  2. Regenerate TypeScript types: npm run generate-types
  3. The UI will automatically adapt to schema changes

๐Ÿ“š Usage Examples

Creating a New Problem

  1. Launch FRM Desktop
  2. Select a domain from the dropdown (medicine, biology, engineering, etc.)
  3. Generate a schema or start from scratch
  4. Edit the schema sections (Best for Professionals):
    • Metadata: Problem ID, domain, version
    • Input: Problem summary, known quantities, unknowns
    • Modeling: Equations, variables, model class
    • Method Selection: Solution methods and justification
    • Validation: Quality metrics and checks
    • Output Contract: Required sections and formatting
    • Novelty Assurance: Novelty assessment and citation management

AI-Powered Example Generation

// Generate a medicine domain schema
const example = await generateSchemaProblem({
  domain: 'medicine',
  scenarioHint: 'epidemic modeling with vaccination'
})

Schema Validation

// Real-time validation
const validation = useValidation(frmSchema)
const isValid = validation.isValid
const errors = validation.errors

๐Ÿงช Supported Domains

Domain Description Example Use Cases
๐Ÿค– Artificial Intelligence AI/ML models, neural networks, and intelligent systems Deep learning, reinforcement learning, optimization
๐ŸŒŒ Astrophysics Celestial mechanics, stellar dynamics, and cosmic phenomena Stellar evolution, orbital mechanics, cosmology
๐Ÿค– Autonomous Systems Robotics, autonomous vehicles, and self-governing systems Path planning, control systems, decision making
๐Ÿงฌ Biology Biological systems and processes Population dynamics, enzyme kinetics, gene regulation
โš—๏ธ Chemical Engineering Process design, reactor engineering, and chemical systems Reactor design, process optimization, kinetics
๐Ÿงช Chemistry Chemical reactions and processes Reaction kinetics, molecular dynamics, catalysis
๐ŸŒ Climate Science Climate modeling, carbon dynamics, and environmental systems Climate change, ecosystem dynamics, pollution
๐Ÿ’ป Coding Software engineering and computational problems Algorithm design, system architecture, performance optimization
๐Ÿ’ฐ Computational Finance Financial modeling and quantitative analysis Risk assessment, portfolio optimization, derivatives
๐Ÿ›ก๏ธ Cybersecurity Security systems and threat modeling Cryptography, network security, threat analysis
๐Ÿ“Š Data Science Data analysis and machine learning Statistical modeling, predictive analytics, data mining
๐Ÿ’ฐ Economics Economic modeling and analysis Market dynamics, policy impact, resource allocation
โšก Energy Systems Energy generation, storage, and distribution Renewable energy, grid optimization, storage systems
๐Ÿญ Engineering Engineering systems and control Control systems, structural analysis, optimization
๐ŸŒŠ Fluid Dynamics Fluid flow and transport phenomena CFD, turbulence modeling, heat transfer
๐ŸŒŠ Fluid Mechanics Fluid behavior and properties Viscous flow, compressible flow, multiphase systems
๐ŸŒ Geosciences Earth sciences and geological processes Seismic modeling, climate patterns, geological formations
๐Ÿ”ฌ General General-purpose mathematical and scientific problems Cross-domain applications, fundamental research
๐Ÿงฑ Materials Science Material properties and behavior Material design, phase transitions, mechanical properties
๐Ÿงฎ Mathematics Pure and applied mathematical problems Mathematical proofs, numerical methods, optimization
๐Ÿฅ Medicine Medical and healthcare applications Disease modeling, drug kinetics, treatment optimization
๐Ÿ“ Metrology Measurement science and standards Calibration, uncertainty quantification, measurement systems
๐Ÿง  Neuroscience Brain and nervous system modeling Neural networks, cognitive modeling, brain dynamics
๐ŸŒ Network Science Network analysis and graph theory Social networks, infrastructure networks, information flow
โš›๏ธ Physics Physical systems and phenomena Quantum mechanics, thermodynamics, electromagnetism
๐Ÿฅ Public Health Population health and epidemiology Disease spread, health policy, population dynamics
โš›๏ธ Quantum Computing Quantum systems and algorithms Quantum algorithms, error correction, optimization
๐ŸŒฑ Renewable Energy Sustainable energy systems Solar modeling, wind energy, energy storage
๐Ÿค– Robotics Robotic systems and automation Motion planning, sensor fusion, autonomous navigation
๐Ÿ“ก Signal Processing Signal analysis and processing Audio processing, image analysis, communication systems
๐Ÿ‘ฅ Social Science Social systems and human behavior Social dynamics, policy analysis, behavioral modeling
๐Ÿš€ Space Technology Space systems and aerospace engineering Orbital mechanics, spacecraft design, mission planning
๐Ÿงฌ Synthetic Biology Engineered biological systems Synthetic circuits, metabolic engineering, bio-design
๐Ÿงฌ Systems Biology Biological system integration Multi-scale modeling, biological networks, systems analysis

๐Ÿ” Schema Compliance & Novelty Assurance

  • โœ… Type Safety - Generated TypeScript types from JSON Schema with runtime type guards
  • โœ… Real-time Validation - AJV validation with detailed error reporting and caching
  • โœ… Schema Evolution - Automatic UI updates when schema changes
  • โœ… Import/Export - Full schema compliance for data portability
  • โœ… Novelty Assessment - AI-powered novelty detection with similarity metrics
  • โœ… Redundancy Checking - Automated detection of duplicate or similar work
  • โœ… Citation Management - Comprehensive citation tracking and validation
  • โœ… Evidence Tracking - Systematic evidence mapping for novelty claims

๐Ÿš€ Performance Features

Optimization Strategies

  • Lazy Loading - Components load on-demand to reduce initial bundle size
  • Validation Caching - LRU cache for validation results with 90% performance improvement
  • Code Splitting - Intelligent chunking for optimal loading performance
  • Memory Management - WeakMap caching and automatic cleanup
  • Virtualized Rendering - High-performance rendering for large datasets

Build Optimizations

  • Chunk Optimization - Manual chunk configuration for optimal loading
  • Tree Shaking - Dead code elimination for smaller bundles
  • Asset Optimization - Compressed assets and optimized images
  • Cross-platform Compatibility - Cross-env for consistent environment handling

๐Ÿ”ง Development Workflow

Schema Development

  1. Design - Plan your schema structure and requirements
  2. Implement - Use the Monaco editor for precise schema editing
  3. Validate - Real-time validation with detailed error reporting
  4. Debug - Use built-in debugging utilities for schema issues
  5. Migrate - Apply schema migrations for version updates

AI Integration Workflow

  1. Configure - Set up OpenAI API credentials
  2. Generate - Use AI to generate domain-specific schemas
  3. Validate - Ensure generated schemas pass validation
  4. Refine - Iterate on AI-generated content
  5. Monitor - Track AI interactions via communication panel

๐Ÿ› ๏ธ Troubleshooting

For detailed troubleshooting information, see SETUP.md.

Common Issues

  • Schema errors on import: The file must satisfy frm_schema.json; the app reports validation details in the Validation panel
  • Electron window stays blank: Ensure the Vite dev server (port 3000 by default) is running and reachable
  • TypeScript errors: Run npm run build to surface compile issues introduced by schema changes
  • MCP connection issues: Check the Communication Log Panel for connection status and error details
  • AI generation fails: Verify your OpenAI API key is correctly set in .env.local and restart the application
  • Performance issues: The app uses lazy loading and caching; initial load may take a moment for large schemas

๐Ÿค Contributing

We welcome contributions! Here's how to get started:

Development Setup

# Fork and clone the repository
git clone https://github.com/DesmondForward/formal-reasoning-mode.git
cd formal-reasoning-mode

# Install dependencies
npm install

# Start development server
npm run dev

Making Changes

  1. Create a feature branch: git checkout -b feature/amazing-feature
  2. Make your changes with clear, descriptive commits
  3. Test your changes thoroughly
  4. Submit a pull request with a detailed description

Code Style

  • TypeScript for type safety
  • ESLint for code quality
  • Prettier for code formatting
  • Conventional Commits for commit messages

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • Formal Reasoning Mode - The underlying methodology and schema
  • OpenAI - For AI-powered example generation
  • Electron - For cross-platform desktop capabilities
  • React - For the modern UI framework
  • Tailwind CSS - For the beautiful design system

๐Ÿ“ž Support


Built with โค๏ธ for the future of mathematical modeling and AI reasoning

โญ Star this repo โ€ข ๐Ÿ› Report a bug โ€ข ๐Ÿ’ก Request a feature

About

A comprehensive workspace for building sophisticated mathematical models across multiple domains including medicine, biology, engineering, AI, and more.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages