Skip to content

An experimental, AI-powered programming language designed for declarative automation. Loom learns from user intent to weave together complex tasks, allowing you to define what you want to achieve, while the language figures out how.

License

Notifications You must be signed in to change notification settings

tyy130/loom-lang

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

15 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Loom Lang Logo

An experimental, AI-powered programming language for declarative automation

Python Version MIT License Issues


๐Ÿ“‘ Table of Contents


๐Ÿ“– Overview

Loom is a self-teaching language that learns from user intent. Instead of writing detailed, step-by-step instructions, you declare what you want to achieve, and Loom's AI core figures out how to do it by weaving together the necessary tasks. It is designed to turn complex, repetitive scripting tasks into simple, high-level commands that it learns from your specific workflows.


โœจ Features

  • AI-Powered Core: The language interpreter is a Large Language Model that translates intent into executable Python.
  • Declarative Syntax: Focus on the "what," not the "how." The language is extended with readable, natural-language commands.
  • Autonomous Learning: The interpreter analyzes script history to find repetitive patterns and autonomously creates new, more efficient commands.
  • Permission-Based Security: Scripts must declare intent to access sensitive resources like the filesystem, preventing unexpected behavior.

๐Ÿค– Loom vs. AI Chatbots: What's the Difference?

A common question is, "How is this different from just asking ChatGPT or Gemini to write a script?" The distinction is between a conversational code generator and a structured, evolving programming environment.

An AI chatbot is like a brilliant consultant who gives you a blueprint (code); you still have to take it to the workshop and build the thing yourself. Loom is like an intelligent assistant in the workshop who not only builds it for you but then invents better tools for the next time.

Feature ChatGPT / Gemini (Chat Interface) Loom Language
Core Function A general-purpose conversational partner that generates text, including code snippets, based on prompts. A specialized programming language with a runtime that executes scripts for automation.
State & Memory Stateless (resets each session). It has conversational context but no persistent, structured memory of how you code. Stateful. It maintains a program_context (variables) during script execution and a persistent teachings memory that grows.
Structure Unstructured. You use natural language prompts. There's no inherent syntax, core library, or permissions model. Structured. It has a defined syntax (.loom files), a core.loom library, and a use keyword for permissions.
Learning Method Passive & General. You can ask it to "remember" things, but it doesn't autonomously create new, reusable functions from your patterns. Active & Specific. The "reflection" phase is a structured, autonomous process that analyzes your code to create new, permanent commands.
Execution Does not execute code. It only writes the code text for you to copy, paste, and run elsewhere. Directly executes code. The interpreter's final step is to run the generated Python, completing the task.

The Key Differentiator: An Evolving Tool

The most important difference is the structured, autonomous learning loop. A chatbot's knowledge is general and updated by its creators offline. Loom's knowledge is specific to you; it learns directly from your actions, in real-time, to permanently upgrade itself with new commands. It's a tool that evolves with you.


๐Ÿš€ Getting Started

Prerequisites

Installation & Setup

  1. Clone the Repository

    git clone https://github.com/your-username/loom-lang.git
    cd loom-lang
  2. Set Up a Virtual Environment

    # Create a virtual environment
    python -m venv .venv
    
    # Activate it (macOS/Linux)
    source .venv/bin/activate
    
    # Or on Windows
    .venv\Scripts\activate
  3. Install Dependencies

    pip install -r requirements.txt
  4. Configure Your API Key

    Create a .env file in the root directory and add your credentials:

    # === Loom Environment Variables ===
    # Gemini API Key (Google)
    GEMINI_API_KEY="your_api_key_here"
    
    # OpenAI API Key
    OPENAI_API_KEY="your_api_key_here"
    
    # Anthropic Claude API Key
    ANTHROPIC_API_KEY="your_api_key_here"
  5. Run the Demo

    Execute the main interpreter to run the example script (run.loom):

    python main.py

๐Ÿ’ก Usage

Loom works by processing .loom script files. The language is built on a foundational core.loom library, which you can extend with your own teach: commands. The true power emerges when the interpreter learns on its own.

Example: Generating a Financial Report

Imagine you have a CSV of transactions and you need to flag high-value sales.

transactions.csv

TransactionID,Client,Amount,Status
TX001,Innovate Corp,8500,Completed
TX002,Data Systems,1200,Completed
TX003,Synergy Inc,950,Pending
TX004,Quantum Tech,15000,Completed

You can write a run.loom script that uses commands from core.loom to process this data.

run.loom

# Grant permission to access the filesystem
use filesystem

# Use a core command to load and parse the CSV data
define transactions as parse csv "transactions.csv"

# This repetitive block is what Loom will learn from.
# It finds high-value sales and prints a formatted alert.
for each transaction in transactions, do "
    define amount as int(transaction['Amount'])
    if amount > 5000 then "
        define client as transaction['Client']
        print f'ALERT: High-value transaction of ${amount} detected for client: {client}.'
    "
"

๐Ÿง  The Magic: Autonomous Learning

After running the script, Loom's reflection phase kicks in. It analyzes the repetitive block inside the loop and recognizes an opportunity for a new, high-level command. The interpreter then reports what it learned:

--- ๐Ÿ“ˆ Loom Learning Report ---
- Learned new command with 95% confidence: 'generate high_value_alert for (transaction)'
----------------------------

The language has now taught itself a new skill. In your next script, you could potentially replace the entire if...then block with this single, declarative line, making your code cleaner and more intent-driven.


๐Ÿ”ฎ The Potential

Loom represents a fundamental shift in how we think about programming languages and automation. Rather than being a static tool that requires developers to learn its syntax and patterns, Loom inverts this relationship: the language learns from you.

Beyond Scripting

While the current implementation focuses on automation scripts, the underlying architecture opens doors to far more ambitious applications:

Domain-Specific Evolution

  • A data scientist's Loom instance could evolve specialized commands for statistical analysis and visualization
  • A DevOps engineer's version might develop sophisticated deployment and monitoring abstractions
  • A content creator's Loom could learn media processing pipelines tailored to their specific workflow

Collaborative Intelligence

  • Teams could share learned command libraries, creating collective knowledge bases
  • Organizations could develop industry-specific Loom dialects that encode best practices
  • Open-source communities could curate and refine command sets for common problem domains

Progressive Abstraction

  • As Loom learns more patterns, it can identify meta-patterns and create higher-order abstractions
  • Complex multi-step workflows become single declarative statements
  • The language grows more powerful and expressive over time, adapting to your evolving needs

The Paradigm Shift

Traditional programming requires you to think like the computer: break problems into precise, sequential steps. Loom allows you to think like a human: describe the outcome you want and let the system figure out the implementation.

This isn't just about convenience. It's about:

  • Accessibility: Non-programmers can automate complex tasks by describing intent
  • Maintainability: High-level declarative code is easier to understand and modify
  • Adaptability: The language evolves with your needs rather than requiring you to learn new frameworks
  • Knowledge Capture: Repetitive patterns in your work automatically become reusable abstractions

Technical Frontiers

The current implementation is just the beginning. Future directions could include:

Multi-Modal Learning

  • Learning from natural language descriptions, not just code patterns
  • Incorporating visual workflows and diagrams
  • Understanding context from documentation and comments

Verification and Safety

  • Formal verification of learned commands
  • Automatic test generation for new abstractions
  • Confidence scoring and human-in-the-loop approval for critical operations

Cross-Language Integration

  • Generating optimized code in multiple target languages
  • Interfacing with existing codebases and APIs
  • Bridging different programming paradigms

Distributed Learning

  • Federated learning across multiple Loom instances
  • Privacy-preserving knowledge sharing
  • Specialized models for different domains

The Vision

Imagine a future where programming languages are not fixed artifacts but living systems that grow with their users. Where the barrier between human intent and machine execution becomes increasingly transparent. Where the collective knowledge of how to solve problems accumulates and compounds over time.

Loom is an experiment in that direction. It's not just a tool for automationโ€”it's a prototype for a new relationship between humans and computers, where the machine adapts to us rather than the other way around.


๐Ÿค Contributing

  • Report Bugs: Please open an issue on the GitHub Issues page.
  • Suggest Features: You can also use GitHub Issues to suggest new ideas or enhancements.
  • Submit Changes: Fork the repository, make your changes, and open a Pull Request.

๐Ÿ“„ License

This project is licensed under the MIT License. See the LICENSE.txt file for details.


๐Ÿ—ฃ Join the Discussion

Get involved, ask questions, or share what you're building.


Created by Tyler Hill at Tactic Dev
Built with โค๏ธ by the Loom community

About

An experimental, AI-powered programming language designed for declarative automation. Loom learns from user intent to weave together complex tasks, allowing you to define what you want to achieve, while the language figures out how.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%