Skip to content

Add agent-shell-restore-context defcustom#605

Open
nhojb wants to merge 2 commits into
xenodium:mainfrom
nhojb:f/restore-context
Open

Add agent-shell-restore-context defcustom#605
nhojb wants to merge 2 commits into
xenodium:mainfrom
nhojb:f/restore-context

Conversation

@nhojb
Copy link
Copy Markdown
Contributor

@nhojb nhojb commented May 26, 2026

Currently when restoring a session you can choose a minimal resume or a full load via agent-shell-prefer-session-resume.

This PR adds a summary option via a new agent-shell-restore-context defcustom. The options are:

  • minimal: Equivalent to agent-shell-prefer-session-resume: t
  • full: Equivalent to agent-shell-prefer-session-resume: nil
  • summary: Loads the full session (when available), but renders only the first prompt and last text response.

The idea is that summary gives you enough context about the session, without needing to restore the entire conversation and tool calls.

Here's an example:

8oar1X67TfB

Checklist

  • I agree to communicate (PR description and comments) with the author myself (not AI-generated).
  • I've reviewed all code in PR myself and will vouch for its quality.
  • I've read and followed the Contributing guidelines.
  • I've filed a feature request/discussion for a new feature.
  • I'm making visual changes, so I'm including screenshots so you can view and discuss.
  • I've added tests where applicable.
  • I've updated documentation where necessary.
  • I've run M-x checkdoc and M-x byte-compile-file.

Copy link
Copy Markdown
Owner

@xenodium xenodium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

Left a couple of minor comments.

The more significant request I'd ask is that you commit to landing the feature, if that's ok with you? If there are related bugs raised, I'd cc ya for visibility.

Comment thread agent-shell.el Outdated
'agent-shell-restore-context
"agent-shell 0.52")

(defcustom agent-shell-restore-context 'minimal
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about naming this agent-shell-session-restore-strategy, it's its more about restoring sessions than context-centric?

Comment thread agent-shell.el Outdated
`minimal': Show only the session title (default). Uses
`session/resume' when supported (no message replay),
so restore is fast and quiet.
`summary': Use `session/load' and, when the replay completes,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we reserve summary for a different feature please?

I've been contemplating pairing resume request with an automaric prompt sent to agent asking to summarize the resumed session.

Maybe name it 'first-last?

Comment thread agent-shell.el Outdated
:state state
:namespace-id "bootstrapping"
:block-id "restore_summary_first_user"
:label-left (propertize "Initial prompt" 'font-lock-face 'font-lock-doc-markup-face)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: search "Initial prompt", replace with "First prompt".

@nhojb nhojb force-pushed the f/restore-context branch from a08c4fd to d4cdd33 Compare May 28, 2026 20:41
@nhojb
Copy link
Copy Markdown
Contributor Author

nhojb commented May 28, 2026

Thanks for the review. Just pushed the suggested fixes.

The more significant request I'd ask is that you commit to landing the feature, if that's ok with you? If there are related bugs raised, I'd cc ya for visibility.

Yes, I'm quite happy to tackle any related bugs and own the feature 😅

@nhojb nhojb force-pushed the f/restore-context branch from d4cdd33 to b5870f0 Compare May 29, 2026 07:54
@nhojb nhojb requested a review from xenodium May 29, 2026 15:00
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.

2 participants