Three Layers, One Model

August 19, 2026 - Map Claude Code's model precedence by peeling three layers.

Introduction

30 Second Summary

Every app you use has settings you can change in more than one place. When two places disagree, the app has to pick a winner.

In this project, you will set three configuration layers in Claude Code to three different models and find out which one actually answers. Then you will remove the winner, restart, and repeat until you have mapped the full order.

What You'll Build

You will launch Claude Code four separate times, and each launch reveals a different model answering because you removed the previous winner.

By the end of this project, you'll have:

  • A recorded result proving which of three conflicting configuration layers wins when all three name a different model.
  • A tested fallback chain from peeling back the stack one layer at a time, showing which layer was waiting behind each winner.
  • A written comparison between your pre-experiment estimate and observed results, with every wrong guess noted.
  • Secret Mission: Discover a fourth configuration layer and place it in the precedence order you established.

Are there any prerequisites?

You need a Claude Pro, Max, Team, Enterprise, or Console account. No prior Claude Code experience or API key is required.

Before We Start

Before any hands-on work, lock in your estimate of which configuration layer wins when three of them disagree. Writing down your guess now turns the rest of this project into a real test of your intuition.

Check What You Have

The experiment in this project depends on an environment variable introduced in Claude Code v2.1.236. An older version will not recognize it.

In this step, you will confirm that Claude Code is installed and up to date, sign in, and make sure your settings file has no leftover model setting that could skew your results.

In this step, get ready to:
  • Confirm Claude Code v2.1.236 or later is installed.
  • Authenticate with your Claude account and note your default model.
  • Clear any leftover model key from your user settings file.
Check whether Claude Code is installed

Claude Code is a terminal CLI that you will use for every launch in this project. You need version 2.1.236 or later for the environment variable this project tests.

  • Press Cmd+Space (macOS) or the Windows key (Windows) to open your search bar.
  • Type Terminal (macOS/Linux) or PowerShell (Windows) and press Enter to open it.
  • Check your Claude Code version by running this command:
claude --version

What do you see in your terminal?

✔️ I see version 2.1.236 or higher

Your output looks something like 2.1.237 (Claude Code). Claude Code is ready to go. Move on to the next substep.

ⓧ I see a version lower than 2.1.236

You have Claude Code installed, but the version is too old for the environment variable this project tests.

  • Update Claude Code by running:
claude update
  • After the update finishes, run claude --version again to confirm the version is 2.1.236 or higher.

Still seeing an older version?

Close your terminal window, open a fresh one, and run claude --version again. Some shells cache the old binary path until you start a new session.

Help me update Claude Code to the latest version.

ⓧ Command not found

Claude Code is not installed yet. Install it now with the command for your platform.

macOS

Linux users can run the same command.

  • Install Claude Code by running:
curl -fsSL https://claude.ai/install.sh | bash

Windows

If you are in PowerShell, install Claude Code by running:

irm https://claude.ai/install.ps1 | iex

If you are in CMD instead, run:

curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
  • After the installer finishes, close your terminal and open a fresh one.
  • Run claude --version to confirm the version is 2.1.236 or higher.

Still getting command not found?

Make sure you opened a new terminal window after the install finished. The installer adds Claude Code to your shell path, but existing windows do not pick up the change.

Help me install Claude Code.

Authenticate and confirm a clean starting state

Before the experiment, you need to sign in and record the model your account uses when no configuration layer overrides it. You also need to make sure no leftover setting from a past session interferes.

  • Launch Claude Code by running:
claude

What happens when you launch?

If this is your first time, Claude Code opens a browser window for you to sign in with your Claude account. Follow the prompts, then switch back to your terminal. You will see the Claude Code prompt once authentication is complete.

Before you run the next command, think about what model you expect your account to default to.

  • Once you are in the interactive session, check your current model by running:
/status

Look at the model shown in the output. This is your account's built-in default, the floor under every configuration layer you will test. Record it here: your account's default model

What is the built-in default?

Your account's built-in default is the model Claude Code falls back to when nothing else is configured. After you set up three competing layers in the next step, this default is what remains when all three are stripped away.

  • Leave the interactive session by running:
/exit

Now check whether your user settings file has a leftover model key from a previous session. If a past session used /model to change models, Claude Code saved that choice to the settings file.

  • Print the contents of your settings file by running:

macOS

Linux users can run the same command.

cat ~/.claude/settings.json

Windows

type $env:USERPROFILE\.claude\settings.json

What do you see?

✔️ No model key (or the file does not exist)

Your settings file is clean. If the command printed an error saying the file does not exist, that is also fine. No leftover model key will interfere with the experiment.

ⓧ I see a model key in the file

You need to remove the "model" key and its value from the file. Keep any other keys that are already there.

  • Open the file in a text editor.

macOS

Linux users can run the same command.

nano ~/.claude/settings.json

Windows

