An agentic workflow system that monitors weather forecasts and energy prices, then generates personalized heating schedules using LLM-based reasoning, with retries, state machines, event orchestration, and Postgres/pgvector context memory.
- Node.js 18+ and npm
- Docker and Docker Compose
npm installcp .env.example .env
# Edit .env with your API keys (OpenAI/Anthropic, etc.)
# DATABASE_URL is already configured for Docker Compose# Start Postgres with pgvector extension
docker-compose up -d
# Verify database is running
docker-compose ps
# View logs if needed
docker-compose logs postgresThe database will be available at localhost:5432 with:
- Database:
heating_schedule - User:
heating_user - Password:
heating_password
# Push Prisma schema to database
npm run db:push
# Generate Prisma client
npm run db:generatenpx tsx scripts/create-test-user.tsThis creates a test user with:
- ID:
test-user-123 - Location: London
- Temperature preferences: 18°C - 21°C
You need to run both Next.js and Inngest:
Option A: Run everything together (recommended)
npm run dev:allOption B: Run separately in different terminals
# Terminal 1: Inngest dev server
npm run dev:inngest
# Terminal 2: Next.js dev server
npm run devWhat's running:
- Next.js UI: http://localhost:3000
- Inngest Dashboard: http://localhost:8288
- Open http://localhost:3000
- Click "Generate Schedule"
- Wait 5-10 seconds for the workflow to complete
- View your optimized heating schedule!
# Stop database
npm run db:down
# Stop Next.js + Inngest (Ctrl+C in the terminal)
# Delete database data (optional)
docker-compose down -vThis project uses a spec-driven approach where all system design is documented in /specs directory. Any LLM can read these specs to understand how to implement or extend the system.
See specs/index.md for the complete specification index.
npm run dev:all- Start Next.js + Inngest together (recommended)npm run dev- Start Next.js onlynpm run dev:inngest- Start Inngest dev server only
npm run db:up- Start Docker Compose (Postgres + pgvector)npm run db:down- Stop Docker Composenpm run db:push- Push Prisma schema to databasenpm run db:generate- Generate Prisma clientnpm run db:studio- Open Prisma Studio
npm run build- Build for productionnpm run lint- Run ESLint
npx tsx test-tools.ts- Test weather & energy APIsnpx tsx test-rag.ts- Test RAG/embedding systemnpx tsx test-ui-flow.ts- Test full workflow end-to-end
ISC