How to Customize the system_message in Open Interpreter: 4 Methods Explained

You can customize the system_message in Open Interpreter by setting interpreter.system_message in Python, using the --system_message CLI flag, creating a reusable profile file, or appending instructions with --custom_instructions.

The system_message is the core prompt that defines Open Interpreter's behavior, capabilities, and output format for every interaction. In the openinterpreter/open-interpreter repository, this message is fully customizable through multiple entry points, allowing you to tailor the AI's personality, safety policies, and coding style to your specific workflow.

What Is the system_message?

The system message is the initial prompt sent to the language model on every request. It tells the model who it is, what it may do, and how it should format its output. According to the source code in interpreter/core/default_system_message.py, the default system message is a formatted f-string that dynamically inserts your operating system, username, and working directory to ground the model in your local environment.

Where the system_message Is Defined and Stored

When you instantiate Open Interpreter, the constructor in interpreter/core/core.py (lines 68-69) receives system_message=default_system_message and stores it as self.system_message. This instance attribute is read directly by the response pipeline in interpreter/core/respond.py (line 26) every time the interpreter generates a response, meaning any change to the attribute is immediately reflected in the next LLM call.

4 Methods to Customize the system_message

You can alter the system message through four distinct mechanisms, ranging from temporary runtime changes to permanent configuration files.

1. Runtime Assignment in Python

The simplest way to customize the system_message is to assign it directly to the singleton interpreter instance in your Python code or Jupyter notebook. This change takes effect immediately for all subsequent chat calls.

from interpreter import interpreter  # the singleton instance

interpreter.system_message = """
You are a helpful data-science assistant. When you write code, always
include a brief comment describing each step.
"""

interpreter.chat("Plot the histogram of the 'mpg' column from the 'auto-mpg.csv' file.")

2. CLI Flag (--system_message)

When launching Open Interpreter from the command line, use the --system_message (or -sm) flag defined in interpreter/terminal_interface/start_terminal_interface.py (lines 46-50) to replace the default prompt entirely.

interpreter --system_message "You are a terse Unix-shell expert. Output only the command."

You can combine this with --custom_instructions to layer additional constraints without rewriting the entire base prompt.

3. Profile Configuration Files

For permanent customizations, create a profile file in ~/.open-interpreter/profiles/ or use the defaults located in interpreter/terminal_interface/profiles/defaults/ (such as assistant.py or llama3.py). These Python files set interpreter.system_message directly and are loaded by interpreter/terminal_interface/profiles/profiles.py.

Create ~/.open-interpreter/profiles/myprofile.py:


# myprofile.py

interpreter.system_message = """
You are a friendly Python tutor. Explain every line of code you output.
"""

interpreter.computer.system_message = ""  # Optional: suppress the built-in computer hint

Run it:

interpreter --profile myprofile.py

4. Appending Custom Instructions (--custom_instructions)

If you want to keep the default system message intact but add specific constraints, use the --custom_instructions (or -ci) flag defined in interpreter/terminal_interface/start_terminal_interface.py (lines 39-44). This appends text to the system message rather than replacing it.

interpreter --custom_instructions "Always wrap Python code in triple backticks."

How the Final Prompt Is Assembled

Understanding how Open Interpreter constructs the final prompt helps predict how your customizations will interact. In interpreter/core/respond.py (line 26), the system message is built through the following concatenation logic:

system_message = interpreter.system_message
if hasattr(language, "system_message"):
    system_message += "\n\n" + language.system_message
system_message += "\n\n" + interpreter.custom_instructions
if interpreter.computer.system_message not in system_message:
    system_message = system_message + "\n\n" + interpreter.computer.system_message

This means your system_message forms the base, followed by language-specific additions, then your custom_instructions, and finally the computer's system message if not already present. Any change to interpreter.system_message or interpreter.custom_instructions is reflected in every subsequent model call.

Summary

  • The system_message is stored as self.system_message in the OpenInterpreter class (interpreter/core/core.py) and defaults to the template in interpreter/core/default_system_message.py.
  • You can customize the system_message through four methods: direct Python assignment, the --system_message CLI flag, profile configuration files, or the --custom_instructions flag for appending text.
  • The final prompt sent to the LLM is assembled in interpreter/core/respond.py by concatenating the base system message, language-specific messages, custom instructions, and computer system messages.
  • Changes take effect immediately for runtime assignments or on the next request for CLI and profile configurations.

Frequently Asked Questions

What is the default system_message in Open Interpreter?

The default system message is defined in interpreter/core/default_system_message.py as a formatted f-string that dynamically inserts your operating system, username, and working directory. It instructs the model that it is a code-interpreting assistant capable of executing commands on your local machine.

Can I combine multiple methods to customize the system_message?

Yes, customization methods are layered. The CLI --system_message flag or a profile file sets the base prompt, while --custom_instructions appends additional constraints. Runtime Python assignments override previous values for the current session, with the final assembly occurring in interpreter/core/respond.py before each LLM call.

How do I permanently save a custom system_message?

Create a profile file in ~/.open-interpreter/profiles/ (e.g., myprofile.py) that sets interpreter.system_message to your desired prompt. Launch Open Interpreter with interpreter --profile myprofile.py to load your configuration automatically.

Does modifying the system_message affect code execution safety?

Changing the system_message alters the model's behavior and instructions, but it does not bypass Open Interpreter's underlying safety mechanisms or sandboxing. The model may interpret relaxed instructions differently, so always review generated code before execution regardless of how you customize the system prompt.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →