Lambda Symbolics

Emacs and sly

Use emacs/autolith.el from the source tree to edit code, work in a sly REPL, and talk to Autolith in one Emacs frame. The REPL connects to the same Lisp image as Autolith. The REPL spans the bottom quarter of the frame. Above it, code is on the left and the agent-shell conversation is in the right third.

  1. Install sly and agent-shell.

  2. Load the integration file:

    Emacs Lisp
    (load "/path/to/autolith/emacs/autolith.el")
  3. In the buffer you want to edit, run M-x autolith-ide. The command starts the Emacs server if needed, launches the agent, and connects sly.

Optional Sly contribs need their Lisp dependencies in Autolith's image. For sly-stepper, install agnostic-lizard in a persistent ASDF source registry visible to the Autolith process before Slynk starts.

autolith-ide starts the Emacs server if needed and launches autolith acp through agent-shell with three environment variables:

  • Set AUTOLITH_SLYNK_DIRECTORY to the slynk/ directory from your sly installation.
  • AUTOLITH_SLYNK_PORT_FILE receives the loopback port once Slynk listens, or error: REASON when it cannot start. autolith-ide waits for it, up to autolith-slynk-timeout seconds, and connects sly.
  • Set AUTOLITH_EMACS_SERVER to the server socket for the Emacs instance you want Autolith to access.

M-x autolith-agent-shell starts only the conversation, with Emacs access and without Slynk. The same variables, or the :slynk-directory, :slynk-port-file and :emacs-server-socket settings, work outside Emacs. In the terminal, (slynk) starts Slynk and shows the port for M-x sly-connect, and (slynk :stop) closes it.

If you enable Emacs access, you can ask Autolith to review the selected region or edit an open buffer, including unsaved text. Review the edits in Emacs and save or undo them there. Access outside the workspace and source roots requires approval.

Slynk listens on 127.0.0.1 only. Like ordinary sly, it has no authentication beyond the optional ~/.sly-secret. Anyone who can reach loopback on this machine can evaluate in the image. Your code shares the agent's heap: a fatal error or (sb-ext:exit) ends the session, which recovers like any crash.

Slynk's debugger and output hooks stay off for Autolith's own threads, so your REPL sees only your evaluations. A checkpoint stops Slynk and closes sly connections, then restarts Slynk on the same port. Reconnect with M-x autolith-ide-reconnect. A checkpoint waits for in-flight sly evaluations and fails if they exceed the shutdown timeout.