Sessions archive rfd - #2161
Draft
Rizzen wants to merge 3 commits into
Draft
Sessions archive rfd#2161Rizzen wants to merge 3 commits into
Rizzen wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
title: "Session Archive and Unarchive"
Authors: Mark Tkachenko (@Rizzen), Evgeniy Stepanov(@xtmq)
Elevator pitch
Standardize reversible session archiving in both ACP v1 and v2: Clients can hide conversations from default history, discover archived sessions, and restore them with the same ID and saved history.
Status quo
session/deleteremoves sessions from history but permits permanent deletion.session/closereleases execution resources. Neither guarantees reversible hiding, andsession/listcannot explicitly request archived sessions.What we propose to do about it
Methods
session/archivehides a session from default history:{ "jsonrpc": "2.0", "id": 1, "method": "session/archive", "params": { "sessionId": "sess_abc123", "_meta": {} } }session/unarchiverestores it:{ "jsonrpc": "2.0", "id": 2, "method": "session/unarchive", "params": { "sessionId": "sess_abc123", "_meta": {} } }Both return a result object with optional
_metaand the matching request ID:{ "jsonrpc": "2.0", "id": 1, "result": { "_meta": {} } }The new models are:
ArchiveSessionRequest,UnarchiveSessionRequestsessionId: SessionId; optional_meta.ArchiveSessionResponse,UnarchiveSessionResponse_meta.SessionArchiveCapabilities_meta.In each model,
_metais an object with arbitrary values. Omission andnullare equivalent. An empty result{}remains valid when no metadata is supplied.Capabilities
Agents advertise one shared
archivecapability:agentCapabilities.sessionCapabilities.archive.capabilities.session.archive.{}means the Agent MUST support both methods, archived listing, and state reporting; omission ornullmeans unsupported. Clients MUST check support before using either method or the list parameter.In v1, this also requires
sessionCapabilities.list: {}; v2 already requires listing for Agents supporting sessions.Example v1 initialization response, also advertising the existing
deletecapability forsession/delete:{ "jsonrpc": "2.0", "id": 0, "result": { "protocolVersion": 1, "agentCapabilities": { "sessionCapabilities": { "list": {}, "delete": {}, "archive": { "_meta": {} } } } } }Listing and state
Extend
session/listwith an optionalarchivedparameter to include archived sessions:null, orfalsetrueThe parameter combines with
cwdand applies before pagination. Clients keep the samecwdandarchivedvalues when followingnextCursor; changing either starts a new pagination sequence.Include archived sessions alongside unarchived sessions:
{ "jsonrpc": "2.0", "id": 3, "method": "session/list", "params": { "cwd": "/home/user/project", "archived": true } }{ "jsonrpc": "2.0", "id": 3, "result": { "sessions": [ { "sessionId": "sess_abc123", "cwd": "/home/user/project", "title": "Implement session archive support", "archived": true }, { "sessionId": "sess_def456", "cwd": "/home/user/project", "title": "Update session documentation", "archived": false } ] } }Add an optional, non-null boolean
archivedto:SessionInfo: required in list results when thearchivecapability is advertised. Otherwise, omission conveys no archive-state guarantee.SessionInfoUpdate: omission leaves state unchanged. Agents SHOULD report changes through existingsession_info_updatenotifications to connected session observers. Listing remains the source of truth after reconnecting; no global subscription is introduced.{ "jsonrpc": "2.0", "method": "session/update", "params": { "sessionId": "sess_abc123", "update": { "sessionUpdate": "session_info_update", "archived": true } } }Guarantees
Resource not found(-32002). Neither method requires activation on the current connection.archivedparameter. Unarchive does not undo deletion; Clients must not substitute deletion for archiving.updatedAt.Shiny future
A user archives a conversation in one Client, finds it in another Client's archived history, and restores it for continued work.
Implementation details and plan
The implementation MUST cover both ACP v1 and v2:
session/archive,session/unarchive, all new models with_meta, the sharedarchivecapability, thesession/listparameter, and archive-state reporting. Implement these behindunstable_session_archive, regenerate both versions' schemas, and update conversions, SDKs, and docs. Validate restoration, retries, persistence, pagination, active sessions, and deletion compatibility in both protocol versions before preview.Frequently asked questions
Why separate methods?
They express opposite state transitions under one shared capability. A boolean setter is possible, but a general metadata-editing API exceeds this request. Extending deletion cannot guarantee recovery when Agents may permanently remove data.
What needs discussion?
Revision history