Skip to content

Environment Variables

The Terminal injects environment variables into every terminal session. These enable CLI tools and AI assistants to detect and interact with The Terminal’s features.

A unique identifier for the current Terminal instance.

Terminal window
echo $THE_TERMINAL_ID
# e.g., "terminal-a1b2c3d4"

Use this to distinguish between multiple Terminal windows or to associate activity with a specific instance.

The port number where the DevTools HTTP API is listening.

Terminal window
echo $THE_TERMINAL_DEVTOOLS_PORT
# e.g., "9876"

Gee-Code uses this to connect to the browser panel.

The full URL for the DevTools API.

Terminal window
echo $THE_TERMINAL_DEVTOOLS_URL
# e.g., "http://localhost:9876"

Equivalent to http://localhost:$THE_TERMINAL_DEVTOOLS_PORT.

The background color mode of the terminal, for tools that adapt their output to the theme.

Terminal window
echo $TERM_BACKGROUND
# "dark" or "light"

In addition to environment variables, The Terminal writes connection details to a file:

~/.the-terminal/devtools.json
{
"port": 9876,
"url": "http://localhost:9876"
}

This file is used by Gee-Code and other tools that need to discover the DevTools API without being launched from within The Terminal.

Terminal window
if [ -n "$THE_TERMINAL_DEVTOOLS_URL" ]; then
echo "Running inside The Terminal"
# Use DevTools API for enhanced output
else
echo "Running in a standard terminal"
fi
const devtoolsUrl = process.env.THE_TERMINAL_DEVTOOLS_URL;
if (devtoolsUrl) {
// Send rich output to The Terminal's Canvas
}
import os
devtools_url = os.environ.get('THE_TERMINAL_DEVTOOLS_URL')
if devtools_url:
# Integrate with The Terminal's DevTools API