Skip to content

Introduces experimental session list/load/resume#289

Merged
xenodium merged 46 commits intomainfrom
pr263-resume-session
Feb 15, 2026
Merged

Introduces experimental session list/load/resume#289
xenodium merged 46 commits intomainfrom
pr263-resume-session

Conversation

@xenodium
Copy link
Owner

@xenodium xenodium commented Feb 15, 2026

Introduces experimental session listing/loading/resuming. These features are not yet stable in ACP and may break if protocol changes.

This work is a collaboration between @farra @travisjeffery and myself.

For the feature to work, agents are required to implement:

And either one of these:

I've validated the flows against two agents known to implement the required ACP at the following versions:

Claude Code (resume)

  • @anthropic-ai/claude-code: 2.1.34
  • @zed-industries/claude-code-acp: 0.16.1

Codex (load)

  • @openai/codex`: 0.101.0

Other agents

No other agents have been tested at this time. Please try against other agents and report issues, but please verify the above ACP features are implemented by those agents.

To enable the experimental list/resume flow use:

(setq agent-shell-deferred-initialization nil)
(setq agent-shell-session-load-strategy 'prompt)

Also introduced agent-shell-prefer-session-resume (defaults to t). In instances where both loading and resuming are available, it prefers resuming as its way more lightweight (no need to replay and render the entire history).

To prefer loading, disable resuming with:

(setq agent-shell-prefer-session-resume nil)

You can start a new shell as usual. For example M-x agent-shell or M-x agent-shell-anthropic-start-claude-code or M-x agent-shell-openai-start-codex.

Note: If you don't get offered any sessions, it's possible the agents haven't been run on the latest versions and haven't had a chance to save a session.

Resuming gives you a list of sessions to choose from via completing-read. If you have a completion framework, it may look different, but mine looks as follows (using ivy):

Screenshot 2026-02-15 at 11 34 26

For example:

Let's build something                 Today, 16:25
Let's refactor my hobby project       Yesterday, 20:18
Let's optimize the rocket engine      Feb 12, 21:02
Related to: #190 #105
Related to: #190 #105
This helps identify where the data/structure originated from
Related to: #190 #105
Example usage:

  ;; Subscribe to all events
  (agent-shell-subscribe-to
   :shell-buffer shell-buffer
   :on-event (lambda (event)
               (message \"event: %s\" (map-elt event :event))))

  ;; Subscribe to file writes
  (agent-shell-subscribe-to
   :shell-buffer shell-buffer
   :event \\='file-write
   :on-event (lambda (event)
               (let ((data (map-elt event :data)))
                 (message \"wrote: %s\" (map-elt data :path)))))

  ;; Unsubscribe
  (let ((token (agent-shell-subscribe-to
                :shell-buffer shell-buffer
                :on-event #\\='my-handler)))
    (agent-shell-unsubscribe :subscription token))"
  (unless on-event
    (error "Missing required argument: :on-event"))
  (unless shell-buffer
    (error "Missing required argument: :shell-buffer"))
  (let ((token (cl-incf agent-shell--subscription-counter)))
    (with-current-buffer shell-buffer
      (let ((subscriptions (map-elt (agent-shell--state) :event-subscriptions)))
        (map-put! (agent-shell--state)
                  :event-subscriptions
                  (cons (list (cons :token token)
                              (cons :event event)
                              (cons :on-event on-event))
                        subscriptions))))
    token))
For example:

Let's build something                 Today, 16:25
Let's refactor my hobby project       Yesterday, 20:18
Let's optimize the rocket engine      Feb 12, 21:02
Related to: #190 #105
Related to: #190 #105
This helps identify where the data/structure originated from
Related to: #190 #105
@xenodium xenodium changed the title Introduces experimental session list/load/resume (collab between @farra @travisjeffery and myself) Introduces experimental session list/load/resume Feb 15, 2026
@xenodium xenodium merged commit fbbdd09 into main Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant