Find the Wall
July 24, 2026 - Test Claude Code's subagent nesting depth limit.
Introduction
30 Second Summary
Every development tool ships with defaults you never chose. When one of those defaults silently changes how many layers deep your automated tasks can spawn tasks of their own, the behavior shifts in ways that are invisible from where you sit.
In this project, you will predict where a subagent nesting chain hits its limit in Claude Code, cross that limit on purpose, and judge the result by what a file on disk actually contains. The gap between prediction and artifact is where the real learning happens.
What You'll Build
You'll ask a chain of subagents to write their depth numbers into a single file, request one level too many, and read the file to discover exactly where the chain stopped and how the wall presented itself.
By the end of this project, you'll have:
- A measured depth number decided by what the artifact file on disk recorded, not by what the parent agent reported.
- A recorded refusal shape showing whether the wall produced a visible error or a silent omission, compared against predictions you wrote before any test ran.
- A confirmed variable test showing whether setting CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH=1 moved the wall to depth 1 or was ignored entirely.
- Secret Mission: Lower the concurrent subagent limit to 3, try to spawn 4 parallel workers, and compare the concurrent limit's refusal shape to the nesting limit's.
Are there any prerequisites?
You need Claude Code already installed on your machine with a Pro, Max, Team, or Enterprise plan. No additional API key or credit card is required.
Before We Start
A default you did not choose is now running inside every agent workflow on your machine. Before we dive in, let's lock in what you're about to test and why it matters.
Check Your Version and Set the Brake
The subagent nesting depth default changed in Claude Code v2.1.219. If your version is older, the default is 1 instead of 3. You would be measuring a different wall entirely.
This project deliberately pushes past the nesting limit. That is the kind of thing that burns tokens by accident. Before the first subagent spawns, you will set a budget brake: every run in this project uses --max-budget-usd 2.00, which caps API spend for that session.
In this step, get ready to:
- Confirm your Claude Code version is 2.1.219 or later.
- Create the depth-test folder and the depth-writer agent definition.
- Verify Claude Code discovers the agent.
Check your Claude Code version
The nesting default moved in a specific release. Running on an older version means the default depth is 1, and the chain you build later would hit the wall in a completely different place.
- Check your installed version by running this command:
claude --version
The output looks like 2.1.219 (Claude Code). Note the version number before the parentheses.
✔️ I see version 2.1.219 or later
Your version is new enough for the nesting depth default to be 3. Move on to the next substep.
ⓧ I see an older version
Your version predates the nesting default change. Update Claude Code to the latest version.
- Update Claude Code by running this command:
claude update
- After the update completes, confirm the new version by running:
claude --version
You should now see 2.1.219 or later.
Still seeing an old version?
Close your terminal, open a new one, and run claude --version again. Some updates require a fresh shell session to take effect.
help me update Claude Code to the latest version
ⓧ Command not found
This project requires Claude Code to be installed with a Pro, Max, Team, or Enterprise plan. Follow the official setup guide at code.claude.com/docs/en/setup to install Claude Code, then return here and re-run claude --version.
Create the test folder and agent definition
Claude Code discovers agent definitions inside a .claude/agents/ directory. The directory must exist before the session starts. You will create the project folder, the agent directory, and the agent file that forms the depth-testing chain.
- Move to your Desktop by running this command:
cd ~/Desktop
- Create the project folder structure and move into it by running these commands:
macOS
mkdir -p depth-test/.claude/agents
cd depth-test
Windows
New-Item -ItemType Directory -Path depth-test\.claude\agents -Force
cd depth-test
- Confirm the folder structure was created by running:
ls .claude
You should see agents in the output.
Don't see the agents folder?
Make sure you ran the mkdir command from the platform tab that matches your operating system. On macOS/Linux, .claude is a hidden directory. If ls .claude says the path does not exist, run the mkdir command again and check for typos in the path.
help me create the .claude/agents directory structure
- Create the agent definition file by running this command:
macOS
cat > .claude/agents/depth-writer.md << 'EOF'
---
name: depth-writer
description: Writes its assigned depth number to depth-log.txt, then spawns the next depth in the chain.
tools: Bash, PowerShell, Write, Read, Agent
---
You are one link in a depth-testing chain.
When you receive a depth number N and a maximum depth M:
1. Append exactly one line to depth-log.txt in the current working directory:
depth-N wrote this line
Use a shell append so earlier lines are preserved.
2. If N is less than M, use the Agent tool to spawn another depth-writer.
Tell it: You are depth (N+1). Maximum depth is (M). Write your line and
continue the chain.
3. If N equals M, stop and return a summary of what you did.
Do not attempt to spawn further.
Always write your own line before spawning the next level.
Do not read or summarize depth-log.txt. Only append to it.
EOF
Windows
@"
---
name: depth-writer
description: Writes its assigned depth number to depth-log.txt, then spawns the next depth in the chain.
tools: Bash, PowerShell, Write, Read, Agent
---
You are one link in a depth-testing chain.
When you receive a depth number N and a maximum depth M:
1. Append exactly one line to depth-log.txt in the current working directory:
depth-N wrote this line
Use a shell append so earlier lines are preserved.
2. If N is less than M, use the Agent tool to spawn another depth-writer.
Tell it: You are depth (N+1). Maximum depth is (M). Write your line and
continue the chain.
3. If N equals M, stop and return a summary of what you did.
Do not attempt to spawn further.
Always write your own line before spawning the next level.
Do not read or summarize depth-log.txt. Only append to it.
"@ | Set-Content .claude\agents\depth-writer.md
What does this agent definition do?
The YAML frontmatter at the top gives the agent a name (depth-writer) and lists the tools it can use: shell access on both platforms, file read/write, and the Agent tool for spawning further subagents.
The markdown body is the agent's system prompt. It tells each link in the chain to append one line to depth-log.txt naming its own depth, then spawn the next level. The last link stops instead of spawning.
- Confirm the agent file was created by running:
ls .claude/agents/
You should see depth-writer.md in the output.
Don't see depth-writer.md?
If the file is missing, the heredoc or here-string may not have completed. Re-run the creation command from the platform tab matching your OS. Make sure you copy the entire command, including the closing EOF line (macOS) or the "@ line (Windows).
help me create the depth-writer agent file
✔️ Awesome, I've got everything!
Great. Make sure you are still inside the depth-test folder before moving on.
ⓧ I'd like to double check the full code
Here is the complete .claude/agents/depth-writer.md file. Compare it character by character with yours.
---
name: depth-writer
description: Writes its assigned depth number to depth-log.txt, then spawns the next depth in the chain.
tools: Bash, PowerShell, Write, Read, Agent
---
You are one link in a depth-testing chain.
When you receive a depth number N and a maximum depth M:
1. Append exactly one line to depth-log.txt in the current working directory:
depth-N wrote this line
Use a shell append so earlier lines are preserved.
2. If N is less than M, use the Agent tool to spawn another depth-writer.
Tell it: You are depth (N+1). Maximum depth is (M). Write your line and
continue the chain.
3. If N equals M, stop and return a summary of what you did.
Do not attempt to spawn further.
Always write your own line before spawning the next level.
Do not read or summarize depth-log.txt. Only append to it.
Verify Claude Code discovers the agent
The folder and file are in place. Now you need to confirm that Claude Code actually sees the agent when it starts a session. This command also introduces the two flags you will use on every run in this project.
Before you run this, do you think Claude Code will find the agent you just created? It should, but if the directory structure has a typo, it will come back empty.
- Check if Claude Code sees the agent by running this command:
claude -p --max-budget-usd 2.00 "What agents are available in this project? List their names only."
What do these flags mean?
- -p runs Claude Code in print mode. It processes a single prompt and exits, instead of opening an interactive session.
- --max-budget-usd 2.00 caps API spend at two dollars for this run. Subagent spend counts toward the cap. If the cap is reached, new spawns are denied and running background subagents are halted.
Every command in this project includes both flags. The budget brake is not optional. You are deliberately spawning chains of subagents, and the cap prevents a runaway chain from burning through your quota.
- Read the output. You should see depth-writer listed as an available agent.
Don't see depth-writer in the output?
- Confirm you are inside the depth-test folder. Run pwd (macOS/Linux) or Get-Location (Windows). The path should end with depth-test.
- Confirm the file path is exactly .claude/agents/depth-writer.md. A missing dot, a misspelled folder, or the file sitting in the wrong directory will all cause Claude Code to miss it.
- If you created the .claude/agents/ directory during a running interactive Claude Code session, it will not be detected. Use -p mode (which starts a fresh session each time) to re-run the check.
help me get Claude Code to find my depth-writer agent
Your environment is locked in. The version is right, the agent is discoverable, and the budget brake is ready. Next up, you will write three predictions before anything runs.
Write Three Predictions
Your version is confirmed and the depth-writer agent is ready to chain. The tempting next move is to request four levels and watch what happens.
Not yet. If you write predictions after running the test, you are narrating, not testing. Three predictions go in now, before anything runs. The changelog tells you where the default sits. It does not tell you what happens when you cross it.
In this step, get ready to:
- Review the one changelog line that describes the nesting default change.
- Write three predictions in a predictions.md file before running any test.
Review the changelog line
Claude Code v2.1.219 changed one default. Here is the exact line from the GitHub release page:
The v2.1.219 changelog line
Subagents can now spawn nested subagents up to depth 3 by default (was 1); set CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH=1 to disable nesting
That is everything the vendor says. The default moved from 1 to 3, and a variable can reverse it. What happens when you request a fourth level is not claimed anywhere. That gap is the open question you are about to answer.
Create your predictions file
You will request 4 levels of nesting. The default allows 3. Before you run anything, you need a file that records what you think will happen.
- Create a new file called predictions.md in your depth-test folder with the following template:
# Predictions
Written before running any test.
The changelog (v2.1.219, July 24 2026) says:
> Subagents can now spawn nested subagents up to depth 3 by default (was 1);
> set CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH=1 to disable nesting
I will request 4 levels. The default allows 3.
## 1. Where is the wall?
Prediction: depths ___ write their line. Depth ___ does not.
## 2. What does the refusal look like?
Prediction: (visible error / silent omission / something else)
Why:
## 3. Does the variable move the wall or get ignored?
Prediction: (only depth 1 writes / all depths still write / something else)
Why:
What are these three predictions?
- Prediction 1 asks which depths actually write their line to the file and which depth gets stopped. The default is 3. You are requesting 4.
- Prediction 2 asks what the stop looks like. Does the blocked depth throw a visible error? Does it silently not run? Does the parent report it differently than the file shows?
- Prediction 3 asks whether CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH=1 actually moves the wall down to depth 1, or gets accepted and ignored.
- Replace the blanks (___) and parenthetical options with your own guesses. Write a short reason in each Why: section.
- Save predictions.md.
- Confirm the file exists by running:
ls predictions.md
You should see predictions.md in the output. Do not run the chain yet.
Don't see predictions.md?
- Make sure your terminal is inside the depth-test folder, not inside .claude/agents or one level above.
- Check that the file is named exactly predictions.md with no extra spaces or capital letters.
Why isn't my predictions.md file showing up when I run ls?
✔️ Awesome, I've got everything!
Great. Double check you have saved predictions.md with your own predictions filled in, not the blank template.
ⓧ I'd like to double check the full code
Your predictions.md should have this structure. The blanks and parenthetical options should be replaced with your own guesses.
# Predictions
Written before running any test.
The changelog (v2.1.219, July 24 2026) says:
> Subagents can now spawn nested subagents up to depth 3 by default (was 1);
> set CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH=1 to disable nesting
I will request 4 levels. The default allows 3.
## 1. Where is the wall?
Prediction: depths ___ write their line. Depth ___ does not.
## 2. What does the refusal look like?
Prediction: (visible error / silent omission / something else)
Why:
## 3. Does the variable move the wall or get ignored?
Prediction: (only depth 1 writes / all depths still write / something else)
Why:
Your predictions are locked in. Next up, you run the chain against the wall and let the file on disk settle the score.
Cross the Wall and Read the Artifact
Your three predictions are locked in. You have a guess about where the chain stops, what the refusal looks like, and whether the variable matters.
Now you test the first two. You are requesting four nesting levels from Claude Code. The default allows three.
The parent agent will report what it thinks happened. The file on disk will show what actually did. A parent confirms it handed a task off. It does not confirm the child completed it.
In this step, get ready to:
- Run the depth-writer chain requesting 4 levels against the default limit of 3.
- Read depth-log.txt to see which levels actually wrote their line.
- Record the observation in predictions.md.
Run the depth-writer chain
Before you run this, look back at your predictions. How many lines do you expect to find in depth-log.txt after the chain finishes, and what do you think Claude will say about depth 4?
- Start the chain by running this command:
claude -p --max-budget-usd 2.00 "Use the depth-writer agent. Tell it: you are depth 1, maximum depth is 4. Write your line and continue the chain."
What does this command do?
- -p runs Claude Code in print mode. It processes the prompt, prints the response, and exits.
- --max-budget-usd 2.00 caps API spend for this run at $2. Subagent spend counts toward the cap.
- The prompt tells the first depth-writer to start at depth 1 and chain all the way to depth 4.
Wait for the command to complete. This may take up to a minute as each subagent spawns the next sequentially.
- Read what Claude prints in the terminal after the chain finishes.
- Note what Claude's summary says about each depth level.
- Pay particular attention to what it claims about depth 4.
Command taking a long time?
- Each subagent spawns the next in sequence, so the chain takes longer than a single prompt. Give it up to a minute.
- If it seems stuck, press Ctrl+C to cancel and run the same command again.
- Make sure you are inside the depth-test folder so Claude Code can find the agent definition.
Why is my depth-writer chain not completing?
Read the artifact on disk
Claude's summary told you what it thinks happened. Now you check what the file actually says.
- Read depth-log.txt by running this command:
macOS
cat depth-log.txt
Windows
Get-Content depth-log.txt
- Count the lines in the output.
- Note which depth numbers appear and which do not.
- Compare what the parent's summary claimed about depth 4 to what the file actually shows.
Why read the file instead of trusting the summary?
A parent agent confirms it handed a task off. It does not confirm the child completed it.
If the wall is silent (no error, no line written), the parent's summary might still describe depth 4 as part of the chain. The file is the only record of what actually ran.
🙋♀️ No depth-log.txt found?
- The depth-writer agent uses a shell append to write its line. If no file exists, the first depth did not write anything at all.
- Confirm you are in the depth-test folder by running pwd (macOS/Linux) or Get-Location (Windows).
- Re-run the claude -p command from the previous substep.
Why didn't depth-log.txt get created when I ran the depth-writer chain?
Record the observation in predictions.md
You now have two pieces of evidence: what Claude reported and what the file contains. Time to record both.
- Open predictions.md in any text editor.
- Add the following section at the very end of the file, then fill in each blank with what you actually observed:
---
# Observations
## Run 1: Default depth, requested 4 levels
depth-log.txt contained:
(paste the actual contents)
The parent's summary said:
(paste or describe what Claude reported about depth 4)
Prediction 1 was: (correct / wrong)
Prediction 2 was: (correct / wrong)
Refusal shape: (describe what you observed)
What am I recording?
- Under "depth-log.txt contained", paste exactly what the file showed. Every line, as-is.
- Under "parent's summary", record what Claude claimed about depth 4. Did it mention a failure? Did it describe a successful handoff? Did it say nothing at all?
- For "refusal shape", describe the gap between what Claude said and what the file shows. Was the wall a visible error or a silent absence?
- Save predictions.md.
✔️ Awesome, I've got everything!
Great. Confirm you have saved predictions.md with both the original Predictions section and the new Observations section.
ⓧ I'd like to double check the full code
Your predictions.md should now have two major sections. Scroll through it and confirm these are present, in this order:
- # Predictions at the top, with your three filled-in predictions from the previous step.
- A --- horizontal rule separating the two sections.
- # Observations with the Run 1 results, including the pasted file contents, the parent's summary, your prediction scores, and the refusal shape.
Not sure what to write for refusal shape?
Look at the gap between the parent's summary and the file. Did Claude claim depth 4 ran when the file shows it did not? Did Claude mention an error? Did it simply stop without explanation? Describe exactly what you saw.
How do I describe the refusal shape I observed in my depth-writer chain test?
You have a number and a shape. Next up, you test whether the CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH variable moves the wall or gets ignored.
Test the Variable
Run 1 gave you a number and a shape. You know where the wall is and how the refusal looks. Two of your three predictions have been tested.
The third prediction is about a variable the changelog names: CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH. Setting it to 1 should disable nesting entirely. If the file still shows the same depths as Run 1, the variable was accepted and ignored. That finding would be bigger than the wall itself.
In this step, get ready to:
- Delete the old log and configure the depth variable to 1.
- Run the same four-level chain under the new constraint.
- Compare the result to Run 1 and record the finding.
Delete the old log and set the variable
Run 2 needs a clean depth-log.txt. If the old file is still there, lines from Run 1 will mix with Run 2 and you will not be able to tell which run produced which line.
- Delete the old depth-log.txt by running the command for your platform:
macOS
rm -f depth-log.txt
Windows
Remove-Item depth-log.txt -ErrorAction SilentlyContinue
Now for the variable itself. Claude Code reads project-local settings from .claude/settings.local.json. The env key inside that file sets environment variables for the session.
- Create the file .claude/settings.local.json with this content:
{
"env": {
"CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH": "1"
}
}
What does this file do?
.claude/settings.local.json holds project-local settings that apply to every Claude Code session started from this folder. It is not meant to be checked into version control.
Setting CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH to "1" should restrict nesting to a single level. If it works, only depth 1 writes its line and the rest of the chain never runs.
- Save .claude/settings.local.json.
- Confirm the file is in place and depth-log.txt is gone by running:
macOS
cat .claude/settings.local.json
You should see the JSON with CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH set to "1". Confirm the old log is gone:
ls depth-log.txt 2>/dev/null || echo "depth-log.txt is gone"
Windows
Get-Content .claude\settings.local.json
You should see the JSON with CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH set to "1". Confirm the old log is gone:
Test-Path depth-log.txt
This should print False.
Settings file not printing correctly?
- Make sure the file is inside the .claude directory, not in the project root. The full path from depth-test is .claude/settings.local.json.
- Check that the JSON is valid. A missing comma, quote, or bracket will cause Claude Code to ignore the file silently.
- help me debug my .claude/settings.local.json file
Run the chain with the variable active
Before you run this, look at prediction 3 in your predictions.md. You asked for 4 levels. The variable says 1. How many lines do you expect in depth-log.txt this time?
- Run the same chain with the budget cap by running this command:
claude -p --max-budget-usd 2.00 "Use the depth-writer agent. Tell it: you are depth 1, maximum depth is 4. Write your line and continue the chain."
- Wait for it to complete.
- Read what Claude prints and note what it claims about each depth.
Seeing Budget limit reached?
The --max-budget-usd 2.00 cap applies to this single run. If the chain consumed more than $2.00 in API calls, new spawns are denied. This is the brake doing its job. Record what you saw and move to the next substep.
help me understand the budget limit in my subagent chain
Read the log and record the result
The parent's summary describes what it thinks happened. The file describes what actually happened. Read the file.
- Read depth-log.txt by running the command for your platform:
macOS
cat depth-log.txt
Windows
Get-Content depth-log.txt
Count the lines. Compare them to what you saw in Run 1. Did the number of depths change?
- Open predictions.md and add the following section after the Run 1 observations:
## Run 2: Variable set to 1, requested 4 levels
depth-log.txt contained:
(paste the actual contents)
Prediction 3 was: (correct / wrong)
Variable behavior: (moved the wall / was ignored / something else)
What am I recording here?
Prediction 3 asked whether the variable would move the wall. The answer is in the line count. If Run 2 has fewer lines than Run 1, the variable moved the wall. If the line count is the same, the variable was accepted and ignored.
Paste the exact contents of depth-log.txt so you have a side-by-side record of both runs.
- Fill in each field with what you actually observed.
- Save predictions.md.
You now have two runs recorded. depth-log.txt exists with Run 2's results. predictions.md shows both the prediction and the observation side by side.
You have seen the test fail at the wall and seen the variable change the result (or not). But you have only ever seen this chain hit a limit. Next, you will run a chain that should succeed and prove the test works both ways.
Prove It Both Ways
You have two runs recorded. Both crossed the wall. But a test you have only ever seen fail is as untrustworthy as one you have only ever seen pass.
This step runs the chain one level shallower than the wall you found in Run 1. If every level writes its line, the chain mechanism works and the missing depth was the limit, not a bug. If it still fails, the chain itself is broken and Run 1 proved nothing.
In this step, get ready to:
- Delete the old log and remove the variable override.
- Run the chain requesting only 3 levels under the default limit.
- Complete predictions.md with all observations and a summary.
Delete the old log and remove the variable override
The depth-log.txt from Run 2 needs to go so Run 3 starts with a clean file. The .claude/settings.local.json file also needs to go. That file set CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH to 1. Removing it restores the default nesting depth of 3.
- Delete both files by running these commands:
macOS
rm -f depth-log.txt
rm -f .claude/settings.local.json
Windows
Remove-Item depth-log.txt -ErrorAction SilentlyContinue
Remove-Item .claude\settings.local.json -ErrorAction SilentlyContinue
- Confirm depth-log.txt is gone by running:
ls
You should see predictions.md and the .claude directory, but no depth-log.txt.
Run the chain within the default limit
With the variable override removed, Claude Code is back to its default nesting depth of 3. This time you are requesting exactly 3 levels. The chain should stay inside the wall.
Before you run this, consider: with the default depth restored and a request for only 3 levels, do you expect all three depths to write their line? What would it mean if one is still missing?
- Run the chain requesting 3 levels by running this command:
claude -p --max-budget-usd 2.00 "Use the depth-writer agent. Tell it: you are depth 1, maximum depth is 3. Write your line and continue the chain."
Wait for the command to complete. Claude prints a summary of what it thinks happened. Note what it claims about each depth, but do not draw conclusions from the summary alone.
Command not completing?
Each subagent spawn takes time. A 3-level chain may need 30 to 60 seconds to finish. If the command hangs for much longer, check that .claude/settings.local.json was actually deleted. If the file still exists, it is still overriding the default depth.
help me debug why my Claude Code subagent chain is hanging
Read the log and complete your predictions
Claude's printed summary is not the evidence. The artifact on disk is. Time to read what depth-log.txt actually contains.
- Read the artifact by running:
macOS
cat depth-log.txt
Windows
Get-Content depth-log.txt
Count the lines. You should see three lines, one for each requested depth. Every level you asked for has written its line.
Why does this matter?
If all three depths wrote, the chain mechanism works. The missing depth in Run 1 was the limit stopping it, not a broken chain. You have now seen the test pass and fail, which makes both results trustworthy.
If a depth is still missing here, the chain itself has a problem. Run 1 may have proved nothing about the wall.
Now record this final run and write your summary. This closes out the full prediction-observation cycle.
- Open predictions.md in your editor.
- Add the following to the end of the file, after the Run 2 section:
## Run 3: Request within the limit (3 levels)
depth-log.txt contained:
(paste the actual contents)
All requested levels wrote: (yes / no)
## Summary
Wall is at depth:
Refusal shape:
Variable behavior:
What I got wrong:
What goes in each summary field?
- Wall is at depth: the last depth number that actually wrote its line in Run 1.
- Refusal shape: what happened at the wall. Was it a visible error, a silent omission, or something else?
- Variable behavior: whether setting CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH to 1 moved the wall in Run 2.
- What I got wrong: where your predictions diverged from what actually happened. This is the most valuable line.
- Paste your actual depth-log.txt contents into the Run 3 section.
- Fill in every field in the Summary section using what you observed across all three runs.
- Save predictions.md.
✔️ Awesome, I've got everything!
Great. Make sure you have saved predictions.md.
ⓧ I'd like to double check the full code
Your predictions.md should contain these sections in order. Scroll through the file and confirm each one is present with your filled-in responses.
- Predictions section with items 1, 2, and 3 filled in (from Step 2).
- Run 1: Default depth, requested 4 levels with pasted log contents, parent summary, and prediction results (from Step 3).
- Run 2: Variable set to 1, requested 4 levels with pasted log contents, prediction result, and variable behavior (from Step 4).
- Run 3: Request within the limit (3 levels) with pasted log contents and yes/no confirmation (from this step).
- Summary with wall depth, refusal shape, variable behavior, and what you got wrong (from this step).
Run 3 is also missing a depth?
If depth-log.txt does not contain all three lines, the chain mechanism itself may be unreliable. Check that .claude/agents/depth-writer.md still matches the original agent definition. Also confirm .claude/settings.local.json was deleted. If the settings file is still there, the depth-1 override is still active.
help me figure out why my depth-writer chain is missing a level even within the default limit
Your depth-log.txt should contain a line for every level you requested. Every level that should have run, ran. This confirms the chain is sound and the wall is real. Your predictions.md now holds a number, a shape, and a correction.
Secret mission
Test a Different Limit
You tested the depth limit. Now point the same predict-cross-verify method at a different wall: the concurrent subagent cap. Lower it to 3, try to spawn 4 parallel workers, and compare the refusal shape to what you saw with nesting.
Clean Up Your Resources
Clean Up Your Resources
This project runs entirely locally, so there are no ongoing costs. Decide whether to keep the depth-test folder for reference or delete it entirely.
Resources you used:
- The depth-test folder on your Desktop, containing predictions.md, .claude/agents/depth-writer.md, and any leftover log or worker files.
Keep everything running
No action needed. Choose this if you want to revisit your predictions and observations later or rerun the tests on a future version of Claude Code.
- The depth-test folder sits on your Desktop and takes up negligible disk space.
- If you want to keep just your findings, copy predictions.md to wherever you store working notes.
Pause - I'll come back to this later
Nothing to pause. The folder is just files on disk with no running processes or active connections.
- Leave the depth-test folder where it is. It consumes no memory or CPU while idle.
- When you come back, cd into depth-test on your Desktop and rerun the tests with --max-budget-usd 2.00 as before.
Delete - I don't want to use this again
Remove the entire project folder. Your findings in predictions.md will be deleted, so copy it elsewhere first if you want to keep it.
- If your terminal is still inside the depth-test folder, move out first by running:
cd ~/Desktop
- Delete the folder on macOS/Linux by running:
rm -rf depth-test
- On Windows, delete the folder by running:
Remove-Item -Recurse -Force depth-test
- Confirm the folder is gone by running ls (macOS/Linux) or Get-ChildItem (Windows). You should no longer see depth-test in the output.
Nice Work!
Nice Work!
You predicted three outcomes, ran three tests, and measured each result by what a file on disk showed. The delta between prediction and observation is your finding.
You've learned how to:
- Found the wall: identified the exact Claude Code subagent nesting depth where the chain stopped under the default, measured by the lines in depth-log.txt rather than by the parent's summary.
- Tested the variable: ran the same chain with CLAUDE_CODE_MAX_SUBAGENT_SPAWN_DEPTH set to 1 and confirmed whether it moved the wall or was ignored.
- Proved the test both ways: saw the chain fail at the wall and pass below it, confirming the chain mechanism works and the missing line was the limit.
- Secret Mission: lowered the concurrent subagent cap to 3, spawned 4 parallel workers, and compared the concurrent limit's refusal shape to the nesting limit's.
Ready to quiz yourself?