@@ -27,7 +27,9 @@ module "claude-code" {
2727
2828## Prerequisites
2929
30- - An ** Anthropic API key** is required for tasks. You can get one from the [ Anthropic Console] ( https://console.anthropic.com/dashboard ) .
30+ - An ** Anthropic API key** or a _ Claude Session Token_ is required for tasks.
31+ - You can get the API key from the [ Anthropic Console] ( https://console.anthropic.com/dashboard ) .
32+ - You can get the Session Token using the ` claude setup-token ` command. This is a long-lived authentication token (requires Claude subscription)
3133
3234## Examples
3335
@@ -36,9 +38,9 @@ module "claude-code" {
3638This example shows how to configure the Claude Code module with a task prompt, API key, and other custom settings.
3739
3840``` tf
39- data "coder_parameter" "task_prompt " {
41+ data "coder_parameter" "ai_prompt " {
4042 type = "string"
41- name = "AI Task Prompt"
43+ name = "AI Prompt"
4244 default = ""
4345 description = "Initial task prompt for Claude Code."
4446 mutable = true
@@ -50,24 +52,20 @@ module "claude-code" {
5052 agent_id = coder_agent.example.id
5153 workdir = "/home/coder/project"
5254
53- # --- Authentication --- required for tasks
55+ # --- Authentication --- ( required for tasks)
5456 claude_api_key = "xxxx-xxxxx-xxxx"
5557 # OR
5658 claude_code_oauth_token = "xxxxx-xxxx-xxxx"
5759
58- # --- Versioning ---
5960 claude_code_version = "1.0.82" # Pin to a specific version
6061 agentapi_version = "v0.6.1"
6162
62- # --- Task Configuration ---
63- task_prompt = data.coder_parameter.task_prompt.value
63+ task_prompt = data.coder_parameter.ai_prompt.value
6464 continue = true # will fail in a new workspace with no conversation/session to continue
6565 model = "sonnet"
6666
67- # --- Permissions & Tools ---
6867 permission_mode = "plan"
6968
70- # --- MCP Configuration ---
7169 mcp = <<-EOF
7270 {
7371 "mcpServers": {
@@ -83,7 +81,7 @@ module "claude-code" {
8381
8482### Standalone Mode
8583
86- Run Claude Code as a standalone CLI in your workspace without task reporting to the Coder UI .
84+ Run and configure Claude Code as a standalone CLI in your workspace.
8785
8886``` tf
8987module "claude-code" {
@@ -98,32 +96,6 @@ module "claude-code" {
9896}
9997```
10098
101- ## Environment Variables
102-
103- The module can be further configured using environment variables set on the Coder agent. This allows for more advanced or dynamic setups.
104-
105- | Variable | Description | Default |
106- | -------------------------------- | ------------------------------------------------------------- | ------------------------------ |
107- | ` CLAUDE_API_KEY ` | Your Anthropic API key. | ` "" ` |
108- | ` CODER_MCP_CLAUDE_SYSTEM_PROMPT ` | A custom system prompt for Claude. | "Send a task status update..." |
109- | ` CODER_MCP_CLAUDE_CODER_PROMPT ` | A custom coder prompt for Claude. | ` "" ` |
110- | ` CODER_MCP_CLAUDE_CONFIG_PATH ` | Path to the Claude configuration file. | ` ~/.claude.json ` |
111- | ` CODER_MCP_CLAUDE_MD_PATH ` | Path to a ` CLAUDE.md ` file for project-specific instructions. | ` ~/.claude/CLAUDE.md ` |
112-
113- An example of setting these on a ` coder_agent ` resource:
114-
115- ``` tf
116- resource "coder_agent" "main" {
117- # ... other agent config
118- env = {
119- CLAUDE_API_KEY = var.anthropic_api_key
120- CODER_MCP_CLAUDE_SYSTEM_PROMPT = <<-EOT
121- You are a helpful assistant that can help with code.
122- EOT
123- }
124- }
125- ```
126-
12799## Troubleshooting
128100
129101If you encounter any issues, check the log files in the ` ~/.claude-module ` directory within your workspace for detailed information.
0 commit comments