fix(hooks): stop hijacking Claude Code session name + humanize auto-task titles (0.14.3)#30
Merged
Merged
Conversation
…to-task titles (0.14.3)
Two related fixes for the SessionStart hook polluting the user's Claude
Code session name and the task list with machine-derived junk.
SessionStart envelope: drop the `sessionTitle` and `initialUserMessage`
fields (the v0.10.1 "X2" experiment). `sessionTitle` was set to
"TJ — <task_id> (<n> open)", which overrode Claude Code's native,
prompt-derived session name with our internal task id. `initialUserMessage`
injected a "[Task Journal resumed: …]" banner into the next prompt, which
the auto-open path then captured as a brand-new garbage-titled task. The
resume context the model needs still rides in `additionalContext`; the tab
label belongs to Claude Code. Removes the now-dead TJ_INITIAL_USER_MESSAGE
gate.
Auto-open titles: route `auto_open_task_from_prompt` through a new
`tj_core::title::humanize_title`. It skips log lines ("685] INFO: …"),
timestamps, shell prompts ("user@host:~$ …"), JSON/paths and the resume
banner, and returns the first line that reads like human intent. When the
prompt is only machine noise it returns None and the caller declines to
auto-open — better no task than a task titled "685] INFO: Mapped {/x, POST}".
Tests: new title:: unit suite (11) for the heuristic; flipped the
SessionStart envelope tests to assert sessionTitle/initialUserMessage are
absent; removed the obsolete TJ_INITIAL_USER_MESSAGE test; added a cli
integration test proving a log-scrollback prompt does not auto-open a task.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
What & why
Two related fixes for the SessionStart hook polluting the user's Claude Code session name and the task list. Reported by a user who saw sessions named
TJ — tj-qqay98cpc2and tasks titled685] INFO: Mapped {/rest-api/...}.1. SessionStart no longer hijacks the session name
The v0.10.1 "X2" experiment emitted two undocumented fields:
sessionTitle: "TJ — <task_id> (<n> open)"— overrode Claude Code's native, prompt-derived session name with our internal task id.initialUserMessage: "[Task Journal resumed: …]"— injected a banner into the next prompt, which auto-open then captured as a new garbage-titled task.Both removed. Resume context still rides in
additionalContext; the tab label belongs to Claude Code. DeadTJ_INITIAL_USER_MESSAGEgate gone.2. Auto-opened tasks get human-readable titles
auto_open_task_from_prompttook the prompt's first non-empty line verbatim — so a session opening on scrollback got titled685] INFO: Mapped {...}. Titles now run throughtj_core::title::humanize_title, which rejects logs, timestamps, shell prompts, JSON/paths and the resume banner, and picks the first human-intent line. Pure machine noise → declines to auto-open.Base note
Cut from
v0.14.2, which shipped from feature branches and never merged tomain(main sat at 0.13.1). Merging this reconciles the drift: brings 0.14.0–0.14.2 and this 0.14.3 fix ontomain.Tests
title::unit suite (11).migrate_projectWSL-only env failures unrelated).🤖 Generated with Claude Code