Skip to content

Add /rename builtin slash command#287

Draft
daniel-agentee wants to merge 4 commits into
zed-industries:mainfrom
daniel-agentee:acp-rename-slash
Draft

Add /rename builtin slash command#287
daniel-agentee wants to merge 4 commits into
zed-industries:mainfrom
daniel-agentee:acp-rename-slash

Conversation

@daniel-agentee
Copy link
Copy Markdown

Summary

Adds /rename <new title> as a builtin slash command for codex-acp. Typing /rename Foo in any ACP client (including stock Zed.app — no client-side change required) renames the current session: the title is persisted to session_index.jsonl, the SQLite state DB is updated, and the client repaints its session list inline via the SessionInfoUpdate notification.

Empty argument prints a usage hint instead of being a silent no-op. The new builtin is added to builtin_command_names() so a same-named skill cannot shadow it.

Why

Today users can rename a session only by opening the title editor in the agent panel header — which depends on Zed having merged the title-editor wiring (and on the protocol/handler PRs landing). A slash command works from any ACP client immediately because the dispatch lives entirely inside codex-acp.

What's in this PR

  • thread.rs:
    • Adds rename to builtin_command_names() and builtin_commands() (with an Unstructured("new session title") input hint so the / picker shows the argument slot).
    • In handle_prompt, intercepts /rename before the Op::UserInput dispatch. Empty arg → Usage: agent message. Non-empty → calls self.handle_set_title(title) which already persists + emits SessionInfoUpdate (from Handle session/setTitle and emit SessionInfoUpdate #286), then sends a confirmation chunk. Returns StopReason::EndTurn immediately — never reaches the model.
  • New unit tests: rename_is_listed_in_builtin_commands, slash_rename_without_arg_shows_usage_message, slash_rename_with_arg_writes_title_to_session_index.

Tests

cargo test --locked --lib

29 lib tests pass.

Dependencies (drafted until merged)

This PR is intentionally split out as a separate, smaller concern from the underlying rename infrastructure. It stacks on:

I'll mark this PR ready-for-review and rebase to a clean single-commit diff once the dependencies land.

Daniel Stojanovic and others added 4 commits May 15, 2026 17:27
Codex skills (loaded via SkillsManager) are now advertised to ACP clients
alongside the existing builtin slash commands. Selecting a skill rewrites
the leading "/name ..." text into Codex's implicit-skill form ("$name ...")
before submission, so invocation goes through the same implicit-skill path
the TUI uses when a user types `$` and picks a skill from the popup.

The cache is refreshed at session load and whenever Codex emits
EventMsg::SkillsUpdateAvailable; the latter is intercepted at the
ThreadActor level (not per-submission) and triggers a session-wide
AvailableCommandsUpdate. Skill names that collide with a builtin
(/init, /compact, /review, etc.) are dropped with a warning so a skill
cannot shadow a builtin.

Plugin-supplied skill roots are not yet threaded through — only
user/project/system skills appear today. Following PR can wire the
plugin outcome through to fully match the TUI's coverage.

References zed-industries#190.
Previously the title was persisted to session_index.jsonl but the
connected client (Zed) only saw the change on the next session/list
refresh — usually after restart. Send a SessionUpdate::SessionInfoUpdate
carrying the new title so the client can update its session list
in place, no restart needed.

Covers both rename surfaces: the session/setTitle JSON-RPC and the
/rename builtin slash command both flow through handle_set_title.
Exposes `/rename <new title>` so users can rename the current ACP
session from the chat input without a title-editor UI in the client.
Works on stock Zed because the command resolves entirely inside
codex-acp via the existing Thread::set_title path that writes to
$CODEX_HOME/session_index.jsonl.

The empty-arg case prints a usage hint instead of a silent no-op,
and `rename` is added to builtin_command_names so a same-named skill
cannot shadow it.
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.

1 participant