feat: add Fork Subagent deep-dive comparison#36
Merged
Conversation
Comprehensive article on Claude Code's implicit fork mechanism vs Qwen Code's explicit agent tool. Covers: trigger decision tree, FORK_AGENT definition, message construction for prompt cache sharing, 4 cache consistency guarantees, 10 non-negotiable rules for fork children, dual-layer recursion guard, worktree isolation, async execution model, cost model comparison (105K vs 500K tokens for 5 subagents with 100K context). Key finding: Fork's core value is prompt cache economics — byte-identical API request prefixes allow N fork children to share one cache entry. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
07962a2 to
d944393
Compare
There was a problem hiding this comment.
Pull request overview
Adds a new deep-dive comparison article explaining Claude Code’s implicit Fork Subagent mechanism versus Qwen Code’s explicit Agent tool, with an emphasis on prompt-cache sharing and execution/recursion/isolation constraints.
Changes:
- Introduces a new comparison doc covering fork triggering, cache-key prefix construction, and consistency guarantees.
- Documents fork-specific rules (anti-recursion, structured output) plus async execution and worktree isolation behavior.
- Provides a side-by-side comparison and token-cost model versus Qwen Code.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1. Unified source paths: forkSubagent.ts# → tools/AgentTool/forkSubagent.ts# 2. Fixed assistant message diagram: added thinking+text to match description 3. Fixed line counts: forkSubagent.ts 211→210, forkedAgent.ts 690→689 (consistent with other docs citing wc -l) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
wenshao
added a commit
that referenced
this pull request
Apr 5, 2026
Closed PR #75 — 10 of 16 items duplicated existing 187. Source code references all verified correct (glm-5.1 self-corrected 8 errors). Extracted 4 new items to p2-tools: - #35 preserveQuoteStyle (quote style preservation in edits) - #36 areFileEditsInputsEquivalent (skip duplicate edits) - #37 MCP channel plugin allowlist - #38 SDK message type enrichment (11 → 30+ types) Total: 191 items. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
New comparison article
docs/comparison/fork-subagent-deep-dive.md(347 lines) covering Claude Code's implicit Fork Subagent mechanism vs Qwen Code's explicit Agent tool.Key Content
subagent_typeomitted → implicit fork (feature-gated)subagent_typerequired, no context inheritance, no cache sharingWhy this matters
Fork Subagent is Claude Code's most sophisticated prompt cache optimization — N children share one cache entry. Previously only mentioned briefly in
09-multi-agent.mdandqwen-code-improvement-report.md, never a dedicated deep-dive.Test plan
🤖 Generated with Claude Code