Skip to content

johanr-8/TaskCluster

 
 

Repository files navigation

TaskCluster

AI-powered project planning — turn a text goal into a structured, scheduled, and exportable project plan.

Architecture

┌─────────┐     ┌─────────┐     ┌───────────────────┐     ┌───────────┐
│  Next.js │────▶│ Fastify │────▶│ LLM Orchestrator  │     │  Worker   │
│  (web)   │     │  (API)  │     │ (OpenAI/Anthropic) │     │ (Redis Q) │
└─────────┘     └────┬────┘     └───────────────────┘     └─────┬─────┘
                     │                                          │
                ┌────┴────┐     ┌───────────┐            ┌─────┴──────┐
                │Sanity   │     │ Scheduler │            │ Email/Slack│
                │CMS      │     │ (Python)  │            │ Notifiers  │
                └─────────┘     └───────────┘            └────────────┘
                     │
              ┌──────┴─────┐
              │ PostgreSQL │  ┌───────┐
              │ (users/    │  │ Redis │
              │  audit)    │  │(cache)│
              └────────────┘  └───────┘

Quick Start

Prerequisites

  • Docker & Docker Compose
  • Node.js 20+ (for local dev)
  • Python 3.12+ (for scheduler dev)

Run Everything Locally

# Clone and enter the repo
cd taskcluster

# Start all services
docker-compose up --build

# Services will be available at:
#   Web frontend:     http://localhost:3000
#   API:              http://localhost:4000
#   LLM Orchestrator: http://localhost:4001
#   Scheduler:        http://localhost:4002

The default configuration uses a mock LLM provider that returns valid plan structures without calling any AI API. To use a real provider:

# .env file at project root
OPENAI_API_KEY=sk-...
LLM_PROVIDER=openai
LLM_MODEL=gpt-4o

Local Development (without Docker)

# Install all workspace dependencies
npm install

# Start PostgreSQL and Redis (or use docker-compose for just those)
docker-compose up -d postgres redis

# In separate terminals:
cd services/api && npm run dev
cd services/llm-orchestrator && npm run dev
cd services/scheduler && pip install -r requirements.txt && uvicorn scheduler.main:app --port 4002 --reload
cd services/worker && npm run dev
cd web && npm run dev

Services

Service Port Language Description
web 3000 TypeScript/Next.js Frontend SPA with DAG/Gantt views
services/api 4000 TypeScript/Fastify REST API, auth, Sanity CMS, caching
services/llm-orchestrator 4001 TypeScript/Fastify LLM adapter + validation + repair loop
services/scheduler 4002 Python/FastAPI PERT scheduling, critical path, constraints
services/worker TypeScript/Node Background job consumer (email/Slack)
sanity TypeScript Sanity Studio & schemas

Project Structure

taskcluster/
├── docker-compose.yml
├── package.json              # npm workspaces root
├── tsconfig.base.json
├── services/
│   ├── api/                  # Fastify REST API
│   │   ├── src/
│   │   │   ├── app.ts        # App builder
│   │   │   ├── server.ts     # Entry point
│   │   │   ├── config.ts     # Zod-validated env
│   │   │   ├── db/           # Drizzle ORM + migrations
│   │   │   ├── lib/          # Redis, Sanity, auth, errors
│   │   │   └── routes/       # health, auth, plans, review, webhooks
│   │   ├── openapi.yaml
│   │   └── Dockerfile
│   ├── llm-orchestrator/     # LLM service
│   │   ├── src/
│   │   │   ├── adapter.ts    # OpenAI/Anthropic/Mock adapters
│   │   │   ├── validator.ts  # JSON schema + cycle detection
│   │   │   └── routes/       # decompose, criteria, resources, regenerate
│   │   ├── prompts/          # Prompt templates
│   │   └── Dockerfile
│   ├── scheduler/            # Python scheduling engine
│   │   ├── scheduler/
│   │   │   ├── engine.py     # PERT, topological sort, critical path
│   │   │   ├── models.py     # Pydantic models
│   │   │   └── routes.py
│   │   ├── tests/
│   │   └── Dockerfile
│   └── worker/               # Background job processor
│       ├── src/worker.ts
│       └── Dockerfile
├── web/                      # Next.js 14 frontend
│   ├── src/
│   │   ├── app/              # App router pages
│   │   ├── components/       # React components (DAG, Gantt, Inspector)
│   │   ├── lib/api.ts        # API client
│   │   └── queries/          # GROQ query files
│   └── Dockerfile
├── sanity/                   # Sanity CMS Studio
│   └── schemas/
├── infra/
│   └── k8s/                  # Kubernetes manifests
├── tests/
│   └── e2e/                  # End-to-end smoke tests
└── .github/workflows/ci.yml  # GitHub Actions CI/CD

API Endpoints

See the full OpenAPI spec for details.

Method Path Description
GET /v1/health Health check
GET /v1/health/ready Readiness (DB, Redis, Sanity)
POST /v1/auth/signup Create account
POST /v1/auth/login Login
POST /v1/plans/generate Generate plan from goal
GET /v1/plans/:id Get plan (cached)
POST /v1/plans/:id/replan Apply patches + reschedule
POST /v1/plans/:id/export Export to Jira/GitHub/Trello
GET /v1/review/low-confidence-plans Low-confidence plans
GET /v1/review/tasks-needing-review Tasks needing review
POST /v1/webhook/sanity Sanity CMS webhook

Testing

# All TypeScript tests
npm test --workspaces

# Scheduler tests
cd services/scheduler && python -m pytest tests/ -v

# E2E smoke tests (requires running services)
docker-compose up -d
npx vitest run --config tests/e2e/vitest.config.ts

User Flow

  1. Enter goal — Type a project description (e.g., "Build an e-commerce site with Stripe")
  2. AI decomposes — LLM breaks goal into phases → tasks with estimates and confidence scores
  3. Scheduler runs — PERT estimates + topological sort + critical path computation
  4. Review — Human reviews low-confidence tasks, edits descriptions, adjusts estimates
  5. Iterate — Replan applies patches and re-runs the scheduler, creating a version snapshot
  6. Export — Push tasks to Jira, GitHub Issues, or Trello

Key Technical Decisions

  • Provider-agnostic LLM: Adapter pattern supports OpenAI, Anthropic, and a mock for testing
  • Repair loop: Up to 3 attempts to fix invalid LLM JSON via a repair prompt
  • PERT scheduling: Weighted 3-point estimates with confidence-based buffers
  • Optimistic UI: Frontend applies changes immediately then reconciles with server
  • Sanity CMS: Structured content for plans/tasks, enabling GROQ queries and webhooks
  • Redis caching: Plan data cached for 5 minutes, invalidated on mutations
  • Idempotent replanning: Idempotency keys prevent duplicate patch operations

Environment Variables

See services/api/src/config.ts for the full validated configuration schema.

Key variables:

  • DATABASE_URL — PostgreSQL connection string
  • REDIS_URL — Redis connection string
  • JWT_SECRET — Secret for JWT token signing
  • SANITY_PROJECT_ID, SANITY_DATASET, SANITY_TOKEN — Sanity CMS credentials
  • LLM_PROVIDERopenai, anthropic, or mock
  • OPENAI_API_KEY / ANTHROPIC_API_KEY — LLM API key
  • LLM_MODEL — Model to use (e.g., gpt-4o, claude-3-sonnet-20240229)

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 90.6%
  • Python 6.6%
  • JavaScript 1.8%
  • Other 1.0%