Stacks

Run Atlas Headless in CI for MATLAB Projects in 2026

Updated 7 min read

To run an Atlas session non-interactively in a MATLAB CI pipeline and retrieve machine-readable output, developers in 2026 leverage the `atlas run` command with specific flags like `--format json`. This approach allows Atlas to execute tasks such as refactoring `.m` function files or adding `matlab.unittest.TestCase` subclasses, streaming events to stdout, and exiting upon session idle, all while integrating with the `matlab.unittest (runtests)` framework and `MATLAB Format Code`.

How to Invoke Atlas Headless in a MATLAB CI Pipeline

In 2026, MATLAB developers can initiate a headless Atlas session within their CI pipeline by using the `atlas run` command, designed specifically for non-interactive execution. This command sends a single prompt to Atlas, which then processes the request and streams all session events directly to stdout, exiting automatically once the session becomes idle.

Running Atlas headless in a MATLAB CI environment is achieved by invoking `atlas run` directly from your pipeline script. This command's default mode is non-interactive, meaning it expects a single prompt as an argument and will not wait for user input. For example, to ask Atlas to vectorize a loop in a MATLAB function, you might use a command like `atlas run "Vectorize the loop in my_function.m for improved performance."`. Atlas will then utilize its capabilities, such as searching code with hybrid semantic and keyword retrieval, and indexing code by AST declarations using tree-sitter, to understand the MATLAB codebase. It operates within the directory containing your `.m` files and any `buildfile.m`, ensuring it can read function signatures, `classdef` blocks, and the toolboxes your code calls into.

Retrieving Machine-Readable Output from Atlas in MATLAB CI

For automated processing in a MATLAB CI pipeline, Atlas provides the `--format json` flag with `atlas run`, ensuring that all streamed events are machine-readable. This is crucial for subsequent pipeline steps that need to parse Atlas's output, rather than relying on human-readable prose, allowing for robust integration and automated decision-making in 2026.

When a later pipeline step in your MATLAB CI needs to programmatically interpret Atlas's activity, the `--format json` flag is indispensable. Instead of the default human-readable output, Atlas will stream raw JSON events to stdout, detailing every action, observation, and decision made during the session. This structured output allows CI tools to parse specific events, such as file edits, tool calls, or session completion status. For instance, after Atlas applies `MATLAB Format Code` conventions to touched files, the JSON output would contain verifiable events related to these modifications. This enables automated checks, reporting, or even triggering further actions based on Atlas's output, ensuring that the integration with your MATLAB development workflow is both efficient and reliable.

Configuring Permissions and Models for Headless MATLAB Runs

To ensure a headless Atlas run in a MATLAB CI pipeline operates without interruption, pre-approving necessary tools via the permission configuration is essential, as there is no interactive user to answer 'ask' prompts. Additionally, explicitly setting the model using the `provider/model` form is required for consistent behavior in 2026.

In a non-interactive CI environment, Atlas cannot prompt for permission to use tools like `bash`, `read`, `edit`, or `todowrite`. Therefore, before initiating `atlas run`, you must configure Atlas's permissions to 'allow' the tools the job requires. This is typically done through a configuration file, ensuring that Atlas can, for example, run `matlab.unittest (runtests)` or apply `MATLAB Format Code` without needing approval. Furthermore, to guarantee predictable behavior and avoid potential issues with model selection, the active model and provider must be explicitly set using the `provider/model` format. This ensures that Atlas connects to the correct Model Context Protocol servers and exposes their tools to the agent, maintaining consistency across different CI runs for your MATLAB projects.

Resuming and Forking Atlas Sessions in MATLAB CI

For complex MATLAB development tasks in 2026, Atlas supports resuming or forking prior sessions using `--continue`, `--session`, or `--fork` flags. This capability allows a CI pipeline step to build upon an earlier run, preventing redundant work and enabling iterative development or debugging of Atlas's actions within a MATLAB codebase.

The ability to resume or fork an Atlas session is particularly valuable in a MATLAB CI pipeline for scenarios where a task might be interrupted, or where you want to iterate on an agent's performance. If an Atlas session, perhaps one tasked with adding a `matlab.unittest.TestCase` subclass under `tests/`, fails or needs further refinement, you can use `--continue` with the session ID to pick up exactly where it left off. Alternatively, `--fork` allows you to create a new session based on the state of a previous one, providing a clean slate for experimentation while preserving the original. This ensures that Atlas can efficiently manage and build upon its code index, which is constructed by AST declarations using tree-sitter, and leverage local Ollama embeddings to keep MATLAB code off third-party servers, even across multiple CI runs.

Step by step

  1. 01Prepare your MATLAB project directory with `.m` files and `buildfile.m` where Atlas will operate.
  2. 02Configure Atlas permissions to 'allow' necessary tools (e.g., `bash`, `read`, `edit`, `todowrite`) in your Atlas configuration file to prevent interactive prompts during CI execution.
  3. 03Invoke `atlas run` in your CI script, providing the prompt as an argument and specifying the model, for example: `atlas run --model github/copilot-gpt4-turbo "Refactor the 'my_classdef.m' class to improve method encapsulation." --format json`.
  4. 04Atlas will read your MATLAB function signatures, `classdef` blocks, and toolboxes, then draft a plan in a read-only plan agent.
  5. 05Atlas will execute its plan, potentially running `matlab.unittest (runtests)` behind a permission prompt (if allowed) or applying `MATLAB Format Code` conventions to touched `.m` files.
  6. 06Atlas streams all events, including unified diffs for every file edit, to stdout in JSON format, which your CI pipeline can parse for automated review and reporting.
  7. 07If needed, use `atlas run --continue <session_id>` or `atlas run --fork <session_id>` in a subsequent CI step to resume or build upon a previous Atlas session's work on your MATLAB codebase.

Frequently asked questions

How do I ensure Atlas doesn't prompt for input in my MATLAB CI?
To prevent Atlas from prompting for input during a headless MATLAB CI run, you must pre-approve all necessary tools (like `bash`, `read`, `edit`, `todowrite`) in your Atlas permission configuration file. This allows Atlas to execute actions such as running `matlab.unittest (runtests)` or applying `MATLAB Format Code` without requiring interactive approval.
Can Atlas run MATLAB tests in CI?
Yes, Atlas can run MATLAB tests in CI. If the `bash` tool is permitted, Atlas can invoke `matlab.unittest (runtests)` to execute your test suites. Atlas can then review failing assertions and propose fixes, with all actions and proposed changes surfaced as unified diffs for approval.
How does Atlas handle code formatting in MATLAB CI?
Atlas can apply `MATLAB Format Code` conventions to touched `.m` files within your CI pipeline. After making edits, Atlas computes a unified diff for every file change and surfaces it for approval. If the `edit` tool is permitted, Atlas can directly apply these formatting changes, ensuring your MATLAB code adheres to standards.
What kind of output does Atlas provide for CI automation in MATLAB?
For CI automation in MATLAB, Atlas provides a stream of events to stdout. By using the `--format json` flag with `atlas run`, this output becomes machine-readable JSON, detailing every step, tool call, and file modification. This structured data allows your CI pipeline to parse and react to Atlas's actions programmatically.
How does Atlas understand my MATLAB codebase?
Atlas understands your MATLAB codebase by indexing code with AST declarations using tree-sitter. It reads `.m` function files, `classdef` blocks, and identifies the toolboxes your code calls into. This allows Atlas to perform hybrid semantic and keyword retrieval for accurate code searching and context awareness.
Can Atlas use local models for MATLAB code in CI?
Yes, Atlas can build its code index with local Ollama embeddings, keeping your MATLAB code off third-party servers. This ensures that sensitive `.m` files and `classdef` definitions remain within your controlled environment while still benefiting from Atlas's advanced code understanding capabilities in CI.
How do I specify which model Atlas should use in a MATLAB CI pipeline?
In a MATLAB CI pipeline, you must explicitly set the active model and provider for Atlas using the `provider/model` format. For example, `atlas run --model github/copilot-gpt4-turbo "..."`. This ensures that Atlas connects to the correct Model Context Protocol servers and uses the intended AI model for your MATLAB tasks.

Try Atlas in your terminal

The terminal-native AI coding agent. Free core, single binary.

Install Atlas

Related guides

Run Atlas Headless in CI with Atlas (2026 Workflow)

How to run Atlas headless in CI in 2026: atlas run sends one prompt and exits when the session goes idle, with --format json, --command, and --continue for pipeline steps.

Rename a symbol across the repo in MATLAB with Atlas in 2026

In 2026, Atlas empowers MATLAB developers to rename functions, classes, and constants across their repositories with unparalleled precision. Leverage semantic analysis and robust verification for comprehensive, safe

Document a module with a README in MATLAB with Atlas in 2026

Learn how Atlas helps MATLAB developers in 2026 generate accurate README documentation directly from source code, using `matlab.unittest (runtests)` and `MATLAB Add-On Manager (mpm)`.

Plan a Multi-File Change Before Editing in MATLAB with Atlas in 2026

Design complex, multi-file MATLAB changes and get them reviewed before modifying a single line of code using Atlas's dedicated plan agent and integrated toolchain.

Self-review your working diff before committing in MATLAB with Atlas in 2026

Catch your own mistakes in uncommitted MATLAB code diffs before they reach review or CI. Atlas helps MATLAB developers in 2026 self-review changes, run `matlab.unittest (runtests)`, and apply `MATLAB Format Code` for

Migrate a deprecated API across every callsite in MATLAB with Atlas in 2026

Streamline deprecated API migrations in MATLAB codebases with Atlas in 2026. Automate finding all callers, applying patches, and verifying with `matlab.unittest (runtests)` for a complete, safe transition.

Upgrade a dependency and fix the breakage in MATLAB with Atlas in 2026

In 2026, Atlas helps MATLAB developers upgrade dependencies and fix breaking changes. Automate MATLAB Add-On Manager (mpm) updates, repair compile errors, and resolve matlab.unittest failures with AI-driven precision.

Audit a repo with parallel subagents in MATLAB with Atlas in 2026

Sweep your MATLAB repository for issues without context window limits. Atlas uses parallel subagents to audit .m files, classdef blocks, and matlab.unittest test classes efficiently.

Browse this resource hub