Back to flin
flin

AI-First Language Design

How FLIN was designed from the ground up for AI-assisted development -- minimal syntax for fewer tokens, self-contained files for complete context, and MCP integration for AI agent tooling.

Thales & Claude | March 25, 2026 9 min flin
flinai-firstdesignllmagents

Most programming languages were designed for humans to write and compilers to read. FLIN was designed for both humans AND AI agents to write, and for both compilers AND LLMs to read.

This is not a minor distinction. It influenced every syntax decision, every convention, and every architecture choice. FLIN is not a language that happens to work well with AI assistants. It is a language that was deliberately optimized for a world where AI agents generate, modify, and maintain code alongside human developers.

The central thesis: the same properties that make a language easy for AI to work with -- minimal syntax, self-contained files, zero configuration, deterministic behavior -- also make it easier for humans. Designing for AI does not compromise the human experience. It enhances it.

Principle 1: Minimal Syntax, Fewer Tokens

Every unnecessary keyword, bracket, and boilerplate line is a token that an LLM must generate. More tokens mean more cost, more latency, and more opportunity for errors. FLIN minimizes syntax to minimize the token cost of code generation.

Compare a simple CRUD endpoint across frameworks:

// Express.js: 23 lines, ~180 tokens
const express = require('express');
const router = express.Router();
const User = require('../models/User');

router.get('/:id', async (req, res) => { try { const user = await User.findById(req.params.id); if (!user) { return res.status(404).json({ error: 'Not found' }); } res.json(user); } catch (err) { res.status(500).json({ error: 'Server error' }); } });

module.exports = router; ```

// FLIN: 7 lines, ~40 tokens
route GET {
    user = User.find(params.id)
    if user == none {
        return error(404, "Not found")
    }
    user
}

The FLIN version uses approximately 78% fewer tokens. For an AI generating 100 endpoints, this difference translates to thousands of tokens saved -- which means faster generation, lower cost, and fewer opportunities for the model to make errors in boilerplate code.

Principle 2: No Imports

FLIN has no import statements. Every entity, every built-in function, and every language feature is available by name without declaring dependencies.

This matters enormously for AI code generation. In a typical Python or JavaScript project, an AI must: 1. Know which module provides the function it wants to use. 2. Generate the correct import statement at the top of the file. 3. Keep imports in sync when adding or removing function calls. 4. Handle import naming conflicts. 5. Know the difference between default and named exports.

In FLIN, the AI writes the function call and it works. User.find(), hash_password(), save, delete, ai_complete() -- all available everywhere, always.

// No imports needed. Everything just works.
hash = hash_password(body.password)
token = create_token(user, { expires: "7d" })
save user
redirect("/dashboard")

This eliminates an entire category of AI-generated errors: wrong import paths, missing imports, circular imports, and version-specific import syntax.

Principle 3: Self-Contained Files

In FLIN, a single .flin file contains everything needed to understand a route: the guards, the validation, the business logic, and the view template. There is no need to trace through multiple files to understand what a route does.

This property is critical for AI agents. An LLM's context window is limited. If understanding one route requires reading the router config, the middleware setup, the controller, the service layer, the model, and the view template, the agent needs 6 files in context. In FLIN, it needs 1.

// app/api/users/[id].flin
// EVERYTHING is in this file

guard auth guard role("admin", "user")

route GET { user = User.find(params.id) if user == none { return error(404, "User not found") } user }

route PUT { validate { name: text @minLength(2) email: text @email } user = User.find(params.id) if body.name != none { user.name = body.name } if body.email != none { user.email = body.email } save user user }

route DELETE { guard owner(params.id) delete User.find(params.id) { success: true } } ```

An AI agent can read this single file and understand everything: who can access it (auth + role guard), what data it expects (validate block), what it does (CRUD operations), and how it responds. No external context needed.

Principle 4: Deterministic Behavior

FLIN's behavior is deterministic: the same code always produces the same result. There are no hidden configuration files that change behavior, no environment-dependent defaults, and no implicit middleware that might or might not run.

For AI agents, determinism means testability. An agent can generate code, reason about its behavior, and verify that it works -- without needing to simulate the entire runtime environment.

// This code always does the same thing:
// 1. Hash the password with Argon2id
// 2. Save to FlinDB
// 3. Return the user
hash = hash_password(body.password)
user = User { email: body.email, password: hash }
save user
user

There is no password_config.yaml that might change the algorithm. There is no DATABASE_ADAPTER environment variable that might change the storage backend. The behavior is in the code, and the code is all the AI needs to read.

llms.txt: AI Context Files

Every FLIN project includes an llms.txt file that provides AI agents with a structured overview of the project:

# FLIN Project

What is this? A task management application built with FLIN.

Entities - User: name, email, role - Task: title, description, status, assignee - Comment: content, author, task

Views - index.flin: Home page with task dashboard - tasks.flin: Task list with filters - tasks/[id].flin: Task detail and edit

How to modify 1. Edit .flin files 2. Run flin dev 3. Changes apply instantly

Syntax quick reference - Variables: name = value - Entities: entity Name { field: type } - Views: HTML-like with {expressions} - Events: click={action} ```

This file is designed for AI consumption. It provides the minimum context an agent needs to understand the project structure, the data model, and the coding conventions.

AGENTS.md: Agent Instructions

For more detailed AI agent integration, FLIN projects include an AGENTS.md file:

# AI Agent Instructions for FLIN

Your Role You are developing a FLIN application.

Key Rules 1. Never use imports -- everything is available globally 2. Never use npm/yarn -- FLIN has no package manager 3. Variables are reactive by default 4. Use save and delete for database operations 5. HTML-like syntax for view sections 6. Guards go at the top of route files 7. Middleware goes in _middleware.flin files

Common Patterns [Entity definition, route handler, middleware examples]

Current Task [Specific instructions for the current work] ```

MCP Integration

FLIN supports the Model Context Protocol (MCP), allowing AI agents to interact with FLIN projects programmatically:

{
    "mcp": {
        "server": "flin-mcp",
        "tools": [
            "flin:create_file",
            "flin:read_file",
            "flin:run_dev",
            "flin:query_entity",
            "flin:generate_component",
            "flin:list_entities"
        ]
    }
}

MCP tools allow an AI agent to: - Create and modify .flin files. - Start the development server. - Query the database to verify behavior. - List available entities and their schemas. - Generate new components from natural language descriptions.

This is not theoretical. It is the mechanism that enables "build me a todo app" to produce a working FLIN application through an AI agent conversation.

AI-Generated Components

Because FLIN's syntax is minimal and self-contained, AI models can generate complete, working components from natural language descriptions:

Prompt: "Create a user registration form with name, email, password, and avatar upload"

Generated:

name = ""
email = ""
password = ""
error = ""

Create Account

{if error}

{error}
{/if}

Already have an account? Log in

```

The generated code is complete, correct, and immediately runnable. No missing imports. No configuration files to create. No dependencies to install. The AI generates one file and it works.

The 100-Agent Future

FLIN's AI-first design is not just about helping individual developers. It is about enabling a new development paradigm: 100 AI agents working on a FLIN application simultaneously.

Each agent reads the llms.txt and AGENTS.md files to understand the project. Each agent works on self-contained .flin files that do not conflict with other agents' work. Each agent can verify its work by running flin dev and querying the database.

The file-based routing means agents do not need to coordinate on a shared routing configuration. The zero-import design means agents do not need to manage a shared dependency graph. The self-contained file convention means each agent's work is isolated to its own files.

This is the future FLIN is designed for: a world where the ratio of AI agents to human developers is 100:1, and the language itself is the coordination mechanism.

What AI-First Does Not Mean

AI-first does not mean human-last. Every design decision that benefits AI agents also benefits human developers:

  • Minimal syntax means less to type and less to read.
  • No imports means less boilerplate and fewer mistakes.
  • Self-contained files means easier navigation and understanding.
  • Deterministic behavior means easier debugging and testing.
  • Structured context files means better onboarding for new team members.

FLIN is not a language for AI to write while humans watch. It is a language for humans and AI to write together, where the design makes collaboration natural for both.

In the final article of Arc 11, we cover search analytics and result caching -- how FLIN tracks what users search for, measures search quality, and caches results for performance.

---

This is Part 124 of the "How We Built FLIN" series, documenting how a CEO in Abidjan and an AI CTO designed and built a programming language from scratch.

Series Navigation: - [123] Hybrid Document Search: BM25 + Semantic - [124] AI-First Language Design (you are here) - [125] Search Analytics and Result Caching

Share this article:

Responses

Write a response
0/2000
Loading responses...

Related Articles