{"slug": "truss-a-programming-language-designed-for-agent-written-software", "title": "Truss: A programming language designed for agent-written software", "summary": "Bret Taylor published a prototype of Truss, a programming language designed for code written by AI agents rather than humans, which shifts the design goal from authoring convenience to human verification and correctness. Truss organizes packages around contracts that specify data structures, functions and formally verified behaviors, with providers such as HashMap and SortedMap required to supply a proof file (package.proof) demonstrating conformance, so the compiler can validate a provider against a contract an order of magnitude faster than constructing the proof itself. Taylor, who described Truss as \"just a prototype,\" said he hopes to start a conversation about platforms needed for provably correct, verifiably secure and fast agent-written software.", "body_md": "Truss\n\nTruss is a programming language optimized for agent-written software. Truss aims to make software more reliable, secure, and performant by embracing the unique strengths of AI agents.\n\nTraditional programming languages were designed for the ergonomics of human authors, effectively optimizing for the convenience of writing code. Truss, in contrast, assumes code is no longer written by hand, but instead written by AI agents. This fundamental assumption changes most of the design considerations for Truss relative to traditional programming languages:\n\n| Traditional programming language | Truss | \n|---|---|\n| Optimize for human editing | Optimize for human verification | \n| Optimize for convenience | Optimize for correctness | \n| Minimize human authoring time | Spend tokens at authoring time to improve enduring correctness and performance | \n\nRather than optimizing for authoring convenience, Truss requires quite a bit of reasoning at authoring time to verify a program's correctness and performance. That tradeoff is sensible for agent-written software because it is not a burden to the software engineer and the one-time token spend can produce software with enduring robustness.\n\nPopular programming languages like Rust are a small step in this direction, providing compile-time memory safety — making Rust code a bit harder to write for humans, but a fantastic language target for AI. Truss takes this idea a few steps further, formally verifying behaviors well beyond memory management.\n\nI ([Bret Taylor](https://backchannel.org/)) think we will probably rewrite most software written before AI because that software is imperfect, insecure, and slow. I would like to have software that is provably correct, verifiably secure, and incredibly fast, and I would like to be able to use agents to produce software of unparalleled scale and complexity that has those qualities.\n\nTruss is just a prototype, but I was hoping to start a conversation about the platforms we need to design to achieve that vision.\n\nThe atomic unit of a Truss **package** is a contract. A **contract** specifies data structures and functions along with their formally verified behaviors, including what they return, what memory they can access, and what state they can change.\n\n**Providers** implement contracts. For example, a `Map` contract could have multiple providers, a `HashMap` and a `SortedMap`. Each provider must *provably* satisfy all the claims in the contract, and each provider provides evidence of their conformance in the form of a **proof** alongside the implementation source code.\n\n```\nlibrary/collections/map/\n  map.truss             # The Map contract\n  package.truss         # Map dependencies\n  inline/\n    inline_map.truss    # InlineMap implementation of Map\n    package.truss       # InlineMap dependencies\n    package.proof       # Evidence that InlineMap satisfies Map\n  sorted/\n    sorted_map.truss    # SortedMap implementation of Map\n    package.truss       # SortedMap dependencies\n    package.proof       # Evidence that SortedMap satisfies Map\n```\n\nWhen your program uses `Map`, the Truss compiler will generate a proof of its correctness by relying on the claims in the `Map` contract without having to independently verify each provider.\n\nWhen you bind `Map` to a provider like `InlineMap`, Truss uses the supplied evidence in `package.proof` to independently verify its conformance, a simple validation process that can be an order of magnitude faster than constructing the proof itself.\n\nThis approach enables formal verification to scale with large code bases, pushing the majority of the work of formal verification to package authors; when you publish a package, you spend as many tokens generating proofs as you do writing the code, and the programs depending on your package don’t need to recreate your efforts.\n\nTruss brings verification all the way to code generation. A provider proves that it implements the contract. The compiler proves that its translation preserves the body’s observable behavior. A separate-compilation rule proves that the guarantee survives linking against conforming implementations.\n\nWe’re going to make a package that replaces one element in a slice of `UInt64` words and returns the value it overwrote.\n\n```\nreplace-element/\n  package.truss\n  replace_element.truss\n  inline/\n    package.truss\n    inline_replace_element.truss\n    package.proof\n```\n\nDeclare the contract in `replace_element.truss`. The contract guarantees that the element at `index` is replaced by `value`, and also protects against buffer overflow:\n\n```\ncontract ReplaceElement {\n    function replace(words: &mutable Slice<UInt64>, index: UInt64, value: UInt64) -> UInt64\n        requires index < words.len\n        ensures result == old(words[index])\n            and snapshot(words) == update(old(snapshot(words)), index, value)\n        terminates\n        effects { read(words), write(words) }\n}\n```\n\nDefine the provider in `inline_replace_element.truss`:\n\n```\nimplementation InlineReplaceElement of ReplaceElement {\n    function replace(words: &mutable Slice<UInt64>, index: UInt64, value: UInt64) -> UInt64 {\n        let previous = words[index]\n        words[index] = value\n        previous\n    }\n}\n```\n\nNow that we’ve defined an implementation, we can generate a proof that it satisfies the `ReplaceElement` contract. The result of that proof lives side-by-side with the implementation so that clients of this package don’t need to reproduce the effort to prove conformance to the contract.\n\nTo generate the proof, we run this command in the provider directory, which emits the `package.proof` file:\n\n```\ntruss proof update\n```\n\nTo use the package in a program, you create a dependency on `ReplaceElement` and bind it to the provider:\n\n```\npackage \"hello-world\" {\n    requires ReplaceElement from \"replace-element\" version \"1.0.0\"\n    bind ReplaceElement to provider \"replace-element/inline\" version \"1.0.0\"\n}\n```\n\nBuild and run your first program in the [getting-started chapter](https://github.com/finiteloop/truss/blob/main/docs/language/01-getting-started.md).\n\nIf you want to get a sense of what Truss contracts can guarantee, take a look at the examples in the included standard library:\n\n1. [**Sort**](https://github.com/finiteloop/truss/blob/main/library/collections/sort/README.md) — Sort a table by one column and every key keeps its original payload, even when keys repeat.\n2. [**SHA-256**](https://github.com/finiteloop/truss/blob/main/library/crypto/sha256/README.md) — The streaming contract proves that the digest covers exactly the bytes accepted, in order, however you split them across calls.\n3. [**HTTP response framing**](https://github.com/finiteloop/truss/blob/main/library/network/http-client/README.md) — The parser finds exactly where the headers end even when the final blank line is split across reads. The bytes that follow are still available to the body reader.\n4. [**ZIP extraction**](https://github.com/finiteloop/truss/blob/main/library/archive/zip/extract/README.md) — If extraction fails halfway through, the reported file and byte counts cover exactly the prefix whose publication was confirmed.\n5. [**JSON strings**](https://github.com/finiteloop/truss/blob/main/library/encoding/json/README.md) — The contract proves which Unicode character an escape sequence represents and exactly where the next character begins, including when two escapes encode a single character.\n6. [**Socket readiness**](https://github.com/finiteloop/truss/blob/main/library/network/poll/README.md) — A delayed event for a closed connection cannot be accepted for a new connection that reuses the same slot.\n7. [**CRC-32**](https://github.com/finiteloop/truss/blob/main/library/hash/crc32/README.md) — A proof using the shipping checksum loop shows that any split of the same bytes, including empty chunks, gives the same checksum as one pass.\n8. [**Owned byte buffers**](https://github.com/finiteloop/truss/blob/main/library/memory/owned-buffer/README.md) — A successful append keeps every original byte and adds exactly the bytes supplied. If the append fails, the caller gets back the original allocation and contents.\n\n[Install Truss from source](https://github.com/finiteloop/truss/blob/main/docs/language/01-getting-started.md#install-from-source) to write and run packages. For compiler development, see [Build the toolchain](https://github.com/finiteloop/truss/blob/main/CONTRIBUTING.md#build-the-toolchain).\n\nThe `truss` command supports the following operations:\n\n| Command | Description | \n|---|---|\n| `--version` | Print the compiler's release version. | \n| `lock [package] [--target <triple>]` | Resolve declared dependencies and provider variants for the output target and write its package lock. | \n| `fetch --locked [package]` | Restore pinned dependencies from the bundled library, local cache, or recorded Git sources. | \n| `proof update\\|check\\|inspect [package]` | Generate, independently replay, or describe the package’s published evidence. | \n| `check [package]` | Check types, contracts, and proofs at the source level. | \n| `build [package]` | Check the package and emit a native executable for the selected target. | \n| `run [package] [-- <args>...]` | Build for the host and run the executable. Arguments after `--` go to the program. | \n| `test [package]` | Run the pinned cases in `package.tests` . Use`--list` to preview cases,`--case <name>` for exact selection, or`--affected` to compare with the last complete passing run. | \n| `format [--check \\| --stdout] <file.truss>...` | Format Truss source files in place, check their formatting, or print the formatted source of one file. | \n| `verify [package] --image <executable>` | Use the Rust verifier to independently check selected linked code and host bindings in a self-hosted build against the pinned package. | \n\nTruss is a project from [Bret Taylor](https://backchannel.org/).", "url": "https://wpnews.pro/news/truss-a-programming-language-designed-for-agent-written-software", "canonical_source": "https://github.com/finiteloop/truss", "published_at": "2026-12-01 05:03:10+00:00", "updated_at": "2026-12-01 05:15:50.230105+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools", "artificial-intelligence"], "entities": ["Truss", "Bret Taylor", "Rust", "HashMap", "SortedMap", "InlineMap"], "also_reported_by": [], "takeaway": "Truss pushes formal verification to package authors by requiring each provider to ship a package.proof of contract conformance, letting the compiler validate a binding roughly an order of magnitude faster than rebuilding the proof.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/truss-a-programming-language-designed-for-agent-written-software", "markdown": "https://wpnews.pro/news/truss-a-programming-language-designed-for-agent-written-software.md", "text": "https://wpnews.pro/news/truss-a-programming-language-designed-for-agent-written-software.txt", "jsonld": "https://wpnews.pro/news/truss-a-programming-language-designed-for-agent-written-software.jsonld"}}