Navigation
ELOWEN · Documentation

Last updated: October 27, 2026

Browse documentation · Code Mode
Plugins

Code Mode

Code Mode lets a model run JavaScript that calls several tools in one turn, which helps when a later tool call depends on an earlier result. Each call still follows the account's permissions and approval rules.

Turn on Code Mode

  1. Open Settings → <assistant name> AI.
  2. Open the Settings of a connected provider, under Linked accounts or AI providers.
  3. Switch to Advanced and turn on Code mode.

The setting applies to every model from that provider, and only an administrator can change it. There is no separate slash command.

Note: The switch appears only for providers that support it: ChatGPT accounts, Meta and xAI accounts, and Kimi or OpenAI connections that use the Responses API. For Kimi, choose Responses under Connection → API format first; Auto probes Responses in the background and uses it after successful detection. Models trained for this tool format, such as GPT-5.6 and newer, work best; try a real task before enabling it for another model.

What the model can do

The model gets an exec tool for raw JavaScript and a wait tool for checking a script that is still running. Every other available tool can be called inside the script through tools.<name>, and AskUserQuestion stays available for asking you to choose.

  • A script can run several dependent tool calls without a separate model round for each one.
  • It can yield while work continues, then resume with wait.
  • Each call a script makes appears in the transcript as its own tool row. While the model is still writing a script, the transcript shows the note of the call that script is writing.
  • The script itself has no direct file or network access; it reaches both through the available tools.

Code Mode grants no extra access: every call inside a script uses the same account, Project, tool permissions and approval checks as a direct call.

Tip: Tool loading applies here too. Only the core tools (Bash, Read, Edit, Grep, Write) are described in full, and a deferred tool stays callable from a script once the model has looked it up. A script can discover deferred tools with tools.tool_search({query: "calendar"}); Code Mode does not use the separate Tool Search tool.

Use JavaScript cells

Each exec call starts a new JavaScript cell. For long-running work the script can yield and return a cell ID; call wait with that ID for more output or completion.

  • To stop a running cell, call wait with terminate: true. A completed or terminated cell cannot be resumed.
  • wait takes its own yield_time_ms and max_tokens arguments.

A first line starting with // @exec: changes the observation time and output budget for that one call, and the script starts on the next line:

// @exec: {"yield_time_ms": 60000, "max_output_tokens": 2000}
text(await tools.ListDir({ path: "src" }));

Code Mode limits

Scripts run in a sandboxed JavaScript engine under that engine's own memory policy. There is no separate cap on open cells, no application memory cap and no inactivity deadline.

How long a script runs

Each exec observation waits 10 seconds by default, and each wait call also waits 10 seconds. The observation window never stops the script: a script keeps running until it finishes, yields or is terminated.

If you send a message while the model is waiting on a script, the wait ends at once so the model reads your message, and the script keeps running.

Output, images and audio

  • Output defaults to 10,000 tokens per observation.
  • Images and audio do not use the text-token budget. Media in one observation can total at most 20 MiB, and one image or audio item at most 10 MiB.
  • Audio is accepted only from ChatGPT account connections; other providers refuse it with an error, and a WAV clip shorter than 25 ms is replaced by a text note.

Cells and who owns them

A cell belongs to the conversation that created it. Another conversation cannot use its IDs, and only one observer can wait on it at a time.

Running cells stop when you press Stop, including cells started in earlier turns, when the conversation is reset, switches model or Chetty restarts, and when its session is cleared, deleted or recreated. An ID from before then is reported as not found, and never reaches a newer cell.

In a shared chat room, cells and saved values belong to the person who wrote the message, including members without a linked Chetty account. Another member cannot read them or wait on them, and a member's personal tools are described and listed only in that member's turns.

Change the defaults

Settings → <assistant name> AI → Runtime → Edit runtime holds two defaults:

  • Default exec observation time sets the default for exec, from 10 to 600 seconds. The wait tool keeps its own fixed 10 second default.
  • Maximum code-mode output sets the default output budget, from 1,000 to 50,000 tokens.

A single call can ask for its own budget with max_output_tokens in the // @exec: prefix, or with max_tokens on wait.

Turn off Code Mode

Return to that provider's Settings → Advanced and switch Code mode off. There is no separate slash command.