@@ -45,6 +45,25 @@ function makeFakeClaudeBinary(dir: string) {
4545 " exit 3" ,
4646 " fi" ,
4747 "fi" ,
48+ 'if [ -n "$T3_FAKE_CLAUDE_REQUIRE_EMPTY_TOOLS" ]; then' ,
49+ ' previous_arg=""' ,
50+ ' empty_tools_found=""' ,
51+ ' for arg in "$@"; do' ,
52+ ' if [ "$previous_arg" = "--tools" ]; then' ,
53+ ' [ -z "$arg" ] || {' ,
54+ ' printf "%s\\n" "--tools was not followed by an empty argument" >&2' ,
55+ " exit 6" ,
56+ " }" ,
57+ ' empty_tools_found="yes"' ,
58+ " break" ,
59+ " fi" ,
60+ ' previous_arg="$arg"' ,
61+ " done" ,
62+ ' [ "$empty_tools_found" = "yes" ] || {' ,
63+ ' printf "%s\\n" "missing --tools empty argument" >&2' ,
64+ " exit 7" ,
65+ " }" ,
66+ "fi" ,
4867 'if [ -n "$T3_FAKE_CLAUDE_STDIN_MUST_CONTAIN" ]; then' ,
4968 ' printf "%s" "$stdin_content" | grep -F -- "$T3_FAKE_CLAUDE_STDIN_MUST_CONTAIN" >/dev/null || {' ,
5069 ' printf "%s\\n" "stdin missing expected content" >&2' ,
@@ -75,6 +94,7 @@ function withFakeClaudeEnv<A, E, R>(
7594 stderr ?: string ;
7695 argsMustContain ?: string ;
7796 argsMustNotContain ?: string ;
97+ requireEmptyTools ?: boolean ;
7898 stdinMustContain ?: string ;
7999 configDirMustBe ?: string ;
80100 claudeConfig ?: Partial < ClaudeSettings > ;
@@ -91,6 +111,7 @@ function withFakeClaudeEnv<A, E, R>(
91111 const previousStderr = process . env . T3_FAKE_CLAUDE_STDERR ;
92112 const previousArgsMustContain = process . env . T3_FAKE_CLAUDE_ARGS_MUST_CONTAIN ;
93113 const previousArgsMustNotContain = process . env . T3_FAKE_CLAUDE_ARGS_MUST_NOT_CONTAIN ;
114+ const previousRequireEmptyTools = process . env . T3_FAKE_CLAUDE_REQUIRE_EMPTY_TOOLS ;
94115 const previousStdinMustContain = process . env . T3_FAKE_CLAUDE_STDIN_MUST_CONTAIN ;
95116 const previousConfigDirMustBe = process . env . T3_FAKE_CLAUDE_CONFIG_DIR_MUST_BE ;
96117
@@ -123,6 +144,12 @@ function withFakeClaudeEnv<A, E, R>(
123144 delete process . env . T3_FAKE_CLAUDE_ARGS_MUST_NOT_CONTAIN ;
124145 }
125146
147+ if ( input . requireEmptyTools === true ) {
148+ process . env . T3_FAKE_CLAUDE_REQUIRE_EMPTY_TOOLS = "1" ;
149+ } else {
150+ delete process . env . T3_FAKE_CLAUDE_REQUIRE_EMPTY_TOOLS ;
151+ }
152+
126153 if ( input . stdinMustContain !== undefined ) {
127154 process . env . T3_FAKE_CLAUDE_STDIN_MUST_CONTAIN = input . stdinMustContain ;
128155 } else {
@@ -169,6 +196,12 @@ function withFakeClaudeEnv<A, E, R>(
169196 process . env . T3_FAKE_CLAUDE_ARGS_MUST_NOT_CONTAIN = previousArgsMustNotContain ;
170197 }
171198
199+ if ( previousRequireEmptyTools === undefined ) {
200+ delete process . env . T3_FAKE_CLAUDE_REQUIRE_EMPTY_TOOLS ;
201+ } else {
202+ process . env . T3_FAKE_CLAUDE_REQUIRE_EMPTY_TOOLS = previousRequireEmptyTools ;
203+ }
204+
172205 if ( previousStdinMustContain === undefined ) {
173206 delete process . env . T3_FAKE_CLAUDE_STDIN_MUST_CONTAIN ;
174207 } else {
@@ -190,6 +223,35 @@ function withFakeClaudeEnv<A, E, R>(
190223}
191224
192225it . layer ( ClaudeTextGenerationTestLayer ) ( "ClaudeTextGeneration" , ( it ) => {
226+ it . effect ( "disables all Claude tools for headless text generation" , ( ) =>
227+ withFakeClaudeEnv (
228+ {
229+ output : JSON . stringify ( {
230+ structured_output : {
231+ title : "No tools available" ,
232+ } ,
233+ } ) ,
234+ argsMustContain :
235+ "--permission-mode dontAsk --disallowedTools Agent,Bash,Edit,Glob,Grep,Monitor,NotebookEdit,PowerShell,Read,Skill,WebFetch,WebSearch,Workflow,Write --strict-mcp-config --tools" ,
236+ argsMustNotContain : "--dangerously-skip-permissions" ,
237+ requireEmptyTools : true ,
238+ } ,
239+ ( textGeneration ) =>
240+ Effect . gen ( function * ( ) {
241+ const generated = yield * textGeneration . generateThreadTitle ( {
242+ cwd : process . cwd ( ) ,
243+ message : "Name this thread without using tools." ,
244+ modelSelection : {
245+ instanceId : ProviderInstanceId . make ( "claudeAgent" ) ,
246+ model : "claude-haiku-4-5" ,
247+ } ,
248+ } ) ;
249+
250+ expect ( generated . title ) . toBe ( "No tools available" ) ;
251+ } ) ,
252+ ) ,
253+ ) ;
254+
193255 it . effect ( "forwards Claude thinking settings for Haiku without passing effort" , ( ) =>
194256 withFakeClaudeEnv (
195257 {
0 commit comments