The NTNT Programming Language
Explicit and verifiable intent.
NTNT (/ɪnˈtɛnt/) is an open-source agent-native language with Intent-Driven Development built in. You define constraints and expected behavior. Agents implement. NTNT verifies continuously.
Why NTNT?
AI agents can generate code quickly. The hard part is knowing whether the result satisfies the original requirements. Specs live in docs or context. Tests assert implementation details. When requirements change, there’s no reliable signal for what is now invalid.
NTNT explores a different approach. Requirements are executable specifications written in Intent Assertion Language (IAL). IAL defines enforceable assertions that continuously check implementation compliance. You monitor implementation and drift in real time.
IDD Flow
Intent-Driven Development in three steps: write requirements, implement with annotations, verify automatically.
Write Intent
Describe what your software should do in a .intent file using natural language.
# server.intent
Feature: User Greeting
id: feature.greeting
Scenario: Greet by name
When: GET /?name=Alice
Then:
- status 200
- body contains "Hello, Alice"
Scenario: Default greeting
When: GET /
Then:
- status 200
- body contains "Hello, World"
Implement with @implements
Write code and link it to requirements with annotations.
// server.tnt
import { html } from "std/http/server"
// @implements: feature.greeting
fn home(req) {
let name = req.query_params["name"] ?? "World"
return html("<h1>Hello, {name}!</h1>")
}
get("/", home)
listen(8080)
Verify
Run ntnt intent check to verify code matches intent.
$ ntnt intent check server.tnt
Feature: User Greeting
✓ Greet by name
✓ GET /?name=Alice → status 200
✓ body contains "Hello, Alice"
✓ Default greeting
✓ GET / → status 200
✓ body contains "Hello, World"
1/1 features passing (4/4 assertions)
Intent Assertion Language
Natural language becomes executable tests through term rewriting.
IAL lets you define domain-specific terms in a glossary. When tests run, natural language assertions are rewritten into executable checks.
## Glossary
| Term | Means |
|------|-------|
| page loads successfully | status 200 |
| they see "$text" | body contains "$text" |
| logged in as $user | header "Authorization" exists |
Then write tests in plain English:
Scenario: Welcome message
When: GET /dashboard
Given: logged in as admin
Then:
- page loads successfully
- they see "Welcome back"
IAL rewrites this into executable HTTP assertions automatically.
Intent Studio
Visual development with live test execution.
See pass/fail indicators update in real-time as you code. Intent Studio watches your files and re-runs tests automatically.
$ ntnt intent studio server.intent
# Opens http://127.0.0.1:3001
- Live ✓/✗ indicators for each scenario
- Automatic re-run on file save
- Detailed assertion results
- Coverage visualization
Key Features
Everything you need for verified AI-assisted development.
Intent-Driven Development
Write requirements in .intent files. Link code with @implements. Run ntnt intent check to verify they match. Full traceability from requirement to implementation.
Design by Contract
requires and ensures are built into the syntax. Agents read them as specs. Humans read them as docs. In HTTP routes, contract violations automatically return proper error responses.
Agent-Native Tooling
ntnt inspect outputs structured JSON describing every function, route, and contract. ntnt validate returns machine-readable errors. AI agents understand your codebase in a single call.
Full-Featured Language
Not a toy. NTNT has contracts, pattern matching, generics, enums, structs, traits, and a comprehensive standard library. Build real applications with HTTP servers, PostgreSQL, Redis, KV store, and more. Configure type safety per deployment with independent lint and type modes.
Type Safety Modes
Two independent axes: NTNT_LINT_MODE (default/warn/strict) and NTNT_TYPE_MODE (forgiving/warn/strict). Start untyped and add types incrementally. Configure per deployment via environment variables. Structured error messages with file, line, expected/actual type, and fix hints.
Batteries Included
No package manager needed. The standard library covers HTTP, databases, JSON, CSV, file I/O, crypto, and concurrency out of the box.
Native Hot-Reload
HTTP servers automatically reload when you save. No restart needed. Edit your code, refresh the browser, see changes instantly.
Design by Contract
Contracts are executable specifications for agents and documentation for humans.
fn withdraw(amount: Int) -> Int
requires amount > 0
requires amount <= self.balance
ensures result >= 0
{
self.balance = self.balance - amount
return self.balance
}
// In HTTP routes, contract violations become proper errors:
// - Failed precondition (requires): 400 Bad Request
// - Failed postcondition (ensures): 500 Internal Server Error
Standard Library
Everything you need to build web applications.
Web
HTTP server with routing, middleware, static files. HTTP client with fetch, auth, and cookies.
Database
Native PostgreSQL with parameterized queries, transactions, and connection pooling.
Data Formats
JSON and CSV parsing and serialization. URL encoding and query string handling.
File System
Read, write, copy, move files. Directory operations. Path manipulation.
Redis / KV
Native Redis client via std/db/redis. KV store (std/kv) for simple key-value operations without a full database setup.
Auth
OAuth, JWT, and session management via std/auth. AES-256-GCM encryption, Argon2 hashing, and base64 via std/crypto.
Crypto
SHA256, HMAC, UUID generation, AES-256-GCM encryption, Argon2 hashing, base64, random bytes, hex encoding.
Concurrency
Go-style channels with send, recv, and timeouts. No async/await complexity.
Ready to Explore?
Check out the documentation and try NTNT for yourself.
Learn NTNT