Autolith

The Common Lisp agent that rewrites itself and rocks.

A self-modifying terminal programming agent inside a live image it can inspect, edit, break & recover, and shape to fit any use case.

nix run github:lambda-symbolics/autolith
Read the docs

Linux, macOS, FreeBSD, NetBSD, OpenBSD, and Windows. See more.

The whole agent is one Common Lisp image.

Autolith is a self-sufficient runtime that lets agents maintain all sorts of states and tools, from MCP servers, to memories, additional tools, agendas and LSP servers. Some might say it's a monolith.

Common Lisp provides describe, conditions, restarts, CLOS protocols, and source forms at runtime. The agent uses them to inspect and change its own implementation.

File search is powered through the amazing and blazingly fast fff Rust library. Autolith can spawn and maintain persistent Lisp workers for experiments and scripts.

The Autolith rock formation
provider
client
terminal
interface
tool
registry
MCP
connections
conversation
store
persistent
memories
workspace
agenda
mutation
journal
what happens
next

In your repository

Repository work
Effective filesystem, shell, and search tools that let the agent quickly navigate any project. Language servers supply diagnostics, renames, and code actions, and Autolith can connect itself to your projects in other ways.
Unattended jobs
Run Autolith inside your own workflows through its headless mode, which prescribes the input and output schemas and can stream live S-expression events while it works.

In its image

Live Lisp
A runtime it can inspect, test, and extend, with heap-isolated workers for experiments. The bedrock of safe self-modification.
Oversized context
Autolith implements RLM to process large amounts of data effectively
Continuity
Portable conversations, memories, agendas, checkpoints. If Autolith breaks itself, it can recover via its recovery image.

The input prompt is a REPL with syntactic sugar.

The sentence "Hello Autolith! What's your favorite rock?" is read as the Lisp form (prompt :to 'autolith "Hello Autolith! What's your favorite rock?")

Prose, typed at the prompt. Autolith reads it as a call to (prompt). Talk to a specific agent using the :to parameter.

Your messages are just calls to (prompt ...)

You can try it here. This syntax lets you send messages to sub-agents (you will see their responses if they decide to respond).

The reader

Read as a call to (prompt), addressed to the primary agent.

You don't need to know Lisp.

Plain text works, and most people never need to type a Lisp form.

But... If you want to learn it, AL is a good place to start: the input is a Lisp REPL, the agent sees what you typed, its result, and any condition (AKA error) it produced, so you can ask it why it failed and let it help you out.

Prompts can be computed.

Text, commands, tools, and Common Lisp are the same text input. A Lisp form runs in the Autolith image and the agent sees its result. Read a prompt off disk, template it, or, I dunno, generate it from the program you are debugging.

;; a computed prompt
(prompt (read-file "review-notes.org"))

;; a tool, called by hand
(resource.read :uri "workspace:.")

;; introspection, right there
(describe 'application)

And you can steer any child in the tree.

Autolith keeps working while its children run. Talk to one to correct it while it's doing something. Its next text reply comes back to your terminal.

(prompt :to 'test-review
        "Run the focused tests and
         report only failures.")

Update the running agent without restarting it.

Autolith replaces complete functions, methods, classes, macros, conditions, and global settings in its image at runtime. The change is instantly live.

If it outlives the process depends on you and Autolith. You can have changes that are persisted and changes that aren't.

Figure 2. Autolith mutations.

self.redefine compiles and installs a complete definition into the image and appends it to the journal.

self.exercise runs asserts against the pending change to let Autolith verify it did not screw up the change.

self.diff lets Autolith review all pending changes.

self.discard is used to discard the live changes that did not really work out, or that you decided you don't want anymore.

self.commit turns a pending change into an automatic commit in Autolith's internal git repo. That way, your modified image can be rebuilt when needed.

After an update, overrides whose tracked source has moved on are skipped instead of silently replacing new code, and (fix-skipped-definitions) asks Autolith to rebuild them against the current source.

Figure 3. When Autolith crashes.

If Autolith breaks:

If you or Autolith somehow manage to crash the process, it will write a crash capsule, boot a separately built pristine image, and select a known-working generation from it.

The conversation you had going on will come back and Autolith will immediately look into what caused the crash in read-only mode.

You can then decide, if there's anything to fix, if and how you want to fix it.

Note: Most ordinary conditions (AKA errors) do not crash Autolith, but instead start its Lisp debugger and let you and the model decide how to handle the error.

Figure 1. RLM paritioning

Work beyond the context window.

Every model has a hard limit on how much it can read at once.

Autolith can work around it effectively. If you ask it to process a log, a codebase, or a folder of documents far too big to fit, it will use recursive inference tools to partition and process all the data, so it can answer questions about the whole thing.

The approach comes from Recursive Language Models, by Alex L. Zhang, Tim Kraska, and Omar Khattab. Autolith is a compromise between a traditional agent and Prime Agent (which also rocks, by the way!), because it is still mostly a normal agent that just has RLM tools available.

Here's how it broadly works: It writes small programs to search and slice the material, sends the parts that matter to itself in separate side conversations, and keeps just those answers. It's like an avalanche.

Autolith will set a ceiling on calls and tokens before RLM starts, so a large question does not blow an insane amount of tokens. If a run reaches its ceiling, it returns what it finished and a context to continue from.

Budget
32 calls, 400 000 tokens, depth 2
Corpus
3.1 MB, 121 src/*.lisp files
Root conversation
59.6 K tokens in, 915 out
Answer
83 condition classes across 14 subsystems, each with its file
Trace
inference:s2Wb1o2, which the agent access like any other resource.

Example recorded sessions.

  :::.      :::        AUTOLITH v0.35.0
  ;;`;;     ;;;        ─────────────────────────────────
 ,[[ '[[,   [[[        model      gpt-5.6-terra
c$$$cc$$$c  $$'        workspace  /root/common-lisp/frob/
 888   888,o88oo,.__
 YMM   ""` """"YUMMM
Download recording
Asked
List every condition class in a 3.1 MB concatenation of 121 source files, grouped by subsystem, with the defining file. Budget of 32 calls, 400 000 tokens, depth 2. Do not read or search the file directly.
Cost
59.6 K tokens in the root conversation. The corpus never enters a prompt.
Answer
All 83 condition classes across 14 subsystems, each with its defining file.

Attach to a session from another terminal.

Every Autolith instance has an authenticated local endpoint on loopback, keyed by the session ID. You can (detach), and Autolith will continue your work in the background.

From any other terminal on the machine

$ autolith localgroup status
$ autolith localgroup tell   SESSION "use the staging config"
$ autolith localgroup attach SESSION --read-only
$ autolith localgroup attach SESSION --take-over
$ autolith localgroup pause  SESSION
$ autolith localgroup kill   SESSION

These are basic monitoring tools you can use to watch running Autolith sessions and instruct them. Autolith also has an opt-in management REPL into the running image, authenticated on every connection, which lets you do anything you like to the agent, with no limitations.

Editors can drive the same sessions over the Agent Client Protocol: point your editor at autolith acp and it gets streamed answers, reasoning, tool activity, approvals, steering, durable follow-ups, and job control.

Calling it a rock formation was considered, but none sounded that well, so old Windows NT terminology it is.

You can also move your work between machines.

$ autolith data export project.sexp --workspace ~/code/project
$ autolith data import project.sexp --workspace ~/src/project

The result is an S-expression archive containing conversations, memories, agendas, plans, papercuts, and other session assets. You will not be surprised by something miraculously missing on import

Even self-modified cores can be rebuilt on another machine by running their replay script.

  • Linux x86_64
  • Linux aarch64
  • musl static
  • macOS x86_64
  • macOS arm64
  • FreeBSD
  • NetBSD
  • OpenBSD
  • Windows x86_64

Give it a mission, not just a prompt.

Long-running work gets acceptance criteria you write, verification gates the harness runs, and hard limits on turns, tokens, and wall-clock time. The model can ask to be verified. Only the evidence can say yes.

Criteria
You write the acceptance criteria. The model cannot weaken them, and a criterion without a gate needs your explicit evidence before the mission can pass.
Gates
Command, artifact, and Lisp gates run in order, each with its own timeout and attempt limit. Deterministic gates fingerprint their input files, so an unchanged pass stays proven and an unchanged failure is not run again.
Budgets
One allowance covers the primary agent, its children, compaction, and recursive inference. Every request reserves its output ceiling before it starts, so parallel children cannot overspend, and prompt-cache reads are not counted.
Reviews
Attach an independent reviewer with its own snapshot, its own allowance, and no tools. Pending findings block acceptance, and an unchanged snapshot is never reviewed twice.
Schedules
Wake a mission at a time, on an interval, or on an external event. Due work enters the ordinary command queue under the same budgets.
Durability
Gate attempts, fingerprints, evidence, and spend restore with the conversation and survive compaction, independently of anything the model summarized.

For lighter work, (goal "…") sets an objective without the ceremony. Start a mission with (mission "start …") and watch it with (mission "status").

(mission "status")

Deliver the accepted build

turns26 / 40
tokens61,200 / 100,000
wall clock41 / 60 min
  1. buildcommand
  2. testslisp, attempt 2 of 3
  3. bundleartifact sha256
  4. reviewyour evidence

spentreserved

verified

Delegate into isolated worktrees.

Children edit and test in their own Git checkouts, report back in one standard shape, and wake the primary turn when they finish. Nobody sits there polling.

Figure 4. Parallel children, deliberate integration.

Give task.run an isolation object and the child works in a detached worktree at an exact baseline. It returns an engineering artifact: a patch or commit range with the paths it touched, the checks it ran, the evidence, open issues, and integration notes.

The parent checks each artifact against the target and applies them in the order it chooses, resolving conflicts on purpose instead of by accident.

After a restart, retained work is sorted into live, completed, safe to restart, or needing a decision. Autolith asks before it repeats anything with side effects.

(tasks)
A live inventory of owned work with lineage, timing, usage, and artifacts. Read a child's transcript, send it a correction, or cancel it.
Engineering role
The bundled engineering role returns the artifact contract, and your own roles can extend it with extra required fields.
Semantic edits
lsp.semantic turns a language server's rename, code action, or file move into one retained proposal. Applying it checks every file's revision and rolls the whole set back if anything fails.
Structural rewrites
Optional ast-grep queries and rewrites, previewed first and published under the same stale-revision checks as every other edit.
Peer messages
Grant one agent a durable, one-way channel to another, even across sessions. Messages are coordination data and never carry extra authority.
Debugger
Optional Debug Adapter Protocol sessions: launch or attach, set breakpoints, step, and inspect variables, each behind exact approval.

Spend tokens on the work, not the bookkeeping.

Most agent spend goes on round trips that resend the whole context. Autolith cuts out the ones that do not move the work forward.

Waiting on a background job
polling5 requests
Autolith1 request

Every block is a provider request that resends the conversation. A finished job wakes the turn instead of being polled for.

One noisy command, in context
inline, 0.5065,536 characters
preview now6,000 bytes, the rest in a shell log

The complete output stays in a retained log that the model can page or search later, without running the command again.

Jobs wake the agent
Shell, Lisp, RLM, skill, and task work that outlives a ten-second grace period is handed off, not rerun. The finished job continues the turn with a bounded notice, and completions that land together share one turn.
Logs, not dumps
Every command keeps its full output behind a shell-log: reference. The model sees a 6,000-byte preview weighted toward the tail, where the errors are, and pages or greps the rest on demand.
Many steps, one call
lisp.eval runs a sequence of forms, and with host tools a Lisp program can call agent tools and branch on their results inside one evaluation. Executable skills turn repeated procedures into tested code.
One edit, many files
A language-server rename or code action arrives as one proposal instead of a file-by-file edit loop, and it lands atomically or not at all.
Compaction keeps the work
Unfinished tool calls, running jobs, and steering that arrives mid-summary carry across compaction. The complete history stays searchable through conversation: resources, so old details are fetched instead of carried.
Partial results are kept
When recursive inference reaches its budget it returns what it finished and a context to resume from, so work already paid for is not thrown away.
Advice only when relevant
Context rules attach guidance only for matching paths, languages, tools, or roles, as ephemeral notes that erode instead of riding along on every request.
Spend guards
Retries after streamed output are capped, exhausted subscription quotas fail at once, runaway repeated tool calls are stopped, and loaded tool definitions are replayed intact so the prompt cache keeps growing.

Sandboxing and security.

Executed commands go through authorization checks before execution, just like in any solid agent.

We have a sandbox with process isolation and scoped filesystem access to limit accidental damage.

Sandbox
cl-exec-sandbox is our platform abstraction for sandboxing, which works on Linux, Mac and Windows.

The default policy is to give commands no network, a read-only host access, allow writing in the workspace and temp directories, forbid changing repo metadata, and a sixty seconds timeout.

On Linux it adds process, user, IPC, UTS, and network namespaces, no_new_privs, and seccomp.
Classification
In automatic mode one RLM inference frame judges each command under a two-call, eight-thousand-token budget and answers: sandboxed, full access, or denied.
Approvals
You can select different permission levels: approve once, run sandboxed, full access, or denied. Headless jobs deny anything that would otherwise open the picker, so make sure to select the correct default setting.
Credentials
In a number of places, Autolith will censor your credentials for MCPs, OAuth, tokens and similar.
Bounds
Most things have defined boundaries to prevent runaway doom loops and reckless spending. These things are of course configurable.
Revision gating
We use careful hashline-based editing (similar to Pi agent), which ensures the agent correctly selects places to edit and does not clobber over forgotten changes.
Immutable mode
--immutable prevents Autolith from self-modifying when you need maximum predictability and security.

You can use it when you are integrating Autolith into another program as a worker, or you just don't want self-modification.

The levels of knowledge

Autolith has several tools and places where it can store information, each with a different purpose and functionality to remind the agent of their existence.

Conversations

Append-only portable S-expressions-based format which serves as a ledger of everything you said, AL said, and everything that happened, including errors and crashes.

Memories

Scoped memories where general facts to be remembered are stored.

Agenda

Long term tracking and planning. Imagine it being like a limited-size Jira / Kanban board.

Plan

Short-term temporary planning, if you've ever used Codex or Claude Code, you know what this is

Git image commits

Complete replay scripts for durable definitions and settings.

Generations

We stole this from Nix. A generation contains a saved image version (core), and everything else needed to restore Autolith to a previous state.

Worker images

AL can have long-running child Lisp images in which it can develop and triage small programs and experiments. These can be checkpointerd and roll-backed too.

Stores are either append-only or transactional. Shared-state storage places are serialized across processes, meaning that 2+ AL instances can work in the workspace at the same time.

Change anything about AL from the prompt.

Configuration is files and Lisp forms, and the running agent can help you with both.

Skills
We support standard SKILL.md with frontmatter, or native SKILL.sexp format, which can also load modifications into the AL image on load (so audit your skills before use).

Project skills take precedence over user's skills, if there's a conflict. Skills in the shared ~/.agents/skills directory are found too, and executable skills run tested Lisp workflows in a disposable worker.
MCP servers
Both stdio and streamable HTTP are supported, with a per-server approval policy. A project can have its own addition MCP servers defined and loaded if marked as trusted in directory-scopes.sexp.
Child roles
Seven predefined child roles are available: scout, designer, reviewer, librarian, task, engineering, sonic (GOTTA GO FAST). You can add your own to .autolith/agents/ and define tools, models, and efforts the role is assigned by default.
Providers
Ten providers are built in, including GitHub Copilot subscriptions, and other OpenAI-compatible providers are trivial to add.
init.lisp
Your entrypoint to scripts being loaded on launch to change any settings to your preferences, or modify Autolith in any way you like.
Request context
define-context-contributor attaches what we call ephemeral notes to provider requests. You can use this to give the model temporary additional context to steer it better. They will quickly erode in a way that does not bust your whole cache. Context rules attach notes only when a path, language, tool, or role matches.
Commands
define-application-command is a simple macro that lets you add your own commands that affect the harness the agent, or well, anything else in your system. The result will be a plain Common Lisp function with some metadata, so you can easily test it by hand and ask AL to help you debug it. Adding commands is cheap, you can litter them like small pebbles on the beach.
Instructions
AGENTS.md, no surprises here. Autolith can also create AUTOLITH.org, where it can track information that's specific to it and should not confuse other agents you might use.
Settings
Every knob is a typed, documented setting. (settings) opens a grouped page where you change values in place, and (setf (config :model) ...) does the same from Lisp.
Help
(help) gives a compact overview by topic, and (help "resource.edit") explains any command, operation, or tool from its live schema.

Install it.

nix run github:lambda-symbolics/autolith

The high testosterone, high estrogen way to install Autolith.

Then sign in to a provider

autolith auth anthropic autolith auth chatgpt autolith auth copilot autolith auth fireworks autolith auth gemini autolith auth grok autolith auth mistral autolith auth nous autolith auth opencode autolith auth openrouter

Once you authenticate, it's time to have fun. Run autolith to get started.

Autolith 5th grade report card

Licence
ISC
Linux
x86_64 and aarch64, glibc and static musl
macOS
x86_64 and arm64
BSD
FreeBSD, NetBSD, OpenBSD on x86_64
Windows
x86_64
Updates
(update) inside AL, autolith update from the CLI

Yes, piping a URL into a shell is evil. Read the installer first, it's not so bad.

Nix is the preferred installation method on worthy operating systems.

Friends of Lambda Symbolics

Chakany Systems builds tools for private communication and researches human behavior and health.

They frequently contribute to Autolith.