Intend is a programming language designed for the post-AI world.
We’ve taught computers to understand our natural language, so why do we still write code like it’s 1999? Intend bridges the gap between your intent (what you want to achieve) and the implementation (how to do it).
You write the logic, the safety contracts, and the steps in a structured, mixed-language format. The Intend compiler—powered by LLMs like Gemini and Ollama—generates robust, type-safe TypeScript.
🪄 How It Works
1. You write an .intend file:
// src/services/user_service.intent
import { User, DB } from "./types";
import { HashPassword } from "./auth_service.intent"; // Import other intents!
/**
* Creates a new user with hashed password
*/
export intent CreateUser(email: string, name: string, plainPassword: string) -> Promise<User> {
// 🛡️ Define strict safety contracts
invariant "Email must be valid format"
invariant "Password must be at least 8 characters"
// 🪜 Describe the steps naturally
step "Validate email format and throw if invalid"
step "Hash the password using HashPassword service" => const hashedPassword
step "Generate unique user ID" => let userId
step "Save user to database" => const user
// ✅ Guarantee the output state
ensure user is defined
ensure user.id is defined
ensure user.password === hashedPassword
}
export intent DeleteUser(id: string) -> Promise<void> {
step "Find user by id" => const user
ensure user is defined
step "Mark user as deleted"
}
2. You compile it:
intend build
3. Intend gives you production-grade TypeScript:
The compiler parses your file, understands your steps, and respects your invariants. It intelligently resolves imports (feeding the contracts of HashPassword to the AI context) and produces a valid TypeScript file.
If the AI generates invalid code, Intend catches it, feeds the error back to the AI, and auto-corrects it in a loop until it compiles perfectly.
🚀 Features
- 🧠 AI-Native Syntax: Designed from the ground up to be understood by both humans and LLMs.
- 🔀 Hybrid Orchestration: Mix AI steps with deterministic function calls.
- 🔄 Auto-Correction Loop: The compiler runs a
Validation -> AI Repairloop. It doesn’t just generate code; it generates working code. - 🛡️ Contract-First:
invariantandensurekeywords make sure the AI knows exactly what boundaries to respect. - ⚡ Instant Builds (CAS): A built-in Content Addressable Storage system caches every successful build. Rebuilding unchanged files is instant.
- 🧩 Module System: Supports multiple intents per file, imports/exports, and resolves contexts across files.
- 🧬 Type-Safe: Fully interoperable with TypeScript.
ensure x is a numbercompiles to runtime strict checks. - 🔌 Provider Agnostic: Compiles using Google Gemini, Ollama (for local privacy), and more.
- 🩺 AI Diagnostics: If a build fails repeatedly, the AI analyzes the error and explains the root cause to you.
- 🔒 Deterministic Lockfiles: The
intend.lockfile ensures your generated code stays stable across machines and environments.
🔒 Deterministic Builds with intend.lock
Intend is designed to be deterministic. While LLMs are probabilistic by nature, your codebase shouldn’t be.
When you run intend build, the compiler generates an intend.lock file in your project root. This file functions similarly to package-lock.json or bun.lockb:
- Stability: It stores the exact generated code for each intent alongside hashes of the source
.intentfile and your project configuration. - Speed: If you haven’t changed your intent logic, the compiler skips the AI generation phase entirely and pulls the code from the lockfile—making builds near-instant.
- Reproducibility: By committing
intend.lockto your version control, you ensure that every developer on your team and your CI/CD pipelines use the exact same code, regardless of AI model updates or provider changes. - Cost Efficiency: No redundant API calls. You only pay for generation when your logic actually changes.
Always commit your intend.lock file.
📚 Language Reference
Keywords
intent
Defines a function. Acts like function in TypeScript but the body is defined by goals, not code.
export intent HashPassword(pwd: string) -> string { ... }
step
A simplified instruction for the AI. Can be plain text or capture a result.
// Simple valid step
step "Validate email format"
// Capture result into constant
step "Hash the password" => const hash
// Capture result into mutable variable
step "Calculate current age" => let age
Direct Calls
Invoke other intents directly for deterministic control flow.
HashPassword(pwd) => const hash
Log("Access granted")
invariant
A hard rule or constraint that must be true throughout or before the logic runs. The AI uses this to add validation logic or choose secure implementations.
invariant "Password length > 8"
ensure
A post-condition check. Intend generates runtime assertions to guarantee these are true before returning.
ensure user is defined
ensure age is a number
context
Defines a global system prompt or rule set for the entire file. Useful for domain-specific constraints (e.g., “Currency is always integers” or “Use strict types”).
context "All currency values must be handled as integers (cents)."
Build Flags
# Force a rebuild (ignore cache)
intend build --force
# Set retry limit (default 5, -1 for unlimited)
intend build --attempts=10
🏁 Getting Started
Prerequisites
- Node.js or Bun
- A creative mind
Installation
npm install -g @intend/cli
# or
bun add -g @intend/cli
Your First Project
# Initialize a new Intend project
intend init my-new-app
# Enter the directory
cd my-new-app
# Build it!
intend build
🛠️ Configuration
intend.config.json lets you choose your AI brain.
{
"sourceDir": "./src/intents",
"outDir": "./out",
"provider": "gemini",
"gemini": {
"apiKey": "YOUR_KEY",
"model": "gemini-2.5-flash-lite"
}
}
Want to run fully local? Just switch to Ollama:
{
"provider": "ollama",
"ollama": {
"model": "llama3"
}
}
🤝 Contributing
Intend is currently in Alpha. We welcome dreamers, hackers, and prompt engineers.
- Fork the repo.
- Create your feature branch.
- Submit a Pull Request.
Built with ❤️ by Mike Eling & Gemini.