| display_name | Claude Code | ||
|---|---|---|---|
| description | Run Claude Code in your workspace | ||
| icon | ../.icons/claude.svg | ||
| maintainer_github | coder | ||
| verified | true | ||
| tags |
|
Run the Claude Code agent in your workspace to generate code and perform tasks.
module "claude-code" {
source = "registry.coder.com/modules/claude-code/coder"
version = "1.2.1"
agent_id = coder_agent.example.id
folder = "/home/coder"
install_claude_code = true
claude_code_version = "latest"
}- Node.js and npm must be installed in your workspace to install Claude Code
- Either
screenortmuxmust be installed in your workspace to run Claude Code in the background - You must add the Coder Login module to your template
The codercom/oss-dogfood:latest container image can be used for testing on container-based workspaces.
This functionality is in early access as of Coder v2.21 and is still evolving. For now, we recommend testing it in a demo or staging environment, rather than deploying to production
Learn more in the Coder documentation
Join our Discord channel or contact us to get help or share feedback.
Your workspace must have either screen or tmux installed to use this.
variable "anthropic_api_key" {
type = string
description = "The Anthropic API key"
sensitive = true
}
module "coder-login" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/modules/coder-login/coder"
version = "1.0.15"
agent_id = coder_agent.example.id
}
data "coder_parameter" "ai_prompt" {
type = "string"
name = "AI Prompt"
default = ""
description = "Write a prompt for Claude Code"
mutable = true
}
# Set the prompt and system prompt for Claude Code via environment variables
resource "coder_agent" "main" {
# ...
env = {
CODER_MCP_CLAUDE_API_KEY = var.anthropic_api_key # or use a coder_parameter
CODER_MCP_CLAUDE_TASK_PROMPT = data.coder_parameter.ai_prompt.value
CODER_MCP_APP_STATUS_SLUG = "claude-code"
CODER_MCP_CLAUDE_SYSTEM_PROMPT = <<-EOT
You are a helpful assistant that can help with code.
EOT
}
}
module "claude-code" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/modules/claude-code/coder"
version = "1.1.0"
agent_id = coder_agent.example.id
folder = "/home/coder"
install_claude_code = true
claude_code_version = "0.2.57"
# Enable experimental features
experiment_use_screen = true # Or use experiment_use_tmux = true to use tmux instead
experiment_report_tasks = true
}Run Claude Code as a standalone app in your workspace. This will install Claude Code and run it directly without using screen or any task reporting to the Coder UI.
module "claude-code" {
source = "registry.coder.com/modules/claude-code/coder"
version = "1.2.1"
agent_id = coder_agent.example.id
folder = "/home/coder"
install_claude_code = true
claude_code_version = "latest"
# Icon is not available in Coder v2.20 and below, so we'll use a custom icon URL
icon = "https://registry.npmmirror.com/@lobehub/icons-static-png/1.24.0/files/dark/claude-color.png"
}