- In short
- context: fork is a SKILL.md frontmatter setting that runs a skill in an isolated subagent instead of inline. The skill body becomes the subagent prompt, the subagent works in its own context window without access to your conversation history, and only a summary returns to the main thread. It exists to keep verbose skill output from flooding the main conversation.
What the Claude Code context fork option does
The claude code context fork option is a single SKILL.md frontmatter line, context: fork, with an outsized effect: it changes where a skill runs. By default a skill executes inline, meaning its instructions and all of its output land directly in your ongoing conversation. Add context: fork and the skill instead runs in an isolated subagent, a separate context window with its own working memory, and only a distilled summary comes back to your main thread. For a skill that reads dozens of files or generates pages of exploratory text, that difference is the line between a focused session and a context window drowning in noise.
- context: fork
- A SKILL.md frontmatter value that runs the skill in a forked subagent. The skill body becomes the subagent prompt, the subagent works in an isolated context window with no access to your conversation history, and only its summarised result returns to the main conversation.
This knowledge point builds directly on SKILL.md frontmatter: context is just one more field, but it is the one that connects skills to Claude Code subagent model. Understanding it is the difference between a skill that quietly preserves your context budget and one that squanders it.
Why isolation preserves your context window
A subagent, as the documentation puts it, does its work in its own context and returns only the summary. That is precisely the property you want for verbose work. When you ask Claude to map an unfamiliar codebase, the honest way to answer is to grep, glob, and read a large number of files, and every one of those reads, run inline, would pile into your main conversation as raw output you will never look at again. Run the same exploration behind context: fork and all that searching happens in the subagent context. Your main thread receives a clean summary with the findings, not the hundreds of lines of file contents that produced it.
The result is a preserved context window. The expensive, single-use output stays in the fork and is discarded when the subagent finishes, leaving your main session lean for the work that actually depends on its full history. This is the same context-preservation rationale behind the Explore subagent in plan-mode workflows, and it is why noisy skills and forking are a natural pair.
How a forked skill runs
When a forked skill fires, three things happen in order. First, a new isolated context is created. Second, the subagent receives the skill content as its prompt, so whatever you wrote in the body becomes the task it executes. Third, the optional agent frontmatter field selects which subagent configuration runs it: built-in options such as Explore (read-only, tuned for codebase discovery) or Plan, general-purpose, or any custom subagent from .claude/agents/. If you omit agent, it defaults to general-purpose. The subagent then works independently and hands back a summary.
The crucial constraint is that the fork starts fresh: it cannot see your conversation history. The skill body has to carry everything the subagent needs to act, because there is no shared context to fall back on. That is why the documentation warns that context: fork only makes sense for skills with explicit instructions, a skill that merely says "use these API conventions" gives a forked subagent guidelines but no task, so it returns nothing useful.
Worked example
You build a /codebase-map skill that reads the directory tree, greps for entry points, and reads key modules to describe an unfamiliar repository. Run inline, a single invocation dumps thousands of lines of file contents into your session before you have written a line of code.
The symptom is context exhaustion. Each run of the inline skill floods the main conversation with raw reads and search hits, material you needed the subagent to look at, but never need to re-read yourself. A few invocations later, your context window is mostly stale file dumps, and the model attention on your actual task has thinned.
The fix is to fork. Add context: fork to the SKILL.md frontmatter and set agent: Explore, the read-only subagent built for exactly this kind of discovery. Now invoking /codebase-map spins up an isolated subagent whose prompt is your skill body; it does all the reading and grepping in its own context window and returns a concise architecture summary to your main thread. The noisy intermediate output lives and dies in the fork. Because the Explore agent starts without your conversation history, you make the skill body self-contained, it states what to map and how to report, so the subagent has a complete task. The payoff is a main session that gains the map without paying the context cost of producing it, which is the entire reason context: fork exists for verbose skills.
Choosing the agent the fork runs as
The agent field is where context: fork gets its character, because it decides what kind of subagent executes the skill. The built-in Explore agent is read-only and tuned for codebase discovery, which makes it the natural partner for a mapping or research skill; Plan is geared toward investigation that precedes a design; general-purpose is the flexible default used when you omit the field; and you can name any custom subagent defined in .claude/agents/. The choice matters for more than tools. The Explore and Plan agents deliberately skip loading CLAUDE.md and git status to keep their context small, so a forked skill using agent: Explore sees only your SKILL.md content and the agent own system prompt. That trimness is a feature for verbose discovery: you want the subagent lean and focused on the task you handed it, not carrying your whole project memory into a throwaway context. When a scenario calls for read-only exploration, pairing context: fork with agent: Explore is the idiomatic answer.
A simple cost model for forking
It helps to reason about forking as a context budget decision. Inline, every token a skill produces is spent from the one context window you are working in, and it stays spent for the rest of the session even after it has served its purpose. Forked, those same tokens are spent from a separate window that is discarded when the subagent returns, and your main session pays only for the short summary that comes back. So the question to ask of any skill is: how much of its output will I still need ten turns from now? If the answer is "almost none", true of file dumps, log scans, and brainstorming fan-out, forking is a clear win because it converts a large, permanent cost into a small one. If the answer is "most of it, and I want to see the reasoning as it happens", true of a focused refactor you are steering turn by turn, inline is right, because forking would hide the very output you need. The skill is matching the execution mode to how disposable the output is.
Writing a skill that survives the fork
Because a forked skill starts with no conversation history, the body has to stand on its own, and writing for that constraint is its own small discipline. State the task explicitly rather than referring to "the file we were just looking at" or "the bug from earlier," because the subagent has never seen any of it. Spell out what to examine, how to examine it, and exactly what to report back, since the only thing that returns to your main thread is the subagent summary, and a vague instruction yields a vague summary. Use argument placeholders such as $ARGUMENTS to pass in the specifics at invocation time, so the same self-contained skill can be pointed at different targets. The documentation is blunt about the failure mode here: a forked skill that contains guidelines without an actionable task gives the subagent nothing to do, and it returns empty-handed. A well-written forked skill reads like a complete brief to a colleague who knows the tools but none of your context, because that is precisely what the subagent is.
Common misreadings to avoid
Misconception
A forked skill can still see my conversation so far, so I can write the skill body assuming earlier context.
What's actually true
Misconception
context: fork improves any skill, so I should add it to my reference and convention skills too.
What's actually true
Fork and the wider context-preservation toolkit
It helps to see context: fork as one member of a family of context-preservation moves that recur across Domain 3, because the exam often tests them together. The Explore subagent isolates verbose discovery during planning; running a noisy skill in a fork isolates verbose execution; compacting trims a conversation that has grown long. All three share a single goal: keep the main context window dense with information that matters and free of single-use noise. Recognising that context: fork is the skill-level expression of the same instinct behind the Explore subagent makes both easier to remember, and it explains why the two are so often paired through the agent: Explore setting.
The unifying idea is that an architect treats the context window as a scarce, valuable resource to be budgeted deliberately rather than filled by accident. A skill that reads widely and reports narrowly is the perfect candidate for forking, because its value is the narrow report and its cost is the wide reading. Forking lets you keep the value and discard the cost. Holding that principle, isolate verbose, single-use work; preserve the main window for what you will reference again, lets you answer not just the context: fork questions but the broader reliability and context-management questions that Domain 3 and Domain 5 share.
How this shows up on the exam
In Domain 3 (20% of the exam), this apply-level knowledge point surfaces through Scenario 2 and Scenario 4 whenever a skill is described as verbose, noisy, or context-hungry. The tested instinct is recognising that the cure for a skill that floods the main conversation is isolation, not trimming the output by hand. Expect to choose context: fork (often paired with agent: Explore) as the remedy, and to reject distractors that leave a noisy skill inline or that fork a skill which has no real task to perform. Hold the rule, fork verbose, instruction-driven skills to preserve the main context window, and pair it with the broader skill design scenarios that ask you to weigh isolation alongside location and tool scope.
A developer complains that their /analyze-logs skill, which ingests and summarises large log files, fills the main conversation with raw log lines and pushes earlier context out of the window. Which change best addresses this?
People also ask
What does context: fork do in a Claude Code skill?
When should I use context: fork?
Does a forked skill see my conversation history?
Watch and learn
Official Anthropic Academy lessons first, then hand-picked walkthroughs. Videos load only when you press play.
Configuration and multi-file skills
Why watch: Using context: fork so a verbose skill runs in an isolated sub-agent context is exactly this KP.
More videos for this concept
References & primary sources
Master this concept with Archie
Practice it inside an adaptive study session. Archie, your Socratic AI tutor, tracks your mastery with Bayesian Knowledge Tracing and schedules the perfect next review.