Back to CompilersLab
sweagent — The Agentic Compiler
Live on npm

sweagent

The planning layer that makes Cursor, Claude Code, and Codex 10x more effective.

14 domain-specialized AI agent pipelines — Planning, Requirements, Data Modeling, API Design, Auth, Backend, Frontend, and more — each with dedicated orchestrators, sub-agents, and structured outputs. Generate implementation-ready blueprints, then hand them to your coding agent.

TypeScript 5.7 MIT License PRs Welcome
14
Agent Modules
3
AI Providers
11
Plan Sections
The Problem

AI Coding Agents Need a Planning Layer

Coding agents are powerful executors, but they fail at planning. Without structured blueprints, they guess and produce half-finished code.

Without sweagent

A coding agent receives "build a task manager" and immediately starts writing code:

  • Picks a random framework — maybe Express, maybe Fastify
  • Invents a database schema on the fly, misses relationships
  • Forgets authentication entirely
  • Skips error handling and edge cases
  • Produces something that sort-of runs but needs a rewrite

With sweagent

The coding agent receives a structured blueprint before writing a single line:

  • 11-section markdown plan with tech stack, data models, API routes
  • Structured JSON requirements with actors, flows, and stories
  • Database schemas with field types, relationships, and indexes
  • API contracts with endpoints, methods, and auth requirements
  • Frontend architecture with pages, components, and routing
Planning Pipeline

Four Stages to a Perfect Blueprint

Each plan walks through structured stages with dedicated LLM calls — not a single-shot prompt. 8+ sequential calls produce traceable, reviewable results.

01

Discovery

Understands the project, asks clarifying questions

Project overview
02

Requirements

4 sequential LLM calls to flesh out the spec

Tech stack
Feature decisions
Data models
Auth flow
03

Design

2 sequential LLM calls for technical design

API routes
Implementation details
04

Synthesis

Assembles the final implementation plan

Execution plan
Edge cases
Testing checklist
Output: Implementation-ready plan.md with 11 sections
Capabilities

Enterprise-Grade Planning Infrastructure

Not a wrapper around a single LLM call. A system of specialized pipelines purpose-built for software engineering.

14 Domain Agent Modules

Planning, Requirements, Data Modeling, API Design, Auth, Backend, Frontend — each a self-contained pipeline with dedicated orchestrators.

Multi-Stage Pipelines

Every agent progresses through discovery, requirements, design, and synthesis — with dedicated LLM calls at each step. No single-shot prompts.

Sub-Agent Orchestration

Complex domains delegate to specialized sub-agents — entity-analyzer, schema-refiner, graphql-analyzer — that run in isolation and return condensed results.

Multi-Provider Models

Unified API for OpenAI, Anthropic, and Google. One createModel() call, zero provider lock-in. Switch models in config, not in code.

Type-Safe Tools

Define tools with Zod schemas. Full type inference and validation before execution. Invalid input never reaches your handler.

Plan Validation

LLM-based judge validates that planning output meets all criteria for a coding agent to start implementing. No incomplete blueprints.

MCP Protocol

Connect to Model Context Protocol servers over HTTP or stdio. Lazy connection, typed tool invocation for seamless integration.

Zero Extra Deps

All provider SDKs (OpenAI, Anthropic, Google) are included. Set your API keys and go — no extra packages needed.

14 Domain Agents

Specialized Pipelines for Every Layer

Each module is a self-contained domain agent with its own orchestrator, sub-agents, tools, and output format.

Discovery

Planning Agent

Implementation-ready markdown plan (11 sections)

Discovery

Requirement Gatherer

Structured JSON (actors, flows, stories, modules)

Specialist

Data Modeler

MongoDB/PostgreSQL schemas

entity-analyzer relationship-mapper schema-refiner
Specialist

API Designer

REST and/or GraphQL API design

endpoint-analyzer contract-designer
Specialist

Auth Designer

Auth strategy, flows, middleware, RBAC

security-analyzer flow-designer
Specialist

Backend Architect

Backend architecture (Express/Apollo)

framework-selector service-planner
Specialist

Frontend Architect

Frontend architecture (React/Next.js)

page-planner component-analyzer framework-selector
Builder

Express Builder

Express.js REST API config

route-generator middleware-configurator
Builder

Apollo Builder

Apollo GraphQL subgraph config

schema-generator resolver-planner
Builder

React Builder

React + Vite app config from GraphQL

graphql-analyzer config-validator
Builder

Next.js Builder

Next.js App Router config

route-planner api-route-generator
Execution

Execution Planner

Phased implementation plan

edge-case-analyzer testing-strategist
Get Started

Up and Running in 60 Seconds

terminal
$ npm install sweagent
plan.ts
import { runPlanningWithResult } from 'sweagent';

const { planning, plan } = await runPlanningWithResult({
  input: 'Task manager app with user auth, task CRUD, assignments, and a dashboard',
  model: { provider: 'openai', model: 'gpt-4o-mini' },
});

if (planning) {
  console.log('Plan is implementation-ready.');
  console.log(plan); // Full markdown blueprint
}
Integrations

Built for Your Coding Agent

Generate blueprints, save them, and let your favorite coding agent implement step by step.

Cursor

Save plan to .cursor/rules/ or paste into chat. Every agent session uses your blueprint as context.

writeFileSync("plan.md", plan)

Claude Code

Save as CLAUDE.md for automatic context. Claude Code reads it on every session start.

writeFileSync("CLAUDE.md", plan)

Codex

Feed structured JSON specs as context. Codex excels with machine-readable requirement documents.

writeFileSync("requirements.json", output)
Architecture

How the Pipeline Flows

Your idea flows through specialized layers — from discovery to framework-specific builders — producing implementation-ready specs at every stage.

Your Idea (Natural Language)
Requirement Gatherer
Planning Agent
Data Modeler
API Designer
Auth Designer
Backend Arch.
Frontend Arch.
Express Builder
Apollo Builder
React Builder
Next.js Builder
Implementation-Ready Blueprints

Stop Guessing. Start Planning.

Give your AI coding agent the structured blueprints it needs. Generate implementation-ready plans in seconds.

npm install sweagent