Skip to content

Commit 592e40c

Browse files
committed
chore: rename variable to report_tasks_system_prompt
1 parent b4589e5 commit 592e40c

File tree

3 files changed

+59
-34
lines changed

3 files changed

+59
-34
lines changed

registry/coder/modules/claude-code/README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ module "claude-code" {
2929
<!-- TODO(major): remove this note and update the prompt configuration example in the next major release -->
3030

3131
> [!NOTE]
32-
> By default, `include_coder_system_prompt` is false. For proper integration with Coder (tool selection & task reporting),
33-
> it is recommended to set `include_coder_system_prompt` to true. In the next major release, this will become the default.
32+
>
33+
> By default, `report_tasks_system_prompt` is false.
34+
> When `report_tasks` is true, it is recommended to set `report_tasks_system_prompt` to true to inject the Coder system prompt to ensure proper task-reporting integration.
35+
> If `report_tasks` is false, this setting has no effect. In the next major release, the default for `report_tasks_system_prompt` will be true.
3436
3537
## Prerequisites
3638

@@ -42,7 +44,7 @@ module "claude-code" {
4244

4345
### Prompt configuration (recommended)
4446

45-
Include Coder’s prompt sections and optionally add your own system prompt.
47+
Include Coder’s prompt section for task reporting and optionally add your own system prompt.
4648

4749
```hcl
4850
module "claude-code" {
@@ -51,7 +53,9 @@ module "claude-code" {
5153
agent_id = coder_agent.example.id
5254
workdir = "/home/coder/project"
5355
54-
include_coder_system_prompt = true
56+
# Configure Coder's task reporting
57+
report_tasks = true
58+
report_tasks_system_prompt = true
5559
5660
# Optional: append additional system prompt.
5761
system_prompt = <<-EOT

registry/coder/modules/claude-code/main.tf

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -186,10 +186,11 @@ variable "system_prompt" {
186186
default = "Send a task status update to notify the user that you are ready for input, and then wait for user input."
187187
}
188188

189-
variable "include_coder_system_prompt" {
189+
variable "report_tasks_system_prompt" {
190190
type = bool
191-
description = "Include Coder system prompts for proper integration with tool selection and task reporting. Defaults to false for backward compatibility, will default to true in the next major release."
191+
description = "Include the Coder system prompt for task reporting when report_tasks is true. Defaults to false for backward compatibility, will default to true in the next major release."
192192
# TODO(major): default to true in the next major release
193+
# Related to PR: https://github.com/coder/registry/pull/443
193194
default = false
194195
}
195196

@@ -237,20 +238,10 @@ locals {
237238
module_dir_name = ".claude-module"
238239
remove_last_session_id_script_b64 = base64encode(file("${path.module}/scripts/remove-last-session-id.sh"))
239240

240-
# Required prompts for the module to properly integrate with Coder
241+
# Required prompts for the module to properly report task status to Coder
241242
inner_system_prompt = <<-EOT
242243
-- Tool Selection --
243244
- coder_report_task: providing status updates or requesting user input.
244-
- playwright: previewing your changes after you made them
245-
to confirm it worked as expected
246-
- desktop-commander - use only for commands that keep running
247-
(servers, dev watchers, GUI apps).
248-
- Built-in tools - use for everything else:
249-
(file operations, git commands, builds & installs, one-off shell commands)
250-
251-
Remember this decision rule:
252-
- Stays running? → desktop-commander
253-
- Finishes immediately? → built-in tools
254245
255246
-- Task Reporting --
256247
Report all tasks to Coder, following these EXACT guidelines:
@@ -267,7 +258,8 @@ locals {
267258

268259
custom_system_prompt = trimspace(try(var.system_prompt, ""))
269260

270-
final_system_prompt = var.include_coder_system_prompt ? format(
261+
# Only include coder system prompts if report_tasks and report_tasks_system_prompt are enabled
262+
final_system_prompt = var.report_tasks && var.report_tasks_system_prompt ? format(
271263
"<system>\n%s\n%s\n</system>",
272264
local.inner_system_prompt,
273265
local.custom_system_prompt,

registry/coder/modules/claude-code/main.tftest.hcl

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ run "test_claude_code_system_prompt_default" {
194194
variables {
195195
agent_id = "test-agent-system-prompt"
196196
workdir = "/home/coder/test"
197+
# report_tasks_system_prompt: default is false
197198
# system_prompt: default string is used
198-
# include_coder_system_prompt: default is false
199199
}
200200

201201
assert {
@@ -211,18 +211,18 @@ run "test_claude_code_system_prompt_default" {
211211
# Ensure Coder sections are not injected when include=false
212212
assert {
213213
condition = length(regexall("-- Tool Selection --|-- Task Reporting --", coder_env.claude_code_system_prompt.value)) == 0
214-
error_message = "Coder integration sections should not be present when include_coder_system_prompt is false"
214+
error_message = "Coder integration sections should not be present when report_tasks_system_prompt is false"
215215
}
216216
}
217217

218218
run "test_claude_code_system_prompt_empty" {
219219
command = plan
220220

221221
variables {
222-
agent_id = "test-agent-system-prompt"
223-
workdir = "/home/coder/test"
222+
agent_id = "test-agent-system-prompt"
223+
workdir = "/home/coder/test"
224+
# report_tasks_system_prompt: default is false
224225
system_prompt = ""
225-
# include_coder_system_prompt: default is false
226226
}
227227

228228
assert {
@@ -235,10 +235,10 @@ run "test_claude_code_system_prompt" {
235235
command = plan
236236

237237
variables {
238-
agent_id = "test-agent-system-prompt"
239-
workdir = "/home/coder/test"
238+
agent_id = "test-agent-system-prompt"
239+
workdir = "/home/coder/test"
240+
# report_tasks_system_prompt: default is false
240241
system_prompt = "Custom addition"
241-
# include_coder_system_prompt: default is false
242242
}
243243

244244
assert {
@@ -254,18 +254,19 @@ run "test_claude_code_system_prompt" {
254254
# Ensure Coder sections are not injected when include=false
255255
assert {
256256
condition = length(regexall("-- Tool Selection --|-- Task Reporting --", coder_env.claude_code_system_prompt.value)) == 0
257-
error_message = "Coder integration sections should not be present when include_coder_system_prompt is false"
257+
error_message = "Coder integration sections should not be present when report_tasks_system_prompt is false"
258258
}
259259
}
260260

261-
run "test_claude_code_include_coder_system_prompt_and_default_system_prompt" {
261+
run "test_claude_code_report_tasks_system_prompt_and_default_system_prompt" {
262262
command = plan
263263

264264
variables {
265265
agent_id = "test-agent-system-prompt"
266266
workdir = "/home/coder/test"
267+
# report_tasks: default is true
268+
report_tasks_system_prompt = true
267269
# system_prompt: default string is used
268-
include_coder_system_prompt = true
269270
}
270271

271272
assert {
@@ -289,14 +290,15 @@ run "test_claude_code_include_coder_system_prompt_and_default_system_prompt" {
289290
}
290291
}
291292

292-
run "test_claude_code_include_coder_system_prompt_and_custom_system_prompt" {
293+
run "test_claude_code_report_tasks_system_prompt_and_custom_system_prompt" {
293294
command = plan
294295

295296
variables {
296-
agent_id = "test-agent-system-prompt"
297-
workdir = "/home/coder/test"
298-
system_prompt = "Custom addition"
299-
include_coder_system_prompt = true
297+
agent_id = "test-agent-system-prompt"
298+
workdir = "/home/coder/test"
299+
# report_tasks: default is true
300+
report_tasks_system_prompt = true
301+
system_prompt = "Custom addition"
300302
}
301303

302304
assert {
@@ -314,6 +316,33 @@ run "test_claude_code_include_coder_system_prompt_and_custom_system_prompt" {
314316
error_message = "System prompt should have Task Reporting section"
315317
}
316318

319+
assert {
320+
condition = length(regexall("Custom addition", coder_env.claude_code_system_prompt.value)) > 0
321+
error_message = "System prompt should have system_prompt variable value"
322+
}
323+
}
324+
325+
run "test_claude_code_report_tasks_disabled" {
326+
command = plan
327+
328+
variables {
329+
agent_id = "test-agent-system-prompt"
330+
workdir = "/home/coder/test"
331+
report_tasks = false
332+
report_tasks_system_prompt = true
333+
system_prompt = "Custom addition"
334+
}
335+
336+
assert {
337+
condition = trimspace(coder_env.claude_code_system_prompt.value) != ""
338+
error_message = "System prompt should not be empty"
339+
}
340+
341+
assert {
342+
condition = length(regexall("-- Tool Selection --|-- Task Reporting --", coder_env.claude_code_system_prompt.value)) == 0
343+
error_message = "Coder integration sections should not be present when report_task is false"
344+
}
345+
317346
assert {
318347
condition = length(regexall("Custom addition", coder_env.claude_code_system_prompt.value)) > 0
319348
error_message = "System prompt should have system_prompt variable value"

0 commit comments

Comments
 (0)