Skip to content
lexlapaxPublic

About

Durable coding-agent loops, built on the BEAM/ elixir

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

Loopex

This project has been superceded by https://github.com/lexlapax/ipse

The learnings from building Loopex are being applied to ipse.

The loop, in Elixir.

Clarity before mechanism. Loopex explains purpose, constraints, and observable behavior before implementation machinery. Every important commitment remains traceable to precise technical contracts and evidence. Nothing essential depends on hidden context.

An agent is a loop around an LLM. Loopex makes that loop an OTP-native, embeddable runtime for durable coding-agent sessions and controlled effects: a small, provider-neutral model loop with truthful recovery, versioned client contracts and location-transparent tool execution. Governed live extensions remain future scope in the M10 draft. It is a minimal terminal coding harness on its own, and small enough to disappear inside a larger host.

The architectural brief is José Valim's observation about Elixir as a coding harness substrate, taken literally: "You don't need an external framework for this. The runtime is the framework." Loopex does not hide OTP behind an agent framework, workflow DSL, or macro layer. Sessions are supervised processes; durable truth is an append-only journal; clients attach and detach while the session lives; a session "brain" can coordinate local or remote "hands"; trusted code can evolve while session state stays in place.

Where Things Stand

Revision status: Closed milestone product baseline; active milestone M8 is open; no next candidate is recorded.

Canonical milestone status and plan records

The M7 coding-agent proof closed on 2026-10-13 and is the source release v0.4.0. It adds native chat from an explicit profile, settled configuration and compaction, and model-question responders for embedding. It also adds read-only helper roles that may run on their own provider, a separate thinking-off summarizer, and the coordinated loopex.experimental/3 and /4 wire generations. The closure evidence records its runs and reviews. The M8 installed durable operator plan is Open for planning; later successors remain drafts.

What Loopex Provides

The latest source release is v0.4.0; its source VERSION still reads 0.3.0, because M7 did not advance it. Loopex is a working single-machine coding harness and the runtime underneath it. Build it from the tagged source on macOS or Linux using the operator getting-started guide. There is no published binary, package or installer yet; the client protocol remains experimental. CHANGELOG.md records how each capability arrived.

  • A durable session runtime you can embed. An Elixir host starts an explicit runtime and owns its sessions. Each session has one serial owner and an append-only journal in a local store. Intent is recorded before any effect and facts before any publication, so a session survives a crash of its process and replays on restart. A lost effect is reported as outcome_unknown and reconciled, never blindly retried. See the embedding guide.
  • A coding loop at the terminal. loopex run runs a prompt as a durable, multi-turn session and streams the answer as it is produced. The model sees the whole conversation and the real output of every tool it ran. Four coding tools (read, write, edit, bash) act on a real workspace under a host policy that can allow or refuse each call. Earlier sessions can be listed and resumed. loopex chat --config FILE holds a conversation from an explicit JSON profile, with settled /configure, compaction, model questions and read-only helper roles. See coding sessions.
  • Governed model context. A repository's instruction files and pinned Git skills reach the model only after an explicit admission decision. They are budgeted, provenance-typed data and never a grant of authority. Downloaded skill files carry no permissions.
  • Two provider profiles. Model calls go through one provider-neutral boundary. Durable sessions use a private companion process for the selected credential. Ephemeral sessions call the provider in the host VM; during a call, its HTTP/TLS state and host-installed observers can see that value. Loopex does not inject the selected key into its journal or diagnostics, but a host-authorized tool can disclose ambient credentials through ordinary tool results. See ADR 0039 for this profile's trust and cleanup limits.
  • Honest tool execution. Each dispatched tool job is attempt- and fence-bound; its outcome is recorded as a receipt or as unresolved. Durable sessions retain that truth for recovery; ephemeral sessions order it in memory. The trusted local executor supervises each command's process group and reports exactly what it could confirm.
  • Durable questions and bounded artifacts. A host policy, such as the app server's ask stance, can answer a tool request with a question instead of a verdict. The question stays as durable session state, so it can be answered after the asking process is gone. Clients read tool output back in verified, bounded chunks.
  • Session protocols and an independent client. A foreground app server speaks the experimental session protocol loopex.experimental/3 over standard input and output, and the daemon speaks loopex.experimental/4 over its socket. A dependency-free Node client drives sessions end to end over both. See app server operations.
  • A local daemon that outlives its clients. loopex daemon owns every session for one state root and keeps them running while no client is connected. Several client processes reach it over a same-user Unix socket. One client drives a session under a controller lease while others observe, and a client can explicitly take over when the driver is lost. An orderly stop drains work and reports what it stopped; a failure ends with a named exit status. See the daemon guide.
  • Observability without source changes. A host can start a runtime-scoped trace session and read telemetry spans that are bounded and redacted. See observability.

Where to start: the operator getting-started guide takes you from a checkout to a first session. The developer getting-started guide covers building on Loopex, and the development process covers contributing to it.

After building from source, you can use the same loop three ways. For an embedded local call, save this as ephemeral.exs in the checkout and run mix run ephemeral.exs while Ollama serves llama3.2:

defmodule ReadOnlyPolicy do
	@behaviour Loopex.Policy
	@impl Loopex.Policy
	def decide(%{effect_class: "read_only"}), do: {:allow, nil}
	def decide(_request), do: {:deny, :effect_class_not_permitted}
end

{:ok, result} =
	LoopexComposition.Ephemeral.run("List this workspace.",
		policy: ReadOnlyPolicy,
		model: "ollama:llama3.2",
		tools: :read_only,
		cwd: File.cwd!()
	)

IO.puts(result.text)

The standalone command needs no state root for the same local model. A durable session uses a state root and the provider companion built with the command:

loopex ask --policy shell-allowlist --model ollama:llama3.2 \
  --tools read-only "List this workspace."
LOOPEX_HOME="$HOME/.loopex" loopex run --policy shell-allowlist "Summarise this repository."

The durable command also needs LOOPEX_PROVIDER_API_KEY. The operator guide shows how to supply it without putting it in command history.

The roadmap is non-normative capability guidance; CHANGELOG.md records what changed.

The founding Concept vision and its Technical depth are one decision-bearing authority: boundaries, invariants, protocol planes, trust model, and delivery shape are settled there. The documentation index is the approachable route into the rest of the project.

Why It Exists

Minimal coding harnesses have proven that a small loop with a rich extension seam beats a feature-heavy agent platform. Product hosts have proven that identity, policy, channels, memory, and delivery are real concerns — and that they should not be prerequisites for improving the loop. Elixir supplies the missing middle: the BEAM already has the primitives those systems rebuild by hand — actors, supervision, live code evolution, distribution — and Loopex adds exactly what the runtime does not supply: stable identities, transactions, receipts, fencing, reconciliation, protocol versions, and trust boundaries.

The rules it holds itself to:

  • One serial owner per session; durable intent before effects; durable facts before publication.
  • Truthful failure: a lost effect is outcome_unknown, never a blind retry.
  • Plain data across every boundary; metadata never grants authority.
  • Mechanism in Loopex, governance in the host.
  • Generated code is a candidate, not authority.
  • Everything entering model context is provenance-typed, budgeted data.
  • Every core concept pays rent: if it can be an extension, adapter, or host concern, it stays out of the kernel.
  • The smallest sufficient system wins; every abstraction names the concrete examples or implementations it serves.

What It Is — and Is Not

The same runtime should support a reference CLI, an IDE agent over the Agent Client Protocol, CI/headless harnesses, a security-rich personal assistant host, a team coding service, and remote executor fleets — all over one semantic contract.

It is deliberately not a generic agent framework, a workflow engine, an identity or policy product, a memory product or RAG framework, a social-channel hub, a marketplace, or a sandbox-by-supervision-tree. Those belong to hosts, adapters, and extensions around the core. Memory, retrieval, and prompt systems plug in through one governed context pipeline in the vision, with its exact contract in the technical companion, without entering the kernel.

The Shape

  • Four layers: a versioned protocol, a pure session core, an OTP session runtime, and replaceable edges (model adapters, stores, executors, transports, clients). The core application uses the Elixir/Erlang standard runtime and declares only the external :telemetry event dispatcher.
  • Durable sessions: a private recovery journal plus a small stable public-event vocabulary, snapshots, and transient progress — distinct planes with distinct guarantees. Restart replays; clients reconnect from cursors.
  • Honest effects: model calls and tool jobs carry attempts, epochs, fencing, receipts, and reconciliation. The durable profile retains their truth across restarts; the ephemeral profile does not.
  • Brains and hands: tool execution is placement-transparent — local process, isolated container/microVM, or trusted remote worker — behind one job/receipt protocol. Distribution connects trusted gateways only; the sandbox is the OS boundary, never the BEAM.
  • Future governed live extensions: the M10 draft targets quiescent trusted OTP generations with tested migration and exact rollback. No extension manifest or lifecycle API ships in the current source.
  • A seven-tool coding surface (read write edit bash grep find ls) inside a measured system-class budget: 1,000 tokens by default and configurable per profile (the M7 validation profiles use 1,500 for chat coding and 2,000 for a helper parent). The coding and read-only presets select four tools each, and the selected definitions are measured with the request before dispatch. Chat adds the model-question tool to a nonempty profile and, when helpers are enabled, the task tool.

Honest Posture

Loopex is a personal project, developed in the open, by the same author as Allbert Assist — whose operating lessons shaped this design and one of whose future roles may be hosting Loopex. It is an independent, clean-room implementation: design lessons are credited in the vision's sources; no code is ported from any harness.

What the open development does not include:

  • No support promises. Issues are read when there is time; no reply, fix, or timeline is owed.
  • The roadmap follows the maintainer's use, not a backlog. Requests are interesting to read but create no obligations.
  • No stability promises in 0.x. Current surfaces are unfrozen. M6's and M7's embedding and command contracts and the wire protocol are experimental; breaking an experimental API in a minor release carries an explicit migration note. No surface claims release-candidate or stable status.

None of that is discouragement; it is the accurate shape of the project. The code is Apache-2.0, so the permission to use, fork, and embed it is real regardless of what can be promised about support.

How Work Is Checked

Two commands, both run from the repository root and described in DEVELOPMENT.md:

bash scripts/check.sh            # the fast check, credential-free
bash scripts/check-release.sh --attempts-index FILE ...   # see DEVELOPMENT.md

scripts/check.sh runs warning-free compilation, formatting, the repository structure checks, documentation ordering, the M7 evidence validator, the release-tooling fixtures, the dependency budget, one version across the applications, and the credential-free suite with one application per VM. It runs once per integration candidate. scripts/check-release.sh is the slow one: the real-provider workflows, the independent Node client, the fresh-source archive build, the long-duration bound proofs and the M7 lanes recorded in a retained attempts index; it needs provider credentials and the pinned Node, and runs once before closure. An unchanged-source release reuses that evidence and runs only its pre-tag administrative-SHA proofs. DEVELOPMENT.md shows a history-safe way to load the credential.

Hosted CI — .github/workflows/agent-bootstrap.yml — runs bash scripts/check.sh --select on every push to main and every pull request, on the current toolchain pair. It is a replaceable runner of the repository's own command, not a second definition of the check. Nothing merges to main without a green candidate check, either in hosted CI or in a clean local run whose complete output and exact SHA are retained, and an independent review of its diff.

The verification guide and its technical companion are the rule book: three stages, how a changed boundary selects its checks, and what keeps them honest. The milestone guide and its technical companion are how a milestone is planned, run and closed. There are no per-milestone gate runners; the gate files under docs/plans/ are historical records.

Roadmap

The roadmap gives the candidate capability sequence and why the ordering matters. Its technical companion holds the exact prerequisite and evidence projection. Each accepted milestone maps its bounded outcomes back to those capabilities.

The roadmap is guidance. The commitment is an accepted plan.

Start Here

License

Loopex is licensed under the Apache License, Version 2.0. Copyright 2026 Sandeep Puri.

Apache-2.0 matches the license of the stack Loopex is built on — Elixir and Erlang/OTP are both Apache-2.0 — and gives you an explicit patent grant alongside explicit "AS IS", no-warranty terms that match the no-promises posture above. If you contribute, your contribution is licensed under the same terms — that is Apache-2.0 §5, and there is no separate CLA.

About

Durable coding-agent loops, built on the BEAM/ elixir

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages