Session self-management API: allow agents/sessions to rename themselves and assign to groups

Open 💬 0 comments Opened Jun 11, 2026 by SteveM74

Feature Request

Claude Code has no way for a running session or agent to manipulate its own context within the app — no API to rename the session, assign it to a group, or signal organisational metadata back to the UI.

Motivation

Agents that follow structured workflows would benefit enormously from being able to self-organise within the app. A concrete example:

I run a custom review agent that performs structured code reviews across multiple PRs. Each review session is a distinct unit of work. Today, I manage these by manually:

  • Renaming the session to something like Review — PR #1165 feat/e2e-phase-3
  • Dragging it into a "Code Reviews" group in the sidebar

There is no way to automate this. The agent has full context about the PR number, branch name, and review type — but cannot pass any of that back to the app to organise itself.

Proposed capability

Expose a mechanism (e.g. a tool, a special output channel, or a hook event) that allows a session to emit structured metadata the app acts on:

{
  "session": {
    "name": "Review — PR #1165 feat/e2e-phase-3",
    "group": "Code Reviews"
  }
}

Possible implementation surfaces:

  • A built-in tool (UpdateSession, SetSessionName) the agent can call
  • A structured output the Stop hook can emit that the app interprets
  • A sidecar JSON file the app watches (e.g. .claude/session-meta.json) that the session can write to

Use cases beyond code review

  • A deployment agent that renames itself to Deploy — v2.4.1 → staging and moves into a "Deployments" group
  • A research agent that names itself after the topic it was asked to investigate
  • Any long-running agent workflow where the session name at launch (New Session) is meaningless by the time meaningful work begins

Current workaround

None — session naming and grouping are manual-only operations in the UI.

Environment

  • Platform: Windows 11
  • Claude Code desktop app

View original on GitHub ↗