env field of settings.json to apply to every session.env field of settings.json, which automatically applies them to every session or rolls out configurations for the entire team.Environment Variable | Description |
CODEBUDDY_API_KEY | API key. Set this key for model API calls. In non-interactive mode ( -p), this key is always used. |
CODEBUDDY_AUTH_TOKEN | CodeBuddy platform authentication token used for all platform API calls. |
CODEBUDDY_CUSTOM_HEADERS | Custom HTTP request headers. Format: Name: Value, with multiple headers separated by line breaks or \\n |
Environment Variable | Description |
CODEBUDDY_BASE_URL | Overrides the API endpoint URL, typically used together with CODEBUDDY_API_KEY. |
CODEBUDDY_INTERNET_ENVIRONMENT | Network environment configuration ( internal for the China version, ioa for the iOA enterprise version) |
HTTP_PROXY / http_proxy | HTTP proxy server address |
HTTPS_PROXY / https_proxy | HTTPS proxy server address |
NO_PROXY / no_proxy | Domains and IPs that bypass the proxy (comma-separated, such as localhost,.example.com) |
Environment Variable | Description |
CODEBUDDY_MODEL | Override the default agent model |
CODEBUDDY_SMALL_FAST_MODEL | Override the model for the lite (lightweight and fast) scenario variant; takes precedence over the variantModels.lite setting. |
CODEBUDDY_BIG_SLOW_MODEL | Override the model for the reasoning (enhanced reasoning) scenario variant; takes precedence over the variantModels.reasoning setting. |
CODEBUDDY_CODE_SUBAGENT_MODEL | One-size-fits-all overrides the models of all built-in subagents (highest priority, overriding the subagents setting). To configure models independently for each subagent, use the /agents panel or subagents.agents.<subagent name>.model in settings.json instead. |
MAX_THINKING_TOKENS | Enable extended thinking and set the token budget for the thinking process. Disabled by default. |
CODEBUDDY_CODE_SUBAGENT_MODEL > the model input parameter of the current Agent tool call > project-level subagents > user-global subagents > product built-in declarations > the main model.variantModels > user-global variantModels > the main model's relatedModels > applicable product built-in defaults > the main model.CODEBUDDY_CODE_SUBAGENT_MODEL uniformly overrides all subagents. To specify them individually, use /agents or subagents.agents.<subagent name>.model. For details, see Subagent documentation.CODEBUDDY_SMALL_FAST_MODEL only affects lite, and CODEBUDDY_BIG_SLOW_MODEL only affects reasoning. The corresponding persistent settings can be managed through /model or variantModels. For details, see Settings documentation.Environment Variable | Description |
BASH_DEFAULT_TIMEOUT_MS | Default timeout for long-running bash commands (default: 120000) |
BASH_MAX_OUTPUT_LENGTH | Maximum number of characters of bash output retained in memory (default: 30000, upper limit: 150000). The excess portion is truncated in the middle (retaining head 20% + tail 80%), and the complete output is automatically saved to disk. |
BASH_MAX_TIMEOUT_MS | Maximum timeout that the model can set for long-running bash commands (default: 600000) |
CODEBUDDY_BASH_ASSISTANT_BUDGET_MS | Main conversation response budget (in milliseconds, default 0=disabled). When set to >0, foreground Bash/PowerShell commands in the main session that exceed this duration are automatically converted to background tasks to keep the conversation responsive. Sub-agents are not affected by this budget. Aligns with Claude Code's ASSISTANT_BLOCKING_BUDGET_MS (CC official default value 15000). |
CODEBUDDY_BASH_AUTO_BACKGROUND_DISABLED | Set to 1 to disable automatic backgrounding on timeout. Foreground commands revert to the old SIGTERM/kill hard termination behavior upon timeout. Use only for debugging or temporary rollback when encountering regressions; keep the default (unset) in normal scenarios. |
CODEBUDDY_BASH_BG_MAX_OUTPUT_BYTES | Total byte limit for stdout+stderr files written to disk by background bash tasks (default 52428800 = 50 MB). When the limit is exceeded, the size watchdog triggers SIGKILL and marks the task as killed, and a notice is injected at the end of stderr. Claude Code hardcodes the same threshold as a constant in ShellCommand.ts, while here it is exposed as an env variable for Ops to adjust. Effective only in file fd mode (in pipe mode, child process output is not written to disk). |
CODEBUDDY_BASH_BG_PIPE_MODE | Set to 1 to force background tasks back to pipe mode (not using file fd), for rollback or debugging. By default (unset), file fd mode is used, which resolves the zombie process issue caused by grandchild processes of commands such as nohup holding the parent pipe fd. The sandbox path automatically falls back to pipe and does not require explicit configuration. Claude Code has no equivalent switch; this is a fallback in codebuddy for compatibility with legacy sandbox/PTY paths. |
Environment Variable | Description |
CODEBUDDY_TOOL_RESULT_THRESHOLD_KB | Size threshold (KB) for externalizing tool results. Non-bash tool results exceeding this threshold are saved to disk and replaced with a placeholder (default: 50). |
BASH_MAX_OUTPUT_LENGTH. When the output exceeds this value and is truncated, the complete output is automatically streamed to disk. CODEBUDDY_TOOL_RESULT_THRESHOLD_KB primarily affects the handling of large outputs from other tools, such as MCP tools. For details, see the Tool Output Externalization section.Environment Variable | Description |
CODEBUDDY_DISABLE_HOT_RELOAD | Set to 1 to disable the hot reload system. |
CODEBUDDY_SKIP_BUILTIN_MARKETPLACE | Set to 1 to skip loading the built-in plugin marketplace. |
CODEBUDDY_AUTO_UPDATE_THIRD_PARTY_MARKETPLACES | Set to true or 1 to enable automatic updates for third-party plugin marketplaces (default: disabled). |
CODEBUDDY_MARKETPLACE_AUTO_UPDATE_INTERVAL_MS | Overrides the refresh window for automatic plugin marketplace updates (in milliseconds). Default: 86400000 (24 hours). Setting a smaller value (such as 3600000, or 1 hour) shortens the automatic update detection interval for easier testing/debugging. Invalid values (non-numeric or less than or equal to 0) fall back to the default value. |
CODEBUDDY_PLUGIN_DIRS | A colon-separated list of local plugin directory paths (equivalent to --plugin-dir). The bin/ directory of a plugin is automatically injected into PATH. |
CODEBUDDY_DISABLE_EXTENDED_PLUGIN_HOOKS | When set to 1 or true, plugin Hook configurations accept only the command type. Configurations containing the prompt, agent, or http type are treated as incompatible. This is used by hosts to temporarily fall back the plugin Hook contract. By default, it is not set. |
CODEBUDDY_IMAGE_GEN_ENABLED | Set to false or 0 to disable the image generation feature. |
CODEBUDDY_IMAGE_EDIT_ENABLED | Set to false or 0 to disable the image editing feature. |
CODEBUDDY_ARTIFACT_ENABLED | Set to false or 0 to disable the Artifact / ArtifactControl tools (publish a local HTML or Markdown file as a shareable public link, with Markdown rendered by the server into a styled page; ArtifactControl currently supports only unpublishing). Enabled by default. Determination order: On international endpoints (codebuddy.ai / workbuddy.ai / staging-codebuddy.tencent.com), this capability is always disabled and cannot be overridden by this variable. In other scenarios, this variable has the highest priority. When it is not set (including empty values), the system falls back to the legacy variable CODEBUDDY_SHARE_LINK_ENABLED, and then to the cloud-side productFeatures (if either Artifact or ShareLink is explicitly false, the capability is disabled; if neither is delivered, it defaults to true). |
CODEBUDDY_SHARE_LINK_ENABLED | Deprecated (retained for compatibility): the former name of CODEBUDDY_ARTIFACT_ENABLED, used as the switch before the ShareLink tool was renamed to Artifact. The semantics are identical to the new variable, which takes precedence; this variable takes effect only when the new variable is not set. |
CODEBUDDY_COMPUTER_USE_ENABLED | Experimental feature: set to true or 1 to enable the macOS desktop control tool (screenshot, mouse, and keyboard). Available only on macOS and disabled by default. When keyboard/mouse actions are invoked for the first time, the terminal must be authorized in System Settings → Privacy & Security → Accessibility and Screen Recording. |
CODEBUDDY_PUSH_NOTIFICATION_ENABLED | Set to false or 0 to disable the PushNotification tool (the model can proactively trigger a terminal/desktop notification when a long-running/background task completes). Enabled by default. |
CODEBUDDY_REPORT_FINDINGS_ENABLED | Set to false or 0 to disable the ReportFindings tool (used by code review agents to submit discovered issues as structured fields, which are rendered as a dedicated list component). Enabled by default. |
CODEBUDDY_WAIT_FOR_MCP_SERVERS_ENABLED | Set to 0 or false to disable the WaitForMcpServers tool. Enabled by default. In interactive mode, it does not block waiting for MCP connections. When the LLM needs an MCP tool that is not yet ready, it can proactively call this tool to wait on demand. In WorkBuddy scenarios, set to 0 to disable it. |
CODEBUDDY_DEFERRED_TOOLS_MCP_READY_WAIT_MS | The maximum number of milliseconds to wait for MCP servers to be ready before deferred tool descriptions are rendered. Defaults to 2500. Set to 0 to skip waiting entirely; with slower connections, the "still connecting" notice is immediately baked into the description. Increasing the value gives remote MCP servers more time to complete the handshake before the first prompt. Once a server is ready, processing continues immediately; the timeout only serves as an upper limit. |
CODEBUDDY_DEFER_TOOL_LOADING | Set to false or 0 to disable deferred loading of MCP tools. |
CODEBUDDY_SHOW_ALL_DEFERRED_TOOLS | Set to true or 1 to display the full descriptions of all deferred tools. |
CODEBUDDY_DISABLE_CRON | Set to 1 to disable scheduled tasks. |
CODEBUDDY_DISABLE_FORK_SUBAGENT | Set to 1 to disable the Fork subagent mode of the Agent tool (subagent_type="fork"). After it is enabled, the Agent tool description automatically hides the fork-mode section, and the model does not see this feature. If the model still passes subagent_type="fork", the runtime falls back to the custom agent named fork (if the user has defined it in .codebuddy/agents/fork.md); otherwise, it is rewritten to the general-purpose regular subagent. This applies to host scenarios where fork recursive spawning must be avoided to prevent request amplification. |
CODEBUDDY_CODE_DISABLE_BACKGROUND_TASKS | Set to 1 / true to disable background tasks for the Agent, Bash, and PowerShell tools (run_in_background=true). After it is enabled, the run_in_background parameter in the schemas of these tools is hidden, and the model does not see this field. Even if historical or cached tool calls or direct callers pass this parameter, the runtime falls back to the synchronous (Agent) / foreground (Bash, PowerShell) execution path. This applies to request-response SDK / one-shot task scenarios, where the main process exits immediately after the main turn ends, and the results of any background agents or background commands cannot flow back into the final response. It aligns with Claude Code's CLAUDE_CODE_DISABLE_BACKGROUND_TASKS (which also governs Agent + Bash + PowerShell). Not set by default (background tasks remain available). It is independent of the print-mode guard (background execution is always blocked under -p). |
CODEBUDDY_REHYDRATE_IMAGE_BLOB_REFS | Set to true to restore image blob references to full base64 data in -p mode streaming output. This applies to downstream integration scenarios that need to directly obtain image data. |
Environment Variable | Description |
CODEBUDDY_AUTOCOMPACT_PCT_OVERRIDE | Sets the context capacity percentage (1-100) that triggers automatic compaction. The default value is determined by the product configuration (typically 70-92%). Use a lower value (such as 50) to compact earlier. |
CODEBUDDY_PRE_MESSAGE_COMPACT | Force controls the pre-message compaction switch. true/1 enables it, and false/0 disables it. The priority is higher than the enablePreMessageCompact and ContextSummaryAgent switches in the product configuration. |
CODEBUDDY_PRE_MESSAGE_COMPACT_PCT | Sets the context capacity percentage (1-100) for pre-check compaction before a user sends a message. The default value is 10%. When the context exceeds this threshold, automatic compaction is performed before a new user message is processed. |
CODEBUDDY_DISABLE_AUTO_MEMORY | Set to 1 to disable automatic memory, and set to 0 to enable it. |
CODEBUDDY_MEMORY_ENABLED | Set to true or 1 to enable the memory feature. |
CODEBUDDY_TYPED_MEMORY_ENABLED | Set to true or 1 to enable typed memory mode. |
CODEBUDDY_TEAM_MEMORY_ENABLED | Set to true or 1 to enable team memory mode. |
CODEBUDDY_USER_ID | User ID in team memory mode |
Environment Variable | Description |
MCP_TIMEOUT | Timeout for MCP server connection in milliseconds |
MCP_TOOL_TIMEOUT | Timeout for MCP tool execution in milliseconds |
MAX_MCP_OUTPUT_TOKENS | Maximum tokens allowed in MCP tool responses (default: 20000) |
CODEBUDDY_DISABLE_MCP_LARGE_OUTPUT_FILES | When set to 1, oversized MCP responses are not written to disk (the ~/.codebuddy/projects/.../tool-results/ file is skipped), and content truncation fallback is always used. |
Environment Variable | Description |
CODEBUDDY_CODE_MAX_OUTPUT_TOKENS | Set the maximum output tokens for most requests. |
CODEBUDDY_CODE_FILE_READ_MAX_OUTPUT_TOKENS | Override the default token limit for file reads (default: 20000). |
CODEBUDDY_STREAM_TIMEOUT_MS | Maximum allowed silence between two data chunks in a streaming response, in milliseconds. Defaults to 300000, which is 5 minutes. Silence after token streaming has started usually indicates a broken connection, so this timeout is decoupled from the first token timeout and set to a shorter threshold. |
CODEBUDDY_FIRST_TOKEN_TIMEOUT_MS | Maximum time to wait for the first model output, in milliseconds. Defaults to 1200000, which is 20 minutes. Slow first token generation during long-context prefill is expected. |
CODEBUDDY_MAX_RETRIES | Maximum number of exponential backoff retries for model requests that fail before generation starts (429 / 5xx / request timeout / lock timeout). Defaults to 8, with an upper limit of 15, and automatically converges when the limit is exceeded. Retries use exponential backoff + jitter and respect the server retry-after header. They occur strictly before streaming content is produced and never resend content that has already been produced. Quota-exhaustion errors are not retried and are handled by model fallback instead. |
CODEBUDDY_RETRY_WATCHDOG | Set to 1 / true / yes to enable unlimited retry mode for unattended / CI scenarios. This mode applies only to the failures that occur before generation starts, with each backoff capped at 5 minutes. Disabled by default. |
CODEBUDDY_SESSION_MAX_ITEMS | Maximum number of historical messages to replay during session/load. Defaults to 1000. Stops reading JSONL in reverse order when the threshold is reached and a user message is encountered. Increase this value when very long sessions need to be supported, for example, 2000 or more in sandbox scenarios. Zero, negative, or non-numeric values fall back to the default value. |
Environment Variable | Description |
CODEBUDDY_CONFIG_DIR | Location for custom CodeBuddy Code configuration and data files |
CODEBUDDY_CODE_DEBUG_LOGS_DIR | Debug log directory |
CODEBUDDY_SANDBOX_IMAGE | Container sandbox image (default: node:20-alpine) |
USE_BUILTIN_RIPGREP | Set to 0 to use the system-installed rg instead of the rg bundled with CodeBuddy Code. |
Environment Variable | Description |
CODEBUDDY_CODE_SHELL | Overrides automatic shell detection. Supported values: bash, zsh, sh, powershell |
CODEBUDDY_CODE_SHELL_PREFIX | Command prefix that wraps all shell commands (for example, for logging or auditing) |
CODEBUDDY_CODE_GIT_BASH_PATH | Explicitly specifies the Git Bash path on Windows. Startup fails if the specified path is invalid. |
CODEBUDDY_SKIP_GIT_BASH_CHECK | Set to 1 to skip Windows Git Bash detection and prompts at startup (applicable when the shell is managed upstream). |
CODEBUDDY_POWERSHELL_PATH | Explicitly specify the PowerShell executable path (taking precedence over automatic detection). |
CODEBUDDY_USE_POWERSHELL_TOOL | Controls the PowerShell tool enablement status. Enabled by default on Windows. Set to 0 to disable it. |
CODEBUDDY_ENV_FILE | Path of the environment file that is automatically sourced before each shell command is executed |
CODEBUDDY_DISABLE_SHELL_SNAPSHOT | Set to 1 to disable shell environment snapshots on all platforms (effective when bash profile loading is slow). |
CODEBUDDY_ENABLE_SHELL_SNAPSHOT | snapshot is skipped by default when Git Bash is not available on Windows. Set to 1 to force enable it (usually not needed). |
Environment Variable | Description |
CODEBUDDY_CODE_DISABLE_TERMINAL_TITLE | Set to 1 to disable automatic terminal title updates. |
CODEBUDDY_INCLUDE_PROMPT_SUGGESTION | Explicitly enable prompt suggestions, overriding the headless default disable and the promptSuggestionEnabled=false configuration. |
CODEBUDDY_PROMPT_SUGGESTION_DISABLED | Set to 1 / true to disable prompt suggestions, with higher priority than CODEBUDDY_INCLUDE_PROMPT_SUGGESTION. |
IS_DEMO | Set to true to enable demo mode: hide email and organization. |
Environment Variable | Description |
CODEBUDDY_CODE_CLIENT_CERT | mTLS client certificate file path Note: Not yet supported. |
CODEBUDDY_CODE_CLIENT_KEY | mTLS client private key file path Note: Not yet supported. |
CODEBUDDY_CODE_CLIENT_KEY_PASSPHRASE | Password for the mTLS encrypted private key (optional) Note: Not yet supported. |
Environment Variable | Description |
DISABLE_TELEMETRY | Set to 1 to disable telemetry. |
DISABLE_ERROR_REPORTING | Set to 1 to disable error reporting. |
DISABLE_AUTOUPDATER | Set to 1 to disable automatic updates. |
DISABLE_FEEDBACK_COMMAND | Set to 1 to disable the /feedback command. |
Environment Variable | Description |
CODEBUDDY_CODE_ENABLE_TELEMETRY | Set to 1 to enable OTel custom reporting; for compatibility with customers migrating from Claude Code, CLAUDE_CODE_ENABLE_TELEMETRY also takes effect. |
OTEL_TRACES_EXPORTER | otlp (default) / console (output to logs for debugging) / none (disable) |
OTEL_EXPORTER_OTLP_ENDPOINT | Generic OTLP endpoint. The tool automatically appends /v1/traces. |
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT | Dedicated endpoint for traces, used as a complete URL, with higher priority than the generic variable. |
OTEL_EXPORTER_OTLP_HEADERS | OTLP request headers in the format k1=v1,k2=v2, with URL encoding supported for values. |
OTEL_EXPORTER_OTLP_TRACES_HEADERS | Dedicated request headers for traces, with higher priority than the generic variable. |
OTEL_EXPORTER_OTLP_PROTOCOL | Only http/protobuf is supported (default); other values (such as grpc and http/json) fall back and trigger an alarm. |
OTEL_SERVICE_NAME | Override the default service.name |
OTEL_RESOURCE_ATTRIBUTES | Resource attributes in the format k1=v1,k2=v2, which are merged into the trace resource. |
DISABLE_TELEMETRY=1, OTel reporting is disabled regardless of how the above variables are set.Environment Variable | Description |
CODEBUDDY_DISABLE_BACKGROUND_TASKS | Set to 1 to disable all background task features. |
Environment Variable | Description |
CODEBUDDY_DAEMON_ALLOW_SLEEP | Set to 1 or true to disable the anti-sleep feature of the daemon (allowing the system to enter idle sleep normally). Automatic reconnection after wake-up is not affected. |
CODEBUDDY_DAEMON_AUTO_CONNECT_CHANNELS | Set to 0 or false to disable automatic connection to WeChat/WeCom channels when the daemon starts. Alternatively, configure daemonAutoConnectChannels: false in settings.json. For a single instance, set autoConnect: false in instances.json. |
CODEBUDDY_DAEMON_RESTORE_CHANNELS | Set by the system when the daemon automatically restarts, containing the list of channels to restore (comma-separated, such as wechat:abc,wecom:default). Users typically do not need to set this manually. |
Environment Variable | Description |
CODEBUDDY_CODE_MAX_TURNS | Maximum execution turns of the main Agent. Priority: CLI --max-turns > this environment variable > default value (500). |
CODEBUDDY_CODE_SUBAGENT_MAX_TURNS | Maximum execution turns of the subagent. Priority: CLI --max-turns > this environment variable > max_turns dynamically passed by the model > default value (500). |
CODEBUDDY_CODE_MAX_SUBAGENTS_PER_SESSION | Maximum subagent spawn budget per session (a positive integer, default 200, adjustable up or down, and cannot be disabled). Nested spawns share the same budget. When the limit is exceeded, the Agent tool returns an error and prompts the model to use its own tools to complete the remaining work. The budget is reset after a new session is created with /clear. |
CODEBUDDY_CODE_DISABLE_AUTO_MEMORY | Set to a truthy value to disable agent-level persistent memory. The frontmatter memory field no longer injects the memory section. By default, it is not set, which means the feature is enabled. |
CODEBUDDY_SUBAGENT_PERMISSION_MODE | Default permission mode for subagents/team members (such as bypassPermissions, acceptEdits, default, and plan). Priority: mode parameter of the Agent tool > CLI --subagent-permission-mode > this environment variable > Settings permissions.subagentPermissionMode > default value in the mapping table. |
CODEBUDDY_TEAM_IDLE_DETECTION_DISABLED | Set to 1 to disable team member idle detection (enabled by default). After it is disabled, APIs of the "wait for team member idle" type immediately return true without blocking, and progress snapshots are no longer recorded. |
CODEBUDDY_TEAM_SHUTDOWN_GRACEFUL_TIMEOUT_MS | Fallback timeout in milliseconds for graceful shutdown of team members, default 15000. If no response is received from a team member after this duration, the process is forcibly terminated. Set to 0 to disable the forced fallback (wait for response only). |
Environment Variable | Description |
CODEBUDDY_GATEWAY_AUTH | Gateway authentication mode ( password or none). Has the highest priority and overrides --auth and the settings gateway.auth. --serve defaults to password; setting it to none disables authentication, in which case any process on the same machine can run commands and read or write files through this service, so this is recommended only for isolated environments or CI use. |
CODEBUDDY_GATEWAY_PASSWORD | Gateway access password. If not set, a random password is automatically generated and written to settings on first startup. |
CODEBUDDY_GATEWAY_FORCE_TUNNEL | Set to 1 to force tunnel mode. |
CODEBUDDY_DISABLE_REQUEST_VALIDATION | Set to 1 to disable Gateway custom request header validation (X-CodeBuddy-Request). For details, see HTTP API Security. |
CODEBUDDY_CODE_CORS_ORIGINS | Additional allowed CORS origins (comma-separated). Supports exact origins, *.domain subdomain wildcards, and * to allow all. For example, https://*.example.com,https://specific.com. If not set and the service is bound to 0.0.0.0 (--host 0.0.0.0), all origins are automatically allowed. |
SERVER__HOST | Listening address in --serve mode (default: 127.0.0.1) |
SERVER__PORT | Listening port in --serve mode. When set to 0, the kernel selects a port automatically, and this variable is updated to the actual listening port after the service is bound. |
Environment Variable | Description |
CODEBUDDY_GATEWAY_WECHAT_KF_TOKEN | WeCom Customer Service Token |
CODEBUDDY_GATEWAY_WECHAT_KF_ENCODING_AES_KEY | WeCom Customer Service Encryption Key |
CODEBUDDY_GATEWAY_WECHAT_KF_CORP_ID | WeCom Customer Service Corp ID |
CODEBUDDY_GATEWAY_WECHAT_KF_CORP_SECRET | WeCom Customer Service Corp Secret |
CODEBUDDY_GATEWAY_WECHAT_KF_ACCOUNT_NAME | WeCom Customer Service Account Name |
CODEBUDDY_GATEWAY_WECOM_TOKEN | WeCom Token |
CODEBUDDY_GATEWAY_WECOM_ENCODING_AES_KEY | WeCom Encryption Key |
CODEBUDDY_GATEWAY_WECOM_CORP_ID | WeCom Corp ID |
CODEBUDDY_GATEWAY_WECOM_CORP_SECRET | WeCom Corp Secret |
CODEBUDDY_GATEWAY_WECOM_AGENT_ID | WeCom App ID |
Environment Variable | Description |
CODEBUDDY_CHANNEL_AUTO_CONNECT | Set to 1 or true to automatically connect all configured channels (WeCom + WeChat) at startup. |
CODEBUDDY_WECOM_AUTO_CONNECT | Set to 1 or true to automatically connect all configured WeCom bot instances at startup. |
CODEBUDDY_WECHAT_AUTO_CONNECT | Set to 1 or true to automatically connect all configured WeChat bot instances at startup. |
CODEBUDDY_WECOM_BOT_ID | WeCom AI Assistant Bot ID. After configuration, a default instance is automatically created and appears in the /remote-control list. |
CODEBUDDY_WECOM_BOT_SECRET | WeCom AI Assistant Secret. Must be used together with CODEBUDDY_WECOM_BOT_ID. |
CODEBUDDY_CHANNEL_AUTO_CONNECT is the unified switch, while CODEBUDDY_WECOM_AUTO_CONNECT and CODEBUDDY_WECHAT_AUTO_CONNECT are type-specific switches. The feature takes effect when any of the three matches. It applies to all modes, including interactive, --serve, and daemon.Environment Variable | Description |
CODEBUDDY_DEBUG | Set to 1/true/yes/on to enable debug mode (equivalent to --debug). |
CODEBUDDY_DEBUG_SDK | Set to 1/true/yes/on to enable SDK debugging. |
CODEBUDDY_DEBUG_REQUEST | Set to 1 to enable request debugging. |
CODEBUDDY_STARTUP_PROFILE | Set to 1 to enable startup performance profiling. |
CODEBUDDY_CODE_HEAP_SNAPSHOT_NEAR_LIMIT_PCT | OOM forensics (disabled by default). When OOM forensics is enabled, if the process heap exceeds the V8 heap upper-limit high watermark, a heap snapshot is automatically written to ~/.codebuddy/diagnostics/<date>/oom-nearlimit-<pid>-<ts>.heapsnapshot (written only once per process). Values: on/true/1 uses the default 85% watermark; 0.9 or 90 sets a custom watermark; unset / 0 / off / false disables it.Note: A snapshot file is approximately 1.5 times the heapUsed value at the time of capture, and a GB-level heap can produce a file of several GB. Enable it only when troubleshooting OOM issues. |
CBC_HEAP_SNAPSHOT_ON_WORKFLOW_END | When this option is set to 1, a heap snapshot is written to ~/.codebuddy/diagnostics/<date>/ after each workflow (such as ultracode) finishes. Disabled by default (as it consumes disk space). Enable it only when troubleshooting residual memory in workflows. |
Environment Variable | Description |
CODEBUDDY_RECORD_DIR | Recording mode: specifies the directory for saving recording files. After set, model responses will be saved to the recording.jsonl file in this directory. |
CODEBUDDY_REPLAY_DIR | Replay mode: specifies the directory for reading recording files. After set, responses are replayed from recording.jsonl without the need for a real API. |
CODEBUDDY_REPLAY_SPEED | Replay speed multiplier. 0 means returning immediately without delay, and 1 means replaying at the original time interval (default: 1). |
CODEBUDDY_REPLAY_STRICT | Set to 1 to enable strict mode: throw an error when recordings are exhausted instead of passing through to the real API. |
CODEBUDDY_RECORD_DIR and CODEBUDDY_REPLAY_DIR are mutually exclusive and cannot be set at the same time.Environment Variable | Description |
SLASH_COMMAND_TOOL_CHAR_BUDGET | Maximum number of characters for slash command tool metadata (default: 15000) |
CODEBUDDY_CODE_API_KEY_HELPER_TTL_MS | Interval for refreshing credentials in milliseconds (default: 300000) |
# Set the API keyexport CODEBUDDY_API_KEY="your-api-key"# Set the proxy serverexport HTTP_PROXY="http://proxy.example.com:8080"export HTTPS_PROXY="https://proxy.example.com:8080"# Set the proxy bypass listexport NO_PROXY="localhost,127.0.0.1,.internal.example.com"# Set custom request headers (separate multiple headers with \\n)export CODEBUDDY_CUSTOM_HEADERS="X-Custom-Header: value1\\nX-Another-Header: value2"# Start CodeBuddycodebuddy
# Use a custom API endpointexport CODEBUDDY_API_KEY="your-api-key"export CODEBUDDY_BASE_URL="https://api.example.com/v1"codebuddy --model your-model-name
models.json are required:# Endpoints and keysexport CODEBUDDY_BASE_URL="https://api.deepseek.com"export CODEBUDDY_API_KEY="<your-deepseek-api-key>"# Default model for the main Agentexport CODEBUDDY_MODEL="deepseek-v4-pro"# Large model for complex reasoningexport CODEBUDDY_BIG_SLOW_MODEL="deepseek-v4-pro"# Small model for background or lightweight tasksexport CODEBUDDY_SMALL_FAST_MODEL="deepseek-v4-flash"# Unified coverage of all subagents at the Ops level.# If not set, the system continues to use single-call mode, per-subagent settings, and built-in product orchestration.export CODEBUDDY_CODE_SUBAGENT_MODEL="deepseek-v4-flash"# You can explicitly specify the main model at startup by using --model.codebuddy --model deepseek-v4-pro
env field of settings.json and are automatically applied to each session, facilitating unified configuration across the team.# Set the China edition environment identifierexport CODEBUDDY_INTERNET_ENVIRONMENT=internal# Set the API keyexport CODEBUDDY_API_KEY="your-api-key"# Start CodeBuddycodebuddy
# Enable automatic memoryexport CODEBUDDY_DISABLE_AUTO_MEMORY="0"# Enable extended thinkingexport MAX_THINKING_TOKENS="10000"# Run in non-interactive modecodebuddy -p -y "Your query"
# Enable debug modeexport CODEBUDDY_DEBUG="1"# Enable startup performance analysisexport CODEBUDDY_STARTUP_PROFILE="1"# Start CodeBuddycodebuddy
env field of settings.json:{"env": {"CODEBUDDY_API_KEY": "your-api-key","HTTPS_PROXY": "https://proxy.example.com:8080","MAX_THINKING_TOKENS": "10000","CODEBUDDY_DISABLE_AUTO_MEMORY": "0"}}
Shell output├─→ OutputSpiller (streams the complete output to disk)└─→ TruncateBuffer (retains head + tail in memory, approximately 30 KB)↓When truncation is detected, a placeholder is generated (approximately 2 KB preview + file path).↓When the model receives a placeholder, it can read the complete file on demand through the Read tool.
Phase | Content | Size |
Disk file (OutputSpiller) | Complete Original Output | 1,355,099 bytes |
Memory Buffer (TruncateBuffer) | head 6KB + tail 24KB | ~30KB |
Send to Model (placeholder) | File path + preview | ~2KB |
~/.codebuddy/projects/{projectDir}/└── {sessionId}/├── tool-results/ ← Tool results for the main session│ ├── {callId}.txt│ └── ...└── subagents/ ← Subagent data├── agent-{agentId}.jsonl ← Subagent conversation history└── agent-{agentId}/└── tool-results/ ← Tool results for the subagent├── {callId}.txt└── ...
Environment Variable | Impact Scope | Default Value |
BASH_MAX_OUTPUT_LENGTH | Memory retention limit of the Bash tool. When the memory retention limit is exceeded, the output is truncated and disk externalization is triggered. | 30000 |
CODEBUDDY_TOOL_RESULT_THRESHOLD_KB | Externalization threshold at the session layer for non-Bash tools (such as MCP) | 50 |
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback