From 5588794ed76303395ae5322a17d6deca89a5263f Mon Sep 17 00:00:00 2001 From: Minky Baek <55613446+toyo30@users.noreply.github.com> Date: Thu, 10 Sep 2026 16:15:21 +0900 Subject: [PATCH] feat(examples): support conversation title in title.sh and update docs - Extract conversation_title (or conversation_name) from stdin JSON payload - Append formatted conversation title to window title when present - Update README documentation with new title format - Relates to #989 --- examples/title/README.md | 4 ++-- examples/title/title.sh | 9 +++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/examples/title/README.md b/examples/title/README.md index 1430ae61b..1e60cf045 100644 --- a/examples/title/README.md +++ b/examples/title/README.md @@ -8,10 +8,10 @@ For more details on how to use and configure the title script, please refer to t ## How it works The `title.sh` script reads a JSON payload from standard input, which contains real-time information about the agent's state and context. It then: -1. Extracts the `agent_state` and `workspace.current_dir` using `jq`. +1. Extracts the `agent_state`, `workspace.current_dir`, and optional `conversation_title` (or `conversation_name`) using `jq`. 2. Parses the current directory to determine a short workspace name (with special handling for CitC workspaces). 3. Maps the agent state to a corresponding emoji (e.g., 🤔 for thinking, 🛠️ for tool use, 😴 for idle). -4. Outputs the formatted title string in the format: `[Emoji] [State] | [Workspace]`. +4. Outputs the formatted title string in the format: `[Emoji] [State] | [Workspace]` or `[Emoji] [State] | [Workspace] ([ConversationTitle])` if a conversation title is set via `/rename` or `/title`. ## Examples diff --git a/examples/title/title.sh b/examples/title/title.sh index e8b46254a..85c084947 100755 --- a/examples/title/title.sh +++ b/examples/title/title.sh @@ -8,8 +8,9 @@ DATA=$(cat) eval $(echo "$DATA" | jq -r ' "STATE=\"\(.agent_state // "idle")\" CWD=\"\(.workspace.current_dir // "")\" + CONV_TITLE=\"\(.conversation_title // .conversation_name // "")\" " -' 2>/dev/null || echo 'STATE="idle" CWD=""') +' 2>/dev/null || echo 'STATE="idle" CWD="" CONV_TITLE=""') # Try to extract CitC workspace name from CWD if [ -n "$CWD" ]; then @@ -32,6 +33,10 @@ case "$STATE" in *) EMOJI="🤖" ;; esac -TITLE="$EMOJI $STATE | $WORKSPACE" +if [ -n "$CONV_TITLE" ]; then + TITLE="$EMOJI $STATE | $WORKSPACE ($CONV_TITLE)" +else + TITLE="$EMOJI $STATE | $WORKSPACE" +fi echo "$TITLE"