The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 22, 19:30 UTC
feat(settings): add thread title instructions (#21882)
Co-authored-by: Yash Singh <saiansh2525@gmail.com>
Caden Elrod committed
Oct 22, 2026 at 19:38 UTC
51273020db3245f4ec29514a419d29b5dcb012dc
11 files changed
+105
-3
apps/server/src/orchestration-v2/ThreadTitleRegenerationService.ts
+1
@@ -115,6 +115,7 @@ const make = Effect.gen(function* () {
115
message: context.message,
116
attachments: context.attachments,
117
...(input.kind.type === "regenerate" ? { previousTitle: projection.thread.title } : {}),
118
+ instructions: settings.threadTitleInstructions,
119
modelSelection: settings.textGenerationModelSelection,
120
});
121
const generatedTitle = result.title.trim();
apps/server/src/textGeneration/ClaudeTextGeneration.test.ts
+19
@@ -270,6 +270,25 @@ it.layer(layerClaudeTextGenerationTest)("ClaudeTextGeneration", (it) => {
270
),
271
);
272
273
+ it.effect("sends thread title instructions to the provider prompt", () =>
274
+ withFakeClaudeEnv(
275
+ {
276
+ output: JSON.stringify({ structured_output: { title: "Reconnect failures" } }),
277
+ stdinMustContain: "Additional instructions:\nUse two to four words.",
278
+ },
279
+ (textGeneration) =>
280
+ textGeneration.generateThreadTitle({
281
+ cwd: process.cwd(),
282
+ message: "Investigate reconnect failures",
283
+ instructions: "Use two to four words.",
284
+ modelSelection: {
285
+ instanceId: ProviderInstanceId.make("claudeAgent"),
286
+ model: SYNTHETIC_CLAUDE_STANDARD_MODEL,
287
+ },
288
+ }),
289
+ ),
290
+ );
291
+
292
it.effect("runs Claude text generation with the configured CLAUDE_CONFIG_DIR", () =>
293
Effect.gen(function* () {
294
const path = yield* Path.Path;
apps/web/src/components/settings/SettingsPanels.tsx
+6
@@ -54,6 +54,7 @@ import { useScopedModelDisabledReason } from "./useScopedModelAvailability";
54
import { useSettingsScope } from "./SettingsScopeContext";
55
import { scopedIdleCompaction } from "./scopedSettings";
56
import { ProjectDefaultsSettings } from "./ProjectDefaultsSettings";
57
+import { ThreadTitleInstructionsSettings } from "./ThreadTitleInstructionsSettings";
58
import { useDesktopUpdateState } from "../../state/desktopUpdate";
59
import {
60
getCustomModelOptionsByInstance,
@@ -516,6 +517,9 @@ export function useSettingsRestore(onRestored?: () => void) {
517
: []),
518
...(settings.confirmQuit !== DEFAULT_UNIFIED_SETTINGS.confirmQuit ? ["Quit shortcut"] : []),
519
...(isTextGenerationModelDirty ? ["Text generation model"] : []),
520
+ ...(settings.threadTitleInstructions !== DEFAULT_UNIFIED_SETTINGS.threadTitleInstructions
521
+ ? ["Thread title instructions"]
522
+ : []),
523
...getChangedBrowserSettingLabels(settings),
524
...(settings.enableAgentBrowserAccess !== DEFAULT_UNIFIED_SETTINGS.enableAgentBrowserAccess
525
? ["Agent browser access"]
@@ -625,6 +629,7 @@ export function useSettingsRestore(onRestored?: () => void) {
629
confirmThreadUnpin: DEFAULT_UNIFIED_SETTINGS.confirmThreadUnpin,
630
confirmQuit: DEFAULT_UNIFIED_SETTINGS.confirmQuit,
631
textGenerationModelSelection: DEFAULT_UNIFIED_SETTINGS.textGenerationModelSelection,
632
+ threadTitleInstructions: DEFAULT_UNIFIED_SETTINGS.threadTitleInstructions,
633
fontFamilySans: DEFAULT_UNIFIED_SETTINGS.fontFamilySans,
634
fontFamilyComposer: DEFAULT_UNIFIED_SETTINGS.fontFamilyComposer,
635
fontFamilyCode: DEFAULT_UNIFIED_SETTINGS.fontFamilyCode,
@@ -1905,6 +1910,7 @@ export function GeneralSettingsPanel() {
1910
)
1911
}
1912
/>
1913
+ <ThreadTitleInstructionsSettings />
1914
</SettingsSection>
1915
1916
<SettingsSection id="about" title="About">
apps/web/src/components/settings/ThreadTitleInstructionsSettings.tsx
new
+60
@@ -0,0 +1,60 @@
1
+import { useRef } from "react";
2
+
3
+import { Textarea } from "../ui/textarea";
4
+import { SettingsRow, SettingResetButton } from "./settingsLayout";
5
+import { useSettingsScope } from "./SettingsScopeContext";
6
+import { searchableSetting } from "./settingsSearch";
7
+import {
8
+ useScopedSettings,
9
+ useScopedSettingsMixed,
10
+ useUpdateScopedSettings,
11
+} from "./useScopedSettings";
12
+
13
+export function ThreadTitleInstructionsSettings() {
14
+ const settings = useScopedSettings();
15
+ const { targets } = useSettingsScope();
16
+ const scopeKey = targets.map((target) => `${target.environmentId}:${target.projectId}`).join(",");
17
+ const edited = useRef(false);
18
+ const updateSettings = useUpdateScopedSettings();
19
+ const mixed = useScopedSettingsMixed(["threadTitleInstructions"]);
20
+
21
+ return (
22
+ <SettingsRow
23
+ serverScoped
24
+ settingKeys={["threadTitleInstructions"]}
25
+ {...searchableSetting("thread-title-instructions")}
26
+ description="Appended to the prompt for new and regenerated thread titles."
27
+ resetAction={
28
+ mixed || settings.threadTitleInstructions !== "" ? (
29
+ <SettingResetButton
30
+ label="thread title instructions"
31
+ onClick={() => updateSettings({ threadTitleInstructions: "" })}
32
+ />
33
+ ) : null
34
+ }
35
+ >
36
+ <div className="mt-3 max-w-2xl pb-3.5">
37
+ <Textarea
38
+ key={`${scopeKey}:${mixed}:${settings.threadTitleInstructions}`}
39
+ aria-label="Thread title instructions"
40
+ onChange={() => {
41
+ edited.current = true;
42
+ }}
43
+ rows={4}
44
+ defaultValue={mixed ? "" : settings.threadTitleInstructions}
45
+ placeholder={
46
+ mixed
47
+ ? "Mixed. Enter instructions to apply to all selected targets."
48
+ : "Keep titles to a few words. Lead with the main subject."
49
+ }
50
+ onBlur={(event) => {
51
+ const value = event.target.value.trim();
52
+ if (edited.current && (mixed || value !== settings.threadTitleInstructions))
53
+ updateSettings({ threadTitleInstructions: value });
54
+ edited.current = false;
55
+ }}
56
+ />
57
+ </div>
58
+ </SettingsRow>
59
+ );
60
+}
apps/web/src/components/settings/settingsSearch.ts
+7
@@ -524,6 +524,13 @@ export const SETTINGS_SEARCH_ITEMS = [
524
scope: "project-defaults",
525
searchTerms: ["generated thread titles source control content default provider"],
526
},
527
+ {
528
+ id: "thread-title-instructions",
529
+ title: "Thread title instructions",
530
+ to: "/settings/general",
531
+ scope: "project-defaults",
532
+ searchTerms: ["generated thread titles prompt custom style naming rename regenerate"],
533
+ },
534
{
535
id: "app-version",
536
title: "Version",
docs/user/thread-sidebar.md
+4
@@ -107,6 +107,10 @@ To generate a fresh title from the conversation, open a thread's menu and choose
107
**Regenerate title**. The action is unavailable while title generation is in progress
108
or when the connected environment needs a server update.
109
110
+To change how titles are written, add **Thread title instructions** in **Settings → General →
111
+Text generation**, such as a length limit or an identifier to put first. They apply to new and
112
+regenerated titles. Select a project to give it its own instructions.
113
+
114
Agents connected through T3 Code can use the same server-owned metadata workflow to
115
rename a thread, regenerate its title, or link and unlink a pull request. These changes
116
appear on web, desktop, and mobile without requiring the originating browser to remain
packages/contracts/src/settings.ts
+4
@@ -979,6 +979,7 @@ export const PROJECT_SCOPED_SERVER_SETTING_KEYS = [
979
"enableAgentBrowserAccess",
980
"enableAgentDeviceAccess",
981
"textGenerationModelSelection",
982
+ "threadTitleInstructions",
983
"sourceControlWriterModelSelection",
984
"reviewGuideModelSelection",
985
"reviewGuideInstructions",
@@ -1022,6 +1023,7 @@ export const ProjectSettingsOverrides = Schema.Struct({
1023
enableAgentBrowserAccess: Schema.optionalKey(Schema.Boolean),
1024
enableAgentDeviceAccess: Schema.optionalKey(Schema.Boolean),
1025
textGenerationModelSelection: Schema.optionalKey(ModelSelection),
1026
+ threadTitleInstructions: Schema.optionalKey(TrimmedString),
1027
sourceControlWriterModelSelection: Schema.optionalKey(Schema.NullOr(ModelSelection)),
1028
reviewGuideModelSelection: Schema.optionalKey(Schema.NullOr(ModelSelection)),
1029
reviewGuideInstructions: Schema.optionalKey(TrimmedString),
@@ -1265,6 +1267,7 @@ export const ServerSettings = Schema.Struct({
1267
}),
1268
),
1269
),
1270
+ threadTitleInstructions: TrimmedString.pipe(Schema.withDecodingDefault(Effect.succeed(""))),
1271
branchNamingMode: BranchNamingMode.pipe(
1272
Schema.withDecodingDefault(Effect.succeed("static" as const)),
1273
),
@@ -1587,6 +1590,7 @@ export const ServerSettingsPatch = Schema.Struct({
1590
worktreeSubmodules: Schema.optionalKey(Schema.NullOr(WorktreeSubmodules)),
1591
addProjectBaseDirectory: Schema.optionalKey(TrimmedString),
1592
textGenerationModelSelection: Schema.optionalKey(ModelSelectionPatch),
1593
+ threadTitleInstructions: Schema.optionalKey(TrimmedString),
1594
branchNamingMode: Schema.optionalKey(BranchNamingMode),
1595
branchNamePrefix: Schema.optionalKey(TrimmedString),
1596
branchNameInstructions: Schema.optionalKey(TrimmedString),
packages/provider-core/src/server/textGeneration.ts
+1
@@ -61,6 +61,7 @@ export interface ThreadTitleGenerationInput {
61
message: string;
62
previousTitle?: string | undefined;
63
attachments?: ReadonlyArray<ChatAttachment> | undefined;
64
+ instructions?: string | undefined;
65
modelSelection: ModelSelection;
66
}
67
packages/provider-core/src/server/textGenerationOperations.ts
+1
@@ -149,6 +149,7 @@ export function fromRunner(name: string, run: Runner): ProviderTextGeneration {
149
previousTitle: input.previousTitle,
150
linkedContext: input.linkedContext,
151
attachments: input.attachments,
152
+ instructions: input.instructions,
153
}),
154
});
155
return {
packages/provider-core/src/server/textGenerationPolicy.ts
-1
@@ -13,7 +13,6 @@ export const TextGenerationPolicy = Schema.Struct({
13
commitInstructions: Schema.optional(Schema.String),
14
changeRequestInstructions: Schema.optional(Schema.String),
15
branchInstructions: Schema.optional(Schema.String),
16
- threadTitleInstructions: Schema.optional(Schema.String),
16
inferRepositoryConventions: Schema.Boolean,
17
});
18
export type TextGenerationPolicy = typeof TextGenerationPolicy.Type;
packages/provider-core/src/server/textGenerationPrompts.ts
+2
-2
@@ -351,7 +351,7 @@ export interface ThreadTitlePromptInput {
351
message: string;
352
previousTitle?: string | undefined;
353
attachments?: ReadonlyArray<ChatAttachment> | undefined;
354
- policy?: TextGenerationPolicy | undefined;
354
+ instructions?: string | undefined;
355
}
356
357
// Keep shared editorial rules in these two prompts in sync.
@@ -430,7 +430,7 @@ function preserveMessageEnd(message: string): string {
430
}
431
432
function threadTitlePromptSuffix(input: ThreadTitlePromptInput): string {
433
- const additionalInstructions = policyInstruction(input.policy?.threadTitleInstructions);
433
+ const additionalInstructions = policyInstruction(input.instructions);
434
const attachmentLines = (input.attachments ?? []).map(
435
(attachment) => `- ${attachment.name} (${attachment.mimeType}, ${attachment.sizeBytes} bytes)`,
436
);