Skip to content

Add AI session checkpoint command to Other Tools menu#354

Merged
tninja merged 3 commits into
mainfrom
copilot/add-ai-session-checkpoint
May 16, 2026
Merged

Add AI session checkpoint command to Other Tools menu#354
tninja merged 3 commits into
mainfrom
copilot/add-ai-session-checkpoint

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 16, 2026

Long-idle AI sessions are hard to resume because there is no quick way to ask the agent for a compact state summary before continuing. This change adds a dedicated checkpoint command that sends a fixed “stop and summarize” prompt and places it in the Other Tools menu where session-inspection utilities belong.

  • New checkpoint command

    • Adds ai-code-session-checkpoint, an interactive command that sends a fixed checkpoint prompt to the active AI session.
    • The prompt asks for:
      • Goal
      • Files changed
      • Current hypothesis
      • Tests/build result
      • Blockers
      • Recommended next action
    • The command then switches focus back to the AI session buffer.
  • Menu wiring

    • Adds AI session checkpoint to ai-code--menu-other-tools.
    • Keeps the feature aligned with the requested UX: available under Other Tools, not the main session/actions groups.
  • Coverage

    • Adds focused tests for:
      • the exact prompt sent by the new command
      • the transient menu entry and keybinding wiring
(ai-code-session-checkpoint)

;; Sends:
;; Please stop and output a CHECKPOINT:
;; - Goal
;; - Files changed
;; - Current hypothesis
;; - Tests/build result
;; - Blockers
;; - Recommended next action
;; Do not continue editing after this checkpoint

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • dl.google.com
    • Triggering command: /usr/lib/apt/methods/https /usr/lib/apt/methods/https (dns block)
  • elpa.gnu.org
    • Triggering command: /usr/bin/emacs emacs -Q -batch -l /tmp/install-ai-code-deps.el (dns block)
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)
    • Triggering command: /usr/bin/python python - (dns block)
  • elpa.nongnu.org
    • Triggering command: /usr/bin/emacs emacs -Q -batch -l /tmp/install-ai-code-deps.el (dns block)
  • melpa.org
    • Triggering command: /usr/bin/emacs emacs -Q -batch -l /tmp/install-ai-code-deps.el (dns block)
    • Triggering command: /usr/bin/python python - (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI linked an issue May 16, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Add checkpoint feature for AI sessions Add AI session checkpoint command to Other Tools menu May 16, 2026
Copilot AI requested a review from tninja May 16, 2026 17:12
Copilot finished work on behalf of tninja May 16, 2026 17:12
@tninja tninja marked this pull request as ready for review May 16, 2026 17:33
@tninja tninja requested a review from Copilot May 16, 2026 17:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a dedicated “session checkpoint” utility to help resume long-idle AI sessions by sending a fixed “stop and summarize” prompt, and exposes it via the Other Tools transient menu group.

Changes:

  • Introduces ai-code-session-checkpoint and a fixed ai-code-session-checkpoint-prompt constant.
  • Wires the command into ai-code--menu-other-tools on key P.
  • Adds ERT coverage for the prompt payload and the menu entry wiring.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
ai-code.el Adds the checkpoint prompt constant + interactive command; registers it in the “Other Tools” transient group.
test/test_ai-code.el Adds tests asserting the exact prompt sent and verifying the transient menu entry/keybinding.

Comment thread test/test_ai-code.el Outdated
Comment on lines +192 to +193
(lambda (command)
(setq sent-command command)))
Comment thread test/test_ai-code.el
Comment on lines +205 to +212
(let* ((suffix (transient-get-suffix 'ai-code--menu-other-tools "P"))
(definition (if (keywordp (car-safe (cdr suffix)))
(cdr suffix)
(nth 2 suffix))))
(should suffix)
(should (eq (plist-get definition :command)
'ai-code-session-checkpoint))
(should (equal (plist-get definition :description)
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cd46847f60

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread ai-code.el
(defun ai-code-session-checkpoint ()
"Ask the active AI session to summarize its current state and stop editing."
(interactive)
(ai-code-cli-send-command ai-code-session-checkpoint-prompt)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Route checkpoint prompt through session-aware prompt sender

ai-code-session-checkpoint sends directly via ai-code-cli-send-command, which only resolves sessions for the current project context, so this command errors in cases where users have a visible AI session from another directory. Other prompt flows use ai-code--send-prompt (via ai-code--insert-prompt) to detect and target the visible session buffer first, which is exactly the long-idle resume scenario this feature is meant to support. In practice, invoking checkpoint from a buffer without a matching project session can fail with “No … session for this project” instead of checkpointing the active visible session.

Useful? React with 👍 / 👎.

@tninja
Copy link
Copy Markdown
Owner

tninja commented May 16, 2026

@copilot carefully review the feedbacks, identify ones make sense and address them.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented May 16, 2026

@copilot carefully review the feedbacks, identify ones make sense and address them.

Addressed the two review points that made sense in 622cdb8: the new checkpoint test mock now accepts &rest args, and the menu-entry test now uses the same (cdr suffix) transient shape as the neighboring tests.

Copilot finished work on behalf of tninja May 16, 2026 18:29
Copy link
Copy Markdown
Owner

@tninja tninja left a comment

Choose a reason for hiding this comment

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

LGTM

@tninja tninja merged commit 872f6db into main May 16, 2026
2 checks passed
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.

Feat: Add AI session checkpoint

3 participants