The Compiler for Human Intent
Transform natural language business requirements into production-ready technical specifications
Quick Start โข How It Works โข Architecture โข Features
Intent Compiler treats software specification as a compilation target. Just like a traditional compiler transforms high-level code into machine instructions, this tool transforms high-level business intent into low-level technical specifications.
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ "Build an Uber for โ โ โข 7 Bounded Contexts โ
โ dog walking with โ โโโบ โ โข 12 Database Tables โ
โ payments and reviews" โ โ โข 42 API Endpoints โ
โ โ โ โข Full Pseudo-code โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Human Intent Technical Specification
| Feature | Description |
|---|---|
| ๐ค Multi-Agent Orchestration | 4 specialized AI agents working in sequence |
| ๐ LangGraph State Machine | Cyclic graph with self-correction loops |
| ๐ง Wizard-Style UI | Step-by-step with human approval gates |
| ๐ Mermaid Diagrams | Auto-generated architecture & ER diagrams |
| ๐๏ธ DDD Module Decomposition | Bounded contexts with traceability |
| ๐๏ธ 3NF Database Schemas | Normalized relational database design |
| ๐ป CSR Pseudo-code | Controller-Service-Repository pattern |
| ๏ฟฝ State Persistence | Resume compilation across sessions |
git clone https://github.com/yourusername/intent-compiler.git
cd intent-compiler
pip install -r requirements.txtCreate a .env file:
GROQ_API_KEY=your_groq_api_key_herestreamlit run app.pyOpen http://localhost:8501 and start compiling! ๐
The Intent Compiler uses a 4-stage compilation pipeline, each handled by a specialized AI agent:
flowchart LR
subgraph Input
A[๐ Business<br>Requirement]
end
subgraph Stage1["Stage 1: Lexical Analysis"]
B[๐ Analyst<br>Agent]
end
subgraph Stage2["Stage 2: Structural Analysis"]
C[๐๏ธ Architect<br>Agent]
end
subgraph Stage3["Stage 3: Memory Allocation"]
D[๐๏ธ Data Engineer<br>Agent]
end
subgraph Stage4["Stage 4: Code Generation"]
E[๐ป Developer<br>Agent]
end
subgraph Output
F[๐ฆ Technical<br>Specification]
end
A --> B
B -->|Requirements<br>User Stories| C
C -->|Modules<br>Architecture| D
D -->|Schema<br>ER Diagram| E
E -->|Pseudo-code| F
D -.->|Self-Correction<br>Loop| D
| Agent | Role | Compiler Analogy | Output |
|---|---|---|---|
| ๐ Analyst | Deconstructs requirements | Lexical Analysis | Structured requirements, User stories |
| ๐๏ธ Architect | Decomposes into modules | Structural Analysis | Bounded contexts, System diagram |
| ๐๏ธ Data Engineer | Designs database schema | Memory Allocation | 3NF ER diagram |
| ๐ป Developer | Generates behavioral logic | Code Generation | CSR pseudo-code |
The compiler is built on LangGraph, which enables cyclic, stateful agent orchestration:
stateDiagram-v2
[*] --> Input: User enters requirements
Input --> Analyst: Start Compilation
Analyst --> AwaitApproval1: Requirements extracted
AwaitApproval1 --> Architect: โ
Approved
AwaitApproval1 --> Analyst: ๐ Re-analyze
Architect --> AwaitApproval2: Modules identified
AwaitApproval2 --> DataEngineer: โ
Approved
AwaitApproval2 --> Architect: ๐ Re-architect
DataEngineer --> Validation: Schema generated
Validation --> DataEngineer: โ Invalid syntax
Validation --> AwaitApproval3: โ
Valid
AwaitApproval3 --> Developer: โ
Approved
AwaitApproval3 --> DataEngineer: ๐ Regenerate
Developer --> Complete: Pseudo-code ready
Complete --> [*]: Export specification
All agents share a persistent state object:
classDiagram
class CompilerState {
+str raw_intent
+list requirements
+list user_stories
+str analyst_summary
+list modules
+str architecture_diagram
+str er_diagram
+bool schema_valid
+dict pseudo_code
+int current_stage
+list messages
}
class AnalystAgent {
+extract_entities()
+generate_user_stories()
+infer_nfrs()
}
class ArchitectAgent {
+identify_bounded_contexts()
+generate_system_diagram()
+map_requirements()
}
class DataEngineerAgent {
+normalize_to_3nf()
+generate_er_diagram()
+validate_syntax()
}
class DeveloperAgent {
+generate_controllers()
+generate_services()
+generate_repositories()
}
CompilerState <-- AnalystAgent : reads/writes
CompilerState <-- ArchitectAgent : reads/writes
CompilerState <-- DataEngineerAgent : reads/writes
CompilerState <-- DeveloperAgent : reads/writes
"Build an app like Uber but for dog walking services. Dog owners can request walks, see nearby walkers, track the walk in real-time, and pay through the app."
{
"requirements": [
{"id": "REQ-001", "type": "Functional", "priority": "Must Have",
"description": "Dog owners can register dogs with profiles"},
{"id": "REQ-002", "type": "Functional", "priority": "Must Have",
"description": "Dog owners can request walks specifying time and location"},
{"id": "REQ-003", "type": "Non-Functional", "priority": "Should Have",
"description": "Real-time location tracking with < 5 second latency"}
],
"user_stories": [
"As a Dog Owner, I want to register my dog with its profile, so that walkers know my dog's needs",
"As a Dog Walker, I want to set my availability, so that I receive relevant walk requests"
]
}graph TD
subgraph UserContext["๐ค User Management"]
Auth[Authentication Service]
Profile[Profile Service]
end
subgraph WalkContext["๐ฆฎ Walk Management"]
Request[Request Service]
Match[Matching Service]
Track[Tracking Service]
end
subgraph PayContext["๐ณ Payment Processing"]
Payment[Payment Service]
Wallet[Wallet Service]
end
subgraph ReviewContext["โญ Rating & Review"]
Review[Review Service]
end
subgraph NotifyContext["๐ Notifications"]
Push[Push Service]
end
Auth --> Request
Request --> Match
Match --> Track
Track --> Payment
Payment --> Review
Track -.->|Events| Push
Payment -.->|Events| Push
erDiagram
DogOwner ||--o{ Dog : owns
DogOwner ||--o{ WalkRequest : creates
Walker ||--o{ WalkRequest : accepts
WalkRequest ||--|| Walk : becomes
Walk ||--|| Payment : requires
Walk ||--o| Review : receives
Walker ||--o{ Availability : sets
DogOwner {
int id PK
string email UK
string name
string phone
timestamp created_at
}
Dog {
int id PK
int owner_id FK
string name
string breed
string size
text special_needs
}
Walker {
int id PK
string email UK
string name
text experience
decimal rating
boolean is_active
}
WalkRequest {
int id PK
int dog_id FK
int owner_id FK
int walker_id FK
timestamp request_time
timestamp walk_time
int duration
string status
}
Walk {
int id PK
int request_id FK
timestamp start_time
timestamp end_time
string current_location
}
Payment {
int id PK
int walk_id FK
decimal amount
decimal tip
string status
timestamp processed_at
}
Review {
int id PK
int walk_id FK
int rating
text comment
timestamp created_at
}
MODULE: WalkScheduling
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# CONTROLLER LAYER
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
FUNCTION POST /walks/request(dog_id, time, duration, location):
ACTION: Create a new walk request
CONDITION: Validate authentication token
IF fails: RETURN 401 Unauthorized
CONDITION: Check dog belongs to authenticated owner
IF fails: RETURN 403 Forbidden
CONDITION: Validate time is in future
IF fails: RETURN 400 Bad Request("Walk must be scheduled in future")
RESULT: Create walk request
walk_request = WalkService.create_request(dog_id, time, duration, location)
NotificationService.notify_nearby_walkers(walk_request)
RETURN 201 Created(walk_request)
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# SERVICE LAYER
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
FUNCTION create_request(dog_id, time, duration, location):
ACTION: Process walk request creation
CONDITION: Check dog has no pending walks
existing = WalkRepository.find_pending_by_dog(dog_id)
IF existing: RAISE ConflictError("Dog already has pending walk")
CONDITION: Check available walkers in area
walkers = WalkerRepository.find_available(location, time)
IF walkers.empty: RAISE NoWalkersError("No walkers available")
RESULT: Create and return request
request = WalkRepository.create({
dog_id: dog_id,
time: time,
duration: duration,
location: location,
status: "pending"
})
RETURN request
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# REPOSITORY LAYER
# โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
FUNCTION find_available(location, time):
RESULT: Query available walkers
SELECT w.* FROM Walker w
JOIN Availability a ON w.id = a.walker_id
WHERE w.is_active = TRUE
AND ST_Distance(w.location, $location) < 5000
AND a.start_time <= $time
AND a.end_time >= $time
ORDER BY w.rating DESC
graph TB
subgraph Frontend["๐ฅ๏ธ Frontend"]
Streamlit[Streamlit]
Mermaid[Mermaid.js]
end
subgraph Orchestration["๐ Orchestration"]
LangGraph[LangGraph]
LangChain[LangChain Core]
end
subgraph LLM["๐ง LLM Provider"]
Groq[Groq API]
Llama[LLaMA 3.3 70B]
end
subgraph State["๐พ State"]
MemorySaver[MemorySaver]
SessionState[Session State]
end
Frontend --> Orchestration
Orchestration --> LLM
Orchestration --> State
| Component | Technology | Purpose |
|---|---|---|
| Orchestration | LangGraph | Stateful, cyclic multi-agent coordination |
| LLM | Groq + LLaMA 3.3 70B | Fast inference for all agents |
| Frontend | Streamlit | Interactive wizard UI |
| Visualization | Mermaid.js | Architecture & ER diagrams |
| State | MemorySaver | Persistent compilation state |
| Validation | Pydantic | Structured output schemas |
intent-compiler/
โโโ app.py # Main Streamlit application
โโโ requirements.txt # Python dependencies
โโโ .env # API keys (local, not in git)
โโโ .gitignore # Git ignore rules
โโโ .streamlit/
โ โโโ config.toml # Streamlit configuration
โโโ secrets.toml.example # Template for secrets
โโโ Procfile # Heroku/Railway deployment
โโโ runtime.txt # Python version
โโโ README.md # This file
The easiest way to deploy - free hosting from Streamlit!
-
Push to GitHub
git init git add . git commit -m "Initial commit" git remote add origin https://github.com/yourusername/intent-compiler.git git push -u origin main
-
Deploy on Streamlit Cloud
- Go to share.streamlit.io
- Click "New app"
- Select your repository
- Set main file:
app.py - Click "Deploy"
-
Add Secrets
- Go to your app's settings โ Secrets
- Add your API key:
GROQ_API_KEY = "your_groq_api_key_here"
flowchart LR
A[GitHub Repo] --> B[Streamlit Cloud]
B --> C[Live App]
D[Secrets Panel] --> B
-
Connect Repository
- Go to railway.app
- Click "New Project" โ "Deploy from GitHub"
- Select your repository
-
Configure Environment
- Add environment variable:
GROQ_API_KEY - Railway auto-detects the
Procfile
- Add environment variable:
-
Deploy
- Railway builds and deploys automatically
- Get your public URL from the dashboard
-
Create Web Service
- Go to render.com
- Click "New" โ "Web Service"
- Connect your GitHub repo
-
Configure
Build Command: pip install -r requirements.txt Start Command: streamlit run app.py --server.port=$PORT --server.address=0.0.0.0
-
Add Environment Variables
- Add
GROQ_API_KEYin the Environment tab
- Add
-
Install Heroku CLI
# Login and create app heroku login heroku create intent-compiler-app -
Set Config Vars
heroku config:set GROQ_API_KEY=your_key_here
-
Deploy
git push heroku main
FROM python:3.11-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
EXPOSE 8501
CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]Build and run:
docker build -t intent-compiler .
docker run -p 8501:8501 -e GROQ_API_KEY=your_key intent-compiler| Variable | Required | Description |
|---|---|---|
GROQ_API_KEY |
โ | Your Groq API key |
You can modify the agent prompts in app.py:
ANALYST_PROMPT- Requirements extraction strategyARCHITECT_PROMPT- Module decomposition rulesDATA_ENGINEER_PROMPT- Schema normalization rulesDEVELOPER_PROMPT- Code generation patterns
- SQLite Persistence - "Time Travel" across sessions
- Token Tracking - Cost estimation per compilation
- Streaming Output - Real-time agent "thinking"
- Code Export - Generate actual code files
- Multiple LLM Support - OpenAI, Anthropic, local models
MIT License - See LICENSE for details.
Built with โค๏ธ using LangGraph, Groq, and Streamlit By DynoSuprovo