Where Is the Global Configuration File for no-mistakes Located?

The global configuration file for no-mistakes is .no-mistakes.yaml, located in your home directory (or the directory specified by the $NM_HOME environment variable), with the schema and loading logic defined in the internal/config package.

The no-mistakes CLI tool centralizes user-wide settings—such as CI timeouts, telemetry flags, and daemon paths—through a single global configuration file. Understanding where this file lives, how the application discovers it, and which source files govern its behavior is critical for troubleshooting and customization.

Location of the no-mistakes Global Configuration File

Default Path and Filename

By default, the no-mistakes binary searches for a file named .no-mistakes.yaml (note the leading dot) in the user’s home directory. The tool resolves the home directory using standard environment variables, ensuring cross-platform compatibility for Linux, macOS, and Windows systems.

If the file exists, no-mistakes parses it at startup; if absent, the application proceeds using only the built-in defaults defined in the source code.

Environment-Based Override with $NM_HOME

You can override the default location by setting the $NM_HOME environment variable. When $NM_HOME is defined, no-mistakes treats that directory as the configuration root and expects to find .no-mistakes.yaml there instead of in $HOME.

The resolution hierarchy is:

  1. Check for $NM_HOME/.no-mistakes.yaml
  2. Fall back to $HOME/.no-mistakes.yaml
  3. Use embedded defaults if neither file exists

Source Code Architecture

The Config Struct in internal/config/config.go

The authoritative definition of global settings resides in internal/config/config.go. This file contains:

  • The Config struct defining all valid configuration keys
  • The Load() function that reads and parses the YAML file
  • The New() constructor that initializes the configuration with defaults

According to the kunchenguid/no-mistakes source code, this package is the single source of truth for how settings are structured and validated.

Embedded Defaults via defaultConfigYAML

Within internal/config/config.go, the defaultConfigYAML constant stores the global default values as a YAML-formatted string. These defaults are injected at compile time and serve as the baseline that user-specific settings override at runtime.

For example, if the user does not specify a ci_timeout value in their .no-mistakes.yaml, the application uses the value from defaultConfigYAML automatically.

How Configuration Loading Works

When the CLI initializes, it executes the loading sequence defined in the internal/config package:

  1. Determine root directory: The code checks for $NM_HOME; if unset, it uses the standard user home directory.
  2. Read user file: It attempts to read .no-mistakes.yaml from the determined root.
  3. Merge with defaults: The parsed file contents are merged with the defaultConfigYAML defaults, with user values taking precedence.
  4. Apply CLI overrides: Command-line flags parsed later in the startup sequence overwrite the merged configuration values before the application logic consumes them.

The entry point for this process is the config.Load() function (typically invoked via config.New()), which returns a populated Config struct or an error if the YAML is malformed.

Customizing Your Configuration

Sample .no-mistakes.yaml Structure

Create a .no-mistakes.yaml in your home directory to persist settings across sessions:

ci_timeout: 15m
telemetry: true
daemon:
  lockfile: "${NM_HOME}/daemon.lock"

This YAML structure mirrors the fields defined in the Config struct within internal/config/config.go.

Command-Line Overrides

You can temporarily override global settings without editing the file by using CLI flags. The flag parsing logic in internal/config/config.go updates the configuration struct after the file is loaded:

no-mistakes --ci-timeout=30m run

In this example, even if .no-mistakes.yaml specifies 15m, the command runs with a 30m timeout because the flag value overwrites the loaded configuration before execution.

Testing the Configuration System

The repository includes comprehensive tests in the internal/config directory to ensure reliability:

These test files confirm that the loading order—defaults → file → environment → CLI flags—behaves as documented in the source code.

Summary

  • The no-mistakes global configuration file is .no-mistakes.yaml, stored in $HOME or $NM_HOME.
  • Source authority for configuration logic is internal/config/config.go, which defines the Config struct, defaultConfigYAML constants, and the Load() function.
  • Loading sequence: Defaults are embedded in the binary, merged with the user’s YAML file, and finally overridden by CLI flags.
  • Customization is supported through both persistent YAML files and temporary command-line flags.

Frequently Asked Questions

What is the default location for the no-mistakes configuration file?

By default, no-mistakes looks for .no-mistakes.yaml in your user home directory. The exact path depends on your operating system’s home directory resolution (e.g., /home/username/.no-mistakes.yaml on Linux or C:\Users\username\.no-mistakes.yaml on Windows).

How do I change where no-mistakes looks for its global config?

Set the $NM_HOME environment variable to point to a custom directory. When this variable is present, no-mistakes reads .no-mistakes.yaml from that location instead of your home directory, allowing you to maintain separate configurations for different projects or environments.

What happens if the .no-mistakes.yaml file is missing?

The application does not fail. According to the implementation in internal/config/config.go, the Load() function falls back to the defaultConfigYAML embedded in the binary. The CLI starts with safe defaults, though you may see warnings depending on the verbosity settings.

Can CLI flags override values in the global configuration file?

Yes. The flag parsing system in internal/config/config.go processes command-line arguments after loading the file-based configuration. Values provided via flags (e.g., --ci-timeout) take precedence over both the .no-mistakes.yaml file and the compiled-in defaults.

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 →