notepad $env:USERPROFILE\.claude\settings.json
  • Find the line that contains "model" and delete the entire line.
  • Make sure the remaining JSON is still valid. No trailing commas before a closing }.
  • Save and close the file.
  • Confirm the key is gone by printing the file again:

macOS

Linux users can run the same command.

cat ~/.claude/settings.json

Windows

type $env:USERPROFILE\.claude\settings.json

You should see the file contents without any model key.

Not sure if your file is clean?

Search the file output for the word model. If it does not appear anywhere, the file is clean. If the file does not exist at all, you are also in the clear.

Help me clean up my Claude Code settings file.

You have a verified version of Claude Code, an authenticated session, and a clean settings file. Next up, you will set three configuration layers to three different models and find out which one wins.

Set All Three Layers to Disagree

Claude Code is installed and your starting state is clean. No leftover model setting in the user settings file will skew your results.

A test where every layer agrees tells you nothing. Three different models in three different places guarantee that only one can win.

In this step, get ready to:
  • Set each configuration layer to a different model.
  • Launch Claude Code and record which model the session actually uses.
Set the environment variable

Anthropic's Week 34 digest (August 17-21, 2026) describes a variable called ANTHROPIC_DEFAULT_MODEL. This is the first layer you will set.

What does ANTHROPIC_DEFAULT_MODEL do?

The digest describes it as the environment variable that sets the model new sessions start on. A /model pick still overrides it and persists across restarts.

The digest says what the variable does. It does not say where it sits relative to the settings file or the command-line flag. That is the open question this experiment answers.

  • Set ANTHROPIC_DEFAULT_MODEL to haiku by running this command:

macOS

This command also works on Linux and WSL.

export ANTHROPIC_DEFAULT_MODEL=haiku

Windows

In PowerShell:

$env:ANTHROPIC_DEFAULT_MODEL = "haiku"

In CMD:

set ANTHROPIC_DEFAULT_MODEL=haiku
  • Confirm the variable is set by running:

macOS

echo $ANTHROPIC_DEFAULT_MODEL

Windows

In PowerShell:

echo $env:ANTHROPIC_DEFAULT_MODEL

In CMD:

echo %ANTHROPIC_DEFAULT_MODEL%

The output should print haiku.

Not seeing haiku?

Check for typos in the variable name. ANTHROPIC_DEFAULT_MODEL is all uppercase with underscores.

Make sure you ran the export (or $env: / set) command in the same terminal window you are checking from. Environment variables only exist in the session that set them.

My ANTHROPIC_DEFAULT_MODEL variable is not printing haiku after I set it

Set the settings file to a different model

The second layer is the user settings file. Claude Code reads this JSON file at startup and applies any model key it finds.

  • Open ~/.claude/settings.json in any text editor (Windows: %USERPROFILE%\.claude\settings.json).
  • Add the model key so the file contains the following (keep any other keys you already have):
{
  "model": "sonnet"
}

What does this setting do?

The model key tells Claude Code which model to use when a session starts. Setting it to sonnet means this file asks for a different model than the haiku you set in the environment variable.

  • Save settings.json.

✔️ Awesome, I've got everything!

Your settings file now has a model key set to sonnet. Make sure you saved the file.

ⓧ I'd like to double check the full code

Your file should include at least this content. If you had other keys before, they should still be there alongside the new model key.

{
  "model": "sonnet"
}
Launch with the flag, record the winner, and exit

All three layers now disagree. The environment variable says haiku. The settings file says sonnet. The flag you are about to use says opus.

Before you launch, look back at the estimate you wrote in Step 0. Which model do you think /status will show?

  • Launch Claude Code with the --model flag set to opus by running:
claude --model opus

Session not opening?

Make sure you are running the command in the same terminal where you set ANTHROPIC_DEFAULT_MODEL. If you opened a new terminal, the variable is no longer set there.

If you see an authentication error, run claude without flags first, sign in again, then retry with --model opus.

Claude Code is not launching with --model opus, what should I check?

  • Once the session opens, check which model is active by running:
/status
  • Record the model name shown in the output.

This is the winner when all three layers are set. Keep this result somewhere you can refer back to.

  • Leave the session by running:
/exit

What did you just learn?

You now know which of the three layers has the highest precedence. It overrode the other two and became the model for your session.

You do not yet know the order of the two that lost. The next step reveals that by removing the winner and seeing which layer takes over.

You have your first data point. Next, you will strip layers away one at a time and find out which was waiting behind the winner.

Peel the Stack

You recorded which model won when all three layers disagreed. That is the top of the stack.

The fallback order matters just as much. When you move to a different machine, not every layer will be set. Removing the winner one layer at a time reveals which layer was waiting behind it.

In this step, get ready to:
  • Remove each configuration layer one at a time and record which model takes over.
  • Reach the account's built-in default with all layers cleared.
  • Compare the full observed sequence against your Step 0 estimate and note every discrepancy.
Remove the winner and record what takes over

The --model flag was part of your launch command in Step 2. This time, you will launch without it. The environment variable and settings file are still set, each naming a different model.

Before you launch, think about which layer you expect to win now. The environment variable says haiku. The settings file says sonnet. Which one takes over?

  • Launch Claude Code without the --model flag by running:
claude
  • Check which model the session is using by running:
/status

Note the model shown. This is the second entry in your sequence.

  • Exit the session by running:
/exit

Seeing the same model as your first launch?

If /status shows the same model that won when all three layers were set, the --model flag may not have been the winner in your case. Double-check which model you recorded in Step 2 and confirm it matches what the flag was set to (opus).

help me figure out why removing the --model flag didn't change the model in /status

Remove the next winner

The settings file still holds its model key. The environment variable is still set. Removing the settings key reveals whether the file was winning over the variable, or the other way around.

  • Open ~/.claude/settings.json (Windows: %USERPROFILE%\.claude\settings.json) in any text editor.
  • Find the "model": "sonnet" line and delete it.
  • Save the file. Keep any other keys that were already in the file.
  • Launch Claude Code again by running:
claude
  • Check the model by running:
/status

Record which model answers. This is the third entry in your sequence.

  • Exit the session by running:
/exit

What if two runs showed the same model?

If removing the settings key changed nothing (the same model appeared for both the second and third entries), check whether a project-level .claude/settings.json in your current directory also has a model key. A project-level file can sit between the user-level file and the environment variable.

Two identical results despite a removed layer can also mean something outside these three is deciding. That is a bigger answer than the order itself.

Remove the last layer and reach the floor

One layer remains. The ANTHROPIC_DEFAULT_MODEL environment variable is still set to haiku. Removing it brings you down to the account's built-in default.

  • Unset the ANTHROPIC_DEFAULT_MODEL environment variable using the command for your system:

macOS

  • In your terminal, run:
unset ANTHROPIC_DEFAULT_MODEL

Linux and WSL users can run the same command.

Windows

  • If you are using PowerShell, run:
Remove-Item Env:\ANTHROPIC_DEFAULT_MODEL

Using CMD?

CMD does not support unsetting a variable inline. Open a new CMD window instead. The variable will not carry over to the new window.

Before you launch, what model do you expect to see now that every layer you set has been removed?

  • Launch Claude Code one more time by running:
claude
  • Check the model by running:
/status

The model shown is your account's built-in default. It should match the default you noted in Step 1. Record this as the fourth and final entry in your sequence.

  • Exit the session by running:
/exit

You now have four entries. Set them beside the estimate you wrote in Step 0.

  • Write down every place the observed order disagrees with your Step 0 estimate.

Why the comparison matters

Every wrong guess is a place where your mental model of configuration layering did not match this tool's actual behavior. Most layered systems give environment variables priority over config files. Some tools break that convention.

Noting those gaps is what makes the experiment transfer. Next time, you will test the order rather than assume it.

Default model doesn't match what you noted in Step 1?

If the fourth entry does not match the default from Step 1, a leftover setting may still be active. Check ~/.claude/settings.json for a remaining model key. Also check whether a project-level .claude/settings.json exists in your current directory.

help me find where a leftover model setting is hiding

Secret mission

The Fourth Layer

Claude Code has a second model environment variable called ANTHROPIC_MODEL. It looks almost identical to ANTHROPIC_DEFAULT_MODEL, but it sits in a completely different place in the precedence order. Can you find where it belongs using the same disagree-and-check method?

Clean Up Your Resources

Clean Up Your Resources

This project runs entirely in your terminal and your local settings file. There are no cloud resources, running processes, or ongoing costs.

You already restored your ~/.claude/settings.json file and unset your environment variables in the previous steps. There is nothing left to tear down.

Keep your precedence notes

The four-layer precedence order you recorded is worth saving wherever you keep working notes. It answers a question that comes up whenever Claude Code behaves differently on a different machine: which layer is set here that is not set there.

Nice Work!

Nice Work!

Nice work! You made three configuration layers in Claude Code disagree on purpose, peeled them off one by one, and mapped the full precedence order from your own results.

What you learned:

  • Set an environment variable, a settings file, and a command-line flag to three different models and recorded which one the session actually used.
  • Peeled the stack one layer at a time, removing each winner to reveal which layer was waiting behind it, and recorded the full fallback order from winner to account default.
  • Wrote an estimate before the experiment, compared it against observed results, and noted every place the order disagreed with what you expected.
  • Secret Mission: Placed a fourth layer (ANTHROPIC_MODEL) in the precedence order and wrote the complete four-layer sequence from your own results.

This is one client, on one plan, on one day. A different plan may expose different layers.

The order is not promised to be stable across versions. It will not help you predict the next tool's order. It only teaches you to check.

Ready to quiz yourself?