Skip to content

feat: add workspace awareness system message on chat creation#23213

Merged
kylecarbs merged 1 commit intomainfrom
kylecarbs/workspace-awareness-system-message
Mar 18, 2026
Merged

feat: add workspace awareness system message on chat creation#23213
kylecarbs merged 1 commit intomainfrom
kylecarbs/workspace-awareness-system-message

Conversation

@kylecarbs
Copy link
Copy Markdown
Member

When a chat is created via chatd, a system message is now inserted informing the model whether the chat was created with or without a workspace.

With workspace:

This chat is attached to a workspace. You can use workspace tools like execute, read_file, write_file, etc.

Without workspace:

There is no workspace associated with this chat yet. Create one using the create_workspace tool before using workspace tools like execute, read_file, write_file, etc.

This is a model-only visibility system message (not shown to users) that helps the model understand its available capabilities upfront — particularly important for subagents spawned without a workspace, which previously would attempt to use workspace tools and fail.

Changes:

  • coderd/chatd/chatd.go: Added workspace awareness constants and inserted the system message in CreateChat after the system prompt, before the initial user message.
  • coderd/chatd/chatd_test.go: Added TestCreateChatInsertsWorkspaceAwarenessMessage with sub-tests for both with-workspace and without-workspace cases.

@kylecarbs kylecarbs requested a review from ethanndickson March 18, 2026 13:37
@kylecarbs kylecarbs marked this pull request as ready for review March 18, 2026 13:37
@kylecarbs kylecarbs force-pushed the kylecarbs/workspace-awareness-system-message branch from c9e090d to cacfeb3 Compare March 18, 2026 13:38
When a chat is created, a system message is now inserted informing the
model whether the chat was created with or without a workspace. This
helps the model understand its available capabilities upfront:

- With workspace: informs the model it can use workspace tools
- Without workspace: instructs the model to create a workspace first
@kylecarbs kylecarbs force-pushed the kylecarbs/workspace-awareness-system-message branch from cacfeb3 to c9ba52a Compare March 18, 2026 13:41
@kylecarbs kylecarbs enabled auto-merge (squash) March 18, 2026 13:41
@kylecarbs kylecarbs merged commit b83b93e into main Mar 18, 2026
45 of 47 checks passed
@kylecarbs kylecarbs deleted the kylecarbs/workspace-awareness-system-message branch March 18, 2026 14:01
@github-actions github-actions bot locked and limited conversation to collaborators Mar 18, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants