Stacks

Run Atlas Headless in CI for Fortran in 2026

Updated 8 min read

Fortran developers in 2026 can run Atlas headless in CI pipelines using the `atlas run` command, enabling non-interactive execution to automate tasks like refactoring legacy FIXED-form numerics or adding `test-drive` unit tests. This integrates directly with your existing Fortran toolchain, including `fpm` for package management and `fpm test` for test execution, providing machine-readable JSON output for subsequent pipeline steps.

How to Run Atlas Headless in Fortran CI Pipelines

Running Atlas headless in a Fortran CI pipeline in 2026 is straightforward, primarily involving the `atlas run` command. This command's default mode is non-interactive, designed to send a single prompt, stream events to stdout, and exit once the session becomes idle, making it ideal for automated environments.

To integrate Atlas into your Fortran CI workflow, you invoke `atlas run` directly within your pipeline script. The core functionality for headless operation is its non-interactive nature. You supply the initial prompt as an argument to `atlas run`, for example, `atlas run "Refactor common blocks in src/legacy.f90 into a new module."`. Atlas will then process this prompt, execute its plan, and stream all events to standard output. This allows CI systems to capture the entire interaction log. For scenarios where subsequent pipeline steps need to programmatically parse Atlas's output, the `--format json` flag is crucial. This flag ensures that Atlas streams raw event data in a machine-readable JSON format, rather than human-readable prose, enabling robust automation and data extraction by other tools in your Fortran CI stack. This approach ensures that Atlas can perform complex Fortran code modifications, such as moving a common block into a module or adding `test-drive` unit tests under the `test/` directory, without requiring any manual intervention.

Configuring Atlas for Fortran Toolchain Integration

Integrating Atlas with your Fortran toolchain requires specific configuration, especially for permissions and model selection, to ensure smooth headless operation. By 2026, Atlas's permission system is robust, allowing you to pre-approve tools like `bash`, `read`, `edit`, and `todowrite` before any headless run.

For Atlas to operate effectively in a Fortran CI environment, particularly when interacting with tools like `fpm` and `fprettify`, its permissions must be pre-configured. A headless run has no human operator to answer 'ask' prompts, so all necessary tool calls must be explicitly 'allow' listed in your Atlas permission configuration. This includes tools like `bash` for executing shell commands (e.g., `fpm test`), `read` for accessing Fortran source files (e.g., `src/my_module.f90`), `edit` for modifying code, and `todowrite` for creating new files or updating existing ones. Without these pre-approvals, Atlas would halt, awaiting a response that never comes. Additionally, setting the active model explicitly is vital for headless runs. The `--model` flag expects a `provider/model` format, such as `--model github/copilot-gpt4`, ensuring Atlas uses the correct AI model for understanding and generating Fortran code, from legacy FIXED-form numerics to modern modules and coarrays. This setup allows Atlas to run `fpm test` behind a permission prompt and iterate on `gfortran` diagnostics, or to run `fprettify` over changed sources before you approve the diff.

Managing Sessions and Output for Fortran CI

Managing Atlas sessions and capturing machine-readable output is key for complex Fortran CI workflows, especially when a job needs to build on an earlier run. Atlas offers several flags, including `--continue`, `--session`, and `--fork`, to manage session state, ensuring continuity across multiple pipeline steps in 2026.

In advanced Fortran CI scenarios, you might need to resume or fork a prior Atlas session. For instance, if an initial CI step uses Atlas to identify potential refactorings in a large Fortran codebase, a subsequent step might need to continue that work or build upon its findings. The `--continue <session_id>` flag allows you to pick up an existing session where it left off, preserving context and prior interactions. Alternatively, `--session <session_id>` can be used to load a specific session without necessarily continuing it, perhaps for review or analysis. The `--fork <session_id>` option creates a new session based on an existing one, allowing parallel experimentation or different approaches to a problem without altering the original session. When combined with `--format json`, these session management capabilities provide a powerful mechanism for orchestrating multi-stage Fortran CI pipelines. The JSON output stream provides detailed events, including tool calls, agent plans, and file changes, which can be parsed by custom scripts or other CI tools to monitor progress, extract specific data points, or trigger subsequent actions, such as running `fpm test (test-drive)` after Atlas proposes a code change.

Ensuring Safety and Review in Headless Fortran Operations

Safety and review are paramount even in headless Fortran CI operations, and Atlas incorporates several mechanisms to ensure code quality and prevent unintended changes. Every Atlas tool call is permission-gated, and it drafts a plan in a read-only agent before executing, providing multiple layers of control by 2026.

Atlas is designed with safety features that are critical for automated Fortran code modifications. Before any tool is executed, Atlas checks against allow, ask, and deny rules. In a headless CI environment, this means all necessary tools (like `bash` for `fpm test` or `edit` for modifying `src/my_module.f90`) must be explicitly allowed. Furthermore, Atlas operates with a 'plan agent' that drafts a proposed course of action in a read-only mode. This plan is then surfaced in the event stream (especially useful with `--format json`), allowing CI systems or custom scripts to review the intended actions before Atlas switches to a 'build agent' to execute them. Crucially, Atlas computes a unified diff for every file edit it proposes. This diff is also surfaced in the event stream for approval. This means that even in a headless context, your CI pipeline can be configured to capture these diffs and, for example, require a human review or an automated check (like running `fprettify` and then `fpm test`) before the changes are committed. Atlas also snapshots file changes as git patches, so edits can be diffed and rolled back if necessary, providing an additional safety net for your Fortran codebase.

Step by step

  1. 01Ensure your Fortran project has an `fpm.toml` file and Atlas is installed and configured with necessary permissions for `bash`, `read`, `edit`, and `todowrite` tools.
  2. 02Invoke `atlas run` in your CI script with a specific prompt, for example, `atlas run "Add test-drive unit tests for the 'calculate_force' subroutine in src/physics_module.f90 under the test/ directory."`, and include `--format json` for machine-readable output.
  3. 03Explicitly set the model using the `provider/model` format, such as `--model github/copilot-gpt4`, to ensure Atlas uses the correct AI for your Fortran tasks.
  4. 04Configure your CI pipeline to parse the JSON event stream from Atlas, looking for proposed file changes (diffs) and agent plans.
  5. 05After Atlas proposes changes, have your CI pipeline run `fprettify` over the changed Fortran sources to ensure formatting consistency, then capture the new diff.
  6. 06Execute `fpm test (test-drive)` within your CI pipeline to validate Atlas's proposed Fortran code changes and ensure all unit tests pass.
  7. 07Implement a review step in your CI, either automated (e.g., checking `gfortran` diagnostics) or manual, based on the diffs and test results before allowing Atlas to write changes or commit.
  8. 08Optionally, use `--continue <session_id>` or `--fork <session_id>` in subsequent CI steps to build upon or branch from previous Atlas sessions for complex Fortran refactoring tasks.

Frequently asked questions

How do I run `fpm test` with Atlas in a Fortran CI pipeline?
You can have Atlas execute `fpm test (test-drive)` by ensuring the `bash` tool is allowed in your Atlas permissions configuration. Atlas will then draft a plan to run the command, and upon approval (or pre-approval in headless mode), it will execute `fpm test` and report the diagnostics from `gfortran`.
Can Atlas format my Fortran code with `fprettify` in CI?
Yes, Atlas can run `fprettify` over changed Fortran sources. You would configure Atlas to use the `bash` tool to execute `fprettify <filename>` or `fprettify --recursive src/`. Atlas will then surface the resulting diff for review before applying the changes, even in a headless CI environment.
How does Atlas handle Fortran modules and interfaces in headless mode?
Atlas indexes Fortran code by AST declarations using tree-sitter, allowing it to understand modules, explicit interfaces, and intent declarations on dummy arguments. This deep understanding enables it to propose accurate changes, such as moving a common block into a module, even when running non-interactively in CI.
What if Atlas needs to ask a question during a headless Fortran CI run?
In a headless Fortran CI run, Atlas cannot ask questions interactively. All necessary tool calls must be pre-approved in your Atlas permission configuration (e.g., 'allow' for `bash`, `read`, `edit`). If an unapproved action is attempted, Atlas will halt, as there is no human to answer an 'ask' prompt.
How do I get machine-readable output from Atlas for my Fortran CI scripts?
To get machine-readable output, invoke `atlas run` with the `--format json` flag. This will stream raw event data in JSON format to stdout, which your Fortran CI scripts can then parse to extract information about agent plans, tool calls, and proposed file changes (diffs).
Can Atlas work with legacy FIXED-form Fortran code in CI?
Yes, Atlas is designed to work with modern Fortran, from legacy FIXED-form numerics to modules and coarrays. Its code indexing capabilities allow it to understand and propose changes to various Fortran code styles, making it suitable for modernizing older Fortran codebases in CI.
How can I review Atlas's proposed Fortran code changes in CI before they are applied?
Atlas computes a unified diff for every file edit and surfaces it in the event stream. In your CI pipeline, you can capture this JSON output, extract the diff, and then use it for automated checks (e.g., running `fpm test`) or for human review before allowing Atlas to write the changes to your Fortran project.

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.

Atlas for Fortran: fpm.toml, Explicit Interfaces, and fprettify in 2026

Atlas is a terminal-native AI coding agent for Fortran in 2026. It reads modules, explicit interfaces, and intent declarations, runs fpm test behind a prompt, and runs fprettify.

Audit a Fortran Repo with Parallel Subagents in 2026

Sweep your Fortran codebase for problems without context window limits. Atlas uses parallel subagents to audit fpm projects, leveraging fprettify and fpm test for comprehensive review in 2026.

Write Unit Tests for Untested Code in Fortran with Atlas in 2026

Boost your Fortran codebase in 2026 by adding robust unit tests with Atlas. Learn to use fpm test and fprettify to ensure code quality and maintainability.

Review a Fortran Pull Request with Atlas in 2026

Streamline Fortran pull request reviews in 2026 with Atlas. Leverage `fpm`, `fprettify`, and `gfortran` diagnostics to catch subtle bugs and ensure robust code quality.

Trace a runtime bug from a stack trace in Fortran with Atlas in 2026

Pinpoint Fortran runtime bugs from production stack traces using Atlas in 2026. Leverage fpm and gfortran diagnostics to quickly identify and fix issues without a debugger attached.

Research a third-party API before integrating it in Fortran with Atlas in 2026

Fortran developers in 2026 can research third-party APIs efficiently with Atlas. Use `websearch` and `webfetch` for current docs, then integrate with confidence, verifying against `fpm` project conventions.

Diagnose a Hanging or Long-Running Fortran Command with Atlas in 2026

Fortran developers in 2026 can use Atlas to diagnose hanging or slow fpm builds and scripts. Identify if commands are blocked on input or genuinely slow, and get them unstuck efficiently.

Browse this resource hub