8000 GitHub - aelmasry/TaskMind: TaskMind is a local AI Agent application designed to transform any user prompt into a structured task. Instead of simply answering questions, TaskMind treats each prompt as a goal, breaks it down into steps, reasons about it, and provides both the thought process and the final result. Β· GitHub
[go: up one dir, main page]

Skip to content
aelmasryPublic

About

TaskMind is a local AI Agent application designed to transform any user prompt into a structured task. Instead of simply answering questions, TaskMind treats each prompt as a goal, breaks it down into steps, reasons about it, and provides both the thought process and the final result.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Latest commit

Β 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TaskMind - Multi-Provider AI Agent

Node.js TypeScript Next.js React License

TaskMind is a sophisticated AI agent that treats user prompts as tasks to be executed. It provides structured reasoning, supports multiple AI providers (OpenAI, Grok, Copilot), and includes cost tracking and performance monitoring. The project includes both a robust backend API and a professional frontend dashboard.

πŸš€ Features

Backend

  • Multi-Provider Support: Seamlessly switch between OpenAI, Grok (xAI), and GitHub Copilot
  • Structured Reasoning: Three-step reasoning process (Analysis β†’ Planning β†’ Execution)
  • Cost Tracking: Real-time cost estimation and monitoring
  • Clean Architecture: Built with SOLID principles and design patterns
  • RESTful API: Easy integration with any application
  • Comprehensive Logging: Detailed execution logs and performance metrics
  • Type Safety: Full TypeScript support with strict typing

Frontend Dashboard

  • Professional UI/UX: Clean, responsive design with configurable themes
  • Real-time Task Management: Submit, monitor, and review AI agent tasks
  • Structured Reasoning Display: View the complete reasoning process with step-by-step breakdown
  • Provider Configuration: Switch between AI providers and models
  • Task History: Detailed execution history with cost tracking
  • Mobile Responsive: Optimized for desktop, tablet, and mobile devices

πŸ—οΈ Architecture

Backend Architecture

TaskMind follows clean architecture principles with:

  • Strategy Pattern: For cost calculation and provider selection
  • Template Method Pattern: For the reasoning process
  • Dependency Inversion: Provider-agnostic design
  • Single Responsibility: Each class has one clear purpose
  • Open/Closed Principle: Easy to extend with new providers

Frontend Architecture

The frontend follows modern React patterns with:

  • Component-Based Design: Reusable, modular components
  • Type Safety: Comprehensive TypeScript interfaces
  • State Management: React hooks for local state management
  • API Abstraction: Clean service layer for backend communication
  • Responsive Design: Mobile-first approach with Tailwind CSS
  • Error Handling: Comprehensive error states and user feedback

πŸ“‹ Prerequisites

  • Node.js 18+
  • npm or yarn
  • API keys for your chosen providers

πŸ› οΈ Installation

Backend Setup

  1. Clone the repository:
git clone <repository-url>
cd TaskMind
  1. Install dependencies:
npm install
  1. Set up environment variables:
cp env.example .env
  1. Configure your API keys in .env:
# OpenAI (Required for default setup)
OPENAI_API_KEY=your_openai_api_key_here

# Grok (Optional)
GROK_API_KEY=your_grok_api_key_here

# Copilot (Optional)
COPILOT_API_KEY=your_copilot_api_key_here
  1. Start the backend server:
npm run dev

The backend will be available at http://localhost:3000

Frontend Setup

  1. Navigate to the frontend directory:
cd frontend
  1. Install dependencies:
npm install
  1. Start the frontend development server:
npm run dev

The dashboard will be available at http://localhost:3001

πŸš€ Quick Start

Using the Dashboard (Recommended)

  1. Start both services:
# Terminal 1 - Backend
npm run dev

# Terminal 2 - Frontend
cd frontend
npm run dev
  1. Open the dashboard: Navigate to http://localhost:3001

  2. Submit your first task: Use the form to submit a prompt and see the AI agent in action

Using the API Directly

# Test OpenAI
curl -X POST http://localhost:3000/agent/task \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Explain quantum computing in simple terms",
    "provider": "openai",
    "model": "gpt-4o-mini"
  }'

πŸ“‘ API Usage

Submit a Task

Single Request (Recommended)

Send provider, model, and prompt in one request:

# OpenAI
curl -X POST http://localhost:3000/agent/task \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "Explain quantum computing in simple terms",
    "provider": "openai",
    "model": "gpt-4o-mini"
  }'

# Grok
curl -X POST http://localhost:3000/agent/task \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "What are the benefits of renewable energy?",
    "provider": "grok",
    "model": "grok-4-latest"
  }'

# Copilot
curl -X POST http://localhost:3000/agent/task \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "How does machine learning work?",
    "provider": "copilot",
    "model": "copilot-chat"
  }'

Switch Providers

curl -X POST http://localhost:3000/agent/provider \
  -H "Content-Type: application/json" \
  -d '{
    "provider": "grok",
    "model": "grok-4-latest"
  }'

Get Configuration

curl http://localhost:3000/agent/config

Get History

curl http://localhost:3000/agent/history

🎨 Dashboard Features

Task Management

  • Submit Tasks: Easy-to-use form with provider and model selection
  • Real-time Processing: Live status updates during task execution
  • Task History: Complete history with detailed reasoning steps
  • Cost Tracking: Real-time cost estimation and monitoring

Provider Management

  • Multi-Provider Support: Switch between OpenAI, Grok, and Copilot
  • Model Selection: Choose from available models for each provider
  • Status Monitoring: Real-time provider availability status
  • Configuration Management: Update settings without restart

User Experience

  • Responsive Design: Works on desktop, tablet, and mobile
  • Professional UI: Clean, modern interface with configurable themes
  • Error Handling: User-friendly error messages and recovery options
  • Loading States: Smooth loading indicators for all operations

πŸ”§ Configuration

Environment Variables

Variable Description Default
DEFAULT_PROVIDER Default AI provider openai
DEFAULT_MODEL Default model gpt-4o-mini
PORT Backend server port 3000
LOG_LEVEL Logging level info
NEXT_PUBLIC_API_URL Frontend API URL http://localhost:3000

Provider-Specific Configuration

OpenAI

OPENAI_API_KEY=your_key
OPENAI_MODEL=gpt-4o-mini
OPENAI_MAX_TOKENS=4000
OPENAI_TEMPERATURE=0.7

Grok

GROK_API_KEY=your_key
GROK_MODEL=grok-4-latest
GROK_MAX_TOKENS=4000
GROK_TEMPERATURE=0.7
GROK_BASE_URL=https://api.x.ai/v1

Copilot

COPILOT_API_KEY=your_key
COPILOT_MODEL=copilot-chat
COPILOT_MAX_TOKENS=4000
COPILOT_TEMPERATURE=0.7
COPILOT_BASE_URL=https://api.github.com/copilot/v1
COPILOT_ORGANIZATION=your_org
COPILOT_PROJECT=your_project

πŸ“Š Cost Tracking

TaskMind automatically tracks costs for all API calls:

{
  "costEstimate": {
    "inputTokens": 150,
    "outputTokens": 300,
    "estimatedCost": 0.000045,
    "currency": "USD",
    "provider": "openai",
    "model": "gpt-4o-mini"
  }
}

πŸ” Monitoring

Logs

  • Application logs: Console output
  • Agent logs: logs/.agent-log (JSONL format)
  • Performance metrics: Response times, token usage, costs

Health Check

curl http://localhost:3000/health

πŸ“ Project Structure

TaskMind/
β”œβ”€β”€ src/                      # Backend source code
β”‚   β”œβ”€β”€ agent.ts             # Core agent logic
β”‚   β”œβ”€β”€ server.ts            # Express server
β”‚   β”œβ”€β”€ providers/           # AI provider implementations
β”‚   β”œβ”€β”€ strategies/          # Design pattern implementations
β”‚   β”œβ”€β”€ types/              # TypeScript type definitions
β”‚   └── utils/              # Utility functions
β”œβ”€β”€ frontend/                # Frontend dashboard
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ app/            # Next.js app directory
β”‚   β”‚   β”œβ”€β”€ components/     # React components
β”‚   β”‚   β”œβ”€β”€ lib/           # Utility functions
β”‚   β”‚   β”œβ”€β”€ services/      # API services
β”‚   β”‚   └── types/         # TypeScript types
β”‚   └── package.json
β”œβ”€β”€ logs/                   # Application logs
β”œβ”€β”€ docs/                   # Documentation
└── tests/                  # Test files

πŸ§ͺ Testing

Backend Tests

# Test OpenAI integration
npm run test-example

# Test Grok integration
npm run test-grok

# Test single request functionality
npm run test-single

Frontend Testing

The frontend includes comprehensive error handling and user feedback:

  • Connection Status: Real-time backend connectivity monitoring
  • Error States: User-friendly error messages and recovery options
  • Loading States: Smooth loading indicators for all async operations
  • Form Validation: Client-side validation with helpful error messages

πŸ”„ Roadmap & TODO

πŸ—„οΈ Phase 1: Database Integration

  • MongoDB Integration
    • Set up MongoDB connection with Mongoose
    • Create data models for TaskExecution, User, Session
    • Implement persistent storage for task history
    • Add data migration scripts
    • Implement backup and restore functionality
    • Add data indexing for performance optimization

πŸ€– Phase 2: ChatGPT Expert System (GPTS-like)

  • Expert Agent Framework

    • Create specialized agent types (Code Expert, Math Expert, etc.)
    • Implement agent selection based on task type
    • Add agent-specific prompts and reasoning strategies
    • Create agent marketplace/registry system
    • Implement agent chaining and collaboration
    • Add agent performance metrics and ratings
  • Advanced Reasoning

    • Implement multi-step reasoning chains
    • Add context memory and conversation history
    • Create tool integration system (web search, file operations)
    • Implement knowledge base integration
    • Add reasoning visualization and explanation

🐳 Phase 3: Docker & Deployment

  • Docker Containerization

    • Create Dockerfile for backend
    • Create Dockerfile for frontend
    • Set up docker-compose for full stack
    • Add MongoDB container configuration
    • Implement health checks and monitoring
    • Create production-ready Docker images
  • Deployment & CI/CD

    • Set up GitHub Actions for automated testing
    • Create deployment scripts for cloud platforms
    • Implement environment-specific configurations
    • Add monitoring and logging infrastructure
    • Set up SSL/TLS certificates

πŸš€ Phase 4: Advanced Features

  • User Management

    • Implement user authentication and authorization
    • Add user profiles and preferences
    • Create team collaboration features
    • Implement usage quotas and billing
  • Advanced Analytics

    • Create detailed usage analytics dashboard
    • Implement cost optimization recommendations
    • Add performance benchmarking tools
    • Create custom reporting features
  • API Enhancements

    • Add GraphQL support
    • Implement WebSocket for real-time updates
    • Create API rate limiting and throttling
    • Add API versioning and documentation

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Quick Start for Contributors

  1. Fork the repository
  2. Clone your fork
    git clone https://github.com/your-username/TaskMind.git
    cd TaskMind
  3. Install dependencies
    # Backend
    npm install
    
    # Frontend
    cd frontend
    npm install
  4. Set up environment
    cp env.example .env
    # Add your API keys to .env
  5. Start development servers
    # Terminal 1 - Backend
    npm run dev
    
    # Terminal 2 - Frontend
    cd frontend
    npm run dev
  6. Create a feature branch
    git checkout -b feature/your-feature-name
  7. Submit a pull request

Development Guidelines

  • Follow our Code Style Guide
  • Write tests for new features
  • Update documentation
  • Use conventional commit messages
  • Ensure all tests pass before submitting

Need Help?

πŸ“„ License

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

🌟 Personal Branding

This project demonstrates professional software engineering practices, with focus on clean architecture, modern technologies, and developer-friendly tooling β€” reinforcing my personal brand as a software engineer.

What This Project Showcases

  • Full-Stack Development: Complete backend API and frontend dashboard
  • Clean Architecture: Well-structured, maintainable codebase
  • Modern Technologies: Latest React, Next.js, TypeScript, and Node.js
  • Professional UI/UX: Polished, responsive design
  • Developer Experience: Excellent tooling and documentation
  • Scalability: Modular design for easy extension
  • Best Practices: Type safety, error handling, and testing

πŸ‘¨β€πŸ’» Author

Ali Salem - admin@alisalem.me

This project demonstrates professional software engineering practices, with focus on clean architecture, modern technologies, and developer-friendly tooling β€” reinforcing my personal brand as a software engineer.

πŸ† Acknowledgments

  • OpenAI for GPT models
  • xAI for Grok models
  • GitHub for Copilot
  • Contributors who help improve TaskMind

Built with ❀️ using TypeScript, Node.js, React, Next.js, and modern design patterns

About

TaskMind is a local AI Agent application designed to transform any user prompt into a structured task. Instead of simply answering questions, TaskMind treats each prompt as a goal, breaks it down into steps, reasons about it, and provides both the thought process and the final result.

Resources

Contributing

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0