Skip to content

[FEATURE]: Add built-in tools to archive and unarchive sessions #61294

Not planned

Description

@nefthy-jl

Feature hasn't been suggested before.

  • I searched the tracker and found no matching feature request.

Describe the enhancement you want to request

Expose built-in tools for archiving and unarchiving sessions, alongside the existing opencode.session_rename and opencode.session_move tools.

An agent can already archive and unarchive sessions by calling the HTTP API through the opencode api CLI command. Dedicated tools would make these actions discoverable and more efficient, without requiring the agent to look up API details and execute a shell command.

For example, a user could ask an agent to complete a task and archive the session when the work is done. The agent could then finish the requested workflow with a built-in tool.

Suggested interface:

  • opencode.session_archive({ sessionID? })
  • opencode.session_unarchive({ sessionID? })

Omitting sessionID should target the current session, consistent with the existing session tools. Providing it should target a specific session.

These tools should reuse the existing archive behavior. This request is for an agent-facing interface, not a new archive mechanism.

Activity

  1. opencodejr commented on Nov 2, 2026

    @opencodejr
    Contributor

    Thanks for the request! To restate it: you'd like built-in opencode.session_archive and opencode.session_unarchive tools (with an optional sessionID that defaults to the current session), next to session_rename and session_move, so agents can archive sessions without having to call the HTTP API through opencode api. Maintainers will consider it.

    A plugin can't provide these tools yet, because the plugin ctx.session.update({ archived }) call currently has no effect (#61038). Once that's fixed, a plugin could add them.

    Related issues:

  2. neriousy commented on Nov 26, 2026

    @neriousy
    Member

    Thanks for the request, @nefthy-jl!

    We're not adding these as built-in tools because a plugin can provide them. Register session_archive and session_unarchive tools that call ctx.session.update({ sessionID, archived: true }) or archived: false, and default to the current session when no sessionID is passed.

    One catch: session.update currently ignores archived (#61038). #61036 fixes it, and once that's merged a plugin like this will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions