# Code Craft AI

> Code Craft AI builds foundation software. Its Loup programming language — the Language of Unusual Portability | Power — is one strongly typed language for scripts, web applications compiled to WebAssembly, native programs, and bare-metal firmware.

The Loup books are the practical guides to the language, one book per execution mode. Every page below is Markdown. Agents that write Loup should install the loup-programmer skill.

## Loup books

- [The Loup books](https://code-craft.ai/references/loup/index.md): Loup — the Language of Unusual Portability | Power — is one strongly typed language for quick scripts, programs compiled to native code or WebAssembly, and bare-metal firmware. The language is the…
- [The Loup Scripting Book](https://code-craft.ai/references/loup/scripting.md): Covers: Loup 1.25 (toolchain 1.25.1) and the Loup Language Reference, the four v1.20 volumes as amended through 1.25 (core, runtime, compilation, data). Section references such as §1-2.4 point into…
- [The Loup Native Book](https://code-craft.ai/references/loup/native.md): Writing Loup programs that compile to native executables. This edition describes Loup 1.25.1.
- [The Loup Web Book](https://code-craft.ai/references/loup/web.md): ⚠ Status: Loup 1.25.1. This book describes the web design in the Loup Language Reference (the v1.20 volumes, amended in place through 1.25). Anything marked ⚠ Planned is not in this release. Loup…
- [The Loup Freestanding Book](https://code-craft.ai/references/loup/freestanding.md): For Loup 1.25. Freestanding support is experimental in this release; features the Language Reference specifies but the toolchain does not implement yet are marked ⚠ Planned.

## The Loup Scripting Book

- [Chapter 1: Getting Started](https://code-craft.ai/references/loup/scripting/ch01-getting-started.md): What you'll learn: how to install Loup, run your first script, read the two kinds of error Loup reports, give a script the permissions it needs, and turn a script into a program with a main()…
- [Chapter 2: Variables and Data Types](https://code-craft.ai/references/loup/scripting/ch02-variables-and-data-types.md): What you'll learn: how Loup binds names to values with let, var and const; the primitive types you use every day; how to convert between numeric types; how Option[T] replaces null; and when to use…
- [Chapter 3: Functions and Closures](https://code-craft.ai/references/loup/scripting/ch03-functions-and-closures.md): What you'll learn: how to declare functions, give parameters default values and pass arguments by name; how to write lambdas and closures, including closures that update outer variables; and how…
- [Chapter 4: Control Flow](https://code-craft.ai/references/loup/scripting/ch04-control-flow.md): What you'll learn: branching with if (as a statement and as an expression) and a first look at match; looping with while, do/while, counted for and for-in over collections and ranges; break, continue…
- [Chapter 5: Collections](https://code-craft.ai/references/loup/scripting/ch05-collections.md): What you'll learn: the four built-in collection types (list, dict, set, tuple), indexing and slicing, the methods each collection has, list comprehensions, spread, membership tests, and what happens…
- [Chapter 6: Structs](https://code-craft.ai/references/loup/scripting/ch06-structs.md): What you'll learn: how to define a struct, construct it with named arguments, give it methods and operators, make modified copies with with, and what "value semantics" means when you assign a struct…
- [Chapter 7: Enums and Pattern Matching](https://code-craft.ai/references/loup/scripting/ch07-enums-and-pattern-matching.md): What you'll learn: how to define enums with and without payloads, take them apart with match, use guards, wildcards and nested patterns, and use the two built-in enums you will meet in almost every…
- [Chapter 8: Classes and Objects](https://code-craft.ai/references/loup/scripting/ch08-classes-and-objects.md): What you'll learn: how to declare classes with fields, a constructor and methods; why methods that change an object are marked modifier and called inside safe; constructors, static factories and…
- [Chapter 9: Interfaces and Generics](https://code-craft.ai/references/loup/scripting/ch09-interfaces-and-generics.md): What you'll learn: how to declare an interface and implement it, give an interface default methods, use the standard interfaces that power ==, <, for and with, overload operators, and write generic…
- [Chapter 10: Error Handling](https://code-craft.ai/references/loup/scripting/ch10-error-handling.md): What you'll learn: the three ways a Loup script deals with failure — Option[T] when a value may be absent, Result[T, E] when an operation can fail in an expected way, and exceptions for failures that…
- [Chapter 11: Modules and Packages](https://code-craft.ai/references/loup/scripting/ch11-modules-and-packages.md): What you'll learn: how one script uses code from another file, how pub decides what a file exports, the import forms Loup has (and the ones it deliberately lacks), what happens when a module is…
- [Chapter 12: Strings, Interpolation, and Template Fences](https://code-craft.ai/references/loup/scripting/ch12-strings-interpolation-templates.md): What you'll learn: how Loup strings work, the string literal forms, the everyday string methods, interpolated strings with filters, and template fences — multi-line templates with {% if %} and {% for…
- [Chapter 13: Concurrency](https://code-craft.ai/references/loup/scripting/ch13-concurrency.md): What you'll learn: async functions and await, structured concurrency with await group, async generators and for await, atomic {} blocks, offloading work with spawnBlocking, worker scripts with…
- [Chapter 14: Reflection and Dynamic Compilation](https://code-craft.ai/references/loup/scripting/ch14-reflection.md): ⚠ Planned — not in Loup 1.25. This chapter describes the design in the Language Reference (§1-4.7 typeof and instanceof, §1-2.3 __module__ and Module, §1-8.8 annotations, §2-5.1 runtime.compile). The…
- [Chapter 15: Reactive UI](https://code-craft.ai/references/loup/scripting/ch15-reactive-ui.md): ⚠ Planned — not in Loup 1.25. This chapter describes the design in the Language Reference (§2-4 Reactive UI: §2-4.1 signals, §2-4.2 components, §2-4.3 mounting, §2-4.6 the ui fence, §2-4.8 the…
- [Chapter 16: Testing](https://code-craft.ai/references/loup/scripting/ch16-testing.md): What you'll learn: how to write tests as ordinary Loup functions, check results with the debug.assert helpers, run them with loup test, read a failure report, skip a test that cannot run, and lay out…
- [Chapter 17: JavaScript Host Interop](https://code-craft.ai/references/loup/scripting/ch17-js-host-interop.md): ⚠ Planned — not in Loup 1.25. This chapter describes the design in the Language Reference (§2-3.1 extern js, §2-3.2 @jsexport, §2-3.3 the lang.interop.js facades). The toolchain does not implement it…
- [Chapter 18: Building Script Tools](https://code-craft.ai/references/loup/scripting/ch18-building-script-tools.md): What you'll learn: how to turn a script into a command-line tool: making it executable, reading arguments and options, reporting errors on standard error with the right exit status, walking…
- [Chapter 19: Memory Safety and Resource Management](https://code-craft.ai/references/loup/scripting/ch19-memory-safety-and-resources.md): What you'll learn: how long values and objects live in a Loup script, how the ownership verbs (reads, edits, takes, shares) and modifier/safe control who may change what, what unique adds, how to…

## The Loup Native Book

- [Chapter 1: Getting started](https://code-craft.ai/references/loup/native/ch01-getting-started.md): This chapter gets you from an empty directory to a running native Loup program. You will install the toolchain, write a program with a main() function, run it with loup run, and then build it into a…
- [Chapter 2: Native mode overview](https://code-craft.ai/references/loup/native/ch02-native-mode-overview.md): Chapter 1 got a program running. This chapter steps back and explains what the two native modes, host.native and host.dual, mean to the compiler: where they sit among Loup's six modes, what they…
- [Chapter 3: Variables and numerics](https://code-craft.ai/references/loup/native/ch03-variables-and-numerics.md): This chapter covers bindings (let, var, const), Loup's primitive types, numeric literals and conversions, and the part that matters most for native code: what happens when integer arithmetic…
- [Chapter 4: Functions](https://code-craft.ai/references/loup/native/ch04-functions.md): Functions in native Loup look like functions in any Loup mode, with every parameter and return type written out. This chapter covers declarations, default and named arguments, function values and…
- [Chapter 5: Control flow](https://code-craft.ai/references/loup/native/ch05-control-flow.md): Loup's control flow is close to C's and TypeScript's, with a few rules that catch people out: conditions always take parentheses, bodies always take braces, there is no ?: operator, and loop…
- [Chapter 6: Collections](https://code-craft.ai/references/loup/native/ch06-collections.md): Loup has four built-in collection types: list[T], dict[K, V], set[T] and tuples. This chapter covers their everyday operations and the property that surprises people coming from Python, JavaScript or…
- [Chapter 7: Structs](https://code-craft.ai/references/loup/native/ch07-structs.md): A struct is a value type for plain data: copied on assignment, compared field by field, and never reference-counted. This chapter covers declaring and constructing structs, mutable fields, methods…
- [Chapter 8: Enums and pattern matching](https://code-craft.ai/references/loup/native/ch08-enums-and-pattern-matching.md): An enum is a type whose values are one of a fixed set of variants, each of which may carry its own data. Together with match, enums are how Loup models "one of several kinds of thing": a parsed…
- [Chapter 9: Classes and ARC](https://code-craft.ai/references/loup/native/ch09-classes-and-arc.md): Structs (chapter 7) are values. Classes are the other half of Loup's data model: objects with identity, shared by reference, whose lifetime is managed by automatic reference counting (ARC). This…
- [Chapter 10: Interfaces](https://code-craft.ai/references/loup/native/ch10-interfaces.md): An interface names a set of methods. A class or struct that declares implements the interface and provides those methods can be used wherever the interface is expected. This chapter covers declaring…
- [Chapter 11: Generics](https://code-craft.ai/references/loup/native/ch11-generics.md): Generics let one definition work for many types: a Stack[T] of anything, a binarySearch over any ordered list. Type parameters are written in square brackets, and bounds in a where clause say what a…
- [Chapter 12: Error handling](https://code-craft.ai/references/loup/native/ch12-error-handling.md): Loup has two ways to report failure. An exception is thrown with throw and travels up the call stack until a try/catch handles it. A Result[T, E] is an ordinary return value that the caller inspects…
- [Chapter 13: Modules and packages](https://code-craft.ai/references/loup/native/ch13-modules-and-packages.md): A program larger than one file is a package: a directory with a .lppkg manifest and source files, each of which is a module. This chapter covers how modules import each other and the standard…
- [Chapter 14: Template fences](https://code-craft.ai/references/loup/native/ch14-template-fences.md): Loup has two built-in ways to produce text from values. Interpolated strings, i"…{$ expr $}…", build a string on the spot and work everywhere, including native binaries. Template fences, blocks…
- [Chapter 15: Ownership verbs](https://code-craft.ai/references/loup/native/ch15-ownership-verbs.md): Every parameter in Loup carries a verb that says what the function will do with the argument: read it, change it in place, take it over, or keep a reference to it. The verb is part of the signature,…
- [Chapter 16: borrow, excl borrow and noescape](https://code-craft.ai/references/loup/native/ch16-borrow-and-noescape.md): Chapter 15's verbs (reads, edits, takes, shares) say what a function does with its arguments. This chapter covers three lower-level keywords that say how an argument is held:
- [Chapter 17: unique ownership](https://code-craft.ai/references/loup/native/ch17-unique-ownership.md): Reference counting lets any number of bindings share a class instance. That flexibility has two costs: a count in every object and an atomic increment or decrement whenever a reference is copied or…
- [Chapter 18: Lifetimes and regions](https://code-craft.ai/references/loup/native/ch18-lifetimes-and-regions.md): A plain borrow (chapter 16) lives only as long as the call it was passed to. Sometimes a borrow has to travel further: a function returns a reference into one of its arguments, or a struct holds a…
- [Chapter 19: @unsafe and calling C](https://code-craft.ai/references/loup/native/ch19-unsafe-and-ffi.md): Every check in chapters 15 to 18 stops at the edge of what the compiler can see. C libraries, inline assembly and claims about thread safety that rest on a protocol the compiler cannot read are on…
- [Chapter 20: Concurrency with OS threads](https://code-craft.ai/references/loup/native/ch20-concurrency-os-threads.md): A native Loup binary can run code on several operating-system threads at once. This chapter covers starting threads and collecting their results, the Sendable rules that decide what may cross a…
- [Chapter 21: Async on native](https://code-craft.ai/references/loup/native/ch21-async-on-native.md): ⚠ Planned for native binaries — not in Loup 1.25. The Language Reference (§2-1.1 to §2-1.9) specifies async/await for native programs, running on a multi-threaded, work-stealing executor. The 1.25.1…
- [Chapter 22: Desktop UI](https://code-craft.ai/references/loup/native/ch22-desktop-ui.md): ⚠ Planned — not in Loup 1.25. This chapter describes the design in the Language Reference (§2-4, "Reactive UI", and §2-4.8, "Desktop Backend"). The toolchain does not implement it yet, so its…
- [Chapter 23: SIMD and GPU](https://code-craft.ai/references/loup/native/ch23-simd-and-gpu.md): ⚠ Planned — not in Loup 1.25. This chapter describes the design in the Language Reference (§1-2.6 and §1-16.8) and the Packages Reference (§21.29, §21.30). The toolchain does not implement it yet, so…
- [Chapter 24: Building and distributing](https://code-craft.ai/references/loup/native/ch24-building-and-distributing.md): This chapter covers getting a native Loup program from a project directory onto someone else's machine: the project manifest, the delivery targets loup build can produce, the native build options and…
- [Chapter 25: Memory safety patterns](https://code-craft.ai/references/loup/native/ch25-memory-safety-patterns.md): Chapters 15 to 20 introduced Loup's safety mechanisms one at a time: ownership verbs, borrows, unique, lifetimes, @unsafe and Sendable. This chapter goes the other way. It takes the classic…

## The Loup Web Book

- [Chapter 1: Getting Started](https://code-craft.ai/references/loup/web/ch01-getting-started.md): This chapter installs Loup, runs a first .lpweb program, sets up a project, and compiles it to WebAssembly. It ends with a look at the browser pipeline the Language Reference specifies, which is not…
- [Chapter 2: The Web Modes](https://code-craft.ai/references/loup/web/ch02-compiled-mode-rules.md): Loup has six execution modes. Two of them are for the web: web.compiled and web.scripted. This chapter covers how a file declares its mode, where each web mode starts running, what each mode allows,…
- [Chapter 3: Variables and Data Types](https://code-craft.ai/references/loup/web/ch03-variables-and-data-types.md): What you'll learn. How let, var and const differ, the primitive types, how integers and floats behave (including what happens on overflow today), characters and strings, bytes, Option instead of…
- [Chapter 4: Functions](https://code-craft.ai/references/loup/web/ch04-functions.md): What you'll learn. How to declare functions, default and named arguments, lambdas and closures, function types, higher-order functions, a first look at generic functions and generators, property…
- [Chapter 5: Control Flow](https://code-craft.ai/references/loup/web/ch05-control-flow.md): What you'll learn. if / else if / else as statements and expressions, while, do/while, the two for loops, labeled break and continue, match, the cleanup tools (try/finally, defer, with), and the…
- [Chapter 6: Collections](https://code-craft.ai/references/loup/web/ch06-collections.md): What you'll learn. The built-in collections list[T], dict[K, V] and set[T], plus tuples: their literals, the methods each one has, slicing, list comprehensions, and what happens when you assign a…
- [Chapter 7: Structs](https://code-craft.ai/references/loup/web/ch07-structs.md): What you'll learn. How to declare and construct structs, what value semantics means in practice, the with copy expression, methods and operators on structs, the pure-value invariant, and generic…
- [Chapter 8: Enums and Pattern Matching](https://code-craft.ai/references/loup/web/ch08-enums-and-pattern-matching.md): What you'll learn. Plain enums, enums whose variants carry data, the built-in Option[T] and Result[T, E], the patterns match accepts (literals, bindings, wildcards, guards, tuples, nested variants,…
- [Chapter 9: Classes and Objects](https://code-craft.ai/references/loup/web/ch09-classes-and-objects.md): A struct (Chapter 7) is a value: two Point(x = 3, y = 4) are the same point, and assigning one copies it. A class describes an object with identity: two shopping carts holding the same items are…
- [Chapter 10: Interfaces](https://code-craft.ai/references/loup/web/ch10-interfaces.md): An interface is a contract: a list of methods that any type claiming to implement it must provide. Code written against the interface works with every implementation, so you can render a list of…
- [Chapter 11: Generics](https://code-craft.ai/references/loup/web/ch11-generics.md): What you'll learn. How to write functions, structs, classes, enums, and interfaces that take type parameters; how type arguments are inferred and when you must write them; how where clauses and…
- [Chapter 12: Error Handling](https://code-craft.ai/references/loup/web/ch12-error-handling.md): What you'll learn. Loup's two error mechanisms, exceptions and Result[T, E]; how to throw, catch, chain, and define exceptions; what an uncaught exception prints; how to handle and propagate a Result…
- [Chapter 13: Modules and Packages](https://code-craft.ai/references/loup/web/ch13-modules-and-packages.md): What you'll learn. How files become modules, the from … import (…) and import … as … forms, pub visibility across files, barrel modules with pub from, the import rule between web.compiled and…
- [Chapter 14: Template Fences — HTML and CSS](https://code-craft.ai/references/loup/web/ch14-template-fences-html-and-css.md): A template fence embeds a block of another language (HTML, CSS, SQL, plain text) in Loup source and fills it with Loup values. It is the tool a web app uses to produce markup.
- [Chapter 15: Async and Concurrency](https://code-craft.ai/references/loup/web/ch15-async-and-concurrency.md): What you'll learn. async functions and Task[T], await, structured concurrency with await group, async generators and for await, atomic {} blocks, and spawnBlocking — and, just as important, how Loup…
- [Chapter 16: Reactive UI](https://code-craft.ai/references/loup/web/ch16-reactive-ui.md): ⚠ Planned — not in Loup 1.25. This chapter describes the design in the Language Reference (§2-4.1–§2-4.7, with the template fences of §1-16). The toolchain does not implement it yet, so its listings…
- [Chapter 17: Web Components](https://code-craft.ai/references/loup/web/ch17-web-components.md): ⚠ Planned — not in Loup 1.25. This chapter describes the design in the Language Reference (§2-4.10, with §1-16.7.1 for CSS and §1-20.6 for bootstrap registration). The toolchain does not implement it…
- [Chapter 18: DOM, Storage, Workers, and JavaScript Interop](https://code-craft.ai/references/loup/web/ch18-dom-storage-workers-js-interop.md): ⚠ Planned — not in Loup 1.25. This chapter describes the design in the Language Reference (§2-3.1–§2-3.3 for JavaScript interop, §2-1.10 for workers, §1-16.6.5 for passing data to scripts). The…
- [Chapter 19: SSR, Hydration, and Deployment](https://code-craft.ai/references/loup/web/ch19-ssr-hydration-and-deployment.md): ⚠ Planned — not in Loup 1.25. This chapter describes the design in the Language Reference (§2-4.7 for server-side rendering, hydration and state serialization, §1-16.6.7–§1-16.6.8 for SafeHtml,…
- [Chapter 20: Memory Safety in Web Apps](https://code-craft.ai/references/loup/web/ch20-memory-safety.md): This chapter collects, bug class by bug class, what Loup does to keep a web app correct: which mistakes the compiler refuses, which ones the runtime catches, and which defences are still planned.…

## The Loup Freestanding Book

- [Chapter 1: What Is Freestanding Mode?](https://code-craft.ai/references/loup/freestanding/ch01-what-is-freestanding.md): What you'll learn. What @mode(freestanding) is, what it keeps from the rest of Loup, what it leaves out, what the 1.25 toolchain can do with it today, and what a first freestanding program looks like.
- [Chapter 2: Building a Bare-Metal Binary](https://code-craft.ai/references/loup/freestanding/ch02-building-a-bare-metal-binary.md): This chapter is the workflow you repeat for every freestanding project: lay out the files, write the manifest and linker script, type-check, build an image for a target architecture, and boot it in…
- [Chapter 3: Integer Types and Wrapping Arithmetic](https://code-craft.ai/references/loup/freestanding/ch03-integer-types-and-wrapping-arithmetic.md): Kernel code is mostly integer code: register values, addresses, page-table bits, ring-buffer indexes, tick counters. This chapter covers the integer rules you meet in @mode(freestanding):
- [Chapter 4: Functions and Control Flow](https://code-craft.ai/references/loup/freestanding/ch04-functions-and-control-flow.md): Most of Loup's everyday syntax is the same in @mode(freestanding) as in any other mode: func, if/else, while, for, match, return, break, continue and lambdas. This chapter is a quick tour of that…
- [Chapter 5: Structs and Layout Control](https://code-craft.ai/references/loup/freestanding/ch05-structs-and-layout.md): Most hardware interfaces have a layout someone else chose. The CPU vendor decided what an interrupt frame and a task state segment look like; the network standard fixed the bytes of a UDP header; the…
- [Chapter 6: Enums and Pattern Matching](https://code-craft.ai/references/loup/freestanding/ch06-enums-and-pattern-matching.md): Enums carry a lot of the weight in freestanding code. Device states are enums, error types are enums, and so are the legal values of most register fields. Because match must be exhaustive, the code…
- [Chapter 7: Classes and Allocators](https://code-craft.ai/references/loup/freestanding/ch07-classes-and-allocators.md): In the hosted modes a class instance lives on a heap managed by ARC. A freestanding image has neither a heap nor ARC, so classes need more care. This chapter covers:
- [Chapter 8: Interfaces and Generics](https://code-craft.ai/references/loup/freestanding/ch08-interfaces-and-generics.md): Freestanding code keeps Loup's interfaces and generics. A UART, a framebuffer console and a debug ring buffer can all implement one SerialOut interface; a table or a ring buffer can be written once…
- [Chapter 9: Error Handling with Result](https://code-craft.ai/references/loup/freestanding/ch09-error-handling-with-result.md): The hosted modes have exceptions. Freestanding does not: throw and exception catch arms are rejected with E_FREESTANDING_EXCEPTIONS. This chapter explains why, then shows what replaces them —…
- [Chapter 10: Ownership Verbs](https://code-craft.ai/references/loup/freestanding/ch10-ownership-verbs.md): With no garbage collector and no reference counting under a freestanding image, something else has to say who may read a value, who may change it, and when its owner gives it away. In Loup that is…
- [Chapter 11: Borrow and Lifetimes](https://code-craft.ai/references/loup/freestanding/ch11-borrow-and-lifetimes.md): Chapter 10 introduced the verbs that say what a function does with an argument. This chapter covers the borrow forms underneath them and the lifetime labels that let the compiler check that a…
- [Chapter 12: Unique Ownership](https://code-craft.ai/references/loup/freestanding/ch12-unique-ownership.md): A freestanding image has no reference counts, so "who owns this object, and when is it done?" must be answered at compile time. unique is how Loup answers it: a unique value has exactly one owner at…
- [Chapter 13: Memory Primitives](https://code-craft.ai/references/loup/freestanding/ch13-memory-primitives.md): Sooner or later freestanding code works on memory directly: a page has to be zeroed before it is mapped, a descriptor ring has to sit at an address the device can find, a register block is a run of…
- [Chapter 14: Inline Assembly](https://code-craft.ai/references/loup/freestanding/ch14-inline-assembly.md): Some instructions have no Loup equivalent: cli and sti, rdmsr/wrmsr, lidt, reading cr2, mrs/msr on Arm, csrr/csrw on RISC-V, the barrier instructions, the first few instructions after reset. For…
- [Chapter 15: MMIO with Volatile](https://code-craft.ai/references/loup/freestanding/ch15-mmio-with-volatile.md): On most systems a device is controlled through memory-mapped I/O (MMIO): its registers appear at fixed physical addresses, and a load or store to one of those addresses talks to the device instead of…
- [Chapter 16: Interrupts and Naked Functions](https://code-craft.ai/references/loup/freestanding/ch16-interrupts-and-naked-functions.md): An interrupt handler runs at a moment you did not choose, on a stack you did not set up, in the middle of code that was doing something else. It must save whatever it touches, return with a special…
- [Chapter 17: Entry Points and Panic](https://code-craft.ai/references/loup/freestanding/ch17-entry-points-and-panic.md): A freestanding program has two special functions. The entry point is the first Loup code the CPU runs: there is no C runtime and no main, only an address the boot loader or the reset vector jumps to.…
- [Chapter 18: Sections and the Linker](https://code-craft.ai/references/loup/freestanding/ch18-sections-and-linker.md): A freestanding image is a set of named sections that the linker places at addresses a linker script chooses. The boot stub has to sit where the loader jumps, the exception vectors where the CPU looks…
- [Chapter 19: Multicore and Atomics](https://code-craft.ai/references/loup/freestanding/ch19-multicore-and-atomics.md): With more than one CPU, two pieces of code really do run at the same time against the same memory. You need operations that complete as one indivisible step, and a way to say which other memory…
- [Chapter 20: The Available Standard Library Subset](https://code-craft.ai/references/loup/freestanding/ch20-available-stdlib-subset.md): Almost all of Loup's standard library is hosted code: it expects the Loup runtime, an operating system, exceptions or a heap. A freestanding image has none of those, so what it can use is small and…
- [Chapter 21: Example — x86_64 Kernel Stub](https://code-craft.ai/references/loup/freestanding/ch21-example-x86_64-kernel-stub.md): This chapter puts the previous ones together in one small, complete kernel for x86_64. It boots under qemu-system-x86_64 -kernel, switches the CPU from 32-bit protected mode to 64-bit long mode,…
- [Chapter 22: Testing and Deploying Firmware](https://code-craft.ai/references/loup/freestanding/ch22-testing-and-deploying-firmware.md): A freestanding program has no test runner underneath it and no exceptions to report a failed assertion. Testing it takes several layers, each catching what the others cannot:
- [Chapter 23: Memory Safety and Kernel Development Patterns](https://code-craft.ai/references/loup/freestanding/ch23-memory-safety-and-kernel-patterns.md): A kernel has memory-safety problems an application never sees. There is no allocator underneath it, devices write into its memory on their own schedule, interrupt handlers run in the middle of…
- [Chapter 24: synchronized Classes and Lock Ordering](https://code-craft.ai/references/loup/freestanding/ch24-synchronized-and-lock-ordering.md): Chapter 19 built spin locks by hand from atomic intrinsics. They work, but nothing ties the lock to the data it protects, nothing stops code from touching that data without the lock, and nothing…

## Agent skills

- [loup-programmer](https://code-craft.ai/references/skills/loup-programmer/SKILL.md): Writes, reviews, debugs and explains code in the Loup programming language (toolchain 1.25.1). Chooses the execution mode and file extension, applies Loup's syntax, ownership and error-handling rules, and verifies the result with the loup CLI. Use for any task that involves Loup source files (.lpscr, .loup, .lphc, .lpweb, .lpfree), .lppkg manifests, @mode(...) directives, or the loup / loup-bootstrap commands. Install: https://code-craft.ai/references/skills/loup-programmer.zip

## Get Loup

- [Download Loup](https://code-craft.ai/loup/download): Loup Lite, the free public build for education and training (no encryption or decryption functionality, not every module), and how customers get the full release

## Optional

- [Full text of every reference page](https://code-craft.ai/llms-full.txt): the books and skills in one file
- [Loup Commercial License](https://code-craft.ai/loup/license): seat pricing and what needs a seat
- [Products](https://code-craft.ai/products): Code Craft AI's products and services
