@devries-cameron20 / t3code-1 / commits / 335d8b5601
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(server): Claude --settings and prompt-file launch args expand ~ (#26649)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 11, 2026 at 11:59 UTC 335d8b56015f09def0cc350f91c5fc7fc3ac69c6
3 files changed +63 -8
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts
+44
@@ -1184,6 +1184,50 @@ describe("ClaudeAdapterV2 append-system-prompt-file launch argument", () => {
1184 ),
1185 );
1186
1187 + // regression: #26631 `~/` launch argument paths resolved under the project cwd
1188 + it.effect.each([
1189 + [
1190 + "--settings ~/.claude/settings.json",
1191 + (options: ClaudeAdapterV2.ClaudeAgentSdkQueryOptions) =>
1192 + assert.deepInclude(options.settings, { skillOverrides: { lint: "off" } }),
1193 + ],
1194 + [
1195 + "--append-system-prompt-file ~/.claude/settings.json",
1196 + (options: ClaudeAdapterV2.ClaudeAgentSdkQueryOptions) =>
1197 + assert.include(appendSystemPrompt(options), '{"skillOverrides":{"lint":"off"}}'),
1198 + ],
1199 + ] as const)("reads %s from the home directory", ([launchArgs, assertOptions]) =>
1200 + Effect.scoped(
1201 + Effect.gen(function* () {
1202 + const fileSystem = yield* FileSystem.FileSystem;
1203 + const home = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-claude-home-" });
1204 + const cwd = yield* fileSystem.makeTempDirectoryScoped({ prefix: "t3-claude-home-cwd-" });
1205 + yield* fileSystem.makeDirectory(NodePath.join(home, ".claude"));
1206 + yield* fileSystem.writeFileString(
1207 + NodePath.join(home, ".claude", "settings.json"),
1208 + '{"skillOverrides":{"lint":"off"}}',
1209 + );
1210 + const { exit, opened } = yield* startTurnWithLaunchArgs(launchArgs, cwd).pipe(
1211 + Effect.provideService(HostProcess.HomeDirectory, home),
1212 + );
1213 + if (Exit.isFailure(exit)) {
1214 + assert.fail(makeProviderFailure({ cause: exit.cause, class: "provider_error" }).message);
1215 + }
1216 + assert.lengthOf(opened, 1);
1217 + assertOptions(opened[0]!);
1218 + }).pipe(
1219 + Effect.provide(
1220 + Layer.mergeAll(
1221 + IdAllocator.layer,
1222 + McpProviderSessions.layer,
1223 + NodeServices.layer,
1224 + NodeCrypto.layer,
1225 + ),
1226 + ),
1227 + ),
1228 + ),
1229 + );
1230 +
1231 // regression: #20413 malformed append-system-prompt launch args fail before a query opens
1232 it.effect.each([
1233 [
apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts
+15 -8
@@ -1938,10 +1938,10 @@ export function makeClaudeQueryOptions(input: {
1938 }
1939
1940 /**
1941 - * Checks the append launch arguments the way the Claude CLI would and reads
1942 - * the file relative to the process cwd. makeClaudeQueryOptions folds these
1943 - * flags out of extraArgs, so a value the CLI would have rejected has to be
1944 - * rejected here or it silently disappears.
1941 + * Checks the append launch arguments the way the Claude CLI would and reads the
1942 + * file (leading ~ expanded) relative to the thread's cwd. makeClaudeQueryOptions
1943 + * folds these flags out of extraArgs, so a value the CLI would have rejected has
1944 + * to be rejected here or it silently disappears.
1945 */
1946 const readClaudeAppendSystemPromptFile = Effect.fnUntraced(function* (input: {
1947 readonly settings: ClaudeSettings | undefined;
@@ -1966,7 +1966,10 @@ const readClaudeAppendSystemPromptFile = Effect.fnUntraced(function* (input: {
1966 flag: "--append-system-prompt-file",
1967 });
1968 }
1969 - const filePath = input.path.resolve(input.cwd ?? ".", file);
1969 + const filePath = input.path.resolve(
1970 + input.cwd ?? ".",
1971 + expandHomePath(file, yield* HostProcess.HomeDirectory),
1972 + );
1973 return yield* input.fileSystem
1974 .readFileString(filePath)
1975 .pipe(
@@ -1980,8 +1983,9 @@ const decodeClaudeLaunchArgSettings = Schema.decodeUnknownEffect(
1983
1984 /**
1985 * Reads the --settings launch argument: a value starting with a brace is inline
1983 - * JSON, anything else is a file path relative to the cwd. makeClaudeQueryOptions
1984 - * merges the result beneath T3's own settings.
1986 + * JSON, anything else is a file path that expands a leading ~ and is otherwise
1987 + * relative to the thread's cwd (the project or its worktree).
1988 + * makeClaudeQueryOptions merges the result beneath T3's own settings.
1989 */
1990 const readClaudeLaunchArgSettings = Effect.fn("ClaudeAdapterV2.readLaunchArgSettings")(
1991 function* (input: {
@@ -2002,7 +2006,10 @@ const readClaudeLaunchArgSettings = Effect.fn("ClaudeAdapterV2.readLaunchArgSett
2006 Effect.mapError((cause) => new ClaudeSettingsLaunchArgError({ cause })),
2007 )) as ClaudeSdkSettings;
2008 }
2005 - const filePath = input.path.resolve(input.cwd ?? ".", trimmed);
2009 + const filePath = input.path.resolve(
2010 + input.cwd ?? ".",
2011 + expandHomePath(trimmed, yield* HostProcess.HomeDirectory),
2012 + );
2013 return (yield* input.fileSystem.readFileString(filePath).pipe(
2014 Effect.flatMap(decodeClaudeLaunchArgSettings),
2015 Effect.mapError((cause) => new ClaudeSettingsLaunchArgError({ path: filePath, cause })),
docs/user/providers-claude.md
+4
@@ -40,6 +40,10 @@ state. Claude does not have Codex's shared-home and shadow-home arrangement.
40 For presets that differ only in API keys or endpoints, use the instance's
41 **Environment variables**. Variable assignments do not belong in **Launch arguments**.
42
43 +File paths in the `--settings` and `--append-system-prompt-file` launch arguments
44 +can start with `~` for the home directory of the machine running T3 Code. Any
45 +other relative path is read from the thread's project folder, or its worktree.
46 +
47 Claude Code's verbose mode can stay enabled when you use Claude for text generation, including
48 thread titles, branch names, commit messages, and pull request descriptions. On a remote connection,
49 T3 Code uses the Claude configuration on the connected server.