Coding Agents
Overview
Coding agents are powerful new tools in planning, developing, debugging, and executing code. As opposed to traditional chatbots, which are limited by their inability to execute commands, coding agents such as OpenCode, are more autonomous and can execute commands on behalf of users. So instead of executing commands in the terminal directly, prompts are given to the agent, which executes commands in the background.
Most importantly for CHPC users, coding agents on the CHPC can write code and run slurm commands including submitting batch jobs. Thus, coding agents provide a single resource for developing pipelines.
At present, coding agents should only be used in the General Environment, as interactions with the agent may transmit prompts, code, or data to external systems outside the Protected Environment (PE).
OpenCode
OpenCode is an open-source text user interface (TUI) application that runs coding agents, similar to the TUI versions Claude Code and Codex. It is primarily a front-end application that can connect to a variety of LLM models as described below.
Connecting to models:
- CHPC-hosted Qwen3-Coder-Next - By default, OpenCode uses the Qwen3-Coder-Next model which is hosted on a server run the CHPC. This is a free resource that is available to users. In contrast to the proprietary applications, OpenCode can connect to and run many different remote and local models. The options to connect to propriety models, such as those provided by Anthropic, OpenAI, and Google, vary with company policies. In terms of performance, Qwen3-Coder-Next is competitive with leading proprietary coding models and generally matches or exceeds the performance of most open-source alternatives. While it may slightly trail the top proprietary models on the most complex tasks, it performs comparably for the vast majority of coding workflows. It works best on concrete tasks but is less reliable with large workflows. NOTE: The CHPC hosted models are currently running on a testing hardware in the General Environment, and can be subject to unannounced outages, as we update the system. Please, do not report an outage, and check if it's working later. We are working on setting up a permanent service, pending the arrival of the dedicated hardware.
- OpenAI - OpenAI allows the use of GPT models through OpenCode for both free accounts and paid subscriptions. Authenticating the account connection requires opening a browser from the terminal and can done with ssh -X forwarding, FastX, or Open OnDemand. In OpenCode, use the /connect slash command and select OpenAI. Select the ChatGPT Pro/Plus (browser) option. Click on the authentication link that appears or copy and paste it into an internet browser. You will be prompted to sign-in to your account and authorize the connection. You can then use the /model command in OpenCode to select your preferred model.
- Claude Code - Connecting OpenCode to an Anthropic pro subscription is not supported by Anthropic and is only allowed with an API key which is a separate system from the typical user subscriptions. Claude may still be used on the CHPC via the Claude Code TUI or VSCode extension as detailed below. The above steps for connecting to OpenAI apply here, except you will be prompted to enter an API key.
- Google - As with Anthropic, Google's Gemini model can only be connected to OpenCode with an API key. The above steps for connecting to OpenAI apply here, except you will be prompted to enter an API key.
NOTE:Currently, the OpenCode module should not be used in the Protected Environment. The OpenCode application runs locally, and if only connected to the CHPC-hosted model, it should not be sending information outside of the Protected Environment. However, the server currently runs in the General Environment, and as such, being outside of the PE, is not compliant. We are working on setting up this service in the PE once the hardware earmarked for this arrives. We are also still confirming that no data is otherwise being transferred by background processes.
OpenCode module
OpenCode is available to use on the CHPC as a module. A system prompt is included in the module which informs the coding agent about the CHPC computing environment (i.e., resources of different clusters, module system, Arbiter, scratch storage space, SLURM account details, CHPC policies).
The OpenCode module can be loaded with the following:
# load OpenCode module
module load opencode
# open OpenCode TUI
opencode
The OpenCode TUI application will then appear.

Claude Code/ Codex users will find OpenCode familiar as they all operate similarly and share basic slash commands. See the OpenCode documentation for more details and examples.
Suddenly closing OpenCode without properly exiting the program may result in corrupted cached files which will prevent future sessions from opening. In that event, run the following command to clear the program's cached files:
# clear local opencode cache
rm -rf ~/.local/share/opencode/cache/*
Codex
Codex is OpenAI's coding agent and is available as a module. Load the module:
# load Codex module
module load codex
# open Codex TUI
codex
Codex can be used with either a free personal subscription, a personal paid subscription, or a University of Utah subscription.
Free and personal accounts can be authenticated using either a device code or an authentication link. Device code authentication is useful when you do not have access to a browser on the system where Codex is running. This option must be enabled in your account settings. Device code authentication is not supported for University of Utah subscriptions.
To authenticate using the link, you must have browser access through the HPC environment, such as ssh -X forwarding, FastX, or an Open OnDemand interactive desktop. Complete authentication by Ctrl-clicking the link or copying and pasting it into a browser. You will then be prompted to choose a sign-in option.
Claude Code
If you have a personal subscription to Claude you can use your Claude subscription in the General Environment (GE). Note that Claude should not be used in the Protected Environment (PE) because of data leakage.
In what follows, we will describe the different steps to get Claude working within VSCode in Open OnDemand.
- Make sure the Claude CLI is loaded in your environment
- Installation of the Claude Extension in VSCode.
- Connect the personal Claude Subscription with VSCode
1.Loading the Claude CLI in your environment
In order to make the Claude CLI permamently loaded in your enviroment, insert the command:
module load claude
in:
- either
$HOME/.custom.sh(if you use the Bash Shell) subsequent to the first line containing (#!/bin/bash) - or
$HOME/.custom.csh(if you use the Csh/Tcsh Shell) subsequent to the first line containing (#!/bin/tcsh)
After either sourcing .custom.sh or .custom.csh or logging in you should be able to invoke the claude executable.
[u0253283@notchpeak2:~]$ echo $SHELL /bin/bash [u0253283@notchpeak2:~]$ source $HOME/.custom.sh [u0253283@notchpeak2:~]$ claude -v 2.1.83 (Claude Code)
2.Installation of the Claude extension in VSCode
In this section we will describe how to install the Claude extension in the Ondemand version of VSCode. In the OpenOnDemand website we have two versions of VSCode, i.e.:
- VSCode Server
- Visual Studio Code Desktop
We have found that currently only the Visual Studio Code Desktop allows us to authenticate with a personal Claude subscription. The Visual Studio Code Desktop can be accessed in OnDemand under the "Interactive Apps" Menu.

After invoking the Visual Studio Code Desktop you will end up on an OnDemand Startup Page where you can select several fields such as the Vscode version, cluster, account, partition, qos, mem, etc.. Please choose the latest version of Vscode.

Finally click the button "Launch Visual Studio Code Desktop" to launch the application.

We are now at the point to install the Claude extension in the Visual Studio Code Desktop. Select the "View" Menu at the top and under it "Extensions". Within "Extensions" search for the "Claude Code for VS Code" extensions by Anthropic and click Install.

After the installation you should see among the other Installed extensions.

3.Connect to your personal Claude subscription
We can now connect to our personal Claude subscription. The easiest way to do this by going to the "Terminal" Menu and open a new terminal.

After typing claude on the command line, you will be first asked to select a style for your terminal.

After selecting the style you will be asked to connect to your subscription.
If you have a Claude account with a Pro, Max,... subscription you need to choose 1. If you have a subscription which is billed by the token usage choose option 2.

If you have a subscription of the first type, then select 1. A browser will be opened and/or a link will be provided to sign in your Claude account.
Authorize the access to your Claude account.

You can check if the authorization is working. Type claude auth status on the command line. You should see the details of your account.
If you have a subscription of type 2, you can proceed in the following way:
- create a directory
$HOME/.setup - in the aforementioned directory, create the file
init.sh, which contains the following line:#!/bin/bash export ANTHROPIC_API_KEY=....
- source the
$HOME/.setup/init.shin your.bashrc
Your are now ready to use Claude within VSCode.
Some useful Claude tips
claude /init: initializes a project and generates theCLAUDE.mdfileclaude /model: allows you to swap LLM modelsclaude /clear: wipes the conversation historyclaude /compact [your info]: compresses the conversation.
When/compactis followed by the stryour infothis command allows you to reduce the context by reducing it to the content ofyour info.