Affordance documentation
Affordance renders an app written in TSX to the token ids a model reads, and runs the loop around it. These pages are built from the Markdown files in the repository; each page links to its source.
cargo install affordance
affordance init my-agent && cd my-agent
affordance runStart here
Getting startedYou need Rust 1.89 or later. It runs on Linux and macOS; see platform evidence. Python, Node and model weights are not needed.3 minA first agentAn agent that reads its task, may run shell commands on this machine, and stops when it answers. app.tsx is the whole app; affordance.yaml binds it to a model server and a machine. …1 minExamplesAn Affordance app is a folder with an app.tsx and an affordance.yaml, run with affordance run in that folder. You do not write Rust to build one.1 minWhy Affordance is shaped like a browserThis document explains where the line between the engine and an app is, and why. It is for anyone extending Affordance, person or model, who wants to predict the answer to "where does this …6 min
Writing apps
The view languageViews are TypeScript/JSX files (.tsx) implementing the JavaScript subset specified here. Intentional differences are in §7.3; unsupported features are in §7.4. Everything here is implemented …41 minApp, turn strategy, template appContract authority: public contracts, language and harness.5 minNative apps in model chat formatsContract authority: public contracts, language and harness.4 minReading model repliesContract authority: public contracts, language and harness.4 min
Running agents
The agent runtimeContract authority: public contracts, language and harness.27 minConfiguring model bindingsThe configuration contract is in HARNESS.md §6. A binding combines a tokenizer and one stock client. model names the default binding; models adds names selected by agents[].model or <Mount …15 minFetch, HTTP bindings and MCPContract authority: public contracts, language and harness.7 minThe harness contractAffordance has two parts. The language (spec/LANGUAGE.md) turns state into exact token ids for a model, plus the actions it offers. The harness (this document) runs apps the way a browser …37 min
Example apps
Context policies exampleA small fleet on the instance runtime. Each agent answers a question by searching a document corpus through bash, on its own machine, under a context policy:2 minPermanent memory (after OptMem)An agent whose memory outlives its sessions, after VictorTaelin's OptMem, built as an instance tree.2 minA memory longer than the context, for any OpenAI clientA chat model behind an OpenAI-compatible endpoint (affordance serve) that keeps each conversation itself, in its journal. A client may send its whole history or only its newest message; …1 minRecursive Language ModelA Recursive Language Model, after Prime Intellect's RLM, built as an instance tree. The root model never reads the input. The input sits in a persistent Python REPL on the agent's machine, …2 min
Embedding and internals
Harness guide: driving an affordance app from RustContract authority: public contracts, language and harness.11 minArchitectureAffordance has one engine, implemented in Rust. Applications and reusable application policies are written in the TSX subset described in LANGUAGE.md. CONTRACTS.md maps the public boundaries …2 minPublic contracts and ownershipThis is the map of Affordance's shipped contracts. LANGUAGE.md is normative for source evaluation and document layout; HARNESS.md is normative for instance execution and recovery. The …4 minVerification (draft)Some properties of the engine are proved, not only tested. This page lists each one: the claim in a sentence or two, the exact statement the tool checked, what the proof assumes, and what it …8 minDependency securityThe release gate runs python3 tools/check-security.py, using cargo-audit and the RustSec database. Install the auditor with cargo install cargo-audit --version 0.22.2 --locked. New …2 min